google_firebasehosting1_beta1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17 CloudPlatform,
18
19 /// View your data across Google Cloud services and see the email address of your Google Account
20 CloudPlatformReadOnly,
21
22 /// View and administer all your Firebase data and settings
23 Firebase,
24
25 /// View all your Firebase data and settings
26 FirebaseReadonly,
27}
28
29impl AsRef<str> for Scope {
30 fn as_ref(&self) -> &str {
31 match *self {
32 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
33 Scope::CloudPlatformReadOnly => {
34 "https://www.googleapis.com/auth/cloud-platform.read-only"
35 }
36 Scope::Firebase => "https://www.googleapis.com/auth/firebase",
37 Scope::FirebaseReadonly => "https://www.googleapis.com/auth/firebase.readonly",
38 }
39 }
40}
41
42#[allow(clippy::derivable_impls)]
43impl Default for Scope {
44 fn default() -> Scope {
45 Scope::FirebaseReadonly
46 }
47}
48
49// ########
50// HUB ###
51// ######
52
53/// Central instance to access all FirebaseHosting related resource activities
54///
55/// # Examples
56///
57/// Instantiate a new hub
58///
59/// ```test_harness,no_run
60/// extern crate hyper;
61/// extern crate hyper_rustls;
62/// extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
63/// use firebasehosting1_beta1::api::Site;
64/// use firebasehosting1_beta1::{Result, Error};
65/// # async fn dox() {
66/// use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
67///
68/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
69/// // `client_secret`, among other things.
70/// let secret: yup_oauth2::ApplicationSecret = Default::default();
71/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
72/// // unless you replace `None` with the desired Flow.
73/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
74/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
75/// // retrieve them from storage.
76/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
77/// secret,
78/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79/// ).build().await.unwrap();
80///
81/// let client = hyper_util::client::legacy::Client::builder(
82/// hyper_util::rt::TokioExecutor::new()
83/// )
84/// .build(
85/// hyper_rustls::HttpsConnectorBuilder::new()
86/// .with_native_roots()
87/// .unwrap()
88/// .https_or_http()
89/// .enable_http1()
90/// .build()
91/// );
92/// let mut hub = FirebaseHosting::new(client, auth);
93/// // As the method needs a request, you would usually fill it with the desired information
94/// // into the respective structure. Some of the parts shown here might not be applicable !
95/// // Values shown here are possibly random and not representative !
96/// let mut req = Site::default();
97///
98/// // You can configure optional parameters by calling the respective setters at will, and
99/// // execute the final call using `doit()`.
100/// // Values shown here are possibly random and not representative !
101/// let result = hub.projects().sites_create(req, "parent")
102/// .validate_only(true)
103/// .site_id("duo")
104/// .doit().await;
105///
106/// match result {
107/// Err(e) => match e {
108/// // The Error enum provides details about what exactly happened.
109/// // You can also just use its `Debug`, `Display` or `Error` traits
110/// Error::HttpError(_)
111/// |Error::Io(_)
112/// |Error::MissingAPIKey
113/// |Error::MissingToken(_)
114/// |Error::Cancelled
115/// |Error::UploadSizeLimitExceeded(_, _)
116/// |Error::Failure(_)
117/// |Error::BadRequest(_)
118/// |Error::FieldClash(_)
119/// |Error::JsonDecodeError(_, _) => println!("{}", e),
120/// },
121/// Ok(res) => println!("Success: {:?}", res),
122/// }
123/// # }
124/// ```
125#[derive(Clone)]
126pub struct FirebaseHosting<C> {
127 pub client: common::Client<C>,
128 pub auth: Box<dyn common::GetToken>,
129 _user_agent: String,
130 _base_url: String,
131 _root_url: String,
132}
133
134impl<C> common::Hub for FirebaseHosting<C> {}
135
136impl<'a, C> FirebaseHosting<C> {
137 pub fn new<A: 'static + common::GetToken>(
138 client: common::Client<C>,
139 auth: A,
140 ) -> FirebaseHosting<C> {
141 FirebaseHosting {
142 client,
143 auth: Box::new(auth),
144 _user_agent: "google-api-rust-client/6.0.0".to_string(),
145 _base_url: "https://firebasehosting.googleapis.com/".to_string(),
146 _root_url: "https://firebasehosting.googleapis.com/".to_string(),
147 }
148 }
149
150 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
151 ProjectMethods { hub: self }
152 }
153 pub fn sites(&'a self) -> SiteMethods<'a, C> {
154 SiteMethods { hub: self }
155 }
156
157 /// Set the user-agent header field to use in all requests to the server.
158 /// It defaults to `google-api-rust-client/6.0.0`.
159 ///
160 /// Returns the previously set user-agent.
161 pub fn user_agent(&mut self, agent_name: String) -> String {
162 std::mem::replace(&mut self._user_agent, agent_name)
163 }
164
165 /// Set the base url to use in all requests to the server.
166 /// It defaults to `https://firebasehosting.googleapis.com/`.
167 ///
168 /// Returns the previously set base url.
169 pub fn base_url(&mut self, new_base_url: String) -> String {
170 std::mem::replace(&mut self._base_url, new_base_url)
171 }
172
173 /// Set the root url to use in all requests to the server.
174 /// It defaults to `https://firebasehosting.googleapis.com/`.
175 ///
176 /// Returns the previously set root url.
177 pub fn root_url(&mut self, new_root_url: String) -> String {
178 std::mem::replace(&mut self._root_url, new_root_url)
179 }
180}
181
182// ############
183// SCHEMAS ###
184// ##########
185/// Contains metadata about the user who performed an action, such as creating a release or finalizing a version.
186///
187/// This type is not used in any activity, and only used as *part* of another schema.
188///
189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
190#[serde_with::serde_as]
191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
192pub struct ActingUser {
193 /// The email address of the user when the user performed the action.
194 pub email: Option<String>,
195 /// A profile image URL for the user. May not be present if the user has changed their email address or deleted their account.
196 #[serde(rename = "imageUrl")]
197 pub image_url: Option<String>,
198}
199
200impl common::Part for ActingUser {}
201
202/// Represents a DNS certificate challenge.
203///
204/// This type is not used in any activity, and only used as *part* of another schema.
205///
206#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
207#[serde_with::serde_as]
208#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
209pub struct CertDnsChallenge {
210 /// The domain name upon which the DNS challenge must be satisfied.
211 #[serde(rename = "domainName")]
212 pub domain_name: Option<String>,
213 /// The value that must be present as a TXT record on the domain name to satisfy the challenge.
214 pub token: Option<String>,
215}
216
217impl common::Part for CertDnsChallenge {}
218
219/// Represents an HTTP certificate challenge.
220///
221/// This type is not used in any activity, and only used as *part* of another schema.
222///
223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
224#[serde_with::serde_as]
225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
226pub struct CertHttpChallenge {
227 /// The URL path on which to serve the specified token to satisfy the certificate challenge.
228 pub path: Option<String>,
229 /// The token to serve at the specified URL path to satisfy the certificate challenge.
230 pub token: Option<String>,
231}
232
233impl common::Part for CertHttpChallenge {}
234
235/// A set of ACME challenges you can use to allow Hosting to create an SSL certificate for your domain name before directing traffic to Hosting servers. Use either the DNS or HTTP challenge; it's not necessary to provide both.
236///
237/// This type is not used in any activity, and only used as *part* of another schema.
238///
239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
240#[serde_with::serde_as]
241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
242pub struct CertVerification {
243 /// Output only. A `TXT` record to add to your DNS records that confirms your intent to let Hosting create an SSL cert for your domain name.
244 pub dns: Option<DnsUpdates>,
245 /// Output only. A file to add to your existing, non-Hosting hosting service that confirms your intent to let Hosting create an SSL cert for your domain name.
246 pub http: Option<HttpUpdate>,
247}
248
249impl common::Part for CertVerification {}
250
251/// An SSL certificate used to provide end-to-end encryption for requests against your domain name. A `Certificate` can be an actual SSL certificate or, for newly-created custom domains, Hosting's intent to create one.
252///
253/// This type is not used in any activity, and only used as *part* of another schema.
254///
255#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
256#[serde_with::serde_as]
257#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
258pub struct Certificate {
259 /// Output only. The certificate's creation time. For `TEMPORARY` certs this is the time Hosting first generated challenges for your domain name. For all other cert types, it's the time the actual cert was created.
260 #[serde(rename = "createTime")]
261 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
262 /// Output only. The certificate's expiration time. After this time, the cert can no longer be used to provide secure communication between Hosting and your site's visitors.
263 #[serde(rename = "expireTime")]
264 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
265 /// Output only. A set of errors Hosting encountered when attempting to create a cert for your domain name. Resolve these issues to ensure Hosting is able to provide secure communication with your site's visitors.
266 pub issues: Option<Vec<Status>>,
267 /// Output only. The state of the certificate. Only the `CERT_ACTIVE` and `CERT_EXPIRING_SOON` states provide SSL coverage for a domain name. If the state is `PROPAGATING` and Hosting had an active cert for the domain name before, that formerly-active cert provides SSL coverage for the domain name until the current cert propagates.
268 pub state: Option<String>,
269 /// Output only. The certificate's type.
270 #[serde(rename = "type")]
271 pub type_: Option<String>,
272 /// Output only. A set of ACME challenges you can add to your DNS records or existing, non-Hosting hosting provider to allow Hosting to create an SSL certificate for your domain name before you point traffic toward hosting. You can use thse challenges as part of a zero downtime transition from your old provider to Hosting.
273 pub verification: Option<CertVerification>,
274}
275
276impl common::Part for Certificate {}
277
278/// A `Channel` represents a stream of releases for a site. All sites have a default `live` channel that serves content to the Firebase-provided subdomains and any connected custom domains.
279///
280/// # Activities
281///
282/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
283/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
284///
285/// * [sites channels create projects](ProjectSiteChannelCreateCall) (request|response)
286/// * [sites channels get projects](ProjectSiteChannelGetCall) (response)
287/// * [sites channels patch projects](ProjectSiteChannelPatchCall) (request|response)
288/// * [channels create sites](SiteChannelCreateCall) (request|response)
289/// * [channels get sites](SiteChannelGetCall) (response)
290/// * [channels patch sites](SiteChannelPatchCall) (request|response)
291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
292#[serde_with::serde_as]
293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
294pub struct Channel {
295 /// Output only. The time at which the channel was created.
296 #[serde(rename = "createTime")]
297 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
298 /// The time at which the channel will be automatically deleted. If null, the channel will not be automatically deleted. This field is present in the output whether it's set directly or via the `ttl` field.
299 #[serde(rename = "expireTime")]
300 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
301 /// Text labels used for extra metadata and/or filtering.
302 pub labels: Option<HashMap<String, String>>,
303 /// The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
304 pub name: Option<String>,
305 /// Output only. The current release for the channel, if any.
306 pub release: Option<Release>,
307 /// The number of previous releases to retain on the channel for rollback or other purposes. Must be a number between 1-100. Defaults to 10 for new channels.
308 #[serde(rename = "retainedReleaseCount")]
309 pub retained_release_count: Option<i32>,
310 /// Input only. A time-to-live for this channel. Sets `expire_time` to the provided duration past the time of the request.
311 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
312 pub ttl: Option<chrono::Duration>,
313 /// Output only. The time at which the channel was last updated.
314 #[serde(rename = "updateTime")]
315 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
316 /// Output only. The URL at which the content of this channel's current release can be viewed. This URL is a Firebase-provided subdomain of `web.app`. The content of this channel's current release can also be viewed at the Firebase-provided subdomain of `firebaseapp.com`. If this channel is the `live` channel for the Hosting site, then the content of this channel's current release can also be viewed at any connected custom domains.
317 pub url: Option<String>,
318}
319
320impl common::RequestValue for Channel {}
321impl common::ResponseResult for Channel {}
322
323/// There is no detailed description.
324///
325/// # Activities
326///
327/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
328/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
329///
330/// * [sites versions clone projects](ProjectSiteVersionCloneCall) (request)
331/// * [versions clone sites](SiteVersionCloneCall) (request)
332#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
333#[serde_with::serde_as]
334#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
335pub struct CloneVersionRequest {
336 /// If provided, only paths that do not match any of the RegEx values in this list will be included in the new version.
337 pub exclude: Option<PathFilter>,
338 /// If true, the call to `CloneVersion` immediately finalizes the version after cloning is complete. If false, the cloned version will have a status of `CREATED`. Use [`UpdateVersion`](patch) to set the status of the version to `FINALIZED`.
339 pub finalize: Option<bool>,
340 /// If provided, only paths that match one or more RegEx values in this list will be included in the new version.
341 pub include: Option<PathFilter>,
342 /// Required. The unique identifier for the version to be cloned, in the format: sites/SITE_ID/versions/VERSION_ID
343 #[serde(rename = "sourceVersion")]
344 pub source_version: Option<String>,
345}
346
347impl common::RequestValue for CloneVersionRequest {}
348
349/// A configured rewrite that directs requests to a Cloud Run service. If the Cloud Run service does not exist when setting or updating your Firebase Hosting configuration, then the request fails. Any errors from the Cloud Run service are passed to the end user (for example, if you delete a service, any requests directed to that service receive a `404` error).
350///
351/// This type is not used in any activity, and only used as *part* of another schema.
352///
353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
354#[serde_with::serde_as]
355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
356pub struct CloudRunRewrite {
357 /// Optional. User-provided region where the Cloud Run service is hosted. Defaults to `us-central1` if not supplied.
358 pub region: Option<String>,
359 /// Required. User-defined ID of the Cloud Run service.
360 #[serde(rename = "serviceId")]
361 pub service_id: Option<String>,
362 /// Optional. User-provided TrafficConfig tag to send traffic to. When omitted, traffic is sent to the service-wide URI
363 pub tag: Option<String>,
364}
365
366impl common::Part for CloudRunRewrite {}
367
368/// A `CustomDomain` is an entity that links a domain name to a Firebase Hosting site. Add a `CustomDomain` to your site to allow Hosting to serve the site’s content in response to requests against your domain name.
369///
370/// # Activities
371///
372/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
373/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
374///
375/// * [sites custom domains create projects](ProjectSiteCustomDomainCreateCall) (request)
376/// * [sites custom domains get projects](ProjectSiteCustomDomainGetCall) (response)
377/// * [sites custom domains patch projects](ProjectSiteCustomDomainPatchCall) (request)
378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
379#[serde_with::serde_as]
380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
381pub struct CustomDomain {
382 /// Annotations you can add to leave both human- and machine-readable metadata about your `CustomDomain`.
383 pub annotations: Option<HashMap<String, String>>,
384 /// Output only. The SSL certificate Hosting has for this custom domain's domain name. For new custom domains, this often represents Hosting's intent to create a certificate, rather than an actual cert. Check the `state` field for more.
385 pub cert: Option<Certificate>,
386 /// A field that lets you specify which SSL certificate type Hosting creates for your domain name. Spark plan custom domains only have access to the `GROUPED` cert type, while Blaze plan domains can select any option.
387 #[serde(rename = "certPreference")]
388 pub cert_preference: Option<String>,
389 /// Output only. The custom domain's create time.
390 #[serde(rename = "createTime")]
391 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
392 /// Output only. The time the `CustomDomain` was deleted; null for custom domains that haven't been deleted. Deleted custom domains persist for approximately 30 days, after which time Hosting removes them completely. To restore a deleted custom domain, make an `UndeleteCustomDomain` request.
393 #[serde(rename = "deleteTime")]
394 pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
395 /// Output only. A string that represents the current state of the `CustomDomain` and allows you to confirm its initial state in requests that would modify it. Use the tag to ensure consistency when making `UpdateCustomDomain`, `DeleteCustomDomain`, and `UndeleteCustomDomain` requests.
396 pub etag: Option<String>,
397 /// Output only. The minimum time before a soft-deleted `CustomDomain` is completely removed from Hosting; null for custom domains that haven't been deleted.
398 #[serde(rename = "expireTime")]
399 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
400 /// Output only. The `HostState` of the domain name this `CustomDomain` refers to.
401 #[serde(rename = "hostState")]
402 pub host_state: Option<String>,
403 /// Output only. A set of errors Hosting systems encountered when trying to establish Hosting's ability to serve secure content for your domain name. Resolve these issues to ensure your `CustomDomain` behaves properly.
404 pub issues: Option<Vec<Status>>,
405 /// Labels used for extra metadata and/or filtering.
406 pub labels: Option<HashMap<String, String>>,
407 /// Output only. The fully-qualified name of the `CustomDomain`.
408 pub name: Option<String>,
409 /// Output only. The `OwnershipState` of the domain name this `CustomDomain` refers to.
410 #[serde(rename = "ownershipState")]
411 pub ownership_state: Option<String>,
412 /// Output only. A field that, if true, indicates that Hosting's systems are attmepting to make the custom domain's state match your preferred state. This is most frequently `true` when initially provisioning a `CustomDomain` after a `CreateCustomDomain` request or when creating a new SSL certificate to match an updated `cert_preference` after an `UpdateCustomDomain` request.
413 pub reconciling: Option<bool>,
414 /// A domain name that this `CustomDomain` should direct traffic towards. If specified, Hosting will respond to requests against this custom domain with an HTTP 301 code, and route traffic to the specified `redirect_target` instead.
415 #[serde(rename = "redirectTarget")]
416 pub redirect_target: Option<String>,
417 /// Output only. A set of updates you should make to the domain name's DNS records to let Hosting serve secure content on its behalf.
418 #[serde(rename = "requiredDnsUpdates")]
419 pub required_dns_updates: Option<DnsUpdates>,
420 /// Output only. The last time the `CustomDomain` was updated.
421 #[serde(rename = "updateTime")]
422 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
423}
424
425impl common::RequestValue for CustomDomain {}
426impl common::ResponseResult for CustomDomain {}
427
428/// DNS records are resource records that define how systems and services should behave when handling requests for a domain name. For example, when you add `A` records to your domain name's DNS records, you're informing other systems (such as your users' web browsers) to contact those IPv4 addresses to retrieve resources relevant to your domain name (such as your Hosting site files).
429///
430/// This type is not used in any activity, and only used as *part* of another schema.
431///
432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
433#[serde_with::serde_as]
434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
435pub struct DnsRecord {
436 /// Output only. The domain name the record pertains to, e.g. `foo.bar.com.`.
437 #[serde(rename = "domainName")]
438 pub domain_name: Option<String>,
439 /// Output only. The data of the record. The meaning of the value depends on record type: - A and AAAA: IP addresses for the domain name. - CNAME: Another domain to check for records. - TXT: Arbitrary text strings associated with the domain name. Hosting uses TXT records to determine which Firebase projects have permission to act on the domain name's behalf. - CAA: The record's flags, tag, and value, e.g. `0 issue "pki.goog"`.
440 pub rdata: Option<String>,
441 /// Output only. An enum that indicates the a required action for this record.
442 #[serde(rename = "requiredAction")]
443 pub required_action: Option<String>,
444 /// Output only. The record's type, which determines what data the record contains.
445 #[serde(rename = "type")]
446 pub type_: Option<String>,
447}
448
449impl common::Part for DnsRecord {}
450
451/// A set of DNS records relevant to the setup and maintenance of a custom domain in Firebase Hosting.
452///
453/// This type is not used in any activity, and only used as *part* of another schema.
454///
455#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
456#[serde_with::serde_as]
457#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
458pub struct DnsRecordSet {
459 /// Output only. An error Hosting services encountered when querying your domain name's DNS records. Note: Hosting ignores `NXDOMAIN` errors, as those generally just mean that a domain name hasn't been set up yet.
460 #[serde(rename = "checkError")]
461 pub check_error: Option<Status>,
462 /// Output only. The domain name the record set pertains to.
463 #[serde(rename = "domainName")]
464 pub domain_name: Option<String>,
465 /// Output only. Records on the domain.
466 pub records: Option<Vec<DnsRecord>>,
467}
468
469impl common::Part for DnsRecordSet {}
470
471/// A set of DNS record updates that you should make to allow Hosting to serve secure content in response to requests against your domain name. These updates present the current state of your domain name's DNS records when Hosting last queried them, and the desired set of records that Hosting needs to see before your custom domain can be fully active.
472///
473/// This type is not used in any activity, and only used as *part* of another schema.
474///
475#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
476#[serde_with::serde_as]
477#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
478pub struct DnsUpdates {
479 /// The last time Hosting checked your custom domain's DNS records.
480 #[serde(rename = "checkTime")]
481 pub check_time: Option<chrono::DateTime<chrono::offset::Utc>>,
482 /// The set of DNS records Hosting needs to serve secure content on the domain.
483 pub desired: Option<Vec<DnsRecordSet>>,
484 /// The set of DNS records Hosting discovered when inspecting a domain.
485 pub discovered: Option<Vec<DnsRecordSet>>,
486}
487
488impl common::Part for DnsUpdates {}
489
490/// The intended behavior and status information of a domain.
491///
492/// # Activities
493///
494/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
495/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
496///
497/// * [sites domains create projects](ProjectSiteDomainCreateCall) (request|response)
498/// * [sites domains get projects](ProjectSiteDomainGetCall) (response)
499/// * [sites domains update projects](ProjectSiteDomainUpdateCall) (request|response)
500/// * [domains create sites](SiteDomainCreateCall) (request|response)
501/// * [domains get sites](SiteDomainGetCall) (response)
502/// * [domains update sites](SiteDomainUpdateCall) (request|response)
503#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
504#[serde_with::serde_as]
505#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
506pub struct Domain {
507 /// Required. The domain name of the association.
508 #[serde(rename = "domainName")]
509 pub domain_name: Option<String>,
510 /// If set, the domain should redirect with the provided parameters.
511 #[serde(rename = "domainRedirect")]
512 pub domain_redirect: Option<DomainRedirect>,
513 /// Output only. Information about the provisioning of certificates and the health of the DNS resolution for the domain.
514 pub provisioning: Option<DomainProvisioning>,
515 /// Required. The site name of the association.
516 pub site: Option<String>,
517 /// Output only. Additional status of the domain association.
518 pub status: Option<String>,
519 /// Output only. The time at which the domain was last updated.
520 #[serde(rename = "updateTime")]
521 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
522}
523
524impl common::RequestValue for Domain {}
525impl common::ResponseResult for Domain {}
526
527/// The current certificate provisioning status information for a domain.
528///
529/// This type is not used in any activity, and only used as *part* of another schema.
530///
531#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
532#[serde_with::serde_as]
533#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
534pub struct DomainProvisioning {
535 /// The TXT records (for the certificate challenge) that were found at the last DNS fetch.
536 #[serde(rename = "certChallengeDiscoveredTxt")]
537 pub cert_challenge_discovered_txt: Option<Vec<String>>,
538 /// The DNS challenge for generating a certificate.
539 #[serde(rename = "certChallengeDns")]
540 pub cert_challenge_dns: Option<CertDnsChallenge>,
541 /// The HTTP challenge for generating a certificate.
542 #[serde(rename = "certChallengeHttp")]
543 pub cert_challenge_http: Option<CertHttpChallenge>,
544 /// The certificate provisioning status; updated when Firebase Hosting provisions an SSL certificate for the domain.
545 #[serde(rename = "certStatus")]
546 pub cert_status: Option<String>,
547 /// The IPs found at the last DNS fetch.
548 #[serde(rename = "discoveredIps")]
549 pub discovered_ips: Option<Vec<String>>,
550 /// The time at which the last DNS fetch occurred.
551 #[serde(rename = "dnsFetchTime")]
552 pub dns_fetch_time: Option<chrono::DateTime<chrono::offset::Utc>>,
553 /// The DNS record match status as of the last DNS fetch.
554 #[serde(rename = "dnsStatus")]
555 pub dns_status: Option<String>,
556 /// The list of IPs to which the domain is expected to resolve.
557 #[serde(rename = "expectedIps")]
558 pub expected_ips: Option<Vec<String>>,
559}
560
561impl common::Part for DomainProvisioning {}
562
563/// Defines the behavior of a domain-level redirect. Domain redirects preserve the path of the redirect but replace the requested domain with the one specified in the redirect configuration.
564///
565/// This type is not used in any activity, and only used as *part* of another schema.
566///
567#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
568#[serde_with::serde_as]
569#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
570pub struct DomainRedirect {
571 /// Required. The domain name to redirect to.
572 #[serde(rename = "domainName")]
573 pub domain_name: Option<String>,
574 /// Required. The redirect status code.
575 #[serde(rename = "type")]
576 pub type_: Option<String>,
577}
578
579impl common::Part for DomainRedirect {}
580
581/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
582///
583/// # Activities
584///
585/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
586/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
587///
588/// * [sites channels delete projects](ProjectSiteChannelDeleteCall) (response)
589/// * [sites domains delete projects](ProjectSiteDomainDeleteCall) (response)
590/// * [sites versions delete projects](ProjectSiteVersionDeleteCall) (response)
591/// * [sites delete projects](ProjectSiteDeleteCall) (response)
592/// * [channels delete sites](SiteChannelDeleteCall) (response)
593/// * [domains delete sites](SiteDomainDeleteCall) (response)
594/// * [versions delete sites](SiteVersionDeleteCall) (response)
595#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
596#[serde_with::serde_as]
597#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
598pub struct Empty {
599 _never_set: Option<bool>,
600}
601
602impl common::ResponseResult for Empty {}
603
604/// A [`Header`](https://firebase.google.com/docs/hosting/full-config#headers) specifies a URL pattern that, if matched to the request URL path, triggers Hosting to apply the specified custom response headers.
605///
606/// This type is not used in any activity, and only used as *part* of another schema.
607///
608#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
609#[serde_with::serde_as]
610#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
611pub struct Header {
612 /// The user-supplied [glob](https://firebase.google.com/docs/hosting/full-config#glob_pattern_matching) to match against the request URL path.
613 pub glob: Option<String>,
614 /// Required. The additional headers to add to the response.
615 pub headers: Option<HashMap<String, String>>,
616 /// The user-supplied RE2 regular expression to match against the request URL path.
617 pub regex: Option<String>,
618}
619
620impl common::Part for Header {}
621
622/// A file you can add to your existing, non-Hosting hosting service that confirms your intent to allow Hosting's Certificate Authorities to create an SSL certificate for your domain.
623///
624/// This type is not used in any activity, and only used as *part* of another schema.
625///
626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
627#[serde_with::serde_as]
628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
629pub struct HttpUpdate {
630 /// Output only. An error encountered during the last contents check. If null, the check completed successfully.
631 #[serde(rename = "checkError")]
632 pub check_error: Option<Status>,
633 /// Output only. A text string to serve at the path.
634 pub desired: Option<String>,
635 /// Output only. Whether Hosting was able to find the required file contents on the specified path during its last check.
636 pub discovered: Option<String>,
637 /// Output only. The last time Hosting systems checked for the file contents.
638 #[serde(rename = "lastCheckTime")]
639 pub last_check_time: Option<chrono::DateTime<chrono::offset::Utc>>,
640 /// Output only. The path to the file.
641 pub path: Option<String>,
642}
643
644impl common::Part for HttpUpdate {}
645
646/// If provided, i18n rewrites are enabled.
647///
648/// This type is not used in any activity, and only used as *part* of another schema.
649///
650#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
651#[serde_with::serde_as]
652#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
653pub struct I18nConfig {
654 /// Required. The user-supplied path where country and language specific content will be looked for within the public directory.
655 pub root: Option<String>,
656}
657
658impl common::Part for I18nConfig {}
659
660/// There is no detailed description.
661///
662/// # Activities
663///
664/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
665/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
666///
667/// * [sites channels list projects](ProjectSiteChannelListCall) (response)
668/// * [channels list sites](SiteChannelListCall) (response)
669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
670#[serde_with::serde_as]
671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
672pub struct ListChannelsResponse {
673 /// The list of channels.
674 pub channels: Option<Vec<Channel>>,
675 /// The pagination token, if more results exist beyond the ones in this response. Include this token in your next call to `ListChannels`. Page tokens are short-lived and should not be stored.
676 #[serde(rename = "nextPageToken")]
677 pub next_page_token: Option<String>,
678}
679
680impl common::ResponseResult for ListChannelsResponse {}
681
682/// The response from `ListCustomDomains`.
683///
684/// # Activities
685///
686/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
687/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
688///
689/// * [sites custom domains list projects](ProjectSiteCustomDomainListCall) (response)
690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
691#[serde_with::serde_as]
692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
693pub struct ListCustomDomainsResponse {
694 /// A list of `CustomDomain` entities associated with the specified Firebase `Site`.
695 #[serde(rename = "customDomains")]
696 pub custom_domains: Option<Vec<CustomDomain>>,
697 /// The pagination token, if more results exist beyond the ones in this response. Include this token in your next call to `ListCustomDomains`. Page tokens are short-lived and should not be stored.
698 #[serde(rename = "nextPageToken")]
699 pub next_page_token: Option<String>,
700}
701
702impl common::ResponseResult for ListCustomDomainsResponse {}
703
704/// The response to listing Domains.
705///
706/// # Activities
707///
708/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
709/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
710///
711/// * [sites domains list projects](ProjectSiteDomainListCall) (response)
712/// * [domains list sites](SiteDomainListCall) (response)
713#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
714#[serde_with::serde_as]
715#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
716pub struct ListDomainsResponse {
717 /// The list of domains, if any exist.
718 pub domains: Option<Vec<Domain>>,
719 /// The pagination token, if more results exist.
720 #[serde(rename = "nextPageToken")]
721 pub next_page_token: Option<String>,
722}
723
724impl common::ResponseResult for ListDomainsResponse {}
725
726/// The response message for Operations.ListOperations.
727///
728/// # Activities
729///
730/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
731/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
732///
733/// * [sites custom domains operations list projects](ProjectSiteCustomDomainOperationListCall) (response)
734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
735#[serde_with::serde_as]
736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
737pub struct ListOperationsResponse {
738 /// The standard List next-page token.
739 #[serde(rename = "nextPageToken")]
740 pub next_page_token: Option<String>,
741 /// A list of operations that matches the specified filter in the request.
742 pub operations: Option<Vec<Operation>>,
743}
744
745impl common::ResponseResult for ListOperationsResponse {}
746
747/// There is no detailed description.
748///
749/// # Activities
750///
751/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
752/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
753///
754/// * [sites channels releases list projects](ProjectSiteChannelReleaseListCall) (response)
755/// * [sites releases list projects](ProjectSiteReleaseListCall) (response)
756/// * [channels releases list sites](SiteChannelReleaseListCall) (response)
757/// * [releases list sites](SiteReleaseListCall) (response)
758#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
759#[serde_with::serde_as]
760#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
761pub struct ListReleasesResponse {
762 /// The pagination token, if more results exist beyond the ones in this response. Include this token in your next call to `ListReleases`. Page tokens are short-lived and should not be stored.
763 #[serde(rename = "nextPageToken")]
764 pub next_page_token: Option<String>,
765 /// The list of hashes of files that still need to be uploaded, if any exist.
766 pub releases: Option<Vec<Release>>,
767}
768
769impl common::ResponseResult for ListReleasesResponse {}
770
771/// There is no detailed description.
772///
773/// # Activities
774///
775/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
776/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
777///
778/// * [sites list projects](ProjectSiteListCall) (response)
779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
780#[serde_with::serde_as]
781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
782pub struct ListSitesResponse {
783 /// The pagination token, if more results exist beyond the ones in this response. Include this token in your next call to `ListSites`. Page tokens are short-lived and should not be stored.
784 #[serde(rename = "nextPageToken")]
785 pub next_page_token: Option<String>,
786 /// A list of Site objects associated with the specified Firebase project.
787 pub sites: Option<Vec<Site>>,
788}
789
790impl common::ResponseResult for ListSitesResponse {}
791
792/// There is no detailed description.
793///
794/// # Activities
795///
796/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
797/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
798///
799/// * [sites versions files list projects](ProjectSiteVersionFileListCall) (response)
800/// * [versions files list sites](SiteVersionFileListCall) (response)
801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
802#[serde_with::serde_as]
803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
804pub struct ListVersionFilesResponse {
805 /// The list of paths to the hashes of the files in the specified version.
806 pub files: Option<Vec<VersionFile>>,
807 /// The pagination token, if more results exist beyond the ones in this response. Include this token in your next call to `ListVersionFiles`. Page tokens are short-lived and should not be stored.
808 #[serde(rename = "nextPageToken")]
809 pub next_page_token: Option<String>,
810}
811
812impl common::ResponseResult for ListVersionFilesResponse {}
813
814/// There is no detailed description.
815///
816/// # Activities
817///
818/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
819/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
820///
821/// * [sites versions list projects](ProjectSiteVersionListCall) (response)
822/// * [versions list sites](SiteVersionListCall) (response)
823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
824#[serde_with::serde_as]
825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
826pub struct ListVersionsResponse {
827 /// The pagination token, if more results exist beyond the ones in this response. Include this token in your next call to `ListVersions`. Page tokens are short-lived and should not be stored.
828 #[serde(rename = "nextPageToken")]
829 pub next_page_token: Option<String>,
830 /// The list of versions, if any exist.
831 pub versions: Option<Vec<Version>>,
832}
833
834impl common::ResponseResult for ListVersionsResponse {}
835
836/// This resource represents a long-running operation that is the result of a network API call.
837///
838/// # Activities
839///
840/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
841/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
842///
843/// * [operations get projects](ProjectOperationGetCall) (response)
844/// * [sites custom domains operations get projects](ProjectSiteCustomDomainOperationGetCall) (response)
845/// * [sites custom domains create projects](ProjectSiteCustomDomainCreateCall) (response)
846/// * [sites custom domains delete projects](ProjectSiteCustomDomainDeleteCall) (response)
847/// * [sites custom domains patch projects](ProjectSiteCustomDomainPatchCall) (response)
848/// * [sites custom domains undelete projects](ProjectSiteCustomDomainUndeleteCall) (response)
849/// * [sites versions clone projects](ProjectSiteVersionCloneCall) (response)
850/// * [versions clone sites](SiteVersionCloneCall) (response)
851#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
852#[serde_with::serde_as]
853#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
854pub struct Operation {
855 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
856 pub done: Option<bool>,
857 /// The error result of the operation in case of failure or cancellation.
858 pub error: Option<Status>,
859 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
860 pub metadata: Option<HashMap<String, serde_json::Value>>,
861 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
862 pub name: Option<String>,
863 /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
864 pub response: Option<HashMap<String, serde_json::Value>>,
865}
866
867impl common::ResponseResult for Operation {}
868
869/// A representation of filter path.
870///
871/// This type is not used in any activity, and only used as *part* of another schema.
872///
873#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
874#[serde_with::serde_as]
875#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
876pub struct PathFilter {
877 /// An array of RegEx values by which to filter.
878 pub regexes: Option<Vec<String>>,
879}
880
881impl common::Part for PathFilter {}
882
883/// There is no detailed description.
884///
885/// # Activities
886///
887/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
888/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
889///
890/// * [sites versions populate files projects](ProjectSiteVersionPopulateFileCall) (request)
891/// * [versions populate files sites](SiteVersionPopulateFileCall) (request)
892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
893#[serde_with::serde_as]
894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
895pub struct PopulateVersionFilesRequest {
896 /// A set of file paths to the hashes corresponding to assets that should be added to the version. A file path to an empty hash will remove the path from the version. Calculate a hash by Gzipping the file then taking the SHA256 hash of the newly compressed file.
897 pub files: Option<HashMap<String, String>>,
898}
899
900impl common::RequestValue for PopulateVersionFilesRequest {}
901
902/// There is no detailed description.
903///
904/// # Activities
905///
906/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
907/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
908///
909/// * [sites versions populate files projects](ProjectSiteVersionPopulateFileCall) (response)
910/// * [versions populate files sites](SiteVersionPopulateFileCall) (response)
911#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
912#[serde_with::serde_as]
913#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
914pub struct PopulateVersionFilesResponse {
915 /// The content hashes of the specified files that need to be uploaded to the specified URL.
916 #[serde(rename = "uploadRequiredHashes")]
917 pub upload_required_hashes: Option<Vec<String>>,
918 /// The URL to which the files should be uploaded, in the format: "https://upload-firebasehosting.googleapis.com/upload/sites/SITE_ID /versions/VERSION_ID/files" Perform a multipart `POST` of the Gzipped file contents to the URL using a forward slash and the hash of the file appended to the end.
919 #[serde(rename = "uploadUrl")]
920 pub upload_url: Option<String>,
921}
922
923impl common::ResponseResult for PopulateVersionFilesResponse {}
924
925/// A [`Redirect`](https://firebase.google.com/docs/hosting/full-config#redirects) specifies a URL pattern that, if matched to the request URL path, triggers Hosting to respond with a redirect to the specified destination path.
926///
927/// This type is not used in any activity, and only used as *part* of another schema.
928///
929#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
930#[serde_with::serde_as]
931#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
932pub struct Redirect {
933 /// The user-supplied [glob](https://firebase.google.com/docs/hosting/full-config#glob_pattern_matching) to match against the request URL path.
934 pub glob: Option<String>,
935 /// Required. The value to put in the HTTP location header of the response. The location can contain capture group values from the pattern using a `:` prefix to identify the segment and an optional `*` to capture the rest of the URL. For example: "glob": "/:capture*", "statusCode": 301, "location": "https://example.com/foo/:capture"
936 pub location: Option<String>,
937 /// The user-supplied RE2 regular expression to match against the request URL path.
938 pub regex: Option<String>,
939 /// Required. The status HTTP code to return in the response. It must be a valid 3xx status code.
940 #[serde(rename = "statusCode")]
941 pub status_code: Option<i32>,
942}
943
944impl common::Part for Redirect {}
945
946/// A `Release` is a particular [collection of configurations and files](sites.versions) that is set to be public at a particular time.
947///
948/// # Activities
949///
950/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
951/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
952///
953/// * [sites channels releases create projects](ProjectSiteChannelReleaseCreateCall) (request|response)
954/// * [sites channels releases get projects](ProjectSiteChannelReleaseGetCall) (response)
955/// * [sites releases create projects](ProjectSiteReleaseCreateCall) (request|response)
956/// * [sites releases get projects](ProjectSiteReleaseGetCall) (response)
957/// * [channels releases create sites](SiteChannelReleaseCreateCall) (request|response)
958/// * [channels releases get sites](SiteChannelReleaseGetCall) (response)
959/// * [releases create sites](SiteReleaseCreateCall) (request|response)
960/// * [releases get sites](SiteReleaseGetCall) (response)
961#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
962#[serde_with::serde_as]
963#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
964pub struct Release {
965 /// The deploy description when the release was created. The value can be up to 512 characters.
966 pub message: Option<String>,
967 /// Output only. The unique identifier for the release, in either of the following formats: - sites/SITE_ID/releases/RELEASE_ID - sites/SITE_ID/channels/CHANNEL_ID/releases/RELEASE_ID This name is provided in the response body when you call [`releases.create`](sites.releases/create) or [`channels.releases.create`](sites.channels.releases/create).
968 pub name: Option<String>,
969 /// Output only. The time at which the version is set to be public.
970 #[serde(rename = "releaseTime")]
971 pub release_time: Option<chrono::DateTime<chrono::offset::Utc>>,
972 /// Output only. Identifies the user who created the release.
973 #[serde(rename = "releaseUser")]
974 pub release_user: Option<ActingUser>,
975 /// Explains the reason for the release. Specify a value for this field only when creating a `SITE_DISABLE` type release.
976 #[serde(rename = "type")]
977 pub type_: Option<String>,
978 /// Output only. The configuration and content that was released.
979 pub version: Option<Version>,
980}
981
982impl common::RequestValue for Release {}
983impl common::ResponseResult for Release {}
984
985/// A [`Rewrite`](https://firebase.google.com/docs/hosting/full-config#rewrites) specifies a URL pattern that, if matched to the request URL path, triggers Hosting to respond as if the service were given the specified destination URL.
986///
987/// This type is not used in any activity, and only used as *part* of another schema.
988///
989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
990#[serde_with::serde_as]
991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
992pub struct Rewrite {
993 /// The request will be forwarded to Firebase Dynamic Links.
994 #[serde(rename = "dynamicLinks")]
995 pub dynamic_links: Option<bool>,
996 /// The function to proxy requests to. Must match the exported function name exactly.
997 pub function: Option<String>,
998 /// Optional. Specify a Cloud region for rewritten Functions invocations. If not provided, defaults to us-central1.
999 #[serde(rename = "functionRegion")]
1000 pub function_region: Option<String>,
1001 /// The user-supplied [glob](https://firebase.google.com/docs/hosting/full-config#glob_pattern_matching) to match against the request URL path.
1002 pub glob: Option<String>,
1003 /// The URL path to rewrite the request to.
1004 pub path: Option<String>,
1005 /// The user-supplied RE2 regular expression to match against the request URL path.
1006 pub regex: Option<String>,
1007 /// The request will be forwarded to Cloud Run.
1008 pub run: Option<CloudRunRewrite>,
1009}
1010
1011impl common::Part for Rewrite {}
1012
1013/// The configuration for how incoming requests to a site should be routed and processed before serving content. The URL request paths are matched against the specified URL patterns in the configuration, then Hosting applies the applicable configuration according to a specific [priority order](https://firebase.google.com/docs/hosting/full-config#hosting_priority_order).
1014///
1015/// This type is not used in any activity, and only used as *part* of another schema.
1016///
1017#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1018#[serde_with::serde_as]
1019#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1020pub struct ServingConfig {
1021 /// How to handle well known App Association files.
1022 #[serde(rename = "appAssociation")]
1023 pub app_association: Option<String>,
1024 /// Defines whether to drop the file extension from uploaded files.
1025 #[serde(rename = "cleanUrls")]
1026 pub clean_urls: Option<bool>,
1027 /// An array of objects, where each object specifies a URL pattern that, if matched to the request URL path, triggers Hosting to apply the specified custom response headers.
1028 pub headers: Option<Vec<Header>>,
1029 /// Optional. Defines i18n rewrite behavior.
1030 pub i18n: Option<I18nConfig>,
1031 /// An array of objects (called redirect rules), where each rule specifies a URL pattern that, if matched to the request URL path, triggers Hosting to respond with a redirect to the specified destination path.
1032 pub redirects: Option<Vec<Redirect>>,
1033 /// An array of objects (called rewrite rules), where each rule specifies a URL pattern that, if matched to the request URL path, triggers Hosting to respond as if the service were given the specified destination URL.
1034 pub rewrites: Option<Vec<Rewrite>>,
1035 /// Defines how to handle a trailing slash in the URL path.
1036 #[serde(rename = "trailingSlashBehavior")]
1037 pub trailing_slash_behavior: Option<String>,
1038}
1039
1040impl common::Part for ServingConfig {}
1041
1042/// A `Site` represents a Firebase Hosting site.
1043///
1044/// # Activities
1045///
1046/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1047/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1048///
1049/// * [sites create projects](ProjectSiteCreateCall) (request|response)
1050/// * [sites get projects](ProjectSiteGetCall) (response)
1051/// * [sites patch projects](ProjectSitePatchCall) (request|response)
1052/// * [channels releases create sites](SiteChannelReleaseCreateCall) (none)
1053/// * [channels releases get sites](SiteChannelReleaseGetCall) (none)
1054/// * [channels releases list sites](SiteChannelReleaseListCall) (none)
1055/// * [channels create sites](SiteChannelCreateCall) (none)
1056/// * [channels delete sites](SiteChannelDeleteCall) (none)
1057/// * [channels get sites](SiteChannelGetCall) (none)
1058/// * [channels list sites](SiteChannelListCall) (none)
1059/// * [channels patch sites](SiteChannelPatchCall) (none)
1060/// * [domains create sites](SiteDomainCreateCall) (none)
1061/// * [domains delete sites](SiteDomainDeleteCall) (none)
1062/// * [domains get sites](SiteDomainGetCall) (none)
1063/// * [domains list sites](SiteDomainListCall) (none)
1064/// * [domains update sites](SiteDomainUpdateCall) (none)
1065/// * [releases create sites](SiteReleaseCreateCall) (none)
1066/// * [releases get sites](SiteReleaseGetCall) (none)
1067/// * [releases list sites](SiteReleaseListCall) (none)
1068/// * [versions files list sites](SiteVersionFileListCall) (none)
1069/// * [versions clone sites](SiteVersionCloneCall) (none)
1070/// * [versions create sites](SiteVersionCreateCall) (none)
1071/// * [versions delete sites](SiteVersionDeleteCall) (none)
1072/// * [versions get sites](SiteVersionGetCall) (none)
1073/// * [versions list sites](SiteVersionListCall) (none)
1074/// * [versions patch sites](SiteVersionPatchCall) (none)
1075/// * [versions populate files sites](SiteVersionPopulateFileCall) (none)
1076/// * [get config sites](SiteGetConfigCall) (none)
1077/// * [update config sites](SiteUpdateConfigCall) (none)
1078#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1079#[serde_with::serde_as]
1080#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1081pub struct Site {
1082 /// Optional. The [ID of a Web App](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.webApps#WebApp.FIELDS.app_id) associated with the Hosting site.
1083 #[serde(rename = "appId")]
1084 pub app_id: Option<String>,
1085 /// Output only. The default URL for the Hosting site.
1086 #[serde(rename = "defaultUrl")]
1087 pub default_url: Option<String>,
1088 /// Optional. User-specified labels for the Hosting site.
1089 pub labels: Option<HashMap<String, String>>,
1090 /// Output only. The fully-qualified resource name of the Hosting site, in the format: projects/PROJECT_IDENTIFIER/sites/SITE_ID PROJECT_IDENTIFIER: the Firebase project's [`ProjectNumber`](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects#FirebaseProject.FIELDS.project_number) ***(recommended)*** or its [`ProjectId`](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects#FirebaseProject.FIELDS.project_id). Learn more about using project identifiers in Google's [AIP 2510 standard](https://google.aip.dev/cloud/2510).
1091 pub name: Option<String>,
1092 /// Output only. The type of Hosting site. Every Firebase project has a `DEFAULT_SITE`, which is created when Hosting is provisioned for the project. All additional sites are `USER_SITE`.
1093 #[serde(rename = "type")]
1094 pub type_: Option<String>,
1095}
1096
1097impl common::RequestValue for Site {}
1098impl common::Resource for Site {}
1099impl common::ResponseResult for Site {}
1100
1101/// A `SiteConfig` contains metadata associated with a specific site that controls Firebase Hosting serving behavior
1102///
1103/// # Activities
1104///
1105/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1106/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1107///
1108/// * [sites get config projects](ProjectSiteGetConfigCall) (response)
1109/// * [sites update config projects](ProjectSiteUpdateConfigCall) (request|response)
1110/// * [get config sites](SiteGetConfigCall) (response)
1111/// * [update config sites](SiteUpdateConfigCall) (request|response)
1112#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1113#[serde_with::serde_as]
1114#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1115pub struct SiteConfig {
1116 /// Whether or not web requests made by site visitors are logged via Cloud Logging.
1117 #[serde(rename = "cloudLoggingEnabled")]
1118 pub cloud_logging_enabled: Option<bool>,
1119 /// The number of FINALIZED versions that will be held for a site before automatic deletion. When a new version is deployed, content for versions in storage in excess of this number will be deleted, and will no longer be billed for storage usage. Oldest versions will be deleted first; sites are created with an unlimited number of max_versions by default.
1120 #[serde(rename = "maxVersions")]
1121 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1122 pub max_versions: Option<i64>,
1123}
1124
1125impl common::RequestValue for SiteConfig {}
1126impl common::ResponseResult for SiteConfig {}
1127
1128/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
1129///
1130/// This type is not used in any activity, and only used as *part* of another schema.
1131///
1132#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1133#[serde_with::serde_as]
1134#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1135pub struct Status {
1136 /// The status code, which should be an enum value of google.rpc.Code.
1137 pub code: Option<i32>,
1138 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1139 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1140 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1141 pub message: Option<String>,
1142}
1143
1144impl common::Part for Status {}
1145
1146/// The request sent to `UndeleteCustomDomain`.
1147///
1148/// # Activities
1149///
1150/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1151/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1152///
1153/// * [sites custom domains undelete projects](ProjectSiteCustomDomainUndeleteCall) (request)
1154#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1155#[serde_with::serde_as]
1156#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1157pub struct UndeleteCustomDomainRequest {
1158 /// A tag that represents the state of the `CustomDomain` as you know it. If present, the supplied tag must match the current value on your `CustomDomain`, or the request fails.
1159 pub etag: Option<String>,
1160 /// If true, Hosting validates that it's possible to complete your request but doesn't actually delete the `CustomDomain`.
1161 #[serde(rename = "validateOnly")]
1162 pub validate_only: Option<bool>,
1163}
1164
1165impl common::RequestValue for UndeleteCustomDomainRequest {}
1166
1167/// A `Version` is a configuration and a collection of static files which determine how a site is displayed.
1168///
1169/// # Activities
1170///
1171/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1172/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1173///
1174/// * [sites versions create projects](ProjectSiteVersionCreateCall) (request|response)
1175/// * [sites versions get projects](ProjectSiteVersionGetCall) (response)
1176/// * [sites versions patch projects](ProjectSiteVersionPatchCall) (request|response)
1177/// * [versions create sites](SiteVersionCreateCall) (request|response)
1178/// * [versions get sites](SiteVersionGetCall) (response)
1179/// * [versions patch sites](SiteVersionPatchCall) (request|response)
1180#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1181#[serde_with::serde_as]
1182#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1183pub struct Version {
1184 /// The configuration for the behavior of the site. This configuration exists in the [`firebase.json`](https://firebase.google.com/docs/cli/#the_firebasejson_file) file.
1185 pub config: Option<ServingConfig>,
1186 /// Output only. The time at which the version was created.
1187 #[serde(rename = "createTime")]
1188 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1189 /// Output only. Identifies the user who created the version.
1190 #[serde(rename = "createUser")]
1191 pub create_user: Option<ActingUser>,
1192 /// Output only. The time at which the version was `DELETED`.
1193 #[serde(rename = "deleteTime")]
1194 pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1195 /// Output only. Identifies the user who `DELETED` the version.
1196 #[serde(rename = "deleteUser")]
1197 pub delete_user: Option<ActingUser>,
1198 /// Output only. The total number of files associated with the version. This value is calculated after a version is `FINALIZED`.
1199 #[serde(rename = "fileCount")]
1200 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1201 pub file_count: Option<i64>,
1202 /// Output only. The time at which the version was `FINALIZED`.
1203 #[serde(rename = "finalizeTime")]
1204 pub finalize_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1205 /// Output only. Identifies the user who `FINALIZED` the version.
1206 #[serde(rename = "finalizeUser")]
1207 pub finalize_user: Option<ActingUser>,
1208 /// The labels used for extra metadata and/or filtering.
1209 pub labels: Option<HashMap<String, String>>,
1210 /// The fully-qualified resource name for the version, in the format: sites/ SITE_ID/versions/VERSION_ID This name is provided in the response body when you call [`CreateVersion`](sites.versions/create).
1211 pub name: Option<String>,
1212 /// The deploy status of the version. For a successful deploy, call [`CreateVersion`](sites.versions/create) to make a new version (`CREATED` status), [upload all desired files](sites.versions/populateFiles) to the version, then [update](sites.versions/patch) the version to the `FINALIZED` status. Note that if you leave the version in the `CREATED` state for more than 12 hours, the system will automatically mark the version as `ABANDONED`. You can also change the status of a version to `DELETED` by calling [`DeleteVersion`](sites.versions/delete).
1213 pub status: Option<String>,
1214 /// Output only. The total stored bytesize of the version. This value is calculated after a version is `FINALIZED`.
1215 #[serde(rename = "versionBytes")]
1216 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1217 pub version_bytes: Option<i64>,
1218}
1219
1220impl common::RequestValue for Version {}
1221impl common::ResponseResult for Version {}
1222
1223/// A static content file that is part of a version.
1224///
1225/// This type is not used in any activity, and only used as *part* of another schema.
1226///
1227#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1228#[serde_with::serde_as]
1229#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1230pub struct VersionFile {
1231 /// The SHA256 content hash of the file.
1232 pub hash: Option<String>,
1233 /// The URI at which the file's content should display.
1234 pub path: Option<String>,
1235 /// Output only. The current status of a particular file in the specified version. The value will be either `pending upload` or `uploaded`.
1236 pub status: Option<String>,
1237}
1238
1239impl common::Part for VersionFile {}
1240
1241// ###################
1242// MethodBuilders ###
1243// #################
1244
1245/// A builder providing access to all methods supported on *project* resources.
1246/// It is not used directly, but through the [`FirebaseHosting`] hub.
1247///
1248/// # Example
1249///
1250/// Instantiate a resource builder
1251///
1252/// ```test_harness,no_run
1253/// extern crate hyper;
1254/// extern crate hyper_rustls;
1255/// extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
1256///
1257/// # async fn dox() {
1258/// use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1259///
1260/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1261/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1262/// secret,
1263/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1264/// ).build().await.unwrap();
1265///
1266/// let client = hyper_util::client::legacy::Client::builder(
1267/// hyper_util::rt::TokioExecutor::new()
1268/// )
1269/// .build(
1270/// hyper_rustls::HttpsConnectorBuilder::new()
1271/// .with_native_roots()
1272/// .unwrap()
1273/// .https_or_http()
1274/// .enable_http1()
1275/// .build()
1276/// );
1277/// let mut hub = FirebaseHosting::new(client, auth);
1278/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1279/// // like `operations_get(...)`, `sites_channels_create(...)`, `sites_channels_delete(...)`, `sites_channels_get(...)`, `sites_channels_list(...)`, `sites_channels_patch(...)`, `sites_channels_releases_create(...)`, `sites_channels_releases_get(...)`, `sites_channels_releases_list(...)`, `sites_create(...)`, `sites_custom_domains_create(...)`, `sites_custom_domains_delete(...)`, `sites_custom_domains_get(...)`, `sites_custom_domains_list(...)`, `sites_custom_domains_operations_get(...)`, `sites_custom_domains_operations_list(...)`, `sites_custom_domains_patch(...)`, `sites_custom_domains_undelete(...)`, `sites_delete(...)`, `sites_domains_create(...)`, `sites_domains_delete(...)`, `sites_domains_get(...)`, `sites_domains_list(...)`, `sites_domains_update(...)`, `sites_get(...)`, `sites_get_config(...)`, `sites_list(...)`, `sites_patch(...)`, `sites_releases_create(...)`, `sites_releases_get(...)`, `sites_releases_list(...)`, `sites_update_config(...)`, `sites_versions_clone(...)`, `sites_versions_create(...)`, `sites_versions_delete(...)`, `sites_versions_files_list(...)`, `sites_versions_get(...)`, `sites_versions_list(...)`, `sites_versions_patch(...)` and `sites_versions_populate_files(...)`
1280/// // to build up your call.
1281/// let rb = hub.projects();
1282/// # }
1283/// ```
1284pub struct ProjectMethods<'a, C>
1285where
1286 C: 'a,
1287{
1288 hub: &'a FirebaseHosting<C>,
1289}
1290
1291impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1292
1293impl<'a, C> ProjectMethods<'a, C> {
1294 /// Create a builder to help you perform the following task:
1295 ///
1296 /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
1297 ///
1298 /// # Arguments
1299 ///
1300 /// * `name` - The name of the operation resource.
1301 pub fn operations_get(&self, name: &str) -> ProjectOperationGetCall<'a, C> {
1302 ProjectOperationGetCall {
1303 hub: self.hub,
1304 _name: name.to_string(),
1305 _delegate: Default::default(),
1306 _additional_params: Default::default(),
1307 _scopes: Default::default(),
1308 }
1309 }
1310
1311 /// Create a builder to help you perform the following task:
1312 ///
1313 /// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
1314 ///
1315 /// # Arguments
1316 ///
1317 /// * `request` - No description provided.
1318 /// * `parent` - Required. The site or channel to which the release belongs, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
1319 pub fn sites_channels_releases_create(
1320 &self,
1321 request: Release,
1322 parent: &str,
1323 ) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
1324 ProjectSiteChannelReleaseCreateCall {
1325 hub: self.hub,
1326 _request: request,
1327 _parent: parent.to_string(),
1328 _version_name: Default::default(),
1329 _delegate: Default::default(),
1330 _additional_params: Default::default(),
1331 _scopes: Default::default(),
1332 }
1333 }
1334
1335 /// Create a builder to help you perform the following task:
1336 ///
1337 /// Gets the specified release for a site or channel. When used to get a release for a site, this can get releases for both the default `live` channel and any active preview channels for the specified site.
1338 ///
1339 /// # Arguments
1340 ///
1341 /// * `name` - Required. The fully-qualified resource name for the Hosting release, in either of the following formats: - sites/SITE_ID/channels/CHANNEL_ID/releases/RELEASE_ID - sites/SITE_ID/releases/RELEASE_ID
1342 pub fn sites_channels_releases_get(
1343 &self,
1344 name: &str,
1345 ) -> ProjectSiteChannelReleaseGetCall<'a, C> {
1346 ProjectSiteChannelReleaseGetCall {
1347 hub: self.hub,
1348 _name: name.to_string(),
1349 _delegate: Default::default(),
1350 _additional_params: Default::default(),
1351 _scopes: Default::default(),
1352 }
1353 }
1354
1355 /// Create a builder to help you perform the following task:
1356 ///
1357 /// Lists the releases that have been created for the specified site or channel. When used to list releases for a site, this list includes releases for both the default `live` channel and any active preview channels for the specified site.
1358 ///
1359 /// # Arguments
1360 ///
1361 /// * `parent` - Required. The site or channel for which to list releases, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
1362 pub fn sites_channels_releases_list(
1363 &self,
1364 parent: &str,
1365 ) -> ProjectSiteChannelReleaseListCall<'a, C> {
1366 ProjectSiteChannelReleaseListCall {
1367 hub: self.hub,
1368 _parent: parent.to_string(),
1369 _page_token: Default::default(),
1370 _page_size: Default::default(),
1371 _delegate: Default::default(),
1372 _additional_params: Default::default(),
1373 _scopes: Default::default(),
1374 }
1375 }
1376
1377 /// Create a builder to help you perform the following task:
1378 ///
1379 /// Creates a new channel in the specified site.
1380 ///
1381 /// # Arguments
1382 ///
1383 /// * `request` - No description provided.
1384 /// * `parent` - Required. The site in which to create this channel, in the format: sites/ SITE_ID
1385 pub fn sites_channels_create(
1386 &self,
1387 request: Channel,
1388 parent: &str,
1389 ) -> ProjectSiteChannelCreateCall<'a, C> {
1390 ProjectSiteChannelCreateCall {
1391 hub: self.hub,
1392 _request: request,
1393 _parent: parent.to_string(),
1394 _channel_id: Default::default(),
1395 _delegate: Default::default(),
1396 _additional_params: Default::default(),
1397 _scopes: Default::default(),
1398 }
1399 }
1400
1401 /// Create a builder to help you perform the following task:
1402 ///
1403 /// Deletes the specified channel of the specified site. The `live` channel cannot be deleted.
1404 ///
1405 /// # Arguments
1406 ///
1407 /// * `name` - Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
1408 pub fn sites_channels_delete(&self, name: &str) -> ProjectSiteChannelDeleteCall<'a, C> {
1409 ProjectSiteChannelDeleteCall {
1410 hub: self.hub,
1411 _name: name.to_string(),
1412 _delegate: Default::default(),
1413 _additional_params: Default::default(),
1414 _scopes: Default::default(),
1415 }
1416 }
1417
1418 /// Create a builder to help you perform the following task:
1419 ///
1420 /// Retrieves information for the specified channel of the specified site.
1421 ///
1422 /// # Arguments
1423 ///
1424 /// * `name` - Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
1425 pub fn sites_channels_get(&self, name: &str) -> ProjectSiteChannelGetCall<'a, C> {
1426 ProjectSiteChannelGetCall {
1427 hub: self.hub,
1428 _name: name.to_string(),
1429 _delegate: Default::default(),
1430 _additional_params: Default::default(),
1431 _scopes: Default::default(),
1432 }
1433 }
1434
1435 /// Create a builder to help you perform the following task:
1436 ///
1437 /// Lists the channels for the specified site. All sites have a default `live` channel.
1438 ///
1439 /// # Arguments
1440 ///
1441 /// * `parent` - Required. The site for which to list channels, in the format: sites/SITE_ID
1442 pub fn sites_channels_list(&self, parent: &str) -> ProjectSiteChannelListCall<'a, C> {
1443 ProjectSiteChannelListCall {
1444 hub: self.hub,
1445 _parent: parent.to_string(),
1446 _page_token: Default::default(),
1447 _page_size: Default::default(),
1448 _delegate: Default::default(),
1449 _additional_params: Default::default(),
1450 _scopes: Default::default(),
1451 }
1452 }
1453
1454 /// Create a builder to help you perform the following task:
1455 ///
1456 /// Updates information for the specified channel of the specified site. Implicitly creates the channel if it doesn't already exist.
1457 ///
1458 /// # Arguments
1459 ///
1460 /// * `request` - No description provided.
1461 /// * `name` - The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
1462 pub fn sites_channels_patch(
1463 &self,
1464 request: Channel,
1465 name: &str,
1466 ) -> ProjectSiteChannelPatchCall<'a, C> {
1467 ProjectSiteChannelPatchCall {
1468 hub: self.hub,
1469 _request: request,
1470 _name: name.to_string(),
1471 _update_mask: Default::default(),
1472 _delegate: Default::default(),
1473 _additional_params: Default::default(),
1474 _scopes: Default::default(),
1475 }
1476 }
1477
1478 /// Create a builder to help you perform the following task:
1479 ///
1480 /// Gets the latest state of a long-running operation. Use this method to poll the operation result at intervals as recommended by the API service.
1481 ///
1482 /// # Arguments
1483 ///
1484 /// * `name` - The name of the operation resource.
1485 pub fn sites_custom_domains_operations_get(
1486 &self,
1487 name: &str,
1488 ) -> ProjectSiteCustomDomainOperationGetCall<'a, C> {
1489 ProjectSiteCustomDomainOperationGetCall {
1490 hub: self.hub,
1491 _name: name.to_string(),
1492 _delegate: Default::default(),
1493 _additional_params: Default::default(),
1494 _scopes: Default::default(),
1495 }
1496 }
1497
1498 /// Create a builder to help you perform the following task:
1499 ///
1500 /// Lists operations that match the specified filter in the request.
1501 ///
1502 /// # Arguments
1503 ///
1504 /// * `name` - The name of the operation's parent resource.
1505 pub fn sites_custom_domains_operations_list(
1506 &self,
1507 name: &str,
1508 ) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
1509 ProjectSiteCustomDomainOperationListCall {
1510 hub: self.hub,
1511 _name: name.to_string(),
1512 _page_token: Default::default(),
1513 _page_size: Default::default(),
1514 _filter: Default::default(),
1515 _delegate: Default::default(),
1516 _additional_params: Default::default(),
1517 _scopes: Default::default(),
1518 }
1519 }
1520
1521 /// Create a builder to help you perform the following task:
1522 ///
1523 /// Creates a `CustomDomain`.
1524 ///
1525 /// # Arguments
1526 ///
1527 /// * `request` - No description provided.
1528 /// * `parent` - Required. The custom domain's parent, specifically a Firebase Hosting `Site`.
1529 pub fn sites_custom_domains_create(
1530 &self,
1531 request: CustomDomain,
1532 parent: &str,
1533 ) -> ProjectSiteCustomDomainCreateCall<'a, C> {
1534 ProjectSiteCustomDomainCreateCall {
1535 hub: self.hub,
1536 _request: request,
1537 _parent: parent.to_string(),
1538 _validate_only: Default::default(),
1539 _custom_domain_id: Default::default(),
1540 _delegate: Default::default(),
1541 _additional_params: Default::default(),
1542 _scopes: Default::default(),
1543 }
1544 }
1545
1546 /// Create a builder to help you perform the following task:
1547 ///
1548 /// Deletes the specified `CustomDomain`.
1549 ///
1550 /// # Arguments
1551 ///
1552 /// * `name` - Required. The name of the `CustomDomain` to delete.
1553 pub fn sites_custom_domains_delete(
1554 &self,
1555 name: &str,
1556 ) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
1557 ProjectSiteCustomDomainDeleteCall {
1558 hub: self.hub,
1559 _name: name.to_string(),
1560 _validate_only: Default::default(),
1561 _etag: Default::default(),
1562 _allow_missing: Default::default(),
1563 _delegate: Default::default(),
1564 _additional_params: Default::default(),
1565 _scopes: Default::default(),
1566 }
1567 }
1568
1569 /// Create a builder to help you perform the following task:
1570 ///
1571 /// Gets the specified `CustomDomain`.
1572 ///
1573 /// # Arguments
1574 ///
1575 /// * `name` - Required. The name of the `CustomDomain` to get.
1576 pub fn sites_custom_domains_get(&self, name: &str) -> ProjectSiteCustomDomainGetCall<'a, C> {
1577 ProjectSiteCustomDomainGetCall {
1578 hub: self.hub,
1579 _name: name.to_string(),
1580 _delegate: Default::default(),
1581 _additional_params: Default::default(),
1582 _scopes: Default::default(),
1583 }
1584 }
1585
1586 /// Create a builder to help you perform the following task:
1587 ///
1588 /// Lists each `CustomDomain` associated with the specified parent Hosting site. Returns `CustomDomain`s in a consistent, but undefined, order to facilitate pagination.
1589 ///
1590 /// # Arguments
1591 ///
1592 /// * `parent` - Required. The Firebase Hosting `Site` with `CustomDomain` entities you'd like to list.
1593 pub fn sites_custom_domains_list(
1594 &self,
1595 parent: &str,
1596 ) -> ProjectSiteCustomDomainListCall<'a, C> {
1597 ProjectSiteCustomDomainListCall {
1598 hub: self.hub,
1599 _parent: parent.to_string(),
1600 _show_deleted: Default::default(),
1601 _page_token: Default::default(),
1602 _page_size: Default::default(),
1603 _delegate: Default::default(),
1604 _additional_params: Default::default(),
1605 _scopes: Default::default(),
1606 }
1607 }
1608
1609 /// Create a builder to help you perform the following task:
1610 ///
1611 /// Updates the specified `CustomDomain`.
1612 ///
1613 /// # Arguments
1614 ///
1615 /// * `request` - No description provided.
1616 /// * `name` - Output only. The fully-qualified name of the `CustomDomain`.
1617 pub fn sites_custom_domains_patch(
1618 &self,
1619 request: CustomDomain,
1620 name: &str,
1621 ) -> ProjectSiteCustomDomainPatchCall<'a, C> {
1622 ProjectSiteCustomDomainPatchCall {
1623 hub: self.hub,
1624 _request: request,
1625 _name: name.to_string(),
1626 _validate_only: Default::default(),
1627 _update_mask: Default::default(),
1628 _allow_missing: Default::default(),
1629 _delegate: Default::default(),
1630 _additional_params: Default::default(),
1631 _scopes: Default::default(),
1632 }
1633 }
1634
1635 /// Create a builder to help you perform the following task:
1636 ///
1637 /// Undeletes the specified `CustomDomain` if it has been soft-deleted. Hosting retains soft-deleted custom domains for around 30 days before permanently deleting them.
1638 ///
1639 /// # Arguments
1640 ///
1641 /// * `request` - No description provided.
1642 /// * `name` - Required. The name of the `CustomDomain` to delete.
1643 pub fn sites_custom_domains_undelete(
1644 &self,
1645 request: UndeleteCustomDomainRequest,
1646 name: &str,
1647 ) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
1648 ProjectSiteCustomDomainUndeleteCall {
1649 hub: self.hub,
1650 _request: request,
1651 _name: name.to_string(),
1652 _delegate: Default::default(),
1653 _additional_params: Default::default(),
1654 _scopes: Default::default(),
1655 }
1656 }
1657
1658 /// Create a builder to help you perform the following task:
1659 ///
1660 /// Creates a domain mapping on the specified site.
1661 ///
1662 /// # Arguments
1663 ///
1664 /// * `request` - No description provided.
1665 /// * `parent` - Required. The parent to create the domain association for, in the format: sites/site-name
1666 pub fn sites_domains_create(
1667 &self,
1668 request: Domain,
1669 parent: &str,
1670 ) -> ProjectSiteDomainCreateCall<'a, C> {
1671 ProjectSiteDomainCreateCall {
1672 hub: self.hub,
1673 _request: request,
1674 _parent: parent.to_string(),
1675 _delegate: Default::default(),
1676 _additional_params: Default::default(),
1677 _scopes: Default::default(),
1678 }
1679 }
1680
1681 /// Create a builder to help you perform the following task:
1682 ///
1683 /// Deletes the existing domain mapping on the specified site.
1684 ///
1685 /// # Arguments
1686 ///
1687 /// * `name` - Required. The name of the domain association to delete.
1688 pub fn sites_domains_delete(&self, name: &str) -> ProjectSiteDomainDeleteCall<'a, C> {
1689 ProjectSiteDomainDeleteCall {
1690 hub: self.hub,
1691 _name: name.to_string(),
1692 _delegate: Default::default(),
1693 _additional_params: Default::default(),
1694 _scopes: Default::default(),
1695 }
1696 }
1697
1698 /// Create a builder to help you perform the following task:
1699 ///
1700 /// Gets a domain mapping on the specified site.
1701 ///
1702 /// # Arguments
1703 ///
1704 /// * `name` - Required. The name of the domain configuration to get.
1705 pub fn sites_domains_get(&self, name: &str) -> ProjectSiteDomainGetCall<'a, C> {
1706 ProjectSiteDomainGetCall {
1707 hub: self.hub,
1708 _name: name.to_string(),
1709 _delegate: Default::default(),
1710 _additional_params: Default::default(),
1711 _scopes: Default::default(),
1712 }
1713 }
1714
1715 /// Create a builder to help you perform the following task:
1716 ///
1717 /// Lists the domains for the specified site.
1718 ///
1719 /// # Arguments
1720 ///
1721 /// * `parent` - Required. The parent for which to list domains, in the format: sites/ site-name
1722 pub fn sites_domains_list(&self, parent: &str) -> ProjectSiteDomainListCall<'a, C> {
1723 ProjectSiteDomainListCall {
1724 hub: self.hub,
1725 _parent: parent.to_string(),
1726 _page_token: Default::default(),
1727 _page_size: Default::default(),
1728 _delegate: Default::default(),
1729 _additional_params: Default::default(),
1730 _scopes: Default::default(),
1731 }
1732 }
1733
1734 /// Create a builder to help you perform the following task:
1735 ///
1736 /// Updates the specified domain mapping, creating the mapping as if it does not exist.
1737 ///
1738 /// # Arguments
1739 ///
1740 /// * `request` - No description provided.
1741 /// * `name` - Required. The name of the domain association to update or create, if an association doesn't already exist.
1742 pub fn sites_domains_update(
1743 &self,
1744 request: Domain,
1745 name: &str,
1746 ) -> ProjectSiteDomainUpdateCall<'a, C> {
1747 ProjectSiteDomainUpdateCall {
1748 hub: self.hub,
1749 _request: request,
1750 _name: name.to_string(),
1751 _delegate: Default::default(),
1752 _additional_params: Default::default(),
1753 _scopes: Default::default(),
1754 }
1755 }
1756
1757 /// Create a builder to help you perform the following task:
1758 ///
1759 /// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
1760 ///
1761 /// # Arguments
1762 ///
1763 /// * `request` - No description provided.
1764 /// * `parent` - Required. The site or channel to which the release belongs, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
1765 pub fn sites_releases_create(
1766 &self,
1767 request: Release,
1768 parent: &str,
1769 ) -> ProjectSiteReleaseCreateCall<'a, C> {
1770 ProjectSiteReleaseCreateCall {
1771 hub: self.hub,
1772 _request: request,
1773 _parent: parent.to_string(),
1774 _version_name: Default::default(),
1775 _delegate: Default::default(),
1776 _additional_params: Default::default(),
1777 _scopes: Default::default(),
1778 }
1779 }
1780
1781 /// Create a builder to help you perform the following task:
1782 ///
1783 /// Gets the specified release for a site or channel. When used to get a release for a site, this can get releases for both the default `live` channel and any active preview channels for the specified site.
1784 ///
1785 /// # Arguments
1786 ///
1787 /// * `name` - Required. The fully-qualified resource name for the Hosting release, in either of the following formats: - sites/SITE_ID/channels/CHANNEL_ID/releases/RELEASE_ID - sites/SITE_ID/releases/RELEASE_ID
1788 pub fn sites_releases_get(&self, name: &str) -> ProjectSiteReleaseGetCall<'a, C> {
1789 ProjectSiteReleaseGetCall {
1790 hub: self.hub,
1791 _name: name.to_string(),
1792 _delegate: Default::default(),
1793 _additional_params: Default::default(),
1794 _scopes: Default::default(),
1795 }
1796 }
1797
1798 /// Create a builder to help you perform the following task:
1799 ///
1800 /// Lists the releases that have been created for the specified site or channel. When used to list releases for a site, this list includes releases for both the default `live` channel and any active preview channels for the specified site.
1801 ///
1802 /// # Arguments
1803 ///
1804 /// * `parent` - Required. The site or channel for which to list releases, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
1805 pub fn sites_releases_list(&self, parent: &str) -> ProjectSiteReleaseListCall<'a, C> {
1806 ProjectSiteReleaseListCall {
1807 hub: self.hub,
1808 _parent: parent.to_string(),
1809 _page_token: Default::default(),
1810 _page_size: Default::default(),
1811 _delegate: Default::default(),
1812 _additional_params: Default::default(),
1813 _scopes: Default::default(),
1814 }
1815 }
1816
1817 /// Create a builder to help you perform the following task:
1818 ///
1819 /// Lists the remaining files to be uploaded for the specified version.
1820 ///
1821 /// # Arguments
1822 ///
1823 /// * `parent` - Required. The version for which to list files, in the format: sites/SITE_ID /versions/VERSION_ID
1824 pub fn sites_versions_files_list(&self, parent: &str) -> ProjectSiteVersionFileListCall<'a, C> {
1825 ProjectSiteVersionFileListCall {
1826 hub: self.hub,
1827 _parent: parent.to_string(),
1828 _status: Default::default(),
1829 _page_token: Default::default(),
1830 _page_size: Default::default(),
1831 _delegate: Default::default(),
1832 _additional_params: Default::default(),
1833 _scopes: Default::default(),
1834 }
1835 }
1836
1837 /// Create a builder to help you perform the following task:
1838 ///
1839 /// Creates a new version on the specified target site using the content of the specified version.
1840 ///
1841 /// # Arguments
1842 ///
1843 /// * `request` - No description provided.
1844 /// * `parent` - Required. The target site for the cloned version, in the format: sites/ SITE_ID
1845 pub fn sites_versions_clone(
1846 &self,
1847 request: CloneVersionRequest,
1848 parent: &str,
1849 ) -> ProjectSiteVersionCloneCall<'a, C> {
1850 ProjectSiteVersionCloneCall {
1851 hub: self.hub,
1852 _request: request,
1853 _parent: parent.to_string(),
1854 _delegate: Default::default(),
1855 _additional_params: Default::default(),
1856 _scopes: Default::default(),
1857 }
1858 }
1859
1860 /// Create a builder to help you perform the following task:
1861 ///
1862 /// Creates a new version for the specified site.
1863 ///
1864 /// # Arguments
1865 ///
1866 /// * `request` - No description provided.
1867 /// * `parent` - Required. The site in which to create the version, in the format: sites/ SITE_ID
1868 pub fn sites_versions_create(
1869 &self,
1870 request: Version,
1871 parent: &str,
1872 ) -> ProjectSiteVersionCreateCall<'a, C> {
1873 ProjectSiteVersionCreateCall {
1874 hub: self.hub,
1875 _request: request,
1876 _parent: parent.to_string(),
1877 _version_id: Default::default(),
1878 _size_bytes: Default::default(),
1879 _delegate: Default::default(),
1880 _additional_params: Default::default(),
1881 _scopes: Default::default(),
1882 }
1883 }
1884
1885 /// Create a builder to help you perform the following task:
1886 ///
1887 /// Deletes the specified version.
1888 ///
1889 /// # Arguments
1890 ///
1891 /// * `name` - Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
1892 pub fn sites_versions_delete(&self, name: &str) -> ProjectSiteVersionDeleteCall<'a, C> {
1893 ProjectSiteVersionDeleteCall {
1894 hub: self.hub,
1895 _name: name.to_string(),
1896 _delegate: Default::default(),
1897 _additional_params: Default::default(),
1898 _scopes: Default::default(),
1899 }
1900 }
1901
1902 /// Create a builder to help you perform the following task:
1903 ///
1904 /// Get the specified version that has been created for the specified site. This can include versions that were created for the default `live` channel or for any active preview channels for the specified site.
1905 ///
1906 /// # Arguments
1907 ///
1908 /// * `name` - Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
1909 pub fn sites_versions_get(&self, name: &str) -> ProjectSiteVersionGetCall<'a, C> {
1910 ProjectSiteVersionGetCall {
1911 hub: self.hub,
1912 _name: name.to_string(),
1913 _delegate: Default::default(),
1914 _additional_params: Default::default(),
1915 _scopes: Default::default(),
1916 }
1917 }
1918
1919 /// Create a builder to help you perform the following task:
1920 ///
1921 /// Lists the versions that have been created for the specified site. This list includes versions for both the default `live` channel and any active preview channels for the specified site.
1922 ///
1923 /// # Arguments
1924 ///
1925 /// * `parent` - Required. The site or channel for which to list versions, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
1926 pub fn sites_versions_list(&self, parent: &str) -> ProjectSiteVersionListCall<'a, C> {
1927 ProjectSiteVersionListCall {
1928 hub: self.hub,
1929 _parent: parent.to_string(),
1930 _page_token: Default::default(),
1931 _page_size: Default::default(),
1932 _filter: Default::default(),
1933 _delegate: Default::default(),
1934 _additional_params: Default::default(),
1935 _scopes: Default::default(),
1936 }
1937 }
1938
1939 /// Create a builder to help you perform the following task:
1940 ///
1941 /// Updates the specified metadata for the specified version. This method will fail with `FAILED_PRECONDITION` in the event of an invalid state transition. The supported [state](https://firebase.google.com/docs/hosting/../sites.versions#versionstatus) transitions for a version are from `CREATED` to `FINALIZED`. Use [`DeleteVersion`](delete) to set the status of a version to `DELETED`.
1942 ///
1943 /// # Arguments
1944 ///
1945 /// * `request` - No description provided.
1946 /// * `name` - The fully-qualified resource name for the version, in the format: sites/ SITE_ID/versions/VERSION_ID This name is provided in the response body when you call [`CreateVersion`](sites.versions/create).
1947 pub fn sites_versions_patch(
1948 &self,
1949 request: Version,
1950 name: &str,
1951 ) -> ProjectSiteVersionPatchCall<'a, C> {
1952 ProjectSiteVersionPatchCall {
1953 hub: self.hub,
1954 _request: request,
1955 _name: name.to_string(),
1956 _update_mask: Default::default(),
1957 _delegate: Default::default(),
1958 _additional_params: Default::default(),
1959 _scopes: Default::default(),
1960 }
1961 }
1962
1963 /// Create a builder to help you perform the following task:
1964 ///
1965 /// Adds content files to the specified version. Each file must be under 2 GB.
1966 ///
1967 /// # Arguments
1968 ///
1969 /// * `request` - No description provided.
1970 /// * `parent` - Required. The version to which to add files, in the format: sites/SITE_ID /versions/VERSION_ID
1971 pub fn sites_versions_populate_files(
1972 &self,
1973 request: PopulateVersionFilesRequest,
1974 parent: &str,
1975 ) -> ProjectSiteVersionPopulateFileCall<'a, C> {
1976 ProjectSiteVersionPopulateFileCall {
1977 hub: self.hub,
1978 _request: request,
1979 _parent: parent.to_string(),
1980 _delegate: Default::default(),
1981 _additional_params: Default::default(),
1982 _scopes: Default::default(),
1983 }
1984 }
1985
1986 /// Create a builder to help you perform the following task:
1987 ///
1988 /// Creates a new Hosting Site in the specified parent Firebase project. Note that Hosting sites can take several minutes to propagate through Firebase systems.
1989 ///
1990 /// # Arguments
1991 ///
1992 /// * `request` - No description provided.
1993 /// * `parent` - Required. The Firebase project in which to create a Hosting site, in the format: projects/PROJECT_IDENTIFIER Refer to the `Site` [`name`](https://firebase.google.com/docs/hosting/../projects#Site.FIELDS.name) field for details about PROJECT_IDENTIFIER values.
1994 pub fn sites_create(&self, request: Site, parent: &str) -> ProjectSiteCreateCall<'a, C> {
1995 ProjectSiteCreateCall {
1996 hub: self.hub,
1997 _request: request,
1998 _parent: parent.to_string(),
1999 _validate_only: Default::default(),
2000 _site_id: Default::default(),
2001 _delegate: Default::default(),
2002 _additional_params: Default::default(),
2003 _scopes: Default::default(),
2004 }
2005 }
2006
2007 /// Create a builder to help you perform the following task:
2008 ///
2009 /// Deletes the specified Hosting Site from the specified parent Firebase project.
2010 ///
2011 /// # Arguments
2012 ///
2013 /// * `name` - Required. The fully-qualified resource name for the Hosting site, in the format: projects/PROJECT_IDENTIFIER/sites/SITE_ID Refer to the `Site` [`name`](https://firebase.google.com/docs/hosting/../projects#Site.FIELDS.name) field for details about PROJECT_IDENTIFIER values.
2014 pub fn sites_delete(&self, name: &str) -> ProjectSiteDeleteCall<'a, C> {
2015 ProjectSiteDeleteCall {
2016 hub: self.hub,
2017 _name: name.to_string(),
2018 _delegate: Default::default(),
2019 _additional_params: Default::default(),
2020 _scopes: Default::default(),
2021 }
2022 }
2023
2024 /// Create a builder to help you perform the following task:
2025 ///
2026 /// Gets the specified Hosting Site.
2027 ///
2028 /// # Arguments
2029 ///
2030 /// * `name` - Required. The fully-qualified resource name for the Hosting site, in the format: projects/PROJECT_IDENTIFIER/sites/SITE_ID Refer to the `Site` [`name`](https://firebase.google.com/docs/hosting/../projects#Site.FIELDS.name) field for details about PROJECT_IDENTIFIER values. Since a SITE_ID is a globally unique identifier, you can also use the unique sub-collection resource access pattern, in the format: projects/-/sites/SITE_ID
2031 pub fn sites_get(&self, name: &str) -> ProjectSiteGetCall<'a, C> {
2032 ProjectSiteGetCall {
2033 hub: self.hub,
2034 _name: name.to_string(),
2035 _delegate: Default::default(),
2036 _additional_params: Default::default(),
2037 _scopes: Default::default(),
2038 }
2039 }
2040
2041 /// Create a builder to help you perform the following task:
2042 ///
2043 /// Gets the Hosting metadata for a specific site.
2044 ///
2045 /// # Arguments
2046 ///
2047 /// * `name` - Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
2048 pub fn sites_get_config(&self, name: &str) -> ProjectSiteGetConfigCall<'a, C> {
2049 ProjectSiteGetConfigCall {
2050 hub: self.hub,
2051 _name: name.to_string(),
2052 _delegate: Default::default(),
2053 _additional_params: Default::default(),
2054 _scopes: Default::default(),
2055 }
2056 }
2057
2058 /// Create a builder to help you perform the following task:
2059 ///
2060 /// Lists each Hosting Site associated with the specified parent Firebase project.
2061 ///
2062 /// # Arguments
2063 ///
2064 /// * `parent` - Required. The Firebase project for which to list sites, in the format: projects/PROJECT_IDENTIFIER Refer to the `Site` [`name`](https://firebase.google.com/docs/hosting/../projects#Site.FIELDS.name) field for details about PROJECT_IDENTIFIER values.
2065 pub fn sites_list(&self, parent: &str) -> ProjectSiteListCall<'a, C> {
2066 ProjectSiteListCall {
2067 hub: self.hub,
2068 _parent: parent.to_string(),
2069 _page_token: Default::default(),
2070 _page_size: Default::default(),
2071 _delegate: Default::default(),
2072 _additional_params: Default::default(),
2073 _scopes: Default::default(),
2074 }
2075 }
2076
2077 /// Create a builder to help you perform the following task:
2078 ///
2079 /// Updates attributes of the specified Hosting Site.
2080 ///
2081 /// # Arguments
2082 ///
2083 /// * `request` - No description provided.
2084 /// * `name` - Output only. The fully-qualified resource name of the Hosting site, in the format: projects/PROJECT_IDENTIFIER/sites/SITE_ID PROJECT_IDENTIFIER: the Firebase project's [`ProjectNumber`](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects#FirebaseProject.FIELDS.project_number) ***(recommended)*** or its [`ProjectId`](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects#FirebaseProject.FIELDS.project_id). Learn more about using project identifiers in Google's [AIP 2510 standard](https://google.aip.dev/cloud/2510).
2085 pub fn sites_patch(&self, request: Site, name: &str) -> ProjectSitePatchCall<'a, C> {
2086 ProjectSitePatchCall {
2087 hub: self.hub,
2088 _request: request,
2089 _name: name.to_string(),
2090 _update_mask: Default::default(),
2091 _delegate: Default::default(),
2092 _additional_params: Default::default(),
2093 _scopes: Default::default(),
2094 }
2095 }
2096
2097 /// Create a builder to help you perform the following task:
2098 ///
2099 /// Sets the Hosting metadata for a specific site.
2100 ///
2101 /// # Arguments
2102 ///
2103 /// * `request` - No description provided.
2104 /// * `name` - Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
2105 pub fn sites_update_config(
2106 &self,
2107 request: SiteConfig,
2108 name: &str,
2109 ) -> ProjectSiteUpdateConfigCall<'a, C> {
2110 ProjectSiteUpdateConfigCall {
2111 hub: self.hub,
2112 _request: request,
2113 _name: name.to_string(),
2114 _update_mask: Default::default(),
2115 _delegate: Default::default(),
2116 _additional_params: Default::default(),
2117 _scopes: Default::default(),
2118 }
2119 }
2120}
2121
2122/// A builder providing access to all methods supported on *site* resources.
2123/// It is not used directly, but through the [`FirebaseHosting`] hub.
2124///
2125/// # Example
2126///
2127/// Instantiate a resource builder
2128///
2129/// ```test_harness,no_run
2130/// extern crate hyper;
2131/// extern crate hyper_rustls;
2132/// extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
2133///
2134/// # async fn dox() {
2135/// use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2136///
2137/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2138/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2139/// secret,
2140/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2141/// ).build().await.unwrap();
2142///
2143/// let client = hyper_util::client::legacy::Client::builder(
2144/// hyper_util::rt::TokioExecutor::new()
2145/// )
2146/// .build(
2147/// hyper_rustls::HttpsConnectorBuilder::new()
2148/// .with_native_roots()
2149/// .unwrap()
2150/// .https_or_http()
2151/// .enable_http1()
2152/// .build()
2153/// );
2154/// let mut hub = FirebaseHosting::new(client, auth);
2155/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2156/// // like `channels_create(...)`, `channels_delete(...)`, `channels_get(...)`, `channels_list(...)`, `channels_patch(...)`, `channels_releases_create(...)`, `channels_releases_get(...)`, `channels_releases_list(...)`, `domains_create(...)`, `domains_delete(...)`, `domains_get(...)`, `domains_list(...)`, `domains_update(...)`, `get_config(...)`, `releases_create(...)`, `releases_get(...)`, `releases_list(...)`, `update_config(...)`, `versions_clone(...)`, `versions_create(...)`, `versions_delete(...)`, `versions_files_list(...)`, `versions_get(...)`, `versions_list(...)`, `versions_patch(...)` and `versions_populate_files(...)`
2157/// // to build up your call.
2158/// let rb = hub.sites();
2159/// # }
2160/// ```
2161pub struct SiteMethods<'a, C>
2162where
2163 C: 'a,
2164{
2165 hub: &'a FirebaseHosting<C>,
2166}
2167
2168impl<'a, C> common::MethodsBuilder for SiteMethods<'a, C> {}
2169
2170impl<'a, C> SiteMethods<'a, C> {
2171 /// Create a builder to help you perform the following task:
2172 ///
2173 /// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
2174 ///
2175 /// # Arguments
2176 ///
2177 /// * `request` - No description provided.
2178 /// * `parent` - Required. The site or channel to which the release belongs, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
2179 pub fn channels_releases_create(
2180 &self,
2181 request: Release,
2182 parent: &str,
2183 ) -> SiteChannelReleaseCreateCall<'a, C> {
2184 SiteChannelReleaseCreateCall {
2185 hub: self.hub,
2186 _request: request,
2187 _parent: parent.to_string(),
2188 _version_name: Default::default(),
2189 _delegate: Default::default(),
2190 _additional_params: Default::default(),
2191 _scopes: Default::default(),
2192 }
2193 }
2194
2195 /// Create a builder to help you perform the following task:
2196 ///
2197 /// Gets the specified release for a site or channel. When used to get a release for a site, this can get releases for both the default `live` channel and any active preview channels for the specified site.
2198 ///
2199 /// # Arguments
2200 ///
2201 /// * `name` - Required. The fully-qualified resource name for the Hosting release, in either of the following formats: - sites/SITE_ID/channels/CHANNEL_ID/releases/RELEASE_ID - sites/SITE_ID/releases/RELEASE_ID
2202 pub fn channels_releases_get(&self, name: &str) -> SiteChannelReleaseGetCall<'a, C> {
2203 SiteChannelReleaseGetCall {
2204 hub: self.hub,
2205 _name: name.to_string(),
2206 _delegate: Default::default(),
2207 _additional_params: Default::default(),
2208 _scopes: Default::default(),
2209 }
2210 }
2211
2212 /// Create a builder to help you perform the following task:
2213 ///
2214 /// Lists the releases that have been created for the specified site or channel. When used to list releases for a site, this list includes releases for both the default `live` channel and any active preview channels for the specified site.
2215 ///
2216 /// # Arguments
2217 ///
2218 /// * `parent` - Required. The site or channel for which to list releases, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
2219 pub fn channels_releases_list(&self, parent: &str) -> SiteChannelReleaseListCall<'a, C> {
2220 SiteChannelReleaseListCall {
2221 hub: self.hub,
2222 _parent: parent.to_string(),
2223 _page_token: Default::default(),
2224 _page_size: Default::default(),
2225 _delegate: Default::default(),
2226 _additional_params: Default::default(),
2227 _scopes: Default::default(),
2228 }
2229 }
2230
2231 /// Create a builder to help you perform the following task:
2232 ///
2233 /// Creates a new channel in the specified site.
2234 ///
2235 /// # Arguments
2236 ///
2237 /// * `request` - No description provided.
2238 /// * `parent` - Required. The site in which to create this channel, in the format: sites/ SITE_ID
2239 pub fn channels_create(&self, request: Channel, parent: &str) -> SiteChannelCreateCall<'a, C> {
2240 SiteChannelCreateCall {
2241 hub: self.hub,
2242 _request: request,
2243 _parent: parent.to_string(),
2244 _channel_id: Default::default(),
2245 _delegate: Default::default(),
2246 _additional_params: Default::default(),
2247 _scopes: Default::default(),
2248 }
2249 }
2250
2251 /// Create a builder to help you perform the following task:
2252 ///
2253 /// Deletes the specified channel of the specified site. The `live` channel cannot be deleted.
2254 ///
2255 /// # Arguments
2256 ///
2257 /// * `name` - Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
2258 pub fn channels_delete(&self, name: &str) -> SiteChannelDeleteCall<'a, C> {
2259 SiteChannelDeleteCall {
2260 hub: self.hub,
2261 _name: name.to_string(),
2262 _delegate: Default::default(),
2263 _additional_params: Default::default(),
2264 _scopes: Default::default(),
2265 }
2266 }
2267
2268 /// Create a builder to help you perform the following task:
2269 ///
2270 /// Retrieves information for the specified channel of the specified site.
2271 ///
2272 /// # Arguments
2273 ///
2274 /// * `name` - Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
2275 pub fn channels_get(&self, name: &str) -> SiteChannelGetCall<'a, C> {
2276 SiteChannelGetCall {
2277 hub: self.hub,
2278 _name: name.to_string(),
2279 _delegate: Default::default(),
2280 _additional_params: Default::default(),
2281 _scopes: Default::default(),
2282 }
2283 }
2284
2285 /// Create a builder to help you perform the following task:
2286 ///
2287 /// Lists the channels for the specified site. All sites have a default `live` channel.
2288 ///
2289 /// # Arguments
2290 ///
2291 /// * `parent` - Required. The site for which to list channels, in the format: sites/SITE_ID
2292 pub fn channels_list(&self, parent: &str) -> SiteChannelListCall<'a, C> {
2293 SiteChannelListCall {
2294 hub: self.hub,
2295 _parent: parent.to_string(),
2296 _page_token: Default::default(),
2297 _page_size: Default::default(),
2298 _delegate: Default::default(),
2299 _additional_params: Default::default(),
2300 _scopes: Default::default(),
2301 }
2302 }
2303
2304 /// Create a builder to help you perform the following task:
2305 ///
2306 /// Updates information for the specified channel of the specified site. Implicitly creates the channel if it doesn't already exist.
2307 ///
2308 /// # Arguments
2309 ///
2310 /// * `request` - No description provided.
2311 /// * `name` - The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
2312 pub fn channels_patch(&self, request: Channel, name: &str) -> SiteChannelPatchCall<'a, C> {
2313 SiteChannelPatchCall {
2314 hub: self.hub,
2315 _request: request,
2316 _name: name.to_string(),
2317 _update_mask: Default::default(),
2318 _delegate: Default::default(),
2319 _additional_params: Default::default(),
2320 _scopes: Default::default(),
2321 }
2322 }
2323
2324 /// Create a builder to help you perform the following task:
2325 ///
2326 /// Creates a domain mapping on the specified site.
2327 ///
2328 /// # Arguments
2329 ///
2330 /// * `request` - No description provided.
2331 /// * `parent` - Required. The parent to create the domain association for, in the format: sites/site-name
2332 pub fn domains_create(&self, request: Domain, parent: &str) -> SiteDomainCreateCall<'a, C> {
2333 SiteDomainCreateCall {
2334 hub: self.hub,
2335 _request: request,
2336 _parent: parent.to_string(),
2337 _delegate: Default::default(),
2338 _additional_params: Default::default(),
2339 _scopes: Default::default(),
2340 }
2341 }
2342
2343 /// Create a builder to help you perform the following task:
2344 ///
2345 /// Deletes the existing domain mapping on the specified site.
2346 ///
2347 /// # Arguments
2348 ///
2349 /// * `name` - Required. The name of the domain association to delete.
2350 pub fn domains_delete(&self, name: &str) -> SiteDomainDeleteCall<'a, C> {
2351 SiteDomainDeleteCall {
2352 hub: self.hub,
2353 _name: name.to_string(),
2354 _delegate: Default::default(),
2355 _additional_params: Default::default(),
2356 _scopes: Default::default(),
2357 }
2358 }
2359
2360 /// Create a builder to help you perform the following task:
2361 ///
2362 /// Gets a domain mapping on the specified site.
2363 ///
2364 /// # Arguments
2365 ///
2366 /// * `name` - Required. The name of the domain configuration to get.
2367 pub fn domains_get(&self, name: &str) -> SiteDomainGetCall<'a, C> {
2368 SiteDomainGetCall {
2369 hub: self.hub,
2370 _name: name.to_string(),
2371 _delegate: Default::default(),
2372 _additional_params: Default::default(),
2373 _scopes: Default::default(),
2374 }
2375 }
2376
2377 /// Create a builder to help you perform the following task:
2378 ///
2379 /// Lists the domains for the specified site.
2380 ///
2381 /// # Arguments
2382 ///
2383 /// * `parent` - Required. The parent for which to list domains, in the format: sites/ site-name
2384 pub fn domains_list(&self, parent: &str) -> SiteDomainListCall<'a, C> {
2385 SiteDomainListCall {
2386 hub: self.hub,
2387 _parent: parent.to_string(),
2388 _page_token: Default::default(),
2389 _page_size: Default::default(),
2390 _delegate: Default::default(),
2391 _additional_params: Default::default(),
2392 _scopes: Default::default(),
2393 }
2394 }
2395
2396 /// Create a builder to help you perform the following task:
2397 ///
2398 /// Updates the specified domain mapping, creating the mapping as if it does not exist.
2399 ///
2400 /// # Arguments
2401 ///
2402 /// * `request` - No description provided.
2403 /// * `name` - Required. The name of the domain association to update or create, if an association doesn't already exist.
2404 pub fn domains_update(&self, request: Domain, name: &str) -> SiteDomainUpdateCall<'a, C> {
2405 SiteDomainUpdateCall {
2406 hub: self.hub,
2407 _request: request,
2408 _name: name.to_string(),
2409 _delegate: Default::default(),
2410 _additional_params: Default::default(),
2411 _scopes: Default::default(),
2412 }
2413 }
2414
2415 /// Create a builder to help you perform the following task:
2416 ///
2417 /// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
2418 ///
2419 /// # Arguments
2420 ///
2421 /// * `request` - No description provided.
2422 /// * `parent` - Required. The site or channel to which the release belongs, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
2423 pub fn releases_create(&self, request: Release, parent: &str) -> SiteReleaseCreateCall<'a, C> {
2424 SiteReleaseCreateCall {
2425 hub: self.hub,
2426 _request: request,
2427 _parent: parent.to_string(),
2428 _version_name: Default::default(),
2429 _delegate: Default::default(),
2430 _additional_params: Default::default(),
2431 _scopes: Default::default(),
2432 }
2433 }
2434
2435 /// Create a builder to help you perform the following task:
2436 ///
2437 /// Gets the specified release for a site or channel. When used to get a release for a site, this can get releases for both the default `live` channel and any active preview channels for the specified site.
2438 ///
2439 /// # Arguments
2440 ///
2441 /// * `name` - Required. The fully-qualified resource name for the Hosting release, in either of the following formats: - sites/SITE_ID/channels/CHANNEL_ID/releases/RELEASE_ID - sites/SITE_ID/releases/RELEASE_ID
2442 pub fn releases_get(&self, name: &str) -> SiteReleaseGetCall<'a, C> {
2443 SiteReleaseGetCall {
2444 hub: self.hub,
2445 _name: name.to_string(),
2446 _delegate: Default::default(),
2447 _additional_params: Default::default(),
2448 _scopes: Default::default(),
2449 }
2450 }
2451
2452 /// Create a builder to help you perform the following task:
2453 ///
2454 /// Lists the releases that have been created for the specified site or channel. When used to list releases for a site, this list includes releases for both the default `live` channel and any active preview channels for the specified site.
2455 ///
2456 /// # Arguments
2457 ///
2458 /// * `parent` - Required. The site or channel for which to list releases, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
2459 pub fn releases_list(&self, parent: &str) -> SiteReleaseListCall<'a, C> {
2460 SiteReleaseListCall {
2461 hub: self.hub,
2462 _parent: parent.to_string(),
2463 _page_token: Default::default(),
2464 _page_size: Default::default(),
2465 _delegate: Default::default(),
2466 _additional_params: Default::default(),
2467 _scopes: Default::default(),
2468 }
2469 }
2470
2471 /// Create a builder to help you perform the following task:
2472 ///
2473 /// Lists the remaining files to be uploaded for the specified version.
2474 ///
2475 /// # Arguments
2476 ///
2477 /// * `parent` - Required. The version for which to list files, in the format: sites/SITE_ID /versions/VERSION_ID
2478 pub fn versions_files_list(&self, parent: &str) -> SiteVersionFileListCall<'a, C> {
2479 SiteVersionFileListCall {
2480 hub: self.hub,
2481 _parent: parent.to_string(),
2482 _status: Default::default(),
2483 _page_token: Default::default(),
2484 _page_size: Default::default(),
2485 _delegate: Default::default(),
2486 _additional_params: Default::default(),
2487 _scopes: Default::default(),
2488 }
2489 }
2490
2491 /// Create a builder to help you perform the following task:
2492 ///
2493 /// Creates a new version on the specified target site using the content of the specified version.
2494 ///
2495 /// # Arguments
2496 ///
2497 /// * `request` - No description provided.
2498 /// * `parent` - Required. The target site for the cloned version, in the format: sites/ SITE_ID
2499 pub fn versions_clone(
2500 &self,
2501 request: CloneVersionRequest,
2502 parent: &str,
2503 ) -> SiteVersionCloneCall<'a, C> {
2504 SiteVersionCloneCall {
2505 hub: self.hub,
2506 _request: request,
2507 _parent: parent.to_string(),
2508 _delegate: Default::default(),
2509 _additional_params: Default::default(),
2510 _scopes: Default::default(),
2511 }
2512 }
2513
2514 /// Create a builder to help you perform the following task:
2515 ///
2516 /// Creates a new version for the specified site.
2517 ///
2518 /// # Arguments
2519 ///
2520 /// * `request` - No description provided.
2521 /// * `parent` - Required. The site in which to create the version, in the format: sites/ SITE_ID
2522 pub fn versions_create(&self, request: Version, parent: &str) -> SiteVersionCreateCall<'a, C> {
2523 SiteVersionCreateCall {
2524 hub: self.hub,
2525 _request: request,
2526 _parent: parent.to_string(),
2527 _version_id: Default::default(),
2528 _size_bytes: Default::default(),
2529 _delegate: Default::default(),
2530 _additional_params: Default::default(),
2531 _scopes: Default::default(),
2532 }
2533 }
2534
2535 /// Create a builder to help you perform the following task:
2536 ///
2537 /// Deletes the specified version.
2538 ///
2539 /// # Arguments
2540 ///
2541 /// * `name` - Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
2542 pub fn versions_delete(&self, name: &str) -> SiteVersionDeleteCall<'a, C> {
2543 SiteVersionDeleteCall {
2544 hub: self.hub,
2545 _name: name.to_string(),
2546 _delegate: Default::default(),
2547 _additional_params: Default::default(),
2548 _scopes: Default::default(),
2549 }
2550 }
2551
2552 /// Create a builder to help you perform the following task:
2553 ///
2554 /// Get the specified version that has been created for the specified site. This can include versions that were created for the default `live` channel or for any active preview channels for the specified site.
2555 ///
2556 /// # Arguments
2557 ///
2558 /// * `name` - Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
2559 pub fn versions_get(&self, name: &str) -> SiteVersionGetCall<'a, C> {
2560 SiteVersionGetCall {
2561 hub: self.hub,
2562 _name: name.to_string(),
2563 _delegate: Default::default(),
2564 _additional_params: Default::default(),
2565 _scopes: Default::default(),
2566 }
2567 }
2568
2569 /// Create a builder to help you perform the following task:
2570 ///
2571 /// Lists the versions that have been created for the specified site. This list includes versions for both the default `live` channel and any active preview channels for the specified site.
2572 ///
2573 /// # Arguments
2574 ///
2575 /// * `parent` - Required. The site or channel for which to list versions, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
2576 pub fn versions_list(&self, parent: &str) -> SiteVersionListCall<'a, C> {
2577 SiteVersionListCall {
2578 hub: self.hub,
2579 _parent: parent.to_string(),
2580 _page_token: Default::default(),
2581 _page_size: Default::default(),
2582 _filter: Default::default(),
2583 _delegate: Default::default(),
2584 _additional_params: Default::default(),
2585 _scopes: Default::default(),
2586 }
2587 }
2588
2589 /// Create a builder to help you perform the following task:
2590 ///
2591 /// Updates the specified metadata for the specified version. This method will fail with `FAILED_PRECONDITION` in the event of an invalid state transition. The supported [state](https://firebase.google.com/docs/hosting/../sites.versions#versionstatus) transitions for a version are from `CREATED` to `FINALIZED`. Use [`DeleteVersion`](delete) to set the status of a version to `DELETED`.
2592 ///
2593 /// # Arguments
2594 ///
2595 /// * `request` - No description provided.
2596 /// * `name` - The fully-qualified resource name for the version, in the format: sites/ SITE_ID/versions/VERSION_ID This name is provided in the response body when you call [`CreateVersion`](sites.versions/create).
2597 pub fn versions_patch(&self, request: Version, name: &str) -> SiteVersionPatchCall<'a, C> {
2598 SiteVersionPatchCall {
2599 hub: self.hub,
2600 _request: request,
2601 _name: name.to_string(),
2602 _update_mask: Default::default(),
2603 _delegate: Default::default(),
2604 _additional_params: Default::default(),
2605 _scopes: Default::default(),
2606 }
2607 }
2608
2609 /// Create a builder to help you perform the following task:
2610 ///
2611 /// Adds content files to the specified version. Each file must be under 2 GB.
2612 ///
2613 /// # Arguments
2614 ///
2615 /// * `request` - No description provided.
2616 /// * `parent` - Required. The version to which to add files, in the format: sites/SITE_ID /versions/VERSION_ID
2617 pub fn versions_populate_files(
2618 &self,
2619 request: PopulateVersionFilesRequest,
2620 parent: &str,
2621 ) -> SiteVersionPopulateFileCall<'a, C> {
2622 SiteVersionPopulateFileCall {
2623 hub: self.hub,
2624 _request: request,
2625 _parent: parent.to_string(),
2626 _delegate: Default::default(),
2627 _additional_params: Default::default(),
2628 _scopes: Default::default(),
2629 }
2630 }
2631
2632 /// Create a builder to help you perform the following task:
2633 ///
2634 /// Gets the Hosting metadata for a specific site.
2635 ///
2636 /// # Arguments
2637 ///
2638 /// * `name` - Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
2639 pub fn get_config(&self, name: &str) -> SiteGetConfigCall<'a, C> {
2640 SiteGetConfigCall {
2641 hub: self.hub,
2642 _name: name.to_string(),
2643 _delegate: Default::default(),
2644 _additional_params: Default::default(),
2645 _scopes: Default::default(),
2646 }
2647 }
2648
2649 /// Create a builder to help you perform the following task:
2650 ///
2651 /// Sets the Hosting metadata for a specific site.
2652 ///
2653 /// # Arguments
2654 ///
2655 /// * `request` - No description provided.
2656 /// * `name` - Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
2657 pub fn update_config(&self, request: SiteConfig, name: &str) -> SiteUpdateConfigCall<'a, C> {
2658 SiteUpdateConfigCall {
2659 hub: self.hub,
2660 _request: request,
2661 _name: name.to_string(),
2662 _update_mask: Default::default(),
2663 _delegate: Default::default(),
2664 _additional_params: Default::default(),
2665 _scopes: Default::default(),
2666 }
2667 }
2668}
2669
2670// ###################
2671// CallBuilders ###
2672// #################
2673
2674/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2675///
2676/// A builder for the *operations.get* method supported by a *project* resource.
2677/// It is not used directly, but through a [`ProjectMethods`] instance.
2678///
2679/// # Example
2680///
2681/// Instantiate a resource method builder
2682///
2683/// ```test_harness,no_run
2684/// # extern crate hyper;
2685/// # extern crate hyper_rustls;
2686/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
2687/// # async fn dox() {
2688/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2689///
2690/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2691/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2692/// # secret,
2693/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2694/// # ).build().await.unwrap();
2695///
2696/// # let client = hyper_util::client::legacy::Client::builder(
2697/// # hyper_util::rt::TokioExecutor::new()
2698/// # )
2699/// # .build(
2700/// # hyper_rustls::HttpsConnectorBuilder::new()
2701/// # .with_native_roots()
2702/// # .unwrap()
2703/// # .https_or_http()
2704/// # .enable_http1()
2705/// # .build()
2706/// # );
2707/// # let mut hub = FirebaseHosting::new(client, auth);
2708/// // You can configure optional parameters by calling the respective setters at will, and
2709/// // execute the final call using `doit()`.
2710/// // Values shown here are possibly random and not representative !
2711/// let result = hub.projects().operations_get("name")
2712/// .doit().await;
2713/// # }
2714/// ```
2715pub struct ProjectOperationGetCall<'a, C>
2716where
2717 C: 'a,
2718{
2719 hub: &'a FirebaseHosting<C>,
2720 _name: String,
2721 _delegate: Option<&'a mut dyn common::Delegate>,
2722 _additional_params: HashMap<String, String>,
2723 _scopes: BTreeSet<String>,
2724}
2725
2726impl<'a, C> common::CallBuilder for ProjectOperationGetCall<'a, C> {}
2727
2728impl<'a, C> ProjectOperationGetCall<'a, C>
2729where
2730 C: common::Connector,
2731{
2732 /// Perform the operation you have build so far.
2733 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2734 use std::borrow::Cow;
2735 use std::io::{Read, Seek};
2736
2737 use common::{url::Params, ToParts};
2738 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2739
2740 let mut dd = common::DefaultDelegate;
2741 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2742 dlg.begin(common::MethodInfo {
2743 id: "firebasehosting.projects.operations.get",
2744 http_method: hyper::Method::GET,
2745 });
2746
2747 for &field in ["alt", "name"].iter() {
2748 if self._additional_params.contains_key(field) {
2749 dlg.finished(false);
2750 return Err(common::Error::FieldClash(field));
2751 }
2752 }
2753
2754 let mut params = Params::with_capacity(3 + self._additional_params.len());
2755 params.push("name", self._name);
2756
2757 params.extend(self._additional_params.iter());
2758
2759 params.push("alt", "json");
2760 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2761 if self._scopes.is_empty() {
2762 self._scopes
2763 .insert(Scope::FirebaseReadonly.as_ref().to_string());
2764 }
2765
2766 #[allow(clippy::single_element_loop)]
2767 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2768 url = params.uri_replacement(url, param_name, find_this, true);
2769 }
2770 {
2771 let to_remove = ["name"];
2772 params.remove_params(&to_remove);
2773 }
2774
2775 let url = params.parse_with_url(&url);
2776
2777 loop {
2778 let token = match self
2779 .hub
2780 .auth
2781 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2782 .await
2783 {
2784 Ok(token) => token,
2785 Err(e) => match dlg.token(e) {
2786 Ok(token) => token,
2787 Err(e) => {
2788 dlg.finished(false);
2789 return Err(common::Error::MissingToken(e));
2790 }
2791 },
2792 };
2793 let mut req_result = {
2794 let client = &self.hub.client;
2795 dlg.pre_request();
2796 let mut req_builder = hyper::Request::builder()
2797 .method(hyper::Method::GET)
2798 .uri(url.as_str())
2799 .header(USER_AGENT, self.hub._user_agent.clone());
2800
2801 if let Some(token) = token.as_ref() {
2802 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2803 }
2804
2805 let request = req_builder
2806 .header(CONTENT_LENGTH, 0_u64)
2807 .body(common::to_body::<String>(None));
2808
2809 client.request(request.unwrap()).await
2810 };
2811
2812 match req_result {
2813 Err(err) => {
2814 if let common::Retry::After(d) = dlg.http_error(&err) {
2815 sleep(d).await;
2816 continue;
2817 }
2818 dlg.finished(false);
2819 return Err(common::Error::HttpError(err));
2820 }
2821 Ok(res) => {
2822 let (mut parts, body) = res.into_parts();
2823 let mut body = common::Body::new(body);
2824 if !parts.status.is_success() {
2825 let bytes = common::to_bytes(body).await.unwrap_or_default();
2826 let error = serde_json::from_str(&common::to_string(&bytes));
2827 let response = common::to_response(parts, bytes.into());
2828
2829 if let common::Retry::After(d) =
2830 dlg.http_failure(&response, error.as_ref().ok())
2831 {
2832 sleep(d).await;
2833 continue;
2834 }
2835
2836 dlg.finished(false);
2837
2838 return Err(match error {
2839 Ok(value) => common::Error::BadRequest(value),
2840 _ => common::Error::Failure(response),
2841 });
2842 }
2843 let response = {
2844 let bytes = common::to_bytes(body).await.unwrap_or_default();
2845 let encoded = common::to_string(&bytes);
2846 match serde_json::from_str(&encoded) {
2847 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2848 Err(error) => {
2849 dlg.response_json_decode_error(&encoded, &error);
2850 return Err(common::Error::JsonDecodeError(
2851 encoded.to_string(),
2852 error,
2853 ));
2854 }
2855 }
2856 };
2857
2858 dlg.finished(true);
2859 return Ok(response);
2860 }
2861 }
2862 }
2863 }
2864
2865 /// The name of the operation resource.
2866 ///
2867 /// Sets the *name* path property to the given value.
2868 ///
2869 /// Even though the property as already been set when instantiating this call,
2870 /// we provide this method for API completeness.
2871 pub fn name(mut self, new_value: &str) -> ProjectOperationGetCall<'a, C> {
2872 self._name = new_value.to_string();
2873 self
2874 }
2875 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2876 /// while executing the actual API request.
2877 ///
2878 /// ````text
2879 /// It should be used to handle progress information, and to implement a certain level of resilience.
2880 /// ````
2881 ///
2882 /// Sets the *delegate* property to the given value.
2883 pub fn delegate(
2884 mut self,
2885 new_value: &'a mut dyn common::Delegate,
2886 ) -> ProjectOperationGetCall<'a, C> {
2887 self._delegate = Some(new_value);
2888 self
2889 }
2890
2891 /// Set any additional parameter of the query string used in the request.
2892 /// It should be used to set parameters which are not yet available through their own
2893 /// setters.
2894 ///
2895 /// Please note that this method must not be used to set any of the known parameters
2896 /// which have their own setter method. If done anyway, the request will fail.
2897 ///
2898 /// # Additional Parameters
2899 ///
2900 /// * *$.xgafv* (query-string) - V1 error format.
2901 /// * *access_token* (query-string) - OAuth access token.
2902 /// * *alt* (query-string) - Data format for response.
2903 /// * *callback* (query-string) - JSONP
2904 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2905 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2906 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2907 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2908 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2909 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2910 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2911 pub fn param<T>(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C>
2912 where
2913 T: AsRef<str>,
2914 {
2915 self._additional_params
2916 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2917 self
2918 }
2919
2920 /// Identifies the authorization scope for the method you are building.
2921 ///
2922 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2923 /// [`Scope::FirebaseReadonly`].
2924 ///
2925 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2926 /// tokens for more than one scope.
2927 ///
2928 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2929 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2930 /// sufficient, a read-write scope will do as well.
2931 pub fn add_scope<St>(mut self, scope: St) -> ProjectOperationGetCall<'a, C>
2932 where
2933 St: AsRef<str>,
2934 {
2935 self._scopes.insert(String::from(scope.as_ref()));
2936 self
2937 }
2938 /// Identifies the authorization scope(s) for the method you are building.
2939 ///
2940 /// See [`Self::add_scope()`] for details.
2941 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOperationGetCall<'a, C>
2942 where
2943 I: IntoIterator<Item = St>,
2944 St: AsRef<str>,
2945 {
2946 self._scopes
2947 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2948 self
2949 }
2950
2951 /// Removes all scopes, and no default scope will be used either.
2952 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2953 /// for details).
2954 pub fn clear_scopes(mut self) -> ProjectOperationGetCall<'a, C> {
2955 self._scopes.clear();
2956 self
2957 }
2958}
2959
2960/// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
2961///
2962/// A builder for the *sites.channels.releases.create* method supported by a *project* resource.
2963/// It is not used directly, but through a [`ProjectMethods`] instance.
2964///
2965/// # Example
2966///
2967/// Instantiate a resource method builder
2968///
2969/// ```test_harness,no_run
2970/// # extern crate hyper;
2971/// # extern crate hyper_rustls;
2972/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
2973/// use firebasehosting1_beta1::api::Release;
2974/// # async fn dox() {
2975/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2976///
2977/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2978/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2979/// # secret,
2980/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2981/// # ).build().await.unwrap();
2982///
2983/// # let client = hyper_util::client::legacy::Client::builder(
2984/// # hyper_util::rt::TokioExecutor::new()
2985/// # )
2986/// # .build(
2987/// # hyper_rustls::HttpsConnectorBuilder::new()
2988/// # .with_native_roots()
2989/// # .unwrap()
2990/// # .https_or_http()
2991/// # .enable_http1()
2992/// # .build()
2993/// # );
2994/// # let mut hub = FirebaseHosting::new(client, auth);
2995/// // As the method needs a request, you would usually fill it with the desired information
2996/// // into the respective structure. Some of the parts shown here might not be applicable !
2997/// // Values shown here are possibly random and not representative !
2998/// let mut req = Release::default();
2999///
3000/// // You can configure optional parameters by calling the respective setters at will, and
3001/// // execute the final call using `doit()`.
3002/// // Values shown here are possibly random and not representative !
3003/// let result = hub.projects().sites_channels_releases_create(req, "parent")
3004/// .version_name("Lorem")
3005/// .doit().await;
3006/// # }
3007/// ```
3008pub struct ProjectSiteChannelReleaseCreateCall<'a, C>
3009where
3010 C: 'a,
3011{
3012 hub: &'a FirebaseHosting<C>,
3013 _request: Release,
3014 _parent: String,
3015 _version_name: Option<String>,
3016 _delegate: Option<&'a mut dyn common::Delegate>,
3017 _additional_params: HashMap<String, String>,
3018 _scopes: BTreeSet<String>,
3019}
3020
3021impl<'a, C> common::CallBuilder for ProjectSiteChannelReleaseCreateCall<'a, C> {}
3022
3023impl<'a, C> ProjectSiteChannelReleaseCreateCall<'a, C>
3024where
3025 C: common::Connector,
3026{
3027 /// Perform the operation you have build so far.
3028 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
3029 use std::borrow::Cow;
3030 use std::io::{Read, Seek};
3031
3032 use common::{url::Params, ToParts};
3033 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3034
3035 let mut dd = common::DefaultDelegate;
3036 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3037 dlg.begin(common::MethodInfo {
3038 id: "firebasehosting.projects.sites.channels.releases.create",
3039 http_method: hyper::Method::POST,
3040 });
3041
3042 for &field in ["alt", "parent", "versionName"].iter() {
3043 if self._additional_params.contains_key(field) {
3044 dlg.finished(false);
3045 return Err(common::Error::FieldClash(field));
3046 }
3047 }
3048
3049 let mut params = Params::with_capacity(5 + self._additional_params.len());
3050 params.push("parent", self._parent);
3051 if let Some(value) = self._version_name.as_ref() {
3052 params.push("versionName", value);
3053 }
3054
3055 params.extend(self._additional_params.iter());
3056
3057 params.push("alt", "json");
3058 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
3059 if self._scopes.is_empty() {
3060 self._scopes
3061 .insert(Scope::CloudPlatform.as_ref().to_string());
3062 }
3063
3064 #[allow(clippy::single_element_loop)]
3065 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3066 url = params.uri_replacement(url, param_name, find_this, true);
3067 }
3068 {
3069 let to_remove = ["parent"];
3070 params.remove_params(&to_remove);
3071 }
3072
3073 let url = params.parse_with_url(&url);
3074
3075 let mut json_mime_type = mime::APPLICATION_JSON;
3076 let mut request_value_reader = {
3077 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3078 common::remove_json_null_values(&mut value);
3079 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3080 serde_json::to_writer(&mut dst, &value).unwrap();
3081 dst
3082 };
3083 let request_size = request_value_reader
3084 .seek(std::io::SeekFrom::End(0))
3085 .unwrap();
3086 request_value_reader
3087 .seek(std::io::SeekFrom::Start(0))
3088 .unwrap();
3089
3090 loop {
3091 let token = match self
3092 .hub
3093 .auth
3094 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3095 .await
3096 {
3097 Ok(token) => token,
3098 Err(e) => match dlg.token(e) {
3099 Ok(token) => token,
3100 Err(e) => {
3101 dlg.finished(false);
3102 return Err(common::Error::MissingToken(e));
3103 }
3104 },
3105 };
3106 request_value_reader
3107 .seek(std::io::SeekFrom::Start(0))
3108 .unwrap();
3109 let mut req_result = {
3110 let client = &self.hub.client;
3111 dlg.pre_request();
3112 let mut req_builder = hyper::Request::builder()
3113 .method(hyper::Method::POST)
3114 .uri(url.as_str())
3115 .header(USER_AGENT, self.hub._user_agent.clone());
3116
3117 if let Some(token) = token.as_ref() {
3118 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3119 }
3120
3121 let request = req_builder
3122 .header(CONTENT_TYPE, json_mime_type.to_string())
3123 .header(CONTENT_LENGTH, request_size as u64)
3124 .body(common::to_body(
3125 request_value_reader.get_ref().clone().into(),
3126 ));
3127
3128 client.request(request.unwrap()).await
3129 };
3130
3131 match req_result {
3132 Err(err) => {
3133 if let common::Retry::After(d) = dlg.http_error(&err) {
3134 sleep(d).await;
3135 continue;
3136 }
3137 dlg.finished(false);
3138 return Err(common::Error::HttpError(err));
3139 }
3140 Ok(res) => {
3141 let (mut parts, body) = res.into_parts();
3142 let mut body = common::Body::new(body);
3143 if !parts.status.is_success() {
3144 let bytes = common::to_bytes(body).await.unwrap_or_default();
3145 let error = serde_json::from_str(&common::to_string(&bytes));
3146 let response = common::to_response(parts, bytes.into());
3147
3148 if let common::Retry::After(d) =
3149 dlg.http_failure(&response, error.as_ref().ok())
3150 {
3151 sleep(d).await;
3152 continue;
3153 }
3154
3155 dlg.finished(false);
3156
3157 return Err(match error {
3158 Ok(value) => common::Error::BadRequest(value),
3159 _ => common::Error::Failure(response),
3160 });
3161 }
3162 let response = {
3163 let bytes = common::to_bytes(body).await.unwrap_or_default();
3164 let encoded = common::to_string(&bytes);
3165 match serde_json::from_str(&encoded) {
3166 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3167 Err(error) => {
3168 dlg.response_json_decode_error(&encoded, &error);
3169 return Err(common::Error::JsonDecodeError(
3170 encoded.to_string(),
3171 error,
3172 ));
3173 }
3174 }
3175 };
3176
3177 dlg.finished(true);
3178 return Ok(response);
3179 }
3180 }
3181 }
3182 }
3183
3184 ///
3185 /// Sets the *request* property to the given value.
3186 ///
3187 /// Even though the property as already been set when instantiating this call,
3188 /// we provide this method for API completeness.
3189 pub fn request(mut self, new_value: Release) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3190 self._request = new_value;
3191 self
3192 }
3193 /// Required. The site or channel to which the release belongs, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
3194 ///
3195 /// Sets the *parent* path property to the given value.
3196 ///
3197 /// Even though the property as already been set when instantiating this call,
3198 /// we provide this method for API completeness.
3199 pub fn parent(mut self, new_value: &str) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3200 self._parent = new_value.to_string();
3201 self
3202 }
3203 /// The unique identifier for a version, in the format: sites/SITE_ID/versions/ VERSION_ID The SITE_ID in this version identifier must match the SITE_ID in the `parent` parameter. This query parameter must be empty if the `type` field in the request body is `SITE_DISABLE`.
3204 ///
3205 /// Sets the *version name* query property to the given value.
3206 pub fn version_name(mut self, new_value: &str) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3207 self._version_name = Some(new_value.to_string());
3208 self
3209 }
3210 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3211 /// while executing the actual API request.
3212 ///
3213 /// ````text
3214 /// It should be used to handle progress information, and to implement a certain level of resilience.
3215 /// ````
3216 ///
3217 /// Sets the *delegate* property to the given value.
3218 pub fn delegate(
3219 mut self,
3220 new_value: &'a mut dyn common::Delegate,
3221 ) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3222 self._delegate = Some(new_value);
3223 self
3224 }
3225
3226 /// Set any additional parameter of the query string used in the request.
3227 /// It should be used to set parameters which are not yet available through their own
3228 /// setters.
3229 ///
3230 /// Please note that this method must not be used to set any of the known parameters
3231 /// which have their own setter method. If done anyway, the request will fail.
3232 ///
3233 /// # Additional Parameters
3234 ///
3235 /// * *$.xgafv* (query-string) - V1 error format.
3236 /// * *access_token* (query-string) - OAuth access token.
3237 /// * *alt* (query-string) - Data format for response.
3238 /// * *callback* (query-string) - JSONP
3239 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3240 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3241 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3242 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3243 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3244 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3245 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3246 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelReleaseCreateCall<'a, C>
3247 where
3248 T: AsRef<str>,
3249 {
3250 self._additional_params
3251 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3252 self
3253 }
3254
3255 /// Identifies the authorization scope for the method you are building.
3256 ///
3257 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3258 /// [`Scope::CloudPlatform`].
3259 ///
3260 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3261 /// tokens for more than one scope.
3262 ///
3263 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3264 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3265 /// sufficient, a read-write scope will do as well.
3266 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelReleaseCreateCall<'a, C>
3267 where
3268 St: AsRef<str>,
3269 {
3270 self._scopes.insert(String::from(scope.as_ref()));
3271 self
3272 }
3273 /// Identifies the authorization scope(s) for the method you are building.
3274 ///
3275 /// See [`Self::add_scope()`] for details.
3276 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelReleaseCreateCall<'a, C>
3277 where
3278 I: IntoIterator<Item = St>,
3279 St: AsRef<str>,
3280 {
3281 self._scopes
3282 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3283 self
3284 }
3285
3286 /// Removes all scopes, and no default scope will be used either.
3287 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3288 /// for details).
3289 pub fn clear_scopes(mut self) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3290 self._scopes.clear();
3291 self
3292 }
3293}
3294
3295/// Gets the specified release for a site or channel. When used to get a release for a site, this can get releases for both the default `live` channel and any active preview channels for the specified site.
3296///
3297/// A builder for the *sites.channels.releases.get* method supported by a *project* resource.
3298/// It is not used directly, but through a [`ProjectMethods`] instance.
3299///
3300/// # Example
3301///
3302/// Instantiate a resource method builder
3303///
3304/// ```test_harness,no_run
3305/// # extern crate hyper;
3306/// # extern crate hyper_rustls;
3307/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
3308/// # async fn dox() {
3309/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3310///
3311/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3312/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3313/// # secret,
3314/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3315/// # ).build().await.unwrap();
3316///
3317/// # let client = hyper_util::client::legacy::Client::builder(
3318/// # hyper_util::rt::TokioExecutor::new()
3319/// # )
3320/// # .build(
3321/// # hyper_rustls::HttpsConnectorBuilder::new()
3322/// # .with_native_roots()
3323/// # .unwrap()
3324/// # .https_or_http()
3325/// # .enable_http1()
3326/// # .build()
3327/// # );
3328/// # let mut hub = FirebaseHosting::new(client, auth);
3329/// // You can configure optional parameters by calling the respective setters at will, and
3330/// // execute the final call using `doit()`.
3331/// // Values shown here are possibly random and not representative !
3332/// let result = hub.projects().sites_channels_releases_get("name")
3333/// .doit().await;
3334/// # }
3335/// ```
3336pub struct ProjectSiteChannelReleaseGetCall<'a, C>
3337where
3338 C: 'a,
3339{
3340 hub: &'a FirebaseHosting<C>,
3341 _name: String,
3342 _delegate: Option<&'a mut dyn common::Delegate>,
3343 _additional_params: HashMap<String, String>,
3344 _scopes: BTreeSet<String>,
3345}
3346
3347impl<'a, C> common::CallBuilder for ProjectSiteChannelReleaseGetCall<'a, C> {}
3348
3349impl<'a, C> ProjectSiteChannelReleaseGetCall<'a, C>
3350where
3351 C: common::Connector,
3352{
3353 /// Perform the operation you have build so far.
3354 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
3355 use std::borrow::Cow;
3356 use std::io::{Read, Seek};
3357
3358 use common::{url::Params, ToParts};
3359 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3360
3361 let mut dd = common::DefaultDelegate;
3362 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3363 dlg.begin(common::MethodInfo {
3364 id: "firebasehosting.projects.sites.channels.releases.get",
3365 http_method: hyper::Method::GET,
3366 });
3367
3368 for &field in ["alt", "name"].iter() {
3369 if self._additional_params.contains_key(field) {
3370 dlg.finished(false);
3371 return Err(common::Error::FieldClash(field));
3372 }
3373 }
3374
3375 let mut params = Params::with_capacity(3 + self._additional_params.len());
3376 params.push("name", self._name);
3377
3378 params.extend(self._additional_params.iter());
3379
3380 params.push("alt", "json");
3381 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3382 if self._scopes.is_empty() {
3383 self._scopes
3384 .insert(Scope::FirebaseReadonly.as_ref().to_string());
3385 }
3386
3387 #[allow(clippy::single_element_loop)]
3388 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3389 url = params.uri_replacement(url, param_name, find_this, true);
3390 }
3391 {
3392 let to_remove = ["name"];
3393 params.remove_params(&to_remove);
3394 }
3395
3396 let url = params.parse_with_url(&url);
3397
3398 loop {
3399 let token = match self
3400 .hub
3401 .auth
3402 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3403 .await
3404 {
3405 Ok(token) => token,
3406 Err(e) => match dlg.token(e) {
3407 Ok(token) => token,
3408 Err(e) => {
3409 dlg.finished(false);
3410 return Err(common::Error::MissingToken(e));
3411 }
3412 },
3413 };
3414 let mut req_result = {
3415 let client = &self.hub.client;
3416 dlg.pre_request();
3417 let mut req_builder = hyper::Request::builder()
3418 .method(hyper::Method::GET)
3419 .uri(url.as_str())
3420 .header(USER_AGENT, self.hub._user_agent.clone());
3421
3422 if let Some(token) = token.as_ref() {
3423 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3424 }
3425
3426 let request = req_builder
3427 .header(CONTENT_LENGTH, 0_u64)
3428 .body(common::to_body::<String>(None));
3429
3430 client.request(request.unwrap()).await
3431 };
3432
3433 match req_result {
3434 Err(err) => {
3435 if let common::Retry::After(d) = dlg.http_error(&err) {
3436 sleep(d).await;
3437 continue;
3438 }
3439 dlg.finished(false);
3440 return Err(common::Error::HttpError(err));
3441 }
3442 Ok(res) => {
3443 let (mut parts, body) = res.into_parts();
3444 let mut body = common::Body::new(body);
3445 if !parts.status.is_success() {
3446 let bytes = common::to_bytes(body).await.unwrap_or_default();
3447 let error = serde_json::from_str(&common::to_string(&bytes));
3448 let response = common::to_response(parts, bytes.into());
3449
3450 if let common::Retry::After(d) =
3451 dlg.http_failure(&response, error.as_ref().ok())
3452 {
3453 sleep(d).await;
3454 continue;
3455 }
3456
3457 dlg.finished(false);
3458
3459 return Err(match error {
3460 Ok(value) => common::Error::BadRequest(value),
3461 _ => common::Error::Failure(response),
3462 });
3463 }
3464 let response = {
3465 let bytes = common::to_bytes(body).await.unwrap_or_default();
3466 let encoded = common::to_string(&bytes);
3467 match serde_json::from_str(&encoded) {
3468 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3469 Err(error) => {
3470 dlg.response_json_decode_error(&encoded, &error);
3471 return Err(common::Error::JsonDecodeError(
3472 encoded.to_string(),
3473 error,
3474 ));
3475 }
3476 }
3477 };
3478
3479 dlg.finished(true);
3480 return Ok(response);
3481 }
3482 }
3483 }
3484 }
3485
3486 /// Required. The fully-qualified resource name for the Hosting release, in either of the following formats: - sites/SITE_ID/channels/CHANNEL_ID/releases/RELEASE_ID - sites/SITE_ID/releases/RELEASE_ID
3487 ///
3488 /// Sets the *name* path property to the given value.
3489 ///
3490 /// Even though the property as already been set when instantiating this call,
3491 /// we provide this method for API completeness.
3492 pub fn name(mut self, new_value: &str) -> ProjectSiteChannelReleaseGetCall<'a, C> {
3493 self._name = new_value.to_string();
3494 self
3495 }
3496 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3497 /// while executing the actual API request.
3498 ///
3499 /// ````text
3500 /// It should be used to handle progress information, and to implement a certain level of resilience.
3501 /// ````
3502 ///
3503 /// Sets the *delegate* property to the given value.
3504 pub fn delegate(
3505 mut self,
3506 new_value: &'a mut dyn common::Delegate,
3507 ) -> ProjectSiteChannelReleaseGetCall<'a, C> {
3508 self._delegate = Some(new_value);
3509 self
3510 }
3511
3512 /// Set any additional parameter of the query string used in the request.
3513 /// It should be used to set parameters which are not yet available through their own
3514 /// setters.
3515 ///
3516 /// Please note that this method must not be used to set any of the known parameters
3517 /// which have their own setter method. If done anyway, the request will fail.
3518 ///
3519 /// # Additional Parameters
3520 ///
3521 /// * *$.xgafv* (query-string) - V1 error format.
3522 /// * *access_token* (query-string) - OAuth access token.
3523 /// * *alt* (query-string) - Data format for response.
3524 /// * *callback* (query-string) - JSONP
3525 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3526 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3527 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3528 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3529 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3530 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3531 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3532 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelReleaseGetCall<'a, C>
3533 where
3534 T: AsRef<str>,
3535 {
3536 self._additional_params
3537 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3538 self
3539 }
3540
3541 /// Identifies the authorization scope for the method you are building.
3542 ///
3543 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3544 /// [`Scope::FirebaseReadonly`].
3545 ///
3546 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3547 /// tokens for more than one scope.
3548 ///
3549 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3550 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3551 /// sufficient, a read-write scope will do as well.
3552 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelReleaseGetCall<'a, C>
3553 where
3554 St: AsRef<str>,
3555 {
3556 self._scopes.insert(String::from(scope.as_ref()));
3557 self
3558 }
3559 /// Identifies the authorization scope(s) for the method you are building.
3560 ///
3561 /// See [`Self::add_scope()`] for details.
3562 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelReleaseGetCall<'a, C>
3563 where
3564 I: IntoIterator<Item = St>,
3565 St: AsRef<str>,
3566 {
3567 self._scopes
3568 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3569 self
3570 }
3571
3572 /// Removes all scopes, and no default scope will be used either.
3573 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3574 /// for details).
3575 pub fn clear_scopes(mut self) -> ProjectSiteChannelReleaseGetCall<'a, C> {
3576 self._scopes.clear();
3577 self
3578 }
3579}
3580
3581/// Lists the releases that have been created for the specified site or channel. When used to list releases for a site, this list includes releases for both the default `live` channel and any active preview channels for the specified site.
3582///
3583/// A builder for the *sites.channels.releases.list* method supported by a *project* resource.
3584/// It is not used directly, but through a [`ProjectMethods`] instance.
3585///
3586/// # Example
3587///
3588/// Instantiate a resource method builder
3589///
3590/// ```test_harness,no_run
3591/// # extern crate hyper;
3592/// # extern crate hyper_rustls;
3593/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
3594/// # async fn dox() {
3595/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3596///
3597/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3598/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3599/// # secret,
3600/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3601/// # ).build().await.unwrap();
3602///
3603/// # let client = hyper_util::client::legacy::Client::builder(
3604/// # hyper_util::rt::TokioExecutor::new()
3605/// # )
3606/// # .build(
3607/// # hyper_rustls::HttpsConnectorBuilder::new()
3608/// # .with_native_roots()
3609/// # .unwrap()
3610/// # .https_or_http()
3611/// # .enable_http1()
3612/// # .build()
3613/// # );
3614/// # let mut hub = FirebaseHosting::new(client, auth);
3615/// // You can configure optional parameters by calling the respective setters at will, and
3616/// // execute the final call using `doit()`.
3617/// // Values shown here are possibly random and not representative !
3618/// let result = hub.projects().sites_channels_releases_list("parent")
3619/// .page_token("dolor")
3620/// .page_size(-17)
3621/// .doit().await;
3622/// # }
3623/// ```
3624pub struct ProjectSiteChannelReleaseListCall<'a, C>
3625where
3626 C: 'a,
3627{
3628 hub: &'a FirebaseHosting<C>,
3629 _parent: String,
3630 _page_token: Option<String>,
3631 _page_size: Option<i32>,
3632 _delegate: Option<&'a mut dyn common::Delegate>,
3633 _additional_params: HashMap<String, String>,
3634 _scopes: BTreeSet<String>,
3635}
3636
3637impl<'a, C> common::CallBuilder for ProjectSiteChannelReleaseListCall<'a, C> {}
3638
3639impl<'a, C> ProjectSiteChannelReleaseListCall<'a, C>
3640where
3641 C: common::Connector,
3642{
3643 /// Perform the operation you have build so far.
3644 pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
3645 use std::borrow::Cow;
3646 use std::io::{Read, Seek};
3647
3648 use common::{url::Params, ToParts};
3649 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3650
3651 let mut dd = common::DefaultDelegate;
3652 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3653 dlg.begin(common::MethodInfo {
3654 id: "firebasehosting.projects.sites.channels.releases.list",
3655 http_method: hyper::Method::GET,
3656 });
3657
3658 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3659 if self._additional_params.contains_key(field) {
3660 dlg.finished(false);
3661 return Err(common::Error::FieldClash(field));
3662 }
3663 }
3664
3665 let mut params = Params::with_capacity(5 + self._additional_params.len());
3666 params.push("parent", self._parent);
3667 if let Some(value) = self._page_token.as_ref() {
3668 params.push("pageToken", value);
3669 }
3670 if let Some(value) = self._page_size.as_ref() {
3671 params.push("pageSize", value.to_string());
3672 }
3673
3674 params.extend(self._additional_params.iter());
3675
3676 params.push("alt", "json");
3677 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
3678 if self._scopes.is_empty() {
3679 self._scopes
3680 .insert(Scope::FirebaseReadonly.as_ref().to_string());
3681 }
3682
3683 #[allow(clippy::single_element_loop)]
3684 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3685 url = params.uri_replacement(url, param_name, find_this, true);
3686 }
3687 {
3688 let to_remove = ["parent"];
3689 params.remove_params(&to_remove);
3690 }
3691
3692 let url = params.parse_with_url(&url);
3693
3694 loop {
3695 let token = match self
3696 .hub
3697 .auth
3698 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3699 .await
3700 {
3701 Ok(token) => token,
3702 Err(e) => match dlg.token(e) {
3703 Ok(token) => token,
3704 Err(e) => {
3705 dlg.finished(false);
3706 return Err(common::Error::MissingToken(e));
3707 }
3708 },
3709 };
3710 let mut req_result = {
3711 let client = &self.hub.client;
3712 dlg.pre_request();
3713 let mut req_builder = hyper::Request::builder()
3714 .method(hyper::Method::GET)
3715 .uri(url.as_str())
3716 .header(USER_AGENT, self.hub._user_agent.clone());
3717
3718 if let Some(token) = token.as_ref() {
3719 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3720 }
3721
3722 let request = req_builder
3723 .header(CONTENT_LENGTH, 0_u64)
3724 .body(common::to_body::<String>(None));
3725
3726 client.request(request.unwrap()).await
3727 };
3728
3729 match req_result {
3730 Err(err) => {
3731 if let common::Retry::After(d) = dlg.http_error(&err) {
3732 sleep(d).await;
3733 continue;
3734 }
3735 dlg.finished(false);
3736 return Err(common::Error::HttpError(err));
3737 }
3738 Ok(res) => {
3739 let (mut parts, body) = res.into_parts();
3740 let mut body = common::Body::new(body);
3741 if !parts.status.is_success() {
3742 let bytes = common::to_bytes(body).await.unwrap_or_default();
3743 let error = serde_json::from_str(&common::to_string(&bytes));
3744 let response = common::to_response(parts, bytes.into());
3745
3746 if let common::Retry::After(d) =
3747 dlg.http_failure(&response, error.as_ref().ok())
3748 {
3749 sleep(d).await;
3750 continue;
3751 }
3752
3753 dlg.finished(false);
3754
3755 return Err(match error {
3756 Ok(value) => common::Error::BadRequest(value),
3757 _ => common::Error::Failure(response),
3758 });
3759 }
3760 let response = {
3761 let bytes = common::to_bytes(body).await.unwrap_or_default();
3762 let encoded = common::to_string(&bytes);
3763 match serde_json::from_str(&encoded) {
3764 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3765 Err(error) => {
3766 dlg.response_json_decode_error(&encoded, &error);
3767 return Err(common::Error::JsonDecodeError(
3768 encoded.to_string(),
3769 error,
3770 ));
3771 }
3772 }
3773 };
3774
3775 dlg.finished(true);
3776 return Ok(response);
3777 }
3778 }
3779 }
3780 }
3781
3782 /// Required. The site or channel for which to list releases, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
3783 ///
3784 /// Sets the *parent* path property to the given value.
3785 ///
3786 /// Even though the property as already been set when instantiating this call,
3787 /// we provide this method for API completeness.
3788 pub fn parent(mut self, new_value: &str) -> ProjectSiteChannelReleaseListCall<'a, C> {
3789 self._parent = new_value.to_string();
3790 self
3791 }
3792 /// A token from a previous call to `releases.list` or `channels.releases.list` that tells the server where to resume listing.
3793 ///
3794 /// Sets the *page token* query property to the given value.
3795 pub fn page_token(mut self, new_value: &str) -> ProjectSiteChannelReleaseListCall<'a, C> {
3796 self._page_token = Some(new_value.to_string());
3797 self
3798 }
3799 /// The maximum number of releases to return. The service may return a lower number if fewer releases exist than this maximum number. If unspecified, defaults to 100.
3800 ///
3801 /// Sets the *page size* query property to the given value.
3802 pub fn page_size(mut self, new_value: i32) -> ProjectSiteChannelReleaseListCall<'a, C> {
3803 self._page_size = Some(new_value);
3804 self
3805 }
3806 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3807 /// while executing the actual API request.
3808 ///
3809 /// ````text
3810 /// It should be used to handle progress information, and to implement a certain level of resilience.
3811 /// ````
3812 ///
3813 /// Sets the *delegate* property to the given value.
3814 pub fn delegate(
3815 mut self,
3816 new_value: &'a mut dyn common::Delegate,
3817 ) -> ProjectSiteChannelReleaseListCall<'a, C> {
3818 self._delegate = Some(new_value);
3819 self
3820 }
3821
3822 /// Set any additional parameter of the query string used in the request.
3823 /// It should be used to set parameters which are not yet available through their own
3824 /// setters.
3825 ///
3826 /// Please note that this method must not be used to set any of the known parameters
3827 /// which have their own setter method. If done anyway, the request will fail.
3828 ///
3829 /// # Additional Parameters
3830 ///
3831 /// * *$.xgafv* (query-string) - V1 error format.
3832 /// * *access_token* (query-string) - OAuth access token.
3833 /// * *alt* (query-string) - Data format for response.
3834 /// * *callback* (query-string) - JSONP
3835 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3836 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3837 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3838 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3839 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3840 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3841 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3842 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelReleaseListCall<'a, C>
3843 where
3844 T: AsRef<str>,
3845 {
3846 self._additional_params
3847 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3848 self
3849 }
3850
3851 /// Identifies the authorization scope for the method you are building.
3852 ///
3853 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3854 /// [`Scope::FirebaseReadonly`].
3855 ///
3856 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3857 /// tokens for more than one scope.
3858 ///
3859 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3860 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3861 /// sufficient, a read-write scope will do as well.
3862 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelReleaseListCall<'a, C>
3863 where
3864 St: AsRef<str>,
3865 {
3866 self._scopes.insert(String::from(scope.as_ref()));
3867 self
3868 }
3869 /// Identifies the authorization scope(s) for the method you are building.
3870 ///
3871 /// See [`Self::add_scope()`] for details.
3872 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelReleaseListCall<'a, C>
3873 where
3874 I: IntoIterator<Item = St>,
3875 St: AsRef<str>,
3876 {
3877 self._scopes
3878 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3879 self
3880 }
3881
3882 /// Removes all scopes, and no default scope will be used either.
3883 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3884 /// for details).
3885 pub fn clear_scopes(mut self) -> ProjectSiteChannelReleaseListCall<'a, C> {
3886 self._scopes.clear();
3887 self
3888 }
3889}
3890
3891/// Creates a new channel in the specified site.
3892///
3893/// A builder for the *sites.channels.create* method supported by a *project* resource.
3894/// It is not used directly, but through a [`ProjectMethods`] instance.
3895///
3896/// # Example
3897///
3898/// Instantiate a resource method builder
3899///
3900/// ```test_harness,no_run
3901/// # extern crate hyper;
3902/// # extern crate hyper_rustls;
3903/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
3904/// use firebasehosting1_beta1::api::Channel;
3905/// # async fn dox() {
3906/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3907///
3908/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3909/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3910/// # secret,
3911/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3912/// # ).build().await.unwrap();
3913///
3914/// # let client = hyper_util::client::legacy::Client::builder(
3915/// # hyper_util::rt::TokioExecutor::new()
3916/// # )
3917/// # .build(
3918/// # hyper_rustls::HttpsConnectorBuilder::new()
3919/// # .with_native_roots()
3920/// # .unwrap()
3921/// # .https_or_http()
3922/// # .enable_http1()
3923/// # .build()
3924/// # );
3925/// # let mut hub = FirebaseHosting::new(client, auth);
3926/// // As the method needs a request, you would usually fill it with the desired information
3927/// // into the respective structure. Some of the parts shown here might not be applicable !
3928/// // Values shown here are possibly random and not representative !
3929/// let mut req = Channel::default();
3930///
3931/// // You can configure optional parameters by calling the respective setters at will, and
3932/// // execute the final call using `doit()`.
3933/// // Values shown here are possibly random and not representative !
3934/// let result = hub.projects().sites_channels_create(req, "parent")
3935/// .channel_id("invidunt")
3936/// .doit().await;
3937/// # }
3938/// ```
3939pub struct ProjectSiteChannelCreateCall<'a, C>
3940where
3941 C: 'a,
3942{
3943 hub: &'a FirebaseHosting<C>,
3944 _request: Channel,
3945 _parent: String,
3946 _channel_id: Option<String>,
3947 _delegate: Option<&'a mut dyn common::Delegate>,
3948 _additional_params: HashMap<String, String>,
3949 _scopes: BTreeSet<String>,
3950}
3951
3952impl<'a, C> common::CallBuilder for ProjectSiteChannelCreateCall<'a, C> {}
3953
3954impl<'a, C> ProjectSiteChannelCreateCall<'a, C>
3955where
3956 C: common::Connector,
3957{
3958 /// Perform the operation you have build so far.
3959 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
3960 use std::borrow::Cow;
3961 use std::io::{Read, Seek};
3962
3963 use common::{url::Params, ToParts};
3964 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3965
3966 let mut dd = common::DefaultDelegate;
3967 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3968 dlg.begin(common::MethodInfo {
3969 id: "firebasehosting.projects.sites.channels.create",
3970 http_method: hyper::Method::POST,
3971 });
3972
3973 for &field in ["alt", "parent", "channelId"].iter() {
3974 if self._additional_params.contains_key(field) {
3975 dlg.finished(false);
3976 return Err(common::Error::FieldClash(field));
3977 }
3978 }
3979
3980 let mut params = Params::with_capacity(5 + self._additional_params.len());
3981 params.push("parent", self._parent);
3982 if let Some(value) = self._channel_id.as_ref() {
3983 params.push("channelId", value);
3984 }
3985
3986 params.extend(self._additional_params.iter());
3987
3988 params.push("alt", "json");
3989 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/channels";
3990 if self._scopes.is_empty() {
3991 self._scopes
3992 .insert(Scope::CloudPlatform.as_ref().to_string());
3993 }
3994
3995 #[allow(clippy::single_element_loop)]
3996 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3997 url = params.uri_replacement(url, param_name, find_this, true);
3998 }
3999 {
4000 let to_remove = ["parent"];
4001 params.remove_params(&to_remove);
4002 }
4003
4004 let url = params.parse_with_url(&url);
4005
4006 let mut json_mime_type = mime::APPLICATION_JSON;
4007 let mut request_value_reader = {
4008 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4009 common::remove_json_null_values(&mut value);
4010 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4011 serde_json::to_writer(&mut dst, &value).unwrap();
4012 dst
4013 };
4014 let request_size = request_value_reader
4015 .seek(std::io::SeekFrom::End(0))
4016 .unwrap();
4017 request_value_reader
4018 .seek(std::io::SeekFrom::Start(0))
4019 .unwrap();
4020
4021 loop {
4022 let token = match self
4023 .hub
4024 .auth
4025 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4026 .await
4027 {
4028 Ok(token) => token,
4029 Err(e) => match dlg.token(e) {
4030 Ok(token) => token,
4031 Err(e) => {
4032 dlg.finished(false);
4033 return Err(common::Error::MissingToken(e));
4034 }
4035 },
4036 };
4037 request_value_reader
4038 .seek(std::io::SeekFrom::Start(0))
4039 .unwrap();
4040 let mut req_result = {
4041 let client = &self.hub.client;
4042 dlg.pre_request();
4043 let mut req_builder = hyper::Request::builder()
4044 .method(hyper::Method::POST)
4045 .uri(url.as_str())
4046 .header(USER_AGENT, self.hub._user_agent.clone());
4047
4048 if let Some(token) = token.as_ref() {
4049 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4050 }
4051
4052 let request = req_builder
4053 .header(CONTENT_TYPE, json_mime_type.to_string())
4054 .header(CONTENT_LENGTH, request_size as u64)
4055 .body(common::to_body(
4056 request_value_reader.get_ref().clone().into(),
4057 ));
4058
4059 client.request(request.unwrap()).await
4060 };
4061
4062 match req_result {
4063 Err(err) => {
4064 if let common::Retry::After(d) = dlg.http_error(&err) {
4065 sleep(d).await;
4066 continue;
4067 }
4068 dlg.finished(false);
4069 return Err(common::Error::HttpError(err));
4070 }
4071 Ok(res) => {
4072 let (mut parts, body) = res.into_parts();
4073 let mut body = common::Body::new(body);
4074 if !parts.status.is_success() {
4075 let bytes = common::to_bytes(body).await.unwrap_or_default();
4076 let error = serde_json::from_str(&common::to_string(&bytes));
4077 let response = common::to_response(parts, bytes.into());
4078
4079 if let common::Retry::After(d) =
4080 dlg.http_failure(&response, error.as_ref().ok())
4081 {
4082 sleep(d).await;
4083 continue;
4084 }
4085
4086 dlg.finished(false);
4087
4088 return Err(match error {
4089 Ok(value) => common::Error::BadRequest(value),
4090 _ => common::Error::Failure(response),
4091 });
4092 }
4093 let response = {
4094 let bytes = common::to_bytes(body).await.unwrap_or_default();
4095 let encoded = common::to_string(&bytes);
4096 match serde_json::from_str(&encoded) {
4097 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4098 Err(error) => {
4099 dlg.response_json_decode_error(&encoded, &error);
4100 return Err(common::Error::JsonDecodeError(
4101 encoded.to_string(),
4102 error,
4103 ));
4104 }
4105 }
4106 };
4107
4108 dlg.finished(true);
4109 return Ok(response);
4110 }
4111 }
4112 }
4113 }
4114
4115 ///
4116 /// Sets the *request* property to the given value.
4117 ///
4118 /// Even though the property as already been set when instantiating this call,
4119 /// we provide this method for API completeness.
4120 pub fn request(mut self, new_value: Channel) -> ProjectSiteChannelCreateCall<'a, C> {
4121 self._request = new_value;
4122 self
4123 }
4124 /// Required. The site in which to create this channel, in the format: sites/ SITE_ID
4125 ///
4126 /// Sets the *parent* path property to the given value.
4127 ///
4128 /// Even though the property as already been set when instantiating this call,
4129 /// we provide this method for API completeness.
4130 pub fn parent(mut self, new_value: &str) -> ProjectSiteChannelCreateCall<'a, C> {
4131 self._parent = new_value.to_string();
4132 self
4133 }
4134 /// Required. Immutable. A unique ID within the site that identifies the channel.
4135 ///
4136 /// Sets the *channel id* query property to the given value.
4137 pub fn channel_id(mut self, new_value: &str) -> ProjectSiteChannelCreateCall<'a, C> {
4138 self._channel_id = Some(new_value.to_string());
4139 self
4140 }
4141 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4142 /// while executing the actual API request.
4143 ///
4144 /// ````text
4145 /// It should be used to handle progress information, and to implement a certain level of resilience.
4146 /// ````
4147 ///
4148 /// Sets the *delegate* property to the given value.
4149 pub fn delegate(
4150 mut self,
4151 new_value: &'a mut dyn common::Delegate,
4152 ) -> ProjectSiteChannelCreateCall<'a, C> {
4153 self._delegate = Some(new_value);
4154 self
4155 }
4156
4157 /// Set any additional parameter of the query string used in the request.
4158 /// It should be used to set parameters which are not yet available through their own
4159 /// setters.
4160 ///
4161 /// Please note that this method must not be used to set any of the known parameters
4162 /// which have their own setter method. If done anyway, the request will fail.
4163 ///
4164 /// # Additional Parameters
4165 ///
4166 /// * *$.xgafv* (query-string) - V1 error format.
4167 /// * *access_token* (query-string) - OAuth access token.
4168 /// * *alt* (query-string) - Data format for response.
4169 /// * *callback* (query-string) - JSONP
4170 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4171 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4172 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4173 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4174 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4175 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4176 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4177 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelCreateCall<'a, C>
4178 where
4179 T: AsRef<str>,
4180 {
4181 self._additional_params
4182 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4183 self
4184 }
4185
4186 /// Identifies the authorization scope for the method you are building.
4187 ///
4188 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4189 /// [`Scope::CloudPlatform`].
4190 ///
4191 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4192 /// tokens for more than one scope.
4193 ///
4194 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4195 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4196 /// sufficient, a read-write scope will do as well.
4197 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelCreateCall<'a, C>
4198 where
4199 St: AsRef<str>,
4200 {
4201 self._scopes.insert(String::from(scope.as_ref()));
4202 self
4203 }
4204 /// Identifies the authorization scope(s) for the method you are building.
4205 ///
4206 /// See [`Self::add_scope()`] for details.
4207 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelCreateCall<'a, C>
4208 where
4209 I: IntoIterator<Item = St>,
4210 St: AsRef<str>,
4211 {
4212 self._scopes
4213 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4214 self
4215 }
4216
4217 /// Removes all scopes, and no default scope will be used either.
4218 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4219 /// for details).
4220 pub fn clear_scopes(mut self) -> ProjectSiteChannelCreateCall<'a, C> {
4221 self._scopes.clear();
4222 self
4223 }
4224}
4225
4226/// Deletes the specified channel of the specified site. The `live` channel cannot be deleted.
4227///
4228/// A builder for the *sites.channels.delete* method supported by a *project* resource.
4229/// It is not used directly, but through a [`ProjectMethods`] instance.
4230///
4231/// # Example
4232///
4233/// Instantiate a resource method builder
4234///
4235/// ```test_harness,no_run
4236/// # extern crate hyper;
4237/// # extern crate hyper_rustls;
4238/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
4239/// # async fn dox() {
4240/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4241///
4242/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4243/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4244/// # secret,
4245/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4246/// # ).build().await.unwrap();
4247///
4248/// # let client = hyper_util::client::legacy::Client::builder(
4249/// # hyper_util::rt::TokioExecutor::new()
4250/// # )
4251/// # .build(
4252/// # hyper_rustls::HttpsConnectorBuilder::new()
4253/// # .with_native_roots()
4254/// # .unwrap()
4255/// # .https_or_http()
4256/// # .enable_http1()
4257/// # .build()
4258/// # );
4259/// # let mut hub = FirebaseHosting::new(client, auth);
4260/// // You can configure optional parameters by calling the respective setters at will, and
4261/// // execute the final call using `doit()`.
4262/// // Values shown here are possibly random and not representative !
4263/// let result = hub.projects().sites_channels_delete("name")
4264/// .doit().await;
4265/// # }
4266/// ```
4267pub struct ProjectSiteChannelDeleteCall<'a, C>
4268where
4269 C: 'a,
4270{
4271 hub: &'a FirebaseHosting<C>,
4272 _name: String,
4273 _delegate: Option<&'a mut dyn common::Delegate>,
4274 _additional_params: HashMap<String, String>,
4275 _scopes: BTreeSet<String>,
4276}
4277
4278impl<'a, C> common::CallBuilder for ProjectSiteChannelDeleteCall<'a, C> {}
4279
4280impl<'a, C> ProjectSiteChannelDeleteCall<'a, C>
4281where
4282 C: common::Connector,
4283{
4284 /// Perform the operation you have build so far.
4285 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4286 use std::borrow::Cow;
4287 use std::io::{Read, Seek};
4288
4289 use common::{url::Params, ToParts};
4290 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4291
4292 let mut dd = common::DefaultDelegate;
4293 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4294 dlg.begin(common::MethodInfo {
4295 id: "firebasehosting.projects.sites.channels.delete",
4296 http_method: hyper::Method::DELETE,
4297 });
4298
4299 for &field in ["alt", "name"].iter() {
4300 if self._additional_params.contains_key(field) {
4301 dlg.finished(false);
4302 return Err(common::Error::FieldClash(field));
4303 }
4304 }
4305
4306 let mut params = Params::with_capacity(3 + self._additional_params.len());
4307 params.push("name", self._name);
4308
4309 params.extend(self._additional_params.iter());
4310
4311 params.push("alt", "json");
4312 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4313 if self._scopes.is_empty() {
4314 self._scopes
4315 .insert(Scope::CloudPlatform.as_ref().to_string());
4316 }
4317
4318 #[allow(clippy::single_element_loop)]
4319 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4320 url = params.uri_replacement(url, param_name, find_this, true);
4321 }
4322 {
4323 let to_remove = ["name"];
4324 params.remove_params(&to_remove);
4325 }
4326
4327 let url = params.parse_with_url(&url);
4328
4329 loop {
4330 let token = match self
4331 .hub
4332 .auth
4333 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4334 .await
4335 {
4336 Ok(token) => token,
4337 Err(e) => match dlg.token(e) {
4338 Ok(token) => token,
4339 Err(e) => {
4340 dlg.finished(false);
4341 return Err(common::Error::MissingToken(e));
4342 }
4343 },
4344 };
4345 let mut req_result = {
4346 let client = &self.hub.client;
4347 dlg.pre_request();
4348 let mut req_builder = hyper::Request::builder()
4349 .method(hyper::Method::DELETE)
4350 .uri(url.as_str())
4351 .header(USER_AGENT, self.hub._user_agent.clone());
4352
4353 if let Some(token) = token.as_ref() {
4354 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4355 }
4356
4357 let request = req_builder
4358 .header(CONTENT_LENGTH, 0_u64)
4359 .body(common::to_body::<String>(None));
4360
4361 client.request(request.unwrap()).await
4362 };
4363
4364 match req_result {
4365 Err(err) => {
4366 if let common::Retry::After(d) = dlg.http_error(&err) {
4367 sleep(d).await;
4368 continue;
4369 }
4370 dlg.finished(false);
4371 return Err(common::Error::HttpError(err));
4372 }
4373 Ok(res) => {
4374 let (mut parts, body) = res.into_parts();
4375 let mut body = common::Body::new(body);
4376 if !parts.status.is_success() {
4377 let bytes = common::to_bytes(body).await.unwrap_or_default();
4378 let error = serde_json::from_str(&common::to_string(&bytes));
4379 let response = common::to_response(parts, bytes.into());
4380
4381 if let common::Retry::After(d) =
4382 dlg.http_failure(&response, error.as_ref().ok())
4383 {
4384 sleep(d).await;
4385 continue;
4386 }
4387
4388 dlg.finished(false);
4389
4390 return Err(match error {
4391 Ok(value) => common::Error::BadRequest(value),
4392 _ => common::Error::Failure(response),
4393 });
4394 }
4395 let response = {
4396 let bytes = common::to_bytes(body).await.unwrap_or_default();
4397 let encoded = common::to_string(&bytes);
4398 match serde_json::from_str(&encoded) {
4399 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4400 Err(error) => {
4401 dlg.response_json_decode_error(&encoded, &error);
4402 return Err(common::Error::JsonDecodeError(
4403 encoded.to_string(),
4404 error,
4405 ));
4406 }
4407 }
4408 };
4409
4410 dlg.finished(true);
4411 return Ok(response);
4412 }
4413 }
4414 }
4415 }
4416
4417 /// Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
4418 ///
4419 /// Sets the *name* path property to the given value.
4420 ///
4421 /// Even though the property as already been set when instantiating this call,
4422 /// we provide this method for API completeness.
4423 pub fn name(mut self, new_value: &str) -> ProjectSiteChannelDeleteCall<'a, C> {
4424 self._name = new_value.to_string();
4425 self
4426 }
4427 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4428 /// while executing the actual API request.
4429 ///
4430 /// ````text
4431 /// It should be used to handle progress information, and to implement a certain level of resilience.
4432 /// ````
4433 ///
4434 /// Sets the *delegate* property to the given value.
4435 pub fn delegate(
4436 mut self,
4437 new_value: &'a mut dyn common::Delegate,
4438 ) -> ProjectSiteChannelDeleteCall<'a, C> {
4439 self._delegate = Some(new_value);
4440 self
4441 }
4442
4443 /// Set any additional parameter of the query string used in the request.
4444 /// It should be used to set parameters which are not yet available through their own
4445 /// setters.
4446 ///
4447 /// Please note that this method must not be used to set any of the known parameters
4448 /// which have their own setter method. If done anyway, the request will fail.
4449 ///
4450 /// # Additional Parameters
4451 ///
4452 /// * *$.xgafv* (query-string) - V1 error format.
4453 /// * *access_token* (query-string) - OAuth access token.
4454 /// * *alt* (query-string) - Data format for response.
4455 /// * *callback* (query-string) - JSONP
4456 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4457 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4458 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4459 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4460 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4461 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4462 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4463 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelDeleteCall<'a, C>
4464 where
4465 T: AsRef<str>,
4466 {
4467 self._additional_params
4468 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4469 self
4470 }
4471
4472 /// Identifies the authorization scope for the method you are building.
4473 ///
4474 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4475 /// [`Scope::CloudPlatform`].
4476 ///
4477 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4478 /// tokens for more than one scope.
4479 ///
4480 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4481 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4482 /// sufficient, a read-write scope will do as well.
4483 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelDeleteCall<'a, C>
4484 where
4485 St: AsRef<str>,
4486 {
4487 self._scopes.insert(String::from(scope.as_ref()));
4488 self
4489 }
4490 /// Identifies the authorization scope(s) for the method you are building.
4491 ///
4492 /// See [`Self::add_scope()`] for details.
4493 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelDeleteCall<'a, C>
4494 where
4495 I: IntoIterator<Item = St>,
4496 St: AsRef<str>,
4497 {
4498 self._scopes
4499 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4500 self
4501 }
4502
4503 /// Removes all scopes, and no default scope will be used either.
4504 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4505 /// for details).
4506 pub fn clear_scopes(mut self) -> ProjectSiteChannelDeleteCall<'a, C> {
4507 self._scopes.clear();
4508 self
4509 }
4510}
4511
4512/// Retrieves information for the specified channel of the specified site.
4513///
4514/// A builder for the *sites.channels.get* method supported by a *project* resource.
4515/// It is not used directly, but through a [`ProjectMethods`] instance.
4516///
4517/// # Example
4518///
4519/// Instantiate a resource method builder
4520///
4521/// ```test_harness,no_run
4522/// # extern crate hyper;
4523/// # extern crate hyper_rustls;
4524/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
4525/// # async fn dox() {
4526/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4527///
4528/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4529/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4530/// # secret,
4531/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4532/// # ).build().await.unwrap();
4533///
4534/// # let client = hyper_util::client::legacy::Client::builder(
4535/// # hyper_util::rt::TokioExecutor::new()
4536/// # )
4537/// # .build(
4538/// # hyper_rustls::HttpsConnectorBuilder::new()
4539/// # .with_native_roots()
4540/// # .unwrap()
4541/// # .https_or_http()
4542/// # .enable_http1()
4543/// # .build()
4544/// # );
4545/// # let mut hub = FirebaseHosting::new(client, auth);
4546/// // You can configure optional parameters by calling the respective setters at will, and
4547/// // execute the final call using `doit()`.
4548/// // Values shown here are possibly random and not representative !
4549/// let result = hub.projects().sites_channels_get("name")
4550/// .doit().await;
4551/// # }
4552/// ```
4553pub struct ProjectSiteChannelGetCall<'a, C>
4554where
4555 C: 'a,
4556{
4557 hub: &'a FirebaseHosting<C>,
4558 _name: String,
4559 _delegate: Option<&'a mut dyn common::Delegate>,
4560 _additional_params: HashMap<String, String>,
4561 _scopes: BTreeSet<String>,
4562}
4563
4564impl<'a, C> common::CallBuilder for ProjectSiteChannelGetCall<'a, C> {}
4565
4566impl<'a, C> ProjectSiteChannelGetCall<'a, C>
4567where
4568 C: common::Connector,
4569{
4570 /// Perform the operation you have build so far.
4571 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
4572 use std::borrow::Cow;
4573 use std::io::{Read, Seek};
4574
4575 use common::{url::Params, ToParts};
4576 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4577
4578 let mut dd = common::DefaultDelegate;
4579 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4580 dlg.begin(common::MethodInfo {
4581 id: "firebasehosting.projects.sites.channels.get",
4582 http_method: hyper::Method::GET,
4583 });
4584
4585 for &field in ["alt", "name"].iter() {
4586 if self._additional_params.contains_key(field) {
4587 dlg.finished(false);
4588 return Err(common::Error::FieldClash(field));
4589 }
4590 }
4591
4592 let mut params = Params::with_capacity(3 + self._additional_params.len());
4593 params.push("name", self._name);
4594
4595 params.extend(self._additional_params.iter());
4596
4597 params.push("alt", "json");
4598 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4599 if self._scopes.is_empty() {
4600 self._scopes
4601 .insert(Scope::FirebaseReadonly.as_ref().to_string());
4602 }
4603
4604 #[allow(clippy::single_element_loop)]
4605 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4606 url = params.uri_replacement(url, param_name, find_this, true);
4607 }
4608 {
4609 let to_remove = ["name"];
4610 params.remove_params(&to_remove);
4611 }
4612
4613 let url = params.parse_with_url(&url);
4614
4615 loop {
4616 let token = match self
4617 .hub
4618 .auth
4619 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4620 .await
4621 {
4622 Ok(token) => token,
4623 Err(e) => match dlg.token(e) {
4624 Ok(token) => token,
4625 Err(e) => {
4626 dlg.finished(false);
4627 return Err(common::Error::MissingToken(e));
4628 }
4629 },
4630 };
4631 let mut req_result = {
4632 let client = &self.hub.client;
4633 dlg.pre_request();
4634 let mut req_builder = hyper::Request::builder()
4635 .method(hyper::Method::GET)
4636 .uri(url.as_str())
4637 .header(USER_AGENT, self.hub._user_agent.clone());
4638
4639 if let Some(token) = token.as_ref() {
4640 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4641 }
4642
4643 let request = req_builder
4644 .header(CONTENT_LENGTH, 0_u64)
4645 .body(common::to_body::<String>(None));
4646
4647 client.request(request.unwrap()).await
4648 };
4649
4650 match req_result {
4651 Err(err) => {
4652 if let common::Retry::After(d) = dlg.http_error(&err) {
4653 sleep(d).await;
4654 continue;
4655 }
4656 dlg.finished(false);
4657 return Err(common::Error::HttpError(err));
4658 }
4659 Ok(res) => {
4660 let (mut parts, body) = res.into_parts();
4661 let mut body = common::Body::new(body);
4662 if !parts.status.is_success() {
4663 let bytes = common::to_bytes(body).await.unwrap_or_default();
4664 let error = serde_json::from_str(&common::to_string(&bytes));
4665 let response = common::to_response(parts, bytes.into());
4666
4667 if let common::Retry::After(d) =
4668 dlg.http_failure(&response, error.as_ref().ok())
4669 {
4670 sleep(d).await;
4671 continue;
4672 }
4673
4674 dlg.finished(false);
4675
4676 return Err(match error {
4677 Ok(value) => common::Error::BadRequest(value),
4678 _ => common::Error::Failure(response),
4679 });
4680 }
4681 let response = {
4682 let bytes = common::to_bytes(body).await.unwrap_or_default();
4683 let encoded = common::to_string(&bytes);
4684 match serde_json::from_str(&encoded) {
4685 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4686 Err(error) => {
4687 dlg.response_json_decode_error(&encoded, &error);
4688 return Err(common::Error::JsonDecodeError(
4689 encoded.to_string(),
4690 error,
4691 ));
4692 }
4693 }
4694 };
4695
4696 dlg.finished(true);
4697 return Ok(response);
4698 }
4699 }
4700 }
4701 }
4702
4703 /// Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
4704 ///
4705 /// Sets the *name* path property to the given value.
4706 ///
4707 /// Even though the property as already been set when instantiating this call,
4708 /// we provide this method for API completeness.
4709 pub fn name(mut self, new_value: &str) -> ProjectSiteChannelGetCall<'a, C> {
4710 self._name = new_value.to_string();
4711 self
4712 }
4713 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4714 /// while executing the actual API request.
4715 ///
4716 /// ````text
4717 /// It should be used to handle progress information, and to implement a certain level of resilience.
4718 /// ````
4719 ///
4720 /// Sets the *delegate* property to the given value.
4721 pub fn delegate(
4722 mut self,
4723 new_value: &'a mut dyn common::Delegate,
4724 ) -> ProjectSiteChannelGetCall<'a, C> {
4725 self._delegate = Some(new_value);
4726 self
4727 }
4728
4729 /// Set any additional parameter of the query string used in the request.
4730 /// It should be used to set parameters which are not yet available through their own
4731 /// setters.
4732 ///
4733 /// Please note that this method must not be used to set any of the known parameters
4734 /// which have their own setter method. If done anyway, the request will fail.
4735 ///
4736 /// # Additional Parameters
4737 ///
4738 /// * *$.xgafv* (query-string) - V1 error format.
4739 /// * *access_token* (query-string) - OAuth access token.
4740 /// * *alt* (query-string) - Data format for response.
4741 /// * *callback* (query-string) - JSONP
4742 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4743 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4744 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4745 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4746 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4747 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4748 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4749 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelGetCall<'a, C>
4750 where
4751 T: AsRef<str>,
4752 {
4753 self._additional_params
4754 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4755 self
4756 }
4757
4758 /// Identifies the authorization scope for the method you are building.
4759 ///
4760 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4761 /// [`Scope::FirebaseReadonly`].
4762 ///
4763 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4764 /// tokens for more than one scope.
4765 ///
4766 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4767 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4768 /// sufficient, a read-write scope will do as well.
4769 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelGetCall<'a, C>
4770 where
4771 St: AsRef<str>,
4772 {
4773 self._scopes.insert(String::from(scope.as_ref()));
4774 self
4775 }
4776 /// Identifies the authorization scope(s) for the method you are building.
4777 ///
4778 /// See [`Self::add_scope()`] for details.
4779 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelGetCall<'a, C>
4780 where
4781 I: IntoIterator<Item = St>,
4782 St: AsRef<str>,
4783 {
4784 self._scopes
4785 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4786 self
4787 }
4788
4789 /// Removes all scopes, and no default scope will be used either.
4790 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4791 /// for details).
4792 pub fn clear_scopes(mut self) -> ProjectSiteChannelGetCall<'a, C> {
4793 self._scopes.clear();
4794 self
4795 }
4796}
4797
4798/// Lists the channels for the specified site. All sites have a default `live` channel.
4799///
4800/// A builder for the *sites.channels.list* method supported by a *project* resource.
4801/// It is not used directly, but through a [`ProjectMethods`] instance.
4802///
4803/// # Example
4804///
4805/// Instantiate a resource method builder
4806///
4807/// ```test_harness,no_run
4808/// # extern crate hyper;
4809/// # extern crate hyper_rustls;
4810/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
4811/// # async fn dox() {
4812/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4813///
4814/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4815/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4816/// # secret,
4817/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4818/// # ).build().await.unwrap();
4819///
4820/// # let client = hyper_util::client::legacy::Client::builder(
4821/// # hyper_util::rt::TokioExecutor::new()
4822/// # )
4823/// # .build(
4824/// # hyper_rustls::HttpsConnectorBuilder::new()
4825/// # .with_native_roots()
4826/// # .unwrap()
4827/// # .https_or_http()
4828/// # .enable_http1()
4829/// # .build()
4830/// # );
4831/// # let mut hub = FirebaseHosting::new(client, auth);
4832/// // You can configure optional parameters by calling the respective setters at will, and
4833/// // execute the final call using `doit()`.
4834/// // Values shown here are possibly random and not representative !
4835/// let result = hub.projects().sites_channels_list("parent")
4836/// .page_token("sed")
4837/// .page_size(-37)
4838/// .doit().await;
4839/// # }
4840/// ```
4841pub struct ProjectSiteChannelListCall<'a, C>
4842where
4843 C: 'a,
4844{
4845 hub: &'a FirebaseHosting<C>,
4846 _parent: String,
4847 _page_token: Option<String>,
4848 _page_size: Option<i32>,
4849 _delegate: Option<&'a mut dyn common::Delegate>,
4850 _additional_params: HashMap<String, String>,
4851 _scopes: BTreeSet<String>,
4852}
4853
4854impl<'a, C> common::CallBuilder for ProjectSiteChannelListCall<'a, C> {}
4855
4856impl<'a, C> ProjectSiteChannelListCall<'a, C>
4857where
4858 C: common::Connector,
4859{
4860 /// Perform the operation you have build so far.
4861 pub async fn doit(mut self) -> common::Result<(common::Response, ListChannelsResponse)> {
4862 use std::borrow::Cow;
4863 use std::io::{Read, Seek};
4864
4865 use common::{url::Params, ToParts};
4866 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4867
4868 let mut dd = common::DefaultDelegate;
4869 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4870 dlg.begin(common::MethodInfo {
4871 id: "firebasehosting.projects.sites.channels.list",
4872 http_method: hyper::Method::GET,
4873 });
4874
4875 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
4876 if self._additional_params.contains_key(field) {
4877 dlg.finished(false);
4878 return Err(common::Error::FieldClash(field));
4879 }
4880 }
4881
4882 let mut params = Params::with_capacity(5 + self._additional_params.len());
4883 params.push("parent", self._parent);
4884 if let Some(value) = self._page_token.as_ref() {
4885 params.push("pageToken", value);
4886 }
4887 if let Some(value) = self._page_size.as_ref() {
4888 params.push("pageSize", value.to_string());
4889 }
4890
4891 params.extend(self._additional_params.iter());
4892
4893 params.push("alt", "json");
4894 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/channels";
4895 if self._scopes.is_empty() {
4896 self._scopes
4897 .insert(Scope::FirebaseReadonly.as_ref().to_string());
4898 }
4899
4900 #[allow(clippy::single_element_loop)]
4901 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4902 url = params.uri_replacement(url, param_name, find_this, true);
4903 }
4904 {
4905 let to_remove = ["parent"];
4906 params.remove_params(&to_remove);
4907 }
4908
4909 let url = params.parse_with_url(&url);
4910
4911 loop {
4912 let token = match self
4913 .hub
4914 .auth
4915 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4916 .await
4917 {
4918 Ok(token) => token,
4919 Err(e) => match dlg.token(e) {
4920 Ok(token) => token,
4921 Err(e) => {
4922 dlg.finished(false);
4923 return Err(common::Error::MissingToken(e));
4924 }
4925 },
4926 };
4927 let mut req_result = {
4928 let client = &self.hub.client;
4929 dlg.pre_request();
4930 let mut req_builder = hyper::Request::builder()
4931 .method(hyper::Method::GET)
4932 .uri(url.as_str())
4933 .header(USER_AGENT, self.hub._user_agent.clone());
4934
4935 if let Some(token) = token.as_ref() {
4936 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4937 }
4938
4939 let request = req_builder
4940 .header(CONTENT_LENGTH, 0_u64)
4941 .body(common::to_body::<String>(None));
4942
4943 client.request(request.unwrap()).await
4944 };
4945
4946 match req_result {
4947 Err(err) => {
4948 if let common::Retry::After(d) = dlg.http_error(&err) {
4949 sleep(d).await;
4950 continue;
4951 }
4952 dlg.finished(false);
4953 return Err(common::Error::HttpError(err));
4954 }
4955 Ok(res) => {
4956 let (mut parts, body) = res.into_parts();
4957 let mut body = common::Body::new(body);
4958 if !parts.status.is_success() {
4959 let bytes = common::to_bytes(body).await.unwrap_or_default();
4960 let error = serde_json::from_str(&common::to_string(&bytes));
4961 let response = common::to_response(parts, bytes.into());
4962
4963 if let common::Retry::After(d) =
4964 dlg.http_failure(&response, error.as_ref().ok())
4965 {
4966 sleep(d).await;
4967 continue;
4968 }
4969
4970 dlg.finished(false);
4971
4972 return Err(match error {
4973 Ok(value) => common::Error::BadRequest(value),
4974 _ => common::Error::Failure(response),
4975 });
4976 }
4977 let response = {
4978 let bytes = common::to_bytes(body).await.unwrap_or_default();
4979 let encoded = common::to_string(&bytes);
4980 match serde_json::from_str(&encoded) {
4981 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4982 Err(error) => {
4983 dlg.response_json_decode_error(&encoded, &error);
4984 return Err(common::Error::JsonDecodeError(
4985 encoded.to_string(),
4986 error,
4987 ));
4988 }
4989 }
4990 };
4991
4992 dlg.finished(true);
4993 return Ok(response);
4994 }
4995 }
4996 }
4997 }
4998
4999 /// Required. The site for which to list channels, in the format: sites/SITE_ID
5000 ///
5001 /// Sets the *parent* path property to the given value.
5002 ///
5003 /// Even though the property as already been set when instantiating this call,
5004 /// we provide this method for API completeness.
5005 pub fn parent(mut self, new_value: &str) -> ProjectSiteChannelListCall<'a, C> {
5006 self._parent = new_value.to_string();
5007 self
5008 }
5009 /// A token from a previous call to `ListChannels` that tells the server where to resume listing.
5010 ///
5011 /// Sets the *page token* query property to the given value.
5012 pub fn page_token(mut self, new_value: &str) -> ProjectSiteChannelListCall<'a, C> {
5013 self._page_token = Some(new_value.to_string());
5014 self
5015 }
5016 /// The maximum number of channels to return. The service may return a lower number if fewer channels exist than this maximum number. If unspecified, defaults to 10. The maximum value is 100; values above 100 will be coerced to 100.
5017 ///
5018 /// Sets the *page size* query property to the given value.
5019 pub fn page_size(mut self, new_value: i32) -> ProjectSiteChannelListCall<'a, C> {
5020 self._page_size = Some(new_value);
5021 self
5022 }
5023 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5024 /// while executing the actual API request.
5025 ///
5026 /// ````text
5027 /// It should be used to handle progress information, and to implement a certain level of resilience.
5028 /// ````
5029 ///
5030 /// Sets the *delegate* property to the given value.
5031 pub fn delegate(
5032 mut self,
5033 new_value: &'a mut dyn common::Delegate,
5034 ) -> ProjectSiteChannelListCall<'a, C> {
5035 self._delegate = Some(new_value);
5036 self
5037 }
5038
5039 /// Set any additional parameter of the query string used in the request.
5040 /// It should be used to set parameters which are not yet available through their own
5041 /// setters.
5042 ///
5043 /// Please note that this method must not be used to set any of the known parameters
5044 /// which have their own setter method. If done anyway, the request will fail.
5045 ///
5046 /// # Additional Parameters
5047 ///
5048 /// * *$.xgafv* (query-string) - V1 error format.
5049 /// * *access_token* (query-string) - OAuth access token.
5050 /// * *alt* (query-string) - Data format for response.
5051 /// * *callback* (query-string) - JSONP
5052 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5053 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5054 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5055 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5056 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5057 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5058 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5059 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelListCall<'a, C>
5060 where
5061 T: AsRef<str>,
5062 {
5063 self._additional_params
5064 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5065 self
5066 }
5067
5068 /// Identifies the authorization scope for the method you are building.
5069 ///
5070 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5071 /// [`Scope::FirebaseReadonly`].
5072 ///
5073 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5074 /// tokens for more than one scope.
5075 ///
5076 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5077 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5078 /// sufficient, a read-write scope will do as well.
5079 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelListCall<'a, C>
5080 where
5081 St: AsRef<str>,
5082 {
5083 self._scopes.insert(String::from(scope.as_ref()));
5084 self
5085 }
5086 /// Identifies the authorization scope(s) for the method you are building.
5087 ///
5088 /// See [`Self::add_scope()`] for details.
5089 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelListCall<'a, C>
5090 where
5091 I: IntoIterator<Item = St>,
5092 St: AsRef<str>,
5093 {
5094 self._scopes
5095 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5096 self
5097 }
5098
5099 /// Removes all scopes, and no default scope will be used either.
5100 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5101 /// for details).
5102 pub fn clear_scopes(mut self) -> ProjectSiteChannelListCall<'a, C> {
5103 self._scopes.clear();
5104 self
5105 }
5106}
5107
5108/// Updates information for the specified channel of the specified site. Implicitly creates the channel if it doesn't already exist.
5109///
5110/// A builder for the *sites.channels.patch* method supported by a *project* resource.
5111/// It is not used directly, but through a [`ProjectMethods`] instance.
5112///
5113/// # Example
5114///
5115/// Instantiate a resource method builder
5116///
5117/// ```test_harness,no_run
5118/// # extern crate hyper;
5119/// # extern crate hyper_rustls;
5120/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
5121/// use firebasehosting1_beta1::api::Channel;
5122/// # async fn dox() {
5123/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5124///
5125/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5126/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5127/// # secret,
5128/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5129/// # ).build().await.unwrap();
5130///
5131/// # let client = hyper_util::client::legacy::Client::builder(
5132/// # hyper_util::rt::TokioExecutor::new()
5133/// # )
5134/// # .build(
5135/// # hyper_rustls::HttpsConnectorBuilder::new()
5136/// # .with_native_roots()
5137/// # .unwrap()
5138/// # .https_or_http()
5139/// # .enable_http1()
5140/// # .build()
5141/// # );
5142/// # let mut hub = FirebaseHosting::new(client, auth);
5143/// // As the method needs a request, you would usually fill it with the desired information
5144/// // into the respective structure. Some of the parts shown here might not be applicable !
5145/// // Values shown here are possibly random and not representative !
5146/// let mut req = Channel::default();
5147///
5148/// // You can configure optional parameters by calling the respective setters at will, and
5149/// // execute the final call using `doit()`.
5150/// // Values shown here are possibly random and not representative !
5151/// let result = hub.projects().sites_channels_patch(req, "name")
5152/// .update_mask(FieldMask::new::<&str>(&[]))
5153/// .doit().await;
5154/// # }
5155/// ```
5156pub struct ProjectSiteChannelPatchCall<'a, C>
5157where
5158 C: 'a,
5159{
5160 hub: &'a FirebaseHosting<C>,
5161 _request: Channel,
5162 _name: String,
5163 _update_mask: Option<common::FieldMask>,
5164 _delegate: Option<&'a mut dyn common::Delegate>,
5165 _additional_params: HashMap<String, String>,
5166 _scopes: BTreeSet<String>,
5167}
5168
5169impl<'a, C> common::CallBuilder for ProjectSiteChannelPatchCall<'a, C> {}
5170
5171impl<'a, C> ProjectSiteChannelPatchCall<'a, C>
5172where
5173 C: common::Connector,
5174{
5175 /// Perform the operation you have build so far.
5176 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
5177 use std::borrow::Cow;
5178 use std::io::{Read, Seek};
5179
5180 use common::{url::Params, ToParts};
5181 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5182
5183 let mut dd = common::DefaultDelegate;
5184 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5185 dlg.begin(common::MethodInfo {
5186 id: "firebasehosting.projects.sites.channels.patch",
5187 http_method: hyper::Method::PATCH,
5188 });
5189
5190 for &field in ["alt", "name", "updateMask"].iter() {
5191 if self._additional_params.contains_key(field) {
5192 dlg.finished(false);
5193 return Err(common::Error::FieldClash(field));
5194 }
5195 }
5196
5197 let mut params = Params::with_capacity(5 + self._additional_params.len());
5198 params.push("name", self._name);
5199 if let Some(value) = self._update_mask.as_ref() {
5200 params.push("updateMask", value.to_string());
5201 }
5202
5203 params.extend(self._additional_params.iter());
5204
5205 params.push("alt", "json");
5206 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5207 if self._scopes.is_empty() {
5208 self._scopes
5209 .insert(Scope::CloudPlatform.as_ref().to_string());
5210 }
5211
5212 #[allow(clippy::single_element_loop)]
5213 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5214 url = params.uri_replacement(url, param_name, find_this, true);
5215 }
5216 {
5217 let to_remove = ["name"];
5218 params.remove_params(&to_remove);
5219 }
5220
5221 let url = params.parse_with_url(&url);
5222
5223 let mut json_mime_type = mime::APPLICATION_JSON;
5224 let mut request_value_reader = {
5225 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5226 common::remove_json_null_values(&mut value);
5227 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5228 serde_json::to_writer(&mut dst, &value).unwrap();
5229 dst
5230 };
5231 let request_size = request_value_reader
5232 .seek(std::io::SeekFrom::End(0))
5233 .unwrap();
5234 request_value_reader
5235 .seek(std::io::SeekFrom::Start(0))
5236 .unwrap();
5237
5238 loop {
5239 let token = match self
5240 .hub
5241 .auth
5242 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5243 .await
5244 {
5245 Ok(token) => token,
5246 Err(e) => match dlg.token(e) {
5247 Ok(token) => token,
5248 Err(e) => {
5249 dlg.finished(false);
5250 return Err(common::Error::MissingToken(e));
5251 }
5252 },
5253 };
5254 request_value_reader
5255 .seek(std::io::SeekFrom::Start(0))
5256 .unwrap();
5257 let mut req_result = {
5258 let client = &self.hub.client;
5259 dlg.pre_request();
5260 let mut req_builder = hyper::Request::builder()
5261 .method(hyper::Method::PATCH)
5262 .uri(url.as_str())
5263 .header(USER_AGENT, self.hub._user_agent.clone());
5264
5265 if let Some(token) = token.as_ref() {
5266 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5267 }
5268
5269 let request = req_builder
5270 .header(CONTENT_TYPE, json_mime_type.to_string())
5271 .header(CONTENT_LENGTH, request_size as u64)
5272 .body(common::to_body(
5273 request_value_reader.get_ref().clone().into(),
5274 ));
5275
5276 client.request(request.unwrap()).await
5277 };
5278
5279 match req_result {
5280 Err(err) => {
5281 if let common::Retry::After(d) = dlg.http_error(&err) {
5282 sleep(d).await;
5283 continue;
5284 }
5285 dlg.finished(false);
5286 return Err(common::Error::HttpError(err));
5287 }
5288 Ok(res) => {
5289 let (mut parts, body) = res.into_parts();
5290 let mut body = common::Body::new(body);
5291 if !parts.status.is_success() {
5292 let bytes = common::to_bytes(body).await.unwrap_or_default();
5293 let error = serde_json::from_str(&common::to_string(&bytes));
5294 let response = common::to_response(parts, bytes.into());
5295
5296 if let common::Retry::After(d) =
5297 dlg.http_failure(&response, error.as_ref().ok())
5298 {
5299 sleep(d).await;
5300 continue;
5301 }
5302
5303 dlg.finished(false);
5304
5305 return Err(match error {
5306 Ok(value) => common::Error::BadRequest(value),
5307 _ => common::Error::Failure(response),
5308 });
5309 }
5310 let response = {
5311 let bytes = common::to_bytes(body).await.unwrap_or_default();
5312 let encoded = common::to_string(&bytes);
5313 match serde_json::from_str(&encoded) {
5314 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5315 Err(error) => {
5316 dlg.response_json_decode_error(&encoded, &error);
5317 return Err(common::Error::JsonDecodeError(
5318 encoded.to_string(),
5319 error,
5320 ));
5321 }
5322 }
5323 };
5324
5325 dlg.finished(true);
5326 return Ok(response);
5327 }
5328 }
5329 }
5330 }
5331
5332 ///
5333 /// Sets the *request* property to the given value.
5334 ///
5335 /// Even though the property as already been set when instantiating this call,
5336 /// we provide this method for API completeness.
5337 pub fn request(mut self, new_value: Channel) -> ProjectSiteChannelPatchCall<'a, C> {
5338 self._request = new_value;
5339 self
5340 }
5341 /// The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
5342 ///
5343 /// Sets the *name* path property to the given value.
5344 ///
5345 /// Even though the property as already been set when instantiating this call,
5346 /// we provide this method for API completeness.
5347 pub fn name(mut self, new_value: &str) -> ProjectSiteChannelPatchCall<'a, C> {
5348 self._name = new_value.to_string();
5349 self
5350 }
5351 /// A comma-separated list of fields to be updated in this request.
5352 ///
5353 /// Sets the *update mask* query property to the given value.
5354 pub fn update_mask(
5355 mut self,
5356 new_value: common::FieldMask,
5357 ) -> ProjectSiteChannelPatchCall<'a, C> {
5358 self._update_mask = Some(new_value);
5359 self
5360 }
5361 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5362 /// while executing the actual API request.
5363 ///
5364 /// ````text
5365 /// It should be used to handle progress information, and to implement a certain level of resilience.
5366 /// ````
5367 ///
5368 /// Sets the *delegate* property to the given value.
5369 pub fn delegate(
5370 mut self,
5371 new_value: &'a mut dyn common::Delegate,
5372 ) -> ProjectSiteChannelPatchCall<'a, C> {
5373 self._delegate = Some(new_value);
5374 self
5375 }
5376
5377 /// Set any additional parameter of the query string used in the request.
5378 /// It should be used to set parameters which are not yet available through their own
5379 /// setters.
5380 ///
5381 /// Please note that this method must not be used to set any of the known parameters
5382 /// which have their own setter method. If done anyway, the request will fail.
5383 ///
5384 /// # Additional Parameters
5385 ///
5386 /// * *$.xgafv* (query-string) - V1 error format.
5387 /// * *access_token* (query-string) - OAuth access token.
5388 /// * *alt* (query-string) - Data format for response.
5389 /// * *callback* (query-string) - JSONP
5390 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5391 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5392 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5393 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5394 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5395 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5396 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5397 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelPatchCall<'a, C>
5398 where
5399 T: AsRef<str>,
5400 {
5401 self._additional_params
5402 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5403 self
5404 }
5405
5406 /// Identifies the authorization scope for the method you are building.
5407 ///
5408 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5409 /// [`Scope::CloudPlatform`].
5410 ///
5411 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5412 /// tokens for more than one scope.
5413 ///
5414 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5415 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5416 /// sufficient, a read-write scope will do as well.
5417 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelPatchCall<'a, C>
5418 where
5419 St: AsRef<str>,
5420 {
5421 self._scopes.insert(String::from(scope.as_ref()));
5422 self
5423 }
5424 /// Identifies the authorization scope(s) for the method you are building.
5425 ///
5426 /// See [`Self::add_scope()`] for details.
5427 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelPatchCall<'a, C>
5428 where
5429 I: IntoIterator<Item = St>,
5430 St: AsRef<str>,
5431 {
5432 self._scopes
5433 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5434 self
5435 }
5436
5437 /// Removes all scopes, and no default scope will be used either.
5438 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5439 /// for details).
5440 pub fn clear_scopes(mut self) -> ProjectSiteChannelPatchCall<'a, C> {
5441 self._scopes.clear();
5442 self
5443 }
5444}
5445
5446/// Gets the latest state of a long-running operation. Use this method to poll the operation result at intervals as recommended by the API service.
5447///
5448/// A builder for the *sites.customDomains.operations.get* method supported by a *project* resource.
5449/// It is not used directly, but through a [`ProjectMethods`] instance.
5450///
5451/// # Example
5452///
5453/// Instantiate a resource method builder
5454///
5455/// ```test_harness,no_run
5456/// # extern crate hyper;
5457/// # extern crate hyper_rustls;
5458/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
5459/// # async fn dox() {
5460/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5461///
5462/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5463/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5464/// # secret,
5465/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5466/// # ).build().await.unwrap();
5467///
5468/// # let client = hyper_util::client::legacy::Client::builder(
5469/// # hyper_util::rt::TokioExecutor::new()
5470/// # )
5471/// # .build(
5472/// # hyper_rustls::HttpsConnectorBuilder::new()
5473/// # .with_native_roots()
5474/// # .unwrap()
5475/// # .https_or_http()
5476/// # .enable_http1()
5477/// # .build()
5478/// # );
5479/// # let mut hub = FirebaseHosting::new(client, auth);
5480/// // You can configure optional parameters by calling the respective setters at will, and
5481/// // execute the final call using `doit()`.
5482/// // Values shown here are possibly random and not representative !
5483/// let result = hub.projects().sites_custom_domains_operations_get("name")
5484/// .doit().await;
5485/// # }
5486/// ```
5487pub struct ProjectSiteCustomDomainOperationGetCall<'a, C>
5488where
5489 C: 'a,
5490{
5491 hub: &'a FirebaseHosting<C>,
5492 _name: String,
5493 _delegate: Option<&'a mut dyn common::Delegate>,
5494 _additional_params: HashMap<String, String>,
5495 _scopes: BTreeSet<String>,
5496}
5497
5498impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainOperationGetCall<'a, C> {}
5499
5500impl<'a, C> ProjectSiteCustomDomainOperationGetCall<'a, C>
5501where
5502 C: common::Connector,
5503{
5504 /// Perform the operation you have build so far.
5505 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5506 use std::borrow::Cow;
5507 use std::io::{Read, Seek};
5508
5509 use common::{url::Params, ToParts};
5510 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5511
5512 let mut dd = common::DefaultDelegate;
5513 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5514 dlg.begin(common::MethodInfo {
5515 id: "firebasehosting.projects.sites.customDomains.operations.get",
5516 http_method: hyper::Method::GET,
5517 });
5518
5519 for &field in ["alt", "name"].iter() {
5520 if self._additional_params.contains_key(field) {
5521 dlg.finished(false);
5522 return Err(common::Error::FieldClash(field));
5523 }
5524 }
5525
5526 let mut params = Params::with_capacity(3 + self._additional_params.len());
5527 params.push("name", self._name);
5528
5529 params.extend(self._additional_params.iter());
5530
5531 params.push("alt", "json");
5532 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5533 if self._scopes.is_empty() {
5534 self._scopes
5535 .insert(Scope::FirebaseReadonly.as_ref().to_string());
5536 }
5537
5538 #[allow(clippy::single_element_loop)]
5539 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5540 url = params.uri_replacement(url, param_name, find_this, true);
5541 }
5542 {
5543 let to_remove = ["name"];
5544 params.remove_params(&to_remove);
5545 }
5546
5547 let url = params.parse_with_url(&url);
5548
5549 loop {
5550 let token = match self
5551 .hub
5552 .auth
5553 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5554 .await
5555 {
5556 Ok(token) => token,
5557 Err(e) => match dlg.token(e) {
5558 Ok(token) => token,
5559 Err(e) => {
5560 dlg.finished(false);
5561 return Err(common::Error::MissingToken(e));
5562 }
5563 },
5564 };
5565 let mut req_result = {
5566 let client = &self.hub.client;
5567 dlg.pre_request();
5568 let mut req_builder = hyper::Request::builder()
5569 .method(hyper::Method::GET)
5570 .uri(url.as_str())
5571 .header(USER_AGENT, self.hub._user_agent.clone());
5572
5573 if let Some(token) = token.as_ref() {
5574 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5575 }
5576
5577 let request = req_builder
5578 .header(CONTENT_LENGTH, 0_u64)
5579 .body(common::to_body::<String>(None));
5580
5581 client.request(request.unwrap()).await
5582 };
5583
5584 match req_result {
5585 Err(err) => {
5586 if let common::Retry::After(d) = dlg.http_error(&err) {
5587 sleep(d).await;
5588 continue;
5589 }
5590 dlg.finished(false);
5591 return Err(common::Error::HttpError(err));
5592 }
5593 Ok(res) => {
5594 let (mut parts, body) = res.into_parts();
5595 let mut body = common::Body::new(body);
5596 if !parts.status.is_success() {
5597 let bytes = common::to_bytes(body).await.unwrap_or_default();
5598 let error = serde_json::from_str(&common::to_string(&bytes));
5599 let response = common::to_response(parts, bytes.into());
5600
5601 if let common::Retry::After(d) =
5602 dlg.http_failure(&response, error.as_ref().ok())
5603 {
5604 sleep(d).await;
5605 continue;
5606 }
5607
5608 dlg.finished(false);
5609
5610 return Err(match error {
5611 Ok(value) => common::Error::BadRequest(value),
5612 _ => common::Error::Failure(response),
5613 });
5614 }
5615 let response = {
5616 let bytes = common::to_bytes(body).await.unwrap_or_default();
5617 let encoded = common::to_string(&bytes);
5618 match serde_json::from_str(&encoded) {
5619 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5620 Err(error) => {
5621 dlg.response_json_decode_error(&encoded, &error);
5622 return Err(common::Error::JsonDecodeError(
5623 encoded.to_string(),
5624 error,
5625 ));
5626 }
5627 }
5628 };
5629
5630 dlg.finished(true);
5631 return Ok(response);
5632 }
5633 }
5634 }
5635 }
5636
5637 /// The name of the operation resource.
5638 ///
5639 /// Sets the *name* path property to the given value.
5640 ///
5641 /// Even though the property as already been set when instantiating this call,
5642 /// we provide this method for API completeness.
5643 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainOperationGetCall<'a, C> {
5644 self._name = new_value.to_string();
5645 self
5646 }
5647 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5648 /// while executing the actual API request.
5649 ///
5650 /// ````text
5651 /// It should be used to handle progress information, and to implement a certain level of resilience.
5652 /// ````
5653 ///
5654 /// Sets the *delegate* property to the given value.
5655 pub fn delegate(
5656 mut self,
5657 new_value: &'a mut dyn common::Delegate,
5658 ) -> ProjectSiteCustomDomainOperationGetCall<'a, C> {
5659 self._delegate = Some(new_value);
5660 self
5661 }
5662
5663 /// Set any additional parameter of the query string used in the request.
5664 /// It should be used to set parameters which are not yet available through their own
5665 /// setters.
5666 ///
5667 /// Please note that this method must not be used to set any of the known parameters
5668 /// which have their own setter method. If done anyway, the request will fail.
5669 ///
5670 /// # Additional Parameters
5671 ///
5672 /// * *$.xgafv* (query-string) - V1 error format.
5673 /// * *access_token* (query-string) - OAuth access token.
5674 /// * *alt* (query-string) - Data format for response.
5675 /// * *callback* (query-string) - JSONP
5676 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5677 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5678 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5679 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5680 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5681 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5682 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5683 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainOperationGetCall<'a, C>
5684 where
5685 T: AsRef<str>,
5686 {
5687 self._additional_params
5688 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5689 self
5690 }
5691
5692 /// Identifies the authorization scope for the method you are building.
5693 ///
5694 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5695 /// [`Scope::FirebaseReadonly`].
5696 ///
5697 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5698 /// tokens for more than one scope.
5699 ///
5700 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5701 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5702 /// sufficient, a read-write scope will do as well.
5703 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainOperationGetCall<'a, C>
5704 where
5705 St: AsRef<str>,
5706 {
5707 self._scopes.insert(String::from(scope.as_ref()));
5708 self
5709 }
5710 /// Identifies the authorization scope(s) for the method you are building.
5711 ///
5712 /// See [`Self::add_scope()`] for details.
5713 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainOperationGetCall<'a, C>
5714 where
5715 I: IntoIterator<Item = St>,
5716 St: AsRef<str>,
5717 {
5718 self._scopes
5719 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5720 self
5721 }
5722
5723 /// Removes all scopes, and no default scope will be used either.
5724 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5725 /// for details).
5726 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainOperationGetCall<'a, C> {
5727 self._scopes.clear();
5728 self
5729 }
5730}
5731
5732/// Lists operations that match the specified filter in the request.
5733///
5734/// A builder for the *sites.customDomains.operations.list* method supported by a *project* resource.
5735/// It is not used directly, but through a [`ProjectMethods`] instance.
5736///
5737/// # Example
5738///
5739/// Instantiate a resource method builder
5740///
5741/// ```test_harness,no_run
5742/// # extern crate hyper;
5743/// # extern crate hyper_rustls;
5744/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
5745/// # async fn dox() {
5746/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5747///
5748/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5749/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5750/// # secret,
5751/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5752/// # ).build().await.unwrap();
5753///
5754/// # let client = hyper_util::client::legacy::Client::builder(
5755/// # hyper_util::rt::TokioExecutor::new()
5756/// # )
5757/// # .build(
5758/// # hyper_rustls::HttpsConnectorBuilder::new()
5759/// # .with_native_roots()
5760/// # .unwrap()
5761/// # .https_or_http()
5762/// # .enable_http1()
5763/// # .build()
5764/// # );
5765/// # let mut hub = FirebaseHosting::new(client, auth);
5766/// // You can configure optional parameters by calling the respective setters at will, and
5767/// // execute the final call using `doit()`.
5768/// // Values shown here are possibly random and not representative !
5769/// let result = hub.projects().sites_custom_domains_operations_list("name")
5770/// .page_token("ipsum")
5771/// .page_size(-50)
5772/// .filter("est")
5773/// .doit().await;
5774/// # }
5775/// ```
5776pub struct ProjectSiteCustomDomainOperationListCall<'a, C>
5777where
5778 C: 'a,
5779{
5780 hub: &'a FirebaseHosting<C>,
5781 _name: String,
5782 _page_token: Option<String>,
5783 _page_size: Option<i32>,
5784 _filter: Option<String>,
5785 _delegate: Option<&'a mut dyn common::Delegate>,
5786 _additional_params: HashMap<String, String>,
5787 _scopes: BTreeSet<String>,
5788}
5789
5790impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainOperationListCall<'a, C> {}
5791
5792impl<'a, C> ProjectSiteCustomDomainOperationListCall<'a, C>
5793where
5794 C: common::Connector,
5795{
5796 /// Perform the operation you have build so far.
5797 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
5798 use std::borrow::Cow;
5799 use std::io::{Read, Seek};
5800
5801 use common::{url::Params, ToParts};
5802 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5803
5804 let mut dd = common::DefaultDelegate;
5805 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5806 dlg.begin(common::MethodInfo {
5807 id: "firebasehosting.projects.sites.customDomains.operations.list",
5808 http_method: hyper::Method::GET,
5809 });
5810
5811 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
5812 if self._additional_params.contains_key(field) {
5813 dlg.finished(false);
5814 return Err(common::Error::FieldClash(field));
5815 }
5816 }
5817
5818 let mut params = Params::with_capacity(6 + self._additional_params.len());
5819 params.push("name", self._name);
5820 if let Some(value) = self._page_token.as_ref() {
5821 params.push("pageToken", value);
5822 }
5823 if let Some(value) = self._page_size.as_ref() {
5824 params.push("pageSize", value.to_string());
5825 }
5826 if let Some(value) = self._filter.as_ref() {
5827 params.push("filter", value);
5828 }
5829
5830 params.extend(self._additional_params.iter());
5831
5832 params.push("alt", "json");
5833 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/operations";
5834 if self._scopes.is_empty() {
5835 self._scopes
5836 .insert(Scope::FirebaseReadonly.as_ref().to_string());
5837 }
5838
5839 #[allow(clippy::single_element_loop)]
5840 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5841 url = params.uri_replacement(url, param_name, find_this, true);
5842 }
5843 {
5844 let to_remove = ["name"];
5845 params.remove_params(&to_remove);
5846 }
5847
5848 let url = params.parse_with_url(&url);
5849
5850 loop {
5851 let token = match self
5852 .hub
5853 .auth
5854 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5855 .await
5856 {
5857 Ok(token) => token,
5858 Err(e) => match dlg.token(e) {
5859 Ok(token) => token,
5860 Err(e) => {
5861 dlg.finished(false);
5862 return Err(common::Error::MissingToken(e));
5863 }
5864 },
5865 };
5866 let mut req_result = {
5867 let client = &self.hub.client;
5868 dlg.pre_request();
5869 let mut req_builder = hyper::Request::builder()
5870 .method(hyper::Method::GET)
5871 .uri(url.as_str())
5872 .header(USER_AGENT, self.hub._user_agent.clone());
5873
5874 if let Some(token) = token.as_ref() {
5875 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5876 }
5877
5878 let request = req_builder
5879 .header(CONTENT_LENGTH, 0_u64)
5880 .body(common::to_body::<String>(None));
5881
5882 client.request(request.unwrap()).await
5883 };
5884
5885 match req_result {
5886 Err(err) => {
5887 if let common::Retry::After(d) = dlg.http_error(&err) {
5888 sleep(d).await;
5889 continue;
5890 }
5891 dlg.finished(false);
5892 return Err(common::Error::HttpError(err));
5893 }
5894 Ok(res) => {
5895 let (mut parts, body) = res.into_parts();
5896 let mut body = common::Body::new(body);
5897 if !parts.status.is_success() {
5898 let bytes = common::to_bytes(body).await.unwrap_or_default();
5899 let error = serde_json::from_str(&common::to_string(&bytes));
5900 let response = common::to_response(parts, bytes.into());
5901
5902 if let common::Retry::After(d) =
5903 dlg.http_failure(&response, error.as_ref().ok())
5904 {
5905 sleep(d).await;
5906 continue;
5907 }
5908
5909 dlg.finished(false);
5910
5911 return Err(match error {
5912 Ok(value) => common::Error::BadRequest(value),
5913 _ => common::Error::Failure(response),
5914 });
5915 }
5916 let response = {
5917 let bytes = common::to_bytes(body).await.unwrap_or_default();
5918 let encoded = common::to_string(&bytes);
5919 match serde_json::from_str(&encoded) {
5920 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5921 Err(error) => {
5922 dlg.response_json_decode_error(&encoded, &error);
5923 return Err(common::Error::JsonDecodeError(
5924 encoded.to_string(),
5925 error,
5926 ));
5927 }
5928 }
5929 };
5930
5931 dlg.finished(true);
5932 return Ok(response);
5933 }
5934 }
5935 }
5936 }
5937
5938 /// The name of the operation's parent resource.
5939 ///
5940 /// Sets the *name* path property to the given value.
5941 ///
5942 /// Even though the property as already been set when instantiating this call,
5943 /// we provide this method for API completeness.
5944 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
5945 self._name = new_value.to_string();
5946 self
5947 }
5948 /// The standard list page token.
5949 ///
5950 /// Sets the *page token* query property to the given value.
5951 pub fn page_token(
5952 mut self,
5953 new_value: &str,
5954 ) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
5955 self._page_token = Some(new_value.to_string());
5956 self
5957 }
5958 /// The standard list page size.
5959 ///
5960 /// Sets the *page size* query property to the given value.
5961 pub fn page_size(mut self, new_value: i32) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
5962 self._page_size = Some(new_value);
5963 self
5964 }
5965 /// The standard list filter.
5966 ///
5967 /// Sets the *filter* query property to the given value.
5968 pub fn filter(mut self, new_value: &str) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
5969 self._filter = Some(new_value.to_string());
5970 self
5971 }
5972 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5973 /// while executing the actual API request.
5974 ///
5975 /// ````text
5976 /// It should be used to handle progress information, and to implement a certain level of resilience.
5977 /// ````
5978 ///
5979 /// Sets the *delegate* property to the given value.
5980 pub fn delegate(
5981 mut self,
5982 new_value: &'a mut dyn common::Delegate,
5983 ) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
5984 self._delegate = Some(new_value);
5985 self
5986 }
5987
5988 /// Set any additional parameter of the query string used in the request.
5989 /// It should be used to set parameters which are not yet available through their own
5990 /// setters.
5991 ///
5992 /// Please note that this method must not be used to set any of the known parameters
5993 /// which have their own setter method. If done anyway, the request will fail.
5994 ///
5995 /// # Additional Parameters
5996 ///
5997 /// * *$.xgafv* (query-string) - V1 error format.
5998 /// * *access_token* (query-string) - OAuth access token.
5999 /// * *alt* (query-string) - Data format for response.
6000 /// * *callback* (query-string) - JSONP
6001 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6002 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6003 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6004 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6005 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6006 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6007 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6008 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainOperationListCall<'a, C>
6009 where
6010 T: AsRef<str>,
6011 {
6012 self._additional_params
6013 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6014 self
6015 }
6016
6017 /// Identifies the authorization scope for the method you are building.
6018 ///
6019 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6020 /// [`Scope::FirebaseReadonly`].
6021 ///
6022 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6023 /// tokens for more than one scope.
6024 ///
6025 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6026 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6027 /// sufficient, a read-write scope will do as well.
6028 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainOperationListCall<'a, C>
6029 where
6030 St: AsRef<str>,
6031 {
6032 self._scopes.insert(String::from(scope.as_ref()));
6033 self
6034 }
6035 /// Identifies the authorization scope(s) for the method you are building.
6036 ///
6037 /// See [`Self::add_scope()`] for details.
6038 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainOperationListCall<'a, C>
6039 where
6040 I: IntoIterator<Item = St>,
6041 St: AsRef<str>,
6042 {
6043 self._scopes
6044 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6045 self
6046 }
6047
6048 /// Removes all scopes, and no default scope will be used either.
6049 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6050 /// for details).
6051 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
6052 self._scopes.clear();
6053 self
6054 }
6055}
6056
6057/// Creates a `CustomDomain`.
6058///
6059/// A builder for the *sites.customDomains.create* method supported by a *project* resource.
6060/// It is not used directly, but through a [`ProjectMethods`] instance.
6061///
6062/// # Example
6063///
6064/// Instantiate a resource method builder
6065///
6066/// ```test_harness,no_run
6067/// # extern crate hyper;
6068/// # extern crate hyper_rustls;
6069/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
6070/// use firebasehosting1_beta1::api::CustomDomain;
6071/// # async fn dox() {
6072/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6073///
6074/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6075/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6076/// # secret,
6077/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6078/// # ).build().await.unwrap();
6079///
6080/// # let client = hyper_util::client::legacy::Client::builder(
6081/// # hyper_util::rt::TokioExecutor::new()
6082/// # )
6083/// # .build(
6084/// # hyper_rustls::HttpsConnectorBuilder::new()
6085/// # .with_native_roots()
6086/// # .unwrap()
6087/// # .https_or_http()
6088/// # .enable_http1()
6089/// # .build()
6090/// # );
6091/// # let mut hub = FirebaseHosting::new(client, auth);
6092/// // As the method needs a request, you would usually fill it with the desired information
6093/// // into the respective structure. Some of the parts shown here might not be applicable !
6094/// // Values shown here are possibly random and not representative !
6095/// let mut req = CustomDomain::default();
6096///
6097/// // You can configure optional parameters by calling the respective setters at will, and
6098/// // execute the final call using `doit()`.
6099/// // Values shown here are possibly random and not representative !
6100/// let result = hub.projects().sites_custom_domains_create(req, "parent")
6101/// .validate_only(false)
6102/// .custom_domain_id("Lorem")
6103/// .doit().await;
6104/// # }
6105/// ```
6106pub struct ProjectSiteCustomDomainCreateCall<'a, C>
6107where
6108 C: 'a,
6109{
6110 hub: &'a FirebaseHosting<C>,
6111 _request: CustomDomain,
6112 _parent: String,
6113 _validate_only: Option<bool>,
6114 _custom_domain_id: Option<String>,
6115 _delegate: Option<&'a mut dyn common::Delegate>,
6116 _additional_params: HashMap<String, String>,
6117 _scopes: BTreeSet<String>,
6118}
6119
6120impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainCreateCall<'a, C> {}
6121
6122impl<'a, C> ProjectSiteCustomDomainCreateCall<'a, C>
6123where
6124 C: common::Connector,
6125{
6126 /// Perform the operation you have build so far.
6127 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6128 use std::borrow::Cow;
6129 use std::io::{Read, Seek};
6130
6131 use common::{url::Params, ToParts};
6132 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6133
6134 let mut dd = common::DefaultDelegate;
6135 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6136 dlg.begin(common::MethodInfo {
6137 id: "firebasehosting.projects.sites.customDomains.create",
6138 http_method: hyper::Method::POST,
6139 });
6140
6141 for &field in ["alt", "parent", "validateOnly", "customDomainId"].iter() {
6142 if self._additional_params.contains_key(field) {
6143 dlg.finished(false);
6144 return Err(common::Error::FieldClash(field));
6145 }
6146 }
6147
6148 let mut params = Params::with_capacity(6 + self._additional_params.len());
6149 params.push("parent", self._parent);
6150 if let Some(value) = self._validate_only.as_ref() {
6151 params.push("validateOnly", value.to_string());
6152 }
6153 if let Some(value) = self._custom_domain_id.as_ref() {
6154 params.push("customDomainId", value);
6155 }
6156
6157 params.extend(self._additional_params.iter());
6158
6159 params.push("alt", "json");
6160 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/customDomains";
6161 if self._scopes.is_empty() {
6162 self._scopes
6163 .insert(Scope::CloudPlatform.as_ref().to_string());
6164 }
6165
6166 #[allow(clippy::single_element_loop)]
6167 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6168 url = params.uri_replacement(url, param_name, find_this, true);
6169 }
6170 {
6171 let to_remove = ["parent"];
6172 params.remove_params(&to_remove);
6173 }
6174
6175 let url = params.parse_with_url(&url);
6176
6177 let mut json_mime_type = mime::APPLICATION_JSON;
6178 let mut request_value_reader = {
6179 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6180 common::remove_json_null_values(&mut value);
6181 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6182 serde_json::to_writer(&mut dst, &value).unwrap();
6183 dst
6184 };
6185 let request_size = request_value_reader
6186 .seek(std::io::SeekFrom::End(0))
6187 .unwrap();
6188 request_value_reader
6189 .seek(std::io::SeekFrom::Start(0))
6190 .unwrap();
6191
6192 loop {
6193 let token = match self
6194 .hub
6195 .auth
6196 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6197 .await
6198 {
6199 Ok(token) => token,
6200 Err(e) => match dlg.token(e) {
6201 Ok(token) => token,
6202 Err(e) => {
6203 dlg.finished(false);
6204 return Err(common::Error::MissingToken(e));
6205 }
6206 },
6207 };
6208 request_value_reader
6209 .seek(std::io::SeekFrom::Start(0))
6210 .unwrap();
6211 let mut req_result = {
6212 let client = &self.hub.client;
6213 dlg.pre_request();
6214 let mut req_builder = hyper::Request::builder()
6215 .method(hyper::Method::POST)
6216 .uri(url.as_str())
6217 .header(USER_AGENT, self.hub._user_agent.clone());
6218
6219 if let Some(token) = token.as_ref() {
6220 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6221 }
6222
6223 let request = req_builder
6224 .header(CONTENT_TYPE, json_mime_type.to_string())
6225 .header(CONTENT_LENGTH, request_size as u64)
6226 .body(common::to_body(
6227 request_value_reader.get_ref().clone().into(),
6228 ));
6229
6230 client.request(request.unwrap()).await
6231 };
6232
6233 match req_result {
6234 Err(err) => {
6235 if let common::Retry::After(d) = dlg.http_error(&err) {
6236 sleep(d).await;
6237 continue;
6238 }
6239 dlg.finished(false);
6240 return Err(common::Error::HttpError(err));
6241 }
6242 Ok(res) => {
6243 let (mut parts, body) = res.into_parts();
6244 let mut body = common::Body::new(body);
6245 if !parts.status.is_success() {
6246 let bytes = common::to_bytes(body).await.unwrap_or_default();
6247 let error = serde_json::from_str(&common::to_string(&bytes));
6248 let response = common::to_response(parts, bytes.into());
6249
6250 if let common::Retry::After(d) =
6251 dlg.http_failure(&response, error.as_ref().ok())
6252 {
6253 sleep(d).await;
6254 continue;
6255 }
6256
6257 dlg.finished(false);
6258
6259 return Err(match error {
6260 Ok(value) => common::Error::BadRequest(value),
6261 _ => common::Error::Failure(response),
6262 });
6263 }
6264 let response = {
6265 let bytes = common::to_bytes(body).await.unwrap_or_default();
6266 let encoded = common::to_string(&bytes);
6267 match serde_json::from_str(&encoded) {
6268 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6269 Err(error) => {
6270 dlg.response_json_decode_error(&encoded, &error);
6271 return Err(common::Error::JsonDecodeError(
6272 encoded.to_string(),
6273 error,
6274 ));
6275 }
6276 }
6277 };
6278
6279 dlg.finished(true);
6280 return Ok(response);
6281 }
6282 }
6283 }
6284 }
6285
6286 ///
6287 /// Sets the *request* property to the given value.
6288 ///
6289 /// Even though the property as already been set when instantiating this call,
6290 /// we provide this method for API completeness.
6291 pub fn request(mut self, new_value: CustomDomain) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6292 self._request = new_value;
6293 self
6294 }
6295 /// Required. The custom domain's parent, specifically a Firebase Hosting `Site`.
6296 ///
6297 /// Sets the *parent* path property to the given value.
6298 ///
6299 /// Even though the property as already been set when instantiating this call,
6300 /// we provide this method for API completeness.
6301 pub fn parent(mut self, new_value: &str) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6302 self._parent = new_value.to_string();
6303 self
6304 }
6305 /// If true, Hosting validates that it's possible to complete your request but doesn't actually create a new `CustomDomain`.
6306 ///
6307 /// Sets the *validate only* query property to the given value.
6308 pub fn validate_only(mut self, new_value: bool) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6309 self._validate_only = Some(new_value);
6310 self
6311 }
6312 /// Required. The ID of the `CustomDomain`, which is the domain name you'd like to use with Firebase Hosting.
6313 ///
6314 /// Sets the *custom domain id* query property to the given value.
6315 pub fn custom_domain_id(mut self, new_value: &str) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6316 self._custom_domain_id = Some(new_value.to_string());
6317 self
6318 }
6319 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6320 /// while executing the actual API request.
6321 ///
6322 /// ````text
6323 /// It should be used to handle progress information, and to implement a certain level of resilience.
6324 /// ````
6325 ///
6326 /// Sets the *delegate* property to the given value.
6327 pub fn delegate(
6328 mut self,
6329 new_value: &'a mut dyn common::Delegate,
6330 ) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6331 self._delegate = Some(new_value);
6332 self
6333 }
6334
6335 /// Set any additional parameter of the query string used in the request.
6336 /// It should be used to set parameters which are not yet available through their own
6337 /// setters.
6338 ///
6339 /// Please note that this method must not be used to set any of the known parameters
6340 /// which have their own setter method. If done anyway, the request will fail.
6341 ///
6342 /// # Additional Parameters
6343 ///
6344 /// * *$.xgafv* (query-string) - V1 error format.
6345 /// * *access_token* (query-string) - OAuth access token.
6346 /// * *alt* (query-string) - Data format for response.
6347 /// * *callback* (query-string) - JSONP
6348 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6349 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6350 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6351 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6352 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6353 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6354 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6355 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainCreateCall<'a, C>
6356 where
6357 T: AsRef<str>,
6358 {
6359 self._additional_params
6360 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6361 self
6362 }
6363
6364 /// Identifies the authorization scope for the method you are building.
6365 ///
6366 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6367 /// [`Scope::CloudPlatform`].
6368 ///
6369 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6370 /// tokens for more than one scope.
6371 ///
6372 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6373 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6374 /// sufficient, a read-write scope will do as well.
6375 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainCreateCall<'a, C>
6376 where
6377 St: AsRef<str>,
6378 {
6379 self._scopes.insert(String::from(scope.as_ref()));
6380 self
6381 }
6382 /// Identifies the authorization scope(s) for the method you are building.
6383 ///
6384 /// See [`Self::add_scope()`] for details.
6385 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainCreateCall<'a, C>
6386 where
6387 I: IntoIterator<Item = St>,
6388 St: AsRef<str>,
6389 {
6390 self._scopes
6391 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6392 self
6393 }
6394
6395 /// Removes all scopes, and no default scope will be used either.
6396 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6397 /// for details).
6398 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6399 self._scopes.clear();
6400 self
6401 }
6402}
6403
6404/// Deletes the specified `CustomDomain`.
6405///
6406/// A builder for the *sites.customDomains.delete* method supported by a *project* resource.
6407/// It is not used directly, but through a [`ProjectMethods`] instance.
6408///
6409/// # Example
6410///
6411/// Instantiate a resource method builder
6412///
6413/// ```test_harness,no_run
6414/// # extern crate hyper;
6415/// # extern crate hyper_rustls;
6416/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
6417/// # async fn dox() {
6418/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6419///
6420/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6421/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6422/// # secret,
6423/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6424/// # ).build().await.unwrap();
6425///
6426/// # let client = hyper_util::client::legacy::Client::builder(
6427/// # hyper_util::rt::TokioExecutor::new()
6428/// # )
6429/// # .build(
6430/// # hyper_rustls::HttpsConnectorBuilder::new()
6431/// # .with_native_roots()
6432/// # .unwrap()
6433/// # .https_or_http()
6434/// # .enable_http1()
6435/// # .build()
6436/// # );
6437/// # let mut hub = FirebaseHosting::new(client, auth);
6438/// // You can configure optional parameters by calling the respective setters at will, and
6439/// // execute the final call using `doit()`.
6440/// // Values shown here are possibly random and not representative !
6441/// let result = hub.projects().sites_custom_domains_delete("name")
6442/// .validate_only(false)
6443/// .etag("sed")
6444/// .allow_missing(false)
6445/// .doit().await;
6446/// # }
6447/// ```
6448pub struct ProjectSiteCustomDomainDeleteCall<'a, C>
6449where
6450 C: 'a,
6451{
6452 hub: &'a FirebaseHosting<C>,
6453 _name: String,
6454 _validate_only: Option<bool>,
6455 _etag: Option<String>,
6456 _allow_missing: Option<bool>,
6457 _delegate: Option<&'a mut dyn common::Delegate>,
6458 _additional_params: HashMap<String, String>,
6459 _scopes: BTreeSet<String>,
6460}
6461
6462impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainDeleteCall<'a, C> {}
6463
6464impl<'a, C> ProjectSiteCustomDomainDeleteCall<'a, C>
6465where
6466 C: common::Connector,
6467{
6468 /// Perform the operation you have build so far.
6469 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6470 use std::borrow::Cow;
6471 use std::io::{Read, Seek};
6472
6473 use common::{url::Params, ToParts};
6474 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6475
6476 let mut dd = common::DefaultDelegate;
6477 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6478 dlg.begin(common::MethodInfo {
6479 id: "firebasehosting.projects.sites.customDomains.delete",
6480 http_method: hyper::Method::DELETE,
6481 });
6482
6483 for &field in ["alt", "name", "validateOnly", "etag", "allowMissing"].iter() {
6484 if self._additional_params.contains_key(field) {
6485 dlg.finished(false);
6486 return Err(common::Error::FieldClash(field));
6487 }
6488 }
6489
6490 let mut params = Params::with_capacity(6 + self._additional_params.len());
6491 params.push("name", self._name);
6492 if let Some(value) = self._validate_only.as_ref() {
6493 params.push("validateOnly", value.to_string());
6494 }
6495 if let Some(value) = self._etag.as_ref() {
6496 params.push("etag", value);
6497 }
6498 if let Some(value) = self._allow_missing.as_ref() {
6499 params.push("allowMissing", value.to_string());
6500 }
6501
6502 params.extend(self._additional_params.iter());
6503
6504 params.push("alt", "json");
6505 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6506 if self._scopes.is_empty() {
6507 self._scopes
6508 .insert(Scope::CloudPlatform.as_ref().to_string());
6509 }
6510
6511 #[allow(clippy::single_element_loop)]
6512 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6513 url = params.uri_replacement(url, param_name, find_this, true);
6514 }
6515 {
6516 let to_remove = ["name"];
6517 params.remove_params(&to_remove);
6518 }
6519
6520 let url = params.parse_with_url(&url);
6521
6522 loop {
6523 let token = match self
6524 .hub
6525 .auth
6526 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6527 .await
6528 {
6529 Ok(token) => token,
6530 Err(e) => match dlg.token(e) {
6531 Ok(token) => token,
6532 Err(e) => {
6533 dlg.finished(false);
6534 return Err(common::Error::MissingToken(e));
6535 }
6536 },
6537 };
6538 let mut req_result = {
6539 let client = &self.hub.client;
6540 dlg.pre_request();
6541 let mut req_builder = hyper::Request::builder()
6542 .method(hyper::Method::DELETE)
6543 .uri(url.as_str())
6544 .header(USER_AGENT, self.hub._user_agent.clone());
6545
6546 if let Some(token) = token.as_ref() {
6547 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6548 }
6549
6550 let request = req_builder
6551 .header(CONTENT_LENGTH, 0_u64)
6552 .body(common::to_body::<String>(None));
6553
6554 client.request(request.unwrap()).await
6555 };
6556
6557 match req_result {
6558 Err(err) => {
6559 if let common::Retry::After(d) = dlg.http_error(&err) {
6560 sleep(d).await;
6561 continue;
6562 }
6563 dlg.finished(false);
6564 return Err(common::Error::HttpError(err));
6565 }
6566 Ok(res) => {
6567 let (mut parts, body) = res.into_parts();
6568 let mut body = common::Body::new(body);
6569 if !parts.status.is_success() {
6570 let bytes = common::to_bytes(body).await.unwrap_or_default();
6571 let error = serde_json::from_str(&common::to_string(&bytes));
6572 let response = common::to_response(parts, bytes.into());
6573
6574 if let common::Retry::After(d) =
6575 dlg.http_failure(&response, error.as_ref().ok())
6576 {
6577 sleep(d).await;
6578 continue;
6579 }
6580
6581 dlg.finished(false);
6582
6583 return Err(match error {
6584 Ok(value) => common::Error::BadRequest(value),
6585 _ => common::Error::Failure(response),
6586 });
6587 }
6588 let response = {
6589 let bytes = common::to_bytes(body).await.unwrap_or_default();
6590 let encoded = common::to_string(&bytes);
6591 match serde_json::from_str(&encoded) {
6592 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6593 Err(error) => {
6594 dlg.response_json_decode_error(&encoded, &error);
6595 return Err(common::Error::JsonDecodeError(
6596 encoded.to_string(),
6597 error,
6598 ));
6599 }
6600 }
6601 };
6602
6603 dlg.finished(true);
6604 return Ok(response);
6605 }
6606 }
6607 }
6608 }
6609
6610 /// Required. The name of the `CustomDomain` to delete.
6611 ///
6612 /// Sets the *name* path property to the given value.
6613 ///
6614 /// Even though the property as already been set when instantiating this call,
6615 /// we provide this method for API completeness.
6616 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6617 self._name = new_value.to_string();
6618 self
6619 }
6620 /// If true, Hosting validates that it's possible to complete your request but doesn't actually delete the `CustomDomain`.
6621 ///
6622 /// Sets the *validate only* query property to the given value.
6623 pub fn validate_only(mut self, new_value: bool) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6624 self._validate_only = Some(new_value);
6625 self
6626 }
6627 /// A tag that represents the state of the `CustomDomain` as you know it. If present, the supplied tag must match the current value on your `CustomDomain`, or the request fails.
6628 ///
6629 /// Sets the *etag* query property to the given value.
6630 pub fn etag(mut self, new_value: &str) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6631 self._etag = Some(new_value.to_string());
6632 self
6633 }
6634 /// If true, the request succeeds even if the `CustomDomain` doesn't exist.
6635 ///
6636 /// Sets the *allow missing* query property to the given value.
6637 pub fn allow_missing(mut self, new_value: bool) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6638 self._allow_missing = Some(new_value);
6639 self
6640 }
6641 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6642 /// while executing the actual API request.
6643 ///
6644 /// ````text
6645 /// It should be used to handle progress information, and to implement a certain level of resilience.
6646 /// ````
6647 ///
6648 /// Sets the *delegate* property to the given value.
6649 pub fn delegate(
6650 mut self,
6651 new_value: &'a mut dyn common::Delegate,
6652 ) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6653 self._delegate = Some(new_value);
6654 self
6655 }
6656
6657 /// Set any additional parameter of the query string used in the request.
6658 /// It should be used to set parameters which are not yet available through their own
6659 /// setters.
6660 ///
6661 /// Please note that this method must not be used to set any of the known parameters
6662 /// which have their own setter method. If done anyway, the request will fail.
6663 ///
6664 /// # Additional Parameters
6665 ///
6666 /// * *$.xgafv* (query-string) - V1 error format.
6667 /// * *access_token* (query-string) - OAuth access token.
6668 /// * *alt* (query-string) - Data format for response.
6669 /// * *callback* (query-string) - JSONP
6670 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6671 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6672 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6673 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6674 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6675 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6676 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6677 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainDeleteCall<'a, C>
6678 where
6679 T: AsRef<str>,
6680 {
6681 self._additional_params
6682 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6683 self
6684 }
6685
6686 /// Identifies the authorization scope for the method you are building.
6687 ///
6688 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6689 /// [`Scope::CloudPlatform`].
6690 ///
6691 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6692 /// tokens for more than one scope.
6693 ///
6694 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6695 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6696 /// sufficient, a read-write scope will do as well.
6697 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainDeleteCall<'a, C>
6698 where
6699 St: AsRef<str>,
6700 {
6701 self._scopes.insert(String::from(scope.as_ref()));
6702 self
6703 }
6704 /// Identifies the authorization scope(s) for the method you are building.
6705 ///
6706 /// See [`Self::add_scope()`] for details.
6707 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainDeleteCall<'a, C>
6708 where
6709 I: IntoIterator<Item = St>,
6710 St: AsRef<str>,
6711 {
6712 self._scopes
6713 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6714 self
6715 }
6716
6717 /// Removes all scopes, and no default scope will be used either.
6718 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6719 /// for details).
6720 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6721 self._scopes.clear();
6722 self
6723 }
6724}
6725
6726/// Gets the specified `CustomDomain`.
6727///
6728/// A builder for the *sites.customDomains.get* method supported by a *project* resource.
6729/// It is not used directly, but through a [`ProjectMethods`] instance.
6730///
6731/// # Example
6732///
6733/// Instantiate a resource method builder
6734///
6735/// ```test_harness,no_run
6736/// # extern crate hyper;
6737/// # extern crate hyper_rustls;
6738/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
6739/// # async fn dox() {
6740/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6741///
6742/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6743/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6744/// # secret,
6745/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6746/// # ).build().await.unwrap();
6747///
6748/// # let client = hyper_util::client::legacy::Client::builder(
6749/// # hyper_util::rt::TokioExecutor::new()
6750/// # )
6751/// # .build(
6752/// # hyper_rustls::HttpsConnectorBuilder::new()
6753/// # .with_native_roots()
6754/// # .unwrap()
6755/// # .https_or_http()
6756/// # .enable_http1()
6757/// # .build()
6758/// # );
6759/// # let mut hub = FirebaseHosting::new(client, auth);
6760/// // You can configure optional parameters by calling the respective setters at will, and
6761/// // execute the final call using `doit()`.
6762/// // Values shown here are possibly random and not representative !
6763/// let result = hub.projects().sites_custom_domains_get("name")
6764/// .doit().await;
6765/// # }
6766/// ```
6767pub struct ProjectSiteCustomDomainGetCall<'a, C>
6768where
6769 C: 'a,
6770{
6771 hub: &'a FirebaseHosting<C>,
6772 _name: String,
6773 _delegate: Option<&'a mut dyn common::Delegate>,
6774 _additional_params: HashMap<String, String>,
6775 _scopes: BTreeSet<String>,
6776}
6777
6778impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainGetCall<'a, C> {}
6779
6780impl<'a, C> ProjectSiteCustomDomainGetCall<'a, C>
6781where
6782 C: common::Connector,
6783{
6784 /// Perform the operation you have build so far.
6785 pub async fn doit(mut self) -> common::Result<(common::Response, CustomDomain)> {
6786 use std::borrow::Cow;
6787 use std::io::{Read, Seek};
6788
6789 use common::{url::Params, ToParts};
6790 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6791
6792 let mut dd = common::DefaultDelegate;
6793 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6794 dlg.begin(common::MethodInfo {
6795 id: "firebasehosting.projects.sites.customDomains.get",
6796 http_method: hyper::Method::GET,
6797 });
6798
6799 for &field in ["alt", "name"].iter() {
6800 if self._additional_params.contains_key(field) {
6801 dlg.finished(false);
6802 return Err(common::Error::FieldClash(field));
6803 }
6804 }
6805
6806 let mut params = Params::with_capacity(3 + self._additional_params.len());
6807 params.push("name", self._name);
6808
6809 params.extend(self._additional_params.iter());
6810
6811 params.push("alt", "json");
6812 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6813 if self._scopes.is_empty() {
6814 self._scopes
6815 .insert(Scope::FirebaseReadonly.as_ref().to_string());
6816 }
6817
6818 #[allow(clippy::single_element_loop)]
6819 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6820 url = params.uri_replacement(url, param_name, find_this, true);
6821 }
6822 {
6823 let to_remove = ["name"];
6824 params.remove_params(&to_remove);
6825 }
6826
6827 let url = params.parse_with_url(&url);
6828
6829 loop {
6830 let token = match self
6831 .hub
6832 .auth
6833 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6834 .await
6835 {
6836 Ok(token) => token,
6837 Err(e) => match dlg.token(e) {
6838 Ok(token) => token,
6839 Err(e) => {
6840 dlg.finished(false);
6841 return Err(common::Error::MissingToken(e));
6842 }
6843 },
6844 };
6845 let mut req_result = {
6846 let client = &self.hub.client;
6847 dlg.pre_request();
6848 let mut req_builder = hyper::Request::builder()
6849 .method(hyper::Method::GET)
6850 .uri(url.as_str())
6851 .header(USER_AGENT, self.hub._user_agent.clone());
6852
6853 if let Some(token) = token.as_ref() {
6854 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6855 }
6856
6857 let request = req_builder
6858 .header(CONTENT_LENGTH, 0_u64)
6859 .body(common::to_body::<String>(None));
6860
6861 client.request(request.unwrap()).await
6862 };
6863
6864 match req_result {
6865 Err(err) => {
6866 if let common::Retry::After(d) = dlg.http_error(&err) {
6867 sleep(d).await;
6868 continue;
6869 }
6870 dlg.finished(false);
6871 return Err(common::Error::HttpError(err));
6872 }
6873 Ok(res) => {
6874 let (mut parts, body) = res.into_parts();
6875 let mut body = common::Body::new(body);
6876 if !parts.status.is_success() {
6877 let bytes = common::to_bytes(body).await.unwrap_or_default();
6878 let error = serde_json::from_str(&common::to_string(&bytes));
6879 let response = common::to_response(parts, bytes.into());
6880
6881 if let common::Retry::After(d) =
6882 dlg.http_failure(&response, error.as_ref().ok())
6883 {
6884 sleep(d).await;
6885 continue;
6886 }
6887
6888 dlg.finished(false);
6889
6890 return Err(match error {
6891 Ok(value) => common::Error::BadRequest(value),
6892 _ => common::Error::Failure(response),
6893 });
6894 }
6895 let response = {
6896 let bytes = common::to_bytes(body).await.unwrap_or_default();
6897 let encoded = common::to_string(&bytes);
6898 match serde_json::from_str(&encoded) {
6899 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6900 Err(error) => {
6901 dlg.response_json_decode_error(&encoded, &error);
6902 return Err(common::Error::JsonDecodeError(
6903 encoded.to_string(),
6904 error,
6905 ));
6906 }
6907 }
6908 };
6909
6910 dlg.finished(true);
6911 return Ok(response);
6912 }
6913 }
6914 }
6915 }
6916
6917 /// Required. The name of the `CustomDomain` to get.
6918 ///
6919 /// Sets the *name* path property to the given value.
6920 ///
6921 /// Even though the property as already been set when instantiating this call,
6922 /// we provide this method for API completeness.
6923 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainGetCall<'a, C> {
6924 self._name = new_value.to_string();
6925 self
6926 }
6927 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6928 /// while executing the actual API request.
6929 ///
6930 /// ````text
6931 /// It should be used to handle progress information, and to implement a certain level of resilience.
6932 /// ````
6933 ///
6934 /// Sets the *delegate* property to the given value.
6935 pub fn delegate(
6936 mut self,
6937 new_value: &'a mut dyn common::Delegate,
6938 ) -> ProjectSiteCustomDomainGetCall<'a, C> {
6939 self._delegate = Some(new_value);
6940 self
6941 }
6942
6943 /// Set any additional parameter of the query string used in the request.
6944 /// It should be used to set parameters which are not yet available through their own
6945 /// setters.
6946 ///
6947 /// Please note that this method must not be used to set any of the known parameters
6948 /// which have their own setter method. If done anyway, the request will fail.
6949 ///
6950 /// # Additional Parameters
6951 ///
6952 /// * *$.xgafv* (query-string) - V1 error format.
6953 /// * *access_token* (query-string) - OAuth access token.
6954 /// * *alt* (query-string) - Data format for response.
6955 /// * *callback* (query-string) - JSONP
6956 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6957 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6958 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6959 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6960 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6961 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6962 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6963 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainGetCall<'a, C>
6964 where
6965 T: AsRef<str>,
6966 {
6967 self._additional_params
6968 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6969 self
6970 }
6971
6972 /// Identifies the authorization scope for the method you are building.
6973 ///
6974 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6975 /// [`Scope::FirebaseReadonly`].
6976 ///
6977 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6978 /// tokens for more than one scope.
6979 ///
6980 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6981 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6982 /// sufficient, a read-write scope will do as well.
6983 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainGetCall<'a, C>
6984 where
6985 St: AsRef<str>,
6986 {
6987 self._scopes.insert(String::from(scope.as_ref()));
6988 self
6989 }
6990 /// Identifies the authorization scope(s) for the method you are building.
6991 ///
6992 /// See [`Self::add_scope()`] for details.
6993 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainGetCall<'a, C>
6994 where
6995 I: IntoIterator<Item = St>,
6996 St: AsRef<str>,
6997 {
6998 self._scopes
6999 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7000 self
7001 }
7002
7003 /// Removes all scopes, and no default scope will be used either.
7004 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7005 /// for details).
7006 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainGetCall<'a, C> {
7007 self._scopes.clear();
7008 self
7009 }
7010}
7011
7012/// Lists each `CustomDomain` associated with the specified parent Hosting site. Returns `CustomDomain`s in a consistent, but undefined, order to facilitate pagination.
7013///
7014/// A builder for the *sites.customDomains.list* method supported by a *project* resource.
7015/// It is not used directly, but through a [`ProjectMethods`] instance.
7016///
7017/// # Example
7018///
7019/// Instantiate a resource method builder
7020///
7021/// ```test_harness,no_run
7022/// # extern crate hyper;
7023/// # extern crate hyper_rustls;
7024/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
7025/// # async fn dox() {
7026/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7027///
7028/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7029/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7030/// # secret,
7031/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7032/// # ).build().await.unwrap();
7033///
7034/// # let client = hyper_util::client::legacy::Client::builder(
7035/// # hyper_util::rt::TokioExecutor::new()
7036/// # )
7037/// # .build(
7038/// # hyper_rustls::HttpsConnectorBuilder::new()
7039/// # .with_native_roots()
7040/// # .unwrap()
7041/// # .https_or_http()
7042/// # .enable_http1()
7043/// # .build()
7044/// # );
7045/// # let mut hub = FirebaseHosting::new(client, auth);
7046/// // You can configure optional parameters by calling the respective setters at will, and
7047/// // execute the final call using `doit()`.
7048/// // Values shown here are possibly random and not representative !
7049/// let result = hub.projects().sites_custom_domains_list("parent")
7050/// .show_deleted(true)
7051/// .page_token("et")
7052/// .page_size(-68)
7053/// .doit().await;
7054/// # }
7055/// ```
7056pub struct ProjectSiteCustomDomainListCall<'a, C>
7057where
7058 C: 'a,
7059{
7060 hub: &'a FirebaseHosting<C>,
7061 _parent: String,
7062 _show_deleted: Option<bool>,
7063 _page_token: Option<String>,
7064 _page_size: Option<i32>,
7065 _delegate: Option<&'a mut dyn common::Delegate>,
7066 _additional_params: HashMap<String, String>,
7067 _scopes: BTreeSet<String>,
7068}
7069
7070impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainListCall<'a, C> {}
7071
7072impl<'a, C> ProjectSiteCustomDomainListCall<'a, C>
7073where
7074 C: common::Connector,
7075{
7076 /// Perform the operation you have build so far.
7077 pub async fn doit(mut self) -> common::Result<(common::Response, ListCustomDomainsResponse)> {
7078 use std::borrow::Cow;
7079 use std::io::{Read, Seek};
7080
7081 use common::{url::Params, ToParts};
7082 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7083
7084 let mut dd = common::DefaultDelegate;
7085 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7086 dlg.begin(common::MethodInfo {
7087 id: "firebasehosting.projects.sites.customDomains.list",
7088 http_method: hyper::Method::GET,
7089 });
7090
7091 for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
7092 if self._additional_params.contains_key(field) {
7093 dlg.finished(false);
7094 return Err(common::Error::FieldClash(field));
7095 }
7096 }
7097
7098 let mut params = Params::with_capacity(6 + self._additional_params.len());
7099 params.push("parent", self._parent);
7100 if let Some(value) = self._show_deleted.as_ref() {
7101 params.push("showDeleted", value.to_string());
7102 }
7103 if let Some(value) = self._page_token.as_ref() {
7104 params.push("pageToken", value);
7105 }
7106 if let Some(value) = self._page_size.as_ref() {
7107 params.push("pageSize", value.to_string());
7108 }
7109
7110 params.extend(self._additional_params.iter());
7111
7112 params.push("alt", "json");
7113 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/customDomains";
7114 if self._scopes.is_empty() {
7115 self._scopes
7116 .insert(Scope::FirebaseReadonly.as_ref().to_string());
7117 }
7118
7119 #[allow(clippy::single_element_loop)]
7120 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7121 url = params.uri_replacement(url, param_name, find_this, true);
7122 }
7123 {
7124 let to_remove = ["parent"];
7125 params.remove_params(&to_remove);
7126 }
7127
7128 let url = params.parse_with_url(&url);
7129
7130 loop {
7131 let token = match self
7132 .hub
7133 .auth
7134 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7135 .await
7136 {
7137 Ok(token) => token,
7138 Err(e) => match dlg.token(e) {
7139 Ok(token) => token,
7140 Err(e) => {
7141 dlg.finished(false);
7142 return Err(common::Error::MissingToken(e));
7143 }
7144 },
7145 };
7146 let mut req_result = {
7147 let client = &self.hub.client;
7148 dlg.pre_request();
7149 let mut req_builder = hyper::Request::builder()
7150 .method(hyper::Method::GET)
7151 .uri(url.as_str())
7152 .header(USER_AGENT, self.hub._user_agent.clone());
7153
7154 if let Some(token) = token.as_ref() {
7155 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7156 }
7157
7158 let request = req_builder
7159 .header(CONTENT_LENGTH, 0_u64)
7160 .body(common::to_body::<String>(None));
7161
7162 client.request(request.unwrap()).await
7163 };
7164
7165 match req_result {
7166 Err(err) => {
7167 if let common::Retry::After(d) = dlg.http_error(&err) {
7168 sleep(d).await;
7169 continue;
7170 }
7171 dlg.finished(false);
7172 return Err(common::Error::HttpError(err));
7173 }
7174 Ok(res) => {
7175 let (mut parts, body) = res.into_parts();
7176 let mut body = common::Body::new(body);
7177 if !parts.status.is_success() {
7178 let bytes = common::to_bytes(body).await.unwrap_or_default();
7179 let error = serde_json::from_str(&common::to_string(&bytes));
7180 let response = common::to_response(parts, bytes.into());
7181
7182 if let common::Retry::After(d) =
7183 dlg.http_failure(&response, error.as_ref().ok())
7184 {
7185 sleep(d).await;
7186 continue;
7187 }
7188
7189 dlg.finished(false);
7190
7191 return Err(match error {
7192 Ok(value) => common::Error::BadRequest(value),
7193 _ => common::Error::Failure(response),
7194 });
7195 }
7196 let response = {
7197 let bytes = common::to_bytes(body).await.unwrap_or_default();
7198 let encoded = common::to_string(&bytes);
7199 match serde_json::from_str(&encoded) {
7200 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7201 Err(error) => {
7202 dlg.response_json_decode_error(&encoded, &error);
7203 return Err(common::Error::JsonDecodeError(
7204 encoded.to_string(),
7205 error,
7206 ));
7207 }
7208 }
7209 };
7210
7211 dlg.finished(true);
7212 return Ok(response);
7213 }
7214 }
7215 }
7216 }
7217
7218 /// Required. The Firebase Hosting `Site` with `CustomDomain` entities you'd like to list.
7219 ///
7220 /// Sets the *parent* path property to the given value.
7221 ///
7222 /// Even though the property as already been set when instantiating this call,
7223 /// we provide this method for API completeness.
7224 pub fn parent(mut self, new_value: &str) -> ProjectSiteCustomDomainListCall<'a, C> {
7225 self._parent = new_value.to_string();
7226 self
7227 }
7228 /// If true, the request returns soft-deleted `CustomDomain`s that haven't been fully-deleted yet. To restore deleted `CustomDomain`s, make an `UndeleteCustomDomain` request.
7229 ///
7230 /// Sets the *show deleted* query property to the given value.
7231 pub fn show_deleted(mut self, new_value: bool) -> ProjectSiteCustomDomainListCall<'a, C> {
7232 self._show_deleted = Some(new_value);
7233 self
7234 }
7235 /// A token from a previous call to `ListCustomDomains` that tells the server where to resume listing.
7236 ///
7237 /// Sets the *page token* query property to the given value.
7238 pub fn page_token(mut self, new_value: &str) -> ProjectSiteCustomDomainListCall<'a, C> {
7239 self._page_token = Some(new_value.to_string());
7240 self
7241 }
7242 /// The max number of `CustomDomain` entities to return in a request. Defaults to 10.
7243 ///
7244 /// Sets the *page size* query property to the given value.
7245 pub fn page_size(mut self, new_value: i32) -> ProjectSiteCustomDomainListCall<'a, C> {
7246 self._page_size = Some(new_value);
7247 self
7248 }
7249 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7250 /// while executing the actual API request.
7251 ///
7252 /// ````text
7253 /// It should be used to handle progress information, and to implement a certain level of resilience.
7254 /// ````
7255 ///
7256 /// Sets the *delegate* property to the given value.
7257 pub fn delegate(
7258 mut self,
7259 new_value: &'a mut dyn common::Delegate,
7260 ) -> ProjectSiteCustomDomainListCall<'a, C> {
7261 self._delegate = Some(new_value);
7262 self
7263 }
7264
7265 /// Set any additional parameter of the query string used in the request.
7266 /// It should be used to set parameters which are not yet available through their own
7267 /// setters.
7268 ///
7269 /// Please note that this method must not be used to set any of the known parameters
7270 /// which have their own setter method. If done anyway, the request will fail.
7271 ///
7272 /// # Additional Parameters
7273 ///
7274 /// * *$.xgafv* (query-string) - V1 error format.
7275 /// * *access_token* (query-string) - OAuth access token.
7276 /// * *alt* (query-string) - Data format for response.
7277 /// * *callback* (query-string) - JSONP
7278 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7279 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7280 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7281 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7282 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7283 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7284 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7285 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainListCall<'a, C>
7286 where
7287 T: AsRef<str>,
7288 {
7289 self._additional_params
7290 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7291 self
7292 }
7293
7294 /// Identifies the authorization scope for the method you are building.
7295 ///
7296 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7297 /// [`Scope::FirebaseReadonly`].
7298 ///
7299 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7300 /// tokens for more than one scope.
7301 ///
7302 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7303 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7304 /// sufficient, a read-write scope will do as well.
7305 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainListCall<'a, C>
7306 where
7307 St: AsRef<str>,
7308 {
7309 self._scopes.insert(String::from(scope.as_ref()));
7310 self
7311 }
7312 /// Identifies the authorization scope(s) for the method you are building.
7313 ///
7314 /// See [`Self::add_scope()`] for details.
7315 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainListCall<'a, C>
7316 where
7317 I: IntoIterator<Item = St>,
7318 St: AsRef<str>,
7319 {
7320 self._scopes
7321 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7322 self
7323 }
7324
7325 /// Removes all scopes, and no default scope will be used either.
7326 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7327 /// for details).
7328 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainListCall<'a, C> {
7329 self._scopes.clear();
7330 self
7331 }
7332}
7333
7334/// Updates the specified `CustomDomain`.
7335///
7336/// A builder for the *sites.customDomains.patch* method supported by a *project* resource.
7337/// It is not used directly, but through a [`ProjectMethods`] instance.
7338///
7339/// # Example
7340///
7341/// Instantiate a resource method builder
7342///
7343/// ```test_harness,no_run
7344/// # extern crate hyper;
7345/// # extern crate hyper_rustls;
7346/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
7347/// use firebasehosting1_beta1::api::CustomDomain;
7348/// # async fn dox() {
7349/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7350///
7351/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7352/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7353/// # secret,
7354/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7355/// # ).build().await.unwrap();
7356///
7357/// # let client = hyper_util::client::legacy::Client::builder(
7358/// # hyper_util::rt::TokioExecutor::new()
7359/// # )
7360/// # .build(
7361/// # hyper_rustls::HttpsConnectorBuilder::new()
7362/// # .with_native_roots()
7363/// # .unwrap()
7364/// # .https_or_http()
7365/// # .enable_http1()
7366/// # .build()
7367/// # );
7368/// # let mut hub = FirebaseHosting::new(client, auth);
7369/// // As the method needs a request, you would usually fill it with the desired information
7370/// // into the respective structure. Some of the parts shown here might not be applicable !
7371/// // Values shown here are possibly random and not representative !
7372/// let mut req = CustomDomain::default();
7373///
7374/// // You can configure optional parameters by calling the respective setters at will, and
7375/// // execute the final call using `doit()`.
7376/// // Values shown here are possibly random and not representative !
7377/// let result = hub.projects().sites_custom_domains_patch(req, "name")
7378/// .validate_only(false)
7379/// .update_mask(FieldMask::new::<&str>(&[]))
7380/// .allow_missing(false)
7381/// .doit().await;
7382/// # }
7383/// ```
7384pub struct ProjectSiteCustomDomainPatchCall<'a, C>
7385where
7386 C: 'a,
7387{
7388 hub: &'a FirebaseHosting<C>,
7389 _request: CustomDomain,
7390 _name: String,
7391 _validate_only: Option<bool>,
7392 _update_mask: Option<common::FieldMask>,
7393 _allow_missing: Option<bool>,
7394 _delegate: Option<&'a mut dyn common::Delegate>,
7395 _additional_params: HashMap<String, String>,
7396 _scopes: BTreeSet<String>,
7397}
7398
7399impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainPatchCall<'a, C> {}
7400
7401impl<'a, C> ProjectSiteCustomDomainPatchCall<'a, C>
7402where
7403 C: common::Connector,
7404{
7405 /// Perform the operation you have build so far.
7406 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7407 use std::borrow::Cow;
7408 use std::io::{Read, Seek};
7409
7410 use common::{url::Params, ToParts};
7411 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7412
7413 let mut dd = common::DefaultDelegate;
7414 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7415 dlg.begin(common::MethodInfo {
7416 id: "firebasehosting.projects.sites.customDomains.patch",
7417 http_method: hyper::Method::PATCH,
7418 });
7419
7420 for &field in ["alt", "name", "validateOnly", "updateMask", "allowMissing"].iter() {
7421 if self._additional_params.contains_key(field) {
7422 dlg.finished(false);
7423 return Err(common::Error::FieldClash(field));
7424 }
7425 }
7426
7427 let mut params = Params::with_capacity(7 + self._additional_params.len());
7428 params.push("name", self._name);
7429 if let Some(value) = self._validate_only.as_ref() {
7430 params.push("validateOnly", value.to_string());
7431 }
7432 if let Some(value) = self._update_mask.as_ref() {
7433 params.push("updateMask", value.to_string());
7434 }
7435 if let Some(value) = self._allow_missing.as_ref() {
7436 params.push("allowMissing", value.to_string());
7437 }
7438
7439 params.extend(self._additional_params.iter());
7440
7441 params.push("alt", "json");
7442 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7443 if self._scopes.is_empty() {
7444 self._scopes
7445 .insert(Scope::CloudPlatform.as_ref().to_string());
7446 }
7447
7448 #[allow(clippy::single_element_loop)]
7449 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7450 url = params.uri_replacement(url, param_name, find_this, true);
7451 }
7452 {
7453 let to_remove = ["name"];
7454 params.remove_params(&to_remove);
7455 }
7456
7457 let url = params.parse_with_url(&url);
7458
7459 let mut json_mime_type = mime::APPLICATION_JSON;
7460 let mut request_value_reader = {
7461 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7462 common::remove_json_null_values(&mut value);
7463 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7464 serde_json::to_writer(&mut dst, &value).unwrap();
7465 dst
7466 };
7467 let request_size = request_value_reader
7468 .seek(std::io::SeekFrom::End(0))
7469 .unwrap();
7470 request_value_reader
7471 .seek(std::io::SeekFrom::Start(0))
7472 .unwrap();
7473
7474 loop {
7475 let token = match self
7476 .hub
7477 .auth
7478 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7479 .await
7480 {
7481 Ok(token) => token,
7482 Err(e) => match dlg.token(e) {
7483 Ok(token) => token,
7484 Err(e) => {
7485 dlg.finished(false);
7486 return Err(common::Error::MissingToken(e));
7487 }
7488 },
7489 };
7490 request_value_reader
7491 .seek(std::io::SeekFrom::Start(0))
7492 .unwrap();
7493 let mut req_result = {
7494 let client = &self.hub.client;
7495 dlg.pre_request();
7496 let mut req_builder = hyper::Request::builder()
7497 .method(hyper::Method::PATCH)
7498 .uri(url.as_str())
7499 .header(USER_AGENT, self.hub._user_agent.clone());
7500
7501 if let Some(token) = token.as_ref() {
7502 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7503 }
7504
7505 let request = req_builder
7506 .header(CONTENT_TYPE, json_mime_type.to_string())
7507 .header(CONTENT_LENGTH, request_size as u64)
7508 .body(common::to_body(
7509 request_value_reader.get_ref().clone().into(),
7510 ));
7511
7512 client.request(request.unwrap()).await
7513 };
7514
7515 match req_result {
7516 Err(err) => {
7517 if let common::Retry::After(d) = dlg.http_error(&err) {
7518 sleep(d).await;
7519 continue;
7520 }
7521 dlg.finished(false);
7522 return Err(common::Error::HttpError(err));
7523 }
7524 Ok(res) => {
7525 let (mut parts, body) = res.into_parts();
7526 let mut body = common::Body::new(body);
7527 if !parts.status.is_success() {
7528 let bytes = common::to_bytes(body).await.unwrap_or_default();
7529 let error = serde_json::from_str(&common::to_string(&bytes));
7530 let response = common::to_response(parts, bytes.into());
7531
7532 if let common::Retry::After(d) =
7533 dlg.http_failure(&response, error.as_ref().ok())
7534 {
7535 sleep(d).await;
7536 continue;
7537 }
7538
7539 dlg.finished(false);
7540
7541 return Err(match error {
7542 Ok(value) => common::Error::BadRequest(value),
7543 _ => common::Error::Failure(response),
7544 });
7545 }
7546 let response = {
7547 let bytes = common::to_bytes(body).await.unwrap_or_default();
7548 let encoded = common::to_string(&bytes);
7549 match serde_json::from_str(&encoded) {
7550 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7551 Err(error) => {
7552 dlg.response_json_decode_error(&encoded, &error);
7553 return Err(common::Error::JsonDecodeError(
7554 encoded.to_string(),
7555 error,
7556 ));
7557 }
7558 }
7559 };
7560
7561 dlg.finished(true);
7562 return Ok(response);
7563 }
7564 }
7565 }
7566 }
7567
7568 ///
7569 /// Sets the *request* property to the given value.
7570 ///
7571 /// Even though the property as already been set when instantiating this call,
7572 /// we provide this method for API completeness.
7573 pub fn request(mut self, new_value: CustomDomain) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7574 self._request = new_value;
7575 self
7576 }
7577 /// Output only. The fully-qualified name of the `CustomDomain`.
7578 ///
7579 /// Sets the *name* path property to the given value.
7580 ///
7581 /// Even though the property as already been set when instantiating this call,
7582 /// we provide this method for API completeness.
7583 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7584 self._name = new_value.to_string();
7585 self
7586 }
7587 /// If true, Hosting validates that it's possible to complete your request but doesn't actually create or update the `CustomDomain`.
7588 ///
7589 /// Sets the *validate only* query property to the given value.
7590 pub fn validate_only(mut self, new_value: bool) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7591 self._validate_only = Some(new_value);
7592 self
7593 }
7594 /// The set of field names from your `CustomDomain` that you want to update. A field will be overwritten if, and only if, it's in the mask. If you don't provide a mask, Hosting updates the entire `CustomDomain`.
7595 ///
7596 /// Sets the *update mask* query property to the given value.
7597 pub fn update_mask(
7598 mut self,
7599 new_value: common::FieldMask,
7600 ) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7601 self._update_mask = Some(new_value);
7602 self
7603 }
7604 /// If true, Hosting creates the `CustomDomain` if it doesn't already exist.
7605 ///
7606 /// Sets the *allow missing* query property to the given value.
7607 pub fn allow_missing(mut self, new_value: bool) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7608 self._allow_missing = Some(new_value);
7609 self
7610 }
7611 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7612 /// while executing the actual API request.
7613 ///
7614 /// ````text
7615 /// It should be used to handle progress information, and to implement a certain level of resilience.
7616 /// ````
7617 ///
7618 /// Sets the *delegate* property to the given value.
7619 pub fn delegate(
7620 mut self,
7621 new_value: &'a mut dyn common::Delegate,
7622 ) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7623 self._delegate = Some(new_value);
7624 self
7625 }
7626
7627 /// Set any additional parameter of the query string used in the request.
7628 /// It should be used to set parameters which are not yet available through their own
7629 /// setters.
7630 ///
7631 /// Please note that this method must not be used to set any of the known parameters
7632 /// which have their own setter method. If done anyway, the request will fail.
7633 ///
7634 /// # Additional Parameters
7635 ///
7636 /// * *$.xgafv* (query-string) - V1 error format.
7637 /// * *access_token* (query-string) - OAuth access token.
7638 /// * *alt* (query-string) - Data format for response.
7639 /// * *callback* (query-string) - JSONP
7640 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7641 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7642 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7643 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7644 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7645 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7646 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7647 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainPatchCall<'a, C>
7648 where
7649 T: AsRef<str>,
7650 {
7651 self._additional_params
7652 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7653 self
7654 }
7655
7656 /// Identifies the authorization scope for the method you are building.
7657 ///
7658 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7659 /// [`Scope::CloudPlatform`].
7660 ///
7661 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7662 /// tokens for more than one scope.
7663 ///
7664 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7665 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7666 /// sufficient, a read-write scope will do as well.
7667 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainPatchCall<'a, C>
7668 where
7669 St: AsRef<str>,
7670 {
7671 self._scopes.insert(String::from(scope.as_ref()));
7672 self
7673 }
7674 /// Identifies the authorization scope(s) for the method you are building.
7675 ///
7676 /// See [`Self::add_scope()`] for details.
7677 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainPatchCall<'a, C>
7678 where
7679 I: IntoIterator<Item = St>,
7680 St: AsRef<str>,
7681 {
7682 self._scopes
7683 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7684 self
7685 }
7686
7687 /// Removes all scopes, and no default scope will be used either.
7688 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7689 /// for details).
7690 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7691 self._scopes.clear();
7692 self
7693 }
7694}
7695
7696/// Undeletes the specified `CustomDomain` if it has been soft-deleted. Hosting retains soft-deleted custom domains for around 30 days before permanently deleting them.
7697///
7698/// A builder for the *sites.customDomains.undelete* method supported by a *project* resource.
7699/// It is not used directly, but through a [`ProjectMethods`] instance.
7700///
7701/// # Example
7702///
7703/// Instantiate a resource method builder
7704///
7705/// ```test_harness,no_run
7706/// # extern crate hyper;
7707/// # extern crate hyper_rustls;
7708/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
7709/// use firebasehosting1_beta1::api::UndeleteCustomDomainRequest;
7710/// # async fn dox() {
7711/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7712///
7713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7714/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7715/// # secret,
7716/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7717/// # ).build().await.unwrap();
7718///
7719/// # let client = hyper_util::client::legacy::Client::builder(
7720/// # hyper_util::rt::TokioExecutor::new()
7721/// # )
7722/// # .build(
7723/// # hyper_rustls::HttpsConnectorBuilder::new()
7724/// # .with_native_roots()
7725/// # .unwrap()
7726/// # .https_or_http()
7727/// # .enable_http1()
7728/// # .build()
7729/// # );
7730/// # let mut hub = FirebaseHosting::new(client, auth);
7731/// // As the method needs a request, you would usually fill it with the desired information
7732/// // into the respective structure. Some of the parts shown here might not be applicable !
7733/// // Values shown here are possibly random and not representative !
7734/// let mut req = UndeleteCustomDomainRequest::default();
7735///
7736/// // You can configure optional parameters by calling the respective setters at will, and
7737/// // execute the final call using `doit()`.
7738/// // Values shown here are possibly random and not representative !
7739/// let result = hub.projects().sites_custom_domains_undelete(req, "name")
7740/// .doit().await;
7741/// # }
7742/// ```
7743pub struct ProjectSiteCustomDomainUndeleteCall<'a, C>
7744where
7745 C: 'a,
7746{
7747 hub: &'a FirebaseHosting<C>,
7748 _request: UndeleteCustomDomainRequest,
7749 _name: String,
7750 _delegate: Option<&'a mut dyn common::Delegate>,
7751 _additional_params: HashMap<String, String>,
7752 _scopes: BTreeSet<String>,
7753}
7754
7755impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainUndeleteCall<'a, C> {}
7756
7757impl<'a, C> ProjectSiteCustomDomainUndeleteCall<'a, C>
7758where
7759 C: common::Connector,
7760{
7761 /// Perform the operation you have build so far.
7762 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7763 use std::borrow::Cow;
7764 use std::io::{Read, Seek};
7765
7766 use common::{url::Params, ToParts};
7767 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7768
7769 let mut dd = common::DefaultDelegate;
7770 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7771 dlg.begin(common::MethodInfo {
7772 id: "firebasehosting.projects.sites.customDomains.undelete",
7773 http_method: hyper::Method::POST,
7774 });
7775
7776 for &field in ["alt", "name"].iter() {
7777 if self._additional_params.contains_key(field) {
7778 dlg.finished(false);
7779 return Err(common::Error::FieldClash(field));
7780 }
7781 }
7782
7783 let mut params = Params::with_capacity(4 + self._additional_params.len());
7784 params.push("name", self._name);
7785
7786 params.extend(self._additional_params.iter());
7787
7788 params.push("alt", "json");
7789 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:undelete";
7790 if self._scopes.is_empty() {
7791 self._scopes
7792 .insert(Scope::CloudPlatform.as_ref().to_string());
7793 }
7794
7795 #[allow(clippy::single_element_loop)]
7796 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7797 url = params.uri_replacement(url, param_name, find_this, true);
7798 }
7799 {
7800 let to_remove = ["name"];
7801 params.remove_params(&to_remove);
7802 }
7803
7804 let url = params.parse_with_url(&url);
7805
7806 let mut json_mime_type = mime::APPLICATION_JSON;
7807 let mut request_value_reader = {
7808 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7809 common::remove_json_null_values(&mut value);
7810 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7811 serde_json::to_writer(&mut dst, &value).unwrap();
7812 dst
7813 };
7814 let request_size = request_value_reader
7815 .seek(std::io::SeekFrom::End(0))
7816 .unwrap();
7817 request_value_reader
7818 .seek(std::io::SeekFrom::Start(0))
7819 .unwrap();
7820
7821 loop {
7822 let token = match self
7823 .hub
7824 .auth
7825 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7826 .await
7827 {
7828 Ok(token) => token,
7829 Err(e) => match dlg.token(e) {
7830 Ok(token) => token,
7831 Err(e) => {
7832 dlg.finished(false);
7833 return Err(common::Error::MissingToken(e));
7834 }
7835 },
7836 };
7837 request_value_reader
7838 .seek(std::io::SeekFrom::Start(0))
7839 .unwrap();
7840 let mut req_result = {
7841 let client = &self.hub.client;
7842 dlg.pre_request();
7843 let mut req_builder = hyper::Request::builder()
7844 .method(hyper::Method::POST)
7845 .uri(url.as_str())
7846 .header(USER_AGENT, self.hub._user_agent.clone());
7847
7848 if let Some(token) = token.as_ref() {
7849 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7850 }
7851
7852 let request = req_builder
7853 .header(CONTENT_TYPE, json_mime_type.to_string())
7854 .header(CONTENT_LENGTH, request_size as u64)
7855 .body(common::to_body(
7856 request_value_reader.get_ref().clone().into(),
7857 ));
7858
7859 client.request(request.unwrap()).await
7860 };
7861
7862 match req_result {
7863 Err(err) => {
7864 if let common::Retry::After(d) = dlg.http_error(&err) {
7865 sleep(d).await;
7866 continue;
7867 }
7868 dlg.finished(false);
7869 return Err(common::Error::HttpError(err));
7870 }
7871 Ok(res) => {
7872 let (mut parts, body) = res.into_parts();
7873 let mut body = common::Body::new(body);
7874 if !parts.status.is_success() {
7875 let bytes = common::to_bytes(body).await.unwrap_or_default();
7876 let error = serde_json::from_str(&common::to_string(&bytes));
7877 let response = common::to_response(parts, bytes.into());
7878
7879 if let common::Retry::After(d) =
7880 dlg.http_failure(&response, error.as_ref().ok())
7881 {
7882 sleep(d).await;
7883 continue;
7884 }
7885
7886 dlg.finished(false);
7887
7888 return Err(match error {
7889 Ok(value) => common::Error::BadRequest(value),
7890 _ => common::Error::Failure(response),
7891 });
7892 }
7893 let response = {
7894 let bytes = common::to_bytes(body).await.unwrap_or_default();
7895 let encoded = common::to_string(&bytes);
7896 match serde_json::from_str(&encoded) {
7897 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7898 Err(error) => {
7899 dlg.response_json_decode_error(&encoded, &error);
7900 return Err(common::Error::JsonDecodeError(
7901 encoded.to_string(),
7902 error,
7903 ));
7904 }
7905 }
7906 };
7907
7908 dlg.finished(true);
7909 return Ok(response);
7910 }
7911 }
7912 }
7913 }
7914
7915 ///
7916 /// Sets the *request* property to the given value.
7917 ///
7918 /// Even though the property as already been set when instantiating this call,
7919 /// we provide this method for API completeness.
7920 pub fn request(
7921 mut self,
7922 new_value: UndeleteCustomDomainRequest,
7923 ) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
7924 self._request = new_value;
7925 self
7926 }
7927 /// Required. The name of the `CustomDomain` to delete.
7928 ///
7929 /// Sets the *name* path property to the given value.
7930 ///
7931 /// Even though the property as already been set when instantiating this call,
7932 /// we provide this method for API completeness.
7933 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
7934 self._name = new_value.to_string();
7935 self
7936 }
7937 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7938 /// while executing the actual API request.
7939 ///
7940 /// ````text
7941 /// It should be used to handle progress information, and to implement a certain level of resilience.
7942 /// ````
7943 ///
7944 /// Sets the *delegate* property to the given value.
7945 pub fn delegate(
7946 mut self,
7947 new_value: &'a mut dyn common::Delegate,
7948 ) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
7949 self._delegate = Some(new_value);
7950 self
7951 }
7952
7953 /// Set any additional parameter of the query string used in the request.
7954 /// It should be used to set parameters which are not yet available through their own
7955 /// setters.
7956 ///
7957 /// Please note that this method must not be used to set any of the known parameters
7958 /// which have their own setter method. If done anyway, the request will fail.
7959 ///
7960 /// # Additional Parameters
7961 ///
7962 /// * *$.xgafv* (query-string) - V1 error format.
7963 /// * *access_token* (query-string) - OAuth access token.
7964 /// * *alt* (query-string) - Data format for response.
7965 /// * *callback* (query-string) - JSONP
7966 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7967 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7968 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7969 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7970 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7971 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7972 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7973 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainUndeleteCall<'a, C>
7974 where
7975 T: AsRef<str>,
7976 {
7977 self._additional_params
7978 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7979 self
7980 }
7981
7982 /// Identifies the authorization scope for the method you are building.
7983 ///
7984 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7985 /// [`Scope::CloudPlatform`].
7986 ///
7987 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7988 /// tokens for more than one scope.
7989 ///
7990 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7991 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7992 /// sufficient, a read-write scope will do as well.
7993 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainUndeleteCall<'a, C>
7994 where
7995 St: AsRef<str>,
7996 {
7997 self._scopes.insert(String::from(scope.as_ref()));
7998 self
7999 }
8000 /// Identifies the authorization scope(s) for the method you are building.
8001 ///
8002 /// See [`Self::add_scope()`] for details.
8003 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainUndeleteCall<'a, C>
8004 where
8005 I: IntoIterator<Item = St>,
8006 St: AsRef<str>,
8007 {
8008 self._scopes
8009 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8010 self
8011 }
8012
8013 /// Removes all scopes, and no default scope will be used either.
8014 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8015 /// for details).
8016 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
8017 self._scopes.clear();
8018 self
8019 }
8020}
8021
8022/// Creates a domain mapping on the specified site.
8023///
8024/// A builder for the *sites.domains.create* method supported by a *project* resource.
8025/// It is not used directly, but through a [`ProjectMethods`] instance.
8026///
8027/// # Example
8028///
8029/// Instantiate a resource method builder
8030///
8031/// ```test_harness,no_run
8032/// # extern crate hyper;
8033/// # extern crate hyper_rustls;
8034/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
8035/// use firebasehosting1_beta1::api::Domain;
8036/// # async fn dox() {
8037/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8038///
8039/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8040/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8041/// # secret,
8042/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8043/// # ).build().await.unwrap();
8044///
8045/// # let client = hyper_util::client::legacy::Client::builder(
8046/// # hyper_util::rt::TokioExecutor::new()
8047/// # )
8048/// # .build(
8049/// # hyper_rustls::HttpsConnectorBuilder::new()
8050/// # .with_native_roots()
8051/// # .unwrap()
8052/// # .https_or_http()
8053/// # .enable_http1()
8054/// # .build()
8055/// # );
8056/// # let mut hub = FirebaseHosting::new(client, auth);
8057/// // As the method needs a request, you would usually fill it with the desired information
8058/// // into the respective structure. Some of the parts shown here might not be applicable !
8059/// // Values shown here are possibly random and not representative !
8060/// let mut req = Domain::default();
8061///
8062/// // You can configure optional parameters by calling the respective setters at will, and
8063/// // execute the final call using `doit()`.
8064/// // Values shown here are possibly random and not representative !
8065/// let result = hub.projects().sites_domains_create(req, "parent")
8066/// .doit().await;
8067/// # }
8068/// ```
8069pub struct ProjectSiteDomainCreateCall<'a, C>
8070where
8071 C: 'a,
8072{
8073 hub: &'a FirebaseHosting<C>,
8074 _request: Domain,
8075 _parent: String,
8076 _delegate: Option<&'a mut dyn common::Delegate>,
8077 _additional_params: HashMap<String, String>,
8078 _scopes: BTreeSet<String>,
8079}
8080
8081impl<'a, C> common::CallBuilder for ProjectSiteDomainCreateCall<'a, C> {}
8082
8083impl<'a, C> ProjectSiteDomainCreateCall<'a, C>
8084where
8085 C: common::Connector,
8086{
8087 /// Perform the operation you have build so far.
8088 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
8089 use std::borrow::Cow;
8090 use std::io::{Read, Seek};
8091
8092 use common::{url::Params, ToParts};
8093 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8094
8095 let mut dd = common::DefaultDelegate;
8096 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8097 dlg.begin(common::MethodInfo {
8098 id: "firebasehosting.projects.sites.domains.create",
8099 http_method: hyper::Method::POST,
8100 });
8101
8102 for &field in ["alt", "parent"].iter() {
8103 if self._additional_params.contains_key(field) {
8104 dlg.finished(false);
8105 return Err(common::Error::FieldClash(field));
8106 }
8107 }
8108
8109 let mut params = Params::with_capacity(4 + self._additional_params.len());
8110 params.push("parent", self._parent);
8111
8112 params.extend(self._additional_params.iter());
8113
8114 params.push("alt", "json");
8115 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/domains";
8116 if self._scopes.is_empty() {
8117 self._scopes
8118 .insert(Scope::CloudPlatform.as_ref().to_string());
8119 }
8120
8121 #[allow(clippy::single_element_loop)]
8122 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8123 url = params.uri_replacement(url, param_name, find_this, true);
8124 }
8125 {
8126 let to_remove = ["parent"];
8127 params.remove_params(&to_remove);
8128 }
8129
8130 let url = params.parse_with_url(&url);
8131
8132 let mut json_mime_type = mime::APPLICATION_JSON;
8133 let mut request_value_reader = {
8134 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8135 common::remove_json_null_values(&mut value);
8136 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8137 serde_json::to_writer(&mut dst, &value).unwrap();
8138 dst
8139 };
8140 let request_size = request_value_reader
8141 .seek(std::io::SeekFrom::End(0))
8142 .unwrap();
8143 request_value_reader
8144 .seek(std::io::SeekFrom::Start(0))
8145 .unwrap();
8146
8147 loop {
8148 let token = match self
8149 .hub
8150 .auth
8151 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8152 .await
8153 {
8154 Ok(token) => token,
8155 Err(e) => match dlg.token(e) {
8156 Ok(token) => token,
8157 Err(e) => {
8158 dlg.finished(false);
8159 return Err(common::Error::MissingToken(e));
8160 }
8161 },
8162 };
8163 request_value_reader
8164 .seek(std::io::SeekFrom::Start(0))
8165 .unwrap();
8166 let mut req_result = {
8167 let client = &self.hub.client;
8168 dlg.pre_request();
8169 let mut req_builder = hyper::Request::builder()
8170 .method(hyper::Method::POST)
8171 .uri(url.as_str())
8172 .header(USER_AGENT, self.hub._user_agent.clone());
8173
8174 if let Some(token) = token.as_ref() {
8175 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8176 }
8177
8178 let request = req_builder
8179 .header(CONTENT_TYPE, json_mime_type.to_string())
8180 .header(CONTENT_LENGTH, request_size as u64)
8181 .body(common::to_body(
8182 request_value_reader.get_ref().clone().into(),
8183 ));
8184
8185 client.request(request.unwrap()).await
8186 };
8187
8188 match req_result {
8189 Err(err) => {
8190 if let common::Retry::After(d) = dlg.http_error(&err) {
8191 sleep(d).await;
8192 continue;
8193 }
8194 dlg.finished(false);
8195 return Err(common::Error::HttpError(err));
8196 }
8197 Ok(res) => {
8198 let (mut parts, body) = res.into_parts();
8199 let mut body = common::Body::new(body);
8200 if !parts.status.is_success() {
8201 let bytes = common::to_bytes(body).await.unwrap_or_default();
8202 let error = serde_json::from_str(&common::to_string(&bytes));
8203 let response = common::to_response(parts, bytes.into());
8204
8205 if let common::Retry::After(d) =
8206 dlg.http_failure(&response, error.as_ref().ok())
8207 {
8208 sleep(d).await;
8209 continue;
8210 }
8211
8212 dlg.finished(false);
8213
8214 return Err(match error {
8215 Ok(value) => common::Error::BadRequest(value),
8216 _ => common::Error::Failure(response),
8217 });
8218 }
8219 let response = {
8220 let bytes = common::to_bytes(body).await.unwrap_or_default();
8221 let encoded = common::to_string(&bytes);
8222 match serde_json::from_str(&encoded) {
8223 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8224 Err(error) => {
8225 dlg.response_json_decode_error(&encoded, &error);
8226 return Err(common::Error::JsonDecodeError(
8227 encoded.to_string(),
8228 error,
8229 ));
8230 }
8231 }
8232 };
8233
8234 dlg.finished(true);
8235 return Ok(response);
8236 }
8237 }
8238 }
8239 }
8240
8241 ///
8242 /// Sets the *request* property to the given value.
8243 ///
8244 /// Even though the property as already been set when instantiating this call,
8245 /// we provide this method for API completeness.
8246 pub fn request(mut self, new_value: Domain) -> ProjectSiteDomainCreateCall<'a, C> {
8247 self._request = new_value;
8248 self
8249 }
8250 /// Required. The parent to create the domain association for, in the format: sites/site-name
8251 ///
8252 /// Sets the *parent* path property to the given value.
8253 ///
8254 /// Even though the property as already been set when instantiating this call,
8255 /// we provide this method for API completeness.
8256 pub fn parent(mut self, new_value: &str) -> ProjectSiteDomainCreateCall<'a, C> {
8257 self._parent = new_value.to_string();
8258 self
8259 }
8260 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8261 /// while executing the actual API request.
8262 ///
8263 /// ````text
8264 /// It should be used to handle progress information, and to implement a certain level of resilience.
8265 /// ````
8266 ///
8267 /// Sets the *delegate* property to the given value.
8268 pub fn delegate(
8269 mut self,
8270 new_value: &'a mut dyn common::Delegate,
8271 ) -> ProjectSiteDomainCreateCall<'a, C> {
8272 self._delegate = Some(new_value);
8273 self
8274 }
8275
8276 /// Set any additional parameter of the query string used in the request.
8277 /// It should be used to set parameters which are not yet available through their own
8278 /// setters.
8279 ///
8280 /// Please note that this method must not be used to set any of the known parameters
8281 /// which have their own setter method. If done anyway, the request will fail.
8282 ///
8283 /// # Additional Parameters
8284 ///
8285 /// * *$.xgafv* (query-string) - V1 error format.
8286 /// * *access_token* (query-string) - OAuth access token.
8287 /// * *alt* (query-string) - Data format for response.
8288 /// * *callback* (query-string) - JSONP
8289 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8290 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8291 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8292 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8293 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8294 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8295 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8296 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainCreateCall<'a, C>
8297 where
8298 T: AsRef<str>,
8299 {
8300 self._additional_params
8301 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8302 self
8303 }
8304
8305 /// Identifies the authorization scope for the method you are building.
8306 ///
8307 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8308 /// [`Scope::CloudPlatform`].
8309 ///
8310 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8311 /// tokens for more than one scope.
8312 ///
8313 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8314 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8315 /// sufficient, a read-write scope will do as well.
8316 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainCreateCall<'a, C>
8317 where
8318 St: AsRef<str>,
8319 {
8320 self._scopes.insert(String::from(scope.as_ref()));
8321 self
8322 }
8323 /// Identifies the authorization scope(s) for the method you are building.
8324 ///
8325 /// See [`Self::add_scope()`] for details.
8326 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainCreateCall<'a, C>
8327 where
8328 I: IntoIterator<Item = St>,
8329 St: AsRef<str>,
8330 {
8331 self._scopes
8332 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8333 self
8334 }
8335
8336 /// Removes all scopes, and no default scope will be used either.
8337 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8338 /// for details).
8339 pub fn clear_scopes(mut self) -> ProjectSiteDomainCreateCall<'a, C> {
8340 self._scopes.clear();
8341 self
8342 }
8343}
8344
8345/// Deletes the existing domain mapping on the specified site.
8346///
8347/// A builder for the *sites.domains.delete* method supported by a *project* resource.
8348/// It is not used directly, but through a [`ProjectMethods`] instance.
8349///
8350/// # Example
8351///
8352/// Instantiate a resource method builder
8353///
8354/// ```test_harness,no_run
8355/// # extern crate hyper;
8356/// # extern crate hyper_rustls;
8357/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
8358/// # async fn dox() {
8359/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8360///
8361/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8362/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8363/// # secret,
8364/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8365/// # ).build().await.unwrap();
8366///
8367/// # let client = hyper_util::client::legacy::Client::builder(
8368/// # hyper_util::rt::TokioExecutor::new()
8369/// # )
8370/// # .build(
8371/// # hyper_rustls::HttpsConnectorBuilder::new()
8372/// # .with_native_roots()
8373/// # .unwrap()
8374/// # .https_or_http()
8375/// # .enable_http1()
8376/// # .build()
8377/// # );
8378/// # let mut hub = FirebaseHosting::new(client, auth);
8379/// // You can configure optional parameters by calling the respective setters at will, and
8380/// // execute the final call using `doit()`.
8381/// // Values shown here are possibly random and not representative !
8382/// let result = hub.projects().sites_domains_delete("name")
8383/// .doit().await;
8384/// # }
8385/// ```
8386pub struct ProjectSiteDomainDeleteCall<'a, C>
8387where
8388 C: 'a,
8389{
8390 hub: &'a FirebaseHosting<C>,
8391 _name: String,
8392 _delegate: Option<&'a mut dyn common::Delegate>,
8393 _additional_params: HashMap<String, String>,
8394 _scopes: BTreeSet<String>,
8395}
8396
8397impl<'a, C> common::CallBuilder for ProjectSiteDomainDeleteCall<'a, C> {}
8398
8399impl<'a, C> ProjectSiteDomainDeleteCall<'a, C>
8400where
8401 C: common::Connector,
8402{
8403 /// Perform the operation you have build so far.
8404 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8405 use std::borrow::Cow;
8406 use std::io::{Read, Seek};
8407
8408 use common::{url::Params, ToParts};
8409 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8410
8411 let mut dd = common::DefaultDelegate;
8412 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8413 dlg.begin(common::MethodInfo {
8414 id: "firebasehosting.projects.sites.domains.delete",
8415 http_method: hyper::Method::DELETE,
8416 });
8417
8418 for &field in ["alt", "name"].iter() {
8419 if self._additional_params.contains_key(field) {
8420 dlg.finished(false);
8421 return Err(common::Error::FieldClash(field));
8422 }
8423 }
8424
8425 let mut params = Params::with_capacity(3 + self._additional_params.len());
8426 params.push("name", self._name);
8427
8428 params.extend(self._additional_params.iter());
8429
8430 params.push("alt", "json");
8431 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8432 if self._scopes.is_empty() {
8433 self._scopes
8434 .insert(Scope::CloudPlatform.as_ref().to_string());
8435 }
8436
8437 #[allow(clippy::single_element_loop)]
8438 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8439 url = params.uri_replacement(url, param_name, find_this, true);
8440 }
8441 {
8442 let to_remove = ["name"];
8443 params.remove_params(&to_remove);
8444 }
8445
8446 let url = params.parse_with_url(&url);
8447
8448 loop {
8449 let token = match self
8450 .hub
8451 .auth
8452 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8453 .await
8454 {
8455 Ok(token) => token,
8456 Err(e) => match dlg.token(e) {
8457 Ok(token) => token,
8458 Err(e) => {
8459 dlg.finished(false);
8460 return Err(common::Error::MissingToken(e));
8461 }
8462 },
8463 };
8464 let mut req_result = {
8465 let client = &self.hub.client;
8466 dlg.pre_request();
8467 let mut req_builder = hyper::Request::builder()
8468 .method(hyper::Method::DELETE)
8469 .uri(url.as_str())
8470 .header(USER_AGENT, self.hub._user_agent.clone());
8471
8472 if let Some(token) = token.as_ref() {
8473 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8474 }
8475
8476 let request = req_builder
8477 .header(CONTENT_LENGTH, 0_u64)
8478 .body(common::to_body::<String>(None));
8479
8480 client.request(request.unwrap()).await
8481 };
8482
8483 match req_result {
8484 Err(err) => {
8485 if let common::Retry::After(d) = dlg.http_error(&err) {
8486 sleep(d).await;
8487 continue;
8488 }
8489 dlg.finished(false);
8490 return Err(common::Error::HttpError(err));
8491 }
8492 Ok(res) => {
8493 let (mut parts, body) = res.into_parts();
8494 let mut body = common::Body::new(body);
8495 if !parts.status.is_success() {
8496 let bytes = common::to_bytes(body).await.unwrap_or_default();
8497 let error = serde_json::from_str(&common::to_string(&bytes));
8498 let response = common::to_response(parts, bytes.into());
8499
8500 if let common::Retry::After(d) =
8501 dlg.http_failure(&response, error.as_ref().ok())
8502 {
8503 sleep(d).await;
8504 continue;
8505 }
8506
8507 dlg.finished(false);
8508
8509 return Err(match error {
8510 Ok(value) => common::Error::BadRequest(value),
8511 _ => common::Error::Failure(response),
8512 });
8513 }
8514 let response = {
8515 let bytes = common::to_bytes(body).await.unwrap_or_default();
8516 let encoded = common::to_string(&bytes);
8517 match serde_json::from_str(&encoded) {
8518 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8519 Err(error) => {
8520 dlg.response_json_decode_error(&encoded, &error);
8521 return Err(common::Error::JsonDecodeError(
8522 encoded.to_string(),
8523 error,
8524 ));
8525 }
8526 }
8527 };
8528
8529 dlg.finished(true);
8530 return Ok(response);
8531 }
8532 }
8533 }
8534 }
8535
8536 /// Required. The name of the domain association to delete.
8537 ///
8538 /// Sets the *name* path property to the given value.
8539 ///
8540 /// Even though the property as already been set when instantiating this call,
8541 /// we provide this method for API completeness.
8542 pub fn name(mut self, new_value: &str) -> ProjectSiteDomainDeleteCall<'a, C> {
8543 self._name = new_value.to_string();
8544 self
8545 }
8546 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8547 /// while executing the actual API request.
8548 ///
8549 /// ````text
8550 /// It should be used to handle progress information, and to implement a certain level of resilience.
8551 /// ````
8552 ///
8553 /// Sets the *delegate* property to the given value.
8554 pub fn delegate(
8555 mut self,
8556 new_value: &'a mut dyn common::Delegate,
8557 ) -> ProjectSiteDomainDeleteCall<'a, C> {
8558 self._delegate = Some(new_value);
8559 self
8560 }
8561
8562 /// Set any additional parameter of the query string used in the request.
8563 /// It should be used to set parameters which are not yet available through their own
8564 /// setters.
8565 ///
8566 /// Please note that this method must not be used to set any of the known parameters
8567 /// which have their own setter method. If done anyway, the request will fail.
8568 ///
8569 /// # Additional Parameters
8570 ///
8571 /// * *$.xgafv* (query-string) - V1 error format.
8572 /// * *access_token* (query-string) - OAuth access token.
8573 /// * *alt* (query-string) - Data format for response.
8574 /// * *callback* (query-string) - JSONP
8575 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8576 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8577 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8578 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8579 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8580 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8581 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8582 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainDeleteCall<'a, C>
8583 where
8584 T: AsRef<str>,
8585 {
8586 self._additional_params
8587 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8588 self
8589 }
8590
8591 /// Identifies the authorization scope for the method you are building.
8592 ///
8593 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8594 /// [`Scope::CloudPlatform`].
8595 ///
8596 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8597 /// tokens for more than one scope.
8598 ///
8599 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8600 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8601 /// sufficient, a read-write scope will do as well.
8602 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainDeleteCall<'a, C>
8603 where
8604 St: AsRef<str>,
8605 {
8606 self._scopes.insert(String::from(scope.as_ref()));
8607 self
8608 }
8609 /// Identifies the authorization scope(s) for the method you are building.
8610 ///
8611 /// See [`Self::add_scope()`] for details.
8612 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainDeleteCall<'a, C>
8613 where
8614 I: IntoIterator<Item = St>,
8615 St: AsRef<str>,
8616 {
8617 self._scopes
8618 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8619 self
8620 }
8621
8622 /// Removes all scopes, and no default scope will be used either.
8623 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8624 /// for details).
8625 pub fn clear_scopes(mut self) -> ProjectSiteDomainDeleteCall<'a, C> {
8626 self._scopes.clear();
8627 self
8628 }
8629}
8630
8631/// Gets a domain mapping on the specified site.
8632///
8633/// A builder for the *sites.domains.get* method supported by a *project* resource.
8634/// It is not used directly, but through a [`ProjectMethods`] instance.
8635///
8636/// # Example
8637///
8638/// Instantiate a resource method builder
8639///
8640/// ```test_harness,no_run
8641/// # extern crate hyper;
8642/// # extern crate hyper_rustls;
8643/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
8644/// # async fn dox() {
8645/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8646///
8647/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8648/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8649/// # secret,
8650/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8651/// # ).build().await.unwrap();
8652///
8653/// # let client = hyper_util::client::legacy::Client::builder(
8654/// # hyper_util::rt::TokioExecutor::new()
8655/// # )
8656/// # .build(
8657/// # hyper_rustls::HttpsConnectorBuilder::new()
8658/// # .with_native_roots()
8659/// # .unwrap()
8660/// # .https_or_http()
8661/// # .enable_http1()
8662/// # .build()
8663/// # );
8664/// # let mut hub = FirebaseHosting::new(client, auth);
8665/// // You can configure optional parameters by calling the respective setters at will, and
8666/// // execute the final call using `doit()`.
8667/// // Values shown here are possibly random and not representative !
8668/// let result = hub.projects().sites_domains_get("name")
8669/// .doit().await;
8670/// # }
8671/// ```
8672pub struct ProjectSiteDomainGetCall<'a, C>
8673where
8674 C: 'a,
8675{
8676 hub: &'a FirebaseHosting<C>,
8677 _name: String,
8678 _delegate: Option<&'a mut dyn common::Delegate>,
8679 _additional_params: HashMap<String, String>,
8680 _scopes: BTreeSet<String>,
8681}
8682
8683impl<'a, C> common::CallBuilder for ProjectSiteDomainGetCall<'a, C> {}
8684
8685impl<'a, C> ProjectSiteDomainGetCall<'a, C>
8686where
8687 C: common::Connector,
8688{
8689 /// Perform the operation you have build so far.
8690 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
8691 use std::borrow::Cow;
8692 use std::io::{Read, Seek};
8693
8694 use common::{url::Params, ToParts};
8695 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8696
8697 let mut dd = common::DefaultDelegate;
8698 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8699 dlg.begin(common::MethodInfo {
8700 id: "firebasehosting.projects.sites.domains.get",
8701 http_method: hyper::Method::GET,
8702 });
8703
8704 for &field in ["alt", "name"].iter() {
8705 if self._additional_params.contains_key(field) {
8706 dlg.finished(false);
8707 return Err(common::Error::FieldClash(field));
8708 }
8709 }
8710
8711 let mut params = Params::with_capacity(3 + self._additional_params.len());
8712 params.push("name", self._name);
8713
8714 params.extend(self._additional_params.iter());
8715
8716 params.push("alt", "json");
8717 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8718 if self._scopes.is_empty() {
8719 self._scopes
8720 .insert(Scope::FirebaseReadonly.as_ref().to_string());
8721 }
8722
8723 #[allow(clippy::single_element_loop)]
8724 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8725 url = params.uri_replacement(url, param_name, find_this, true);
8726 }
8727 {
8728 let to_remove = ["name"];
8729 params.remove_params(&to_remove);
8730 }
8731
8732 let url = params.parse_with_url(&url);
8733
8734 loop {
8735 let token = match self
8736 .hub
8737 .auth
8738 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8739 .await
8740 {
8741 Ok(token) => token,
8742 Err(e) => match dlg.token(e) {
8743 Ok(token) => token,
8744 Err(e) => {
8745 dlg.finished(false);
8746 return Err(common::Error::MissingToken(e));
8747 }
8748 },
8749 };
8750 let mut req_result = {
8751 let client = &self.hub.client;
8752 dlg.pre_request();
8753 let mut req_builder = hyper::Request::builder()
8754 .method(hyper::Method::GET)
8755 .uri(url.as_str())
8756 .header(USER_AGENT, self.hub._user_agent.clone());
8757
8758 if let Some(token) = token.as_ref() {
8759 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8760 }
8761
8762 let request = req_builder
8763 .header(CONTENT_LENGTH, 0_u64)
8764 .body(common::to_body::<String>(None));
8765
8766 client.request(request.unwrap()).await
8767 };
8768
8769 match req_result {
8770 Err(err) => {
8771 if let common::Retry::After(d) = dlg.http_error(&err) {
8772 sleep(d).await;
8773 continue;
8774 }
8775 dlg.finished(false);
8776 return Err(common::Error::HttpError(err));
8777 }
8778 Ok(res) => {
8779 let (mut parts, body) = res.into_parts();
8780 let mut body = common::Body::new(body);
8781 if !parts.status.is_success() {
8782 let bytes = common::to_bytes(body).await.unwrap_or_default();
8783 let error = serde_json::from_str(&common::to_string(&bytes));
8784 let response = common::to_response(parts, bytes.into());
8785
8786 if let common::Retry::After(d) =
8787 dlg.http_failure(&response, error.as_ref().ok())
8788 {
8789 sleep(d).await;
8790 continue;
8791 }
8792
8793 dlg.finished(false);
8794
8795 return Err(match error {
8796 Ok(value) => common::Error::BadRequest(value),
8797 _ => common::Error::Failure(response),
8798 });
8799 }
8800 let response = {
8801 let bytes = common::to_bytes(body).await.unwrap_or_default();
8802 let encoded = common::to_string(&bytes);
8803 match serde_json::from_str(&encoded) {
8804 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8805 Err(error) => {
8806 dlg.response_json_decode_error(&encoded, &error);
8807 return Err(common::Error::JsonDecodeError(
8808 encoded.to_string(),
8809 error,
8810 ));
8811 }
8812 }
8813 };
8814
8815 dlg.finished(true);
8816 return Ok(response);
8817 }
8818 }
8819 }
8820 }
8821
8822 /// Required. The name of the domain configuration to get.
8823 ///
8824 /// Sets the *name* path property to the given value.
8825 ///
8826 /// Even though the property as already been set when instantiating this call,
8827 /// we provide this method for API completeness.
8828 pub fn name(mut self, new_value: &str) -> ProjectSiteDomainGetCall<'a, C> {
8829 self._name = new_value.to_string();
8830 self
8831 }
8832 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8833 /// while executing the actual API request.
8834 ///
8835 /// ````text
8836 /// It should be used to handle progress information, and to implement a certain level of resilience.
8837 /// ````
8838 ///
8839 /// Sets the *delegate* property to the given value.
8840 pub fn delegate(
8841 mut self,
8842 new_value: &'a mut dyn common::Delegate,
8843 ) -> ProjectSiteDomainGetCall<'a, C> {
8844 self._delegate = Some(new_value);
8845 self
8846 }
8847
8848 /// Set any additional parameter of the query string used in the request.
8849 /// It should be used to set parameters which are not yet available through their own
8850 /// setters.
8851 ///
8852 /// Please note that this method must not be used to set any of the known parameters
8853 /// which have their own setter method. If done anyway, the request will fail.
8854 ///
8855 /// # Additional Parameters
8856 ///
8857 /// * *$.xgafv* (query-string) - V1 error format.
8858 /// * *access_token* (query-string) - OAuth access token.
8859 /// * *alt* (query-string) - Data format for response.
8860 /// * *callback* (query-string) - JSONP
8861 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8862 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8863 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8864 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8865 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8866 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8867 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8868 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainGetCall<'a, C>
8869 where
8870 T: AsRef<str>,
8871 {
8872 self._additional_params
8873 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8874 self
8875 }
8876
8877 /// Identifies the authorization scope for the method you are building.
8878 ///
8879 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8880 /// [`Scope::FirebaseReadonly`].
8881 ///
8882 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8883 /// tokens for more than one scope.
8884 ///
8885 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8886 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8887 /// sufficient, a read-write scope will do as well.
8888 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainGetCall<'a, C>
8889 where
8890 St: AsRef<str>,
8891 {
8892 self._scopes.insert(String::from(scope.as_ref()));
8893 self
8894 }
8895 /// Identifies the authorization scope(s) for the method you are building.
8896 ///
8897 /// See [`Self::add_scope()`] for details.
8898 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainGetCall<'a, C>
8899 where
8900 I: IntoIterator<Item = St>,
8901 St: AsRef<str>,
8902 {
8903 self._scopes
8904 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8905 self
8906 }
8907
8908 /// Removes all scopes, and no default scope will be used either.
8909 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8910 /// for details).
8911 pub fn clear_scopes(mut self) -> ProjectSiteDomainGetCall<'a, C> {
8912 self._scopes.clear();
8913 self
8914 }
8915}
8916
8917/// Lists the domains for the specified site.
8918///
8919/// A builder for the *sites.domains.list* method supported by a *project* resource.
8920/// It is not used directly, but through a [`ProjectMethods`] instance.
8921///
8922/// # Example
8923///
8924/// Instantiate a resource method builder
8925///
8926/// ```test_harness,no_run
8927/// # extern crate hyper;
8928/// # extern crate hyper_rustls;
8929/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
8930/// # async fn dox() {
8931/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8932///
8933/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8934/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8935/// # secret,
8936/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8937/// # ).build().await.unwrap();
8938///
8939/// # let client = hyper_util::client::legacy::Client::builder(
8940/// # hyper_util::rt::TokioExecutor::new()
8941/// # )
8942/// # .build(
8943/// # hyper_rustls::HttpsConnectorBuilder::new()
8944/// # .with_native_roots()
8945/// # .unwrap()
8946/// # .https_or_http()
8947/// # .enable_http1()
8948/// # .build()
8949/// # );
8950/// # let mut hub = FirebaseHosting::new(client, auth);
8951/// // You can configure optional parameters by calling the respective setters at will, and
8952/// // execute the final call using `doit()`.
8953/// // Values shown here are possibly random and not representative !
8954/// let result = hub.projects().sites_domains_list("parent")
8955/// .page_token("Stet")
8956/// .page_size(-99)
8957/// .doit().await;
8958/// # }
8959/// ```
8960pub struct ProjectSiteDomainListCall<'a, C>
8961where
8962 C: 'a,
8963{
8964 hub: &'a FirebaseHosting<C>,
8965 _parent: String,
8966 _page_token: Option<String>,
8967 _page_size: Option<i32>,
8968 _delegate: Option<&'a mut dyn common::Delegate>,
8969 _additional_params: HashMap<String, String>,
8970 _scopes: BTreeSet<String>,
8971}
8972
8973impl<'a, C> common::CallBuilder for ProjectSiteDomainListCall<'a, C> {}
8974
8975impl<'a, C> ProjectSiteDomainListCall<'a, C>
8976where
8977 C: common::Connector,
8978{
8979 /// Perform the operation you have build so far.
8980 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainsResponse)> {
8981 use std::borrow::Cow;
8982 use std::io::{Read, Seek};
8983
8984 use common::{url::Params, ToParts};
8985 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8986
8987 let mut dd = common::DefaultDelegate;
8988 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8989 dlg.begin(common::MethodInfo {
8990 id: "firebasehosting.projects.sites.domains.list",
8991 http_method: hyper::Method::GET,
8992 });
8993
8994 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
8995 if self._additional_params.contains_key(field) {
8996 dlg.finished(false);
8997 return Err(common::Error::FieldClash(field));
8998 }
8999 }
9000
9001 let mut params = Params::with_capacity(5 + self._additional_params.len());
9002 params.push("parent", self._parent);
9003 if let Some(value) = self._page_token.as_ref() {
9004 params.push("pageToken", value);
9005 }
9006 if let Some(value) = self._page_size.as_ref() {
9007 params.push("pageSize", value.to_string());
9008 }
9009
9010 params.extend(self._additional_params.iter());
9011
9012 params.push("alt", "json");
9013 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/domains";
9014 if self._scopes.is_empty() {
9015 self._scopes
9016 .insert(Scope::FirebaseReadonly.as_ref().to_string());
9017 }
9018
9019 #[allow(clippy::single_element_loop)]
9020 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9021 url = params.uri_replacement(url, param_name, find_this, true);
9022 }
9023 {
9024 let to_remove = ["parent"];
9025 params.remove_params(&to_remove);
9026 }
9027
9028 let url = params.parse_with_url(&url);
9029
9030 loop {
9031 let token = match self
9032 .hub
9033 .auth
9034 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9035 .await
9036 {
9037 Ok(token) => token,
9038 Err(e) => match dlg.token(e) {
9039 Ok(token) => token,
9040 Err(e) => {
9041 dlg.finished(false);
9042 return Err(common::Error::MissingToken(e));
9043 }
9044 },
9045 };
9046 let mut req_result = {
9047 let client = &self.hub.client;
9048 dlg.pre_request();
9049 let mut req_builder = hyper::Request::builder()
9050 .method(hyper::Method::GET)
9051 .uri(url.as_str())
9052 .header(USER_AGENT, self.hub._user_agent.clone());
9053
9054 if let Some(token) = token.as_ref() {
9055 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9056 }
9057
9058 let request = req_builder
9059 .header(CONTENT_LENGTH, 0_u64)
9060 .body(common::to_body::<String>(None));
9061
9062 client.request(request.unwrap()).await
9063 };
9064
9065 match req_result {
9066 Err(err) => {
9067 if let common::Retry::After(d) = dlg.http_error(&err) {
9068 sleep(d).await;
9069 continue;
9070 }
9071 dlg.finished(false);
9072 return Err(common::Error::HttpError(err));
9073 }
9074 Ok(res) => {
9075 let (mut parts, body) = res.into_parts();
9076 let mut body = common::Body::new(body);
9077 if !parts.status.is_success() {
9078 let bytes = common::to_bytes(body).await.unwrap_or_default();
9079 let error = serde_json::from_str(&common::to_string(&bytes));
9080 let response = common::to_response(parts, bytes.into());
9081
9082 if let common::Retry::After(d) =
9083 dlg.http_failure(&response, error.as_ref().ok())
9084 {
9085 sleep(d).await;
9086 continue;
9087 }
9088
9089 dlg.finished(false);
9090
9091 return Err(match error {
9092 Ok(value) => common::Error::BadRequest(value),
9093 _ => common::Error::Failure(response),
9094 });
9095 }
9096 let response = {
9097 let bytes = common::to_bytes(body).await.unwrap_or_default();
9098 let encoded = common::to_string(&bytes);
9099 match serde_json::from_str(&encoded) {
9100 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9101 Err(error) => {
9102 dlg.response_json_decode_error(&encoded, &error);
9103 return Err(common::Error::JsonDecodeError(
9104 encoded.to_string(),
9105 error,
9106 ));
9107 }
9108 }
9109 };
9110
9111 dlg.finished(true);
9112 return Ok(response);
9113 }
9114 }
9115 }
9116 }
9117
9118 /// Required. The parent for which to list domains, in the format: sites/ site-name
9119 ///
9120 /// Sets the *parent* path property to the given value.
9121 ///
9122 /// Even though the property as already been set when instantiating this call,
9123 /// we provide this method for API completeness.
9124 pub fn parent(mut self, new_value: &str) -> ProjectSiteDomainListCall<'a, C> {
9125 self._parent = new_value.to_string();
9126 self
9127 }
9128 /// The next_page_token from a previous request, if provided.
9129 ///
9130 /// Sets the *page token* query property to the given value.
9131 pub fn page_token(mut self, new_value: &str) -> ProjectSiteDomainListCall<'a, C> {
9132 self._page_token = Some(new_value.to_string());
9133 self
9134 }
9135 /// The page size to return. Defaults to 50.
9136 ///
9137 /// Sets the *page size* query property to the given value.
9138 pub fn page_size(mut self, new_value: i32) -> ProjectSiteDomainListCall<'a, C> {
9139 self._page_size = Some(new_value);
9140 self
9141 }
9142 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9143 /// while executing the actual API request.
9144 ///
9145 /// ````text
9146 /// It should be used to handle progress information, and to implement a certain level of resilience.
9147 /// ````
9148 ///
9149 /// Sets the *delegate* property to the given value.
9150 pub fn delegate(
9151 mut self,
9152 new_value: &'a mut dyn common::Delegate,
9153 ) -> ProjectSiteDomainListCall<'a, C> {
9154 self._delegate = Some(new_value);
9155 self
9156 }
9157
9158 /// Set any additional parameter of the query string used in the request.
9159 /// It should be used to set parameters which are not yet available through their own
9160 /// setters.
9161 ///
9162 /// Please note that this method must not be used to set any of the known parameters
9163 /// which have their own setter method. If done anyway, the request will fail.
9164 ///
9165 /// # Additional Parameters
9166 ///
9167 /// * *$.xgafv* (query-string) - V1 error format.
9168 /// * *access_token* (query-string) - OAuth access token.
9169 /// * *alt* (query-string) - Data format for response.
9170 /// * *callback* (query-string) - JSONP
9171 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9172 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9173 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9174 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9175 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9176 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9177 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9178 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainListCall<'a, C>
9179 where
9180 T: AsRef<str>,
9181 {
9182 self._additional_params
9183 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9184 self
9185 }
9186
9187 /// Identifies the authorization scope for the method you are building.
9188 ///
9189 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9190 /// [`Scope::FirebaseReadonly`].
9191 ///
9192 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9193 /// tokens for more than one scope.
9194 ///
9195 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9196 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9197 /// sufficient, a read-write scope will do as well.
9198 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainListCall<'a, C>
9199 where
9200 St: AsRef<str>,
9201 {
9202 self._scopes.insert(String::from(scope.as_ref()));
9203 self
9204 }
9205 /// Identifies the authorization scope(s) for the method you are building.
9206 ///
9207 /// See [`Self::add_scope()`] for details.
9208 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainListCall<'a, C>
9209 where
9210 I: IntoIterator<Item = St>,
9211 St: AsRef<str>,
9212 {
9213 self._scopes
9214 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9215 self
9216 }
9217
9218 /// Removes all scopes, and no default scope will be used either.
9219 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9220 /// for details).
9221 pub fn clear_scopes(mut self) -> ProjectSiteDomainListCall<'a, C> {
9222 self._scopes.clear();
9223 self
9224 }
9225}
9226
9227/// Updates the specified domain mapping, creating the mapping as if it does not exist.
9228///
9229/// A builder for the *sites.domains.update* method supported by a *project* resource.
9230/// It is not used directly, but through a [`ProjectMethods`] instance.
9231///
9232/// # Example
9233///
9234/// Instantiate a resource method builder
9235///
9236/// ```test_harness,no_run
9237/// # extern crate hyper;
9238/// # extern crate hyper_rustls;
9239/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
9240/// use firebasehosting1_beta1::api::Domain;
9241/// # async fn dox() {
9242/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9243///
9244/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9245/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9246/// # secret,
9247/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9248/// # ).build().await.unwrap();
9249///
9250/// # let client = hyper_util::client::legacy::Client::builder(
9251/// # hyper_util::rt::TokioExecutor::new()
9252/// # )
9253/// # .build(
9254/// # hyper_rustls::HttpsConnectorBuilder::new()
9255/// # .with_native_roots()
9256/// # .unwrap()
9257/// # .https_or_http()
9258/// # .enable_http1()
9259/// # .build()
9260/// # );
9261/// # let mut hub = FirebaseHosting::new(client, auth);
9262/// // As the method needs a request, you would usually fill it with the desired information
9263/// // into the respective structure. Some of the parts shown here might not be applicable !
9264/// // Values shown here are possibly random and not representative !
9265/// let mut req = Domain::default();
9266///
9267/// // You can configure optional parameters by calling the respective setters at will, and
9268/// // execute the final call using `doit()`.
9269/// // Values shown here are possibly random and not representative !
9270/// let result = hub.projects().sites_domains_update(req, "name")
9271/// .doit().await;
9272/// # }
9273/// ```
9274pub struct ProjectSiteDomainUpdateCall<'a, C>
9275where
9276 C: 'a,
9277{
9278 hub: &'a FirebaseHosting<C>,
9279 _request: Domain,
9280 _name: String,
9281 _delegate: Option<&'a mut dyn common::Delegate>,
9282 _additional_params: HashMap<String, String>,
9283 _scopes: BTreeSet<String>,
9284}
9285
9286impl<'a, C> common::CallBuilder for ProjectSiteDomainUpdateCall<'a, C> {}
9287
9288impl<'a, C> ProjectSiteDomainUpdateCall<'a, C>
9289where
9290 C: common::Connector,
9291{
9292 /// Perform the operation you have build so far.
9293 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
9294 use std::borrow::Cow;
9295 use std::io::{Read, Seek};
9296
9297 use common::{url::Params, ToParts};
9298 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9299
9300 let mut dd = common::DefaultDelegate;
9301 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9302 dlg.begin(common::MethodInfo {
9303 id: "firebasehosting.projects.sites.domains.update",
9304 http_method: hyper::Method::PUT,
9305 });
9306
9307 for &field in ["alt", "name"].iter() {
9308 if self._additional_params.contains_key(field) {
9309 dlg.finished(false);
9310 return Err(common::Error::FieldClash(field));
9311 }
9312 }
9313
9314 let mut params = Params::with_capacity(4 + self._additional_params.len());
9315 params.push("name", self._name);
9316
9317 params.extend(self._additional_params.iter());
9318
9319 params.push("alt", "json");
9320 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
9321 if self._scopes.is_empty() {
9322 self._scopes
9323 .insert(Scope::CloudPlatform.as_ref().to_string());
9324 }
9325
9326 #[allow(clippy::single_element_loop)]
9327 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9328 url = params.uri_replacement(url, param_name, find_this, true);
9329 }
9330 {
9331 let to_remove = ["name"];
9332 params.remove_params(&to_remove);
9333 }
9334
9335 let url = params.parse_with_url(&url);
9336
9337 let mut json_mime_type = mime::APPLICATION_JSON;
9338 let mut request_value_reader = {
9339 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9340 common::remove_json_null_values(&mut value);
9341 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9342 serde_json::to_writer(&mut dst, &value).unwrap();
9343 dst
9344 };
9345 let request_size = request_value_reader
9346 .seek(std::io::SeekFrom::End(0))
9347 .unwrap();
9348 request_value_reader
9349 .seek(std::io::SeekFrom::Start(0))
9350 .unwrap();
9351
9352 loop {
9353 let token = match self
9354 .hub
9355 .auth
9356 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9357 .await
9358 {
9359 Ok(token) => token,
9360 Err(e) => match dlg.token(e) {
9361 Ok(token) => token,
9362 Err(e) => {
9363 dlg.finished(false);
9364 return Err(common::Error::MissingToken(e));
9365 }
9366 },
9367 };
9368 request_value_reader
9369 .seek(std::io::SeekFrom::Start(0))
9370 .unwrap();
9371 let mut req_result = {
9372 let client = &self.hub.client;
9373 dlg.pre_request();
9374 let mut req_builder = hyper::Request::builder()
9375 .method(hyper::Method::PUT)
9376 .uri(url.as_str())
9377 .header(USER_AGENT, self.hub._user_agent.clone());
9378
9379 if let Some(token) = token.as_ref() {
9380 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9381 }
9382
9383 let request = req_builder
9384 .header(CONTENT_TYPE, json_mime_type.to_string())
9385 .header(CONTENT_LENGTH, request_size as u64)
9386 .body(common::to_body(
9387 request_value_reader.get_ref().clone().into(),
9388 ));
9389
9390 client.request(request.unwrap()).await
9391 };
9392
9393 match req_result {
9394 Err(err) => {
9395 if let common::Retry::After(d) = dlg.http_error(&err) {
9396 sleep(d).await;
9397 continue;
9398 }
9399 dlg.finished(false);
9400 return Err(common::Error::HttpError(err));
9401 }
9402 Ok(res) => {
9403 let (mut parts, body) = res.into_parts();
9404 let mut body = common::Body::new(body);
9405 if !parts.status.is_success() {
9406 let bytes = common::to_bytes(body).await.unwrap_or_default();
9407 let error = serde_json::from_str(&common::to_string(&bytes));
9408 let response = common::to_response(parts, bytes.into());
9409
9410 if let common::Retry::After(d) =
9411 dlg.http_failure(&response, error.as_ref().ok())
9412 {
9413 sleep(d).await;
9414 continue;
9415 }
9416
9417 dlg.finished(false);
9418
9419 return Err(match error {
9420 Ok(value) => common::Error::BadRequest(value),
9421 _ => common::Error::Failure(response),
9422 });
9423 }
9424 let response = {
9425 let bytes = common::to_bytes(body).await.unwrap_or_default();
9426 let encoded = common::to_string(&bytes);
9427 match serde_json::from_str(&encoded) {
9428 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9429 Err(error) => {
9430 dlg.response_json_decode_error(&encoded, &error);
9431 return Err(common::Error::JsonDecodeError(
9432 encoded.to_string(),
9433 error,
9434 ));
9435 }
9436 }
9437 };
9438
9439 dlg.finished(true);
9440 return Ok(response);
9441 }
9442 }
9443 }
9444 }
9445
9446 ///
9447 /// Sets the *request* property to the given value.
9448 ///
9449 /// Even though the property as already been set when instantiating this call,
9450 /// we provide this method for API completeness.
9451 pub fn request(mut self, new_value: Domain) -> ProjectSiteDomainUpdateCall<'a, C> {
9452 self._request = new_value;
9453 self
9454 }
9455 /// Required. The name of the domain association to update or create, if an association doesn't already exist.
9456 ///
9457 /// Sets the *name* path property to the given value.
9458 ///
9459 /// Even though the property as already been set when instantiating this call,
9460 /// we provide this method for API completeness.
9461 pub fn name(mut self, new_value: &str) -> ProjectSiteDomainUpdateCall<'a, C> {
9462 self._name = new_value.to_string();
9463 self
9464 }
9465 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9466 /// while executing the actual API request.
9467 ///
9468 /// ````text
9469 /// It should be used to handle progress information, and to implement a certain level of resilience.
9470 /// ````
9471 ///
9472 /// Sets the *delegate* property to the given value.
9473 pub fn delegate(
9474 mut self,
9475 new_value: &'a mut dyn common::Delegate,
9476 ) -> ProjectSiteDomainUpdateCall<'a, C> {
9477 self._delegate = Some(new_value);
9478 self
9479 }
9480
9481 /// Set any additional parameter of the query string used in the request.
9482 /// It should be used to set parameters which are not yet available through their own
9483 /// setters.
9484 ///
9485 /// Please note that this method must not be used to set any of the known parameters
9486 /// which have their own setter method. If done anyway, the request will fail.
9487 ///
9488 /// # Additional Parameters
9489 ///
9490 /// * *$.xgafv* (query-string) - V1 error format.
9491 /// * *access_token* (query-string) - OAuth access token.
9492 /// * *alt* (query-string) - Data format for response.
9493 /// * *callback* (query-string) - JSONP
9494 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9495 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9496 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9497 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9498 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9499 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9500 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9501 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainUpdateCall<'a, C>
9502 where
9503 T: AsRef<str>,
9504 {
9505 self._additional_params
9506 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9507 self
9508 }
9509
9510 /// Identifies the authorization scope for the method you are building.
9511 ///
9512 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9513 /// [`Scope::CloudPlatform`].
9514 ///
9515 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9516 /// tokens for more than one scope.
9517 ///
9518 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9519 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9520 /// sufficient, a read-write scope will do as well.
9521 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainUpdateCall<'a, C>
9522 where
9523 St: AsRef<str>,
9524 {
9525 self._scopes.insert(String::from(scope.as_ref()));
9526 self
9527 }
9528 /// Identifies the authorization scope(s) for the method you are building.
9529 ///
9530 /// See [`Self::add_scope()`] for details.
9531 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainUpdateCall<'a, C>
9532 where
9533 I: IntoIterator<Item = St>,
9534 St: AsRef<str>,
9535 {
9536 self._scopes
9537 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9538 self
9539 }
9540
9541 /// Removes all scopes, and no default scope will be used either.
9542 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9543 /// for details).
9544 pub fn clear_scopes(mut self) -> ProjectSiteDomainUpdateCall<'a, C> {
9545 self._scopes.clear();
9546 self
9547 }
9548}
9549
9550/// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
9551///
9552/// A builder for the *sites.releases.create* method supported by a *project* resource.
9553/// It is not used directly, but through a [`ProjectMethods`] instance.
9554///
9555/// # Example
9556///
9557/// Instantiate a resource method builder
9558///
9559/// ```test_harness,no_run
9560/// # extern crate hyper;
9561/// # extern crate hyper_rustls;
9562/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
9563/// use firebasehosting1_beta1::api::Release;
9564/// # async fn dox() {
9565/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9566///
9567/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9568/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9569/// # secret,
9570/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9571/// # ).build().await.unwrap();
9572///
9573/// # let client = hyper_util::client::legacy::Client::builder(
9574/// # hyper_util::rt::TokioExecutor::new()
9575/// # )
9576/// # .build(
9577/// # hyper_rustls::HttpsConnectorBuilder::new()
9578/// # .with_native_roots()
9579/// # .unwrap()
9580/// # .https_or_http()
9581/// # .enable_http1()
9582/// # .build()
9583/// # );
9584/// # let mut hub = FirebaseHosting::new(client, auth);
9585/// // As the method needs a request, you would usually fill it with the desired information
9586/// // into the respective structure. Some of the parts shown here might not be applicable !
9587/// // Values shown here are possibly random and not representative !
9588/// let mut req = Release::default();
9589///
9590/// // You can configure optional parameters by calling the respective setters at will, and
9591/// // execute the final call using `doit()`.
9592/// // Values shown here are possibly random and not representative !
9593/// let result = hub.projects().sites_releases_create(req, "parent")
9594/// .version_name("vero")
9595/// .doit().await;
9596/// # }
9597/// ```
9598pub struct ProjectSiteReleaseCreateCall<'a, C>
9599where
9600 C: 'a,
9601{
9602 hub: &'a FirebaseHosting<C>,
9603 _request: Release,
9604 _parent: String,
9605 _version_name: Option<String>,
9606 _delegate: Option<&'a mut dyn common::Delegate>,
9607 _additional_params: HashMap<String, String>,
9608 _scopes: BTreeSet<String>,
9609}
9610
9611impl<'a, C> common::CallBuilder for ProjectSiteReleaseCreateCall<'a, C> {}
9612
9613impl<'a, C> ProjectSiteReleaseCreateCall<'a, C>
9614where
9615 C: common::Connector,
9616{
9617 /// Perform the operation you have build so far.
9618 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
9619 use std::borrow::Cow;
9620 use std::io::{Read, Seek};
9621
9622 use common::{url::Params, ToParts};
9623 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9624
9625 let mut dd = common::DefaultDelegate;
9626 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9627 dlg.begin(common::MethodInfo {
9628 id: "firebasehosting.projects.sites.releases.create",
9629 http_method: hyper::Method::POST,
9630 });
9631
9632 for &field in ["alt", "parent", "versionName"].iter() {
9633 if self._additional_params.contains_key(field) {
9634 dlg.finished(false);
9635 return Err(common::Error::FieldClash(field));
9636 }
9637 }
9638
9639 let mut params = Params::with_capacity(5 + self._additional_params.len());
9640 params.push("parent", self._parent);
9641 if let Some(value) = self._version_name.as_ref() {
9642 params.push("versionName", value);
9643 }
9644
9645 params.extend(self._additional_params.iter());
9646
9647 params.push("alt", "json");
9648 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
9649 if self._scopes.is_empty() {
9650 self._scopes
9651 .insert(Scope::CloudPlatform.as_ref().to_string());
9652 }
9653
9654 #[allow(clippy::single_element_loop)]
9655 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9656 url = params.uri_replacement(url, param_name, find_this, true);
9657 }
9658 {
9659 let to_remove = ["parent"];
9660 params.remove_params(&to_remove);
9661 }
9662
9663 let url = params.parse_with_url(&url);
9664
9665 let mut json_mime_type = mime::APPLICATION_JSON;
9666 let mut request_value_reader = {
9667 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9668 common::remove_json_null_values(&mut value);
9669 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9670 serde_json::to_writer(&mut dst, &value).unwrap();
9671 dst
9672 };
9673 let request_size = request_value_reader
9674 .seek(std::io::SeekFrom::End(0))
9675 .unwrap();
9676 request_value_reader
9677 .seek(std::io::SeekFrom::Start(0))
9678 .unwrap();
9679
9680 loop {
9681 let token = match self
9682 .hub
9683 .auth
9684 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9685 .await
9686 {
9687 Ok(token) => token,
9688 Err(e) => match dlg.token(e) {
9689 Ok(token) => token,
9690 Err(e) => {
9691 dlg.finished(false);
9692 return Err(common::Error::MissingToken(e));
9693 }
9694 },
9695 };
9696 request_value_reader
9697 .seek(std::io::SeekFrom::Start(0))
9698 .unwrap();
9699 let mut req_result = {
9700 let client = &self.hub.client;
9701 dlg.pre_request();
9702 let mut req_builder = hyper::Request::builder()
9703 .method(hyper::Method::POST)
9704 .uri(url.as_str())
9705 .header(USER_AGENT, self.hub._user_agent.clone());
9706
9707 if let Some(token) = token.as_ref() {
9708 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9709 }
9710
9711 let request = req_builder
9712 .header(CONTENT_TYPE, json_mime_type.to_string())
9713 .header(CONTENT_LENGTH, request_size as u64)
9714 .body(common::to_body(
9715 request_value_reader.get_ref().clone().into(),
9716 ));
9717
9718 client.request(request.unwrap()).await
9719 };
9720
9721 match req_result {
9722 Err(err) => {
9723 if let common::Retry::After(d) = dlg.http_error(&err) {
9724 sleep(d).await;
9725 continue;
9726 }
9727 dlg.finished(false);
9728 return Err(common::Error::HttpError(err));
9729 }
9730 Ok(res) => {
9731 let (mut parts, body) = res.into_parts();
9732 let mut body = common::Body::new(body);
9733 if !parts.status.is_success() {
9734 let bytes = common::to_bytes(body).await.unwrap_or_default();
9735 let error = serde_json::from_str(&common::to_string(&bytes));
9736 let response = common::to_response(parts, bytes.into());
9737
9738 if let common::Retry::After(d) =
9739 dlg.http_failure(&response, error.as_ref().ok())
9740 {
9741 sleep(d).await;
9742 continue;
9743 }
9744
9745 dlg.finished(false);
9746
9747 return Err(match error {
9748 Ok(value) => common::Error::BadRequest(value),
9749 _ => common::Error::Failure(response),
9750 });
9751 }
9752 let response = {
9753 let bytes = common::to_bytes(body).await.unwrap_or_default();
9754 let encoded = common::to_string(&bytes);
9755 match serde_json::from_str(&encoded) {
9756 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9757 Err(error) => {
9758 dlg.response_json_decode_error(&encoded, &error);
9759 return Err(common::Error::JsonDecodeError(
9760 encoded.to_string(),
9761 error,
9762 ));
9763 }
9764 }
9765 };
9766
9767 dlg.finished(true);
9768 return Ok(response);
9769 }
9770 }
9771 }
9772 }
9773
9774 ///
9775 /// Sets the *request* property to the given value.
9776 ///
9777 /// Even though the property as already been set when instantiating this call,
9778 /// we provide this method for API completeness.
9779 pub fn request(mut self, new_value: Release) -> ProjectSiteReleaseCreateCall<'a, C> {
9780 self._request = new_value;
9781 self
9782 }
9783 /// Required. The site or channel to which the release belongs, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
9784 ///
9785 /// Sets the *parent* path property to the given value.
9786 ///
9787 /// Even though the property as already been set when instantiating this call,
9788 /// we provide this method for API completeness.
9789 pub fn parent(mut self, new_value: &str) -> ProjectSiteReleaseCreateCall<'a, C> {
9790 self._parent = new_value.to_string();
9791 self
9792 }
9793 /// The unique identifier for a version, in the format: sites/SITE_ID/versions/ VERSION_ID The SITE_ID in this version identifier must match the SITE_ID in the `parent` parameter. This query parameter must be empty if the `type` field in the request body is `SITE_DISABLE`.
9794 ///
9795 /// Sets the *version name* query property to the given value.
9796 pub fn version_name(mut self, new_value: &str) -> ProjectSiteReleaseCreateCall<'a, C> {
9797 self._version_name = Some(new_value.to_string());
9798 self
9799 }
9800 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9801 /// while executing the actual API request.
9802 ///
9803 /// ````text
9804 /// It should be used to handle progress information, and to implement a certain level of resilience.
9805 /// ````
9806 ///
9807 /// Sets the *delegate* property to the given value.
9808 pub fn delegate(
9809 mut self,
9810 new_value: &'a mut dyn common::Delegate,
9811 ) -> ProjectSiteReleaseCreateCall<'a, C> {
9812 self._delegate = Some(new_value);
9813 self
9814 }
9815
9816 /// Set any additional parameter of the query string used in the request.
9817 /// It should be used to set parameters which are not yet available through their own
9818 /// setters.
9819 ///
9820 /// Please note that this method must not be used to set any of the known parameters
9821 /// which have their own setter method. If done anyway, the request will fail.
9822 ///
9823 /// # Additional Parameters
9824 ///
9825 /// * *$.xgafv* (query-string) - V1 error format.
9826 /// * *access_token* (query-string) - OAuth access token.
9827 /// * *alt* (query-string) - Data format for response.
9828 /// * *callback* (query-string) - JSONP
9829 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9830 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9831 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9832 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9833 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9834 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9835 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9836 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteReleaseCreateCall<'a, C>
9837 where
9838 T: AsRef<str>,
9839 {
9840 self._additional_params
9841 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9842 self
9843 }
9844
9845 /// Identifies the authorization scope for the method you are building.
9846 ///
9847 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9848 /// [`Scope::CloudPlatform`].
9849 ///
9850 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9851 /// tokens for more than one scope.
9852 ///
9853 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9854 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9855 /// sufficient, a read-write scope will do as well.
9856 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteReleaseCreateCall<'a, C>
9857 where
9858 St: AsRef<str>,
9859 {
9860 self._scopes.insert(String::from(scope.as_ref()));
9861 self
9862 }
9863 /// Identifies the authorization scope(s) for the method you are building.
9864 ///
9865 /// See [`Self::add_scope()`] for details.
9866 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteReleaseCreateCall<'a, C>
9867 where
9868 I: IntoIterator<Item = St>,
9869 St: AsRef<str>,
9870 {
9871 self._scopes
9872 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9873 self
9874 }
9875
9876 /// Removes all scopes, and no default scope will be used either.
9877 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9878 /// for details).
9879 pub fn clear_scopes(mut self) -> ProjectSiteReleaseCreateCall<'a, C> {
9880 self._scopes.clear();
9881 self
9882 }
9883}
9884
9885/// Gets the specified release for a site or channel. When used to get a release for a site, this can get releases for both the default `live` channel and any active preview channels for the specified site.
9886///
9887/// A builder for the *sites.releases.get* method supported by a *project* resource.
9888/// It is not used directly, but through a [`ProjectMethods`] instance.
9889///
9890/// # Example
9891///
9892/// Instantiate a resource method builder
9893///
9894/// ```test_harness,no_run
9895/// # extern crate hyper;
9896/// # extern crate hyper_rustls;
9897/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
9898/// # async fn dox() {
9899/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9900///
9901/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9902/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9903/// # secret,
9904/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9905/// # ).build().await.unwrap();
9906///
9907/// # let client = hyper_util::client::legacy::Client::builder(
9908/// # hyper_util::rt::TokioExecutor::new()
9909/// # )
9910/// # .build(
9911/// # hyper_rustls::HttpsConnectorBuilder::new()
9912/// # .with_native_roots()
9913/// # .unwrap()
9914/// # .https_or_http()
9915/// # .enable_http1()
9916/// # .build()
9917/// # );
9918/// # let mut hub = FirebaseHosting::new(client, auth);
9919/// // You can configure optional parameters by calling the respective setters at will, and
9920/// // execute the final call using `doit()`.
9921/// // Values shown here are possibly random and not representative !
9922/// let result = hub.projects().sites_releases_get("name")
9923/// .doit().await;
9924/// # }
9925/// ```
9926pub struct ProjectSiteReleaseGetCall<'a, C>
9927where
9928 C: 'a,
9929{
9930 hub: &'a FirebaseHosting<C>,
9931 _name: String,
9932 _delegate: Option<&'a mut dyn common::Delegate>,
9933 _additional_params: HashMap<String, String>,
9934 _scopes: BTreeSet<String>,
9935}
9936
9937impl<'a, C> common::CallBuilder for ProjectSiteReleaseGetCall<'a, C> {}
9938
9939impl<'a, C> ProjectSiteReleaseGetCall<'a, C>
9940where
9941 C: common::Connector,
9942{
9943 /// Perform the operation you have build so far.
9944 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
9945 use std::borrow::Cow;
9946 use std::io::{Read, Seek};
9947
9948 use common::{url::Params, ToParts};
9949 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9950
9951 let mut dd = common::DefaultDelegate;
9952 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9953 dlg.begin(common::MethodInfo {
9954 id: "firebasehosting.projects.sites.releases.get",
9955 http_method: hyper::Method::GET,
9956 });
9957
9958 for &field in ["alt", "name"].iter() {
9959 if self._additional_params.contains_key(field) {
9960 dlg.finished(false);
9961 return Err(common::Error::FieldClash(field));
9962 }
9963 }
9964
9965 let mut params = Params::with_capacity(3 + self._additional_params.len());
9966 params.push("name", self._name);
9967
9968 params.extend(self._additional_params.iter());
9969
9970 params.push("alt", "json");
9971 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
9972 if self._scopes.is_empty() {
9973 self._scopes
9974 .insert(Scope::FirebaseReadonly.as_ref().to_string());
9975 }
9976
9977 #[allow(clippy::single_element_loop)]
9978 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9979 url = params.uri_replacement(url, param_name, find_this, true);
9980 }
9981 {
9982 let to_remove = ["name"];
9983 params.remove_params(&to_remove);
9984 }
9985
9986 let url = params.parse_with_url(&url);
9987
9988 loop {
9989 let token = match self
9990 .hub
9991 .auth
9992 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9993 .await
9994 {
9995 Ok(token) => token,
9996 Err(e) => match dlg.token(e) {
9997 Ok(token) => token,
9998 Err(e) => {
9999 dlg.finished(false);
10000 return Err(common::Error::MissingToken(e));
10001 }
10002 },
10003 };
10004 let mut req_result = {
10005 let client = &self.hub.client;
10006 dlg.pre_request();
10007 let mut req_builder = hyper::Request::builder()
10008 .method(hyper::Method::GET)
10009 .uri(url.as_str())
10010 .header(USER_AGENT, self.hub._user_agent.clone());
10011
10012 if let Some(token) = token.as_ref() {
10013 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10014 }
10015
10016 let request = req_builder
10017 .header(CONTENT_LENGTH, 0_u64)
10018 .body(common::to_body::<String>(None));
10019
10020 client.request(request.unwrap()).await
10021 };
10022
10023 match req_result {
10024 Err(err) => {
10025 if let common::Retry::After(d) = dlg.http_error(&err) {
10026 sleep(d).await;
10027 continue;
10028 }
10029 dlg.finished(false);
10030 return Err(common::Error::HttpError(err));
10031 }
10032 Ok(res) => {
10033 let (mut parts, body) = res.into_parts();
10034 let mut body = common::Body::new(body);
10035 if !parts.status.is_success() {
10036 let bytes = common::to_bytes(body).await.unwrap_or_default();
10037 let error = serde_json::from_str(&common::to_string(&bytes));
10038 let response = common::to_response(parts, bytes.into());
10039
10040 if let common::Retry::After(d) =
10041 dlg.http_failure(&response, error.as_ref().ok())
10042 {
10043 sleep(d).await;
10044 continue;
10045 }
10046
10047 dlg.finished(false);
10048
10049 return Err(match error {
10050 Ok(value) => common::Error::BadRequest(value),
10051 _ => common::Error::Failure(response),
10052 });
10053 }
10054 let response = {
10055 let bytes = common::to_bytes(body).await.unwrap_or_default();
10056 let encoded = common::to_string(&bytes);
10057 match serde_json::from_str(&encoded) {
10058 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10059 Err(error) => {
10060 dlg.response_json_decode_error(&encoded, &error);
10061 return Err(common::Error::JsonDecodeError(
10062 encoded.to_string(),
10063 error,
10064 ));
10065 }
10066 }
10067 };
10068
10069 dlg.finished(true);
10070 return Ok(response);
10071 }
10072 }
10073 }
10074 }
10075
10076 /// Required. The fully-qualified resource name for the Hosting release, in either of the following formats: - sites/SITE_ID/channels/CHANNEL_ID/releases/RELEASE_ID - sites/SITE_ID/releases/RELEASE_ID
10077 ///
10078 /// Sets the *name* path property to the given value.
10079 ///
10080 /// Even though the property as already been set when instantiating this call,
10081 /// we provide this method for API completeness.
10082 pub fn name(mut self, new_value: &str) -> ProjectSiteReleaseGetCall<'a, C> {
10083 self._name = new_value.to_string();
10084 self
10085 }
10086 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10087 /// while executing the actual API request.
10088 ///
10089 /// ````text
10090 /// It should be used to handle progress information, and to implement a certain level of resilience.
10091 /// ````
10092 ///
10093 /// Sets the *delegate* property to the given value.
10094 pub fn delegate(
10095 mut self,
10096 new_value: &'a mut dyn common::Delegate,
10097 ) -> ProjectSiteReleaseGetCall<'a, C> {
10098 self._delegate = Some(new_value);
10099 self
10100 }
10101
10102 /// Set any additional parameter of the query string used in the request.
10103 /// It should be used to set parameters which are not yet available through their own
10104 /// setters.
10105 ///
10106 /// Please note that this method must not be used to set any of the known parameters
10107 /// which have their own setter method. If done anyway, the request will fail.
10108 ///
10109 /// # Additional Parameters
10110 ///
10111 /// * *$.xgafv* (query-string) - V1 error format.
10112 /// * *access_token* (query-string) - OAuth access token.
10113 /// * *alt* (query-string) - Data format for response.
10114 /// * *callback* (query-string) - JSONP
10115 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10116 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10117 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10118 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10119 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10120 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10121 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10122 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteReleaseGetCall<'a, C>
10123 where
10124 T: AsRef<str>,
10125 {
10126 self._additional_params
10127 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10128 self
10129 }
10130
10131 /// Identifies the authorization scope for the method you are building.
10132 ///
10133 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10134 /// [`Scope::FirebaseReadonly`].
10135 ///
10136 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10137 /// tokens for more than one scope.
10138 ///
10139 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10140 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10141 /// sufficient, a read-write scope will do as well.
10142 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteReleaseGetCall<'a, C>
10143 where
10144 St: AsRef<str>,
10145 {
10146 self._scopes.insert(String::from(scope.as_ref()));
10147 self
10148 }
10149 /// Identifies the authorization scope(s) for the method you are building.
10150 ///
10151 /// See [`Self::add_scope()`] for details.
10152 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteReleaseGetCall<'a, C>
10153 where
10154 I: IntoIterator<Item = St>,
10155 St: AsRef<str>,
10156 {
10157 self._scopes
10158 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10159 self
10160 }
10161
10162 /// Removes all scopes, and no default scope will be used either.
10163 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10164 /// for details).
10165 pub fn clear_scopes(mut self) -> ProjectSiteReleaseGetCall<'a, C> {
10166 self._scopes.clear();
10167 self
10168 }
10169}
10170
10171/// Lists the releases that have been created for the specified site or channel. When used to list releases for a site, this list includes releases for both the default `live` channel and any active preview channels for the specified site.
10172///
10173/// A builder for the *sites.releases.list* method supported by a *project* resource.
10174/// It is not used directly, but through a [`ProjectMethods`] instance.
10175///
10176/// # Example
10177///
10178/// Instantiate a resource method builder
10179///
10180/// ```test_harness,no_run
10181/// # extern crate hyper;
10182/// # extern crate hyper_rustls;
10183/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
10184/// # async fn dox() {
10185/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10186///
10187/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10188/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10189/// # secret,
10190/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10191/// # ).build().await.unwrap();
10192///
10193/// # let client = hyper_util::client::legacy::Client::builder(
10194/// # hyper_util::rt::TokioExecutor::new()
10195/// # )
10196/// # .build(
10197/// # hyper_rustls::HttpsConnectorBuilder::new()
10198/// # .with_native_roots()
10199/// # .unwrap()
10200/// # .https_or_http()
10201/// # .enable_http1()
10202/// # .build()
10203/// # );
10204/// # let mut hub = FirebaseHosting::new(client, auth);
10205/// // You can configure optional parameters by calling the respective setters at will, and
10206/// // execute the final call using `doit()`.
10207/// // Values shown here are possibly random and not representative !
10208/// let result = hub.projects().sites_releases_list("parent")
10209/// .page_token("vero")
10210/// .page_size(-44)
10211/// .doit().await;
10212/// # }
10213/// ```
10214pub struct ProjectSiteReleaseListCall<'a, C>
10215where
10216 C: 'a,
10217{
10218 hub: &'a FirebaseHosting<C>,
10219 _parent: String,
10220 _page_token: Option<String>,
10221 _page_size: Option<i32>,
10222 _delegate: Option<&'a mut dyn common::Delegate>,
10223 _additional_params: HashMap<String, String>,
10224 _scopes: BTreeSet<String>,
10225}
10226
10227impl<'a, C> common::CallBuilder for ProjectSiteReleaseListCall<'a, C> {}
10228
10229impl<'a, C> ProjectSiteReleaseListCall<'a, C>
10230where
10231 C: common::Connector,
10232{
10233 /// Perform the operation you have build so far.
10234 pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
10235 use std::borrow::Cow;
10236 use std::io::{Read, Seek};
10237
10238 use common::{url::Params, ToParts};
10239 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10240
10241 let mut dd = common::DefaultDelegate;
10242 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10243 dlg.begin(common::MethodInfo {
10244 id: "firebasehosting.projects.sites.releases.list",
10245 http_method: hyper::Method::GET,
10246 });
10247
10248 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
10249 if self._additional_params.contains_key(field) {
10250 dlg.finished(false);
10251 return Err(common::Error::FieldClash(field));
10252 }
10253 }
10254
10255 let mut params = Params::with_capacity(5 + self._additional_params.len());
10256 params.push("parent", self._parent);
10257 if let Some(value) = self._page_token.as_ref() {
10258 params.push("pageToken", value);
10259 }
10260 if let Some(value) = self._page_size.as_ref() {
10261 params.push("pageSize", value.to_string());
10262 }
10263
10264 params.extend(self._additional_params.iter());
10265
10266 params.push("alt", "json");
10267 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
10268 if self._scopes.is_empty() {
10269 self._scopes
10270 .insert(Scope::FirebaseReadonly.as_ref().to_string());
10271 }
10272
10273 #[allow(clippy::single_element_loop)]
10274 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10275 url = params.uri_replacement(url, param_name, find_this, true);
10276 }
10277 {
10278 let to_remove = ["parent"];
10279 params.remove_params(&to_remove);
10280 }
10281
10282 let url = params.parse_with_url(&url);
10283
10284 loop {
10285 let token = match self
10286 .hub
10287 .auth
10288 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10289 .await
10290 {
10291 Ok(token) => token,
10292 Err(e) => match dlg.token(e) {
10293 Ok(token) => token,
10294 Err(e) => {
10295 dlg.finished(false);
10296 return Err(common::Error::MissingToken(e));
10297 }
10298 },
10299 };
10300 let mut req_result = {
10301 let client = &self.hub.client;
10302 dlg.pre_request();
10303 let mut req_builder = hyper::Request::builder()
10304 .method(hyper::Method::GET)
10305 .uri(url.as_str())
10306 .header(USER_AGENT, self.hub._user_agent.clone());
10307
10308 if let Some(token) = token.as_ref() {
10309 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10310 }
10311
10312 let request = req_builder
10313 .header(CONTENT_LENGTH, 0_u64)
10314 .body(common::to_body::<String>(None));
10315
10316 client.request(request.unwrap()).await
10317 };
10318
10319 match req_result {
10320 Err(err) => {
10321 if let common::Retry::After(d) = dlg.http_error(&err) {
10322 sleep(d).await;
10323 continue;
10324 }
10325 dlg.finished(false);
10326 return Err(common::Error::HttpError(err));
10327 }
10328 Ok(res) => {
10329 let (mut parts, body) = res.into_parts();
10330 let mut body = common::Body::new(body);
10331 if !parts.status.is_success() {
10332 let bytes = common::to_bytes(body).await.unwrap_or_default();
10333 let error = serde_json::from_str(&common::to_string(&bytes));
10334 let response = common::to_response(parts, bytes.into());
10335
10336 if let common::Retry::After(d) =
10337 dlg.http_failure(&response, error.as_ref().ok())
10338 {
10339 sleep(d).await;
10340 continue;
10341 }
10342
10343 dlg.finished(false);
10344
10345 return Err(match error {
10346 Ok(value) => common::Error::BadRequest(value),
10347 _ => common::Error::Failure(response),
10348 });
10349 }
10350 let response = {
10351 let bytes = common::to_bytes(body).await.unwrap_or_default();
10352 let encoded = common::to_string(&bytes);
10353 match serde_json::from_str(&encoded) {
10354 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10355 Err(error) => {
10356 dlg.response_json_decode_error(&encoded, &error);
10357 return Err(common::Error::JsonDecodeError(
10358 encoded.to_string(),
10359 error,
10360 ));
10361 }
10362 }
10363 };
10364
10365 dlg.finished(true);
10366 return Ok(response);
10367 }
10368 }
10369 }
10370 }
10371
10372 /// Required. The site or channel for which to list releases, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
10373 ///
10374 /// Sets the *parent* path property to the given value.
10375 ///
10376 /// Even though the property as already been set when instantiating this call,
10377 /// we provide this method for API completeness.
10378 pub fn parent(mut self, new_value: &str) -> ProjectSiteReleaseListCall<'a, C> {
10379 self._parent = new_value.to_string();
10380 self
10381 }
10382 /// A token from a previous call to `releases.list` or `channels.releases.list` that tells the server where to resume listing.
10383 ///
10384 /// Sets the *page token* query property to the given value.
10385 pub fn page_token(mut self, new_value: &str) -> ProjectSiteReleaseListCall<'a, C> {
10386 self._page_token = Some(new_value.to_string());
10387 self
10388 }
10389 /// The maximum number of releases to return. The service may return a lower number if fewer releases exist than this maximum number. If unspecified, defaults to 100.
10390 ///
10391 /// Sets the *page size* query property to the given value.
10392 pub fn page_size(mut self, new_value: i32) -> ProjectSiteReleaseListCall<'a, C> {
10393 self._page_size = Some(new_value);
10394 self
10395 }
10396 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10397 /// while executing the actual API request.
10398 ///
10399 /// ````text
10400 /// It should be used to handle progress information, and to implement a certain level of resilience.
10401 /// ````
10402 ///
10403 /// Sets the *delegate* property to the given value.
10404 pub fn delegate(
10405 mut self,
10406 new_value: &'a mut dyn common::Delegate,
10407 ) -> ProjectSiteReleaseListCall<'a, C> {
10408 self._delegate = Some(new_value);
10409 self
10410 }
10411
10412 /// Set any additional parameter of the query string used in the request.
10413 /// It should be used to set parameters which are not yet available through their own
10414 /// setters.
10415 ///
10416 /// Please note that this method must not be used to set any of the known parameters
10417 /// which have their own setter method. If done anyway, the request will fail.
10418 ///
10419 /// # Additional Parameters
10420 ///
10421 /// * *$.xgafv* (query-string) - V1 error format.
10422 /// * *access_token* (query-string) - OAuth access token.
10423 /// * *alt* (query-string) - Data format for response.
10424 /// * *callback* (query-string) - JSONP
10425 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10426 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10427 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10428 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10429 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10430 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10431 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10432 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteReleaseListCall<'a, C>
10433 where
10434 T: AsRef<str>,
10435 {
10436 self._additional_params
10437 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10438 self
10439 }
10440
10441 /// Identifies the authorization scope for the method you are building.
10442 ///
10443 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10444 /// [`Scope::FirebaseReadonly`].
10445 ///
10446 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10447 /// tokens for more than one scope.
10448 ///
10449 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10450 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10451 /// sufficient, a read-write scope will do as well.
10452 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteReleaseListCall<'a, C>
10453 where
10454 St: AsRef<str>,
10455 {
10456 self._scopes.insert(String::from(scope.as_ref()));
10457 self
10458 }
10459 /// Identifies the authorization scope(s) for the method you are building.
10460 ///
10461 /// See [`Self::add_scope()`] for details.
10462 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteReleaseListCall<'a, C>
10463 where
10464 I: IntoIterator<Item = St>,
10465 St: AsRef<str>,
10466 {
10467 self._scopes
10468 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10469 self
10470 }
10471
10472 /// Removes all scopes, and no default scope will be used either.
10473 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10474 /// for details).
10475 pub fn clear_scopes(mut self) -> ProjectSiteReleaseListCall<'a, C> {
10476 self._scopes.clear();
10477 self
10478 }
10479}
10480
10481/// Lists the remaining files to be uploaded for the specified version.
10482///
10483/// A builder for the *sites.versions.files.list* method supported by a *project* resource.
10484/// It is not used directly, but through a [`ProjectMethods`] instance.
10485///
10486/// # Example
10487///
10488/// Instantiate a resource method builder
10489///
10490/// ```test_harness,no_run
10491/// # extern crate hyper;
10492/// # extern crate hyper_rustls;
10493/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
10494/// # async fn dox() {
10495/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10496///
10497/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10498/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10499/// # secret,
10500/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10501/// # ).build().await.unwrap();
10502///
10503/// # let client = hyper_util::client::legacy::Client::builder(
10504/// # hyper_util::rt::TokioExecutor::new()
10505/// # )
10506/// # .build(
10507/// # hyper_rustls::HttpsConnectorBuilder::new()
10508/// # .with_native_roots()
10509/// # .unwrap()
10510/// # .https_or_http()
10511/// # .enable_http1()
10512/// # .build()
10513/// # );
10514/// # let mut hub = FirebaseHosting::new(client, auth);
10515/// // You can configure optional parameters by calling the respective setters at will, and
10516/// // execute the final call using `doit()`.
10517/// // Values shown here are possibly random and not representative !
10518/// let result = hub.projects().sites_versions_files_list("parent")
10519/// .status("diam")
10520/// .page_token("no")
10521/// .page_size(-100)
10522/// .doit().await;
10523/// # }
10524/// ```
10525pub struct ProjectSiteVersionFileListCall<'a, C>
10526where
10527 C: 'a,
10528{
10529 hub: &'a FirebaseHosting<C>,
10530 _parent: String,
10531 _status: Option<String>,
10532 _page_token: Option<String>,
10533 _page_size: Option<i32>,
10534 _delegate: Option<&'a mut dyn common::Delegate>,
10535 _additional_params: HashMap<String, String>,
10536 _scopes: BTreeSet<String>,
10537}
10538
10539impl<'a, C> common::CallBuilder for ProjectSiteVersionFileListCall<'a, C> {}
10540
10541impl<'a, C> ProjectSiteVersionFileListCall<'a, C>
10542where
10543 C: common::Connector,
10544{
10545 /// Perform the operation you have build so far.
10546 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionFilesResponse)> {
10547 use std::borrow::Cow;
10548 use std::io::{Read, Seek};
10549
10550 use common::{url::Params, ToParts};
10551 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10552
10553 let mut dd = common::DefaultDelegate;
10554 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10555 dlg.begin(common::MethodInfo {
10556 id: "firebasehosting.projects.sites.versions.files.list",
10557 http_method: hyper::Method::GET,
10558 });
10559
10560 for &field in ["alt", "parent", "status", "pageToken", "pageSize"].iter() {
10561 if self._additional_params.contains_key(field) {
10562 dlg.finished(false);
10563 return Err(common::Error::FieldClash(field));
10564 }
10565 }
10566
10567 let mut params = Params::with_capacity(6 + self._additional_params.len());
10568 params.push("parent", self._parent);
10569 if let Some(value) = self._status.as_ref() {
10570 params.push("status", value);
10571 }
10572 if let Some(value) = self._page_token.as_ref() {
10573 params.push("pageToken", value);
10574 }
10575 if let Some(value) = self._page_size.as_ref() {
10576 params.push("pageSize", value.to_string());
10577 }
10578
10579 params.extend(self._additional_params.iter());
10580
10581 params.push("alt", "json");
10582 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/files";
10583 if self._scopes.is_empty() {
10584 self._scopes
10585 .insert(Scope::FirebaseReadonly.as_ref().to_string());
10586 }
10587
10588 #[allow(clippy::single_element_loop)]
10589 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10590 url = params.uri_replacement(url, param_name, find_this, true);
10591 }
10592 {
10593 let to_remove = ["parent"];
10594 params.remove_params(&to_remove);
10595 }
10596
10597 let url = params.parse_with_url(&url);
10598
10599 loop {
10600 let token = match self
10601 .hub
10602 .auth
10603 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10604 .await
10605 {
10606 Ok(token) => token,
10607 Err(e) => match dlg.token(e) {
10608 Ok(token) => token,
10609 Err(e) => {
10610 dlg.finished(false);
10611 return Err(common::Error::MissingToken(e));
10612 }
10613 },
10614 };
10615 let mut req_result = {
10616 let client = &self.hub.client;
10617 dlg.pre_request();
10618 let mut req_builder = hyper::Request::builder()
10619 .method(hyper::Method::GET)
10620 .uri(url.as_str())
10621 .header(USER_AGENT, self.hub._user_agent.clone());
10622
10623 if let Some(token) = token.as_ref() {
10624 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10625 }
10626
10627 let request = req_builder
10628 .header(CONTENT_LENGTH, 0_u64)
10629 .body(common::to_body::<String>(None));
10630
10631 client.request(request.unwrap()).await
10632 };
10633
10634 match req_result {
10635 Err(err) => {
10636 if let common::Retry::After(d) = dlg.http_error(&err) {
10637 sleep(d).await;
10638 continue;
10639 }
10640 dlg.finished(false);
10641 return Err(common::Error::HttpError(err));
10642 }
10643 Ok(res) => {
10644 let (mut parts, body) = res.into_parts();
10645 let mut body = common::Body::new(body);
10646 if !parts.status.is_success() {
10647 let bytes = common::to_bytes(body).await.unwrap_or_default();
10648 let error = serde_json::from_str(&common::to_string(&bytes));
10649 let response = common::to_response(parts, bytes.into());
10650
10651 if let common::Retry::After(d) =
10652 dlg.http_failure(&response, error.as_ref().ok())
10653 {
10654 sleep(d).await;
10655 continue;
10656 }
10657
10658 dlg.finished(false);
10659
10660 return Err(match error {
10661 Ok(value) => common::Error::BadRequest(value),
10662 _ => common::Error::Failure(response),
10663 });
10664 }
10665 let response = {
10666 let bytes = common::to_bytes(body).await.unwrap_or_default();
10667 let encoded = common::to_string(&bytes);
10668 match serde_json::from_str(&encoded) {
10669 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10670 Err(error) => {
10671 dlg.response_json_decode_error(&encoded, &error);
10672 return Err(common::Error::JsonDecodeError(
10673 encoded.to_string(),
10674 error,
10675 ));
10676 }
10677 }
10678 };
10679
10680 dlg.finished(true);
10681 return Ok(response);
10682 }
10683 }
10684 }
10685 }
10686
10687 /// Required. The version for which to list files, in the format: sites/SITE_ID /versions/VERSION_ID
10688 ///
10689 /// Sets the *parent* path property to the given value.
10690 ///
10691 /// Even though the property as already been set when instantiating this call,
10692 /// we provide this method for API completeness.
10693 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionFileListCall<'a, C> {
10694 self._parent = new_value.to_string();
10695 self
10696 }
10697 /// The type of files that should be listed for the specified version.
10698 ///
10699 /// Sets the *status* query property to the given value.
10700 pub fn status(mut self, new_value: &str) -> ProjectSiteVersionFileListCall<'a, C> {
10701 self._status = Some(new_value.to_string());
10702 self
10703 }
10704 /// A token from a previous call to `ListVersionFiles` that tells the server where to resume listing.
10705 ///
10706 /// Sets the *page token* query property to the given value.
10707 pub fn page_token(mut self, new_value: &str) -> ProjectSiteVersionFileListCall<'a, C> {
10708 self._page_token = Some(new_value.to_string());
10709 self
10710 }
10711 /// The maximum number of version files to return. The service may return a lower number if fewer version files exist than this maximum number. If unspecified, defaults to 1000.
10712 ///
10713 /// Sets the *page size* query property to the given value.
10714 pub fn page_size(mut self, new_value: i32) -> ProjectSiteVersionFileListCall<'a, C> {
10715 self._page_size = Some(new_value);
10716 self
10717 }
10718 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10719 /// while executing the actual API request.
10720 ///
10721 /// ````text
10722 /// It should be used to handle progress information, and to implement a certain level of resilience.
10723 /// ````
10724 ///
10725 /// Sets the *delegate* property to the given value.
10726 pub fn delegate(
10727 mut self,
10728 new_value: &'a mut dyn common::Delegate,
10729 ) -> ProjectSiteVersionFileListCall<'a, C> {
10730 self._delegate = Some(new_value);
10731 self
10732 }
10733
10734 /// Set any additional parameter of the query string used in the request.
10735 /// It should be used to set parameters which are not yet available through their own
10736 /// setters.
10737 ///
10738 /// Please note that this method must not be used to set any of the known parameters
10739 /// which have their own setter method. If done anyway, the request will fail.
10740 ///
10741 /// # Additional Parameters
10742 ///
10743 /// * *$.xgafv* (query-string) - V1 error format.
10744 /// * *access_token* (query-string) - OAuth access token.
10745 /// * *alt* (query-string) - Data format for response.
10746 /// * *callback* (query-string) - JSONP
10747 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10748 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10749 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10750 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10751 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10752 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10753 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10754 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionFileListCall<'a, C>
10755 where
10756 T: AsRef<str>,
10757 {
10758 self._additional_params
10759 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10760 self
10761 }
10762
10763 /// Identifies the authorization scope for the method you are building.
10764 ///
10765 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10766 /// [`Scope::FirebaseReadonly`].
10767 ///
10768 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10769 /// tokens for more than one scope.
10770 ///
10771 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10772 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10773 /// sufficient, a read-write scope will do as well.
10774 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionFileListCall<'a, C>
10775 where
10776 St: AsRef<str>,
10777 {
10778 self._scopes.insert(String::from(scope.as_ref()));
10779 self
10780 }
10781 /// Identifies the authorization scope(s) for the method you are building.
10782 ///
10783 /// See [`Self::add_scope()`] for details.
10784 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionFileListCall<'a, C>
10785 where
10786 I: IntoIterator<Item = St>,
10787 St: AsRef<str>,
10788 {
10789 self._scopes
10790 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10791 self
10792 }
10793
10794 /// Removes all scopes, and no default scope will be used either.
10795 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10796 /// for details).
10797 pub fn clear_scopes(mut self) -> ProjectSiteVersionFileListCall<'a, C> {
10798 self._scopes.clear();
10799 self
10800 }
10801}
10802
10803/// Creates a new version on the specified target site using the content of the specified version.
10804///
10805/// A builder for the *sites.versions.clone* method supported by a *project* resource.
10806/// It is not used directly, but through a [`ProjectMethods`] instance.
10807///
10808/// # Example
10809///
10810/// Instantiate a resource method builder
10811///
10812/// ```test_harness,no_run
10813/// # extern crate hyper;
10814/// # extern crate hyper_rustls;
10815/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
10816/// use firebasehosting1_beta1::api::CloneVersionRequest;
10817/// # async fn dox() {
10818/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10819///
10820/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10821/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10822/// # secret,
10823/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10824/// # ).build().await.unwrap();
10825///
10826/// # let client = hyper_util::client::legacy::Client::builder(
10827/// # hyper_util::rt::TokioExecutor::new()
10828/// # )
10829/// # .build(
10830/// # hyper_rustls::HttpsConnectorBuilder::new()
10831/// # .with_native_roots()
10832/// # .unwrap()
10833/// # .https_or_http()
10834/// # .enable_http1()
10835/// # .build()
10836/// # );
10837/// # let mut hub = FirebaseHosting::new(client, auth);
10838/// // As the method needs a request, you would usually fill it with the desired information
10839/// // into the respective structure. Some of the parts shown here might not be applicable !
10840/// // Values shown here are possibly random and not representative !
10841/// let mut req = CloneVersionRequest::default();
10842///
10843/// // You can configure optional parameters by calling the respective setters at will, and
10844/// // execute the final call using `doit()`.
10845/// // Values shown here are possibly random and not representative !
10846/// let result = hub.projects().sites_versions_clone(req, "parent")
10847/// .doit().await;
10848/// # }
10849/// ```
10850pub struct ProjectSiteVersionCloneCall<'a, C>
10851where
10852 C: 'a,
10853{
10854 hub: &'a FirebaseHosting<C>,
10855 _request: CloneVersionRequest,
10856 _parent: String,
10857 _delegate: Option<&'a mut dyn common::Delegate>,
10858 _additional_params: HashMap<String, String>,
10859 _scopes: BTreeSet<String>,
10860}
10861
10862impl<'a, C> common::CallBuilder for ProjectSiteVersionCloneCall<'a, C> {}
10863
10864impl<'a, C> ProjectSiteVersionCloneCall<'a, C>
10865where
10866 C: common::Connector,
10867{
10868 /// Perform the operation you have build so far.
10869 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10870 use std::borrow::Cow;
10871 use std::io::{Read, Seek};
10872
10873 use common::{url::Params, ToParts};
10874 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10875
10876 let mut dd = common::DefaultDelegate;
10877 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10878 dlg.begin(common::MethodInfo {
10879 id: "firebasehosting.projects.sites.versions.clone",
10880 http_method: hyper::Method::POST,
10881 });
10882
10883 for &field in ["alt", "parent"].iter() {
10884 if self._additional_params.contains_key(field) {
10885 dlg.finished(false);
10886 return Err(common::Error::FieldClash(field));
10887 }
10888 }
10889
10890 let mut params = Params::with_capacity(4 + self._additional_params.len());
10891 params.push("parent", self._parent);
10892
10893 params.extend(self._additional_params.iter());
10894
10895 params.push("alt", "json");
10896 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions:clone";
10897 if self._scopes.is_empty() {
10898 self._scopes
10899 .insert(Scope::CloudPlatform.as_ref().to_string());
10900 }
10901
10902 #[allow(clippy::single_element_loop)]
10903 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10904 url = params.uri_replacement(url, param_name, find_this, true);
10905 }
10906 {
10907 let to_remove = ["parent"];
10908 params.remove_params(&to_remove);
10909 }
10910
10911 let url = params.parse_with_url(&url);
10912
10913 let mut json_mime_type = mime::APPLICATION_JSON;
10914 let mut request_value_reader = {
10915 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10916 common::remove_json_null_values(&mut value);
10917 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10918 serde_json::to_writer(&mut dst, &value).unwrap();
10919 dst
10920 };
10921 let request_size = request_value_reader
10922 .seek(std::io::SeekFrom::End(0))
10923 .unwrap();
10924 request_value_reader
10925 .seek(std::io::SeekFrom::Start(0))
10926 .unwrap();
10927
10928 loop {
10929 let token = match self
10930 .hub
10931 .auth
10932 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10933 .await
10934 {
10935 Ok(token) => token,
10936 Err(e) => match dlg.token(e) {
10937 Ok(token) => token,
10938 Err(e) => {
10939 dlg.finished(false);
10940 return Err(common::Error::MissingToken(e));
10941 }
10942 },
10943 };
10944 request_value_reader
10945 .seek(std::io::SeekFrom::Start(0))
10946 .unwrap();
10947 let mut req_result = {
10948 let client = &self.hub.client;
10949 dlg.pre_request();
10950 let mut req_builder = hyper::Request::builder()
10951 .method(hyper::Method::POST)
10952 .uri(url.as_str())
10953 .header(USER_AGENT, self.hub._user_agent.clone());
10954
10955 if let Some(token) = token.as_ref() {
10956 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10957 }
10958
10959 let request = req_builder
10960 .header(CONTENT_TYPE, json_mime_type.to_string())
10961 .header(CONTENT_LENGTH, request_size as u64)
10962 .body(common::to_body(
10963 request_value_reader.get_ref().clone().into(),
10964 ));
10965
10966 client.request(request.unwrap()).await
10967 };
10968
10969 match req_result {
10970 Err(err) => {
10971 if let common::Retry::After(d) = dlg.http_error(&err) {
10972 sleep(d).await;
10973 continue;
10974 }
10975 dlg.finished(false);
10976 return Err(common::Error::HttpError(err));
10977 }
10978 Ok(res) => {
10979 let (mut parts, body) = res.into_parts();
10980 let mut body = common::Body::new(body);
10981 if !parts.status.is_success() {
10982 let bytes = common::to_bytes(body).await.unwrap_or_default();
10983 let error = serde_json::from_str(&common::to_string(&bytes));
10984 let response = common::to_response(parts, bytes.into());
10985
10986 if let common::Retry::After(d) =
10987 dlg.http_failure(&response, error.as_ref().ok())
10988 {
10989 sleep(d).await;
10990 continue;
10991 }
10992
10993 dlg.finished(false);
10994
10995 return Err(match error {
10996 Ok(value) => common::Error::BadRequest(value),
10997 _ => common::Error::Failure(response),
10998 });
10999 }
11000 let response = {
11001 let bytes = common::to_bytes(body).await.unwrap_or_default();
11002 let encoded = common::to_string(&bytes);
11003 match serde_json::from_str(&encoded) {
11004 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11005 Err(error) => {
11006 dlg.response_json_decode_error(&encoded, &error);
11007 return Err(common::Error::JsonDecodeError(
11008 encoded.to_string(),
11009 error,
11010 ));
11011 }
11012 }
11013 };
11014
11015 dlg.finished(true);
11016 return Ok(response);
11017 }
11018 }
11019 }
11020 }
11021
11022 ///
11023 /// Sets the *request* property to the given value.
11024 ///
11025 /// Even though the property as already been set when instantiating this call,
11026 /// we provide this method for API completeness.
11027 pub fn request(mut self, new_value: CloneVersionRequest) -> ProjectSiteVersionCloneCall<'a, C> {
11028 self._request = new_value;
11029 self
11030 }
11031 /// Required. The target site for the cloned version, in the format: sites/ SITE_ID
11032 ///
11033 /// Sets the *parent* path property to the given value.
11034 ///
11035 /// Even though the property as already been set when instantiating this call,
11036 /// we provide this method for API completeness.
11037 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionCloneCall<'a, C> {
11038 self._parent = new_value.to_string();
11039 self
11040 }
11041 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11042 /// while executing the actual API request.
11043 ///
11044 /// ````text
11045 /// It should be used to handle progress information, and to implement a certain level of resilience.
11046 /// ````
11047 ///
11048 /// Sets the *delegate* property to the given value.
11049 pub fn delegate(
11050 mut self,
11051 new_value: &'a mut dyn common::Delegate,
11052 ) -> ProjectSiteVersionCloneCall<'a, C> {
11053 self._delegate = Some(new_value);
11054 self
11055 }
11056
11057 /// Set any additional parameter of the query string used in the request.
11058 /// It should be used to set parameters which are not yet available through their own
11059 /// setters.
11060 ///
11061 /// Please note that this method must not be used to set any of the known parameters
11062 /// which have their own setter method. If done anyway, the request will fail.
11063 ///
11064 /// # Additional Parameters
11065 ///
11066 /// * *$.xgafv* (query-string) - V1 error format.
11067 /// * *access_token* (query-string) - OAuth access token.
11068 /// * *alt* (query-string) - Data format for response.
11069 /// * *callback* (query-string) - JSONP
11070 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11071 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11072 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11073 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11074 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11075 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11076 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11077 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionCloneCall<'a, C>
11078 where
11079 T: AsRef<str>,
11080 {
11081 self._additional_params
11082 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11083 self
11084 }
11085
11086 /// Identifies the authorization scope for the method you are building.
11087 ///
11088 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11089 /// [`Scope::CloudPlatform`].
11090 ///
11091 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11092 /// tokens for more than one scope.
11093 ///
11094 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11095 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11096 /// sufficient, a read-write scope will do as well.
11097 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionCloneCall<'a, C>
11098 where
11099 St: AsRef<str>,
11100 {
11101 self._scopes.insert(String::from(scope.as_ref()));
11102 self
11103 }
11104 /// Identifies the authorization scope(s) for the method you are building.
11105 ///
11106 /// See [`Self::add_scope()`] for details.
11107 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionCloneCall<'a, C>
11108 where
11109 I: IntoIterator<Item = St>,
11110 St: AsRef<str>,
11111 {
11112 self._scopes
11113 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11114 self
11115 }
11116
11117 /// Removes all scopes, and no default scope will be used either.
11118 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11119 /// for details).
11120 pub fn clear_scopes(mut self) -> ProjectSiteVersionCloneCall<'a, C> {
11121 self._scopes.clear();
11122 self
11123 }
11124}
11125
11126/// Creates a new version for the specified site.
11127///
11128/// A builder for the *sites.versions.create* method supported by a *project* resource.
11129/// It is not used directly, but through a [`ProjectMethods`] instance.
11130///
11131/// # Example
11132///
11133/// Instantiate a resource method builder
11134///
11135/// ```test_harness,no_run
11136/// # extern crate hyper;
11137/// # extern crate hyper_rustls;
11138/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
11139/// use firebasehosting1_beta1::api::Version;
11140/// # async fn dox() {
11141/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11142///
11143/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11144/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11145/// # secret,
11146/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11147/// # ).build().await.unwrap();
11148///
11149/// # let client = hyper_util::client::legacy::Client::builder(
11150/// # hyper_util::rt::TokioExecutor::new()
11151/// # )
11152/// # .build(
11153/// # hyper_rustls::HttpsConnectorBuilder::new()
11154/// # .with_native_roots()
11155/// # .unwrap()
11156/// # .https_or_http()
11157/// # .enable_http1()
11158/// # .build()
11159/// # );
11160/// # let mut hub = FirebaseHosting::new(client, auth);
11161/// // As the method needs a request, you would usually fill it with the desired information
11162/// // into the respective structure. Some of the parts shown here might not be applicable !
11163/// // Values shown here are possibly random and not representative !
11164/// let mut req = Version::default();
11165///
11166/// // You can configure optional parameters by calling the respective setters at will, and
11167/// // execute the final call using `doit()`.
11168/// // Values shown here are possibly random and not representative !
11169/// let result = hub.projects().sites_versions_create(req, "parent")
11170/// .version_id("consetetur")
11171/// .size_bytes(-28)
11172/// .doit().await;
11173/// # }
11174/// ```
11175pub struct ProjectSiteVersionCreateCall<'a, C>
11176where
11177 C: 'a,
11178{
11179 hub: &'a FirebaseHosting<C>,
11180 _request: Version,
11181 _parent: String,
11182 _version_id: Option<String>,
11183 _size_bytes: Option<i64>,
11184 _delegate: Option<&'a mut dyn common::Delegate>,
11185 _additional_params: HashMap<String, String>,
11186 _scopes: BTreeSet<String>,
11187}
11188
11189impl<'a, C> common::CallBuilder for ProjectSiteVersionCreateCall<'a, C> {}
11190
11191impl<'a, C> ProjectSiteVersionCreateCall<'a, C>
11192where
11193 C: common::Connector,
11194{
11195 /// Perform the operation you have build so far.
11196 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
11197 use std::borrow::Cow;
11198 use std::io::{Read, Seek};
11199
11200 use common::{url::Params, ToParts};
11201 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11202
11203 let mut dd = common::DefaultDelegate;
11204 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11205 dlg.begin(common::MethodInfo {
11206 id: "firebasehosting.projects.sites.versions.create",
11207 http_method: hyper::Method::POST,
11208 });
11209
11210 for &field in ["alt", "parent", "versionId", "sizeBytes"].iter() {
11211 if self._additional_params.contains_key(field) {
11212 dlg.finished(false);
11213 return Err(common::Error::FieldClash(field));
11214 }
11215 }
11216
11217 let mut params = Params::with_capacity(6 + self._additional_params.len());
11218 params.push("parent", self._parent);
11219 if let Some(value) = self._version_id.as_ref() {
11220 params.push("versionId", value);
11221 }
11222 if let Some(value) = self._size_bytes.as_ref() {
11223 params.push("sizeBytes", value.to_string());
11224 }
11225
11226 params.extend(self._additional_params.iter());
11227
11228 params.push("alt", "json");
11229 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
11230 if self._scopes.is_empty() {
11231 self._scopes
11232 .insert(Scope::CloudPlatform.as_ref().to_string());
11233 }
11234
11235 #[allow(clippy::single_element_loop)]
11236 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11237 url = params.uri_replacement(url, param_name, find_this, true);
11238 }
11239 {
11240 let to_remove = ["parent"];
11241 params.remove_params(&to_remove);
11242 }
11243
11244 let url = params.parse_with_url(&url);
11245
11246 let mut json_mime_type = mime::APPLICATION_JSON;
11247 let mut request_value_reader = {
11248 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11249 common::remove_json_null_values(&mut value);
11250 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11251 serde_json::to_writer(&mut dst, &value).unwrap();
11252 dst
11253 };
11254 let request_size = request_value_reader
11255 .seek(std::io::SeekFrom::End(0))
11256 .unwrap();
11257 request_value_reader
11258 .seek(std::io::SeekFrom::Start(0))
11259 .unwrap();
11260
11261 loop {
11262 let token = match self
11263 .hub
11264 .auth
11265 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11266 .await
11267 {
11268 Ok(token) => token,
11269 Err(e) => match dlg.token(e) {
11270 Ok(token) => token,
11271 Err(e) => {
11272 dlg.finished(false);
11273 return Err(common::Error::MissingToken(e));
11274 }
11275 },
11276 };
11277 request_value_reader
11278 .seek(std::io::SeekFrom::Start(0))
11279 .unwrap();
11280 let mut req_result = {
11281 let client = &self.hub.client;
11282 dlg.pre_request();
11283 let mut req_builder = hyper::Request::builder()
11284 .method(hyper::Method::POST)
11285 .uri(url.as_str())
11286 .header(USER_AGENT, self.hub._user_agent.clone());
11287
11288 if let Some(token) = token.as_ref() {
11289 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11290 }
11291
11292 let request = req_builder
11293 .header(CONTENT_TYPE, json_mime_type.to_string())
11294 .header(CONTENT_LENGTH, request_size as u64)
11295 .body(common::to_body(
11296 request_value_reader.get_ref().clone().into(),
11297 ));
11298
11299 client.request(request.unwrap()).await
11300 };
11301
11302 match req_result {
11303 Err(err) => {
11304 if let common::Retry::After(d) = dlg.http_error(&err) {
11305 sleep(d).await;
11306 continue;
11307 }
11308 dlg.finished(false);
11309 return Err(common::Error::HttpError(err));
11310 }
11311 Ok(res) => {
11312 let (mut parts, body) = res.into_parts();
11313 let mut body = common::Body::new(body);
11314 if !parts.status.is_success() {
11315 let bytes = common::to_bytes(body).await.unwrap_or_default();
11316 let error = serde_json::from_str(&common::to_string(&bytes));
11317 let response = common::to_response(parts, bytes.into());
11318
11319 if let common::Retry::After(d) =
11320 dlg.http_failure(&response, error.as_ref().ok())
11321 {
11322 sleep(d).await;
11323 continue;
11324 }
11325
11326 dlg.finished(false);
11327
11328 return Err(match error {
11329 Ok(value) => common::Error::BadRequest(value),
11330 _ => common::Error::Failure(response),
11331 });
11332 }
11333 let response = {
11334 let bytes = common::to_bytes(body).await.unwrap_or_default();
11335 let encoded = common::to_string(&bytes);
11336 match serde_json::from_str(&encoded) {
11337 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11338 Err(error) => {
11339 dlg.response_json_decode_error(&encoded, &error);
11340 return Err(common::Error::JsonDecodeError(
11341 encoded.to_string(),
11342 error,
11343 ));
11344 }
11345 }
11346 };
11347
11348 dlg.finished(true);
11349 return Ok(response);
11350 }
11351 }
11352 }
11353 }
11354
11355 ///
11356 /// Sets the *request* property to the given value.
11357 ///
11358 /// Even though the property as already been set when instantiating this call,
11359 /// we provide this method for API completeness.
11360 pub fn request(mut self, new_value: Version) -> ProjectSiteVersionCreateCall<'a, C> {
11361 self._request = new_value;
11362 self
11363 }
11364 /// Required. The site in which to create the version, in the format: sites/ SITE_ID
11365 ///
11366 /// Sets the *parent* path property to the given value.
11367 ///
11368 /// Even though the property as already been set when instantiating this call,
11369 /// we provide this method for API completeness.
11370 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionCreateCall<'a, C> {
11371 self._parent = new_value.to_string();
11372 self
11373 }
11374 /// A unique id for the new version. This is was only specified for legacy version creations, and should be blank.
11375 ///
11376 /// Sets the *version id* query property to the given value.
11377 pub fn version_id(mut self, new_value: &str) -> ProjectSiteVersionCreateCall<'a, C> {
11378 self._version_id = Some(new_value.to_string());
11379 self
11380 }
11381 /// The self-reported size of the version. This value is used for a pre-emptive quota check for legacy version uploads.
11382 ///
11383 /// Sets the *size bytes* query property to the given value.
11384 pub fn size_bytes(mut self, new_value: i64) -> ProjectSiteVersionCreateCall<'a, C> {
11385 self._size_bytes = Some(new_value);
11386 self
11387 }
11388 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11389 /// while executing the actual API request.
11390 ///
11391 /// ````text
11392 /// It should be used to handle progress information, and to implement a certain level of resilience.
11393 /// ````
11394 ///
11395 /// Sets the *delegate* property to the given value.
11396 pub fn delegate(
11397 mut self,
11398 new_value: &'a mut dyn common::Delegate,
11399 ) -> ProjectSiteVersionCreateCall<'a, C> {
11400 self._delegate = Some(new_value);
11401 self
11402 }
11403
11404 /// Set any additional parameter of the query string used in the request.
11405 /// It should be used to set parameters which are not yet available through their own
11406 /// setters.
11407 ///
11408 /// Please note that this method must not be used to set any of the known parameters
11409 /// which have their own setter method. If done anyway, the request will fail.
11410 ///
11411 /// # Additional Parameters
11412 ///
11413 /// * *$.xgafv* (query-string) - V1 error format.
11414 /// * *access_token* (query-string) - OAuth access token.
11415 /// * *alt* (query-string) - Data format for response.
11416 /// * *callback* (query-string) - JSONP
11417 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11418 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11419 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11420 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11421 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11422 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11423 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11424 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionCreateCall<'a, C>
11425 where
11426 T: AsRef<str>,
11427 {
11428 self._additional_params
11429 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11430 self
11431 }
11432
11433 /// Identifies the authorization scope for the method you are building.
11434 ///
11435 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11436 /// [`Scope::CloudPlatform`].
11437 ///
11438 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11439 /// tokens for more than one scope.
11440 ///
11441 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11442 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11443 /// sufficient, a read-write scope will do as well.
11444 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionCreateCall<'a, C>
11445 where
11446 St: AsRef<str>,
11447 {
11448 self._scopes.insert(String::from(scope.as_ref()));
11449 self
11450 }
11451 /// Identifies the authorization scope(s) for the method you are building.
11452 ///
11453 /// See [`Self::add_scope()`] for details.
11454 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionCreateCall<'a, C>
11455 where
11456 I: IntoIterator<Item = St>,
11457 St: AsRef<str>,
11458 {
11459 self._scopes
11460 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11461 self
11462 }
11463
11464 /// Removes all scopes, and no default scope will be used either.
11465 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11466 /// for details).
11467 pub fn clear_scopes(mut self) -> ProjectSiteVersionCreateCall<'a, C> {
11468 self._scopes.clear();
11469 self
11470 }
11471}
11472
11473/// Deletes the specified version.
11474///
11475/// A builder for the *sites.versions.delete* method supported by a *project* resource.
11476/// It is not used directly, but through a [`ProjectMethods`] instance.
11477///
11478/// # Example
11479///
11480/// Instantiate a resource method builder
11481///
11482/// ```test_harness,no_run
11483/// # extern crate hyper;
11484/// # extern crate hyper_rustls;
11485/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
11486/// # async fn dox() {
11487/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11488///
11489/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11490/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11491/// # secret,
11492/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11493/// # ).build().await.unwrap();
11494///
11495/// # let client = hyper_util::client::legacy::Client::builder(
11496/// # hyper_util::rt::TokioExecutor::new()
11497/// # )
11498/// # .build(
11499/// # hyper_rustls::HttpsConnectorBuilder::new()
11500/// # .with_native_roots()
11501/// # .unwrap()
11502/// # .https_or_http()
11503/// # .enable_http1()
11504/// # .build()
11505/// # );
11506/// # let mut hub = FirebaseHosting::new(client, auth);
11507/// // You can configure optional parameters by calling the respective setters at will, and
11508/// // execute the final call using `doit()`.
11509/// // Values shown here are possibly random and not representative !
11510/// let result = hub.projects().sites_versions_delete("name")
11511/// .doit().await;
11512/// # }
11513/// ```
11514pub struct ProjectSiteVersionDeleteCall<'a, C>
11515where
11516 C: 'a,
11517{
11518 hub: &'a FirebaseHosting<C>,
11519 _name: String,
11520 _delegate: Option<&'a mut dyn common::Delegate>,
11521 _additional_params: HashMap<String, String>,
11522 _scopes: BTreeSet<String>,
11523}
11524
11525impl<'a, C> common::CallBuilder for ProjectSiteVersionDeleteCall<'a, C> {}
11526
11527impl<'a, C> ProjectSiteVersionDeleteCall<'a, C>
11528where
11529 C: common::Connector,
11530{
11531 /// Perform the operation you have build so far.
11532 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
11533 use std::borrow::Cow;
11534 use std::io::{Read, Seek};
11535
11536 use common::{url::Params, ToParts};
11537 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11538
11539 let mut dd = common::DefaultDelegate;
11540 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11541 dlg.begin(common::MethodInfo {
11542 id: "firebasehosting.projects.sites.versions.delete",
11543 http_method: hyper::Method::DELETE,
11544 });
11545
11546 for &field in ["alt", "name"].iter() {
11547 if self._additional_params.contains_key(field) {
11548 dlg.finished(false);
11549 return Err(common::Error::FieldClash(field));
11550 }
11551 }
11552
11553 let mut params = Params::with_capacity(3 + self._additional_params.len());
11554 params.push("name", self._name);
11555
11556 params.extend(self._additional_params.iter());
11557
11558 params.push("alt", "json");
11559 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
11560 if self._scopes.is_empty() {
11561 self._scopes
11562 .insert(Scope::CloudPlatform.as_ref().to_string());
11563 }
11564
11565 #[allow(clippy::single_element_loop)]
11566 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11567 url = params.uri_replacement(url, param_name, find_this, true);
11568 }
11569 {
11570 let to_remove = ["name"];
11571 params.remove_params(&to_remove);
11572 }
11573
11574 let url = params.parse_with_url(&url);
11575
11576 loop {
11577 let token = match self
11578 .hub
11579 .auth
11580 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11581 .await
11582 {
11583 Ok(token) => token,
11584 Err(e) => match dlg.token(e) {
11585 Ok(token) => token,
11586 Err(e) => {
11587 dlg.finished(false);
11588 return Err(common::Error::MissingToken(e));
11589 }
11590 },
11591 };
11592 let mut req_result = {
11593 let client = &self.hub.client;
11594 dlg.pre_request();
11595 let mut req_builder = hyper::Request::builder()
11596 .method(hyper::Method::DELETE)
11597 .uri(url.as_str())
11598 .header(USER_AGENT, self.hub._user_agent.clone());
11599
11600 if let Some(token) = token.as_ref() {
11601 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11602 }
11603
11604 let request = req_builder
11605 .header(CONTENT_LENGTH, 0_u64)
11606 .body(common::to_body::<String>(None));
11607
11608 client.request(request.unwrap()).await
11609 };
11610
11611 match req_result {
11612 Err(err) => {
11613 if let common::Retry::After(d) = dlg.http_error(&err) {
11614 sleep(d).await;
11615 continue;
11616 }
11617 dlg.finished(false);
11618 return Err(common::Error::HttpError(err));
11619 }
11620 Ok(res) => {
11621 let (mut parts, body) = res.into_parts();
11622 let mut body = common::Body::new(body);
11623 if !parts.status.is_success() {
11624 let bytes = common::to_bytes(body).await.unwrap_or_default();
11625 let error = serde_json::from_str(&common::to_string(&bytes));
11626 let response = common::to_response(parts, bytes.into());
11627
11628 if let common::Retry::After(d) =
11629 dlg.http_failure(&response, error.as_ref().ok())
11630 {
11631 sleep(d).await;
11632 continue;
11633 }
11634
11635 dlg.finished(false);
11636
11637 return Err(match error {
11638 Ok(value) => common::Error::BadRequest(value),
11639 _ => common::Error::Failure(response),
11640 });
11641 }
11642 let response = {
11643 let bytes = common::to_bytes(body).await.unwrap_or_default();
11644 let encoded = common::to_string(&bytes);
11645 match serde_json::from_str(&encoded) {
11646 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11647 Err(error) => {
11648 dlg.response_json_decode_error(&encoded, &error);
11649 return Err(common::Error::JsonDecodeError(
11650 encoded.to_string(),
11651 error,
11652 ));
11653 }
11654 }
11655 };
11656
11657 dlg.finished(true);
11658 return Ok(response);
11659 }
11660 }
11661 }
11662 }
11663
11664 /// Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
11665 ///
11666 /// Sets the *name* path property to the given value.
11667 ///
11668 /// Even though the property as already been set when instantiating this call,
11669 /// we provide this method for API completeness.
11670 pub fn name(mut self, new_value: &str) -> ProjectSiteVersionDeleteCall<'a, C> {
11671 self._name = new_value.to_string();
11672 self
11673 }
11674 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11675 /// while executing the actual API request.
11676 ///
11677 /// ````text
11678 /// It should be used to handle progress information, and to implement a certain level of resilience.
11679 /// ````
11680 ///
11681 /// Sets the *delegate* property to the given value.
11682 pub fn delegate(
11683 mut self,
11684 new_value: &'a mut dyn common::Delegate,
11685 ) -> ProjectSiteVersionDeleteCall<'a, C> {
11686 self._delegate = Some(new_value);
11687 self
11688 }
11689
11690 /// Set any additional parameter of the query string used in the request.
11691 /// It should be used to set parameters which are not yet available through their own
11692 /// setters.
11693 ///
11694 /// Please note that this method must not be used to set any of the known parameters
11695 /// which have their own setter method. If done anyway, the request will fail.
11696 ///
11697 /// # Additional Parameters
11698 ///
11699 /// * *$.xgafv* (query-string) - V1 error format.
11700 /// * *access_token* (query-string) - OAuth access token.
11701 /// * *alt* (query-string) - Data format for response.
11702 /// * *callback* (query-string) - JSONP
11703 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11704 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11705 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11706 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11707 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11708 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11709 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11710 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionDeleteCall<'a, C>
11711 where
11712 T: AsRef<str>,
11713 {
11714 self._additional_params
11715 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11716 self
11717 }
11718
11719 /// Identifies the authorization scope for the method you are building.
11720 ///
11721 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11722 /// [`Scope::CloudPlatform`].
11723 ///
11724 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11725 /// tokens for more than one scope.
11726 ///
11727 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11728 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11729 /// sufficient, a read-write scope will do as well.
11730 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionDeleteCall<'a, C>
11731 where
11732 St: AsRef<str>,
11733 {
11734 self._scopes.insert(String::from(scope.as_ref()));
11735 self
11736 }
11737 /// Identifies the authorization scope(s) for the method you are building.
11738 ///
11739 /// See [`Self::add_scope()`] for details.
11740 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionDeleteCall<'a, C>
11741 where
11742 I: IntoIterator<Item = St>,
11743 St: AsRef<str>,
11744 {
11745 self._scopes
11746 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11747 self
11748 }
11749
11750 /// Removes all scopes, and no default scope will be used either.
11751 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11752 /// for details).
11753 pub fn clear_scopes(mut self) -> ProjectSiteVersionDeleteCall<'a, C> {
11754 self._scopes.clear();
11755 self
11756 }
11757}
11758
11759/// Get the specified version that has been created for the specified site. This can include versions that were created for the default `live` channel or for any active preview channels for the specified site.
11760///
11761/// A builder for the *sites.versions.get* method supported by a *project* resource.
11762/// It is not used directly, but through a [`ProjectMethods`] instance.
11763///
11764/// # Example
11765///
11766/// Instantiate a resource method builder
11767///
11768/// ```test_harness,no_run
11769/// # extern crate hyper;
11770/// # extern crate hyper_rustls;
11771/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
11772/// # async fn dox() {
11773/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11774///
11775/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11776/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11777/// # secret,
11778/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11779/// # ).build().await.unwrap();
11780///
11781/// # let client = hyper_util::client::legacy::Client::builder(
11782/// # hyper_util::rt::TokioExecutor::new()
11783/// # )
11784/// # .build(
11785/// # hyper_rustls::HttpsConnectorBuilder::new()
11786/// # .with_native_roots()
11787/// # .unwrap()
11788/// # .https_or_http()
11789/// # .enable_http1()
11790/// # .build()
11791/// # );
11792/// # let mut hub = FirebaseHosting::new(client, auth);
11793/// // You can configure optional parameters by calling the respective setters at will, and
11794/// // execute the final call using `doit()`.
11795/// // Values shown here are possibly random and not representative !
11796/// let result = hub.projects().sites_versions_get("name")
11797/// .doit().await;
11798/// # }
11799/// ```
11800pub struct ProjectSiteVersionGetCall<'a, C>
11801where
11802 C: 'a,
11803{
11804 hub: &'a FirebaseHosting<C>,
11805 _name: String,
11806 _delegate: Option<&'a mut dyn common::Delegate>,
11807 _additional_params: HashMap<String, String>,
11808 _scopes: BTreeSet<String>,
11809}
11810
11811impl<'a, C> common::CallBuilder for ProjectSiteVersionGetCall<'a, C> {}
11812
11813impl<'a, C> ProjectSiteVersionGetCall<'a, C>
11814where
11815 C: common::Connector,
11816{
11817 /// Perform the operation you have build so far.
11818 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
11819 use std::borrow::Cow;
11820 use std::io::{Read, Seek};
11821
11822 use common::{url::Params, ToParts};
11823 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11824
11825 let mut dd = common::DefaultDelegate;
11826 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11827 dlg.begin(common::MethodInfo {
11828 id: "firebasehosting.projects.sites.versions.get",
11829 http_method: hyper::Method::GET,
11830 });
11831
11832 for &field in ["alt", "name"].iter() {
11833 if self._additional_params.contains_key(field) {
11834 dlg.finished(false);
11835 return Err(common::Error::FieldClash(field));
11836 }
11837 }
11838
11839 let mut params = Params::with_capacity(3 + self._additional_params.len());
11840 params.push("name", self._name);
11841
11842 params.extend(self._additional_params.iter());
11843
11844 params.push("alt", "json");
11845 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
11846 if self._scopes.is_empty() {
11847 self._scopes
11848 .insert(Scope::FirebaseReadonly.as_ref().to_string());
11849 }
11850
11851 #[allow(clippy::single_element_loop)]
11852 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11853 url = params.uri_replacement(url, param_name, find_this, true);
11854 }
11855 {
11856 let to_remove = ["name"];
11857 params.remove_params(&to_remove);
11858 }
11859
11860 let url = params.parse_with_url(&url);
11861
11862 loop {
11863 let token = match self
11864 .hub
11865 .auth
11866 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11867 .await
11868 {
11869 Ok(token) => token,
11870 Err(e) => match dlg.token(e) {
11871 Ok(token) => token,
11872 Err(e) => {
11873 dlg.finished(false);
11874 return Err(common::Error::MissingToken(e));
11875 }
11876 },
11877 };
11878 let mut req_result = {
11879 let client = &self.hub.client;
11880 dlg.pre_request();
11881 let mut req_builder = hyper::Request::builder()
11882 .method(hyper::Method::GET)
11883 .uri(url.as_str())
11884 .header(USER_AGENT, self.hub._user_agent.clone());
11885
11886 if let Some(token) = token.as_ref() {
11887 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11888 }
11889
11890 let request = req_builder
11891 .header(CONTENT_LENGTH, 0_u64)
11892 .body(common::to_body::<String>(None));
11893
11894 client.request(request.unwrap()).await
11895 };
11896
11897 match req_result {
11898 Err(err) => {
11899 if let common::Retry::After(d) = dlg.http_error(&err) {
11900 sleep(d).await;
11901 continue;
11902 }
11903 dlg.finished(false);
11904 return Err(common::Error::HttpError(err));
11905 }
11906 Ok(res) => {
11907 let (mut parts, body) = res.into_parts();
11908 let mut body = common::Body::new(body);
11909 if !parts.status.is_success() {
11910 let bytes = common::to_bytes(body).await.unwrap_or_default();
11911 let error = serde_json::from_str(&common::to_string(&bytes));
11912 let response = common::to_response(parts, bytes.into());
11913
11914 if let common::Retry::After(d) =
11915 dlg.http_failure(&response, error.as_ref().ok())
11916 {
11917 sleep(d).await;
11918 continue;
11919 }
11920
11921 dlg.finished(false);
11922
11923 return Err(match error {
11924 Ok(value) => common::Error::BadRequest(value),
11925 _ => common::Error::Failure(response),
11926 });
11927 }
11928 let response = {
11929 let bytes = common::to_bytes(body).await.unwrap_or_default();
11930 let encoded = common::to_string(&bytes);
11931 match serde_json::from_str(&encoded) {
11932 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11933 Err(error) => {
11934 dlg.response_json_decode_error(&encoded, &error);
11935 return Err(common::Error::JsonDecodeError(
11936 encoded.to_string(),
11937 error,
11938 ));
11939 }
11940 }
11941 };
11942
11943 dlg.finished(true);
11944 return Ok(response);
11945 }
11946 }
11947 }
11948 }
11949
11950 /// Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
11951 ///
11952 /// Sets the *name* path property to the given value.
11953 ///
11954 /// Even though the property as already been set when instantiating this call,
11955 /// we provide this method for API completeness.
11956 pub fn name(mut self, new_value: &str) -> ProjectSiteVersionGetCall<'a, C> {
11957 self._name = new_value.to_string();
11958 self
11959 }
11960 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11961 /// while executing the actual API request.
11962 ///
11963 /// ````text
11964 /// It should be used to handle progress information, and to implement a certain level of resilience.
11965 /// ````
11966 ///
11967 /// Sets the *delegate* property to the given value.
11968 pub fn delegate(
11969 mut self,
11970 new_value: &'a mut dyn common::Delegate,
11971 ) -> ProjectSiteVersionGetCall<'a, C> {
11972 self._delegate = Some(new_value);
11973 self
11974 }
11975
11976 /// Set any additional parameter of the query string used in the request.
11977 /// It should be used to set parameters which are not yet available through their own
11978 /// setters.
11979 ///
11980 /// Please note that this method must not be used to set any of the known parameters
11981 /// which have their own setter method. If done anyway, the request will fail.
11982 ///
11983 /// # Additional Parameters
11984 ///
11985 /// * *$.xgafv* (query-string) - V1 error format.
11986 /// * *access_token* (query-string) - OAuth access token.
11987 /// * *alt* (query-string) - Data format for response.
11988 /// * *callback* (query-string) - JSONP
11989 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11990 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11991 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11992 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11993 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11994 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11995 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11996 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionGetCall<'a, C>
11997 where
11998 T: AsRef<str>,
11999 {
12000 self._additional_params
12001 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12002 self
12003 }
12004
12005 /// Identifies the authorization scope for the method you are building.
12006 ///
12007 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12008 /// [`Scope::FirebaseReadonly`].
12009 ///
12010 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12011 /// tokens for more than one scope.
12012 ///
12013 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12014 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12015 /// sufficient, a read-write scope will do as well.
12016 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionGetCall<'a, C>
12017 where
12018 St: AsRef<str>,
12019 {
12020 self._scopes.insert(String::from(scope.as_ref()));
12021 self
12022 }
12023 /// Identifies the authorization scope(s) for the method you are building.
12024 ///
12025 /// See [`Self::add_scope()`] for details.
12026 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionGetCall<'a, C>
12027 where
12028 I: IntoIterator<Item = St>,
12029 St: AsRef<str>,
12030 {
12031 self._scopes
12032 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12033 self
12034 }
12035
12036 /// Removes all scopes, and no default scope will be used either.
12037 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12038 /// for details).
12039 pub fn clear_scopes(mut self) -> ProjectSiteVersionGetCall<'a, C> {
12040 self._scopes.clear();
12041 self
12042 }
12043}
12044
12045/// Lists the versions that have been created for the specified site. This list includes versions for both the default `live` channel and any active preview channels for the specified site.
12046///
12047/// A builder for the *sites.versions.list* method supported by a *project* resource.
12048/// It is not used directly, but through a [`ProjectMethods`] instance.
12049///
12050/// # Example
12051///
12052/// Instantiate a resource method builder
12053///
12054/// ```test_harness,no_run
12055/// # extern crate hyper;
12056/// # extern crate hyper_rustls;
12057/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
12058/// # async fn dox() {
12059/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12060///
12061/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12062/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12063/// # secret,
12064/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12065/// # ).build().await.unwrap();
12066///
12067/// # let client = hyper_util::client::legacy::Client::builder(
12068/// # hyper_util::rt::TokioExecutor::new()
12069/// # )
12070/// # .build(
12071/// # hyper_rustls::HttpsConnectorBuilder::new()
12072/// # .with_native_roots()
12073/// # .unwrap()
12074/// # .https_or_http()
12075/// # .enable_http1()
12076/// # .build()
12077/// # );
12078/// # let mut hub = FirebaseHosting::new(client, auth);
12079/// // You can configure optional parameters by calling the respective setters at will, and
12080/// // execute the final call using `doit()`.
12081/// // Values shown here are possibly random and not representative !
12082/// let result = hub.projects().sites_versions_list("parent")
12083/// .page_token("amet.")
12084/// .page_size(-30)
12085/// .filter("takimata")
12086/// .doit().await;
12087/// # }
12088/// ```
12089pub struct ProjectSiteVersionListCall<'a, C>
12090where
12091 C: 'a,
12092{
12093 hub: &'a FirebaseHosting<C>,
12094 _parent: String,
12095 _page_token: Option<String>,
12096 _page_size: Option<i32>,
12097 _filter: Option<String>,
12098 _delegate: Option<&'a mut dyn common::Delegate>,
12099 _additional_params: HashMap<String, String>,
12100 _scopes: BTreeSet<String>,
12101}
12102
12103impl<'a, C> common::CallBuilder for ProjectSiteVersionListCall<'a, C> {}
12104
12105impl<'a, C> ProjectSiteVersionListCall<'a, C>
12106where
12107 C: common::Connector,
12108{
12109 /// Perform the operation you have build so far.
12110 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionsResponse)> {
12111 use std::borrow::Cow;
12112 use std::io::{Read, Seek};
12113
12114 use common::{url::Params, ToParts};
12115 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12116
12117 let mut dd = common::DefaultDelegate;
12118 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12119 dlg.begin(common::MethodInfo {
12120 id: "firebasehosting.projects.sites.versions.list",
12121 http_method: hyper::Method::GET,
12122 });
12123
12124 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
12125 if self._additional_params.contains_key(field) {
12126 dlg.finished(false);
12127 return Err(common::Error::FieldClash(field));
12128 }
12129 }
12130
12131 let mut params = Params::with_capacity(6 + self._additional_params.len());
12132 params.push("parent", self._parent);
12133 if let Some(value) = self._page_token.as_ref() {
12134 params.push("pageToken", value);
12135 }
12136 if let Some(value) = self._page_size.as_ref() {
12137 params.push("pageSize", value.to_string());
12138 }
12139 if let Some(value) = self._filter.as_ref() {
12140 params.push("filter", value);
12141 }
12142
12143 params.extend(self._additional_params.iter());
12144
12145 params.push("alt", "json");
12146 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
12147 if self._scopes.is_empty() {
12148 self._scopes
12149 .insert(Scope::FirebaseReadonly.as_ref().to_string());
12150 }
12151
12152 #[allow(clippy::single_element_loop)]
12153 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12154 url = params.uri_replacement(url, param_name, find_this, true);
12155 }
12156 {
12157 let to_remove = ["parent"];
12158 params.remove_params(&to_remove);
12159 }
12160
12161 let url = params.parse_with_url(&url);
12162
12163 loop {
12164 let token = match self
12165 .hub
12166 .auth
12167 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12168 .await
12169 {
12170 Ok(token) => token,
12171 Err(e) => match dlg.token(e) {
12172 Ok(token) => token,
12173 Err(e) => {
12174 dlg.finished(false);
12175 return Err(common::Error::MissingToken(e));
12176 }
12177 },
12178 };
12179 let mut req_result = {
12180 let client = &self.hub.client;
12181 dlg.pre_request();
12182 let mut req_builder = hyper::Request::builder()
12183 .method(hyper::Method::GET)
12184 .uri(url.as_str())
12185 .header(USER_AGENT, self.hub._user_agent.clone());
12186
12187 if let Some(token) = token.as_ref() {
12188 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12189 }
12190
12191 let request = req_builder
12192 .header(CONTENT_LENGTH, 0_u64)
12193 .body(common::to_body::<String>(None));
12194
12195 client.request(request.unwrap()).await
12196 };
12197
12198 match req_result {
12199 Err(err) => {
12200 if let common::Retry::After(d) = dlg.http_error(&err) {
12201 sleep(d).await;
12202 continue;
12203 }
12204 dlg.finished(false);
12205 return Err(common::Error::HttpError(err));
12206 }
12207 Ok(res) => {
12208 let (mut parts, body) = res.into_parts();
12209 let mut body = common::Body::new(body);
12210 if !parts.status.is_success() {
12211 let bytes = common::to_bytes(body).await.unwrap_or_default();
12212 let error = serde_json::from_str(&common::to_string(&bytes));
12213 let response = common::to_response(parts, bytes.into());
12214
12215 if let common::Retry::After(d) =
12216 dlg.http_failure(&response, error.as_ref().ok())
12217 {
12218 sleep(d).await;
12219 continue;
12220 }
12221
12222 dlg.finished(false);
12223
12224 return Err(match error {
12225 Ok(value) => common::Error::BadRequest(value),
12226 _ => common::Error::Failure(response),
12227 });
12228 }
12229 let response = {
12230 let bytes = common::to_bytes(body).await.unwrap_or_default();
12231 let encoded = common::to_string(&bytes);
12232 match serde_json::from_str(&encoded) {
12233 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12234 Err(error) => {
12235 dlg.response_json_decode_error(&encoded, &error);
12236 return Err(common::Error::JsonDecodeError(
12237 encoded.to_string(),
12238 error,
12239 ));
12240 }
12241 }
12242 };
12243
12244 dlg.finished(true);
12245 return Ok(response);
12246 }
12247 }
12248 }
12249 }
12250
12251 /// Required. The site or channel for which to list versions, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
12252 ///
12253 /// Sets the *parent* path property to the given value.
12254 ///
12255 /// Even though the property as already been set when instantiating this call,
12256 /// we provide this method for API completeness.
12257 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionListCall<'a, C> {
12258 self._parent = new_value.to_string();
12259 self
12260 }
12261 /// A token from a previous call to `ListVersions` that tells the server where to resume listing.
12262 ///
12263 /// Sets the *page token* query property to the given value.
12264 pub fn page_token(mut self, new_value: &str) -> ProjectSiteVersionListCall<'a, C> {
12265 self._page_token = Some(new_value.to_string());
12266 self
12267 }
12268 /// The maximum number of versions to return. The service may return a lower number if fewer versions exist than this maximum number. If unspecified, defaults to 25. The maximum value is 100; values above 100 will be coerced to 100.
12269 ///
12270 /// Sets the *page size* query property to the given value.
12271 pub fn page_size(mut self, new_value: i32) -> ProjectSiteVersionListCall<'a, C> {
12272 self._page_size = Some(new_value);
12273 self
12274 }
12275 /// A filter string used to return a subset of versions in the response. The currently supported fields for filtering are: `name`, `status`, and `create_time`. Learn more about filtering in Google's [AIP 160 standard](https://google.aip.dev/160).
12276 ///
12277 /// Sets the *filter* query property to the given value.
12278 pub fn filter(mut self, new_value: &str) -> ProjectSiteVersionListCall<'a, C> {
12279 self._filter = Some(new_value.to_string());
12280 self
12281 }
12282 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12283 /// while executing the actual API request.
12284 ///
12285 /// ````text
12286 /// It should be used to handle progress information, and to implement a certain level of resilience.
12287 /// ````
12288 ///
12289 /// Sets the *delegate* property to the given value.
12290 pub fn delegate(
12291 mut self,
12292 new_value: &'a mut dyn common::Delegate,
12293 ) -> ProjectSiteVersionListCall<'a, C> {
12294 self._delegate = Some(new_value);
12295 self
12296 }
12297
12298 /// Set any additional parameter of the query string used in the request.
12299 /// It should be used to set parameters which are not yet available through their own
12300 /// setters.
12301 ///
12302 /// Please note that this method must not be used to set any of the known parameters
12303 /// which have their own setter method. If done anyway, the request will fail.
12304 ///
12305 /// # Additional Parameters
12306 ///
12307 /// * *$.xgafv* (query-string) - V1 error format.
12308 /// * *access_token* (query-string) - OAuth access token.
12309 /// * *alt* (query-string) - Data format for response.
12310 /// * *callback* (query-string) - JSONP
12311 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12312 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12313 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12314 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12315 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12316 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12317 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12318 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionListCall<'a, C>
12319 where
12320 T: AsRef<str>,
12321 {
12322 self._additional_params
12323 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12324 self
12325 }
12326
12327 /// Identifies the authorization scope for the method you are building.
12328 ///
12329 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12330 /// [`Scope::FirebaseReadonly`].
12331 ///
12332 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12333 /// tokens for more than one scope.
12334 ///
12335 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12336 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12337 /// sufficient, a read-write scope will do as well.
12338 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionListCall<'a, C>
12339 where
12340 St: AsRef<str>,
12341 {
12342 self._scopes.insert(String::from(scope.as_ref()));
12343 self
12344 }
12345 /// Identifies the authorization scope(s) for the method you are building.
12346 ///
12347 /// See [`Self::add_scope()`] for details.
12348 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionListCall<'a, C>
12349 where
12350 I: IntoIterator<Item = St>,
12351 St: AsRef<str>,
12352 {
12353 self._scopes
12354 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12355 self
12356 }
12357
12358 /// Removes all scopes, and no default scope will be used either.
12359 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12360 /// for details).
12361 pub fn clear_scopes(mut self) -> ProjectSiteVersionListCall<'a, C> {
12362 self._scopes.clear();
12363 self
12364 }
12365}
12366
12367/// Updates the specified metadata for the specified version. This method will fail with `FAILED_PRECONDITION` in the event of an invalid state transition. The supported [state](https://firebase.google.com/docs/hosting/../sites.versions#versionstatus) transitions for a version are from `CREATED` to `FINALIZED`. Use [`DeleteVersion`](delete) to set the status of a version to `DELETED`.
12368///
12369/// A builder for the *sites.versions.patch* method supported by a *project* resource.
12370/// It is not used directly, but through a [`ProjectMethods`] instance.
12371///
12372/// # Example
12373///
12374/// Instantiate a resource method builder
12375///
12376/// ```test_harness,no_run
12377/// # extern crate hyper;
12378/// # extern crate hyper_rustls;
12379/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
12380/// use firebasehosting1_beta1::api::Version;
12381/// # async fn dox() {
12382/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12383///
12384/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12385/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12386/// # secret,
12387/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12388/// # ).build().await.unwrap();
12389///
12390/// # let client = hyper_util::client::legacy::Client::builder(
12391/// # hyper_util::rt::TokioExecutor::new()
12392/// # )
12393/// # .build(
12394/// # hyper_rustls::HttpsConnectorBuilder::new()
12395/// # .with_native_roots()
12396/// # .unwrap()
12397/// # .https_or_http()
12398/// # .enable_http1()
12399/// # .build()
12400/// # );
12401/// # let mut hub = FirebaseHosting::new(client, auth);
12402/// // As the method needs a request, you would usually fill it with the desired information
12403/// // into the respective structure. Some of the parts shown here might not be applicable !
12404/// // Values shown here are possibly random and not representative !
12405/// let mut req = Version::default();
12406///
12407/// // You can configure optional parameters by calling the respective setters at will, and
12408/// // execute the final call using `doit()`.
12409/// // Values shown here are possibly random and not representative !
12410/// let result = hub.projects().sites_versions_patch(req, "name")
12411/// .update_mask(FieldMask::new::<&str>(&[]))
12412/// .doit().await;
12413/// # }
12414/// ```
12415pub struct ProjectSiteVersionPatchCall<'a, C>
12416where
12417 C: 'a,
12418{
12419 hub: &'a FirebaseHosting<C>,
12420 _request: Version,
12421 _name: String,
12422 _update_mask: Option<common::FieldMask>,
12423 _delegate: Option<&'a mut dyn common::Delegate>,
12424 _additional_params: HashMap<String, String>,
12425 _scopes: BTreeSet<String>,
12426}
12427
12428impl<'a, C> common::CallBuilder for ProjectSiteVersionPatchCall<'a, C> {}
12429
12430impl<'a, C> ProjectSiteVersionPatchCall<'a, C>
12431where
12432 C: common::Connector,
12433{
12434 /// Perform the operation you have build so far.
12435 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
12436 use std::borrow::Cow;
12437 use std::io::{Read, Seek};
12438
12439 use common::{url::Params, ToParts};
12440 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12441
12442 let mut dd = common::DefaultDelegate;
12443 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12444 dlg.begin(common::MethodInfo {
12445 id: "firebasehosting.projects.sites.versions.patch",
12446 http_method: hyper::Method::PATCH,
12447 });
12448
12449 for &field in ["alt", "name", "updateMask"].iter() {
12450 if self._additional_params.contains_key(field) {
12451 dlg.finished(false);
12452 return Err(common::Error::FieldClash(field));
12453 }
12454 }
12455
12456 let mut params = Params::with_capacity(5 + self._additional_params.len());
12457 params.push("name", self._name);
12458 if let Some(value) = self._update_mask.as_ref() {
12459 params.push("updateMask", value.to_string());
12460 }
12461
12462 params.extend(self._additional_params.iter());
12463
12464 params.push("alt", "json");
12465 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
12466 if self._scopes.is_empty() {
12467 self._scopes
12468 .insert(Scope::CloudPlatform.as_ref().to_string());
12469 }
12470
12471 #[allow(clippy::single_element_loop)]
12472 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12473 url = params.uri_replacement(url, param_name, find_this, true);
12474 }
12475 {
12476 let to_remove = ["name"];
12477 params.remove_params(&to_remove);
12478 }
12479
12480 let url = params.parse_with_url(&url);
12481
12482 let mut json_mime_type = mime::APPLICATION_JSON;
12483 let mut request_value_reader = {
12484 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12485 common::remove_json_null_values(&mut value);
12486 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12487 serde_json::to_writer(&mut dst, &value).unwrap();
12488 dst
12489 };
12490 let request_size = request_value_reader
12491 .seek(std::io::SeekFrom::End(0))
12492 .unwrap();
12493 request_value_reader
12494 .seek(std::io::SeekFrom::Start(0))
12495 .unwrap();
12496
12497 loop {
12498 let token = match self
12499 .hub
12500 .auth
12501 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12502 .await
12503 {
12504 Ok(token) => token,
12505 Err(e) => match dlg.token(e) {
12506 Ok(token) => token,
12507 Err(e) => {
12508 dlg.finished(false);
12509 return Err(common::Error::MissingToken(e));
12510 }
12511 },
12512 };
12513 request_value_reader
12514 .seek(std::io::SeekFrom::Start(0))
12515 .unwrap();
12516 let mut req_result = {
12517 let client = &self.hub.client;
12518 dlg.pre_request();
12519 let mut req_builder = hyper::Request::builder()
12520 .method(hyper::Method::PATCH)
12521 .uri(url.as_str())
12522 .header(USER_AGENT, self.hub._user_agent.clone());
12523
12524 if let Some(token) = token.as_ref() {
12525 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12526 }
12527
12528 let request = req_builder
12529 .header(CONTENT_TYPE, json_mime_type.to_string())
12530 .header(CONTENT_LENGTH, request_size as u64)
12531 .body(common::to_body(
12532 request_value_reader.get_ref().clone().into(),
12533 ));
12534
12535 client.request(request.unwrap()).await
12536 };
12537
12538 match req_result {
12539 Err(err) => {
12540 if let common::Retry::After(d) = dlg.http_error(&err) {
12541 sleep(d).await;
12542 continue;
12543 }
12544 dlg.finished(false);
12545 return Err(common::Error::HttpError(err));
12546 }
12547 Ok(res) => {
12548 let (mut parts, body) = res.into_parts();
12549 let mut body = common::Body::new(body);
12550 if !parts.status.is_success() {
12551 let bytes = common::to_bytes(body).await.unwrap_or_default();
12552 let error = serde_json::from_str(&common::to_string(&bytes));
12553 let response = common::to_response(parts, bytes.into());
12554
12555 if let common::Retry::After(d) =
12556 dlg.http_failure(&response, error.as_ref().ok())
12557 {
12558 sleep(d).await;
12559 continue;
12560 }
12561
12562 dlg.finished(false);
12563
12564 return Err(match error {
12565 Ok(value) => common::Error::BadRequest(value),
12566 _ => common::Error::Failure(response),
12567 });
12568 }
12569 let response = {
12570 let bytes = common::to_bytes(body).await.unwrap_or_default();
12571 let encoded = common::to_string(&bytes);
12572 match serde_json::from_str(&encoded) {
12573 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12574 Err(error) => {
12575 dlg.response_json_decode_error(&encoded, &error);
12576 return Err(common::Error::JsonDecodeError(
12577 encoded.to_string(),
12578 error,
12579 ));
12580 }
12581 }
12582 };
12583
12584 dlg.finished(true);
12585 return Ok(response);
12586 }
12587 }
12588 }
12589 }
12590
12591 ///
12592 /// Sets the *request* property to the given value.
12593 ///
12594 /// Even though the property as already been set when instantiating this call,
12595 /// we provide this method for API completeness.
12596 pub fn request(mut self, new_value: Version) -> ProjectSiteVersionPatchCall<'a, C> {
12597 self._request = new_value;
12598 self
12599 }
12600 /// The fully-qualified resource name for the version, in the format: sites/ SITE_ID/versions/VERSION_ID This name is provided in the response body when you call [`CreateVersion`](sites.versions/create).
12601 ///
12602 /// Sets the *name* path property to the given value.
12603 ///
12604 /// Even though the property as already been set when instantiating this call,
12605 /// we provide this method for API completeness.
12606 pub fn name(mut self, new_value: &str) -> ProjectSiteVersionPatchCall<'a, C> {
12607 self._name = new_value.to_string();
12608 self
12609 }
12610 /// A set of field names from your [version](https://firebase.google.com/docs/hosting/../sites.versions) that you want to update. A field will be overwritten if, and only if, it’s in the mask. If a mask is not provided then a default mask of only [`status`](https://firebase.google.com/docs/hosting/../sites.versions#Version.FIELDS.status) will be used.
12611 ///
12612 /// Sets the *update mask* query property to the given value.
12613 pub fn update_mask(
12614 mut self,
12615 new_value: common::FieldMask,
12616 ) -> ProjectSiteVersionPatchCall<'a, C> {
12617 self._update_mask = Some(new_value);
12618 self
12619 }
12620 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12621 /// while executing the actual API request.
12622 ///
12623 /// ````text
12624 /// It should be used to handle progress information, and to implement a certain level of resilience.
12625 /// ````
12626 ///
12627 /// Sets the *delegate* property to the given value.
12628 pub fn delegate(
12629 mut self,
12630 new_value: &'a mut dyn common::Delegate,
12631 ) -> ProjectSiteVersionPatchCall<'a, C> {
12632 self._delegate = Some(new_value);
12633 self
12634 }
12635
12636 /// Set any additional parameter of the query string used in the request.
12637 /// It should be used to set parameters which are not yet available through their own
12638 /// setters.
12639 ///
12640 /// Please note that this method must not be used to set any of the known parameters
12641 /// which have their own setter method. If done anyway, the request will fail.
12642 ///
12643 /// # Additional Parameters
12644 ///
12645 /// * *$.xgafv* (query-string) - V1 error format.
12646 /// * *access_token* (query-string) - OAuth access token.
12647 /// * *alt* (query-string) - Data format for response.
12648 /// * *callback* (query-string) - JSONP
12649 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12650 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12651 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12652 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12653 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12654 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12655 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12656 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionPatchCall<'a, C>
12657 where
12658 T: AsRef<str>,
12659 {
12660 self._additional_params
12661 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12662 self
12663 }
12664
12665 /// Identifies the authorization scope for the method you are building.
12666 ///
12667 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12668 /// [`Scope::CloudPlatform`].
12669 ///
12670 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12671 /// tokens for more than one scope.
12672 ///
12673 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12674 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12675 /// sufficient, a read-write scope will do as well.
12676 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionPatchCall<'a, C>
12677 where
12678 St: AsRef<str>,
12679 {
12680 self._scopes.insert(String::from(scope.as_ref()));
12681 self
12682 }
12683 /// Identifies the authorization scope(s) for the method you are building.
12684 ///
12685 /// See [`Self::add_scope()`] for details.
12686 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionPatchCall<'a, C>
12687 where
12688 I: IntoIterator<Item = St>,
12689 St: AsRef<str>,
12690 {
12691 self._scopes
12692 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12693 self
12694 }
12695
12696 /// Removes all scopes, and no default scope will be used either.
12697 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12698 /// for details).
12699 pub fn clear_scopes(mut self) -> ProjectSiteVersionPatchCall<'a, C> {
12700 self._scopes.clear();
12701 self
12702 }
12703}
12704
12705/// Adds content files to the specified version. Each file must be under 2 GB.
12706///
12707/// A builder for the *sites.versions.populateFiles* method supported by a *project* resource.
12708/// It is not used directly, but through a [`ProjectMethods`] instance.
12709///
12710/// # Example
12711///
12712/// Instantiate a resource method builder
12713///
12714/// ```test_harness,no_run
12715/// # extern crate hyper;
12716/// # extern crate hyper_rustls;
12717/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
12718/// use firebasehosting1_beta1::api::PopulateVersionFilesRequest;
12719/// # async fn dox() {
12720/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12721///
12722/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12723/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12724/// # secret,
12725/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12726/// # ).build().await.unwrap();
12727///
12728/// # let client = hyper_util::client::legacy::Client::builder(
12729/// # hyper_util::rt::TokioExecutor::new()
12730/// # )
12731/// # .build(
12732/// # hyper_rustls::HttpsConnectorBuilder::new()
12733/// # .with_native_roots()
12734/// # .unwrap()
12735/// # .https_or_http()
12736/// # .enable_http1()
12737/// # .build()
12738/// # );
12739/// # let mut hub = FirebaseHosting::new(client, auth);
12740/// // As the method needs a request, you would usually fill it with the desired information
12741/// // into the respective structure. Some of the parts shown here might not be applicable !
12742/// // Values shown here are possibly random and not representative !
12743/// let mut req = PopulateVersionFilesRequest::default();
12744///
12745/// // You can configure optional parameters by calling the respective setters at will, and
12746/// // execute the final call using `doit()`.
12747/// // Values shown here are possibly random and not representative !
12748/// let result = hub.projects().sites_versions_populate_files(req, "parent")
12749/// .doit().await;
12750/// # }
12751/// ```
12752pub struct ProjectSiteVersionPopulateFileCall<'a, C>
12753where
12754 C: 'a,
12755{
12756 hub: &'a FirebaseHosting<C>,
12757 _request: PopulateVersionFilesRequest,
12758 _parent: String,
12759 _delegate: Option<&'a mut dyn common::Delegate>,
12760 _additional_params: HashMap<String, String>,
12761 _scopes: BTreeSet<String>,
12762}
12763
12764impl<'a, C> common::CallBuilder for ProjectSiteVersionPopulateFileCall<'a, C> {}
12765
12766impl<'a, C> ProjectSiteVersionPopulateFileCall<'a, C>
12767where
12768 C: common::Connector,
12769{
12770 /// Perform the operation you have build so far.
12771 pub async fn doit(
12772 mut self,
12773 ) -> common::Result<(common::Response, PopulateVersionFilesResponse)> {
12774 use std::borrow::Cow;
12775 use std::io::{Read, Seek};
12776
12777 use common::{url::Params, ToParts};
12778 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12779
12780 let mut dd = common::DefaultDelegate;
12781 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12782 dlg.begin(common::MethodInfo {
12783 id: "firebasehosting.projects.sites.versions.populateFiles",
12784 http_method: hyper::Method::POST,
12785 });
12786
12787 for &field in ["alt", "parent"].iter() {
12788 if self._additional_params.contains_key(field) {
12789 dlg.finished(false);
12790 return Err(common::Error::FieldClash(field));
12791 }
12792 }
12793
12794 let mut params = Params::with_capacity(4 + self._additional_params.len());
12795 params.push("parent", self._parent);
12796
12797 params.extend(self._additional_params.iter());
12798
12799 params.push("alt", "json");
12800 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:populateFiles";
12801 if self._scopes.is_empty() {
12802 self._scopes
12803 .insert(Scope::CloudPlatform.as_ref().to_string());
12804 }
12805
12806 #[allow(clippy::single_element_loop)]
12807 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12808 url = params.uri_replacement(url, param_name, find_this, true);
12809 }
12810 {
12811 let to_remove = ["parent"];
12812 params.remove_params(&to_remove);
12813 }
12814
12815 let url = params.parse_with_url(&url);
12816
12817 let mut json_mime_type = mime::APPLICATION_JSON;
12818 let mut request_value_reader = {
12819 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12820 common::remove_json_null_values(&mut value);
12821 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12822 serde_json::to_writer(&mut dst, &value).unwrap();
12823 dst
12824 };
12825 let request_size = request_value_reader
12826 .seek(std::io::SeekFrom::End(0))
12827 .unwrap();
12828 request_value_reader
12829 .seek(std::io::SeekFrom::Start(0))
12830 .unwrap();
12831
12832 loop {
12833 let token = match self
12834 .hub
12835 .auth
12836 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12837 .await
12838 {
12839 Ok(token) => token,
12840 Err(e) => match dlg.token(e) {
12841 Ok(token) => token,
12842 Err(e) => {
12843 dlg.finished(false);
12844 return Err(common::Error::MissingToken(e));
12845 }
12846 },
12847 };
12848 request_value_reader
12849 .seek(std::io::SeekFrom::Start(0))
12850 .unwrap();
12851 let mut req_result = {
12852 let client = &self.hub.client;
12853 dlg.pre_request();
12854 let mut req_builder = hyper::Request::builder()
12855 .method(hyper::Method::POST)
12856 .uri(url.as_str())
12857 .header(USER_AGENT, self.hub._user_agent.clone());
12858
12859 if let Some(token) = token.as_ref() {
12860 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12861 }
12862
12863 let request = req_builder
12864 .header(CONTENT_TYPE, json_mime_type.to_string())
12865 .header(CONTENT_LENGTH, request_size as u64)
12866 .body(common::to_body(
12867 request_value_reader.get_ref().clone().into(),
12868 ));
12869
12870 client.request(request.unwrap()).await
12871 };
12872
12873 match req_result {
12874 Err(err) => {
12875 if let common::Retry::After(d) = dlg.http_error(&err) {
12876 sleep(d).await;
12877 continue;
12878 }
12879 dlg.finished(false);
12880 return Err(common::Error::HttpError(err));
12881 }
12882 Ok(res) => {
12883 let (mut parts, body) = res.into_parts();
12884 let mut body = common::Body::new(body);
12885 if !parts.status.is_success() {
12886 let bytes = common::to_bytes(body).await.unwrap_or_default();
12887 let error = serde_json::from_str(&common::to_string(&bytes));
12888 let response = common::to_response(parts, bytes.into());
12889
12890 if let common::Retry::After(d) =
12891 dlg.http_failure(&response, error.as_ref().ok())
12892 {
12893 sleep(d).await;
12894 continue;
12895 }
12896
12897 dlg.finished(false);
12898
12899 return Err(match error {
12900 Ok(value) => common::Error::BadRequest(value),
12901 _ => common::Error::Failure(response),
12902 });
12903 }
12904 let response = {
12905 let bytes = common::to_bytes(body).await.unwrap_or_default();
12906 let encoded = common::to_string(&bytes);
12907 match serde_json::from_str(&encoded) {
12908 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12909 Err(error) => {
12910 dlg.response_json_decode_error(&encoded, &error);
12911 return Err(common::Error::JsonDecodeError(
12912 encoded.to_string(),
12913 error,
12914 ));
12915 }
12916 }
12917 };
12918
12919 dlg.finished(true);
12920 return Ok(response);
12921 }
12922 }
12923 }
12924 }
12925
12926 ///
12927 /// Sets the *request* property to the given value.
12928 ///
12929 /// Even though the property as already been set when instantiating this call,
12930 /// we provide this method for API completeness.
12931 pub fn request(
12932 mut self,
12933 new_value: PopulateVersionFilesRequest,
12934 ) -> ProjectSiteVersionPopulateFileCall<'a, C> {
12935 self._request = new_value;
12936 self
12937 }
12938 /// Required. The version to which to add files, in the format: sites/SITE_ID /versions/VERSION_ID
12939 ///
12940 /// Sets the *parent* path property to the given value.
12941 ///
12942 /// Even though the property as already been set when instantiating this call,
12943 /// we provide this method for API completeness.
12944 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionPopulateFileCall<'a, C> {
12945 self._parent = new_value.to_string();
12946 self
12947 }
12948 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12949 /// while executing the actual API request.
12950 ///
12951 /// ````text
12952 /// It should be used to handle progress information, and to implement a certain level of resilience.
12953 /// ````
12954 ///
12955 /// Sets the *delegate* property to the given value.
12956 pub fn delegate(
12957 mut self,
12958 new_value: &'a mut dyn common::Delegate,
12959 ) -> ProjectSiteVersionPopulateFileCall<'a, C> {
12960 self._delegate = Some(new_value);
12961 self
12962 }
12963
12964 /// Set any additional parameter of the query string used in the request.
12965 /// It should be used to set parameters which are not yet available through their own
12966 /// setters.
12967 ///
12968 /// Please note that this method must not be used to set any of the known parameters
12969 /// which have their own setter method. If done anyway, the request will fail.
12970 ///
12971 /// # Additional Parameters
12972 ///
12973 /// * *$.xgafv* (query-string) - V1 error format.
12974 /// * *access_token* (query-string) - OAuth access token.
12975 /// * *alt* (query-string) - Data format for response.
12976 /// * *callback* (query-string) - JSONP
12977 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12978 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12979 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12980 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12981 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12982 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12983 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12984 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionPopulateFileCall<'a, C>
12985 where
12986 T: AsRef<str>,
12987 {
12988 self._additional_params
12989 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12990 self
12991 }
12992
12993 /// Identifies the authorization scope for the method you are building.
12994 ///
12995 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12996 /// [`Scope::CloudPlatform`].
12997 ///
12998 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12999 /// tokens for more than one scope.
13000 ///
13001 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13002 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13003 /// sufficient, a read-write scope will do as well.
13004 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionPopulateFileCall<'a, C>
13005 where
13006 St: AsRef<str>,
13007 {
13008 self._scopes.insert(String::from(scope.as_ref()));
13009 self
13010 }
13011 /// Identifies the authorization scope(s) for the method you are building.
13012 ///
13013 /// See [`Self::add_scope()`] for details.
13014 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionPopulateFileCall<'a, C>
13015 where
13016 I: IntoIterator<Item = St>,
13017 St: AsRef<str>,
13018 {
13019 self._scopes
13020 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13021 self
13022 }
13023
13024 /// Removes all scopes, and no default scope will be used either.
13025 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13026 /// for details).
13027 pub fn clear_scopes(mut self) -> ProjectSiteVersionPopulateFileCall<'a, C> {
13028 self._scopes.clear();
13029 self
13030 }
13031}
13032
13033/// Creates a new Hosting Site in the specified parent Firebase project. Note that Hosting sites can take several minutes to propagate through Firebase systems.
13034///
13035/// A builder for the *sites.create* method supported by a *project* resource.
13036/// It is not used directly, but through a [`ProjectMethods`] instance.
13037///
13038/// # Example
13039///
13040/// Instantiate a resource method builder
13041///
13042/// ```test_harness,no_run
13043/// # extern crate hyper;
13044/// # extern crate hyper_rustls;
13045/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
13046/// use firebasehosting1_beta1::api::Site;
13047/// # async fn dox() {
13048/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13049///
13050/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13051/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13052/// # secret,
13053/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13054/// # ).build().await.unwrap();
13055///
13056/// # let client = hyper_util::client::legacy::Client::builder(
13057/// # hyper_util::rt::TokioExecutor::new()
13058/// # )
13059/// # .build(
13060/// # hyper_rustls::HttpsConnectorBuilder::new()
13061/// # .with_native_roots()
13062/// # .unwrap()
13063/// # .https_or_http()
13064/// # .enable_http1()
13065/// # .build()
13066/// # );
13067/// # let mut hub = FirebaseHosting::new(client, auth);
13068/// // As the method needs a request, you would usually fill it with the desired information
13069/// // into the respective structure. Some of the parts shown here might not be applicable !
13070/// // Values shown here are possibly random and not representative !
13071/// let mut req = Site::default();
13072///
13073/// // You can configure optional parameters by calling the respective setters at will, and
13074/// // execute the final call using `doit()`.
13075/// // Values shown here are possibly random and not representative !
13076/// let result = hub.projects().sites_create(req, "parent")
13077/// .validate_only(false)
13078/// .site_id("dolore")
13079/// .doit().await;
13080/// # }
13081/// ```
13082pub struct ProjectSiteCreateCall<'a, C>
13083where
13084 C: 'a,
13085{
13086 hub: &'a FirebaseHosting<C>,
13087 _request: Site,
13088 _parent: String,
13089 _validate_only: Option<bool>,
13090 _site_id: Option<String>,
13091 _delegate: Option<&'a mut dyn common::Delegate>,
13092 _additional_params: HashMap<String, String>,
13093 _scopes: BTreeSet<String>,
13094}
13095
13096impl<'a, C> common::CallBuilder for ProjectSiteCreateCall<'a, C> {}
13097
13098impl<'a, C> ProjectSiteCreateCall<'a, C>
13099where
13100 C: common::Connector,
13101{
13102 /// Perform the operation you have build so far.
13103 pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
13104 use std::borrow::Cow;
13105 use std::io::{Read, Seek};
13106
13107 use common::{url::Params, ToParts};
13108 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13109
13110 let mut dd = common::DefaultDelegate;
13111 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13112 dlg.begin(common::MethodInfo {
13113 id: "firebasehosting.projects.sites.create",
13114 http_method: hyper::Method::POST,
13115 });
13116
13117 for &field in ["alt", "parent", "validateOnly", "siteId"].iter() {
13118 if self._additional_params.contains_key(field) {
13119 dlg.finished(false);
13120 return Err(common::Error::FieldClash(field));
13121 }
13122 }
13123
13124 let mut params = Params::with_capacity(6 + self._additional_params.len());
13125 params.push("parent", self._parent);
13126 if let Some(value) = self._validate_only.as_ref() {
13127 params.push("validateOnly", value.to_string());
13128 }
13129 if let Some(value) = self._site_id.as_ref() {
13130 params.push("siteId", value);
13131 }
13132
13133 params.extend(self._additional_params.iter());
13134
13135 params.push("alt", "json");
13136 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/sites";
13137 if self._scopes.is_empty() {
13138 self._scopes
13139 .insert(Scope::CloudPlatform.as_ref().to_string());
13140 }
13141
13142 #[allow(clippy::single_element_loop)]
13143 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13144 url = params.uri_replacement(url, param_name, find_this, true);
13145 }
13146 {
13147 let to_remove = ["parent"];
13148 params.remove_params(&to_remove);
13149 }
13150
13151 let url = params.parse_with_url(&url);
13152
13153 let mut json_mime_type = mime::APPLICATION_JSON;
13154 let mut request_value_reader = {
13155 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13156 common::remove_json_null_values(&mut value);
13157 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13158 serde_json::to_writer(&mut dst, &value).unwrap();
13159 dst
13160 };
13161 let request_size = request_value_reader
13162 .seek(std::io::SeekFrom::End(0))
13163 .unwrap();
13164 request_value_reader
13165 .seek(std::io::SeekFrom::Start(0))
13166 .unwrap();
13167
13168 loop {
13169 let token = match self
13170 .hub
13171 .auth
13172 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13173 .await
13174 {
13175 Ok(token) => token,
13176 Err(e) => match dlg.token(e) {
13177 Ok(token) => token,
13178 Err(e) => {
13179 dlg.finished(false);
13180 return Err(common::Error::MissingToken(e));
13181 }
13182 },
13183 };
13184 request_value_reader
13185 .seek(std::io::SeekFrom::Start(0))
13186 .unwrap();
13187 let mut req_result = {
13188 let client = &self.hub.client;
13189 dlg.pre_request();
13190 let mut req_builder = hyper::Request::builder()
13191 .method(hyper::Method::POST)
13192 .uri(url.as_str())
13193 .header(USER_AGENT, self.hub._user_agent.clone());
13194
13195 if let Some(token) = token.as_ref() {
13196 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13197 }
13198
13199 let request = req_builder
13200 .header(CONTENT_TYPE, json_mime_type.to_string())
13201 .header(CONTENT_LENGTH, request_size as u64)
13202 .body(common::to_body(
13203 request_value_reader.get_ref().clone().into(),
13204 ));
13205
13206 client.request(request.unwrap()).await
13207 };
13208
13209 match req_result {
13210 Err(err) => {
13211 if let common::Retry::After(d) = dlg.http_error(&err) {
13212 sleep(d).await;
13213 continue;
13214 }
13215 dlg.finished(false);
13216 return Err(common::Error::HttpError(err));
13217 }
13218 Ok(res) => {
13219 let (mut parts, body) = res.into_parts();
13220 let mut body = common::Body::new(body);
13221 if !parts.status.is_success() {
13222 let bytes = common::to_bytes(body).await.unwrap_or_default();
13223 let error = serde_json::from_str(&common::to_string(&bytes));
13224 let response = common::to_response(parts, bytes.into());
13225
13226 if let common::Retry::After(d) =
13227 dlg.http_failure(&response, error.as_ref().ok())
13228 {
13229 sleep(d).await;
13230 continue;
13231 }
13232
13233 dlg.finished(false);
13234
13235 return Err(match error {
13236 Ok(value) => common::Error::BadRequest(value),
13237 _ => common::Error::Failure(response),
13238 });
13239 }
13240 let response = {
13241 let bytes = common::to_bytes(body).await.unwrap_or_default();
13242 let encoded = common::to_string(&bytes);
13243 match serde_json::from_str(&encoded) {
13244 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13245 Err(error) => {
13246 dlg.response_json_decode_error(&encoded, &error);
13247 return Err(common::Error::JsonDecodeError(
13248 encoded.to_string(),
13249 error,
13250 ));
13251 }
13252 }
13253 };
13254
13255 dlg.finished(true);
13256 return Ok(response);
13257 }
13258 }
13259 }
13260 }
13261
13262 ///
13263 /// Sets the *request* property to the given value.
13264 ///
13265 /// Even though the property as already been set when instantiating this call,
13266 /// we provide this method for API completeness.
13267 pub fn request(mut self, new_value: Site) -> ProjectSiteCreateCall<'a, C> {
13268 self._request = new_value;
13269 self
13270 }
13271 /// Required. The Firebase project in which to create a Hosting site, in the format: projects/PROJECT_IDENTIFIER Refer to the `Site` [`name`](https://firebase.google.com/docs/hosting/../projects#Site.FIELDS.name) field for details about PROJECT_IDENTIFIER values.
13272 ///
13273 /// Sets the *parent* path property to the given value.
13274 ///
13275 /// Even though the property as already been set when instantiating this call,
13276 /// we provide this method for API completeness.
13277 pub fn parent(mut self, new_value: &str) -> ProjectSiteCreateCall<'a, C> {
13278 self._parent = new_value.to_string();
13279 self
13280 }
13281 /// Optional. If set, validates that the site_id is available and that the request would succeed, returning the expected resulting site or error.
13282 ///
13283 /// Sets the *validate only* query property to the given value.
13284 pub fn validate_only(mut self, new_value: bool) -> ProjectSiteCreateCall<'a, C> {
13285 self._validate_only = Some(new_value);
13286 self
13287 }
13288 /// Required. Immutable. A globally unique identifier for the Hosting site. This identifier is used to construct the Firebase-provisioned subdomains for the site, so it must also be a valid domain name label.
13289 ///
13290 /// Sets the *site id* query property to the given value.
13291 pub fn site_id(mut self, new_value: &str) -> ProjectSiteCreateCall<'a, C> {
13292 self._site_id = Some(new_value.to_string());
13293 self
13294 }
13295 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13296 /// while executing the actual API request.
13297 ///
13298 /// ````text
13299 /// It should be used to handle progress information, and to implement a certain level of resilience.
13300 /// ````
13301 ///
13302 /// Sets the *delegate* property to the given value.
13303 pub fn delegate(
13304 mut self,
13305 new_value: &'a mut dyn common::Delegate,
13306 ) -> ProjectSiteCreateCall<'a, C> {
13307 self._delegate = Some(new_value);
13308 self
13309 }
13310
13311 /// Set any additional parameter of the query string used in the request.
13312 /// It should be used to set parameters which are not yet available through their own
13313 /// setters.
13314 ///
13315 /// Please note that this method must not be used to set any of the known parameters
13316 /// which have their own setter method. If done anyway, the request will fail.
13317 ///
13318 /// # Additional Parameters
13319 ///
13320 /// * *$.xgafv* (query-string) - V1 error format.
13321 /// * *access_token* (query-string) - OAuth access token.
13322 /// * *alt* (query-string) - Data format for response.
13323 /// * *callback* (query-string) - JSONP
13324 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13325 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13326 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13327 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13328 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13329 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13330 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13331 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCreateCall<'a, C>
13332 where
13333 T: AsRef<str>,
13334 {
13335 self._additional_params
13336 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13337 self
13338 }
13339
13340 /// Identifies the authorization scope for the method you are building.
13341 ///
13342 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13343 /// [`Scope::CloudPlatform`].
13344 ///
13345 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13346 /// tokens for more than one scope.
13347 ///
13348 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13349 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13350 /// sufficient, a read-write scope will do as well.
13351 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCreateCall<'a, C>
13352 where
13353 St: AsRef<str>,
13354 {
13355 self._scopes.insert(String::from(scope.as_ref()));
13356 self
13357 }
13358 /// Identifies the authorization scope(s) for the method you are building.
13359 ///
13360 /// See [`Self::add_scope()`] for details.
13361 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCreateCall<'a, C>
13362 where
13363 I: IntoIterator<Item = St>,
13364 St: AsRef<str>,
13365 {
13366 self._scopes
13367 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13368 self
13369 }
13370
13371 /// Removes all scopes, and no default scope will be used either.
13372 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13373 /// for details).
13374 pub fn clear_scopes(mut self) -> ProjectSiteCreateCall<'a, C> {
13375 self._scopes.clear();
13376 self
13377 }
13378}
13379
13380/// Deletes the specified Hosting Site from the specified parent Firebase project.
13381///
13382/// A builder for the *sites.delete* method supported by a *project* resource.
13383/// It is not used directly, but through a [`ProjectMethods`] instance.
13384///
13385/// # Example
13386///
13387/// Instantiate a resource method builder
13388///
13389/// ```test_harness,no_run
13390/// # extern crate hyper;
13391/// # extern crate hyper_rustls;
13392/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
13393/// # async fn dox() {
13394/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13395///
13396/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13397/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13398/// # secret,
13399/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13400/// # ).build().await.unwrap();
13401///
13402/// # let client = hyper_util::client::legacy::Client::builder(
13403/// # hyper_util::rt::TokioExecutor::new()
13404/// # )
13405/// # .build(
13406/// # hyper_rustls::HttpsConnectorBuilder::new()
13407/// # .with_native_roots()
13408/// # .unwrap()
13409/// # .https_or_http()
13410/// # .enable_http1()
13411/// # .build()
13412/// # );
13413/// # let mut hub = FirebaseHosting::new(client, auth);
13414/// // You can configure optional parameters by calling the respective setters at will, and
13415/// // execute the final call using `doit()`.
13416/// // Values shown here are possibly random and not representative !
13417/// let result = hub.projects().sites_delete("name")
13418/// .doit().await;
13419/// # }
13420/// ```
13421pub struct ProjectSiteDeleteCall<'a, C>
13422where
13423 C: 'a,
13424{
13425 hub: &'a FirebaseHosting<C>,
13426 _name: String,
13427 _delegate: Option<&'a mut dyn common::Delegate>,
13428 _additional_params: HashMap<String, String>,
13429 _scopes: BTreeSet<String>,
13430}
13431
13432impl<'a, C> common::CallBuilder for ProjectSiteDeleteCall<'a, C> {}
13433
13434impl<'a, C> ProjectSiteDeleteCall<'a, C>
13435where
13436 C: common::Connector,
13437{
13438 /// Perform the operation you have build so far.
13439 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
13440 use std::borrow::Cow;
13441 use std::io::{Read, Seek};
13442
13443 use common::{url::Params, ToParts};
13444 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13445
13446 let mut dd = common::DefaultDelegate;
13447 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13448 dlg.begin(common::MethodInfo {
13449 id: "firebasehosting.projects.sites.delete",
13450 http_method: hyper::Method::DELETE,
13451 });
13452
13453 for &field in ["alt", "name"].iter() {
13454 if self._additional_params.contains_key(field) {
13455 dlg.finished(false);
13456 return Err(common::Error::FieldClash(field));
13457 }
13458 }
13459
13460 let mut params = Params::with_capacity(3 + self._additional_params.len());
13461 params.push("name", self._name);
13462
13463 params.extend(self._additional_params.iter());
13464
13465 params.push("alt", "json");
13466 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
13467 if self._scopes.is_empty() {
13468 self._scopes
13469 .insert(Scope::CloudPlatform.as_ref().to_string());
13470 }
13471
13472 #[allow(clippy::single_element_loop)]
13473 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13474 url = params.uri_replacement(url, param_name, find_this, true);
13475 }
13476 {
13477 let to_remove = ["name"];
13478 params.remove_params(&to_remove);
13479 }
13480
13481 let url = params.parse_with_url(&url);
13482
13483 loop {
13484 let token = match self
13485 .hub
13486 .auth
13487 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13488 .await
13489 {
13490 Ok(token) => token,
13491 Err(e) => match dlg.token(e) {
13492 Ok(token) => token,
13493 Err(e) => {
13494 dlg.finished(false);
13495 return Err(common::Error::MissingToken(e));
13496 }
13497 },
13498 };
13499 let mut req_result = {
13500 let client = &self.hub.client;
13501 dlg.pre_request();
13502 let mut req_builder = hyper::Request::builder()
13503 .method(hyper::Method::DELETE)
13504 .uri(url.as_str())
13505 .header(USER_AGENT, self.hub._user_agent.clone());
13506
13507 if let Some(token) = token.as_ref() {
13508 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13509 }
13510
13511 let request = req_builder
13512 .header(CONTENT_LENGTH, 0_u64)
13513 .body(common::to_body::<String>(None));
13514
13515 client.request(request.unwrap()).await
13516 };
13517
13518 match req_result {
13519 Err(err) => {
13520 if let common::Retry::After(d) = dlg.http_error(&err) {
13521 sleep(d).await;
13522 continue;
13523 }
13524 dlg.finished(false);
13525 return Err(common::Error::HttpError(err));
13526 }
13527 Ok(res) => {
13528 let (mut parts, body) = res.into_parts();
13529 let mut body = common::Body::new(body);
13530 if !parts.status.is_success() {
13531 let bytes = common::to_bytes(body).await.unwrap_or_default();
13532 let error = serde_json::from_str(&common::to_string(&bytes));
13533 let response = common::to_response(parts, bytes.into());
13534
13535 if let common::Retry::After(d) =
13536 dlg.http_failure(&response, error.as_ref().ok())
13537 {
13538 sleep(d).await;
13539 continue;
13540 }
13541
13542 dlg.finished(false);
13543
13544 return Err(match error {
13545 Ok(value) => common::Error::BadRequest(value),
13546 _ => common::Error::Failure(response),
13547 });
13548 }
13549 let response = {
13550 let bytes = common::to_bytes(body).await.unwrap_or_default();
13551 let encoded = common::to_string(&bytes);
13552 match serde_json::from_str(&encoded) {
13553 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13554 Err(error) => {
13555 dlg.response_json_decode_error(&encoded, &error);
13556 return Err(common::Error::JsonDecodeError(
13557 encoded.to_string(),
13558 error,
13559 ));
13560 }
13561 }
13562 };
13563
13564 dlg.finished(true);
13565 return Ok(response);
13566 }
13567 }
13568 }
13569 }
13570
13571 /// Required. The fully-qualified resource name for the Hosting site, in the format: projects/PROJECT_IDENTIFIER/sites/SITE_ID Refer to the `Site` [`name`](https://firebase.google.com/docs/hosting/../projects#Site.FIELDS.name) field for details about PROJECT_IDENTIFIER values.
13572 ///
13573 /// Sets the *name* path property to the given value.
13574 ///
13575 /// Even though the property as already been set when instantiating this call,
13576 /// we provide this method for API completeness.
13577 pub fn name(mut self, new_value: &str) -> ProjectSiteDeleteCall<'a, C> {
13578 self._name = new_value.to_string();
13579 self
13580 }
13581 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13582 /// while executing the actual API request.
13583 ///
13584 /// ````text
13585 /// It should be used to handle progress information, and to implement a certain level of resilience.
13586 /// ````
13587 ///
13588 /// Sets the *delegate* property to the given value.
13589 pub fn delegate(
13590 mut self,
13591 new_value: &'a mut dyn common::Delegate,
13592 ) -> ProjectSiteDeleteCall<'a, C> {
13593 self._delegate = Some(new_value);
13594 self
13595 }
13596
13597 /// Set any additional parameter of the query string used in the request.
13598 /// It should be used to set parameters which are not yet available through their own
13599 /// setters.
13600 ///
13601 /// Please note that this method must not be used to set any of the known parameters
13602 /// which have their own setter method. If done anyway, the request will fail.
13603 ///
13604 /// # Additional Parameters
13605 ///
13606 /// * *$.xgafv* (query-string) - V1 error format.
13607 /// * *access_token* (query-string) - OAuth access token.
13608 /// * *alt* (query-string) - Data format for response.
13609 /// * *callback* (query-string) - JSONP
13610 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13611 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13612 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13613 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13614 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13615 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13616 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13617 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDeleteCall<'a, C>
13618 where
13619 T: AsRef<str>,
13620 {
13621 self._additional_params
13622 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13623 self
13624 }
13625
13626 /// Identifies the authorization scope for the method you are building.
13627 ///
13628 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13629 /// [`Scope::CloudPlatform`].
13630 ///
13631 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13632 /// tokens for more than one scope.
13633 ///
13634 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13635 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13636 /// sufficient, a read-write scope will do as well.
13637 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDeleteCall<'a, C>
13638 where
13639 St: AsRef<str>,
13640 {
13641 self._scopes.insert(String::from(scope.as_ref()));
13642 self
13643 }
13644 /// Identifies the authorization scope(s) for the method you are building.
13645 ///
13646 /// See [`Self::add_scope()`] for details.
13647 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDeleteCall<'a, C>
13648 where
13649 I: IntoIterator<Item = St>,
13650 St: AsRef<str>,
13651 {
13652 self._scopes
13653 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13654 self
13655 }
13656
13657 /// Removes all scopes, and no default scope will be used either.
13658 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13659 /// for details).
13660 pub fn clear_scopes(mut self) -> ProjectSiteDeleteCall<'a, C> {
13661 self._scopes.clear();
13662 self
13663 }
13664}
13665
13666/// Gets the specified Hosting Site.
13667///
13668/// A builder for the *sites.get* method supported by a *project* resource.
13669/// It is not used directly, but through a [`ProjectMethods`] instance.
13670///
13671/// # Example
13672///
13673/// Instantiate a resource method builder
13674///
13675/// ```test_harness,no_run
13676/// # extern crate hyper;
13677/// # extern crate hyper_rustls;
13678/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
13679/// # async fn dox() {
13680/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13681///
13682/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13683/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13684/// # secret,
13685/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13686/// # ).build().await.unwrap();
13687///
13688/// # let client = hyper_util::client::legacy::Client::builder(
13689/// # hyper_util::rt::TokioExecutor::new()
13690/// # )
13691/// # .build(
13692/// # hyper_rustls::HttpsConnectorBuilder::new()
13693/// # .with_native_roots()
13694/// # .unwrap()
13695/// # .https_or_http()
13696/// # .enable_http1()
13697/// # .build()
13698/// # );
13699/// # let mut hub = FirebaseHosting::new(client, auth);
13700/// // You can configure optional parameters by calling the respective setters at will, and
13701/// // execute the final call using `doit()`.
13702/// // Values shown here are possibly random and not representative !
13703/// let result = hub.projects().sites_get("name")
13704/// .doit().await;
13705/// # }
13706/// ```
13707pub struct ProjectSiteGetCall<'a, C>
13708where
13709 C: 'a,
13710{
13711 hub: &'a FirebaseHosting<C>,
13712 _name: String,
13713 _delegate: Option<&'a mut dyn common::Delegate>,
13714 _additional_params: HashMap<String, String>,
13715 _scopes: BTreeSet<String>,
13716}
13717
13718impl<'a, C> common::CallBuilder for ProjectSiteGetCall<'a, C> {}
13719
13720impl<'a, C> ProjectSiteGetCall<'a, C>
13721where
13722 C: common::Connector,
13723{
13724 /// Perform the operation you have build so far.
13725 pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
13726 use std::borrow::Cow;
13727 use std::io::{Read, Seek};
13728
13729 use common::{url::Params, ToParts};
13730 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13731
13732 let mut dd = common::DefaultDelegate;
13733 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13734 dlg.begin(common::MethodInfo {
13735 id: "firebasehosting.projects.sites.get",
13736 http_method: hyper::Method::GET,
13737 });
13738
13739 for &field in ["alt", "name"].iter() {
13740 if self._additional_params.contains_key(field) {
13741 dlg.finished(false);
13742 return Err(common::Error::FieldClash(field));
13743 }
13744 }
13745
13746 let mut params = Params::with_capacity(3 + self._additional_params.len());
13747 params.push("name", self._name);
13748
13749 params.extend(self._additional_params.iter());
13750
13751 params.push("alt", "json");
13752 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
13753 if self._scopes.is_empty() {
13754 self._scopes
13755 .insert(Scope::FirebaseReadonly.as_ref().to_string());
13756 }
13757
13758 #[allow(clippy::single_element_loop)]
13759 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13760 url = params.uri_replacement(url, param_name, find_this, true);
13761 }
13762 {
13763 let to_remove = ["name"];
13764 params.remove_params(&to_remove);
13765 }
13766
13767 let url = params.parse_with_url(&url);
13768
13769 loop {
13770 let token = match self
13771 .hub
13772 .auth
13773 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13774 .await
13775 {
13776 Ok(token) => token,
13777 Err(e) => match dlg.token(e) {
13778 Ok(token) => token,
13779 Err(e) => {
13780 dlg.finished(false);
13781 return Err(common::Error::MissingToken(e));
13782 }
13783 },
13784 };
13785 let mut req_result = {
13786 let client = &self.hub.client;
13787 dlg.pre_request();
13788 let mut req_builder = hyper::Request::builder()
13789 .method(hyper::Method::GET)
13790 .uri(url.as_str())
13791 .header(USER_AGENT, self.hub._user_agent.clone());
13792
13793 if let Some(token) = token.as_ref() {
13794 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13795 }
13796
13797 let request = req_builder
13798 .header(CONTENT_LENGTH, 0_u64)
13799 .body(common::to_body::<String>(None));
13800
13801 client.request(request.unwrap()).await
13802 };
13803
13804 match req_result {
13805 Err(err) => {
13806 if let common::Retry::After(d) = dlg.http_error(&err) {
13807 sleep(d).await;
13808 continue;
13809 }
13810 dlg.finished(false);
13811 return Err(common::Error::HttpError(err));
13812 }
13813 Ok(res) => {
13814 let (mut parts, body) = res.into_parts();
13815 let mut body = common::Body::new(body);
13816 if !parts.status.is_success() {
13817 let bytes = common::to_bytes(body).await.unwrap_or_default();
13818 let error = serde_json::from_str(&common::to_string(&bytes));
13819 let response = common::to_response(parts, bytes.into());
13820
13821 if let common::Retry::After(d) =
13822 dlg.http_failure(&response, error.as_ref().ok())
13823 {
13824 sleep(d).await;
13825 continue;
13826 }
13827
13828 dlg.finished(false);
13829
13830 return Err(match error {
13831 Ok(value) => common::Error::BadRequest(value),
13832 _ => common::Error::Failure(response),
13833 });
13834 }
13835 let response = {
13836 let bytes = common::to_bytes(body).await.unwrap_or_default();
13837 let encoded = common::to_string(&bytes);
13838 match serde_json::from_str(&encoded) {
13839 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13840 Err(error) => {
13841 dlg.response_json_decode_error(&encoded, &error);
13842 return Err(common::Error::JsonDecodeError(
13843 encoded.to_string(),
13844 error,
13845 ));
13846 }
13847 }
13848 };
13849
13850 dlg.finished(true);
13851 return Ok(response);
13852 }
13853 }
13854 }
13855 }
13856
13857 /// Required. The fully-qualified resource name for the Hosting site, in the format: projects/PROJECT_IDENTIFIER/sites/SITE_ID Refer to the `Site` [`name`](https://firebase.google.com/docs/hosting/../projects#Site.FIELDS.name) field for details about PROJECT_IDENTIFIER values. Since a SITE_ID is a globally unique identifier, you can also use the unique sub-collection resource access pattern, in the format: projects/-/sites/SITE_ID
13858 ///
13859 /// Sets the *name* path property to the given value.
13860 ///
13861 /// Even though the property as already been set when instantiating this call,
13862 /// we provide this method for API completeness.
13863 pub fn name(mut self, new_value: &str) -> ProjectSiteGetCall<'a, C> {
13864 self._name = new_value.to_string();
13865 self
13866 }
13867 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13868 /// while executing the actual API request.
13869 ///
13870 /// ````text
13871 /// It should be used to handle progress information, and to implement a certain level of resilience.
13872 /// ````
13873 ///
13874 /// Sets the *delegate* property to the given value.
13875 pub fn delegate(
13876 mut self,
13877 new_value: &'a mut dyn common::Delegate,
13878 ) -> ProjectSiteGetCall<'a, C> {
13879 self._delegate = Some(new_value);
13880 self
13881 }
13882
13883 /// Set any additional parameter of the query string used in the request.
13884 /// It should be used to set parameters which are not yet available through their own
13885 /// setters.
13886 ///
13887 /// Please note that this method must not be used to set any of the known parameters
13888 /// which have their own setter method. If done anyway, the request will fail.
13889 ///
13890 /// # Additional Parameters
13891 ///
13892 /// * *$.xgafv* (query-string) - V1 error format.
13893 /// * *access_token* (query-string) - OAuth access token.
13894 /// * *alt* (query-string) - Data format for response.
13895 /// * *callback* (query-string) - JSONP
13896 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13897 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13898 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13899 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13900 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13901 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13902 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13903 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteGetCall<'a, C>
13904 where
13905 T: AsRef<str>,
13906 {
13907 self._additional_params
13908 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13909 self
13910 }
13911
13912 /// Identifies the authorization scope for the method you are building.
13913 ///
13914 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13915 /// [`Scope::FirebaseReadonly`].
13916 ///
13917 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13918 /// tokens for more than one scope.
13919 ///
13920 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13921 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13922 /// sufficient, a read-write scope will do as well.
13923 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteGetCall<'a, C>
13924 where
13925 St: AsRef<str>,
13926 {
13927 self._scopes.insert(String::from(scope.as_ref()));
13928 self
13929 }
13930 /// Identifies the authorization scope(s) for the method you are building.
13931 ///
13932 /// See [`Self::add_scope()`] for details.
13933 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteGetCall<'a, C>
13934 where
13935 I: IntoIterator<Item = St>,
13936 St: AsRef<str>,
13937 {
13938 self._scopes
13939 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13940 self
13941 }
13942
13943 /// Removes all scopes, and no default scope will be used either.
13944 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13945 /// for details).
13946 pub fn clear_scopes(mut self) -> ProjectSiteGetCall<'a, C> {
13947 self._scopes.clear();
13948 self
13949 }
13950}
13951
13952/// Gets the Hosting metadata for a specific site.
13953///
13954/// A builder for the *sites.getConfig* method supported by a *project* resource.
13955/// It is not used directly, but through a [`ProjectMethods`] instance.
13956///
13957/// # Example
13958///
13959/// Instantiate a resource method builder
13960///
13961/// ```test_harness,no_run
13962/// # extern crate hyper;
13963/// # extern crate hyper_rustls;
13964/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
13965/// # async fn dox() {
13966/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13967///
13968/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13969/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13970/// # secret,
13971/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13972/// # ).build().await.unwrap();
13973///
13974/// # let client = hyper_util::client::legacy::Client::builder(
13975/// # hyper_util::rt::TokioExecutor::new()
13976/// # )
13977/// # .build(
13978/// # hyper_rustls::HttpsConnectorBuilder::new()
13979/// # .with_native_roots()
13980/// # .unwrap()
13981/// # .https_or_http()
13982/// # .enable_http1()
13983/// # .build()
13984/// # );
13985/// # let mut hub = FirebaseHosting::new(client, auth);
13986/// // You can configure optional parameters by calling the respective setters at will, and
13987/// // execute the final call using `doit()`.
13988/// // Values shown here are possibly random and not representative !
13989/// let result = hub.projects().sites_get_config("name")
13990/// .doit().await;
13991/// # }
13992/// ```
13993pub struct ProjectSiteGetConfigCall<'a, C>
13994where
13995 C: 'a,
13996{
13997 hub: &'a FirebaseHosting<C>,
13998 _name: String,
13999 _delegate: Option<&'a mut dyn common::Delegate>,
14000 _additional_params: HashMap<String, String>,
14001 _scopes: BTreeSet<String>,
14002}
14003
14004impl<'a, C> common::CallBuilder for ProjectSiteGetConfigCall<'a, C> {}
14005
14006impl<'a, C> ProjectSiteGetConfigCall<'a, C>
14007where
14008 C: common::Connector,
14009{
14010 /// Perform the operation you have build so far.
14011 pub async fn doit(mut self) -> common::Result<(common::Response, SiteConfig)> {
14012 use std::borrow::Cow;
14013 use std::io::{Read, Seek};
14014
14015 use common::{url::Params, ToParts};
14016 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14017
14018 let mut dd = common::DefaultDelegate;
14019 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14020 dlg.begin(common::MethodInfo {
14021 id: "firebasehosting.projects.sites.getConfig",
14022 http_method: hyper::Method::GET,
14023 });
14024
14025 for &field in ["alt", "name"].iter() {
14026 if self._additional_params.contains_key(field) {
14027 dlg.finished(false);
14028 return Err(common::Error::FieldClash(field));
14029 }
14030 }
14031
14032 let mut params = Params::with_capacity(3 + self._additional_params.len());
14033 params.push("name", self._name);
14034
14035 params.extend(self._additional_params.iter());
14036
14037 params.push("alt", "json");
14038 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
14039 if self._scopes.is_empty() {
14040 self._scopes
14041 .insert(Scope::FirebaseReadonly.as_ref().to_string());
14042 }
14043
14044 #[allow(clippy::single_element_loop)]
14045 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14046 url = params.uri_replacement(url, param_name, find_this, true);
14047 }
14048 {
14049 let to_remove = ["name"];
14050 params.remove_params(&to_remove);
14051 }
14052
14053 let url = params.parse_with_url(&url);
14054
14055 loop {
14056 let token = match self
14057 .hub
14058 .auth
14059 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14060 .await
14061 {
14062 Ok(token) => token,
14063 Err(e) => match dlg.token(e) {
14064 Ok(token) => token,
14065 Err(e) => {
14066 dlg.finished(false);
14067 return Err(common::Error::MissingToken(e));
14068 }
14069 },
14070 };
14071 let mut req_result = {
14072 let client = &self.hub.client;
14073 dlg.pre_request();
14074 let mut req_builder = hyper::Request::builder()
14075 .method(hyper::Method::GET)
14076 .uri(url.as_str())
14077 .header(USER_AGENT, self.hub._user_agent.clone());
14078
14079 if let Some(token) = token.as_ref() {
14080 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14081 }
14082
14083 let request = req_builder
14084 .header(CONTENT_LENGTH, 0_u64)
14085 .body(common::to_body::<String>(None));
14086
14087 client.request(request.unwrap()).await
14088 };
14089
14090 match req_result {
14091 Err(err) => {
14092 if let common::Retry::After(d) = dlg.http_error(&err) {
14093 sleep(d).await;
14094 continue;
14095 }
14096 dlg.finished(false);
14097 return Err(common::Error::HttpError(err));
14098 }
14099 Ok(res) => {
14100 let (mut parts, body) = res.into_parts();
14101 let mut body = common::Body::new(body);
14102 if !parts.status.is_success() {
14103 let bytes = common::to_bytes(body).await.unwrap_or_default();
14104 let error = serde_json::from_str(&common::to_string(&bytes));
14105 let response = common::to_response(parts, bytes.into());
14106
14107 if let common::Retry::After(d) =
14108 dlg.http_failure(&response, error.as_ref().ok())
14109 {
14110 sleep(d).await;
14111 continue;
14112 }
14113
14114 dlg.finished(false);
14115
14116 return Err(match error {
14117 Ok(value) => common::Error::BadRequest(value),
14118 _ => common::Error::Failure(response),
14119 });
14120 }
14121 let response = {
14122 let bytes = common::to_bytes(body).await.unwrap_or_default();
14123 let encoded = common::to_string(&bytes);
14124 match serde_json::from_str(&encoded) {
14125 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14126 Err(error) => {
14127 dlg.response_json_decode_error(&encoded, &error);
14128 return Err(common::Error::JsonDecodeError(
14129 encoded.to_string(),
14130 error,
14131 ));
14132 }
14133 }
14134 };
14135
14136 dlg.finished(true);
14137 return Ok(response);
14138 }
14139 }
14140 }
14141 }
14142
14143 /// Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
14144 ///
14145 /// Sets the *name* path property to the given value.
14146 ///
14147 /// Even though the property as already been set when instantiating this call,
14148 /// we provide this method for API completeness.
14149 pub fn name(mut self, new_value: &str) -> ProjectSiteGetConfigCall<'a, C> {
14150 self._name = new_value.to_string();
14151 self
14152 }
14153 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14154 /// while executing the actual API request.
14155 ///
14156 /// ````text
14157 /// It should be used to handle progress information, and to implement a certain level of resilience.
14158 /// ````
14159 ///
14160 /// Sets the *delegate* property to the given value.
14161 pub fn delegate(
14162 mut self,
14163 new_value: &'a mut dyn common::Delegate,
14164 ) -> ProjectSiteGetConfigCall<'a, C> {
14165 self._delegate = Some(new_value);
14166 self
14167 }
14168
14169 /// Set any additional parameter of the query string used in the request.
14170 /// It should be used to set parameters which are not yet available through their own
14171 /// setters.
14172 ///
14173 /// Please note that this method must not be used to set any of the known parameters
14174 /// which have their own setter method. If done anyway, the request will fail.
14175 ///
14176 /// # Additional Parameters
14177 ///
14178 /// * *$.xgafv* (query-string) - V1 error format.
14179 /// * *access_token* (query-string) - OAuth access token.
14180 /// * *alt* (query-string) - Data format for response.
14181 /// * *callback* (query-string) - JSONP
14182 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14183 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14184 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14185 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14186 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14187 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14188 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14189 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteGetConfigCall<'a, C>
14190 where
14191 T: AsRef<str>,
14192 {
14193 self._additional_params
14194 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14195 self
14196 }
14197
14198 /// Identifies the authorization scope for the method you are building.
14199 ///
14200 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14201 /// [`Scope::FirebaseReadonly`].
14202 ///
14203 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14204 /// tokens for more than one scope.
14205 ///
14206 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14207 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14208 /// sufficient, a read-write scope will do as well.
14209 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteGetConfigCall<'a, C>
14210 where
14211 St: AsRef<str>,
14212 {
14213 self._scopes.insert(String::from(scope.as_ref()));
14214 self
14215 }
14216 /// Identifies the authorization scope(s) for the method you are building.
14217 ///
14218 /// See [`Self::add_scope()`] for details.
14219 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteGetConfigCall<'a, C>
14220 where
14221 I: IntoIterator<Item = St>,
14222 St: AsRef<str>,
14223 {
14224 self._scopes
14225 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14226 self
14227 }
14228
14229 /// Removes all scopes, and no default scope will be used either.
14230 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14231 /// for details).
14232 pub fn clear_scopes(mut self) -> ProjectSiteGetConfigCall<'a, C> {
14233 self._scopes.clear();
14234 self
14235 }
14236}
14237
14238/// Lists each Hosting Site associated with the specified parent Firebase project.
14239///
14240/// A builder for the *sites.list* method supported by a *project* resource.
14241/// It is not used directly, but through a [`ProjectMethods`] instance.
14242///
14243/// # Example
14244///
14245/// Instantiate a resource method builder
14246///
14247/// ```test_harness,no_run
14248/// # extern crate hyper;
14249/// # extern crate hyper_rustls;
14250/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
14251/// # async fn dox() {
14252/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14253///
14254/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14255/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14256/// # secret,
14257/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14258/// # ).build().await.unwrap();
14259///
14260/// # let client = hyper_util::client::legacy::Client::builder(
14261/// # hyper_util::rt::TokioExecutor::new()
14262/// # )
14263/// # .build(
14264/// # hyper_rustls::HttpsConnectorBuilder::new()
14265/// # .with_native_roots()
14266/// # .unwrap()
14267/// # .https_or_http()
14268/// # .enable_http1()
14269/// # .build()
14270/// # );
14271/// # let mut hub = FirebaseHosting::new(client, auth);
14272/// // You can configure optional parameters by calling the respective setters at will, and
14273/// // execute the final call using `doit()`.
14274/// // Values shown here are possibly random and not representative !
14275/// let result = hub.projects().sites_list("parent")
14276/// .page_token("ea")
14277/// .page_size(-95)
14278/// .doit().await;
14279/// # }
14280/// ```
14281pub struct ProjectSiteListCall<'a, C>
14282where
14283 C: 'a,
14284{
14285 hub: &'a FirebaseHosting<C>,
14286 _parent: String,
14287 _page_token: Option<String>,
14288 _page_size: Option<i32>,
14289 _delegate: Option<&'a mut dyn common::Delegate>,
14290 _additional_params: HashMap<String, String>,
14291 _scopes: BTreeSet<String>,
14292}
14293
14294impl<'a, C> common::CallBuilder for ProjectSiteListCall<'a, C> {}
14295
14296impl<'a, C> ProjectSiteListCall<'a, C>
14297where
14298 C: common::Connector,
14299{
14300 /// Perform the operation you have build so far.
14301 pub async fn doit(mut self) -> common::Result<(common::Response, ListSitesResponse)> {
14302 use std::borrow::Cow;
14303 use std::io::{Read, Seek};
14304
14305 use common::{url::Params, ToParts};
14306 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14307
14308 let mut dd = common::DefaultDelegate;
14309 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14310 dlg.begin(common::MethodInfo {
14311 id: "firebasehosting.projects.sites.list",
14312 http_method: hyper::Method::GET,
14313 });
14314
14315 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
14316 if self._additional_params.contains_key(field) {
14317 dlg.finished(false);
14318 return Err(common::Error::FieldClash(field));
14319 }
14320 }
14321
14322 let mut params = Params::with_capacity(5 + self._additional_params.len());
14323 params.push("parent", self._parent);
14324 if let Some(value) = self._page_token.as_ref() {
14325 params.push("pageToken", value);
14326 }
14327 if let Some(value) = self._page_size.as_ref() {
14328 params.push("pageSize", value.to_string());
14329 }
14330
14331 params.extend(self._additional_params.iter());
14332
14333 params.push("alt", "json");
14334 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/sites";
14335 if self._scopes.is_empty() {
14336 self._scopes
14337 .insert(Scope::FirebaseReadonly.as_ref().to_string());
14338 }
14339
14340 #[allow(clippy::single_element_loop)]
14341 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14342 url = params.uri_replacement(url, param_name, find_this, true);
14343 }
14344 {
14345 let to_remove = ["parent"];
14346 params.remove_params(&to_remove);
14347 }
14348
14349 let url = params.parse_with_url(&url);
14350
14351 loop {
14352 let token = match self
14353 .hub
14354 .auth
14355 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14356 .await
14357 {
14358 Ok(token) => token,
14359 Err(e) => match dlg.token(e) {
14360 Ok(token) => token,
14361 Err(e) => {
14362 dlg.finished(false);
14363 return Err(common::Error::MissingToken(e));
14364 }
14365 },
14366 };
14367 let mut req_result = {
14368 let client = &self.hub.client;
14369 dlg.pre_request();
14370 let mut req_builder = hyper::Request::builder()
14371 .method(hyper::Method::GET)
14372 .uri(url.as_str())
14373 .header(USER_AGENT, self.hub._user_agent.clone());
14374
14375 if let Some(token) = token.as_ref() {
14376 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14377 }
14378
14379 let request = req_builder
14380 .header(CONTENT_LENGTH, 0_u64)
14381 .body(common::to_body::<String>(None));
14382
14383 client.request(request.unwrap()).await
14384 };
14385
14386 match req_result {
14387 Err(err) => {
14388 if let common::Retry::After(d) = dlg.http_error(&err) {
14389 sleep(d).await;
14390 continue;
14391 }
14392 dlg.finished(false);
14393 return Err(common::Error::HttpError(err));
14394 }
14395 Ok(res) => {
14396 let (mut parts, body) = res.into_parts();
14397 let mut body = common::Body::new(body);
14398 if !parts.status.is_success() {
14399 let bytes = common::to_bytes(body).await.unwrap_or_default();
14400 let error = serde_json::from_str(&common::to_string(&bytes));
14401 let response = common::to_response(parts, bytes.into());
14402
14403 if let common::Retry::After(d) =
14404 dlg.http_failure(&response, error.as_ref().ok())
14405 {
14406 sleep(d).await;
14407 continue;
14408 }
14409
14410 dlg.finished(false);
14411
14412 return Err(match error {
14413 Ok(value) => common::Error::BadRequest(value),
14414 _ => common::Error::Failure(response),
14415 });
14416 }
14417 let response = {
14418 let bytes = common::to_bytes(body).await.unwrap_or_default();
14419 let encoded = common::to_string(&bytes);
14420 match serde_json::from_str(&encoded) {
14421 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14422 Err(error) => {
14423 dlg.response_json_decode_error(&encoded, &error);
14424 return Err(common::Error::JsonDecodeError(
14425 encoded.to_string(),
14426 error,
14427 ));
14428 }
14429 }
14430 };
14431
14432 dlg.finished(true);
14433 return Ok(response);
14434 }
14435 }
14436 }
14437 }
14438
14439 /// Required. The Firebase project for which to list sites, in the format: projects/PROJECT_IDENTIFIER Refer to the `Site` [`name`](https://firebase.google.com/docs/hosting/../projects#Site.FIELDS.name) field for details about PROJECT_IDENTIFIER values.
14440 ///
14441 /// Sets the *parent* path property to the given value.
14442 ///
14443 /// Even though the property as already been set when instantiating this call,
14444 /// we provide this method for API completeness.
14445 pub fn parent(mut self, new_value: &str) -> ProjectSiteListCall<'a, C> {
14446 self._parent = new_value.to_string();
14447 self
14448 }
14449 /// Optional. A token from a previous call to `ListSites` that tells the server where to resume listing.
14450 ///
14451 /// Sets the *page token* query property to the given value.
14452 pub fn page_token(mut self, new_value: &str) -> ProjectSiteListCall<'a, C> {
14453 self._page_token = Some(new_value.to_string());
14454 self
14455 }
14456 /// Optional. The maximum number of sites to return. The service may return a lower number if fewer sites exist than this maximum number. If unspecified, defaults to 40.
14457 ///
14458 /// Sets the *page size* query property to the given value.
14459 pub fn page_size(mut self, new_value: i32) -> ProjectSiteListCall<'a, C> {
14460 self._page_size = Some(new_value);
14461 self
14462 }
14463 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14464 /// while executing the actual API request.
14465 ///
14466 /// ````text
14467 /// It should be used to handle progress information, and to implement a certain level of resilience.
14468 /// ````
14469 ///
14470 /// Sets the *delegate* property to the given value.
14471 pub fn delegate(
14472 mut self,
14473 new_value: &'a mut dyn common::Delegate,
14474 ) -> ProjectSiteListCall<'a, C> {
14475 self._delegate = Some(new_value);
14476 self
14477 }
14478
14479 /// Set any additional parameter of the query string used in the request.
14480 /// It should be used to set parameters which are not yet available through their own
14481 /// setters.
14482 ///
14483 /// Please note that this method must not be used to set any of the known parameters
14484 /// which have their own setter method. If done anyway, the request will fail.
14485 ///
14486 /// # Additional Parameters
14487 ///
14488 /// * *$.xgafv* (query-string) - V1 error format.
14489 /// * *access_token* (query-string) - OAuth access token.
14490 /// * *alt* (query-string) - Data format for response.
14491 /// * *callback* (query-string) - JSONP
14492 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14493 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14494 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14495 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14496 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14497 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14498 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14499 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteListCall<'a, C>
14500 where
14501 T: AsRef<str>,
14502 {
14503 self._additional_params
14504 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14505 self
14506 }
14507
14508 /// Identifies the authorization scope for the method you are building.
14509 ///
14510 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14511 /// [`Scope::FirebaseReadonly`].
14512 ///
14513 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14514 /// tokens for more than one scope.
14515 ///
14516 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14517 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14518 /// sufficient, a read-write scope will do as well.
14519 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteListCall<'a, C>
14520 where
14521 St: AsRef<str>,
14522 {
14523 self._scopes.insert(String::from(scope.as_ref()));
14524 self
14525 }
14526 /// Identifies the authorization scope(s) for the method you are building.
14527 ///
14528 /// See [`Self::add_scope()`] for details.
14529 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteListCall<'a, C>
14530 where
14531 I: IntoIterator<Item = St>,
14532 St: AsRef<str>,
14533 {
14534 self._scopes
14535 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14536 self
14537 }
14538
14539 /// Removes all scopes, and no default scope will be used either.
14540 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14541 /// for details).
14542 pub fn clear_scopes(mut self) -> ProjectSiteListCall<'a, C> {
14543 self._scopes.clear();
14544 self
14545 }
14546}
14547
14548/// Updates attributes of the specified Hosting Site.
14549///
14550/// A builder for the *sites.patch* method supported by a *project* resource.
14551/// It is not used directly, but through a [`ProjectMethods`] instance.
14552///
14553/// # Example
14554///
14555/// Instantiate a resource method builder
14556///
14557/// ```test_harness,no_run
14558/// # extern crate hyper;
14559/// # extern crate hyper_rustls;
14560/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
14561/// use firebasehosting1_beta1::api::Site;
14562/// # async fn dox() {
14563/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14564///
14565/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14566/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14567/// # secret,
14568/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14569/// # ).build().await.unwrap();
14570///
14571/// # let client = hyper_util::client::legacy::Client::builder(
14572/// # hyper_util::rt::TokioExecutor::new()
14573/// # )
14574/// # .build(
14575/// # hyper_rustls::HttpsConnectorBuilder::new()
14576/// # .with_native_roots()
14577/// # .unwrap()
14578/// # .https_or_http()
14579/// # .enable_http1()
14580/// # .build()
14581/// # );
14582/// # let mut hub = FirebaseHosting::new(client, auth);
14583/// // As the method needs a request, you would usually fill it with the desired information
14584/// // into the respective structure. Some of the parts shown here might not be applicable !
14585/// // Values shown here are possibly random and not representative !
14586/// let mut req = Site::default();
14587///
14588/// // You can configure optional parameters by calling the respective setters at will, and
14589/// // execute the final call using `doit()`.
14590/// // Values shown here are possibly random and not representative !
14591/// let result = hub.projects().sites_patch(req, "name")
14592/// .update_mask(FieldMask::new::<&str>(&[]))
14593/// .doit().await;
14594/// # }
14595/// ```
14596pub struct ProjectSitePatchCall<'a, C>
14597where
14598 C: 'a,
14599{
14600 hub: &'a FirebaseHosting<C>,
14601 _request: Site,
14602 _name: String,
14603 _update_mask: Option<common::FieldMask>,
14604 _delegate: Option<&'a mut dyn common::Delegate>,
14605 _additional_params: HashMap<String, String>,
14606 _scopes: BTreeSet<String>,
14607}
14608
14609impl<'a, C> common::CallBuilder for ProjectSitePatchCall<'a, C> {}
14610
14611impl<'a, C> ProjectSitePatchCall<'a, C>
14612where
14613 C: common::Connector,
14614{
14615 /// Perform the operation you have build so far.
14616 pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
14617 use std::borrow::Cow;
14618 use std::io::{Read, Seek};
14619
14620 use common::{url::Params, ToParts};
14621 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14622
14623 let mut dd = common::DefaultDelegate;
14624 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14625 dlg.begin(common::MethodInfo {
14626 id: "firebasehosting.projects.sites.patch",
14627 http_method: hyper::Method::PATCH,
14628 });
14629
14630 for &field in ["alt", "name", "updateMask"].iter() {
14631 if self._additional_params.contains_key(field) {
14632 dlg.finished(false);
14633 return Err(common::Error::FieldClash(field));
14634 }
14635 }
14636
14637 let mut params = Params::with_capacity(5 + self._additional_params.len());
14638 params.push("name", self._name);
14639 if let Some(value) = self._update_mask.as_ref() {
14640 params.push("updateMask", value.to_string());
14641 }
14642
14643 params.extend(self._additional_params.iter());
14644
14645 params.push("alt", "json");
14646 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
14647 if self._scopes.is_empty() {
14648 self._scopes
14649 .insert(Scope::CloudPlatform.as_ref().to_string());
14650 }
14651
14652 #[allow(clippy::single_element_loop)]
14653 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14654 url = params.uri_replacement(url, param_name, find_this, true);
14655 }
14656 {
14657 let to_remove = ["name"];
14658 params.remove_params(&to_remove);
14659 }
14660
14661 let url = params.parse_with_url(&url);
14662
14663 let mut json_mime_type = mime::APPLICATION_JSON;
14664 let mut request_value_reader = {
14665 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14666 common::remove_json_null_values(&mut value);
14667 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14668 serde_json::to_writer(&mut dst, &value).unwrap();
14669 dst
14670 };
14671 let request_size = request_value_reader
14672 .seek(std::io::SeekFrom::End(0))
14673 .unwrap();
14674 request_value_reader
14675 .seek(std::io::SeekFrom::Start(0))
14676 .unwrap();
14677
14678 loop {
14679 let token = match self
14680 .hub
14681 .auth
14682 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14683 .await
14684 {
14685 Ok(token) => token,
14686 Err(e) => match dlg.token(e) {
14687 Ok(token) => token,
14688 Err(e) => {
14689 dlg.finished(false);
14690 return Err(common::Error::MissingToken(e));
14691 }
14692 },
14693 };
14694 request_value_reader
14695 .seek(std::io::SeekFrom::Start(0))
14696 .unwrap();
14697 let mut req_result = {
14698 let client = &self.hub.client;
14699 dlg.pre_request();
14700 let mut req_builder = hyper::Request::builder()
14701 .method(hyper::Method::PATCH)
14702 .uri(url.as_str())
14703 .header(USER_AGENT, self.hub._user_agent.clone());
14704
14705 if let Some(token) = token.as_ref() {
14706 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14707 }
14708
14709 let request = req_builder
14710 .header(CONTENT_TYPE, json_mime_type.to_string())
14711 .header(CONTENT_LENGTH, request_size as u64)
14712 .body(common::to_body(
14713 request_value_reader.get_ref().clone().into(),
14714 ));
14715
14716 client.request(request.unwrap()).await
14717 };
14718
14719 match req_result {
14720 Err(err) => {
14721 if let common::Retry::After(d) = dlg.http_error(&err) {
14722 sleep(d).await;
14723 continue;
14724 }
14725 dlg.finished(false);
14726 return Err(common::Error::HttpError(err));
14727 }
14728 Ok(res) => {
14729 let (mut parts, body) = res.into_parts();
14730 let mut body = common::Body::new(body);
14731 if !parts.status.is_success() {
14732 let bytes = common::to_bytes(body).await.unwrap_or_default();
14733 let error = serde_json::from_str(&common::to_string(&bytes));
14734 let response = common::to_response(parts, bytes.into());
14735
14736 if let common::Retry::After(d) =
14737 dlg.http_failure(&response, error.as_ref().ok())
14738 {
14739 sleep(d).await;
14740 continue;
14741 }
14742
14743 dlg.finished(false);
14744
14745 return Err(match error {
14746 Ok(value) => common::Error::BadRequest(value),
14747 _ => common::Error::Failure(response),
14748 });
14749 }
14750 let response = {
14751 let bytes = common::to_bytes(body).await.unwrap_or_default();
14752 let encoded = common::to_string(&bytes);
14753 match serde_json::from_str(&encoded) {
14754 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14755 Err(error) => {
14756 dlg.response_json_decode_error(&encoded, &error);
14757 return Err(common::Error::JsonDecodeError(
14758 encoded.to_string(),
14759 error,
14760 ));
14761 }
14762 }
14763 };
14764
14765 dlg.finished(true);
14766 return Ok(response);
14767 }
14768 }
14769 }
14770 }
14771
14772 ///
14773 /// Sets the *request* property to the given value.
14774 ///
14775 /// Even though the property as already been set when instantiating this call,
14776 /// we provide this method for API completeness.
14777 pub fn request(mut self, new_value: Site) -> ProjectSitePatchCall<'a, C> {
14778 self._request = new_value;
14779 self
14780 }
14781 /// Output only. The fully-qualified resource name of the Hosting site, in the format: projects/PROJECT_IDENTIFIER/sites/SITE_ID PROJECT_IDENTIFIER: the Firebase project's [`ProjectNumber`](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects#FirebaseProject.FIELDS.project_number) ***(recommended)*** or its [`ProjectId`](https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects#FirebaseProject.FIELDS.project_id). Learn more about using project identifiers in Google's [AIP 2510 standard](https://google.aip.dev/cloud/2510).
14782 ///
14783 /// Sets the *name* path property to the given value.
14784 ///
14785 /// Even though the property as already been set when instantiating this call,
14786 /// we provide this method for API completeness.
14787 pub fn name(mut self, new_value: &str) -> ProjectSitePatchCall<'a, C> {
14788 self._name = new_value.to_string();
14789 self
14790 }
14791 /// A set of field names from your Site that you want to update.
14792 ///
14793 /// Sets the *update mask* query property to the given value.
14794 pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectSitePatchCall<'a, C> {
14795 self._update_mask = Some(new_value);
14796 self
14797 }
14798 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14799 /// while executing the actual API request.
14800 ///
14801 /// ````text
14802 /// It should be used to handle progress information, and to implement a certain level of resilience.
14803 /// ````
14804 ///
14805 /// Sets the *delegate* property to the given value.
14806 pub fn delegate(
14807 mut self,
14808 new_value: &'a mut dyn common::Delegate,
14809 ) -> ProjectSitePatchCall<'a, C> {
14810 self._delegate = Some(new_value);
14811 self
14812 }
14813
14814 /// Set any additional parameter of the query string used in the request.
14815 /// It should be used to set parameters which are not yet available through their own
14816 /// setters.
14817 ///
14818 /// Please note that this method must not be used to set any of the known parameters
14819 /// which have their own setter method. If done anyway, the request will fail.
14820 ///
14821 /// # Additional Parameters
14822 ///
14823 /// * *$.xgafv* (query-string) - V1 error format.
14824 /// * *access_token* (query-string) - OAuth access token.
14825 /// * *alt* (query-string) - Data format for response.
14826 /// * *callback* (query-string) - JSONP
14827 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14828 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14829 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14830 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14831 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14832 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14833 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14834 pub fn param<T>(mut self, name: T, value: T) -> ProjectSitePatchCall<'a, C>
14835 where
14836 T: AsRef<str>,
14837 {
14838 self._additional_params
14839 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14840 self
14841 }
14842
14843 /// Identifies the authorization scope for the method you are building.
14844 ///
14845 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14846 /// [`Scope::CloudPlatform`].
14847 ///
14848 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14849 /// tokens for more than one scope.
14850 ///
14851 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14852 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14853 /// sufficient, a read-write scope will do as well.
14854 pub fn add_scope<St>(mut self, scope: St) -> ProjectSitePatchCall<'a, C>
14855 where
14856 St: AsRef<str>,
14857 {
14858 self._scopes.insert(String::from(scope.as_ref()));
14859 self
14860 }
14861 /// Identifies the authorization scope(s) for the method you are building.
14862 ///
14863 /// See [`Self::add_scope()`] for details.
14864 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSitePatchCall<'a, C>
14865 where
14866 I: IntoIterator<Item = St>,
14867 St: AsRef<str>,
14868 {
14869 self._scopes
14870 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14871 self
14872 }
14873
14874 /// Removes all scopes, and no default scope will be used either.
14875 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14876 /// for details).
14877 pub fn clear_scopes(mut self) -> ProjectSitePatchCall<'a, C> {
14878 self._scopes.clear();
14879 self
14880 }
14881}
14882
14883/// Sets the Hosting metadata for a specific site.
14884///
14885/// A builder for the *sites.updateConfig* method supported by a *project* resource.
14886/// It is not used directly, but through a [`ProjectMethods`] instance.
14887///
14888/// # Example
14889///
14890/// Instantiate a resource method builder
14891///
14892/// ```test_harness,no_run
14893/// # extern crate hyper;
14894/// # extern crate hyper_rustls;
14895/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
14896/// use firebasehosting1_beta1::api::SiteConfig;
14897/// # async fn dox() {
14898/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14899///
14900/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14901/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14902/// # secret,
14903/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14904/// # ).build().await.unwrap();
14905///
14906/// # let client = hyper_util::client::legacy::Client::builder(
14907/// # hyper_util::rt::TokioExecutor::new()
14908/// # )
14909/// # .build(
14910/// # hyper_rustls::HttpsConnectorBuilder::new()
14911/// # .with_native_roots()
14912/// # .unwrap()
14913/// # .https_or_http()
14914/// # .enable_http1()
14915/// # .build()
14916/// # );
14917/// # let mut hub = FirebaseHosting::new(client, auth);
14918/// // As the method needs a request, you would usually fill it with the desired information
14919/// // into the respective structure. Some of the parts shown here might not be applicable !
14920/// // Values shown here are possibly random and not representative !
14921/// let mut req = SiteConfig::default();
14922///
14923/// // You can configure optional parameters by calling the respective setters at will, and
14924/// // execute the final call using `doit()`.
14925/// // Values shown here are possibly random and not representative !
14926/// let result = hub.projects().sites_update_config(req, "name")
14927/// .update_mask(FieldMask::new::<&str>(&[]))
14928/// .doit().await;
14929/// # }
14930/// ```
14931pub struct ProjectSiteUpdateConfigCall<'a, C>
14932where
14933 C: 'a,
14934{
14935 hub: &'a FirebaseHosting<C>,
14936 _request: SiteConfig,
14937 _name: String,
14938 _update_mask: Option<common::FieldMask>,
14939 _delegate: Option<&'a mut dyn common::Delegate>,
14940 _additional_params: HashMap<String, String>,
14941 _scopes: BTreeSet<String>,
14942}
14943
14944impl<'a, C> common::CallBuilder for ProjectSiteUpdateConfigCall<'a, C> {}
14945
14946impl<'a, C> ProjectSiteUpdateConfigCall<'a, C>
14947where
14948 C: common::Connector,
14949{
14950 /// Perform the operation you have build so far.
14951 pub async fn doit(mut self) -> common::Result<(common::Response, SiteConfig)> {
14952 use std::borrow::Cow;
14953 use std::io::{Read, Seek};
14954
14955 use common::{url::Params, ToParts};
14956 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14957
14958 let mut dd = common::DefaultDelegate;
14959 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14960 dlg.begin(common::MethodInfo {
14961 id: "firebasehosting.projects.sites.updateConfig",
14962 http_method: hyper::Method::PATCH,
14963 });
14964
14965 for &field in ["alt", "name", "updateMask"].iter() {
14966 if self._additional_params.contains_key(field) {
14967 dlg.finished(false);
14968 return Err(common::Error::FieldClash(field));
14969 }
14970 }
14971
14972 let mut params = Params::with_capacity(5 + self._additional_params.len());
14973 params.push("name", self._name);
14974 if let Some(value) = self._update_mask.as_ref() {
14975 params.push("updateMask", value.to_string());
14976 }
14977
14978 params.extend(self._additional_params.iter());
14979
14980 params.push("alt", "json");
14981 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
14982 if self._scopes.is_empty() {
14983 self._scopes
14984 .insert(Scope::CloudPlatform.as_ref().to_string());
14985 }
14986
14987 #[allow(clippy::single_element_loop)]
14988 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14989 url = params.uri_replacement(url, param_name, find_this, true);
14990 }
14991 {
14992 let to_remove = ["name"];
14993 params.remove_params(&to_remove);
14994 }
14995
14996 let url = params.parse_with_url(&url);
14997
14998 let mut json_mime_type = mime::APPLICATION_JSON;
14999 let mut request_value_reader = {
15000 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15001 common::remove_json_null_values(&mut value);
15002 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15003 serde_json::to_writer(&mut dst, &value).unwrap();
15004 dst
15005 };
15006 let request_size = request_value_reader
15007 .seek(std::io::SeekFrom::End(0))
15008 .unwrap();
15009 request_value_reader
15010 .seek(std::io::SeekFrom::Start(0))
15011 .unwrap();
15012
15013 loop {
15014 let token = match self
15015 .hub
15016 .auth
15017 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15018 .await
15019 {
15020 Ok(token) => token,
15021 Err(e) => match dlg.token(e) {
15022 Ok(token) => token,
15023 Err(e) => {
15024 dlg.finished(false);
15025 return Err(common::Error::MissingToken(e));
15026 }
15027 },
15028 };
15029 request_value_reader
15030 .seek(std::io::SeekFrom::Start(0))
15031 .unwrap();
15032 let mut req_result = {
15033 let client = &self.hub.client;
15034 dlg.pre_request();
15035 let mut req_builder = hyper::Request::builder()
15036 .method(hyper::Method::PATCH)
15037 .uri(url.as_str())
15038 .header(USER_AGENT, self.hub._user_agent.clone());
15039
15040 if let Some(token) = token.as_ref() {
15041 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15042 }
15043
15044 let request = req_builder
15045 .header(CONTENT_TYPE, json_mime_type.to_string())
15046 .header(CONTENT_LENGTH, request_size as u64)
15047 .body(common::to_body(
15048 request_value_reader.get_ref().clone().into(),
15049 ));
15050
15051 client.request(request.unwrap()).await
15052 };
15053
15054 match req_result {
15055 Err(err) => {
15056 if let common::Retry::After(d) = dlg.http_error(&err) {
15057 sleep(d).await;
15058 continue;
15059 }
15060 dlg.finished(false);
15061 return Err(common::Error::HttpError(err));
15062 }
15063 Ok(res) => {
15064 let (mut parts, body) = res.into_parts();
15065 let mut body = common::Body::new(body);
15066 if !parts.status.is_success() {
15067 let bytes = common::to_bytes(body).await.unwrap_or_default();
15068 let error = serde_json::from_str(&common::to_string(&bytes));
15069 let response = common::to_response(parts, bytes.into());
15070
15071 if let common::Retry::After(d) =
15072 dlg.http_failure(&response, error.as_ref().ok())
15073 {
15074 sleep(d).await;
15075 continue;
15076 }
15077
15078 dlg.finished(false);
15079
15080 return Err(match error {
15081 Ok(value) => common::Error::BadRequest(value),
15082 _ => common::Error::Failure(response),
15083 });
15084 }
15085 let response = {
15086 let bytes = common::to_bytes(body).await.unwrap_or_default();
15087 let encoded = common::to_string(&bytes);
15088 match serde_json::from_str(&encoded) {
15089 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15090 Err(error) => {
15091 dlg.response_json_decode_error(&encoded, &error);
15092 return Err(common::Error::JsonDecodeError(
15093 encoded.to_string(),
15094 error,
15095 ));
15096 }
15097 }
15098 };
15099
15100 dlg.finished(true);
15101 return Ok(response);
15102 }
15103 }
15104 }
15105 }
15106
15107 ///
15108 /// Sets the *request* property to the given value.
15109 ///
15110 /// Even though the property as already been set when instantiating this call,
15111 /// we provide this method for API completeness.
15112 pub fn request(mut self, new_value: SiteConfig) -> ProjectSiteUpdateConfigCall<'a, C> {
15113 self._request = new_value;
15114 self
15115 }
15116 /// Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
15117 ///
15118 /// Sets the *name* path property to the given value.
15119 ///
15120 /// Even though the property as already been set when instantiating this call,
15121 /// we provide this method for API completeness.
15122 pub fn name(mut self, new_value: &str) -> ProjectSiteUpdateConfigCall<'a, C> {
15123 self._name = new_value.to_string();
15124 self
15125 }
15126 /// A set of field names from your [site configuration](https://firebase.google.com/docs/hosting/../sites.SiteConfig) that you want to update. A field will be overwritten if, and only if, it’s in the mask. If a mask is not provided then a default mask of only [`max_versions`](https://firebase.google.com/docs/hosting/../sites.SiteConfig.max_versions) will be used.
15127 ///
15128 /// Sets the *update mask* query property to the given value.
15129 pub fn update_mask(
15130 mut self,
15131 new_value: common::FieldMask,
15132 ) -> ProjectSiteUpdateConfigCall<'a, C> {
15133 self._update_mask = Some(new_value);
15134 self
15135 }
15136 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15137 /// while executing the actual API request.
15138 ///
15139 /// ````text
15140 /// It should be used to handle progress information, and to implement a certain level of resilience.
15141 /// ````
15142 ///
15143 /// Sets the *delegate* property to the given value.
15144 pub fn delegate(
15145 mut self,
15146 new_value: &'a mut dyn common::Delegate,
15147 ) -> ProjectSiteUpdateConfigCall<'a, C> {
15148 self._delegate = Some(new_value);
15149 self
15150 }
15151
15152 /// Set any additional parameter of the query string used in the request.
15153 /// It should be used to set parameters which are not yet available through their own
15154 /// setters.
15155 ///
15156 /// Please note that this method must not be used to set any of the known parameters
15157 /// which have their own setter method. If done anyway, the request will fail.
15158 ///
15159 /// # Additional Parameters
15160 ///
15161 /// * *$.xgafv* (query-string) - V1 error format.
15162 /// * *access_token* (query-string) - OAuth access token.
15163 /// * *alt* (query-string) - Data format for response.
15164 /// * *callback* (query-string) - JSONP
15165 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15166 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15167 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15168 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15169 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15170 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15171 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15172 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteUpdateConfigCall<'a, C>
15173 where
15174 T: AsRef<str>,
15175 {
15176 self._additional_params
15177 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15178 self
15179 }
15180
15181 /// Identifies the authorization scope for the method you are building.
15182 ///
15183 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15184 /// [`Scope::CloudPlatform`].
15185 ///
15186 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15187 /// tokens for more than one scope.
15188 ///
15189 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15190 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15191 /// sufficient, a read-write scope will do as well.
15192 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteUpdateConfigCall<'a, C>
15193 where
15194 St: AsRef<str>,
15195 {
15196 self._scopes.insert(String::from(scope.as_ref()));
15197 self
15198 }
15199 /// Identifies the authorization scope(s) for the method you are building.
15200 ///
15201 /// See [`Self::add_scope()`] for details.
15202 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteUpdateConfigCall<'a, C>
15203 where
15204 I: IntoIterator<Item = St>,
15205 St: AsRef<str>,
15206 {
15207 self._scopes
15208 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15209 self
15210 }
15211
15212 /// Removes all scopes, and no default scope will be used either.
15213 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15214 /// for details).
15215 pub fn clear_scopes(mut self) -> ProjectSiteUpdateConfigCall<'a, C> {
15216 self._scopes.clear();
15217 self
15218 }
15219}
15220
15221/// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
15222///
15223/// A builder for the *channels.releases.create* method supported by a *site* resource.
15224/// It is not used directly, but through a [`SiteMethods`] instance.
15225///
15226/// # Example
15227///
15228/// Instantiate a resource method builder
15229///
15230/// ```test_harness,no_run
15231/// # extern crate hyper;
15232/// # extern crate hyper_rustls;
15233/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
15234/// use firebasehosting1_beta1::api::Release;
15235/// # async fn dox() {
15236/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15237///
15238/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15239/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15240/// # secret,
15241/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15242/// # ).build().await.unwrap();
15243///
15244/// # let client = hyper_util::client::legacy::Client::builder(
15245/// # hyper_util::rt::TokioExecutor::new()
15246/// # )
15247/// # .build(
15248/// # hyper_rustls::HttpsConnectorBuilder::new()
15249/// # .with_native_roots()
15250/// # .unwrap()
15251/// # .https_or_http()
15252/// # .enable_http1()
15253/// # .build()
15254/// # );
15255/// # let mut hub = FirebaseHosting::new(client, auth);
15256/// // As the method needs a request, you would usually fill it with the desired information
15257/// // into the respective structure. Some of the parts shown here might not be applicable !
15258/// // Values shown here are possibly random and not representative !
15259/// let mut req = Release::default();
15260///
15261/// // You can configure optional parameters by calling the respective setters at will, and
15262/// // execute the final call using `doit()`.
15263/// // Values shown here are possibly random and not representative !
15264/// let result = hub.sites().channels_releases_create(req, "parent")
15265/// .version_name("est")
15266/// .doit().await;
15267/// # }
15268/// ```
15269pub struct SiteChannelReleaseCreateCall<'a, C>
15270where
15271 C: 'a,
15272{
15273 hub: &'a FirebaseHosting<C>,
15274 _request: Release,
15275 _parent: String,
15276 _version_name: Option<String>,
15277 _delegate: Option<&'a mut dyn common::Delegate>,
15278 _additional_params: HashMap<String, String>,
15279 _scopes: BTreeSet<String>,
15280}
15281
15282impl<'a, C> common::CallBuilder for SiteChannelReleaseCreateCall<'a, C> {}
15283
15284impl<'a, C> SiteChannelReleaseCreateCall<'a, C>
15285where
15286 C: common::Connector,
15287{
15288 /// Perform the operation you have build so far.
15289 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
15290 use std::borrow::Cow;
15291 use std::io::{Read, Seek};
15292
15293 use common::{url::Params, ToParts};
15294 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15295
15296 let mut dd = common::DefaultDelegate;
15297 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15298 dlg.begin(common::MethodInfo {
15299 id: "firebasehosting.sites.channels.releases.create",
15300 http_method: hyper::Method::POST,
15301 });
15302
15303 for &field in ["alt", "parent", "versionName"].iter() {
15304 if self._additional_params.contains_key(field) {
15305 dlg.finished(false);
15306 return Err(common::Error::FieldClash(field));
15307 }
15308 }
15309
15310 let mut params = Params::with_capacity(5 + self._additional_params.len());
15311 params.push("parent", self._parent);
15312 if let Some(value) = self._version_name.as_ref() {
15313 params.push("versionName", value);
15314 }
15315
15316 params.extend(self._additional_params.iter());
15317
15318 params.push("alt", "json");
15319 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
15320 if self._scopes.is_empty() {
15321 self._scopes
15322 .insert(Scope::CloudPlatform.as_ref().to_string());
15323 }
15324
15325 #[allow(clippy::single_element_loop)]
15326 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15327 url = params.uri_replacement(url, param_name, find_this, true);
15328 }
15329 {
15330 let to_remove = ["parent"];
15331 params.remove_params(&to_remove);
15332 }
15333
15334 let url = params.parse_with_url(&url);
15335
15336 let mut json_mime_type = mime::APPLICATION_JSON;
15337 let mut request_value_reader = {
15338 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15339 common::remove_json_null_values(&mut value);
15340 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15341 serde_json::to_writer(&mut dst, &value).unwrap();
15342 dst
15343 };
15344 let request_size = request_value_reader
15345 .seek(std::io::SeekFrom::End(0))
15346 .unwrap();
15347 request_value_reader
15348 .seek(std::io::SeekFrom::Start(0))
15349 .unwrap();
15350
15351 loop {
15352 let token = match self
15353 .hub
15354 .auth
15355 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15356 .await
15357 {
15358 Ok(token) => token,
15359 Err(e) => match dlg.token(e) {
15360 Ok(token) => token,
15361 Err(e) => {
15362 dlg.finished(false);
15363 return Err(common::Error::MissingToken(e));
15364 }
15365 },
15366 };
15367 request_value_reader
15368 .seek(std::io::SeekFrom::Start(0))
15369 .unwrap();
15370 let mut req_result = {
15371 let client = &self.hub.client;
15372 dlg.pre_request();
15373 let mut req_builder = hyper::Request::builder()
15374 .method(hyper::Method::POST)
15375 .uri(url.as_str())
15376 .header(USER_AGENT, self.hub._user_agent.clone());
15377
15378 if let Some(token) = token.as_ref() {
15379 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15380 }
15381
15382 let request = req_builder
15383 .header(CONTENT_TYPE, json_mime_type.to_string())
15384 .header(CONTENT_LENGTH, request_size as u64)
15385 .body(common::to_body(
15386 request_value_reader.get_ref().clone().into(),
15387 ));
15388
15389 client.request(request.unwrap()).await
15390 };
15391
15392 match req_result {
15393 Err(err) => {
15394 if let common::Retry::After(d) = dlg.http_error(&err) {
15395 sleep(d).await;
15396 continue;
15397 }
15398 dlg.finished(false);
15399 return Err(common::Error::HttpError(err));
15400 }
15401 Ok(res) => {
15402 let (mut parts, body) = res.into_parts();
15403 let mut body = common::Body::new(body);
15404 if !parts.status.is_success() {
15405 let bytes = common::to_bytes(body).await.unwrap_or_default();
15406 let error = serde_json::from_str(&common::to_string(&bytes));
15407 let response = common::to_response(parts, bytes.into());
15408
15409 if let common::Retry::After(d) =
15410 dlg.http_failure(&response, error.as_ref().ok())
15411 {
15412 sleep(d).await;
15413 continue;
15414 }
15415
15416 dlg.finished(false);
15417
15418 return Err(match error {
15419 Ok(value) => common::Error::BadRequest(value),
15420 _ => common::Error::Failure(response),
15421 });
15422 }
15423 let response = {
15424 let bytes = common::to_bytes(body).await.unwrap_or_default();
15425 let encoded = common::to_string(&bytes);
15426 match serde_json::from_str(&encoded) {
15427 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15428 Err(error) => {
15429 dlg.response_json_decode_error(&encoded, &error);
15430 return Err(common::Error::JsonDecodeError(
15431 encoded.to_string(),
15432 error,
15433 ));
15434 }
15435 }
15436 };
15437
15438 dlg.finished(true);
15439 return Ok(response);
15440 }
15441 }
15442 }
15443 }
15444
15445 ///
15446 /// Sets the *request* property to the given value.
15447 ///
15448 /// Even though the property as already been set when instantiating this call,
15449 /// we provide this method for API completeness.
15450 pub fn request(mut self, new_value: Release) -> SiteChannelReleaseCreateCall<'a, C> {
15451 self._request = new_value;
15452 self
15453 }
15454 /// Required. The site or channel to which the release belongs, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
15455 ///
15456 /// Sets the *parent* path property to the given value.
15457 ///
15458 /// Even though the property as already been set when instantiating this call,
15459 /// we provide this method for API completeness.
15460 pub fn parent(mut self, new_value: &str) -> SiteChannelReleaseCreateCall<'a, C> {
15461 self._parent = new_value.to_string();
15462 self
15463 }
15464 /// The unique identifier for a version, in the format: sites/SITE_ID/versions/ VERSION_ID The SITE_ID in this version identifier must match the SITE_ID in the `parent` parameter. This query parameter must be empty if the `type` field in the request body is `SITE_DISABLE`.
15465 ///
15466 /// Sets the *version name* query property to the given value.
15467 pub fn version_name(mut self, new_value: &str) -> SiteChannelReleaseCreateCall<'a, C> {
15468 self._version_name = Some(new_value.to_string());
15469 self
15470 }
15471 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15472 /// while executing the actual API request.
15473 ///
15474 /// ````text
15475 /// It should be used to handle progress information, and to implement a certain level of resilience.
15476 /// ````
15477 ///
15478 /// Sets the *delegate* property to the given value.
15479 pub fn delegate(
15480 mut self,
15481 new_value: &'a mut dyn common::Delegate,
15482 ) -> SiteChannelReleaseCreateCall<'a, C> {
15483 self._delegate = Some(new_value);
15484 self
15485 }
15486
15487 /// Set any additional parameter of the query string used in the request.
15488 /// It should be used to set parameters which are not yet available through their own
15489 /// setters.
15490 ///
15491 /// Please note that this method must not be used to set any of the known parameters
15492 /// which have their own setter method. If done anyway, the request will fail.
15493 ///
15494 /// # Additional Parameters
15495 ///
15496 /// * *$.xgafv* (query-string) - V1 error format.
15497 /// * *access_token* (query-string) - OAuth access token.
15498 /// * *alt* (query-string) - Data format for response.
15499 /// * *callback* (query-string) - JSONP
15500 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15501 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15502 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15503 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15504 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15505 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15506 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15507 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelReleaseCreateCall<'a, C>
15508 where
15509 T: AsRef<str>,
15510 {
15511 self._additional_params
15512 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15513 self
15514 }
15515
15516 /// Identifies the authorization scope for the method you are building.
15517 ///
15518 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15519 /// [`Scope::CloudPlatform`].
15520 ///
15521 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15522 /// tokens for more than one scope.
15523 ///
15524 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15525 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15526 /// sufficient, a read-write scope will do as well.
15527 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelReleaseCreateCall<'a, C>
15528 where
15529 St: AsRef<str>,
15530 {
15531 self._scopes.insert(String::from(scope.as_ref()));
15532 self
15533 }
15534 /// Identifies the authorization scope(s) for the method you are building.
15535 ///
15536 /// See [`Self::add_scope()`] for details.
15537 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelReleaseCreateCall<'a, C>
15538 where
15539 I: IntoIterator<Item = St>,
15540 St: AsRef<str>,
15541 {
15542 self._scopes
15543 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15544 self
15545 }
15546
15547 /// Removes all scopes, and no default scope will be used either.
15548 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15549 /// for details).
15550 pub fn clear_scopes(mut self) -> SiteChannelReleaseCreateCall<'a, C> {
15551 self._scopes.clear();
15552 self
15553 }
15554}
15555
15556/// Gets the specified release for a site or channel. When used to get a release for a site, this can get releases for both the default `live` channel and any active preview channels for the specified site.
15557///
15558/// A builder for the *channels.releases.get* method supported by a *site* resource.
15559/// It is not used directly, but through a [`SiteMethods`] instance.
15560///
15561/// # Example
15562///
15563/// Instantiate a resource method builder
15564///
15565/// ```test_harness,no_run
15566/// # extern crate hyper;
15567/// # extern crate hyper_rustls;
15568/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
15569/// # async fn dox() {
15570/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15571///
15572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15573/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15574/// # secret,
15575/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15576/// # ).build().await.unwrap();
15577///
15578/// # let client = hyper_util::client::legacy::Client::builder(
15579/// # hyper_util::rt::TokioExecutor::new()
15580/// # )
15581/// # .build(
15582/// # hyper_rustls::HttpsConnectorBuilder::new()
15583/// # .with_native_roots()
15584/// # .unwrap()
15585/// # .https_or_http()
15586/// # .enable_http1()
15587/// # .build()
15588/// # );
15589/// # let mut hub = FirebaseHosting::new(client, auth);
15590/// // You can configure optional parameters by calling the respective setters at will, and
15591/// // execute the final call using `doit()`.
15592/// // Values shown here are possibly random and not representative !
15593/// let result = hub.sites().channels_releases_get("name")
15594/// .doit().await;
15595/// # }
15596/// ```
15597pub struct SiteChannelReleaseGetCall<'a, C>
15598where
15599 C: 'a,
15600{
15601 hub: &'a FirebaseHosting<C>,
15602 _name: String,
15603 _delegate: Option<&'a mut dyn common::Delegate>,
15604 _additional_params: HashMap<String, String>,
15605 _scopes: BTreeSet<String>,
15606}
15607
15608impl<'a, C> common::CallBuilder for SiteChannelReleaseGetCall<'a, C> {}
15609
15610impl<'a, C> SiteChannelReleaseGetCall<'a, C>
15611where
15612 C: common::Connector,
15613{
15614 /// Perform the operation you have build so far.
15615 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
15616 use std::borrow::Cow;
15617 use std::io::{Read, Seek};
15618
15619 use common::{url::Params, ToParts};
15620 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15621
15622 let mut dd = common::DefaultDelegate;
15623 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15624 dlg.begin(common::MethodInfo {
15625 id: "firebasehosting.sites.channels.releases.get",
15626 http_method: hyper::Method::GET,
15627 });
15628
15629 for &field in ["alt", "name"].iter() {
15630 if self._additional_params.contains_key(field) {
15631 dlg.finished(false);
15632 return Err(common::Error::FieldClash(field));
15633 }
15634 }
15635
15636 let mut params = Params::with_capacity(3 + self._additional_params.len());
15637 params.push("name", self._name);
15638
15639 params.extend(self._additional_params.iter());
15640
15641 params.push("alt", "json");
15642 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
15643 if self._scopes.is_empty() {
15644 self._scopes
15645 .insert(Scope::FirebaseReadonly.as_ref().to_string());
15646 }
15647
15648 #[allow(clippy::single_element_loop)]
15649 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15650 url = params.uri_replacement(url, param_name, find_this, true);
15651 }
15652 {
15653 let to_remove = ["name"];
15654 params.remove_params(&to_remove);
15655 }
15656
15657 let url = params.parse_with_url(&url);
15658
15659 loop {
15660 let token = match self
15661 .hub
15662 .auth
15663 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15664 .await
15665 {
15666 Ok(token) => token,
15667 Err(e) => match dlg.token(e) {
15668 Ok(token) => token,
15669 Err(e) => {
15670 dlg.finished(false);
15671 return Err(common::Error::MissingToken(e));
15672 }
15673 },
15674 };
15675 let mut req_result = {
15676 let client = &self.hub.client;
15677 dlg.pre_request();
15678 let mut req_builder = hyper::Request::builder()
15679 .method(hyper::Method::GET)
15680 .uri(url.as_str())
15681 .header(USER_AGENT, self.hub._user_agent.clone());
15682
15683 if let Some(token) = token.as_ref() {
15684 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15685 }
15686
15687 let request = req_builder
15688 .header(CONTENT_LENGTH, 0_u64)
15689 .body(common::to_body::<String>(None));
15690
15691 client.request(request.unwrap()).await
15692 };
15693
15694 match req_result {
15695 Err(err) => {
15696 if let common::Retry::After(d) = dlg.http_error(&err) {
15697 sleep(d).await;
15698 continue;
15699 }
15700 dlg.finished(false);
15701 return Err(common::Error::HttpError(err));
15702 }
15703 Ok(res) => {
15704 let (mut parts, body) = res.into_parts();
15705 let mut body = common::Body::new(body);
15706 if !parts.status.is_success() {
15707 let bytes = common::to_bytes(body).await.unwrap_or_default();
15708 let error = serde_json::from_str(&common::to_string(&bytes));
15709 let response = common::to_response(parts, bytes.into());
15710
15711 if let common::Retry::After(d) =
15712 dlg.http_failure(&response, error.as_ref().ok())
15713 {
15714 sleep(d).await;
15715 continue;
15716 }
15717
15718 dlg.finished(false);
15719
15720 return Err(match error {
15721 Ok(value) => common::Error::BadRequest(value),
15722 _ => common::Error::Failure(response),
15723 });
15724 }
15725 let response = {
15726 let bytes = common::to_bytes(body).await.unwrap_or_default();
15727 let encoded = common::to_string(&bytes);
15728 match serde_json::from_str(&encoded) {
15729 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15730 Err(error) => {
15731 dlg.response_json_decode_error(&encoded, &error);
15732 return Err(common::Error::JsonDecodeError(
15733 encoded.to_string(),
15734 error,
15735 ));
15736 }
15737 }
15738 };
15739
15740 dlg.finished(true);
15741 return Ok(response);
15742 }
15743 }
15744 }
15745 }
15746
15747 /// Required. The fully-qualified resource name for the Hosting release, in either of the following formats: - sites/SITE_ID/channels/CHANNEL_ID/releases/RELEASE_ID - sites/SITE_ID/releases/RELEASE_ID
15748 ///
15749 /// Sets the *name* path property to the given value.
15750 ///
15751 /// Even though the property as already been set when instantiating this call,
15752 /// we provide this method for API completeness.
15753 pub fn name(mut self, new_value: &str) -> SiteChannelReleaseGetCall<'a, C> {
15754 self._name = new_value.to_string();
15755 self
15756 }
15757 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15758 /// while executing the actual API request.
15759 ///
15760 /// ````text
15761 /// It should be used to handle progress information, and to implement a certain level of resilience.
15762 /// ````
15763 ///
15764 /// Sets the *delegate* property to the given value.
15765 pub fn delegate(
15766 mut self,
15767 new_value: &'a mut dyn common::Delegate,
15768 ) -> SiteChannelReleaseGetCall<'a, C> {
15769 self._delegate = Some(new_value);
15770 self
15771 }
15772
15773 /// Set any additional parameter of the query string used in the request.
15774 /// It should be used to set parameters which are not yet available through their own
15775 /// setters.
15776 ///
15777 /// Please note that this method must not be used to set any of the known parameters
15778 /// which have their own setter method. If done anyway, the request will fail.
15779 ///
15780 /// # Additional Parameters
15781 ///
15782 /// * *$.xgafv* (query-string) - V1 error format.
15783 /// * *access_token* (query-string) - OAuth access token.
15784 /// * *alt* (query-string) - Data format for response.
15785 /// * *callback* (query-string) - JSONP
15786 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15787 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15788 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15789 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15790 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15791 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15792 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15793 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelReleaseGetCall<'a, C>
15794 where
15795 T: AsRef<str>,
15796 {
15797 self._additional_params
15798 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15799 self
15800 }
15801
15802 /// Identifies the authorization scope for the method you are building.
15803 ///
15804 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15805 /// [`Scope::FirebaseReadonly`].
15806 ///
15807 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15808 /// tokens for more than one scope.
15809 ///
15810 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15811 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15812 /// sufficient, a read-write scope will do as well.
15813 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelReleaseGetCall<'a, C>
15814 where
15815 St: AsRef<str>,
15816 {
15817 self._scopes.insert(String::from(scope.as_ref()));
15818 self
15819 }
15820 /// Identifies the authorization scope(s) for the method you are building.
15821 ///
15822 /// See [`Self::add_scope()`] for details.
15823 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelReleaseGetCall<'a, C>
15824 where
15825 I: IntoIterator<Item = St>,
15826 St: AsRef<str>,
15827 {
15828 self._scopes
15829 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15830 self
15831 }
15832
15833 /// Removes all scopes, and no default scope will be used either.
15834 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15835 /// for details).
15836 pub fn clear_scopes(mut self) -> SiteChannelReleaseGetCall<'a, C> {
15837 self._scopes.clear();
15838 self
15839 }
15840}
15841
15842/// Lists the releases that have been created for the specified site or channel. When used to list releases for a site, this list includes releases for both the default `live` channel and any active preview channels for the specified site.
15843///
15844/// A builder for the *channels.releases.list* method supported by a *site* resource.
15845/// It is not used directly, but through a [`SiteMethods`] instance.
15846///
15847/// # Example
15848///
15849/// Instantiate a resource method builder
15850///
15851/// ```test_harness,no_run
15852/// # extern crate hyper;
15853/// # extern crate hyper_rustls;
15854/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
15855/// # async fn dox() {
15856/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15857///
15858/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15859/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15860/// # secret,
15861/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15862/// # ).build().await.unwrap();
15863///
15864/// # let client = hyper_util::client::legacy::Client::builder(
15865/// # hyper_util::rt::TokioExecutor::new()
15866/// # )
15867/// # .build(
15868/// # hyper_rustls::HttpsConnectorBuilder::new()
15869/// # .with_native_roots()
15870/// # .unwrap()
15871/// # .https_or_http()
15872/// # .enable_http1()
15873/// # .build()
15874/// # );
15875/// # let mut hub = FirebaseHosting::new(client, auth);
15876/// // You can configure optional parameters by calling the respective setters at will, and
15877/// // execute the final call using `doit()`.
15878/// // Values shown here are possibly random and not representative !
15879/// let result = hub.sites().channels_releases_list("parent")
15880/// .page_token("sit")
15881/// .page_size(-35)
15882/// .doit().await;
15883/// # }
15884/// ```
15885pub struct SiteChannelReleaseListCall<'a, C>
15886where
15887 C: 'a,
15888{
15889 hub: &'a FirebaseHosting<C>,
15890 _parent: String,
15891 _page_token: Option<String>,
15892 _page_size: Option<i32>,
15893 _delegate: Option<&'a mut dyn common::Delegate>,
15894 _additional_params: HashMap<String, String>,
15895 _scopes: BTreeSet<String>,
15896}
15897
15898impl<'a, C> common::CallBuilder for SiteChannelReleaseListCall<'a, C> {}
15899
15900impl<'a, C> SiteChannelReleaseListCall<'a, C>
15901where
15902 C: common::Connector,
15903{
15904 /// Perform the operation you have build so far.
15905 pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
15906 use std::borrow::Cow;
15907 use std::io::{Read, Seek};
15908
15909 use common::{url::Params, ToParts};
15910 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15911
15912 let mut dd = common::DefaultDelegate;
15913 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15914 dlg.begin(common::MethodInfo {
15915 id: "firebasehosting.sites.channels.releases.list",
15916 http_method: hyper::Method::GET,
15917 });
15918
15919 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
15920 if self._additional_params.contains_key(field) {
15921 dlg.finished(false);
15922 return Err(common::Error::FieldClash(field));
15923 }
15924 }
15925
15926 let mut params = Params::with_capacity(5 + self._additional_params.len());
15927 params.push("parent", self._parent);
15928 if let Some(value) = self._page_token.as_ref() {
15929 params.push("pageToken", value);
15930 }
15931 if let Some(value) = self._page_size.as_ref() {
15932 params.push("pageSize", value.to_string());
15933 }
15934
15935 params.extend(self._additional_params.iter());
15936
15937 params.push("alt", "json");
15938 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
15939 if self._scopes.is_empty() {
15940 self._scopes
15941 .insert(Scope::FirebaseReadonly.as_ref().to_string());
15942 }
15943
15944 #[allow(clippy::single_element_loop)]
15945 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15946 url = params.uri_replacement(url, param_name, find_this, true);
15947 }
15948 {
15949 let to_remove = ["parent"];
15950 params.remove_params(&to_remove);
15951 }
15952
15953 let url = params.parse_with_url(&url);
15954
15955 loop {
15956 let token = match self
15957 .hub
15958 .auth
15959 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15960 .await
15961 {
15962 Ok(token) => token,
15963 Err(e) => match dlg.token(e) {
15964 Ok(token) => token,
15965 Err(e) => {
15966 dlg.finished(false);
15967 return Err(common::Error::MissingToken(e));
15968 }
15969 },
15970 };
15971 let mut req_result = {
15972 let client = &self.hub.client;
15973 dlg.pre_request();
15974 let mut req_builder = hyper::Request::builder()
15975 .method(hyper::Method::GET)
15976 .uri(url.as_str())
15977 .header(USER_AGENT, self.hub._user_agent.clone());
15978
15979 if let Some(token) = token.as_ref() {
15980 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15981 }
15982
15983 let request = req_builder
15984 .header(CONTENT_LENGTH, 0_u64)
15985 .body(common::to_body::<String>(None));
15986
15987 client.request(request.unwrap()).await
15988 };
15989
15990 match req_result {
15991 Err(err) => {
15992 if let common::Retry::After(d) = dlg.http_error(&err) {
15993 sleep(d).await;
15994 continue;
15995 }
15996 dlg.finished(false);
15997 return Err(common::Error::HttpError(err));
15998 }
15999 Ok(res) => {
16000 let (mut parts, body) = res.into_parts();
16001 let mut body = common::Body::new(body);
16002 if !parts.status.is_success() {
16003 let bytes = common::to_bytes(body).await.unwrap_or_default();
16004 let error = serde_json::from_str(&common::to_string(&bytes));
16005 let response = common::to_response(parts, bytes.into());
16006
16007 if let common::Retry::After(d) =
16008 dlg.http_failure(&response, error.as_ref().ok())
16009 {
16010 sleep(d).await;
16011 continue;
16012 }
16013
16014 dlg.finished(false);
16015
16016 return Err(match error {
16017 Ok(value) => common::Error::BadRequest(value),
16018 _ => common::Error::Failure(response),
16019 });
16020 }
16021 let response = {
16022 let bytes = common::to_bytes(body).await.unwrap_or_default();
16023 let encoded = common::to_string(&bytes);
16024 match serde_json::from_str(&encoded) {
16025 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16026 Err(error) => {
16027 dlg.response_json_decode_error(&encoded, &error);
16028 return Err(common::Error::JsonDecodeError(
16029 encoded.to_string(),
16030 error,
16031 ));
16032 }
16033 }
16034 };
16035
16036 dlg.finished(true);
16037 return Ok(response);
16038 }
16039 }
16040 }
16041 }
16042
16043 /// Required. The site or channel for which to list releases, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
16044 ///
16045 /// Sets the *parent* path property to the given value.
16046 ///
16047 /// Even though the property as already been set when instantiating this call,
16048 /// we provide this method for API completeness.
16049 pub fn parent(mut self, new_value: &str) -> SiteChannelReleaseListCall<'a, C> {
16050 self._parent = new_value.to_string();
16051 self
16052 }
16053 /// A token from a previous call to `releases.list` or `channels.releases.list` that tells the server where to resume listing.
16054 ///
16055 /// Sets the *page token* query property to the given value.
16056 pub fn page_token(mut self, new_value: &str) -> SiteChannelReleaseListCall<'a, C> {
16057 self._page_token = Some(new_value.to_string());
16058 self
16059 }
16060 /// The maximum number of releases to return. The service may return a lower number if fewer releases exist than this maximum number. If unspecified, defaults to 100.
16061 ///
16062 /// Sets the *page size* query property to the given value.
16063 pub fn page_size(mut self, new_value: i32) -> SiteChannelReleaseListCall<'a, C> {
16064 self._page_size = Some(new_value);
16065 self
16066 }
16067 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16068 /// while executing the actual API request.
16069 ///
16070 /// ````text
16071 /// It should be used to handle progress information, and to implement a certain level of resilience.
16072 /// ````
16073 ///
16074 /// Sets the *delegate* property to the given value.
16075 pub fn delegate(
16076 mut self,
16077 new_value: &'a mut dyn common::Delegate,
16078 ) -> SiteChannelReleaseListCall<'a, C> {
16079 self._delegate = Some(new_value);
16080 self
16081 }
16082
16083 /// Set any additional parameter of the query string used in the request.
16084 /// It should be used to set parameters which are not yet available through their own
16085 /// setters.
16086 ///
16087 /// Please note that this method must not be used to set any of the known parameters
16088 /// which have their own setter method. If done anyway, the request will fail.
16089 ///
16090 /// # Additional Parameters
16091 ///
16092 /// * *$.xgafv* (query-string) - V1 error format.
16093 /// * *access_token* (query-string) - OAuth access token.
16094 /// * *alt* (query-string) - Data format for response.
16095 /// * *callback* (query-string) - JSONP
16096 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16097 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16098 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16099 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16100 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16101 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16102 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16103 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelReleaseListCall<'a, C>
16104 where
16105 T: AsRef<str>,
16106 {
16107 self._additional_params
16108 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16109 self
16110 }
16111
16112 /// Identifies the authorization scope for the method you are building.
16113 ///
16114 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16115 /// [`Scope::FirebaseReadonly`].
16116 ///
16117 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16118 /// tokens for more than one scope.
16119 ///
16120 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16121 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16122 /// sufficient, a read-write scope will do as well.
16123 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelReleaseListCall<'a, C>
16124 where
16125 St: AsRef<str>,
16126 {
16127 self._scopes.insert(String::from(scope.as_ref()));
16128 self
16129 }
16130 /// Identifies the authorization scope(s) for the method you are building.
16131 ///
16132 /// See [`Self::add_scope()`] for details.
16133 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelReleaseListCall<'a, C>
16134 where
16135 I: IntoIterator<Item = St>,
16136 St: AsRef<str>,
16137 {
16138 self._scopes
16139 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16140 self
16141 }
16142
16143 /// Removes all scopes, and no default scope will be used either.
16144 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16145 /// for details).
16146 pub fn clear_scopes(mut self) -> SiteChannelReleaseListCall<'a, C> {
16147 self._scopes.clear();
16148 self
16149 }
16150}
16151
16152/// Creates a new channel in the specified site.
16153///
16154/// A builder for the *channels.create* method supported by a *site* resource.
16155/// It is not used directly, but through a [`SiteMethods`] instance.
16156///
16157/// # Example
16158///
16159/// Instantiate a resource method builder
16160///
16161/// ```test_harness,no_run
16162/// # extern crate hyper;
16163/// # extern crate hyper_rustls;
16164/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
16165/// use firebasehosting1_beta1::api::Channel;
16166/// # async fn dox() {
16167/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16168///
16169/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16170/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16171/// # secret,
16172/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16173/// # ).build().await.unwrap();
16174///
16175/// # let client = hyper_util::client::legacy::Client::builder(
16176/// # hyper_util::rt::TokioExecutor::new()
16177/// # )
16178/// # .build(
16179/// # hyper_rustls::HttpsConnectorBuilder::new()
16180/// # .with_native_roots()
16181/// # .unwrap()
16182/// # .https_or_http()
16183/// # .enable_http1()
16184/// # .build()
16185/// # );
16186/// # let mut hub = FirebaseHosting::new(client, auth);
16187/// // As the method needs a request, you would usually fill it with the desired information
16188/// // into the respective structure. Some of the parts shown here might not be applicable !
16189/// // Values shown here are possibly random and not representative !
16190/// let mut req = Channel::default();
16191///
16192/// // You can configure optional parameters by calling the respective setters at will, and
16193/// // execute the final call using `doit()`.
16194/// // Values shown here are possibly random and not representative !
16195/// let result = hub.sites().channels_create(req, "parent")
16196/// .channel_id("aliquyam")
16197/// .doit().await;
16198/// # }
16199/// ```
16200pub struct SiteChannelCreateCall<'a, C>
16201where
16202 C: 'a,
16203{
16204 hub: &'a FirebaseHosting<C>,
16205 _request: Channel,
16206 _parent: String,
16207 _channel_id: Option<String>,
16208 _delegate: Option<&'a mut dyn common::Delegate>,
16209 _additional_params: HashMap<String, String>,
16210 _scopes: BTreeSet<String>,
16211}
16212
16213impl<'a, C> common::CallBuilder for SiteChannelCreateCall<'a, C> {}
16214
16215impl<'a, C> SiteChannelCreateCall<'a, C>
16216where
16217 C: common::Connector,
16218{
16219 /// Perform the operation you have build so far.
16220 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
16221 use std::borrow::Cow;
16222 use std::io::{Read, Seek};
16223
16224 use common::{url::Params, ToParts};
16225 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16226
16227 let mut dd = common::DefaultDelegate;
16228 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16229 dlg.begin(common::MethodInfo {
16230 id: "firebasehosting.sites.channels.create",
16231 http_method: hyper::Method::POST,
16232 });
16233
16234 for &field in ["alt", "parent", "channelId"].iter() {
16235 if self._additional_params.contains_key(field) {
16236 dlg.finished(false);
16237 return Err(common::Error::FieldClash(field));
16238 }
16239 }
16240
16241 let mut params = Params::with_capacity(5 + self._additional_params.len());
16242 params.push("parent", self._parent);
16243 if let Some(value) = self._channel_id.as_ref() {
16244 params.push("channelId", value);
16245 }
16246
16247 params.extend(self._additional_params.iter());
16248
16249 params.push("alt", "json");
16250 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/channels";
16251 if self._scopes.is_empty() {
16252 self._scopes
16253 .insert(Scope::CloudPlatform.as_ref().to_string());
16254 }
16255
16256 #[allow(clippy::single_element_loop)]
16257 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16258 url = params.uri_replacement(url, param_name, find_this, true);
16259 }
16260 {
16261 let to_remove = ["parent"];
16262 params.remove_params(&to_remove);
16263 }
16264
16265 let url = params.parse_with_url(&url);
16266
16267 let mut json_mime_type = mime::APPLICATION_JSON;
16268 let mut request_value_reader = {
16269 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16270 common::remove_json_null_values(&mut value);
16271 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16272 serde_json::to_writer(&mut dst, &value).unwrap();
16273 dst
16274 };
16275 let request_size = request_value_reader
16276 .seek(std::io::SeekFrom::End(0))
16277 .unwrap();
16278 request_value_reader
16279 .seek(std::io::SeekFrom::Start(0))
16280 .unwrap();
16281
16282 loop {
16283 let token = match self
16284 .hub
16285 .auth
16286 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16287 .await
16288 {
16289 Ok(token) => token,
16290 Err(e) => match dlg.token(e) {
16291 Ok(token) => token,
16292 Err(e) => {
16293 dlg.finished(false);
16294 return Err(common::Error::MissingToken(e));
16295 }
16296 },
16297 };
16298 request_value_reader
16299 .seek(std::io::SeekFrom::Start(0))
16300 .unwrap();
16301 let mut req_result = {
16302 let client = &self.hub.client;
16303 dlg.pre_request();
16304 let mut req_builder = hyper::Request::builder()
16305 .method(hyper::Method::POST)
16306 .uri(url.as_str())
16307 .header(USER_AGENT, self.hub._user_agent.clone());
16308
16309 if let Some(token) = token.as_ref() {
16310 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16311 }
16312
16313 let request = req_builder
16314 .header(CONTENT_TYPE, json_mime_type.to_string())
16315 .header(CONTENT_LENGTH, request_size as u64)
16316 .body(common::to_body(
16317 request_value_reader.get_ref().clone().into(),
16318 ));
16319
16320 client.request(request.unwrap()).await
16321 };
16322
16323 match req_result {
16324 Err(err) => {
16325 if let common::Retry::After(d) = dlg.http_error(&err) {
16326 sleep(d).await;
16327 continue;
16328 }
16329 dlg.finished(false);
16330 return Err(common::Error::HttpError(err));
16331 }
16332 Ok(res) => {
16333 let (mut parts, body) = res.into_parts();
16334 let mut body = common::Body::new(body);
16335 if !parts.status.is_success() {
16336 let bytes = common::to_bytes(body).await.unwrap_or_default();
16337 let error = serde_json::from_str(&common::to_string(&bytes));
16338 let response = common::to_response(parts, bytes.into());
16339
16340 if let common::Retry::After(d) =
16341 dlg.http_failure(&response, error.as_ref().ok())
16342 {
16343 sleep(d).await;
16344 continue;
16345 }
16346
16347 dlg.finished(false);
16348
16349 return Err(match error {
16350 Ok(value) => common::Error::BadRequest(value),
16351 _ => common::Error::Failure(response),
16352 });
16353 }
16354 let response = {
16355 let bytes = common::to_bytes(body).await.unwrap_or_default();
16356 let encoded = common::to_string(&bytes);
16357 match serde_json::from_str(&encoded) {
16358 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16359 Err(error) => {
16360 dlg.response_json_decode_error(&encoded, &error);
16361 return Err(common::Error::JsonDecodeError(
16362 encoded.to_string(),
16363 error,
16364 ));
16365 }
16366 }
16367 };
16368
16369 dlg.finished(true);
16370 return Ok(response);
16371 }
16372 }
16373 }
16374 }
16375
16376 ///
16377 /// Sets the *request* property to the given value.
16378 ///
16379 /// Even though the property as already been set when instantiating this call,
16380 /// we provide this method for API completeness.
16381 pub fn request(mut self, new_value: Channel) -> SiteChannelCreateCall<'a, C> {
16382 self._request = new_value;
16383 self
16384 }
16385 /// Required. The site in which to create this channel, in the format: sites/ SITE_ID
16386 ///
16387 /// Sets the *parent* path property to the given value.
16388 ///
16389 /// Even though the property as already been set when instantiating this call,
16390 /// we provide this method for API completeness.
16391 pub fn parent(mut self, new_value: &str) -> SiteChannelCreateCall<'a, C> {
16392 self._parent = new_value.to_string();
16393 self
16394 }
16395 /// Required. Immutable. A unique ID within the site that identifies the channel.
16396 ///
16397 /// Sets the *channel id* query property to the given value.
16398 pub fn channel_id(mut self, new_value: &str) -> SiteChannelCreateCall<'a, C> {
16399 self._channel_id = Some(new_value.to_string());
16400 self
16401 }
16402 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16403 /// while executing the actual API request.
16404 ///
16405 /// ````text
16406 /// It should be used to handle progress information, and to implement a certain level of resilience.
16407 /// ````
16408 ///
16409 /// Sets the *delegate* property to the given value.
16410 pub fn delegate(
16411 mut self,
16412 new_value: &'a mut dyn common::Delegate,
16413 ) -> SiteChannelCreateCall<'a, C> {
16414 self._delegate = Some(new_value);
16415 self
16416 }
16417
16418 /// Set any additional parameter of the query string used in the request.
16419 /// It should be used to set parameters which are not yet available through their own
16420 /// setters.
16421 ///
16422 /// Please note that this method must not be used to set any of the known parameters
16423 /// which have their own setter method. If done anyway, the request will fail.
16424 ///
16425 /// # Additional Parameters
16426 ///
16427 /// * *$.xgafv* (query-string) - V1 error format.
16428 /// * *access_token* (query-string) - OAuth access token.
16429 /// * *alt* (query-string) - Data format for response.
16430 /// * *callback* (query-string) - JSONP
16431 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16432 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16433 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16434 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16435 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16436 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16437 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16438 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelCreateCall<'a, C>
16439 where
16440 T: AsRef<str>,
16441 {
16442 self._additional_params
16443 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16444 self
16445 }
16446
16447 /// Identifies the authorization scope for the method you are building.
16448 ///
16449 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16450 /// [`Scope::CloudPlatform`].
16451 ///
16452 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16453 /// tokens for more than one scope.
16454 ///
16455 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16456 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16457 /// sufficient, a read-write scope will do as well.
16458 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelCreateCall<'a, C>
16459 where
16460 St: AsRef<str>,
16461 {
16462 self._scopes.insert(String::from(scope.as_ref()));
16463 self
16464 }
16465 /// Identifies the authorization scope(s) for the method you are building.
16466 ///
16467 /// See [`Self::add_scope()`] for details.
16468 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelCreateCall<'a, C>
16469 where
16470 I: IntoIterator<Item = St>,
16471 St: AsRef<str>,
16472 {
16473 self._scopes
16474 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16475 self
16476 }
16477
16478 /// Removes all scopes, and no default scope will be used either.
16479 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16480 /// for details).
16481 pub fn clear_scopes(mut self) -> SiteChannelCreateCall<'a, C> {
16482 self._scopes.clear();
16483 self
16484 }
16485}
16486
16487/// Deletes the specified channel of the specified site. The `live` channel cannot be deleted.
16488///
16489/// A builder for the *channels.delete* method supported by a *site* resource.
16490/// It is not used directly, but through a [`SiteMethods`] instance.
16491///
16492/// # Example
16493///
16494/// Instantiate a resource method builder
16495///
16496/// ```test_harness,no_run
16497/// # extern crate hyper;
16498/// # extern crate hyper_rustls;
16499/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
16500/// # async fn dox() {
16501/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16502///
16503/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16504/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16505/// # secret,
16506/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16507/// # ).build().await.unwrap();
16508///
16509/// # let client = hyper_util::client::legacy::Client::builder(
16510/// # hyper_util::rt::TokioExecutor::new()
16511/// # )
16512/// # .build(
16513/// # hyper_rustls::HttpsConnectorBuilder::new()
16514/// # .with_native_roots()
16515/// # .unwrap()
16516/// # .https_or_http()
16517/// # .enable_http1()
16518/// # .build()
16519/// # );
16520/// # let mut hub = FirebaseHosting::new(client, auth);
16521/// // You can configure optional parameters by calling the respective setters at will, and
16522/// // execute the final call using `doit()`.
16523/// // Values shown here are possibly random and not representative !
16524/// let result = hub.sites().channels_delete("name")
16525/// .doit().await;
16526/// # }
16527/// ```
16528pub struct SiteChannelDeleteCall<'a, C>
16529where
16530 C: 'a,
16531{
16532 hub: &'a FirebaseHosting<C>,
16533 _name: String,
16534 _delegate: Option<&'a mut dyn common::Delegate>,
16535 _additional_params: HashMap<String, String>,
16536 _scopes: BTreeSet<String>,
16537}
16538
16539impl<'a, C> common::CallBuilder for SiteChannelDeleteCall<'a, C> {}
16540
16541impl<'a, C> SiteChannelDeleteCall<'a, C>
16542where
16543 C: common::Connector,
16544{
16545 /// Perform the operation you have build so far.
16546 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
16547 use std::borrow::Cow;
16548 use std::io::{Read, Seek};
16549
16550 use common::{url::Params, ToParts};
16551 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16552
16553 let mut dd = common::DefaultDelegate;
16554 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16555 dlg.begin(common::MethodInfo {
16556 id: "firebasehosting.sites.channels.delete",
16557 http_method: hyper::Method::DELETE,
16558 });
16559
16560 for &field in ["alt", "name"].iter() {
16561 if self._additional_params.contains_key(field) {
16562 dlg.finished(false);
16563 return Err(common::Error::FieldClash(field));
16564 }
16565 }
16566
16567 let mut params = Params::with_capacity(3 + self._additional_params.len());
16568 params.push("name", self._name);
16569
16570 params.extend(self._additional_params.iter());
16571
16572 params.push("alt", "json");
16573 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
16574 if self._scopes.is_empty() {
16575 self._scopes
16576 .insert(Scope::CloudPlatform.as_ref().to_string());
16577 }
16578
16579 #[allow(clippy::single_element_loop)]
16580 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16581 url = params.uri_replacement(url, param_name, find_this, true);
16582 }
16583 {
16584 let to_remove = ["name"];
16585 params.remove_params(&to_remove);
16586 }
16587
16588 let url = params.parse_with_url(&url);
16589
16590 loop {
16591 let token = match self
16592 .hub
16593 .auth
16594 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16595 .await
16596 {
16597 Ok(token) => token,
16598 Err(e) => match dlg.token(e) {
16599 Ok(token) => token,
16600 Err(e) => {
16601 dlg.finished(false);
16602 return Err(common::Error::MissingToken(e));
16603 }
16604 },
16605 };
16606 let mut req_result = {
16607 let client = &self.hub.client;
16608 dlg.pre_request();
16609 let mut req_builder = hyper::Request::builder()
16610 .method(hyper::Method::DELETE)
16611 .uri(url.as_str())
16612 .header(USER_AGENT, self.hub._user_agent.clone());
16613
16614 if let Some(token) = token.as_ref() {
16615 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16616 }
16617
16618 let request = req_builder
16619 .header(CONTENT_LENGTH, 0_u64)
16620 .body(common::to_body::<String>(None));
16621
16622 client.request(request.unwrap()).await
16623 };
16624
16625 match req_result {
16626 Err(err) => {
16627 if let common::Retry::After(d) = dlg.http_error(&err) {
16628 sleep(d).await;
16629 continue;
16630 }
16631 dlg.finished(false);
16632 return Err(common::Error::HttpError(err));
16633 }
16634 Ok(res) => {
16635 let (mut parts, body) = res.into_parts();
16636 let mut body = common::Body::new(body);
16637 if !parts.status.is_success() {
16638 let bytes = common::to_bytes(body).await.unwrap_or_default();
16639 let error = serde_json::from_str(&common::to_string(&bytes));
16640 let response = common::to_response(parts, bytes.into());
16641
16642 if let common::Retry::After(d) =
16643 dlg.http_failure(&response, error.as_ref().ok())
16644 {
16645 sleep(d).await;
16646 continue;
16647 }
16648
16649 dlg.finished(false);
16650
16651 return Err(match error {
16652 Ok(value) => common::Error::BadRequest(value),
16653 _ => common::Error::Failure(response),
16654 });
16655 }
16656 let response = {
16657 let bytes = common::to_bytes(body).await.unwrap_or_default();
16658 let encoded = common::to_string(&bytes);
16659 match serde_json::from_str(&encoded) {
16660 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16661 Err(error) => {
16662 dlg.response_json_decode_error(&encoded, &error);
16663 return Err(common::Error::JsonDecodeError(
16664 encoded.to_string(),
16665 error,
16666 ));
16667 }
16668 }
16669 };
16670
16671 dlg.finished(true);
16672 return Ok(response);
16673 }
16674 }
16675 }
16676 }
16677
16678 /// Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
16679 ///
16680 /// Sets the *name* path property to the given value.
16681 ///
16682 /// Even though the property as already been set when instantiating this call,
16683 /// we provide this method for API completeness.
16684 pub fn name(mut self, new_value: &str) -> SiteChannelDeleteCall<'a, C> {
16685 self._name = new_value.to_string();
16686 self
16687 }
16688 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16689 /// while executing the actual API request.
16690 ///
16691 /// ````text
16692 /// It should be used to handle progress information, and to implement a certain level of resilience.
16693 /// ````
16694 ///
16695 /// Sets the *delegate* property to the given value.
16696 pub fn delegate(
16697 mut self,
16698 new_value: &'a mut dyn common::Delegate,
16699 ) -> SiteChannelDeleteCall<'a, C> {
16700 self._delegate = Some(new_value);
16701 self
16702 }
16703
16704 /// Set any additional parameter of the query string used in the request.
16705 /// It should be used to set parameters which are not yet available through their own
16706 /// setters.
16707 ///
16708 /// Please note that this method must not be used to set any of the known parameters
16709 /// which have their own setter method. If done anyway, the request will fail.
16710 ///
16711 /// # Additional Parameters
16712 ///
16713 /// * *$.xgafv* (query-string) - V1 error format.
16714 /// * *access_token* (query-string) - OAuth access token.
16715 /// * *alt* (query-string) - Data format for response.
16716 /// * *callback* (query-string) - JSONP
16717 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16718 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16719 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16720 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16721 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16722 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16723 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16724 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelDeleteCall<'a, C>
16725 where
16726 T: AsRef<str>,
16727 {
16728 self._additional_params
16729 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16730 self
16731 }
16732
16733 /// Identifies the authorization scope for the method you are building.
16734 ///
16735 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16736 /// [`Scope::CloudPlatform`].
16737 ///
16738 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16739 /// tokens for more than one scope.
16740 ///
16741 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16742 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16743 /// sufficient, a read-write scope will do as well.
16744 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelDeleteCall<'a, C>
16745 where
16746 St: AsRef<str>,
16747 {
16748 self._scopes.insert(String::from(scope.as_ref()));
16749 self
16750 }
16751 /// Identifies the authorization scope(s) for the method you are building.
16752 ///
16753 /// See [`Self::add_scope()`] for details.
16754 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelDeleteCall<'a, C>
16755 where
16756 I: IntoIterator<Item = St>,
16757 St: AsRef<str>,
16758 {
16759 self._scopes
16760 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16761 self
16762 }
16763
16764 /// Removes all scopes, and no default scope will be used either.
16765 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16766 /// for details).
16767 pub fn clear_scopes(mut self) -> SiteChannelDeleteCall<'a, C> {
16768 self._scopes.clear();
16769 self
16770 }
16771}
16772
16773/// Retrieves information for the specified channel of the specified site.
16774///
16775/// A builder for the *channels.get* method supported by a *site* resource.
16776/// It is not used directly, but through a [`SiteMethods`] instance.
16777///
16778/// # Example
16779///
16780/// Instantiate a resource method builder
16781///
16782/// ```test_harness,no_run
16783/// # extern crate hyper;
16784/// # extern crate hyper_rustls;
16785/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
16786/// # async fn dox() {
16787/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16788///
16789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16790/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16791/// # secret,
16792/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16793/// # ).build().await.unwrap();
16794///
16795/// # let client = hyper_util::client::legacy::Client::builder(
16796/// # hyper_util::rt::TokioExecutor::new()
16797/// # )
16798/// # .build(
16799/// # hyper_rustls::HttpsConnectorBuilder::new()
16800/// # .with_native_roots()
16801/// # .unwrap()
16802/// # .https_or_http()
16803/// # .enable_http1()
16804/// # .build()
16805/// # );
16806/// # let mut hub = FirebaseHosting::new(client, auth);
16807/// // You can configure optional parameters by calling the respective setters at will, and
16808/// // execute the final call using `doit()`.
16809/// // Values shown here are possibly random and not representative !
16810/// let result = hub.sites().channels_get("name")
16811/// .doit().await;
16812/// # }
16813/// ```
16814pub struct SiteChannelGetCall<'a, C>
16815where
16816 C: 'a,
16817{
16818 hub: &'a FirebaseHosting<C>,
16819 _name: String,
16820 _delegate: Option<&'a mut dyn common::Delegate>,
16821 _additional_params: HashMap<String, String>,
16822 _scopes: BTreeSet<String>,
16823}
16824
16825impl<'a, C> common::CallBuilder for SiteChannelGetCall<'a, C> {}
16826
16827impl<'a, C> SiteChannelGetCall<'a, C>
16828where
16829 C: common::Connector,
16830{
16831 /// Perform the operation you have build so far.
16832 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
16833 use std::borrow::Cow;
16834 use std::io::{Read, Seek};
16835
16836 use common::{url::Params, ToParts};
16837 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16838
16839 let mut dd = common::DefaultDelegate;
16840 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16841 dlg.begin(common::MethodInfo {
16842 id: "firebasehosting.sites.channels.get",
16843 http_method: hyper::Method::GET,
16844 });
16845
16846 for &field in ["alt", "name"].iter() {
16847 if self._additional_params.contains_key(field) {
16848 dlg.finished(false);
16849 return Err(common::Error::FieldClash(field));
16850 }
16851 }
16852
16853 let mut params = Params::with_capacity(3 + self._additional_params.len());
16854 params.push("name", self._name);
16855
16856 params.extend(self._additional_params.iter());
16857
16858 params.push("alt", "json");
16859 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
16860 if self._scopes.is_empty() {
16861 self._scopes
16862 .insert(Scope::FirebaseReadonly.as_ref().to_string());
16863 }
16864
16865 #[allow(clippy::single_element_loop)]
16866 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16867 url = params.uri_replacement(url, param_name, find_this, true);
16868 }
16869 {
16870 let to_remove = ["name"];
16871 params.remove_params(&to_remove);
16872 }
16873
16874 let url = params.parse_with_url(&url);
16875
16876 loop {
16877 let token = match self
16878 .hub
16879 .auth
16880 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16881 .await
16882 {
16883 Ok(token) => token,
16884 Err(e) => match dlg.token(e) {
16885 Ok(token) => token,
16886 Err(e) => {
16887 dlg.finished(false);
16888 return Err(common::Error::MissingToken(e));
16889 }
16890 },
16891 };
16892 let mut req_result = {
16893 let client = &self.hub.client;
16894 dlg.pre_request();
16895 let mut req_builder = hyper::Request::builder()
16896 .method(hyper::Method::GET)
16897 .uri(url.as_str())
16898 .header(USER_AGENT, self.hub._user_agent.clone());
16899
16900 if let Some(token) = token.as_ref() {
16901 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16902 }
16903
16904 let request = req_builder
16905 .header(CONTENT_LENGTH, 0_u64)
16906 .body(common::to_body::<String>(None));
16907
16908 client.request(request.unwrap()).await
16909 };
16910
16911 match req_result {
16912 Err(err) => {
16913 if let common::Retry::After(d) = dlg.http_error(&err) {
16914 sleep(d).await;
16915 continue;
16916 }
16917 dlg.finished(false);
16918 return Err(common::Error::HttpError(err));
16919 }
16920 Ok(res) => {
16921 let (mut parts, body) = res.into_parts();
16922 let mut body = common::Body::new(body);
16923 if !parts.status.is_success() {
16924 let bytes = common::to_bytes(body).await.unwrap_or_default();
16925 let error = serde_json::from_str(&common::to_string(&bytes));
16926 let response = common::to_response(parts, bytes.into());
16927
16928 if let common::Retry::After(d) =
16929 dlg.http_failure(&response, error.as_ref().ok())
16930 {
16931 sleep(d).await;
16932 continue;
16933 }
16934
16935 dlg.finished(false);
16936
16937 return Err(match error {
16938 Ok(value) => common::Error::BadRequest(value),
16939 _ => common::Error::Failure(response),
16940 });
16941 }
16942 let response = {
16943 let bytes = common::to_bytes(body).await.unwrap_or_default();
16944 let encoded = common::to_string(&bytes);
16945 match serde_json::from_str(&encoded) {
16946 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16947 Err(error) => {
16948 dlg.response_json_decode_error(&encoded, &error);
16949 return Err(common::Error::JsonDecodeError(
16950 encoded.to_string(),
16951 error,
16952 ));
16953 }
16954 }
16955 };
16956
16957 dlg.finished(true);
16958 return Ok(response);
16959 }
16960 }
16961 }
16962 }
16963
16964 /// Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
16965 ///
16966 /// Sets the *name* path property to the given value.
16967 ///
16968 /// Even though the property as already been set when instantiating this call,
16969 /// we provide this method for API completeness.
16970 pub fn name(mut self, new_value: &str) -> SiteChannelGetCall<'a, C> {
16971 self._name = new_value.to_string();
16972 self
16973 }
16974 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16975 /// while executing the actual API request.
16976 ///
16977 /// ````text
16978 /// It should be used to handle progress information, and to implement a certain level of resilience.
16979 /// ````
16980 ///
16981 /// Sets the *delegate* property to the given value.
16982 pub fn delegate(
16983 mut self,
16984 new_value: &'a mut dyn common::Delegate,
16985 ) -> SiteChannelGetCall<'a, C> {
16986 self._delegate = Some(new_value);
16987 self
16988 }
16989
16990 /// Set any additional parameter of the query string used in the request.
16991 /// It should be used to set parameters which are not yet available through their own
16992 /// setters.
16993 ///
16994 /// Please note that this method must not be used to set any of the known parameters
16995 /// which have their own setter method. If done anyway, the request will fail.
16996 ///
16997 /// # Additional Parameters
16998 ///
16999 /// * *$.xgafv* (query-string) - V1 error format.
17000 /// * *access_token* (query-string) - OAuth access token.
17001 /// * *alt* (query-string) - Data format for response.
17002 /// * *callback* (query-string) - JSONP
17003 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17004 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17005 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17006 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17007 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17008 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17009 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17010 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelGetCall<'a, C>
17011 where
17012 T: AsRef<str>,
17013 {
17014 self._additional_params
17015 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17016 self
17017 }
17018
17019 /// Identifies the authorization scope for the method you are building.
17020 ///
17021 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17022 /// [`Scope::FirebaseReadonly`].
17023 ///
17024 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17025 /// tokens for more than one scope.
17026 ///
17027 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17028 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17029 /// sufficient, a read-write scope will do as well.
17030 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelGetCall<'a, C>
17031 where
17032 St: AsRef<str>,
17033 {
17034 self._scopes.insert(String::from(scope.as_ref()));
17035 self
17036 }
17037 /// Identifies the authorization scope(s) for the method you are building.
17038 ///
17039 /// See [`Self::add_scope()`] for details.
17040 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelGetCall<'a, C>
17041 where
17042 I: IntoIterator<Item = St>,
17043 St: AsRef<str>,
17044 {
17045 self._scopes
17046 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17047 self
17048 }
17049
17050 /// Removes all scopes, and no default scope will be used either.
17051 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17052 /// for details).
17053 pub fn clear_scopes(mut self) -> SiteChannelGetCall<'a, C> {
17054 self._scopes.clear();
17055 self
17056 }
17057}
17058
17059/// Lists the channels for the specified site. All sites have a default `live` channel.
17060///
17061/// A builder for the *channels.list* method supported by a *site* resource.
17062/// It is not used directly, but through a [`SiteMethods`] instance.
17063///
17064/// # Example
17065///
17066/// Instantiate a resource method builder
17067///
17068/// ```test_harness,no_run
17069/// # extern crate hyper;
17070/// # extern crate hyper_rustls;
17071/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
17072/// # async fn dox() {
17073/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17074///
17075/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17076/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17077/// # secret,
17078/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17079/// # ).build().await.unwrap();
17080///
17081/// # let client = hyper_util::client::legacy::Client::builder(
17082/// # hyper_util::rt::TokioExecutor::new()
17083/// # )
17084/// # .build(
17085/// # hyper_rustls::HttpsConnectorBuilder::new()
17086/// # .with_native_roots()
17087/// # .unwrap()
17088/// # .https_or_http()
17089/// # .enable_http1()
17090/// # .build()
17091/// # );
17092/// # let mut hub = FirebaseHosting::new(client, auth);
17093/// // You can configure optional parameters by calling the respective setters at will, and
17094/// // execute the final call using `doit()`.
17095/// // Values shown here are possibly random and not representative !
17096/// let result = hub.sites().channels_list("parent")
17097/// .page_token("Lorem")
17098/// .page_size(-7)
17099/// .doit().await;
17100/// # }
17101/// ```
17102pub struct SiteChannelListCall<'a, C>
17103where
17104 C: 'a,
17105{
17106 hub: &'a FirebaseHosting<C>,
17107 _parent: String,
17108 _page_token: Option<String>,
17109 _page_size: Option<i32>,
17110 _delegate: Option<&'a mut dyn common::Delegate>,
17111 _additional_params: HashMap<String, String>,
17112 _scopes: BTreeSet<String>,
17113}
17114
17115impl<'a, C> common::CallBuilder for SiteChannelListCall<'a, C> {}
17116
17117impl<'a, C> SiteChannelListCall<'a, C>
17118where
17119 C: common::Connector,
17120{
17121 /// Perform the operation you have build so far.
17122 pub async fn doit(mut self) -> common::Result<(common::Response, ListChannelsResponse)> {
17123 use std::borrow::Cow;
17124 use std::io::{Read, Seek};
17125
17126 use common::{url::Params, ToParts};
17127 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17128
17129 let mut dd = common::DefaultDelegate;
17130 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17131 dlg.begin(common::MethodInfo {
17132 id: "firebasehosting.sites.channels.list",
17133 http_method: hyper::Method::GET,
17134 });
17135
17136 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
17137 if self._additional_params.contains_key(field) {
17138 dlg.finished(false);
17139 return Err(common::Error::FieldClash(field));
17140 }
17141 }
17142
17143 let mut params = Params::with_capacity(5 + self._additional_params.len());
17144 params.push("parent", self._parent);
17145 if let Some(value) = self._page_token.as_ref() {
17146 params.push("pageToken", value);
17147 }
17148 if let Some(value) = self._page_size.as_ref() {
17149 params.push("pageSize", value.to_string());
17150 }
17151
17152 params.extend(self._additional_params.iter());
17153
17154 params.push("alt", "json");
17155 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/channels";
17156 if self._scopes.is_empty() {
17157 self._scopes
17158 .insert(Scope::FirebaseReadonly.as_ref().to_string());
17159 }
17160
17161 #[allow(clippy::single_element_loop)]
17162 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17163 url = params.uri_replacement(url, param_name, find_this, true);
17164 }
17165 {
17166 let to_remove = ["parent"];
17167 params.remove_params(&to_remove);
17168 }
17169
17170 let url = params.parse_with_url(&url);
17171
17172 loop {
17173 let token = match self
17174 .hub
17175 .auth
17176 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17177 .await
17178 {
17179 Ok(token) => token,
17180 Err(e) => match dlg.token(e) {
17181 Ok(token) => token,
17182 Err(e) => {
17183 dlg.finished(false);
17184 return Err(common::Error::MissingToken(e));
17185 }
17186 },
17187 };
17188 let mut req_result = {
17189 let client = &self.hub.client;
17190 dlg.pre_request();
17191 let mut req_builder = hyper::Request::builder()
17192 .method(hyper::Method::GET)
17193 .uri(url.as_str())
17194 .header(USER_AGENT, self.hub._user_agent.clone());
17195
17196 if let Some(token) = token.as_ref() {
17197 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17198 }
17199
17200 let request = req_builder
17201 .header(CONTENT_LENGTH, 0_u64)
17202 .body(common::to_body::<String>(None));
17203
17204 client.request(request.unwrap()).await
17205 };
17206
17207 match req_result {
17208 Err(err) => {
17209 if let common::Retry::After(d) = dlg.http_error(&err) {
17210 sleep(d).await;
17211 continue;
17212 }
17213 dlg.finished(false);
17214 return Err(common::Error::HttpError(err));
17215 }
17216 Ok(res) => {
17217 let (mut parts, body) = res.into_parts();
17218 let mut body = common::Body::new(body);
17219 if !parts.status.is_success() {
17220 let bytes = common::to_bytes(body).await.unwrap_or_default();
17221 let error = serde_json::from_str(&common::to_string(&bytes));
17222 let response = common::to_response(parts, bytes.into());
17223
17224 if let common::Retry::After(d) =
17225 dlg.http_failure(&response, error.as_ref().ok())
17226 {
17227 sleep(d).await;
17228 continue;
17229 }
17230
17231 dlg.finished(false);
17232
17233 return Err(match error {
17234 Ok(value) => common::Error::BadRequest(value),
17235 _ => common::Error::Failure(response),
17236 });
17237 }
17238 let response = {
17239 let bytes = common::to_bytes(body).await.unwrap_or_default();
17240 let encoded = common::to_string(&bytes);
17241 match serde_json::from_str(&encoded) {
17242 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17243 Err(error) => {
17244 dlg.response_json_decode_error(&encoded, &error);
17245 return Err(common::Error::JsonDecodeError(
17246 encoded.to_string(),
17247 error,
17248 ));
17249 }
17250 }
17251 };
17252
17253 dlg.finished(true);
17254 return Ok(response);
17255 }
17256 }
17257 }
17258 }
17259
17260 /// Required. The site for which to list channels, in the format: sites/SITE_ID
17261 ///
17262 /// Sets the *parent* path property to the given value.
17263 ///
17264 /// Even though the property as already been set when instantiating this call,
17265 /// we provide this method for API completeness.
17266 pub fn parent(mut self, new_value: &str) -> SiteChannelListCall<'a, C> {
17267 self._parent = new_value.to_string();
17268 self
17269 }
17270 /// A token from a previous call to `ListChannels` that tells the server where to resume listing.
17271 ///
17272 /// Sets the *page token* query property to the given value.
17273 pub fn page_token(mut self, new_value: &str) -> SiteChannelListCall<'a, C> {
17274 self._page_token = Some(new_value.to_string());
17275 self
17276 }
17277 /// The maximum number of channels to return. The service may return a lower number if fewer channels exist than this maximum number. If unspecified, defaults to 10. The maximum value is 100; values above 100 will be coerced to 100.
17278 ///
17279 /// Sets the *page size* query property to the given value.
17280 pub fn page_size(mut self, new_value: i32) -> SiteChannelListCall<'a, C> {
17281 self._page_size = Some(new_value);
17282 self
17283 }
17284 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17285 /// while executing the actual API request.
17286 ///
17287 /// ````text
17288 /// It should be used to handle progress information, and to implement a certain level of resilience.
17289 /// ````
17290 ///
17291 /// Sets the *delegate* property to the given value.
17292 pub fn delegate(
17293 mut self,
17294 new_value: &'a mut dyn common::Delegate,
17295 ) -> SiteChannelListCall<'a, C> {
17296 self._delegate = Some(new_value);
17297 self
17298 }
17299
17300 /// Set any additional parameter of the query string used in the request.
17301 /// It should be used to set parameters which are not yet available through their own
17302 /// setters.
17303 ///
17304 /// Please note that this method must not be used to set any of the known parameters
17305 /// which have their own setter method. If done anyway, the request will fail.
17306 ///
17307 /// # Additional Parameters
17308 ///
17309 /// * *$.xgafv* (query-string) - V1 error format.
17310 /// * *access_token* (query-string) - OAuth access token.
17311 /// * *alt* (query-string) - Data format for response.
17312 /// * *callback* (query-string) - JSONP
17313 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17314 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17315 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17316 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17317 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17318 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17319 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17320 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelListCall<'a, C>
17321 where
17322 T: AsRef<str>,
17323 {
17324 self._additional_params
17325 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17326 self
17327 }
17328
17329 /// Identifies the authorization scope for the method you are building.
17330 ///
17331 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17332 /// [`Scope::FirebaseReadonly`].
17333 ///
17334 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17335 /// tokens for more than one scope.
17336 ///
17337 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17338 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17339 /// sufficient, a read-write scope will do as well.
17340 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelListCall<'a, C>
17341 where
17342 St: AsRef<str>,
17343 {
17344 self._scopes.insert(String::from(scope.as_ref()));
17345 self
17346 }
17347 /// Identifies the authorization scope(s) for the method you are building.
17348 ///
17349 /// See [`Self::add_scope()`] for details.
17350 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelListCall<'a, C>
17351 where
17352 I: IntoIterator<Item = St>,
17353 St: AsRef<str>,
17354 {
17355 self._scopes
17356 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17357 self
17358 }
17359
17360 /// Removes all scopes, and no default scope will be used either.
17361 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17362 /// for details).
17363 pub fn clear_scopes(mut self) -> SiteChannelListCall<'a, C> {
17364 self._scopes.clear();
17365 self
17366 }
17367}
17368
17369/// Updates information for the specified channel of the specified site. Implicitly creates the channel if it doesn't already exist.
17370///
17371/// A builder for the *channels.patch* method supported by a *site* resource.
17372/// It is not used directly, but through a [`SiteMethods`] instance.
17373///
17374/// # Example
17375///
17376/// Instantiate a resource method builder
17377///
17378/// ```test_harness,no_run
17379/// # extern crate hyper;
17380/// # extern crate hyper_rustls;
17381/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
17382/// use firebasehosting1_beta1::api::Channel;
17383/// # async fn dox() {
17384/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17385///
17386/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17387/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17388/// # secret,
17389/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17390/// # ).build().await.unwrap();
17391///
17392/// # let client = hyper_util::client::legacy::Client::builder(
17393/// # hyper_util::rt::TokioExecutor::new()
17394/// # )
17395/// # .build(
17396/// # hyper_rustls::HttpsConnectorBuilder::new()
17397/// # .with_native_roots()
17398/// # .unwrap()
17399/// # .https_or_http()
17400/// # .enable_http1()
17401/// # .build()
17402/// # );
17403/// # let mut hub = FirebaseHosting::new(client, auth);
17404/// // As the method needs a request, you would usually fill it with the desired information
17405/// // into the respective structure. Some of the parts shown here might not be applicable !
17406/// // Values shown here are possibly random and not representative !
17407/// let mut req = Channel::default();
17408///
17409/// // You can configure optional parameters by calling the respective setters at will, and
17410/// // execute the final call using `doit()`.
17411/// // Values shown here are possibly random and not representative !
17412/// let result = hub.sites().channels_patch(req, "name")
17413/// .update_mask(FieldMask::new::<&str>(&[]))
17414/// .doit().await;
17415/// # }
17416/// ```
17417pub struct SiteChannelPatchCall<'a, C>
17418where
17419 C: 'a,
17420{
17421 hub: &'a FirebaseHosting<C>,
17422 _request: Channel,
17423 _name: String,
17424 _update_mask: Option<common::FieldMask>,
17425 _delegate: Option<&'a mut dyn common::Delegate>,
17426 _additional_params: HashMap<String, String>,
17427 _scopes: BTreeSet<String>,
17428}
17429
17430impl<'a, C> common::CallBuilder for SiteChannelPatchCall<'a, C> {}
17431
17432impl<'a, C> SiteChannelPatchCall<'a, C>
17433where
17434 C: common::Connector,
17435{
17436 /// Perform the operation you have build so far.
17437 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
17438 use std::borrow::Cow;
17439 use std::io::{Read, Seek};
17440
17441 use common::{url::Params, ToParts};
17442 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17443
17444 let mut dd = common::DefaultDelegate;
17445 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17446 dlg.begin(common::MethodInfo {
17447 id: "firebasehosting.sites.channels.patch",
17448 http_method: hyper::Method::PATCH,
17449 });
17450
17451 for &field in ["alt", "name", "updateMask"].iter() {
17452 if self._additional_params.contains_key(field) {
17453 dlg.finished(false);
17454 return Err(common::Error::FieldClash(field));
17455 }
17456 }
17457
17458 let mut params = Params::with_capacity(5 + self._additional_params.len());
17459 params.push("name", self._name);
17460 if let Some(value) = self._update_mask.as_ref() {
17461 params.push("updateMask", value.to_string());
17462 }
17463
17464 params.extend(self._additional_params.iter());
17465
17466 params.push("alt", "json");
17467 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
17468 if self._scopes.is_empty() {
17469 self._scopes
17470 .insert(Scope::CloudPlatform.as_ref().to_string());
17471 }
17472
17473 #[allow(clippy::single_element_loop)]
17474 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17475 url = params.uri_replacement(url, param_name, find_this, true);
17476 }
17477 {
17478 let to_remove = ["name"];
17479 params.remove_params(&to_remove);
17480 }
17481
17482 let url = params.parse_with_url(&url);
17483
17484 let mut json_mime_type = mime::APPLICATION_JSON;
17485 let mut request_value_reader = {
17486 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17487 common::remove_json_null_values(&mut value);
17488 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17489 serde_json::to_writer(&mut dst, &value).unwrap();
17490 dst
17491 };
17492 let request_size = request_value_reader
17493 .seek(std::io::SeekFrom::End(0))
17494 .unwrap();
17495 request_value_reader
17496 .seek(std::io::SeekFrom::Start(0))
17497 .unwrap();
17498
17499 loop {
17500 let token = match self
17501 .hub
17502 .auth
17503 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17504 .await
17505 {
17506 Ok(token) => token,
17507 Err(e) => match dlg.token(e) {
17508 Ok(token) => token,
17509 Err(e) => {
17510 dlg.finished(false);
17511 return Err(common::Error::MissingToken(e));
17512 }
17513 },
17514 };
17515 request_value_reader
17516 .seek(std::io::SeekFrom::Start(0))
17517 .unwrap();
17518 let mut req_result = {
17519 let client = &self.hub.client;
17520 dlg.pre_request();
17521 let mut req_builder = hyper::Request::builder()
17522 .method(hyper::Method::PATCH)
17523 .uri(url.as_str())
17524 .header(USER_AGENT, self.hub._user_agent.clone());
17525
17526 if let Some(token) = token.as_ref() {
17527 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17528 }
17529
17530 let request = req_builder
17531 .header(CONTENT_TYPE, json_mime_type.to_string())
17532 .header(CONTENT_LENGTH, request_size as u64)
17533 .body(common::to_body(
17534 request_value_reader.get_ref().clone().into(),
17535 ));
17536
17537 client.request(request.unwrap()).await
17538 };
17539
17540 match req_result {
17541 Err(err) => {
17542 if let common::Retry::After(d) = dlg.http_error(&err) {
17543 sleep(d).await;
17544 continue;
17545 }
17546 dlg.finished(false);
17547 return Err(common::Error::HttpError(err));
17548 }
17549 Ok(res) => {
17550 let (mut parts, body) = res.into_parts();
17551 let mut body = common::Body::new(body);
17552 if !parts.status.is_success() {
17553 let bytes = common::to_bytes(body).await.unwrap_or_default();
17554 let error = serde_json::from_str(&common::to_string(&bytes));
17555 let response = common::to_response(parts, bytes.into());
17556
17557 if let common::Retry::After(d) =
17558 dlg.http_failure(&response, error.as_ref().ok())
17559 {
17560 sleep(d).await;
17561 continue;
17562 }
17563
17564 dlg.finished(false);
17565
17566 return Err(match error {
17567 Ok(value) => common::Error::BadRequest(value),
17568 _ => common::Error::Failure(response),
17569 });
17570 }
17571 let response = {
17572 let bytes = common::to_bytes(body).await.unwrap_or_default();
17573 let encoded = common::to_string(&bytes);
17574 match serde_json::from_str(&encoded) {
17575 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17576 Err(error) => {
17577 dlg.response_json_decode_error(&encoded, &error);
17578 return Err(common::Error::JsonDecodeError(
17579 encoded.to_string(),
17580 error,
17581 ));
17582 }
17583 }
17584 };
17585
17586 dlg.finished(true);
17587 return Ok(response);
17588 }
17589 }
17590 }
17591 }
17592
17593 ///
17594 /// Sets the *request* property to the given value.
17595 ///
17596 /// Even though the property as already been set when instantiating this call,
17597 /// we provide this method for API completeness.
17598 pub fn request(mut self, new_value: Channel) -> SiteChannelPatchCall<'a, C> {
17599 self._request = new_value;
17600 self
17601 }
17602 /// The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
17603 ///
17604 /// Sets the *name* path property to the given value.
17605 ///
17606 /// Even though the property as already been set when instantiating this call,
17607 /// we provide this method for API completeness.
17608 pub fn name(mut self, new_value: &str) -> SiteChannelPatchCall<'a, C> {
17609 self._name = new_value.to_string();
17610 self
17611 }
17612 /// A comma-separated list of fields to be updated in this request.
17613 ///
17614 /// Sets the *update mask* query property to the given value.
17615 pub fn update_mask(mut self, new_value: common::FieldMask) -> SiteChannelPatchCall<'a, C> {
17616 self._update_mask = Some(new_value);
17617 self
17618 }
17619 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17620 /// while executing the actual API request.
17621 ///
17622 /// ````text
17623 /// It should be used to handle progress information, and to implement a certain level of resilience.
17624 /// ````
17625 ///
17626 /// Sets the *delegate* property to the given value.
17627 pub fn delegate(
17628 mut self,
17629 new_value: &'a mut dyn common::Delegate,
17630 ) -> SiteChannelPatchCall<'a, C> {
17631 self._delegate = Some(new_value);
17632 self
17633 }
17634
17635 /// Set any additional parameter of the query string used in the request.
17636 /// It should be used to set parameters which are not yet available through their own
17637 /// setters.
17638 ///
17639 /// Please note that this method must not be used to set any of the known parameters
17640 /// which have their own setter method. If done anyway, the request will fail.
17641 ///
17642 /// # Additional Parameters
17643 ///
17644 /// * *$.xgafv* (query-string) - V1 error format.
17645 /// * *access_token* (query-string) - OAuth access token.
17646 /// * *alt* (query-string) - Data format for response.
17647 /// * *callback* (query-string) - JSONP
17648 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17649 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17650 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17651 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17652 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17653 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17654 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17655 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelPatchCall<'a, C>
17656 where
17657 T: AsRef<str>,
17658 {
17659 self._additional_params
17660 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17661 self
17662 }
17663
17664 /// Identifies the authorization scope for the method you are building.
17665 ///
17666 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17667 /// [`Scope::CloudPlatform`].
17668 ///
17669 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17670 /// tokens for more than one scope.
17671 ///
17672 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17673 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17674 /// sufficient, a read-write scope will do as well.
17675 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelPatchCall<'a, C>
17676 where
17677 St: AsRef<str>,
17678 {
17679 self._scopes.insert(String::from(scope.as_ref()));
17680 self
17681 }
17682 /// Identifies the authorization scope(s) for the method you are building.
17683 ///
17684 /// See [`Self::add_scope()`] for details.
17685 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelPatchCall<'a, C>
17686 where
17687 I: IntoIterator<Item = St>,
17688 St: AsRef<str>,
17689 {
17690 self._scopes
17691 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17692 self
17693 }
17694
17695 /// Removes all scopes, and no default scope will be used either.
17696 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17697 /// for details).
17698 pub fn clear_scopes(mut self) -> SiteChannelPatchCall<'a, C> {
17699 self._scopes.clear();
17700 self
17701 }
17702}
17703
17704/// Creates a domain mapping on the specified site.
17705///
17706/// A builder for the *domains.create* method supported by a *site* resource.
17707/// It is not used directly, but through a [`SiteMethods`] instance.
17708///
17709/// # Example
17710///
17711/// Instantiate a resource method builder
17712///
17713/// ```test_harness,no_run
17714/// # extern crate hyper;
17715/// # extern crate hyper_rustls;
17716/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
17717/// use firebasehosting1_beta1::api::Domain;
17718/// # async fn dox() {
17719/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17720///
17721/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17723/// # secret,
17724/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17725/// # ).build().await.unwrap();
17726///
17727/// # let client = hyper_util::client::legacy::Client::builder(
17728/// # hyper_util::rt::TokioExecutor::new()
17729/// # )
17730/// # .build(
17731/// # hyper_rustls::HttpsConnectorBuilder::new()
17732/// # .with_native_roots()
17733/// # .unwrap()
17734/// # .https_or_http()
17735/// # .enable_http1()
17736/// # .build()
17737/// # );
17738/// # let mut hub = FirebaseHosting::new(client, auth);
17739/// // As the method needs a request, you would usually fill it with the desired information
17740/// // into the respective structure. Some of the parts shown here might not be applicable !
17741/// // Values shown here are possibly random and not representative !
17742/// let mut req = Domain::default();
17743///
17744/// // You can configure optional parameters by calling the respective setters at will, and
17745/// // execute the final call using `doit()`.
17746/// // Values shown here are possibly random and not representative !
17747/// let result = hub.sites().domains_create(req, "parent")
17748/// .doit().await;
17749/// # }
17750/// ```
17751pub struct SiteDomainCreateCall<'a, C>
17752where
17753 C: 'a,
17754{
17755 hub: &'a FirebaseHosting<C>,
17756 _request: Domain,
17757 _parent: String,
17758 _delegate: Option<&'a mut dyn common::Delegate>,
17759 _additional_params: HashMap<String, String>,
17760 _scopes: BTreeSet<String>,
17761}
17762
17763impl<'a, C> common::CallBuilder for SiteDomainCreateCall<'a, C> {}
17764
17765impl<'a, C> SiteDomainCreateCall<'a, C>
17766where
17767 C: common::Connector,
17768{
17769 /// Perform the operation you have build so far.
17770 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
17771 use std::borrow::Cow;
17772 use std::io::{Read, Seek};
17773
17774 use common::{url::Params, ToParts};
17775 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17776
17777 let mut dd = common::DefaultDelegate;
17778 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17779 dlg.begin(common::MethodInfo {
17780 id: "firebasehosting.sites.domains.create",
17781 http_method: hyper::Method::POST,
17782 });
17783
17784 for &field in ["alt", "parent"].iter() {
17785 if self._additional_params.contains_key(field) {
17786 dlg.finished(false);
17787 return Err(common::Error::FieldClash(field));
17788 }
17789 }
17790
17791 let mut params = Params::with_capacity(4 + self._additional_params.len());
17792 params.push("parent", self._parent);
17793
17794 params.extend(self._additional_params.iter());
17795
17796 params.push("alt", "json");
17797 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/domains";
17798 if self._scopes.is_empty() {
17799 self._scopes
17800 .insert(Scope::CloudPlatform.as_ref().to_string());
17801 }
17802
17803 #[allow(clippy::single_element_loop)]
17804 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17805 url = params.uri_replacement(url, param_name, find_this, true);
17806 }
17807 {
17808 let to_remove = ["parent"];
17809 params.remove_params(&to_remove);
17810 }
17811
17812 let url = params.parse_with_url(&url);
17813
17814 let mut json_mime_type = mime::APPLICATION_JSON;
17815 let mut request_value_reader = {
17816 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17817 common::remove_json_null_values(&mut value);
17818 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17819 serde_json::to_writer(&mut dst, &value).unwrap();
17820 dst
17821 };
17822 let request_size = request_value_reader
17823 .seek(std::io::SeekFrom::End(0))
17824 .unwrap();
17825 request_value_reader
17826 .seek(std::io::SeekFrom::Start(0))
17827 .unwrap();
17828
17829 loop {
17830 let token = match self
17831 .hub
17832 .auth
17833 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17834 .await
17835 {
17836 Ok(token) => token,
17837 Err(e) => match dlg.token(e) {
17838 Ok(token) => token,
17839 Err(e) => {
17840 dlg.finished(false);
17841 return Err(common::Error::MissingToken(e));
17842 }
17843 },
17844 };
17845 request_value_reader
17846 .seek(std::io::SeekFrom::Start(0))
17847 .unwrap();
17848 let mut req_result = {
17849 let client = &self.hub.client;
17850 dlg.pre_request();
17851 let mut req_builder = hyper::Request::builder()
17852 .method(hyper::Method::POST)
17853 .uri(url.as_str())
17854 .header(USER_AGENT, self.hub._user_agent.clone());
17855
17856 if let Some(token) = token.as_ref() {
17857 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17858 }
17859
17860 let request = req_builder
17861 .header(CONTENT_TYPE, json_mime_type.to_string())
17862 .header(CONTENT_LENGTH, request_size as u64)
17863 .body(common::to_body(
17864 request_value_reader.get_ref().clone().into(),
17865 ));
17866
17867 client.request(request.unwrap()).await
17868 };
17869
17870 match req_result {
17871 Err(err) => {
17872 if let common::Retry::After(d) = dlg.http_error(&err) {
17873 sleep(d).await;
17874 continue;
17875 }
17876 dlg.finished(false);
17877 return Err(common::Error::HttpError(err));
17878 }
17879 Ok(res) => {
17880 let (mut parts, body) = res.into_parts();
17881 let mut body = common::Body::new(body);
17882 if !parts.status.is_success() {
17883 let bytes = common::to_bytes(body).await.unwrap_or_default();
17884 let error = serde_json::from_str(&common::to_string(&bytes));
17885 let response = common::to_response(parts, bytes.into());
17886
17887 if let common::Retry::After(d) =
17888 dlg.http_failure(&response, error.as_ref().ok())
17889 {
17890 sleep(d).await;
17891 continue;
17892 }
17893
17894 dlg.finished(false);
17895
17896 return Err(match error {
17897 Ok(value) => common::Error::BadRequest(value),
17898 _ => common::Error::Failure(response),
17899 });
17900 }
17901 let response = {
17902 let bytes = common::to_bytes(body).await.unwrap_or_default();
17903 let encoded = common::to_string(&bytes);
17904 match serde_json::from_str(&encoded) {
17905 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17906 Err(error) => {
17907 dlg.response_json_decode_error(&encoded, &error);
17908 return Err(common::Error::JsonDecodeError(
17909 encoded.to_string(),
17910 error,
17911 ));
17912 }
17913 }
17914 };
17915
17916 dlg.finished(true);
17917 return Ok(response);
17918 }
17919 }
17920 }
17921 }
17922
17923 ///
17924 /// Sets the *request* property to the given value.
17925 ///
17926 /// Even though the property as already been set when instantiating this call,
17927 /// we provide this method for API completeness.
17928 pub fn request(mut self, new_value: Domain) -> SiteDomainCreateCall<'a, C> {
17929 self._request = new_value;
17930 self
17931 }
17932 /// Required. The parent to create the domain association for, in the format: sites/site-name
17933 ///
17934 /// Sets the *parent* path property to the given value.
17935 ///
17936 /// Even though the property as already been set when instantiating this call,
17937 /// we provide this method for API completeness.
17938 pub fn parent(mut self, new_value: &str) -> SiteDomainCreateCall<'a, C> {
17939 self._parent = new_value.to_string();
17940 self
17941 }
17942 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17943 /// while executing the actual API request.
17944 ///
17945 /// ````text
17946 /// It should be used to handle progress information, and to implement a certain level of resilience.
17947 /// ````
17948 ///
17949 /// Sets the *delegate* property to the given value.
17950 pub fn delegate(
17951 mut self,
17952 new_value: &'a mut dyn common::Delegate,
17953 ) -> SiteDomainCreateCall<'a, C> {
17954 self._delegate = Some(new_value);
17955 self
17956 }
17957
17958 /// Set any additional parameter of the query string used in the request.
17959 /// It should be used to set parameters which are not yet available through their own
17960 /// setters.
17961 ///
17962 /// Please note that this method must not be used to set any of the known parameters
17963 /// which have their own setter method. If done anyway, the request will fail.
17964 ///
17965 /// # Additional Parameters
17966 ///
17967 /// * *$.xgafv* (query-string) - V1 error format.
17968 /// * *access_token* (query-string) - OAuth access token.
17969 /// * *alt* (query-string) - Data format for response.
17970 /// * *callback* (query-string) - JSONP
17971 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17972 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17973 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17974 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17975 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17976 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17977 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17978 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainCreateCall<'a, C>
17979 where
17980 T: AsRef<str>,
17981 {
17982 self._additional_params
17983 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17984 self
17985 }
17986
17987 /// Identifies the authorization scope for the method you are building.
17988 ///
17989 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17990 /// [`Scope::CloudPlatform`].
17991 ///
17992 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17993 /// tokens for more than one scope.
17994 ///
17995 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17996 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17997 /// sufficient, a read-write scope will do as well.
17998 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainCreateCall<'a, C>
17999 where
18000 St: AsRef<str>,
18001 {
18002 self._scopes.insert(String::from(scope.as_ref()));
18003 self
18004 }
18005 /// Identifies the authorization scope(s) for the method you are building.
18006 ///
18007 /// See [`Self::add_scope()`] for details.
18008 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainCreateCall<'a, C>
18009 where
18010 I: IntoIterator<Item = St>,
18011 St: AsRef<str>,
18012 {
18013 self._scopes
18014 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18015 self
18016 }
18017
18018 /// Removes all scopes, and no default scope will be used either.
18019 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18020 /// for details).
18021 pub fn clear_scopes(mut self) -> SiteDomainCreateCall<'a, C> {
18022 self._scopes.clear();
18023 self
18024 }
18025}
18026
18027/// Deletes the existing domain mapping on the specified site.
18028///
18029/// A builder for the *domains.delete* method supported by a *site* resource.
18030/// It is not used directly, but through a [`SiteMethods`] instance.
18031///
18032/// # Example
18033///
18034/// Instantiate a resource method builder
18035///
18036/// ```test_harness,no_run
18037/// # extern crate hyper;
18038/// # extern crate hyper_rustls;
18039/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
18040/// # async fn dox() {
18041/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18042///
18043/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18044/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18045/// # secret,
18046/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18047/// # ).build().await.unwrap();
18048///
18049/// # let client = hyper_util::client::legacy::Client::builder(
18050/// # hyper_util::rt::TokioExecutor::new()
18051/// # )
18052/// # .build(
18053/// # hyper_rustls::HttpsConnectorBuilder::new()
18054/// # .with_native_roots()
18055/// # .unwrap()
18056/// # .https_or_http()
18057/// # .enable_http1()
18058/// # .build()
18059/// # );
18060/// # let mut hub = FirebaseHosting::new(client, auth);
18061/// // You can configure optional parameters by calling the respective setters at will, and
18062/// // execute the final call using `doit()`.
18063/// // Values shown here are possibly random and not representative !
18064/// let result = hub.sites().domains_delete("name")
18065/// .doit().await;
18066/// # }
18067/// ```
18068pub struct SiteDomainDeleteCall<'a, C>
18069where
18070 C: 'a,
18071{
18072 hub: &'a FirebaseHosting<C>,
18073 _name: String,
18074 _delegate: Option<&'a mut dyn common::Delegate>,
18075 _additional_params: HashMap<String, String>,
18076 _scopes: BTreeSet<String>,
18077}
18078
18079impl<'a, C> common::CallBuilder for SiteDomainDeleteCall<'a, C> {}
18080
18081impl<'a, C> SiteDomainDeleteCall<'a, C>
18082where
18083 C: common::Connector,
18084{
18085 /// Perform the operation you have build so far.
18086 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
18087 use std::borrow::Cow;
18088 use std::io::{Read, Seek};
18089
18090 use common::{url::Params, ToParts};
18091 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18092
18093 let mut dd = common::DefaultDelegate;
18094 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18095 dlg.begin(common::MethodInfo {
18096 id: "firebasehosting.sites.domains.delete",
18097 http_method: hyper::Method::DELETE,
18098 });
18099
18100 for &field in ["alt", "name"].iter() {
18101 if self._additional_params.contains_key(field) {
18102 dlg.finished(false);
18103 return Err(common::Error::FieldClash(field));
18104 }
18105 }
18106
18107 let mut params = Params::with_capacity(3 + self._additional_params.len());
18108 params.push("name", self._name);
18109
18110 params.extend(self._additional_params.iter());
18111
18112 params.push("alt", "json");
18113 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
18114 if self._scopes.is_empty() {
18115 self._scopes
18116 .insert(Scope::CloudPlatform.as_ref().to_string());
18117 }
18118
18119 #[allow(clippy::single_element_loop)]
18120 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18121 url = params.uri_replacement(url, param_name, find_this, true);
18122 }
18123 {
18124 let to_remove = ["name"];
18125 params.remove_params(&to_remove);
18126 }
18127
18128 let url = params.parse_with_url(&url);
18129
18130 loop {
18131 let token = match self
18132 .hub
18133 .auth
18134 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18135 .await
18136 {
18137 Ok(token) => token,
18138 Err(e) => match dlg.token(e) {
18139 Ok(token) => token,
18140 Err(e) => {
18141 dlg.finished(false);
18142 return Err(common::Error::MissingToken(e));
18143 }
18144 },
18145 };
18146 let mut req_result = {
18147 let client = &self.hub.client;
18148 dlg.pre_request();
18149 let mut req_builder = hyper::Request::builder()
18150 .method(hyper::Method::DELETE)
18151 .uri(url.as_str())
18152 .header(USER_AGENT, self.hub._user_agent.clone());
18153
18154 if let Some(token) = token.as_ref() {
18155 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18156 }
18157
18158 let request = req_builder
18159 .header(CONTENT_LENGTH, 0_u64)
18160 .body(common::to_body::<String>(None));
18161
18162 client.request(request.unwrap()).await
18163 };
18164
18165 match req_result {
18166 Err(err) => {
18167 if let common::Retry::After(d) = dlg.http_error(&err) {
18168 sleep(d).await;
18169 continue;
18170 }
18171 dlg.finished(false);
18172 return Err(common::Error::HttpError(err));
18173 }
18174 Ok(res) => {
18175 let (mut parts, body) = res.into_parts();
18176 let mut body = common::Body::new(body);
18177 if !parts.status.is_success() {
18178 let bytes = common::to_bytes(body).await.unwrap_or_default();
18179 let error = serde_json::from_str(&common::to_string(&bytes));
18180 let response = common::to_response(parts, bytes.into());
18181
18182 if let common::Retry::After(d) =
18183 dlg.http_failure(&response, error.as_ref().ok())
18184 {
18185 sleep(d).await;
18186 continue;
18187 }
18188
18189 dlg.finished(false);
18190
18191 return Err(match error {
18192 Ok(value) => common::Error::BadRequest(value),
18193 _ => common::Error::Failure(response),
18194 });
18195 }
18196 let response = {
18197 let bytes = common::to_bytes(body).await.unwrap_or_default();
18198 let encoded = common::to_string(&bytes);
18199 match serde_json::from_str(&encoded) {
18200 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18201 Err(error) => {
18202 dlg.response_json_decode_error(&encoded, &error);
18203 return Err(common::Error::JsonDecodeError(
18204 encoded.to_string(),
18205 error,
18206 ));
18207 }
18208 }
18209 };
18210
18211 dlg.finished(true);
18212 return Ok(response);
18213 }
18214 }
18215 }
18216 }
18217
18218 /// Required. The name of the domain association to delete.
18219 ///
18220 /// Sets the *name* path property to the given value.
18221 ///
18222 /// Even though the property as already been set when instantiating this call,
18223 /// we provide this method for API completeness.
18224 pub fn name(mut self, new_value: &str) -> SiteDomainDeleteCall<'a, C> {
18225 self._name = new_value.to_string();
18226 self
18227 }
18228 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18229 /// while executing the actual API request.
18230 ///
18231 /// ````text
18232 /// It should be used to handle progress information, and to implement a certain level of resilience.
18233 /// ````
18234 ///
18235 /// Sets the *delegate* property to the given value.
18236 pub fn delegate(
18237 mut self,
18238 new_value: &'a mut dyn common::Delegate,
18239 ) -> SiteDomainDeleteCall<'a, C> {
18240 self._delegate = Some(new_value);
18241 self
18242 }
18243
18244 /// Set any additional parameter of the query string used in the request.
18245 /// It should be used to set parameters which are not yet available through their own
18246 /// setters.
18247 ///
18248 /// Please note that this method must not be used to set any of the known parameters
18249 /// which have their own setter method. If done anyway, the request will fail.
18250 ///
18251 /// # Additional Parameters
18252 ///
18253 /// * *$.xgafv* (query-string) - V1 error format.
18254 /// * *access_token* (query-string) - OAuth access token.
18255 /// * *alt* (query-string) - Data format for response.
18256 /// * *callback* (query-string) - JSONP
18257 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18258 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18259 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18260 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18261 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18262 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18263 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18264 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainDeleteCall<'a, C>
18265 where
18266 T: AsRef<str>,
18267 {
18268 self._additional_params
18269 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18270 self
18271 }
18272
18273 /// Identifies the authorization scope for the method you are building.
18274 ///
18275 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18276 /// [`Scope::CloudPlatform`].
18277 ///
18278 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18279 /// tokens for more than one scope.
18280 ///
18281 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18282 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18283 /// sufficient, a read-write scope will do as well.
18284 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainDeleteCall<'a, C>
18285 where
18286 St: AsRef<str>,
18287 {
18288 self._scopes.insert(String::from(scope.as_ref()));
18289 self
18290 }
18291 /// Identifies the authorization scope(s) for the method you are building.
18292 ///
18293 /// See [`Self::add_scope()`] for details.
18294 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainDeleteCall<'a, C>
18295 where
18296 I: IntoIterator<Item = St>,
18297 St: AsRef<str>,
18298 {
18299 self._scopes
18300 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18301 self
18302 }
18303
18304 /// Removes all scopes, and no default scope will be used either.
18305 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18306 /// for details).
18307 pub fn clear_scopes(mut self) -> SiteDomainDeleteCall<'a, C> {
18308 self._scopes.clear();
18309 self
18310 }
18311}
18312
18313/// Gets a domain mapping on the specified site.
18314///
18315/// A builder for the *domains.get* method supported by a *site* resource.
18316/// It is not used directly, but through a [`SiteMethods`] instance.
18317///
18318/// # Example
18319///
18320/// Instantiate a resource method builder
18321///
18322/// ```test_harness,no_run
18323/// # extern crate hyper;
18324/// # extern crate hyper_rustls;
18325/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
18326/// # async fn dox() {
18327/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18328///
18329/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18330/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18331/// # secret,
18332/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18333/// # ).build().await.unwrap();
18334///
18335/// # let client = hyper_util::client::legacy::Client::builder(
18336/// # hyper_util::rt::TokioExecutor::new()
18337/// # )
18338/// # .build(
18339/// # hyper_rustls::HttpsConnectorBuilder::new()
18340/// # .with_native_roots()
18341/// # .unwrap()
18342/// # .https_or_http()
18343/// # .enable_http1()
18344/// # .build()
18345/// # );
18346/// # let mut hub = FirebaseHosting::new(client, auth);
18347/// // You can configure optional parameters by calling the respective setters at will, and
18348/// // execute the final call using `doit()`.
18349/// // Values shown here are possibly random and not representative !
18350/// let result = hub.sites().domains_get("name")
18351/// .doit().await;
18352/// # }
18353/// ```
18354pub struct SiteDomainGetCall<'a, C>
18355where
18356 C: 'a,
18357{
18358 hub: &'a FirebaseHosting<C>,
18359 _name: String,
18360 _delegate: Option<&'a mut dyn common::Delegate>,
18361 _additional_params: HashMap<String, String>,
18362 _scopes: BTreeSet<String>,
18363}
18364
18365impl<'a, C> common::CallBuilder for SiteDomainGetCall<'a, C> {}
18366
18367impl<'a, C> SiteDomainGetCall<'a, C>
18368where
18369 C: common::Connector,
18370{
18371 /// Perform the operation you have build so far.
18372 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
18373 use std::borrow::Cow;
18374 use std::io::{Read, Seek};
18375
18376 use common::{url::Params, ToParts};
18377 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18378
18379 let mut dd = common::DefaultDelegate;
18380 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18381 dlg.begin(common::MethodInfo {
18382 id: "firebasehosting.sites.domains.get",
18383 http_method: hyper::Method::GET,
18384 });
18385
18386 for &field in ["alt", "name"].iter() {
18387 if self._additional_params.contains_key(field) {
18388 dlg.finished(false);
18389 return Err(common::Error::FieldClash(field));
18390 }
18391 }
18392
18393 let mut params = Params::with_capacity(3 + self._additional_params.len());
18394 params.push("name", self._name);
18395
18396 params.extend(self._additional_params.iter());
18397
18398 params.push("alt", "json");
18399 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
18400 if self._scopes.is_empty() {
18401 self._scopes
18402 .insert(Scope::FirebaseReadonly.as_ref().to_string());
18403 }
18404
18405 #[allow(clippy::single_element_loop)]
18406 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18407 url = params.uri_replacement(url, param_name, find_this, true);
18408 }
18409 {
18410 let to_remove = ["name"];
18411 params.remove_params(&to_remove);
18412 }
18413
18414 let url = params.parse_with_url(&url);
18415
18416 loop {
18417 let token = match self
18418 .hub
18419 .auth
18420 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18421 .await
18422 {
18423 Ok(token) => token,
18424 Err(e) => match dlg.token(e) {
18425 Ok(token) => token,
18426 Err(e) => {
18427 dlg.finished(false);
18428 return Err(common::Error::MissingToken(e));
18429 }
18430 },
18431 };
18432 let mut req_result = {
18433 let client = &self.hub.client;
18434 dlg.pre_request();
18435 let mut req_builder = hyper::Request::builder()
18436 .method(hyper::Method::GET)
18437 .uri(url.as_str())
18438 .header(USER_AGENT, self.hub._user_agent.clone());
18439
18440 if let Some(token) = token.as_ref() {
18441 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18442 }
18443
18444 let request = req_builder
18445 .header(CONTENT_LENGTH, 0_u64)
18446 .body(common::to_body::<String>(None));
18447
18448 client.request(request.unwrap()).await
18449 };
18450
18451 match req_result {
18452 Err(err) => {
18453 if let common::Retry::After(d) = dlg.http_error(&err) {
18454 sleep(d).await;
18455 continue;
18456 }
18457 dlg.finished(false);
18458 return Err(common::Error::HttpError(err));
18459 }
18460 Ok(res) => {
18461 let (mut parts, body) = res.into_parts();
18462 let mut body = common::Body::new(body);
18463 if !parts.status.is_success() {
18464 let bytes = common::to_bytes(body).await.unwrap_or_default();
18465 let error = serde_json::from_str(&common::to_string(&bytes));
18466 let response = common::to_response(parts, bytes.into());
18467
18468 if let common::Retry::After(d) =
18469 dlg.http_failure(&response, error.as_ref().ok())
18470 {
18471 sleep(d).await;
18472 continue;
18473 }
18474
18475 dlg.finished(false);
18476
18477 return Err(match error {
18478 Ok(value) => common::Error::BadRequest(value),
18479 _ => common::Error::Failure(response),
18480 });
18481 }
18482 let response = {
18483 let bytes = common::to_bytes(body).await.unwrap_or_default();
18484 let encoded = common::to_string(&bytes);
18485 match serde_json::from_str(&encoded) {
18486 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18487 Err(error) => {
18488 dlg.response_json_decode_error(&encoded, &error);
18489 return Err(common::Error::JsonDecodeError(
18490 encoded.to_string(),
18491 error,
18492 ));
18493 }
18494 }
18495 };
18496
18497 dlg.finished(true);
18498 return Ok(response);
18499 }
18500 }
18501 }
18502 }
18503
18504 /// Required. The name of the domain configuration to get.
18505 ///
18506 /// Sets the *name* path property to the given value.
18507 ///
18508 /// Even though the property as already been set when instantiating this call,
18509 /// we provide this method for API completeness.
18510 pub fn name(mut self, new_value: &str) -> SiteDomainGetCall<'a, C> {
18511 self._name = new_value.to_string();
18512 self
18513 }
18514 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18515 /// while executing the actual API request.
18516 ///
18517 /// ````text
18518 /// It should be used to handle progress information, and to implement a certain level of resilience.
18519 /// ````
18520 ///
18521 /// Sets the *delegate* property to the given value.
18522 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SiteDomainGetCall<'a, C> {
18523 self._delegate = Some(new_value);
18524 self
18525 }
18526
18527 /// Set any additional parameter of the query string used in the request.
18528 /// It should be used to set parameters which are not yet available through their own
18529 /// setters.
18530 ///
18531 /// Please note that this method must not be used to set any of the known parameters
18532 /// which have their own setter method. If done anyway, the request will fail.
18533 ///
18534 /// # Additional Parameters
18535 ///
18536 /// * *$.xgafv* (query-string) - V1 error format.
18537 /// * *access_token* (query-string) - OAuth access token.
18538 /// * *alt* (query-string) - Data format for response.
18539 /// * *callback* (query-string) - JSONP
18540 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18541 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18542 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18543 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18544 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18545 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18546 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18547 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainGetCall<'a, C>
18548 where
18549 T: AsRef<str>,
18550 {
18551 self._additional_params
18552 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18553 self
18554 }
18555
18556 /// Identifies the authorization scope for the method you are building.
18557 ///
18558 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18559 /// [`Scope::FirebaseReadonly`].
18560 ///
18561 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18562 /// tokens for more than one scope.
18563 ///
18564 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18565 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18566 /// sufficient, a read-write scope will do as well.
18567 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainGetCall<'a, C>
18568 where
18569 St: AsRef<str>,
18570 {
18571 self._scopes.insert(String::from(scope.as_ref()));
18572 self
18573 }
18574 /// Identifies the authorization scope(s) for the method you are building.
18575 ///
18576 /// See [`Self::add_scope()`] for details.
18577 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainGetCall<'a, C>
18578 where
18579 I: IntoIterator<Item = St>,
18580 St: AsRef<str>,
18581 {
18582 self._scopes
18583 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18584 self
18585 }
18586
18587 /// Removes all scopes, and no default scope will be used either.
18588 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18589 /// for details).
18590 pub fn clear_scopes(mut self) -> SiteDomainGetCall<'a, C> {
18591 self._scopes.clear();
18592 self
18593 }
18594}
18595
18596/// Lists the domains for the specified site.
18597///
18598/// A builder for the *domains.list* method supported by a *site* resource.
18599/// It is not used directly, but through a [`SiteMethods`] instance.
18600///
18601/// # Example
18602///
18603/// Instantiate a resource method builder
18604///
18605/// ```test_harness,no_run
18606/// # extern crate hyper;
18607/// # extern crate hyper_rustls;
18608/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
18609/// # async fn dox() {
18610/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18611///
18612/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18613/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18614/// # secret,
18615/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18616/// # ).build().await.unwrap();
18617///
18618/// # let client = hyper_util::client::legacy::Client::builder(
18619/// # hyper_util::rt::TokioExecutor::new()
18620/// # )
18621/// # .build(
18622/// # hyper_rustls::HttpsConnectorBuilder::new()
18623/// # .with_native_roots()
18624/// # .unwrap()
18625/// # .https_or_http()
18626/// # .enable_http1()
18627/// # .build()
18628/// # );
18629/// # let mut hub = FirebaseHosting::new(client, auth);
18630/// // You can configure optional parameters by calling the respective setters at will, and
18631/// // execute the final call using `doit()`.
18632/// // Values shown here are possibly random and not representative !
18633/// let result = hub.sites().domains_list("parent")
18634/// .page_token("sed")
18635/// .page_size(-11)
18636/// .doit().await;
18637/// # }
18638/// ```
18639pub struct SiteDomainListCall<'a, C>
18640where
18641 C: 'a,
18642{
18643 hub: &'a FirebaseHosting<C>,
18644 _parent: String,
18645 _page_token: Option<String>,
18646 _page_size: Option<i32>,
18647 _delegate: Option<&'a mut dyn common::Delegate>,
18648 _additional_params: HashMap<String, String>,
18649 _scopes: BTreeSet<String>,
18650}
18651
18652impl<'a, C> common::CallBuilder for SiteDomainListCall<'a, C> {}
18653
18654impl<'a, C> SiteDomainListCall<'a, C>
18655where
18656 C: common::Connector,
18657{
18658 /// Perform the operation you have build so far.
18659 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainsResponse)> {
18660 use std::borrow::Cow;
18661 use std::io::{Read, Seek};
18662
18663 use common::{url::Params, ToParts};
18664 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18665
18666 let mut dd = common::DefaultDelegate;
18667 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18668 dlg.begin(common::MethodInfo {
18669 id: "firebasehosting.sites.domains.list",
18670 http_method: hyper::Method::GET,
18671 });
18672
18673 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
18674 if self._additional_params.contains_key(field) {
18675 dlg.finished(false);
18676 return Err(common::Error::FieldClash(field));
18677 }
18678 }
18679
18680 let mut params = Params::with_capacity(5 + self._additional_params.len());
18681 params.push("parent", self._parent);
18682 if let Some(value) = self._page_token.as_ref() {
18683 params.push("pageToken", value);
18684 }
18685 if let Some(value) = self._page_size.as_ref() {
18686 params.push("pageSize", value.to_string());
18687 }
18688
18689 params.extend(self._additional_params.iter());
18690
18691 params.push("alt", "json");
18692 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/domains";
18693 if self._scopes.is_empty() {
18694 self._scopes
18695 .insert(Scope::FirebaseReadonly.as_ref().to_string());
18696 }
18697
18698 #[allow(clippy::single_element_loop)]
18699 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18700 url = params.uri_replacement(url, param_name, find_this, true);
18701 }
18702 {
18703 let to_remove = ["parent"];
18704 params.remove_params(&to_remove);
18705 }
18706
18707 let url = params.parse_with_url(&url);
18708
18709 loop {
18710 let token = match self
18711 .hub
18712 .auth
18713 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18714 .await
18715 {
18716 Ok(token) => token,
18717 Err(e) => match dlg.token(e) {
18718 Ok(token) => token,
18719 Err(e) => {
18720 dlg.finished(false);
18721 return Err(common::Error::MissingToken(e));
18722 }
18723 },
18724 };
18725 let mut req_result = {
18726 let client = &self.hub.client;
18727 dlg.pre_request();
18728 let mut req_builder = hyper::Request::builder()
18729 .method(hyper::Method::GET)
18730 .uri(url.as_str())
18731 .header(USER_AGENT, self.hub._user_agent.clone());
18732
18733 if let Some(token) = token.as_ref() {
18734 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18735 }
18736
18737 let request = req_builder
18738 .header(CONTENT_LENGTH, 0_u64)
18739 .body(common::to_body::<String>(None));
18740
18741 client.request(request.unwrap()).await
18742 };
18743
18744 match req_result {
18745 Err(err) => {
18746 if let common::Retry::After(d) = dlg.http_error(&err) {
18747 sleep(d).await;
18748 continue;
18749 }
18750 dlg.finished(false);
18751 return Err(common::Error::HttpError(err));
18752 }
18753 Ok(res) => {
18754 let (mut parts, body) = res.into_parts();
18755 let mut body = common::Body::new(body);
18756 if !parts.status.is_success() {
18757 let bytes = common::to_bytes(body).await.unwrap_or_default();
18758 let error = serde_json::from_str(&common::to_string(&bytes));
18759 let response = common::to_response(parts, bytes.into());
18760
18761 if let common::Retry::After(d) =
18762 dlg.http_failure(&response, error.as_ref().ok())
18763 {
18764 sleep(d).await;
18765 continue;
18766 }
18767
18768 dlg.finished(false);
18769
18770 return Err(match error {
18771 Ok(value) => common::Error::BadRequest(value),
18772 _ => common::Error::Failure(response),
18773 });
18774 }
18775 let response = {
18776 let bytes = common::to_bytes(body).await.unwrap_or_default();
18777 let encoded = common::to_string(&bytes);
18778 match serde_json::from_str(&encoded) {
18779 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18780 Err(error) => {
18781 dlg.response_json_decode_error(&encoded, &error);
18782 return Err(common::Error::JsonDecodeError(
18783 encoded.to_string(),
18784 error,
18785 ));
18786 }
18787 }
18788 };
18789
18790 dlg.finished(true);
18791 return Ok(response);
18792 }
18793 }
18794 }
18795 }
18796
18797 /// Required. The parent for which to list domains, in the format: sites/ site-name
18798 ///
18799 /// Sets the *parent* path property to the given value.
18800 ///
18801 /// Even though the property as already been set when instantiating this call,
18802 /// we provide this method for API completeness.
18803 pub fn parent(mut self, new_value: &str) -> SiteDomainListCall<'a, C> {
18804 self._parent = new_value.to_string();
18805 self
18806 }
18807 /// The next_page_token from a previous request, if provided.
18808 ///
18809 /// Sets the *page token* query property to the given value.
18810 pub fn page_token(mut self, new_value: &str) -> SiteDomainListCall<'a, C> {
18811 self._page_token = Some(new_value.to_string());
18812 self
18813 }
18814 /// The page size to return. Defaults to 50.
18815 ///
18816 /// Sets the *page size* query property to the given value.
18817 pub fn page_size(mut self, new_value: i32) -> SiteDomainListCall<'a, C> {
18818 self._page_size = Some(new_value);
18819 self
18820 }
18821 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18822 /// while executing the actual API request.
18823 ///
18824 /// ````text
18825 /// It should be used to handle progress information, and to implement a certain level of resilience.
18826 /// ````
18827 ///
18828 /// Sets the *delegate* property to the given value.
18829 pub fn delegate(
18830 mut self,
18831 new_value: &'a mut dyn common::Delegate,
18832 ) -> SiteDomainListCall<'a, C> {
18833 self._delegate = Some(new_value);
18834 self
18835 }
18836
18837 /// Set any additional parameter of the query string used in the request.
18838 /// It should be used to set parameters which are not yet available through their own
18839 /// setters.
18840 ///
18841 /// Please note that this method must not be used to set any of the known parameters
18842 /// which have their own setter method. If done anyway, the request will fail.
18843 ///
18844 /// # Additional Parameters
18845 ///
18846 /// * *$.xgafv* (query-string) - V1 error format.
18847 /// * *access_token* (query-string) - OAuth access token.
18848 /// * *alt* (query-string) - Data format for response.
18849 /// * *callback* (query-string) - JSONP
18850 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18851 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18852 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18853 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18854 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18855 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18856 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18857 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainListCall<'a, C>
18858 where
18859 T: AsRef<str>,
18860 {
18861 self._additional_params
18862 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18863 self
18864 }
18865
18866 /// Identifies the authorization scope for the method you are building.
18867 ///
18868 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18869 /// [`Scope::FirebaseReadonly`].
18870 ///
18871 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18872 /// tokens for more than one scope.
18873 ///
18874 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18875 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18876 /// sufficient, a read-write scope will do as well.
18877 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainListCall<'a, C>
18878 where
18879 St: AsRef<str>,
18880 {
18881 self._scopes.insert(String::from(scope.as_ref()));
18882 self
18883 }
18884 /// Identifies the authorization scope(s) for the method you are building.
18885 ///
18886 /// See [`Self::add_scope()`] for details.
18887 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainListCall<'a, C>
18888 where
18889 I: IntoIterator<Item = St>,
18890 St: AsRef<str>,
18891 {
18892 self._scopes
18893 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18894 self
18895 }
18896
18897 /// Removes all scopes, and no default scope will be used either.
18898 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18899 /// for details).
18900 pub fn clear_scopes(mut self) -> SiteDomainListCall<'a, C> {
18901 self._scopes.clear();
18902 self
18903 }
18904}
18905
18906/// Updates the specified domain mapping, creating the mapping as if it does not exist.
18907///
18908/// A builder for the *domains.update* method supported by a *site* resource.
18909/// It is not used directly, but through a [`SiteMethods`] instance.
18910///
18911/// # Example
18912///
18913/// Instantiate a resource method builder
18914///
18915/// ```test_harness,no_run
18916/// # extern crate hyper;
18917/// # extern crate hyper_rustls;
18918/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
18919/// use firebasehosting1_beta1::api::Domain;
18920/// # async fn dox() {
18921/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18922///
18923/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18924/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18925/// # secret,
18926/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18927/// # ).build().await.unwrap();
18928///
18929/// # let client = hyper_util::client::legacy::Client::builder(
18930/// # hyper_util::rt::TokioExecutor::new()
18931/// # )
18932/// # .build(
18933/// # hyper_rustls::HttpsConnectorBuilder::new()
18934/// # .with_native_roots()
18935/// # .unwrap()
18936/// # .https_or_http()
18937/// # .enable_http1()
18938/// # .build()
18939/// # );
18940/// # let mut hub = FirebaseHosting::new(client, auth);
18941/// // As the method needs a request, you would usually fill it with the desired information
18942/// // into the respective structure. Some of the parts shown here might not be applicable !
18943/// // Values shown here are possibly random and not representative !
18944/// let mut req = Domain::default();
18945///
18946/// // You can configure optional parameters by calling the respective setters at will, and
18947/// // execute the final call using `doit()`.
18948/// // Values shown here are possibly random and not representative !
18949/// let result = hub.sites().domains_update(req, "name")
18950/// .doit().await;
18951/// # }
18952/// ```
18953pub struct SiteDomainUpdateCall<'a, C>
18954where
18955 C: 'a,
18956{
18957 hub: &'a FirebaseHosting<C>,
18958 _request: Domain,
18959 _name: String,
18960 _delegate: Option<&'a mut dyn common::Delegate>,
18961 _additional_params: HashMap<String, String>,
18962 _scopes: BTreeSet<String>,
18963}
18964
18965impl<'a, C> common::CallBuilder for SiteDomainUpdateCall<'a, C> {}
18966
18967impl<'a, C> SiteDomainUpdateCall<'a, C>
18968where
18969 C: common::Connector,
18970{
18971 /// Perform the operation you have build so far.
18972 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
18973 use std::borrow::Cow;
18974 use std::io::{Read, Seek};
18975
18976 use common::{url::Params, ToParts};
18977 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18978
18979 let mut dd = common::DefaultDelegate;
18980 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18981 dlg.begin(common::MethodInfo {
18982 id: "firebasehosting.sites.domains.update",
18983 http_method: hyper::Method::PUT,
18984 });
18985
18986 for &field in ["alt", "name"].iter() {
18987 if self._additional_params.contains_key(field) {
18988 dlg.finished(false);
18989 return Err(common::Error::FieldClash(field));
18990 }
18991 }
18992
18993 let mut params = Params::with_capacity(4 + self._additional_params.len());
18994 params.push("name", self._name);
18995
18996 params.extend(self._additional_params.iter());
18997
18998 params.push("alt", "json");
18999 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
19000 if self._scopes.is_empty() {
19001 self._scopes
19002 .insert(Scope::CloudPlatform.as_ref().to_string());
19003 }
19004
19005 #[allow(clippy::single_element_loop)]
19006 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19007 url = params.uri_replacement(url, param_name, find_this, true);
19008 }
19009 {
19010 let to_remove = ["name"];
19011 params.remove_params(&to_remove);
19012 }
19013
19014 let url = params.parse_with_url(&url);
19015
19016 let mut json_mime_type = mime::APPLICATION_JSON;
19017 let mut request_value_reader = {
19018 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19019 common::remove_json_null_values(&mut value);
19020 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19021 serde_json::to_writer(&mut dst, &value).unwrap();
19022 dst
19023 };
19024 let request_size = request_value_reader
19025 .seek(std::io::SeekFrom::End(0))
19026 .unwrap();
19027 request_value_reader
19028 .seek(std::io::SeekFrom::Start(0))
19029 .unwrap();
19030
19031 loop {
19032 let token = match self
19033 .hub
19034 .auth
19035 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19036 .await
19037 {
19038 Ok(token) => token,
19039 Err(e) => match dlg.token(e) {
19040 Ok(token) => token,
19041 Err(e) => {
19042 dlg.finished(false);
19043 return Err(common::Error::MissingToken(e));
19044 }
19045 },
19046 };
19047 request_value_reader
19048 .seek(std::io::SeekFrom::Start(0))
19049 .unwrap();
19050 let mut req_result = {
19051 let client = &self.hub.client;
19052 dlg.pre_request();
19053 let mut req_builder = hyper::Request::builder()
19054 .method(hyper::Method::PUT)
19055 .uri(url.as_str())
19056 .header(USER_AGENT, self.hub._user_agent.clone());
19057
19058 if let Some(token) = token.as_ref() {
19059 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19060 }
19061
19062 let request = req_builder
19063 .header(CONTENT_TYPE, json_mime_type.to_string())
19064 .header(CONTENT_LENGTH, request_size as u64)
19065 .body(common::to_body(
19066 request_value_reader.get_ref().clone().into(),
19067 ));
19068
19069 client.request(request.unwrap()).await
19070 };
19071
19072 match req_result {
19073 Err(err) => {
19074 if let common::Retry::After(d) = dlg.http_error(&err) {
19075 sleep(d).await;
19076 continue;
19077 }
19078 dlg.finished(false);
19079 return Err(common::Error::HttpError(err));
19080 }
19081 Ok(res) => {
19082 let (mut parts, body) = res.into_parts();
19083 let mut body = common::Body::new(body);
19084 if !parts.status.is_success() {
19085 let bytes = common::to_bytes(body).await.unwrap_or_default();
19086 let error = serde_json::from_str(&common::to_string(&bytes));
19087 let response = common::to_response(parts, bytes.into());
19088
19089 if let common::Retry::After(d) =
19090 dlg.http_failure(&response, error.as_ref().ok())
19091 {
19092 sleep(d).await;
19093 continue;
19094 }
19095
19096 dlg.finished(false);
19097
19098 return Err(match error {
19099 Ok(value) => common::Error::BadRequest(value),
19100 _ => common::Error::Failure(response),
19101 });
19102 }
19103 let response = {
19104 let bytes = common::to_bytes(body).await.unwrap_or_default();
19105 let encoded = common::to_string(&bytes);
19106 match serde_json::from_str(&encoded) {
19107 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19108 Err(error) => {
19109 dlg.response_json_decode_error(&encoded, &error);
19110 return Err(common::Error::JsonDecodeError(
19111 encoded.to_string(),
19112 error,
19113 ));
19114 }
19115 }
19116 };
19117
19118 dlg.finished(true);
19119 return Ok(response);
19120 }
19121 }
19122 }
19123 }
19124
19125 ///
19126 /// Sets the *request* property to the given value.
19127 ///
19128 /// Even though the property as already been set when instantiating this call,
19129 /// we provide this method for API completeness.
19130 pub fn request(mut self, new_value: Domain) -> SiteDomainUpdateCall<'a, C> {
19131 self._request = new_value;
19132 self
19133 }
19134 /// Required. The name of the domain association to update or create, if an association doesn't already exist.
19135 ///
19136 /// Sets the *name* path property to the given value.
19137 ///
19138 /// Even though the property as already been set when instantiating this call,
19139 /// we provide this method for API completeness.
19140 pub fn name(mut self, new_value: &str) -> SiteDomainUpdateCall<'a, C> {
19141 self._name = new_value.to_string();
19142 self
19143 }
19144 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19145 /// while executing the actual API request.
19146 ///
19147 /// ````text
19148 /// It should be used to handle progress information, and to implement a certain level of resilience.
19149 /// ````
19150 ///
19151 /// Sets the *delegate* property to the given value.
19152 pub fn delegate(
19153 mut self,
19154 new_value: &'a mut dyn common::Delegate,
19155 ) -> SiteDomainUpdateCall<'a, C> {
19156 self._delegate = Some(new_value);
19157 self
19158 }
19159
19160 /// Set any additional parameter of the query string used in the request.
19161 /// It should be used to set parameters which are not yet available through their own
19162 /// setters.
19163 ///
19164 /// Please note that this method must not be used to set any of the known parameters
19165 /// which have their own setter method. If done anyway, the request will fail.
19166 ///
19167 /// # Additional Parameters
19168 ///
19169 /// * *$.xgafv* (query-string) - V1 error format.
19170 /// * *access_token* (query-string) - OAuth access token.
19171 /// * *alt* (query-string) - Data format for response.
19172 /// * *callback* (query-string) - JSONP
19173 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19174 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19175 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19176 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19177 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19178 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19179 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19180 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainUpdateCall<'a, C>
19181 where
19182 T: AsRef<str>,
19183 {
19184 self._additional_params
19185 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19186 self
19187 }
19188
19189 /// Identifies the authorization scope for the method you are building.
19190 ///
19191 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19192 /// [`Scope::CloudPlatform`].
19193 ///
19194 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19195 /// tokens for more than one scope.
19196 ///
19197 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19198 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19199 /// sufficient, a read-write scope will do as well.
19200 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainUpdateCall<'a, C>
19201 where
19202 St: AsRef<str>,
19203 {
19204 self._scopes.insert(String::from(scope.as_ref()));
19205 self
19206 }
19207 /// Identifies the authorization scope(s) for the method you are building.
19208 ///
19209 /// See [`Self::add_scope()`] for details.
19210 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainUpdateCall<'a, C>
19211 where
19212 I: IntoIterator<Item = St>,
19213 St: AsRef<str>,
19214 {
19215 self._scopes
19216 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19217 self
19218 }
19219
19220 /// Removes all scopes, and no default scope will be used either.
19221 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19222 /// for details).
19223 pub fn clear_scopes(mut self) -> SiteDomainUpdateCall<'a, C> {
19224 self._scopes.clear();
19225 self
19226 }
19227}
19228
19229/// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
19230///
19231/// A builder for the *releases.create* method supported by a *site* resource.
19232/// It is not used directly, but through a [`SiteMethods`] instance.
19233///
19234/// # Example
19235///
19236/// Instantiate a resource method builder
19237///
19238/// ```test_harness,no_run
19239/// # extern crate hyper;
19240/// # extern crate hyper_rustls;
19241/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
19242/// use firebasehosting1_beta1::api::Release;
19243/// # async fn dox() {
19244/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19245///
19246/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19247/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19248/// # secret,
19249/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19250/// # ).build().await.unwrap();
19251///
19252/// # let client = hyper_util::client::legacy::Client::builder(
19253/// # hyper_util::rt::TokioExecutor::new()
19254/// # )
19255/// # .build(
19256/// # hyper_rustls::HttpsConnectorBuilder::new()
19257/// # .with_native_roots()
19258/// # .unwrap()
19259/// # .https_or_http()
19260/// # .enable_http1()
19261/// # .build()
19262/// # );
19263/// # let mut hub = FirebaseHosting::new(client, auth);
19264/// // As the method needs a request, you would usually fill it with the desired information
19265/// // into the respective structure. Some of the parts shown here might not be applicable !
19266/// // Values shown here are possibly random and not representative !
19267/// let mut req = Release::default();
19268///
19269/// // You can configure optional parameters by calling the respective setters at will, and
19270/// // execute the final call using `doit()`.
19271/// // Values shown here are possibly random and not representative !
19272/// let result = hub.sites().releases_create(req, "parent")
19273/// .version_name("sed")
19274/// .doit().await;
19275/// # }
19276/// ```
19277pub struct SiteReleaseCreateCall<'a, C>
19278where
19279 C: 'a,
19280{
19281 hub: &'a FirebaseHosting<C>,
19282 _request: Release,
19283 _parent: String,
19284 _version_name: Option<String>,
19285 _delegate: Option<&'a mut dyn common::Delegate>,
19286 _additional_params: HashMap<String, String>,
19287 _scopes: BTreeSet<String>,
19288}
19289
19290impl<'a, C> common::CallBuilder for SiteReleaseCreateCall<'a, C> {}
19291
19292impl<'a, C> SiteReleaseCreateCall<'a, C>
19293where
19294 C: common::Connector,
19295{
19296 /// Perform the operation you have build so far.
19297 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
19298 use std::borrow::Cow;
19299 use std::io::{Read, Seek};
19300
19301 use common::{url::Params, ToParts};
19302 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19303
19304 let mut dd = common::DefaultDelegate;
19305 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19306 dlg.begin(common::MethodInfo {
19307 id: "firebasehosting.sites.releases.create",
19308 http_method: hyper::Method::POST,
19309 });
19310
19311 for &field in ["alt", "parent", "versionName"].iter() {
19312 if self._additional_params.contains_key(field) {
19313 dlg.finished(false);
19314 return Err(common::Error::FieldClash(field));
19315 }
19316 }
19317
19318 let mut params = Params::with_capacity(5 + self._additional_params.len());
19319 params.push("parent", self._parent);
19320 if let Some(value) = self._version_name.as_ref() {
19321 params.push("versionName", value);
19322 }
19323
19324 params.extend(self._additional_params.iter());
19325
19326 params.push("alt", "json");
19327 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
19328 if self._scopes.is_empty() {
19329 self._scopes
19330 .insert(Scope::CloudPlatform.as_ref().to_string());
19331 }
19332
19333 #[allow(clippy::single_element_loop)]
19334 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19335 url = params.uri_replacement(url, param_name, find_this, true);
19336 }
19337 {
19338 let to_remove = ["parent"];
19339 params.remove_params(&to_remove);
19340 }
19341
19342 let url = params.parse_with_url(&url);
19343
19344 let mut json_mime_type = mime::APPLICATION_JSON;
19345 let mut request_value_reader = {
19346 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19347 common::remove_json_null_values(&mut value);
19348 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19349 serde_json::to_writer(&mut dst, &value).unwrap();
19350 dst
19351 };
19352 let request_size = request_value_reader
19353 .seek(std::io::SeekFrom::End(0))
19354 .unwrap();
19355 request_value_reader
19356 .seek(std::io::SeekFrom::Start(0))
19357 .unwrap();
19358
19359 loop {
19360 let token = match self
19361 .hub
19362 .auth
19363 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19364 .await
19365 {
19366 Ok(token) => token,
19367 Err(e) => match dlg.token(e) {
19368 Ok(token) => token,
19369 Err(e) => {
19370 dlg.finished(false);
19371 return Err(common::Error::MissingToken(e));
19372 }
19373 },
19374 };
19375 request_value_reader
19376 .seek(std::io::SeekFrom::Start(0))
19377 .unwrap();
19378 let mut req_result = {
19379 let client = &self.hub.client;
19380 dlg.pre_request();
19381 let mut req_builder = hyper::Request::builder()
19382 .method(hyper::Method::POST)
19383 .uri(url.as_str())
19384 .header(USER_AGENT, self.hub._user_agent.clone());
19385
19386 if let Some(token) = token.as_ref() {
19387 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19388 }
19389
19390 let request = req_builder
19391 .header(CONTENT_TYPE, json_mime_type.to_string())
19392 .header(CONTENT_LENGTH, request_size as u64)
19393 .body(common::to_body(
19394 request_value_reader.get_ref().clone().into(),
19395 ));
19396
19397 client.request(request.unwrap()).await
19398 };
19399
19400 match req_result {
19401 Err(err) => {
19402 if let common::Retry::After(d) = dlg.http_error(&err) {
19403 sleep(d).await;
19404 continue;
19405 }
19406 dlg.finished(false);
19407 return Err(common::Error::HttpError(err));
19408 }
19409 Ok(res) => {
19410 let (mut parts, body) = res.into_parts();
19411 let mut body = common::Body::new(body);
19412 if !parts.status.is_success() {
19413 let bytes = common::to_bytes(body).await.unwrap_or_default();
19414 let error = serde_json::from_str(&common::to_string(&bytes));
19415 let response = common::to_response(parts, bytes.into());
19416
19417 if let common::Retry::After(d) =
19418 dlg.http_failure(&response, error.as_ref().ok())
19419 {
19420 sleep(d).await;
19421 continue;
19422 }
19423
19424 dlg.finished(false);
19425
19426 return Err(match error {
19427 Ok(value) => common::Error::BadRequest(value),
19428 _ => common::Error::Failure(response),
19429 });
19430 }
19431 let response = {
19432 let bytes = common::to_bytes(body).await.unwrap_or_default();
19433 let encoded = common::to_string(&bytes);
19434 match serde_json::from_str(&encoded) {
19435 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19436 Err(error) => {
19437 dlg.response_json_decode_error(&encoded, &error);
19438 return Err(common::Error::JsonDecodeError(
19439 encoded.to_string(),
19440 error,
19441 ));
19442 }
19443 }
19444 };
19445
19446 dlg.finished(true);
19447 return Ok(response);
19448 }
19449 }
19450 }
19451 }
19452
19453 ///
19454 /// Sets the *request* property to the given value.
19455 ///
19456 /// Even though the property as already been set when instantiating this call,
19457 /// we provide this method for API completeness.
19458 pub fn request(mut self, new_value: Release) -> SiteReleaseCreateCall<'a, C> {
19459 self._request = new_value;
19460 self
19461 }
19462 /// Required. The site or channel to which the release belongs, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
19463 ///
19464 /// Sets the *parent* path property to the given value.
19465 ///
19466 /// Even though the property as already been set when instantiating this call,
19467 /// we provide this method for API completeness.
19468 pub fn parent(mut self, new_value: &str) -> SiteReleaseCreateCall<'a, C> {
19469 self._parent = new_value.to_string();
19470 self
19471 }
19472 /// The unique identifier for a version, in the format: sites/SITE_ID/versions/ VERSION_ID The SITE_ID in this version identifier must match the SITE_ID in the `parent` parameter. This query parameter must be empty if the `type` field in the request body is `SITE_DISABLE`.
19473 ///
19474 /// Sets the *version name* query property to the given value.
19475 pub fn version_name(mut self, new_value: &str) -> SiteReleaseCreateCall<'a, C> {
19476 self._version_name = Some(new_value.to_string());
19477 self
19478 }
19479 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19480 /// while executing the actual API request.
19481 ///
19482 /// ````text
19483 /// It should be used to handle progress information, and to implement a certain level of resilience.
19484 /// ````
19485 ///
19486 /// Sets the *delegate* property to the given value.
19487 pub fn delegate(
19488 mut self,
19489 new_value: &'a mut dyn common::Delegate,
19490 ) -> SiteReleaseCreateCall<'a, C> {
19491 self._delegate = Some(new_value);
19492 self
19493 }
19494
19495 /// Set any additional parameter of the query string used in the request.
19496 /// It should be used to set parameters which are not yet available through their own
19497 /// setters.
19498 ///
19499 /// Please note that this method must not be used to set any of the known parameters
19500 /// which have their own setter method. If done anyway, the request will fail.
19501 ///
19502 /// # Additional Parameters
19503 ///
19504 /// * *$.xgafv* (query-string) - V1 error format.
19505 /// * *access_token* (query-string) - OAuth access token.
19506 /// * *alt* (query-string) - Data format for response.
19507 /// * *callback* (query-string) - JSONP
19508 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19509 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19510 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19511 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19512 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19513 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19514 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19515 pub fn param<T>(mut self, name: T, value: T) -> SiteReleaseCreateCall<'a, C>
19516 where
19517 T: AsRef<str>,
19518 {
19519 self._additional_params
19520 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19521 self
19522 }
19523
19524 /// Identifies the authorization scope for the method you are building.
19525 ///
19526 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19527 /// [`Scope::CloudPlatform`].
19528 ///
19529 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19530 /// tokens for more than one scope.
19531 ///
19532 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19533 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19534 /// sufficient, a read-write scope will do as well.
19535 pub fn add_scope<St>(mut self, scope: St) -> SiteReleaseCreateCall<'a, C>
19536 where
19537 St: AsRef<str>,
19538 {
19539 self._scopes.insert(String::from(scope.as_ref()));
19540 self
19541 }
19542 /// Identifies the authorization scope(s) for the method you are building.
19543 ///
19544 /// See [`Self::add_scope()`] for details.
19545 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteReleaseCreateCall<'a, C>
19546 where
19547 I: IntoIterator<Item = St>,
19548 St: AsRef<str>,
19549 {
19550 self._scopes
19551 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19552 self
19553 }
19554
19555 /// Removes all scopes, and no default scope will be used either.
19556 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19557 /// for details).
19558 pub fn clear_scopes(mut self) -> SiteReleaseCreateCall<'a, C> {
19559 self._scopes.clear();
19560 self
19561 }
19562}
19563
19564/// Gets the specified release for a site or channel. When used to get a release for a site, this can get releases for both the default `live` channel and any active preview channels for the specified site.
19565///
19566/// A builder for the *releases.get* method supported by a *site* resource.
19567/// It is not used directly, but through a [`SiteMethods`] instance.
19568///
19569/// # Example
19570///
19571/// Instantiate a resource method builder
19572///
19573/// ```test_harness,no_run
19574/// # extern crate hyper;
19575/// # extern crate hyper_rustls;
19576/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
19577/// # async fn dox() {
19578/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19579///
19580/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19581/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19582/// # secret,
19583/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19584/// # ).build().await.unwrap();
19585///
19586/// # let client = hyper_util::client::legacy::Client::builder(
19587/// # hyper_util::rt::TokioExecutor::new()
19588/// # )
19589/// # .build(
19590/// # hyper_rustls::HttpsConnectorBuilder::new()
19591/// # .with_native_roots()
19592/// # .unwrap()
19593/// # .https_or_http()
19594/// # .enable_http1()
19595/// # .build()
19596/// # );
19597/// # let mut hub = FirebaseHosting::new(client, auth);
19598/// // You can configure optional parameters by calling the respective setters at will, and
19599/// // execute the final call using `doit()`.
19600/// // Values shown here are possibly random and not representative !
19601/// let result = hub.sites().releases_get("name")
19602/// .doit().await;
19603/// # }
19604/// ```
19605pub struct SiteReleaseGetCall<'a, C>
19606where
19607 C: 'a,
19608{
19609 hub: &'a FirebaseHosting<C>,
19610 _name: String,
19611 _delegate: Option<&'a mut dyn common::Delegate>,
19612 _additional_params: HashMap<String, String>,
19613 _scopes: BTreeSet<String>,
19614}
19615
19616impl<'a, C> common::CallBuilder for SiteReleaseGetCall<'a, C> {}
19617
19618impl<'a, C> SiteReleaseGetCall<'a, C>
19619where
19620 C: common::Connector,
19621{
19622 /// Perform the operation you have build so far.
19623 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
19624 use std::borrow::Cow;
19625 use std::io::{Read, Seek};
19626
19627 use common::{url::Params, ToParts};
19628 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19629
19630 let mut dd = common::DefaultDelegate;
19631 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19632 dlg.begin(common::MethodInfo {
19633 id: "firebasehosting.sites.releases.get",
19634 http_method: hyper::Method::GET,
19635 });
19636
19637 for &field in ["alt", "name"].iter() {
19638 if self._additional_params.contains_key(field) {
19639 dlg.finished(false);
19640 return Err(common::Error::FieldClash(field));
19641 }
19642 }
19643
19644 let mut params = Params::with_capacity(3 + self._additional_params.len());
19645 params.push("name", self._name);
19646
19647 params.extend(self._additional_params.iter());
19648
19649 params.push("alt", "json");
19650 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
19651 if self._scopes.is_empty() {
19652 self._scopes
19653 .insert(Scope::FirebaseReadonly.as_ref().to_string());
19654 }
19655
19656 #[allow(clippy::single_element_loop)]
19657 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19658 url = params.uri_replacement(url, param_name, find_this, true);
19659 }
19660 {
19661 let to_remove = ["name"];
19662 params.remove_params(&to_remove);
19663 }
19664
19665 let url = params.parse_with_url(&url);
19666
19667 loop {
19668 let token = match self
19669 .hub
19670 .auth
19671 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19672 .await
19673 {
19674 Ok(token) => token,
19675 Err(e) => match dlg.token(e) {
19676 Ok(token) => token,
19677 Err(e) => {
19678 dlg.finished(false);
19679 return Err(common::Error::MissingToken(e));
19680 }
19681 },
19682 };
19683 let mut req_result = {
19684 let client = &self.hub.client;
19685 dlg.pre_request();
19686 let mut req_builder = hyper::Request::builder()
19687 .method(hyper::Method::GET)
19688 .uri(url.as_str())
19689 .header(USER_AGENT, self.hub._user_agent.clone());
19690
19691 if let Some(token) = token.as_ref() {
19692 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19693 }
19694
19695 let request = req_builder
19696 .header(CONTENT_LENGTH, 0_u64)
19697 .body(common::to_body::<String>(None));
19698
19699 client.request(request.unwrap()).await
19700 };
19701
19702 match req_result {
19703 Err(err) => {
19704 if let common::Retry::After(d) = dlg.http_error(&err) {
19705 sleep(d).await;
19706 continue;
19707 }
19708 dlg.finished(false);
19709 return Err(common::Error::HttpError(err));
19710 }
19711 Ok(res) => {
19712 let (mut parts, body) = res.into_parts();
19713 let mut body = common::Body::new(body);
19714 if !parts.status.is_success() {
19715 let bytes = common::to_bytes(body).await.unwrap_or_default();
19716 let error = serde_json::from_str(&common::to_string(&bytes));
19717 let response = common::to_response(parts, bytes.into());
19718
19719 if let common::Retry::After(d) =
19720 dlg.http_failure(&response, error.as_ref().ok())
19721 {
19722 sleep(d).await;
19723 continue;
19724 }
19725
19726 dlg.finished(false);
19727
19728 return Err(match error {
19729 Ok(value) => common::Error::BadRequest(value),
19730 _ => common::Error::Failure(response),
19731 });
19732 }
19733 let response = {
19734 let bytes = common::to_bytes(body).await.unwrap_or_default();
19735 let encoded = common::to_string(&bytes);
19736 match serde_json::from_str(&encoded) {
19737 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19738 Err(error) => {
19739 dlg.response_json_decode_error(&encoded, &error);
19740 return Err(common::Error::JsonDecodeError(
19741 encoded.to_string(),
19742 error,
19743 ));
19744 }
19745 }
19746 };
19747
19748 dlg.finished(true);
19749 return Ok(response);
19750 }
19751 }
19752 }
19753 }
19754
19755 /// Required. The fully-qualified resource name for the Hosting release, in either of the following formats: - sites/SITE_ID/channels/CHANNEL_ID/releases/RELEASE_ID - sites/SITE_ID/releases/RELEASE_ID
19756 ///
19757 /// Sets the *name* path property to the given value.
19758 ///
19759 /// Even though the property as already been set when instantiating this call,
19760 /// we provide this method for API completeness.
19761 pub fn name(mut self, new_value: &str) -> SiteReleaseGetCall<'a, C> {
19762 self._name = new_value.to_string();
19763 self
19764 }
19765 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19766 /// while executing the actual API request.
19767 ///
19768 /// ````text
19769 /// It should be used to handle progress information, and to implement a certain level of resilience.
19770 /// ````
19771 ///
19772 /// Sets the *delegate* property to the given value.
19773 pub fn delegate(
19774 mut self,
19775 new_value: &'a mut dyn common::Delegate,
19776 ) -> SiteReleaseGetCall<'a, C> {
19777 self._delegate = Some(new_value);
19778 self
19779 }
19780
19781 /// Set any additional parameter of the query string used in the request.
19782 /// It should be used to set parameters which are not yet available through their own
19783 /// setters.
19784 ///
19785 /// Please note that this method must not be used to set any of the known parameters
19786 /// which have their own setter method. If done anyway, the request will fail.
19787 ///
19788 /// # Additional Parameters
19789 ///
19790 /// * *$.xgafv* (query-string) - V1 error format.
19791 /// * *access_token* (query-string) - OAuth access token.
19792 /// * *alt* (query-string) - Data format for response.
19793 /// * *callback* (query-string) - JSONP
19794 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19795 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19796 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19797 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19798 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19799 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19800 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19801 pub fn param<T>(mut self, name: T, value: T) -> SiteReleaseGetCall<'a, C>
19802 where
19803 T: AsRef<str>,
19804 {
19805 self._additional_params
19806 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19807 self
19808 }
19809
19810 /// Identifies the authorization scope for the method you are building.
19811 ///
19812 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19813 /// [`Scope::FirebaseReadonly`].
19814 ///
19815 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19816 /// tokens for more than one scope.
19817 ///
19818 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19819 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19820 /// sufficient, a read-write scope will do as well.
19821 pub fn add_scope<St>(mut self, scope: St) -> SiteReleaseGetCall<'a, C>
19822 where
19823 St: AsRef<str>,
19824 {
19825 self._scopes.insert(String::from(scope.as_ref()));
19826 self
19827 }
19828 /// Identifies the authorization scope(s) for the method you are building.
19829 ///
19830 /// See [`Self::add_scope()`] for details.
19831 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteReleaseGetCall<'a, C>
19832 where
19833 I: IntoIterator<Item = St>,
19834 St: AsRef<str>,
19835 {
19836 self._scopes
19837 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19838 self
19839 }
19840
19841 /// Removes all scopes, and no default scope will be used either.
19842 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19843 /// for details).
19844 pub fn clear_scopes(mut self) -> SiteReleaseGetCall<'a, C> {
19845 self._scopes.clear();
19846 self
19847 }
19848}
19849
19850/// Lists the releases that have been created for the specified site or channel. When used to list releases for a site, this list includes releases for both the default `live` channel and any active preview channels for the specified site.
19851///
19852/// A builder for the *releases.list* method supported by a *site* resource.
19853/// It is not used directly, but through a [`SiteMethods`] instance.
19854///
19855/// # Example
19856///
19857/// Instantiate a resource method builder
19858///
19859/// ```test_harness,no_run
19860/// # extern crate hyper;
19861/// # extern crate hyper_rustls;
19862/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
19863/// # async fn dox() {
19864/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19865///
19866/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19867/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19868/// # secret,
19869/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19870/// # ).build().await.unwrap();
19871///
19872/// # let client = hyper_util::client::legacy::Client::builder(
19873/// # hyper_util::rt::TokioExecutor::new()
19874/// # )
19875/// # .build(
19876/// # hyper_rustls::HttpsConnectorBuilder::new()
19877/// # .with_native_roots()
19878/// # .unwrap()
19879/// # .https_or_http()
19880/// # .enable_http1()
19881/// # .build()
19882/// # );
19883/// # let mut hub = FirebaseHosting::new(client, auth);
19884/// // You can configure optional parameters by calling the respective setters at will, and
19885/// // execute the final call using `doit()`.
19886/// // Values shown here are possibly random and not representative !
19887/// let result = hub.sites().releases_list("parent")
19888/// .page_token("At")
19889/// .page_size(-45)
19890/// .doit().await;
19891/// # }
19892/// ```
19893pub struct SiteReleaseListCall<'a, C>
19894where
19895 C: 'a,
19896{
19897 hub: &'a FirebaseHosting<C>,
19898 _parent: String,
19899 _page_token: Option<String>,
19900 _page_size: Option<i32>,
19901 _delegate: Option<&'a mut dyn common::Delegate>,
19902 _additional_params: HashMap<String, String>,
19903 _scopes: BTreeSet<String>,
19904}
19905
19906impl<'a, C> common::CallBuilder for SiteReleaseListCall<'a, C> {}
19907
19908impl<'a, C> SiteReleaseListCall<'a, C>
19909where
19910 C: common::Connector,
19911{
19912 /// Perform the operation you have build so far.
19913 pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
19914 use std::borrow::Cow;
19915 use std::io::{Read, Seek};
19916
19917 use common::{url::Params, ToParts};
19918 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19919
19920 let mut dd = common::DefaultDelegate;
19921 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19922 dlg.begin(common::MethodInfo {
19923 id: "firebasehosting.sites.releases.list",
19924 http_method: hyper::Method::GET,
19925 });
19926
19927 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
19928 if self._additional_params.contains_key(field) {
19929 dlg.finished(false);
19930 return Err(common::Error::FieldClash(field));
19931 }
19932 }
19933
19934 let mut params = Params::with_capacity(5 + self._additional_params.len());
19935 params.push("parent", self._parent);
19936 if let Some(value) = self._page_token.as_ref() {
19937 params.push("pageToken", value);
19938 }
19939 if let Some(value) = self._page_size.as_ref() {
19940 params.push("pageSize", value.to_string());
19941 }
19942
19943 params.extend(self._additional_params.iter());
19944
19945 params.push("alt", "json");
19946 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
19947 if self._scopes.is_empty() {
19948 self._scopes
19949 .insert(Scope::FirebaseReadonly.as_ref().to_string());
19950 }
19951
19952 #[allow(clippy::single_element_loop)]
19953 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19954 url = params.uri_replacement(url, param_name, find_this, true);
19955 }
19956 {
19957 let to_remove = ["parent"];
19958 params.remove_params(&to_remove);
19959 }
19960
19961 let url = params.parse_with_url(&url);
19962
19963 loop {
19964 let token = match self
19965 .hub
19966 .auth
19967 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19968 .await
19969 {
19970 Ok(token) => token,
19971 Err(e) => match dlg.token(e) {
19972 Ok(token) => token,
19973 Err(e) => {
19974 dlg.finished(false);
19975 return Err(common::Error::MissingToken(e));
19976 }
19977 },
19978 };
19979 let mut req_result = {
19980 let client = &self.hub.client;
19981 dlg.pre_request();
19982 let mut req_builder = hyper::Request::builder()
19983 .method(hyper::Method::GET)
19984 .uri(url.as_str())
19985 .header(USER_AGENT, self.hub._user_agent.clone());
19986
19987 if let Some(token) = token.as_ref() {
19988 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19989 }
19990
19991 let request = req_builder
19992 .header(CONTENT_LENGTH, 0_u64)
19993 .body(common::to_body::<String>(None));
19994
19995 client.request(request.unwrap()).await
19996 };
19997
19998 match req_result {
19999 Err(err) => {
20000 if let common::Retry::After(d) = dlg.http_error(&err) {
20001 sleep(d).await;
20002 continue;
20003 }
20004 dlg.finished(false);
20005 return Err(common::Error::HttpError(err));
20006 }
20007 Ok(res) => {
20008 let (mut parts, body) = res.into_parts();
20009 let mut body = common::Body::new(body);
20010 if !parts.status.is_success() {
20011 let bytes = common::to_bytes(body).await.unwrap_or_default();
20012 let error = serde_json::from_str(&common::to_string(&bytes));
20013 let response = common::to_response(parts, bytes.into());
20014
20015 if let common::Retry::After(d) =
20016 dlg.http_failure(&response, error.as_ref().ok())
20017 {
20018 sleep(d).await;
20019 continue;
20020 }
20021
20022 dlg.finished(false);
20023
20024 return Err(match error {
20025 Ok(value) => common::Error::BadRequest(value),
20026 _ => common::Error::Failure(response),
20027 });
20028 }
20029 let response = {
20030 let bytes = common::to_bytes(body).await.unwrap_or_default();
20031 let encoded = common::to_string(&bytes);
20032 match serde_json::from_str(&encoded) {
20033 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20034 Err(error) => {
20035 dlg.response_json_decode_error(&encoded, &error);
20036 return Err(common::Error::JsonDecodeError(
20037 encoded.to_string(),
20038 error,
20039 ));
20040 }
20041 }
20042 };
20043
20044 dlg.finished(true);
20045 return Ok(response);
20046 }
20047 }
20048 }
20049 }
20050
20051 /// Required. The site or channel for which to list releases, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
20052 ///
20053 /// Sets the *parent* path property to the given value.
20054 ///
20055 /// Even though the property as already been set when instantiating this call,
20056 /// we provide this method for API completeness.
20057 pub fn parent(mut self, new_value: &str) -> SiteReleaseListCall<'a, C> {
20058 self._parent = new_value.to_string();
20059 self
20060 }
20061 /// A token from a previous call to `releases.list` or `channels.releases.list` that tells the server where to resume listing.
20062 ///
20063 /// Sets the *page token* query property to the given value.
20064 pub fn page_token(mut self, new_value: &str) -> SiteReleaseListCall<'a, C> {
20065 self._page_token = Some(new_value.to_string());
20066 self
20067 }
20068 /// The maximum number of releases to return. The service may return a lower number if fewer releases exist than this maximum number. If unspecified, defaults to 100.
20069 ///
20070 /// Sets the *page size* query property to the given value.
20071 pub fn page_size(mut self, new_value: i32) -> SiteReleaseListCall<'a, C> {
20072 self._page_size = Some(new_value);
20073 self
20074 }
20075 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20076 /// while executing the actual API request.
20077 ///
20078 /// ````text
20079 /// It should be used to handle progress information, and to implement a certain level of resilience.
20080 /// ````
20081 ///
20082 /// Sets the *delegate* property to the given value.
20083 pub fn delegate(
20084 mut self,
20085 new_value: &'a mut dyn common::Delegate,
20086 ) -> SiteReleaseListCall<'a, C> {
20087 self._delegate = Some(new_value);
20088 self
20089 }
20090
20091 /// Set any additional parameter of the query string used in the request.
20092 /// It should be used to set parameters which are not yet available through their own
20093 /// setters.
20094 ///
20095 /// Please note that this method must not be used to set any of the known parameters
20096 /// which have their own setter method. If done anyway, the request will fail.
20097 ///
20098 /// # Additional Parameters
20099 ///
20100 /// * *$.xgafv* (query-string) - V1 error format.
20101 /// * *access_token* (query-string) - OAuth access token.
20102 /// * *alt* (query-string) - Data format for response.
20103 /// * *callback* (query-string) - JSONP
20104 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20105 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20106 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20107 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20108 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20109 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20110 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20111 pub fn param<T>(mut self, name: T, value: T) -> SiteReleaseListCall<'a, C>
20112 where
20113 T: AsRef<str>,
20114 {
20115 self._additional_params
20116 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20117 self
20118 }
20119
20120 /// Identifies the authorization scope for the method you are building.
20121 ///
20122 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20123 /// [`Scope::FirebaseReadonly`].
20124 ///
20125 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20126 /// tokens for more than one scope.
20127 ///
20128 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20129 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20130 /// sufficient, a read-write scope will do as well.
20131 pub fn add_scope<St>(mut self, scope: St) -> SiteReleaseListCall<'a, C>
20132 where
20133 St: AsRef<str>,
20134 {
20135 self._scopes.insert(String::from(scope.as_ref()));
20136 self
20137 }
20138 /// Identifies the authorization scope(s) for the method you are building.
20139 ///
20140 /// See [`Self::add_scope()`] for details.
20141 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteReleaseListCall<'a, C>
20142 where
20143 I: IntoIterator<Item = St>,
20144 St: AsRef<str>,
20145 {
20146 self._scopes
20147 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20148 self
20149 }
20150
20151 /// Removes all scopes, and no default scope will be used either.
20152 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20153 /// for details).
20154 pub fn clear_scopes(mut self) -> SiteReleaseListCall<'a, C> {
20155 self._scopes.clear();
20156 self
20157 }
20158}
20159
20160/// Lists the remaining files to be uploaded for the specified version.
20161///
20162/// A builder for the *versions.files.list* method supported by a *site* resource.
20163/// It is not used directly, but through a [`SiteMethods`] instance.
20164///
20165/// # Example
20166///
20167/// Instantiate a resource method builder
20168///
20169/// ```test_harness,no_run
20170/// # extern crate hyper;
20171/// # extern crate hyper_rustls;
20172/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
20173/// # async fn dox() {
20174/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20175///
20176/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20177/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20178/// # secret,
20179/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20180/// # ).build().await.unwrap();
20181///
20182/// # let client = hyper_util::client::legacy::Client::builder(
20183/// # hyper_util::rt::TokioExecutor::new()
20184/// # )
20185/// # .build(
20186/// # hyper_rustls::HttpsConnectorBuilder::new()
20187/// # .with_native_roots()
20188/// # .unwrap()
20189/// # .https_or_http()
20190/// # .enable_http1()
20191/// # .build()
20192/// # );
20193/// # let mut hub = FirebaseHosting::new(client, auth);
20194/// // You can configure optional parameters by calling the respective setters at will, and
20195/// // execute the final call using `doit()`.
20196/// // Values shown here are possibly random and not representative !
20197/// let result = hub.sites().versions_files_list("parent")
20198/// .status("dolores")
20199/// .page_token("sadipscing")
20200/// .page_size(-31)
20201/// .doit().await;
20202/// # }
20203/// ```
20204pub struct SiteVersionFileListCall<'a, C>
20205where
20206 C: 'a,
20207{
20208 hub: &'a FirebaseHosting<C>,
20209 _parent: String,
20210 _status: Option<String>,
20211 _page_token: Option<String>,
20212 _page_size: Option<i32>,
20213 _delegate: Option<&'a mut dyn common::Delegate>,
20214 _additional_params: HashMap<String, String>,
20215 _scopes: BTreeSet<String>,
20216}
20217
20218impl<'a, C> common::CallBuilder for SiteVersionFileListCall<'a, C> {}
20219
20220impl<'a, C> SiteVersionFileListCall<'a, C>
20221where
20222 C: common::Connector,
20223{
20224 /// Perform the operation you have build so far.
20225 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionFilesResponse)> {
20226 use std::borrow::Cow;
20227 use std::io::{Read, Seek};
20228
20229 use common::{url::Params, ToParts};
20230 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20231
20232 let mut dd = common::DefaultDelegate;
20233 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20234 dlg.begin(common::MethodInfo {
20235 id: "firebasehosting.sites.versions.files.list",
20236 http_method: hyper::Method::GET,
20237 });
20238
20239 for &field in ["alt", "parent", "status", "pageToken", "pageSize"].iter() {
20240 if self._additional_params.contains_key(field) {
20241 dlg.finished(false);
20242 return Err(common::Error::FieldClash(field));
20243 }
20244 }
20245
20246 let mut params = Params::with_capacity(6 + self._additional_params.len());
20247 params.push("parent", self._parent);
20248 if let Some(value) = self._status.as_ref() {
20249 params.push("status", value);
20250 }
20251 if let Some(value) = self._page_token.as_ref() {
20252 params.push("pageToken", value);
20253 }
20254 if let Some(value) = self._page_size.as_ref() {
20255 params.push("pageSize", value.to_string());
20256 }
20257
20258 params.extend(self._additional_params.iter());
20259
20260 params.push("alt", "json");
20261 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/files";
20262 if self._scopes.is_empty() {
20263 self._scopes
20264 .insert(Scope::FirebaseReadonly.as_ref().to_string());
20265 }
20266
20267 #[allow(clippy::single_element_loop)]
20268 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20269 url = params.uri_replacement(url, param_name, find_this, true);
20270 }
20271 {
20272 let to_remove = ["parent"];
20273 params.remove_params(&to_remove);
20274 }
20275
20276 let url = params.parse_with_url(&url);
20277
20278 loop {
20279 let token = match self
20280 .hub
20281 .auth
20282 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20283 .await
20284 {
20285 Ok(token) => token,
20286 Err(e) => match dlg.token(e) {
20287 Ok(token) => token,
20288 Err(e) => {
20289 dlg.finished(false);
20290 return Err(common::Error::MissingToken(e));
20291 }
20292 },
20293 };
20294 let mut req_result = {
20295 let client = &self.hub.client;
20296 dlg.pre_request();
20297 let mut req_builder = hyper::Request::builder()
20298 .method(hyper::Method::GET)
20299 .uri(url.as_str())
20300 .header(USER_AGENT, self.hub._user_agent.clone());
20301
20302 if let Some(token) = token.as_ref() {
20303 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20304 }
20305
20306 let request = req_builder
20307 .header(CONTENT_LENGTH, 0_u64)
20308 .body(common::to_body::<String>(None));
20309
20310 client.request(request.unwrap()).await
20311 };
20312
20313 match req_result {
20314 Err(err) => {
20315 if let common::Retry::After(d) = dlg.http_error(&err) {
20316 sleep(d).await;
20317 continue;
20318 }
20319 dlg.finished(false);
20320 return Err(common::Error::HttpError(err));
20321 }
20322 Ok(res) => {
20323 let (mut parts, body) = res.into_parts();
20324 let mut body = common::Body::new(body);
20325 if !parts.status.is_success() {
20326 let bytes = common::to_bytes(body).await.unwrap_or_default();
20327 let error = serde_json::from_str(&common::to_string(&bytes));
20328 let response = common::to_response(parts, bytes.into());
20329
20330 if let common::Retry::After(d) =
20331 dlg.http_failure(&response, error.as_ref().ok())
20332 {
20333 sleep(d).await;
20334 continue;
20335 }
20336
20337 dlg.finished(false);
20338
20339 return Err(match error {
20340 Ok(value) => common::Error::BadRequest(value),
20341 _ => common::Error::Failure(response),
20342 });
20343 }
20344 let response = {
20345 let bytes = common::to_bytes(body).await.unwrap_or_default();
20346 let encoded = common::to_string(&bytes);
20347 match serde_json::from_str(&encoded) {
20348 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20349 Err(error) => {
20350 dlg.response_json_decode_error(&encoded, &error);
20351 return Err(common::Error::JsonDecodeError(
20352 encoded.to_string(),
20353 error,
20354 ));
20355 }
20356 }
20357 };
20358
20359 dlg.finished(true);
20360 return Ok(response);
20361 }
20362 }
20363 }
20364 }
20365
20366 /// Required. The version for which to list files, in the format: sites/SITE_ID /versions/VERSION_ID
20367 ///
20368 /// Sets the *parent* path property to the given value.
20369 ///
20370 /// Even though the property as already been set when instantiating this call,
20371 /// we provide this method for API completeness.
20372 pub fn parent(mut self, new_value: &str) -> SiteVersionFileListCall<'a, C> {
20373 self._parent = new_value.to_string();
20374 self
20375 }
20376 /// The type of files that should be listed for the specified version.
20377 ///
20378 /// Sets the *status* query property to the given value.
20379 pub fn status(mut self, new_value: &str) -> SiteVersionFileListCall<'a, C> {
20380 self._status = Some(new_value.to_string());
20381 self
20382 }
20383 /// A token from a previous call to `ListVersionFiles` that tells the server where to resume listing.
20384 ///
20385 /// Sets the *page token* query property to the given value.
20386 pub fn page_token(mut self, new_value: &str) -> SiteVersionFileListCall<'a, C> {
20387 self._page_token = Some(new_value.to_string());
20388 self
20389 }
20390 /// The maximum number of version files to return. The service may return a lower number if fewer version files exist than this maximum number. If unspecified, defaults to 1000.
20391 ///
20392 /// Sets the *page size* query property to the given value.
20393 pub fn page_size(mut self, new_value: i32) -> SiteVersionFileListCall<'a, C> {
20394 self._page_size = Some(new_value);
20395 self
20396 }
20397 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20398 /// while executing the actual API request.
20399 ///
20400 /// ````text
20401 /// It should be used to handle progress information, and to implement a certain level of resilience.
20402 /// ````
20403 ///
20404 /// Sets the *delegate* property to the given value.
20405 pub fn delegate(
20406 mut self,
20407 new_value: &'a mut dyn common::Delegate,
20408 ) -> SiteVersionFileListCall<'a, C> {
20409 self._delegate = Some(new_value);
20410 self
20411 }
20412
20413 /// Set any additional parameter of the query string used in the request.
20414 /// It should be used to set parameters which are not yet available through their own
20415 /// setters.
20416 ///
20417 /// Please note that this method must not be used to set any of the known parameters
20418 /// which have their own setter method. If done anyway, the request will fail.
20419 ///
20420 /// # Additional Parameters
20421 ///
20422 /// * *$.xgafv* (query-string) - V1 error format.
20423 /// * *access_token* (query-string) - OAuth access token.
20424 /// * *alt* (query-string) - Data format for response.
20425 /// * *callback* (query-string) - JSONP
20426 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20427 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20428 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20429 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20430 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20431 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20432 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20433 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionFileListCall<'a, C>
20434 where
20435 T: AsRef<str>,
20436 {
20437 self._additional_params
20438 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20439 self
20440 }
20441
20442 /// Identifies the authorization scope for the method you are building.
20443 ///
20444 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20445 /// [`Scope::FirebaseReadonly`].
20446 ///
20447 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20448 /// tokens for more than one scope.
20449 ///
20450 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20451 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20452 /// sufficient, a read-write scope will do as well.
20453 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionFileListCall<'a, C>
20454 where
20455 St: AsRef<str>,
20456 {
20457 self._scopes.insert(String::from(scope.as_ref()));
20458 self
20459 }
20460 /// Identifies the authorization scope(s) for the method you are building.
20461 ///
20462 /// See [`Self::add_scope()`] for details.
20463 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionFileListCall<'a, C>
20464 where
20465 I: IntoIterator<Item = St>,
20466 St: AsRef<str>,
20467 {
20468 self._scopes
20469 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20470 self
20471 }
20472
20473 /// Removes all scopes, and no default scope will be used either.
20474 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20475 /// for details).
20476 pub fn clear_scopes(mut self) -> SiteVersionFileListCall<'a, C> {
20477 self._scopes.clear();
20478 self
20479 }
20480}
20481
20482/// Creates a new version on the specified target site using the content of the specified version.
20483///
20484/// A builder for the *versions.clone* method supported by a *site* resource.
20485/// It is not used directly, but through a [`SiteMethods`] instance.
20486///
20487/// # Example
20488///
20489/// Instantiate a resource method builder
20490///
20491/// ```test_harness,no_run
20492/// # extern crate hyper;
20493/// # extern crate hyper_rustls;
20494/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
20495/// use firebasehosting1_beta1::api::CloneVersionRequest;
20496/// # async fn dox() {
20497/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20498///
20499/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20500/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20501/// # secret,
20502/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20503/// # ).build().await.unwrap();
20504///
20505/// # let client = hyper_util::client::legacy::Client::builder(
20506/// # hyper_util::rt::TokioExecutor::new()
20507/// # )
20508/// # .build(
20509/// # hyper_rustls::HttpsConnectorBuilder::new()
20510/// # .with_native_roots()
20511/// # .unwrap()
20512/// # .https_or_http()
20513/// # .enable_http1()
20514/// # .build()
20515/// # );
20516/// # let mut hub = FirebaseHosting::new(client, auth);
20517/// // As the method needs a request, you would usually fill it with the desired information
20518/// // into the respective structure. Some of the parts shown here might not be applicable !
20519/// // Values shown here are possibly random and not representative !
20520/// let mut req = CloneVersionRequest::default();
20521///
20522/// // You can configure optional parameters by calling the respective setters at will, and
20523/// // execute the final call using `doit()`.
20524/// // Values shown here are possibly random and not representative !
20525/// let result = hub.sites().versions_clone(req, "parent")
20526/// .doit().await;
20527/// # }
20528/// ```
20529pub struct SiteVersionCloneCall<'a, C>
20530where
20531 C: 'a,
20532{
20533 hub: &'a FirebaseHosting<C>,
20534 _request: CloneVersionRequest,
20535 _parent: String,
20536 _delegate: Option<&'a mut dyn common::Delegate>,
20537 _additional_params: HashMap<String, String>,
20538 _scopes: BTreeSet<String>,
20539}
20540
20541impl<'a, C> common::CallBuilder for SiteVersionCloneCall<'a, C> {}
20542
20543impl<'a, C> SiteVersionCloneCall<'a, C>
20544where
20545 C: common::Connector,
20546{
20547 /// Perform the operation you have build so far.
20548 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20549 use std::borrow::Cow;
20550 use std::io::{Read, Seek};
20551
20552 use common::{url::Params, ToParts};
20553 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20554
20555 let mut dd = common::DefaultDelegate;
20556 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20557 dlg.begin(common::MethodInfo {
20558 id: "firebasehosting.sites.versions.clone",
20559 http_method: hyper::Method::POST,
20560 });
20561
20562 for &field in ["alt", "parent"].iter() {
20563 if self._additional_params.contains_key(field) {
20564 dlg.finished(false);
20565 return Err(common::Error::FieldClash(field));
20566 }
20567 }
20568
20569 let mut params = Params::with_capacity(4 + self._additional_params.len());
20570 params.push("parent", self._parent);
20571
20572 params.extend(self._additional_params.iter());
20573
20574 params.push("alt", "json");
20575 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions:clone";
20576 if self._scopes.is_empty() {
20577 self._scopes
20578 .insert(Scope::CloudPlatform.as_ref().to_string());
20579 }
20580
20581 #[allow(clippy::single_element_loop)]
20582 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20583 url = params.uri_replacement(url, param_name, find_this, true);
20584 }
20585 {
20586 let to_remove = ["parent"];
20587 params.remove_params(&to_remove);
20588 }
20589
20590 let url = params.parse_with_url(&url);
20591
20592 let mut json_mime_type = mime::APPLICATION_JSON;
20593 let mut request_value_reader = {
20594 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20595 common::remove_json_null_values(&mut value);
20596 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20597 serde_json::to_writer(&mut dst, &value).unwrap();
20598 dst
20599 };
20600 let request_size = request_value_reader
20601 .seek(std::io::SeekFrom::End(0))
20602 .unwrap();
20603 request_value_reader
20604 .seek(std::io::SeekFrom::Start(0))
20605 .unwrap();
20606
20607 loop {
20608 let token = match self
20609 .hub
20610 .auth
20611 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20612 .await
20613 {
20614 Ok(token) => token,
20615 Err(e) => match dlg.token(e) {
20616 Ok(token) => token,
20617 Err(e) => {
20618 dlg.finished(false);
20619 return Err(common::Error::MissingToken(e));
20620 }
20621 },
20622 };
20623 request_value_reader
20624 .seek(std::io::SeekFrom::Start(0))
20625 .unwrap();
20626 let mut req_result = {
20627 let client = &self.hub.client;
20628 dlg.pre_request();
20629 let mut req_builder = hyper::Request::builder()
20630 .method(hyper::Method::POST)
20631 .uri(url.as_str())
20632 .header(USER_AGENT, self.hub._user_agent.clone());
20633
20634 if let Some(token) = token.as_ref() {
20635 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20636 }
20637
20638 let request = req_builder
20639 .header(CONTENT_TYPE, json_mime_type.to_string())
20640 .header(CONTENT_LENGTH, request_size as u64)
20641 .body(common::to_body(
20642 request_value_reader.get_ref().clone().into(),
20643 ));
20644
20645 client.request(request.unwrap()).await
20646 };
20647
20648 match req_result {
20649 Err(err) => {
20650 if let common::Retry::After(d) = dlg.http_error(&err) {
20651 sleep(d).await;
20652 continue;
20653 }
20654 dlg.finished(false);
20655 return Err(common::Error::HttpError(err));
20656 }
20657 Ok(res) => {
20658 let (mut parts, body) = res.into_parts();
20659 let mut body = common::Body::new(body);
20660 if !parts.status.is_success() {
20661 let bytes = common::to_bytes(body).await.unwrap_or_default();
20662 let error = serde_json::from_str(&common::to_string(&bytes));
20663 let response = common::to_response(parts, bytes.into());
20664
20665 if let common::Retry::After(d) =
20666 dlg.http_failure(&response, error.as_ref().ok())
20667 {
20668 sleep(d).await;
20669 continue;
20670 }
20671
20672 dlg.finished(false);
20673
20674 return Err(match error {
20675 Ok(value) => common::Error::BadRequest(value),
20676 _ => common::Error::Failure(response),
20677 });
20678 }
20679 let response = {
20680 let bytes = common::to_bytes(body).await.unwrap_or_default();
20681 let encoded = common::to_string(&bytes);
20682 match serde_json::from_str(&encoded) {
20683 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20684 Err(error) => {
20685 dlg.response_json_decode_error(&encoded, &error);
20686 return Err(common::Error::JsonDecodeError(
20687 encoded.to_string(),
20688 error,
20689 ));
20690 }
20691 }
20692 };
20693
20694 dlg.finished(true);
20695 return Ok(response);
20696 }
20697 }
20698 }
20699 }
20700
20701 ///
20702 /// Sets the *request* property to the given value.
20703 ///
20704 /// Even though the property as already been set when instantiating this call,
20705 /// we provide this method for API completeness.
20706 pub fn request(mut self, new_value: CloneVersionRequest) -> SiteVersionCloneCall<'a, C> {
20707 self._request = new_value;
20708 self
20709 }
20710 /// Required. The target site for the cloned version, in the format: sites/ SITE_ID
20711 ///
20712 /// Sets the *parent* path property to the given value.
20713 ///
20714 /// Even though the property as already been set when instantiating this call,
20715 /// we provide this method for API completeness.
20716 pub fn parent(mut self, new_value: &str) -> SiteVersionCloneCall<'a, C> {
20717 self._parent = new_value.to_string();
20718 self
20719 }
20720 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20721 /// while executing the actual API request.
20722 ///
20723 /// ````text
20724 /// It should be used to handle progress information, and to implement a certain level of resilience.
20725 /// ````
20726 ///
20727 /// Sets the *delegate* property to the given value.
20728 pub fn delegate(
20729 mut self,
20730 new_value: &'a mut dyn common::Delegate,
20731 ) -> SiteVersionCloneCall<'a, C> {
20732 self._delegate = Some(new_value);
20733 self
20734 }
20735
20736 /// Set any additional parameter of the query string used in the request.
20737 /// It should be used to set parameters which are not yet available through their own
20738 /// setters.
20739 ///
20740 /// Please note that this method must not be used to set any of the known parameters
20741 /// which have their own setter method. If done anyway, the request will fail.
20742 ///
20743 /// # Additional Parameters
20744 ///
20745 /// * *$.xgafv* (query-string) - V1 error format.
20746 /// * *access_token* (query-string) - OAuth access token.
20747 /// * *alt* (query-string) - Data format for response.
20748 /// * *callback* (query-string) - JSONP
20749 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20750 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20751 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20752 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20753 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20754 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20755 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20756 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionCloneCall<'a, C>
20757 where
20758 T: AsRef<str>,
20759 {
20760 self._additional_params
20761 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20762 self
20763 }
20764
20765 /// Identifies the authorization scope for the method you are building.
20766 ///
20767 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20768 /// [`Scope::CloudPlatform`].
20769 ///
20770 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20771 /// tokens for more than one scope.
20772 ///
20773 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20774 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20775 /// sufficient, a read-write scope will do as well.
20776 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionCloneCall<'a, C>
20777 where
20778 St: AsRef<str>,
20779 {
20780 self._scopes.insert(String::from(scope.as_ref()));
20781 self
20782 }
20783 /// Identifies the authorization scope(s) for the method you are building.
20784 ///
20785 /// See [`Self::add_scope()`] for details.
20786 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionCloneCall<'a, C>
20787 where
20788 I: IntoIterator<Item = St>,
20789 St: AsRef<str>,
20790 {
20791 self._scopes
20792 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20793 self
20794 }
20795
20796 /// Removes all scopes, and no default scope will be used either.
20797 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20798 /// for details).
20799 pub fn clear_scopes(mut self) -> SiteVersionCloneCall<'a, C> {
20800 self._scopes.clear();
20801 self
20802 }
20803}
20804
20805/// Creates a new version for the specified site.
20806///
20807/// A builder for the *versions.create* method supported by a *site* resource.
20808/// It is not used directly, but through a [`SiteMethods`] instance.
20809///
20810/// # Example
20811///
20812/// Instantiate a resource method builder
20813///
20814/// ```test_harness,no_run
20815/// # extern crate hyper;
20816/// # extern crate hyper_rustls;
20817/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
20818/// use firebasehosting1_beta1::api::Version;
20819/// # async fn dox() {
20820/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20821///
20822/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20823/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20824/// # secret,
20825/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20826/// # ).build().await.unwrap();
20827///
20828/// # let client = hyper_util::client::legacy::Client::builder(
20829/// # hyper_util::rt::TokioExecutor::new()
20830/// # )
20831/// # .build(
20832/// # hyper_rustls::HttpsConnectorBuilder::new()
20833/// # .with_native_roots()
20834/// # .unwrap()
20835/// # .https_or_http()
20836/// # .enable_http1()
20837/// # .build()
20838/// # );
20839/// # let mut hub = FirebaseHosting::new(client, auth);
20840/// // As the method needs a request, you would usually fill it with the desired information
20841/// // into the respective structure. Some of the parts shown here might not be applicable !
20842/// // Values shown here are possibly random and not representative !
20843/// let mut req = Version::default();
20844///
20845/// // You can configure optional parameters by calling the respective setters at will, and
20846/// // execute the final call using `doit()`.
20847/// // Values shown here are possibly random and not representative !
20848/// let result = hub.sites().versions_create(req, "parent")
20849/// .version_id("est")
20850/// .size_bytes(-24)
20851/// .doit().await;
20852/// # }
20853/// ```
20854pub struct SiteVersionCreateCall<'a, C>
20855where
20856 C: 'a,
20857{
20858 hub: &'a FirebaseHosting<C>,
20859 _request: Version,
20860 _parent: String,
20861 _version_id: Option<String>,
20862 _size_bytes: Option<i64>,
20863 _delegate: Option<&'a mut dyn common::Delegate>,
20864 _additional_params: HashMap<String, String>,
20865 _scopes: BTreeSet<String>,
20866}
20867
20868impl<'a, C> common::CallBuilder for SiteVersionCreateCall<'a, C> {}
20869
20870impl<'a, C> SiteVersionCreateCall<'a, C>
20871where
20872 C: common::Connector,
20873{
20874 /// Perform the operation you have build so far.
20875 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
20876 use std::borrow::Cow;
20877 use std::io::{Read, Seek};
20878
20879 use common::{url::Params, ToParts};
20880 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20881
20882 let mut dd = common::DefaultDelegate;
20883 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20884 dlg.begin(common::MethodInfo {
20885 id: "firebasehosting.sites.versions.create",
20886 http_method: hyper::Method::POST,
20887 });
20888
20889 for &field in ["alt", "parent", "versionId", "sizeBytes"].iter() {
20890 if self._additional_params.contains_key(field) {
20891 dlg.finished(false);
20892 return Err(common::Error::FieldClash(field));
20893 }
20894 }
20895
20896 let mut params = Params::with_capacity(6 + self._additional_params.len());
20897 params.push("parent", self._parent);
20898 if let Some(value) = self._version_id.as_ref() {
20899 params.push("versionId", value);
20900 }
20901 if let Some(value) = self._size_bytes.as_ref() {
20902 params.push("sizeBytes", value.to_string());
20903 }
20904
20905 params.extend(self._additional_params.iter());
20906
20907 params.push("alt", "json");
20908 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
20909 if self._scopes.is_empty() {
20910 self._scopes
20911 .insert(Scope::CloudPlatform.as_ref().to_string());
20912 }
20913
20914 #[allow(clippy::single_element_loop)]
20915 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20916 url = params.uri_replacement(url, param_name, find_this, true);
20917 }
20918 {
20919 let to_remove = ["parent"];
20920 params.remove_params(&to_remove);
20921 }
20922
20923 let url = params.parse_with_url(&url);
20924
20925 let mut json_mime_type = mime::APPLICATION_JSON;
20926 let mut request_value_reader = {
20927 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20928 common::remove_json_null_values(&mut value);
20929 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20930 serde_json::to_writer(&mut dst, &value).unwrap();
20931 dst
20932 };
20933 let request_size = request_value_reader
20934 .seek(std::io::SeekFrom::End(0))
20935 .unwrap();
20936 request_value_reader
20937 .seek(std::io::SeekFrom::Start(0))
20938 .unwrap();
20939
20940 loop {
20941 let token = match self
20942 .hub
20943 .auth
20944 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20945 .await
20946 {
20947 Ok(token) => token,
20948 Err(e) => match dlg.token(e) {
20949 Ok(token) => token,
20950 Err(e) => {
20951 dlg.finished(false);
20952 return Err(common::Error::MissingToken(e));
20953 }
20954 },
20955 };
20956 request_value_reader
20957 .seek(std::io::SeekFrom::Start(0))
20958 .unwrap();
20959 let mut req_result = {
20960 let client = &self.hub.client;
20961 dlg.pre_request();
20962 let mut req_builder = hyper::Request::builder()
20963 .method(hyper::Method::POST)
20964 .uri(url.as_str())
20965 .header(USER_AGENT, self.hub._user_agent.clone());
20966
20967 if let Some(token) = token.as_ref() {
20968 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20969 }
20970
20971 let request = req_builder
20972 .header(CONTENT_TYPE, json_mime_type.to_string())
20973 .header(CONTENT_LENGTH, request_size as u64)
20974 .body(common::to_body(
20975 request_value_reader.get_ref().clone().into(),
20976 ));
20977
20978 client.request(request.unwrap()).await
20979 };
20980
20981 match req_result {
20982 Err(err) => {
20983 if let common::Retry::After(d) = dlg.http_error(&err) {
20984 sleep(d).await;
20985 continue;
20986 }
20987 dlg.finished(false);
20988 return Err(common::Error::HttpError(err));
20989 }
20990 Ok(res) => {
20991 let (mut parts, body) = res.into_parts();
20992 let mut body = common::Body::new(body);
20993 if !parts.status.is_success() {
20994 let bytes = common::to_bytes(body).await.unwrap_or_default();
20995 let error = serde_json::from_str(&common::to_string(&bytes));
20996 let response = common::to_response(parts, bytes.into());
20997
20998 if let common::Retry::After(d) =
20999 dlg.http_failure(&response, error.as_ref().ok())
21000 {
21001 sleep(d).await;
21002 continue;
21003 }
21004
21005 dlg.finished(false);
21006
21007 return Err(match error {
21008 Ok(value) => common::Error::BadRequest(value),
21009 _ => common::Error::Failure(response),
21010 });
21011 }
21012 let response = {
21013 let bytes = common::to_bytes(body).await.unwrap_or_default();
21014 let encoded = common::to_string(&bytes);
21015 match serde_json::from_str(&encoded) {
21016 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21017 Err(error) => {
21018 dlg.response_json_decode_error(&encoded, &error);
21019 return Err(common::Error::JsonDecodeError(
21020 encoded.to_string(),
21021 error,
21022 ));
21023 }
21024 }
21025 };
21026
21027 dlg.finished(true);
21028 return Ok(response);
21029 }
21030 }
21031 }
21032 }
21033
21034 ///
21035 /// Sets the *request* property to the given value.
21036 ///
21037 /// Even though the property as already been set when instantiating this call,
21038 /// we provide this method for API completeness.
21039 pub fn request(mut self, new_value: Version) -> SiteVersionCreateCall<'a, C> {
21040 self._request = new_value;
21041 self
21042 }
21043 /// Required. The site in which to create the version, in the format: sites/ SITE_ID
21044 ///
21045 /// Sets the *parent* path property to the given value.
21046 ///
21047 /// Even though the property as already been set when instantiating this call,
21048 /// we provide this method for API completeness.
21049 pub fn parent(mut self, new_value: &str) -> SiteVersionCreateCall<'a, C> {
21050 self._parent = new_value.to_string();
21051 self
21052 }
21053 /// A unique id for the new version. This is was only specified for legacy version creations, and should be blank.
21054 ///
21055 /// Sets the *version id* query property to the given value.
21056 pub fn version_id(mut self, new_value: &str) -> SiteVersionCreateCall<'a, C> {
21057 self._version_id = Some(new_value.to_string());
21058 self
21059 }
21060 /// The self-reported size of the version. This value is used for a pre-emptive quota check for legacy version uploads.
21061 ///
21062 /// Sets the *size bytes* query property to the given value.
21063 pub fn size_bytes(mut self, new_value: i64) -> SiteVersionCreateCall<'a, C> {
21064 self._size_bytes = Some(new_value);
21065 self
21066 }
21067 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21068 /// while executing the actual API request.
21069 ///
21070 /// ````text
21071 /// It should be used to handle progress information, and to implement a certain level of resilience.
21072 /// ````
21073 ///
21074 /// Sets the *delegate* property to the given value.
21075 pub fn delegate(
21076 mut self,
21077 new_value: &'a mut dyn common::Delegate,
21078 ) -> SiteVersionCreateCall<'a, C> {
21079 self._delegate = Some(new_value);
21080 self
21081 }
21082
21083 /// Set any additional parameter of the query string used in the request.
21084 /// It should be used to set parameters which are not yet available through their own
21085 /// setters.
21086 ///
21087 /// Please note that this method must not be used to set any of the known parameters
21088 /// which have their own setter method. If done anyway, the request will fail.
21089 ///
21090 /// # Additional Parameters
21091 ///
21092 /// * *$.xgafv* (query-string) - V1 error format.
21093 /// * *access_token* (query-string) - OAuth access token.
21094 /// * *alt* (query-string) - Data format for response.
21095 /// * *callback* (query-string) - JSONP
21096 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21097 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21098 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21099 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21100 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21101 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21102 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21103 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionCreateCall<'a, C>
21104 where
21105 T: AsRef<str>,
21106 {
21107 self._additional_params
21108 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21109 self
21110 }
21111
21112 /// Identifies the authorization scope for the method you are building.
21113 ///
21114 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21115 /// [`Scope::CloudPlatform`].
21116 ///
21117 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21118 /// tokens for more than one scope.
21119 ///
21120 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21121 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21122 /// sufficient, a read-write scope will do as well.
21123 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionCreateCall<'a, C>
21124 where
21125 St: AsRef<str>,
21126 {
21127 self._scopes.insert(String::from(scope.as_ref()));
21128 self
21129 }
21130 /// Identifies the authorization scope(s) for the method you are building.
21131 ///
21132 /// See [`Self::add_scope()`] for details.
21133 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionCreateCall<'a, C>
21134 where
21135 I: IntoIterator<Item = St>,
21136 St: AsRef<str>,
21137 {
21138 self._scopes
21139 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21140 self
21141 }
21142
21143 /// Removes all scopes, and no default scope will be used either.
21144 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21145 /// for details).
21146 pub fn clear_scopes(mut self) -> SiteVersionCreateCall<'a, C> {
21147 self._scopes.clear();
21148 self
21149 }
21150}
21151
21152/// Deletes the specified version.
21153///
21154/// A builder for the *versions.delete* method supported by a *site* resource.
21155/// It is not used directly, but through a [`SiteMethods`] instance.
21156///
21157/// # Example
21158///
21159/// Instantiate a resource method builder
21160///
21161/// ```test_harness,no_run
21162/// # extern crate hyper;
21163/// # extern crate hyper_rustls;
21164/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
21165/// # async fn dox() {
21166/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21167///
21168/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21169/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21170/// # secret,
21171/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21172/// # ).build().await.unwrap();
21173///
21174/// # let client = hyper_util::client::legacy::Client::builder(
21175/// # hyper_util::rt::TokioExecutor::new()
21176/// # )
21177/// # .build(
21178/// # hyper_rustls::HttpsConnectorBuilder::new()
21179/// # .with_native_roots()
21180/// # .unwrap()
21181/// # .https_or_http()
21182/// # .enable_http1()
21183/// # .build()
21184/// # );
21185/// # let mut hub = FirebaseHosting::new(client, auth);
21186/// // You can configure optional parameters by calling the respective setters at will, and
21187/// // execute the final call using `doit()`.
21188/// // Values shown here are possibly random and not representative !
21189/// let result = hub.sites().versions_delete("name")
21190/// .doit().await;
21191/// # }
21192/// ```
21193pub struct SiteVersionDeleteCall<'a, C>
21194where
21195 C: 'a,
21196{
21197 hub: &'a FirebaseHosting<C>,
21198 _name: String,
21199 _delegate: Option<&'a mut dyn common::Delegate>,
21200 _additional_params: HashMap<String, String>,
21201 _scopes: BTreeSet<String>,
21202}
21203
21204impl<'a, C> common::CallBuilder for SiteVersionDeleteCall<'a, C> {}
21205
21206impl<'a, C> SiteVersionDeleteCall<'a, C>
21207where
21208 C: common::Connector,
21209{
21210 /// Perform the operation you have build so far.
21211 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
21212 use std::borrow::Cow;
21213 use std::io::{Read, Seek};
21214
21215 use common::{url::Params, ToParts};
21216 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21217
21218 let mut dd = common::DefaultDelegate;
21219 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21220 dlg.begin(common::MethodInfo {
21221 id: "firebasehosting.sites.versions.delete",
21222 http_method: hyper::Method::DELETE,
21223 });
21224
21225 for &field in ["alt", "name"].iter() {
21226 if self._additional_params.contains_key(field) {
21227 dlg.finished(false);
21228 return Err(common::Error::FieldClash(field));
21229 }
21230 }
21231
21232 let mut params = Params::with_capacity(3 + self._additional_params.len());
21233 params.push("name", self._name);
21234
21235 params.extend(self._additional_params.iter());
21236
21237 params.push("alt", "json");
21238 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
21239 if self._scopes.is_empty() {
21240 self._scopes
21241 .insert(Scope::CloudPlatform.as_ref().to_string());
21242 }
21243
21244 #[allow(clippy::single_element_loop)]
21245 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21246 url = params.uri_replacement(url, param_name, find_this, true);
21247 }
21248 {
21249 let to_remove = ["name"];
21250 params.remove_params(&to_remove);
21251 }
21252
21253 let url = params.parse_with_url(&url);
21254
21255 loop {
21256 let token = match self
21257 .hub
21258 .auth
21259 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21260 .await
21261 {
21262 Ok(token) => token,
21263 Err(e) => match dlg.token(e) {
21264 Ok(token) => token,
21265 Err(e) => {
21266 dlg.finished(false);
21267 return Err(common::Error::MissingToken(e));
21268 }
21269 },
21270 };
21271 let mut req_result = {
21272 let client = &self.hub.client;
21273 dlg.pre_request();
21274 let mut req_builder = hyper::Request::builder()
21275 .method(hyper::Method::DELETE)
21276 .uri(url.as_str())
21277 .header(USER_AGENT, self.hub._user_agent.clone());
21278
21279 if let Some(token) = token.as_ref() {
21280 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21281 }
21282
21283 let request = req_builder
21284 .header(CONTENT_LENGTH, 0_u64)
21285 .body(common::to_body::<String>(None));
21286
21287 client.request(request.unwrap()).await
21288 };
21289
21290 match req_result {
21291 Err(err) => {
21292 if let common::Retry::After(d) = dlg.http_error(&err) {
21293 sleep(d).await;
21294 continue;
21295 }
21296 dlg.finished(false);
21297 return Err(common::Error::HttpError(err));
21298 }
21299 Ok(res) => {
21300 let (mut parts, body) = res.into_parts();
21301 let mut body = common::Body::new(body);
21302 if !parts.status.is_success() {
21303 let bytes = common::to_bytes(body).await.unwrap_or_default();
21304 let error = serde_json::from_str(&common::to_string(&bytes));
21305 let response = common::to_response(parts, bytes.into());
21306
21307 if let common::Retry::After(d) =
21308 dlg.http_failure(&response, error.as_ref().ok())
21309 {
21310 sleep(d).await;
21311 continue;
21312 }
21313
21314 dlg.finished(false);
21315
21316 return Err(match error {
21317 Ok(value) => common::Error::BadRequest(value),
21318 _ => common::Error::Failure(response),
21319 });
21320 }
21321 let response = {
21322 let bytes = common::to_bytes(body).await.unwrap_or_default();
21323 let encoded = common::to_string(&bytes);
21324 match serde_json::from_str(&encoded) {
21325 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21326 Err(error) => {
21327 dlg.response_json_decode_error(&encoded, &error);
21328 return Err(common::Error::JsonDecodeError(
21329 encoded.to_string(),
21330 error,
21331 ));
21332 }
21333 }
21334 };
21335
21336 dlg.finished(true);
21337 return Ok(response);
21338 }
21339 }
21340 }
21341 }
21342
21343 /// Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
21344 ///
21345 /// Sets the *name* path property to the given value.
21346 ///
21347 /// Even though the property as already been set when instantiating this call,
21348 /// we provide this method for API completeness.
21349 pub fn name(mut self, new_value: &str) -> SiteVersionDeleteCall<'a, C> {
21350 self._name = new_value.to_string();
21351 self
21352 }
21353 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21354 /// while executing the actual API request.
21355 ///
21356 /// ````text
21357 /// It should be used to handle progress information, and to implement a certain level of resilience.
21358 /// ````
21359 ///
21360 /// Sets the *delegate* property to the given value.
21361 pub fn delegate(
21362 mut self,
21363 new_value: &'a mut dyn common::Delegate,
21364 ) -> SiteVersionDeleteCall<'a, C> {
21365 self._delegate = Some(new_value);
21366 self
21367 }
21368
21369 /// Set any additional parameter of the query string used in the request.
21370 /// It should be used to set parameters which are not yet available through their own
21371 /// setters.
21372 ///
21373 /// Please note that this method must not be used to set any of the known parameters
21374 /// which have their own setter method. If done anyway, the request will fail.
21375 ///
21376 /// # Additional Parameters
21377 ///
21378 /// * *$.xgafv* (query-string) - V1 error format.
21379 /// * *access_token* (query-string) - OAuth access token.
21380 /// * *alt* (query-string) - Data format for response.
21381 /// * *callback* (query-string) - JSONP
21382 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21383 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21384 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21385 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21386 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21387 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21388 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21389 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionDeleteCall<'a, C>
21390 where
21391 T: AsRef<str>,
21392 {
21393 self._additional_params
21394 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21395 self
21396 }
21397
21398 /// Identifies the authorization scope for the method you are building.
21399 ///
21400 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21401 /// [`Scope::CloudPlatform`].
21402 ///
21403 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21404 /// tokens for more than one scope.
21405 ///
21406 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21407 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21408 /// sufficient, a read-write scope will do as well.
21409 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionDeleteCall<'a, C>
21410 where
21411 St: AsRef<str>,
21412 {
21413 self._scopes.insert(String::from(scope.as_ref()));
21414 self
21415 }
21416 /// Identifies the authorization scope(s) for the method you are building.
21417 ///
21418 /// See [`Self::add_scope()`] for details.
21419 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionDeleteCall<'a, C>
21420 where
21421 I: IntoIterator<Item = St>,
21422 St: AsRef<str>,
21423 {
21424 self._scopes
21425 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21426 self
21427 }
21428
21429 /// Removes all scopes, and no default scope will be used either.
21430 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21431 /// for details).
21432 pub fn clear_scopes(mut self) -> SiteVersionDeleteCall<'a, C> {
21433 self._scopes.clear();
21434 self
21435 }
21436}
21437
21438/// Get the specified version that has been created for the specified site. This can include versions that were created for the default `live` channel or for any active preview channels for the specified site.
21439///
21440/// A builder for the *versions.get* method supported by a *site* resource.
21441/// It is not used directly, but through a [`SiteMethods`] instance.
21442///
21443/// # Example
21444///
21445/// Instantiate a resource method builder
21446///
21447/// ```test_harness,no_run
21448/// # extern crate hyper;
21449/// # extern crate hyper_rustls;
21450/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
21451/// # async fn dox() {
21452/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21453///
21454/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21455/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21456/// # secret,
21457/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21458/// # ).build().await.unwrap();
21459///
21460/// # let client = hyper_util::client::legacy::Client::builder(
21461/// # hyper_util::rt::TokioExecutor::new()
21462/// # )
21463/// # .build(
21464/// # hyper_rustls::HttpsConnectorBuilder::new()
21465/// # .with_native_roots()
21466/// # .unwrap()
21467/// # .https_or_http()
21468/// # .enable_http1()
21469/// # .build()
21470/// # );
21471/// # let mut hub = FirebaseHosting::new(client, auth);
21472/// // You can configure optional parameters by calling the respective setters at will, and
21473/// // execute the final call using `doit()`.
21474/// // Values shown here are possibly random and not representative !
21475/// let result = hub.sites().versions_get("name")
21476/// .doit().await;
21477/// # }
21478/// ```
21479pub struct SiteVersionGetCall<'a, C>
21480where
21481 C: 'a,
21482{
21483 hub: &'a FirebaseHosting<C>,
21484 _name: String,
21485 _delegate: Option<&'a mut dyn common::Delegate>,
21486 _additional_params: HashMap<String, String>,
21487 _scopes: BTreeSet<String>,
21488}
21489
21490impl<'a, C> common::CallBuilder for SiteVersionGetCall<'a, C> {}
21491
21492impl<'a, C> SiteVersionGetCall<'a, C>
21493where
21494 C: common::Connector,
21495{
21496 /// Perform the operation you have build so far.
21497 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
21498 use std::borrow::Cow;
21499 use std::io::{Read, Seek};
21500
21501 use common::{url::Params, ToParts};
21502 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21503
21504 let mut dd = common::DefaultDelegate;
21505 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21506 dlg.begin(common::MethodInfo {
21507 id: "firebasehosting.sites.versions.get",
21508 http_method: hyper::Method::GET,
21509 });
21510
21511 for &field in ["alt", "name"].iter() {
21512 if self._additional_params.contains_key(field) {
21513 dlg.finished(false);
21514 return Err(common::Error::FieldClash(field));
21515 }
21516 }
21517
21518 let mut params = Params::with_capacity(3 + self._additional_params.len());
21519 params.push("name", self._name);
21520
21521 params.extend(self._additional_params.iter());
21522
21523 params.push("alt", "json");
21524 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
21525 if self._scopes.is_empty() {
21526 self._scopes
21527 .insert(Scope::FirebaseReadonly.as_ref().to_string());
21528 }
21529
21530 #[allow(clippy::single_element_loop)]
21531 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21532 url = params.uri_replacement(url, param_name, find_this, true);
21533 }
21534 {
21535 let to_remove = ["name"];
21536 params.remove_params(&to_remove);
21537 }
21538
21539 let url = params.parse_with_url(&url);
21540
21541 loop {
21542 let token = match self
21543 .hub
21544 .auth
21545 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21546 .await
21547 {
21548 Ok(token) => token,
21549 Err(e) => match dlg.token(e) {
21550 Ok(token) => token,
21551 Err(e) => {
21552 dlg.finished(false);
21553 return Err(common::Error::MissingToken(e));
21554 }
21555 },
21556 };
21557 let mut req_result = {
21558 let client = &self.hub.client;
21559 dlg.pre_request();
21560 let mut req_builder = hyper::Request::builder()
21561 .method(hyper::Method::GET)
21562 .uri(url.as_str())
21563 .header(USER_AGENT, self.hub._user_agent.clone());
21564
21565 if let Some(token) = token.as_ref() {
21566 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21567 }
21568
21569 let request = req_builder
21570 .header(CONTENT_LENGTH, 0_u64)
21571 .body(common::to_body::<String>(None));
21572
21573 client.request(request.unwrap()).await
21574 };
21575
21576 match req_result {
21577 Err(err) => {
21578 if let common::Retry::After(d) = dlg.http_error(&err) {
21579 sleep(d).await;
21580 continue;
21581 }
21582 dlg.finished(false);
21583 return Err(common::Error::HttpError(err));
21584 }
21585 Ok(res) => {
21586 let (mut parts, body) = res.into_parts();
21587 let mut body = common::Body::new(body);
21588 if !parts.status.is_success() {
21589 let bytes = common::to_bytes(body).await.unwrap_or_default();
21590 let error = serde_json::from_str(&common::to_string(&bytes));
21591 let response = common::to_response(parts, bytes.into());
21592
21593 if let common::Retry::After(d) =
21594 dlg.http_failure(&response, error.as_ref().ok())
21595 {
21596 sleep(d).await;
21597 continue;
21598 }
21599
21600 dlg.finished(false);
21601
21602 return Err(match error {
21603 Ok(value) => common::Error::BadRequest(value),
21604 _ => common::Error::Failure(response),
21605 });
21606 }
21607 let response = {
21608 let bytes = common::to_bytes(body).await.unwrap_or_default();
21609 let encoded = common::to_string(&bytes);
21610 match serde_json::from_str(&encoded) {
21611 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21612 Err(error) => {
21613 dlg.response_json_decode_error(&encoded, &error);
21614 return Err(common::Error::JsonDecodeError(
21615 encoded.to_string(),
21616 error,
21617 ));
21618 }
21619 }
21620 };
21621
21622 dlg.finished(true);
21623 return Ok(response);
21624 }
21625 }
21626 }
21627 }
21628
21629 /// Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
21630 ///
21631 /// Sets the *name* path property to the given value.
21632 ///
21633 /// Even though the property as already been set when instantiating this call,
21634 /// we provide this method for API completeness.
21635 pub fn name(mut self, new_value: &str) -> SiteVersionGetCall<'a, C> {
21636 self._name = new_value.to_string();
21637 self
21638 }
21639 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21640 /// while executing the actual API request.
21641 ///
21642 /// ````text
21643 /// It should be used to handle progress information, and to implement a certain level of resilience.
21644 /// ````
21645 ///
21646 /// Sets the *delegate* property to the given value.
21647 pub fn delegate(
21648 mut self,
21649 new_value: &'a mut dyn common::Delegate,
21650 ) -> SiteVersionGetCall<'a, C> {
21651 self._delegate = Some(new_value);
21652 self
21653 }
21654
21655 /// Set any additional parameter of the query string used in the request.
21656 /// It should be used to set parameters which are not yet available through their own
21657 /// setters.
21658 ///
21659 /// Please note that this method must not be used to set any of the known parameters
21660 /// which have their own setter method. If done anyway, the request will fail.
21661 ///
21662 /// # Additional Parameters
21663 ///
21664 /// * *$.xgafv* (query-string) - V1 error format.
21665 /// * *access_token* (query-string) - OAuth access token.
21666 /// * *alt* (query-string) - Data format for response.
21667 /// * *callback* (query-string) - JSONP
21668 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21669 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21670 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21671 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21672 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21673 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21674 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21675 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionGetCall<'a, C>
21676 where
21677 T: AsRef<str>,
21678 {
21679 self._additional_params
21680 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21681 self
21682 }
21683
21684 /// Identifies the authorization scope for the method you are building.
21685 ///
21686 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21687 /// [`Scope::FirebaseReadonly`].
21688 ///
21689 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21690 /// tokens for more than one scope.
21691 ///
21692 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21693 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21694 /// sufficient, a read-write scope will do as well.
21695 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionGetCall<'a, C>
21696 where
21697 St: AsRef<str>,
21698 {
21699 self._scopes.insert(String::from(scope.as_ref()));
21700 self
21701 }
21702 /// Identifies the authorization scope(s) for the method you are building.
21703 ///
21704 /// See [`Self::add_scope()`] for details.
21705 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionGetCall<'a, C>
21706 where
21707 I: IntoIterator<Item = St>,
21708 St: AsRef<str>,
21709 {
21710 self._scopes
21711 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21712 self
21713 }
21714
21715 /// Removes all scopes, and no default scope will be used either.
21716 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21717 /// for details).
21718 pub fn clear_scopes(mut self) -> SiteVersionGetCall<'a, C> {
21719 self._scopes.clear();
21720 self
21721 }
21722}
21723
21724/// Lists the versions that have been created for the specified site. This list includes versions for both the default `live` channel and any active preview channels for the specified site.
21725///
21726/// A builder for the *versions.list* method supported by a *site* resource.
21727/// It is not used directly, but through a [`SiteMethods`] instance.
21728///
21729/// # Example
21730///
21731/// Instantiate a resource method builder
21732///
21733/// ```test_harness,no_run
21734/// # extern crate hyper;
21735/// # extern crate hyper_rustls;
21736/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
21737/// # async fn dox() {
21738/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21739///
21740/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21741/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21742/// # secret,
21743/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21744/// # ).build().await.unwrap();
21745///
21746/// # let client = hyper_util::client::legacy::Client::builder(
21747/// # hyper_util::rt::TokioExecutor::new()
21748/// # )
21749/// # .build(
21750/// # hyper_rustls::HttpsConnectorBuilder::new()
21751/// # .with_native_roots()
21752/// # .unwrap()
21753/// # .https_or_http()
21754/// # .enable_http1()
21755/// # .build()
21756/// # );
21757/// # let mut hub = FirebaseHosting::new(client, auth);
21758/// // You can configure optional parameters by calling the respective setters at will, and
21759/// // execute the final call using `doit()`.
21760/// // Values shown here are possibly random and not representative !
21761/// let result = hub.sites().versions_list("parent")
21762/// .page_token("Stet")
21763/// .page_size(-7)
21764/// .filter("aliquyam")
21765/// .doit().await;
21766/// # }
21767/// ```
21768pub struct SiteVersionListCall<'a, C>
21769where
21770 C: 'a,
21771{
21772 hub: &'a FirebaseHosting<C>,
21773 _parent: String,
21774 _page_token: Option<String>,
21775 _page_size: Option<i32>,
21776 _filter: Option<String>,
21777 _delegate: Option<&'a mut dyn common::Delegate>,
21778 _additional_params: HashMap<String, String>,
21779 _scopes: BTreeSet<String>,
21780}
21781
21782impl<'a, C> common::CallBuilder for SiteVersionListCall<'a, C> {}
21783
21784impl<'a, C> SiteVersionListCall<'a, C>
21785where
21786 C: common::Connector,
21787{
21788 /// Perform the operation you have build so far.
21789 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionsResponse)> {
21790 use std::borrow::Cow;
21791 use std::io::{Read, Seek};
21792
21793 use common::{url::Params, ToParts};
21794 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21795
21796 let mut dd = common::DefaultDelegate;
21797 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21798 dlg.begin(common::MethodInfo {
21799 id: "firebasehosting.sites.versions.list",
21800 http_method: hyper::Method::GET,
21801 });
21802
21803 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
21804 if self._additional_params.contains_key(field) {
21805 dlg.finished(false);
21806 return Err(common::Error::FieldClash(field));
21807 }
21808 }
21809
21810 let mut params = Params::with_capacity(6 + self._additional_params.len());
21811 params.push("parent", self._parent);
21812 if let Some(value) = self._page_token.as_ref() {
21813 params.push("pageToken", value);
21814 }
21815 if let Some(value) = self._page_size.as_ref() {
21816 params.push("pageSize", value.to_string());
21817 }
21818 if let Some(value) = self._filter.as_ref() {
21819 params.push("filter", value);
21820 }
21821
21822 params.extend(self._additional_params.iter());
21823
21824 params.push("alt", "json");
21825 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
21826 if self._scopes.is_empty() {
21827 self._scopes
21828 .insert(Scope::FirebaseReadonly.as_ref().to_string());
21829 }
21830
21831 #[allow(clippy::single_element_loop)]
21832 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21833 url = params.uri_replacement(url, param_name, find_this, true);
21834 }
21835 {
21836 let to_remove = ["parent"];
21837 params.remove_params(&to_remove);
21838 }
21839
21840 let url = params.parse_with_url(&url);
21841
21842 loop {
21843 let token = match self
21844 .hub
21845 .auth
21846 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21847 .await
21848 {
21849 Ok(token) => token,
21850 Err(e) => match dlg.token(e) {
21851 Ok(token) => token,
21852 Err(e) => {
21853 dlg.finished(false);
21854 return Err(common::Error::MissingToken(e));
21855 }
21856 },
21857 };
21858 let mut req_result = {
21859 let client = &self.hub.client;
21860 dlg.pre_request();
21861 let mut req_builder = hyper::Request::builder()
21862 .method(hyper::Method::GET)
21863 .uri(url.as_str())
21864 .header(USER_AGENT, self.hub._user_agent.clone());
21865
21866 if let Some(token) = token.as_ref() {
21867 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21868 }
21869
21870 let request = req_builder
21871 .header(CONTENT_LENGTH, 0_u64)
21872 .body(common::to_body::<String>(None));
21873
21874 client.request(request.unwrap()).await
21875 };
21876
21877 match req_result {
21878 Err(err) => {
21879 if let common::Retry::After(d) = dlg.http_error(&err) {
21880 sleep(d).await;
21881 continue;
21882 }
21883 dlg.finished(false);
21884 return Err(common::Error::HttpError(err));
21885 }
21886 Ok(res) => {
21887 let (mut parts, body) = res.into_parts();
21888 let mut body = common::Body::new(body);
21889 if !parts.status.is_success() {
21890 let bytes = common::to_bytes(body).await.unwrap_or_default();
21891 let error = serde_json::from_str(&common::to_string(&bytes));
21892 let response = common::to_response(parts, bytes.into());
21893
21894 if let common::Retry::After(d) =
21895 dlg.http_failure(&response, error.as_ref().ok())
21896 {
21897 sleep(d).await;
21898 continue;
21899 }
21900
21901 dlg.finished(false);
21902
21903 return Err(match error {
21904 Ok(value) => common::Error::BadRequest(value),
21905 _ => common::Error::Failure(response),
21906 });
21907 }
21908 let response = {
21909 let bytes = common::to_bytes(body).await.unwrap_or_default();
21910 let encoded = common::to_string(&bytes);
21911 match serde_json::from_str(&encoded) {
21912 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21913 Err(error) => {
21914 dlg.response_json_decode_error(&encoded, &error);
21915 return Err(common::Error::JsonDecodeError(
21916 encoded.to_string(),
21917 error,
21918 ));
21919 }
21920 }
21921 };
21922
21923 dlg.finished(true);
21924 return Ok(response);
21925 }
21926 }
21927 }
21928 }
21929
21930 /// Required. The site or channel for which to list versions, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID
21931 ///
21932 /// Sets the *parent* path property to the given value.
21933 ///
21934 /// Even though the property as already been set when instantiating this call,
21935 /// we provide this method for API completeness.
21936 pub fn parent(mut self, new_value: &str) -> SiteVersionListCall<'a, C> {
21937 self._parent = new_value.to_string();
21938 self
21939 }
21940 /// A token from a previous call to `ListVersions` that tells the server where to resume listing.
21941 ///
21942 /// Sets the *page token* query property to the given value.
21943 pub fn page_token(mut self, new_value: &str) -> SiteVersionListCall<'a, C> {
21944 self._page_token = Some(new_value.to_string());
21945 self
21946 }
21947 /// The maximum number of versions to return. The service may return a lower number if fewer versions exist than this maximum number. If unspecified, defaults to 25. The maximum value is 100; values above 100 will be coerced to 100.
21948 ///
21949 /// Sets the *page size* query property to the given value.
21950 pub fn page_size(mut self, new_value: i32) -> SiteVersionListCall<'a, C> {
21951 self._page_size = Some(new_value);
21952 self
21953 }
21954 /// A filter string used to return a subset of versions in the response. The currently supported fields for filtering are: `name`, `status`, and `create_time`. Learn more about filtering in Google's [AIP 160 standard](https://google.aip.dev/160).
21955 ///
21956 /// Sets the *filter* query property to the given value.
21957 pub fn filter(mut self, new_value: &str) -> SiteVersionListCall<'a, C> {
21958 self._filter = Some(new_value.to_string());
21959 self
21960 }
21961 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21962 /// while executing the actual API request.
21963 ///
21964 /// ````text
21965 /// It should be used to handle progress information, and to implement a certain level of resilience.
21966 /// ````
21967 ///
21968 /// Sets the *delegate* property to the given value.
21969 pub fn delegate(
21970 mut self,
21971 new_value: &'a mut dyn common::Delegate,
21972 ) -> SiteVersionListCall<'a, C> {
21973 self._delegate = Some(new_value);
21974 self
21975 }
21976
21977 /// Set any additional parameter of the query string used in the request.
21978 /// It should be used to set parameters which are not yet available through their own
21979 /// setters.
21980 ///
21981 /// Please note that this method must not be used to set any of the known parameters
21982 /// which have their own setter method. If done anyway, the request will fail.
21983 ///
21984 /// # Additional Parameters
21985 ///
21986 /// * *$.xgafv* (query-string) - V1 error format.
21987 /// * *access_token* (query-string) - OAuth access token.
21988 /// * *alt* (query-string) - Data format for response.
21989 /// * *callback* (query-string) - JSONP
21990 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21991 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21992 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21993 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21994 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21995 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21996 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21997 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionListCall<'a, C>
21998 where
21999 T: AsRef<str>,
22000 {
22001 self._additional_params
22002 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22003 self
22004 }
22005
22006 /// Identifies the authorization scope for the method you are building.
22007 ///
22008 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22009 /// [`Scope::FirebaseReadonly`].
22010 ///
22011 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22012 /// tokens for more than one scope.
22013 ///
22014 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22015 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22016 /// sufficient, a read-write scope will do as well.
22017 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionListCall<'a, C>
22018 where
22019 St: AsRef<str>,
22020 {
22021 self._scopes.insert(String::from(scope.as_ref()));
22022 self
22023 }
22024 /// Identifies the authorization scope(s) for the method you are building.
22025 ///
22026 /// See [`Self::add_scope()`] for details.
22027 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionListCall<'a, C>
22028 where
22029 I: IntoIterator<Item = St>,
22030 St: AsRef<str>,
22031 {
22032 self._scopes
22033 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22034 self
22035 }
22036
22037 /// Removes all scopes, and no default scope will be used either.
22038 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22039 /// for details).
22040 pub fn clear_scopes(mut self) -> SiteVersionListCall<'a, C> {
22041 self._scopes.clear();
22042 self
22043 }
22044}
22045
22046/// Updates the specified metadata for the specified version. This method will fail with `FAILED_PRECONDITION` in the event of an invalid state transition. The supported [state](https://firebase.google.com/docs/hosting/../sites.versions#versionstatus) transitions for a version are from `CREATED` to `FINALIZED`. Use [`DeleteVersion`](delete) to set the status of a version to `DELETED`.
22047///
22048/// A builder for the *versions.patch* method supported by a *site* resource.
22049/// It is not used directly, but through a [`SiteMethods`] instance.
22050///
22051/// # Example
22052///
22053/// Instantiate a resource method builder
22054///
22055/// ```test_harness,no_run
22056/// # extern crate hyper;
22057/// # extern crate hyper_rustls;
22058/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
22059/// use firebasehosting1_beta1::api::Version;
22060/// # async fn dox() {
22061/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22062///
22063/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22064/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22065/// # secret,
22066/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22067/// # ).build().await.unwrap();
22068///
22069/// # let client = hyper_util::client::legacy::Client::builder(
22070/// # hyper_util::rt::TokioExecutor::new()
22071/// # )
22072/// # .build(
22073/// # hyper_rustls::HttpsConnectorBuilder::new()
22074/// # .with_native_roots()
22075/// # .unwrap()
22076/// # .https_or_http()
22077/// # .enable_http1()
22078/// # .build()
22079/// # );
22080/// # let mut hub = FirebaseHosting::new(client, auth);
22081/// // As the method needs a request, you would usually fill it with the desired information
22082/// // into the respective structure. Some of the parts shown here might not be applicable !
22083/// // Values shown here are possibly random and not representative !
22084/// let mut req = Version::default();
22085///
22086/// // You can configure optional parameters by calling the respective setters at will, and
22087/// // execute the final call using `doit()`.
22088/// // Values shown here are possibly random and not representative !
22089/// let result = hub.sites().versions_patch(req, "name")
22090/// .update_mask(FieldMask::new::<&str>(&[]))
22091/// .doit().await;
22092/// # }
22093/// ```
22094pub struct SiteVersionPatchCall<'a, C>
22095where
22096 C: 'a,
22097{
22098 hub: &'a FirebaseHosting<C>,
22099 _request: Version,
22100 _name: String,
22101 _update_mask: Option<common::FieldMask>,
22102 _delegate: Option<&'a mut dyn common::Delegate>,
22103 _additional_params: HashMap<String, String>,
22104 _scopes: BTreeSet<String>,
22105}
22106
22107impl<'a, C> common::CallBuilder for SiteVersionPatchCall<'a, C> {}
22108
22109impl<'a, C> SiteVersionPatchCall<'a, C>
22110where
22111 C: common::Connector,
22112{
22113 /// Perform the operation you have build so far.
22114 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
22115 use std::borrow::Cow;
22116 use std::io::{Read, Seek};
22117
22118 use common::{url::Params, ToParts};
22119 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22120
22121 let mut dd = common::DefaultDelegate;
22122 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22123 dlg.begin(common::MethodInfo {
22124 id: "firebasehosting.sites.versions.patch",
22125 http_method: hyper::Method::PATCH,
22126 });
22127
22128 for &field in ["alt", "name", "updateMask"].iter() {
22129 if self._additional_params.contains_key(field) {
22130 dlg.finished(false);
22131 return Err(common::Error::FieldClash(field));
22132 }
22133 }
22134
22135 let mut params = Params::with_capacity(5 + self._additional_params.len());
22136 params.push("name", self._name);
22137 if let Some(value) = self._update_mask.as_ref() {
22138 params.push("updateMask", value.to_string());
22139 }
22140
22141 params.extend(self._additional_params.iter());
22142
22143 params.push("alt", "json");
22144 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
22145 if self._scopes.is_empty() {
22146 self._scopes
22147 .insert(Scope::CloudPlatform.as_ref().to_string());
22148 }
22149
22150 #[allow(clippy::single_element_loop)]
22151 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22152 url = params.uri_replacement(url, param_name, find_this, true);
22153 }
22154 {
22155 let to_remove = ["name"];
22156 params.remove_params(&to_remove);
22157 }
22158
22159 let url = params.parse_with_url(&url);
22160
22161 let mut json_mime_type = mime::APPLICATION_JSON;
22162 let mut request_value_reader = {
22163 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22164 common::remove_json_null_values(&mut value);
22165 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22166 serde_json::to_writer(&mut dst, &value).unwrap();
22167 dst
22168 };
22169 let request_size = request_value_reader
22170 .seek(std::io::SeekFrom::End(0))
22171 .unwrap();
22172 request_value_reader
22173 .seek(std::io::SeekFrom::Start(0))
22174 .unwrap();
22175
22176 loop {
22177 let token = match self
22178 .hub
22179 .auth
22180 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22181 .await
22182 {
22183 Ok(token) => token,
22184 Err(e) => match dlg.token(e) {
22185 Ok(token) => token,
22186 Err(e) => {
22187 dlg.finished(false);
22188 return Err(common::Error::MissingToken(e));
22189 }
22190 },
22191 };
22192 request_value_reader
22193 .seek(std::io::SeekFrom::Start(0))
22194 .unwrap();
22195 let mut req_result = {
22196 let client = &self.hub.client;
22197 dlg.pre_request();
22198 let mut req_builder = hyper::Request::builder()
22199 .method(hyper::Method::PATCH)
22200 .uri(url.as_str())
22201 .header(USER_AGENT, self.hub._user_agent.clone());
22202
22203 if let Some(token) = token.as_ref() {
22204 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22205 }
22206
22207 let request = req_builder
22208 .header(CONTENT_TYPE, json_mime_type.to_string())
22209 .header(CONTENT_LENGTH, request_size as u64)
22210 .body(common::to_body(
22211 request_value_reader.get_ref().clone().into(),
22212 ));
22213
22214 client.request(request.unwrap()).await
22215 };
22216
22217 match req_result {
22218 Err(err) => {
22219 if let common::Retry::After(d) = dlg.http_error(&err) {
22220 sleep(d).await;
22221 continue;
22222 }
22223 dlg.finished(false);
22224 return Err(common::Error::HttpError(err));
22225 }
22226 Ok(res) => {
22227 let (mut parts, body) = res.into_parts();
22228 let mut body = common::Body::new(body);
22229 if !parts.status.is_success() {
22230 let bytes = common::to_bytes(body).await.unwrap_or_default();
22231 let error = serde_json::from_str(&common::to_string(&bytes));
22232 let response = common::to_response(parts, bytes.into());
22233
22234 if let common::Retry::After(d) =
22235 dlg.http_failure(&response, error.as_ref().ok())
22236 {
22237 sleep(d).await;
22238 continue;
22239 }
22240
22241 dlg.finished(false);
22242
22243 return Err(match error {
22244 Ok(value) => common::Error::BadRequest(value),
22245 _ => common::Error::Failure(response),
22246 });
22247 }
22248 let response = {
22249 let bytes = common::to_bytes(body).await.unwrap_or_default();
22250 let encoded = common::to_string(&bytes);
22251 match serde_json::from_str(&encoded) {
22252 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22253 Err(error) => {
22254 dlg.response_json_decode_error(&encoded, &error);
22255 return Err(common::Error::JsonDecodeError(
22256 encoded.to_string(),
22257 error,
22258 ));
22259 }
22260 }
22261 };
22262
22263 dlg.finished(true);
22264 return Ok(response);
22265 }
22266 }
22267 }
22268 }
22269
22270 ///
22271 /// Sets the *request* property to the given value.
22272 ///
22273 /// Even though the property as already been set when instantiating this call,
22274 /// we provide this method for API completeness.
22275 pub fn request(mut self, new_value: Version) -> SiteVersionPatchCall<'a, C> {
22276 self._request = new_value;
22277 self
22278 }
22279 /// The fully-qualified resource name for the version, in the format: sites/ SITE_ID/versions/VERSION_ID This name is provided in the response body when you call [`CreateVersion`](sites.versions/create).
22280 ///
22281 /// Sets the *name* path property to the given value.
22282 ///
22283 /// Even though the property as already been set when instantiating this call,
22284 /// we provide this method for API completeness.
22285 pub fn name(mut self, new_value: &str) -> SiteVersionPatchCall<'a, C> {
22286 self._name = new_value.to_string();
22287 self
22288 }
22289 /// A set of field names from your [version](https://firebase.google.com/docs/hosting/../sites.versions) that you want to update. A field will be overwritten if, and only if, it’s in the mask. If a mask is not provided then a default mask of only [`status`](https://firebase.google.com/docs/hosting/../sites.versions#Version.FIELDS.status) will be used.
22290 ///
22291 /// Sets the *update mask* query property to the given value.
22292 pub fn update_mask(mut self, new_value: common::FieldMask) -> SiteVersionPatchCall<'a, C> {
22293 self._update_mask = Some(new_value);
22294 self
22295 }
22296 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22297 /// while executing the actual API request.
22298 ///
22299 /// ````text
22300 /// It should be used to handle progress information, and to implement a certain level of resilience.
22301 /// ````
22302 ///
22303 /// Sets the *delegate* property to the given value.
22304 pub fn delegate(
22305 mut self,
22306 new_value: &'a mut dyn common::Delegate,
22307 ) -> SiteVersionPatchCall<'a, C> {
22308 self._delegate = Some(new_value);
22309 self
22310 }
22311
22312 /// Set any additional parameter of the query string used in the request.
22313 /// It should be used to set parameters which are not yet available through their own
22314 /// setters.
22315 ///
22316 /// Please note that this method must not be used to set any of the known parameters
22317 /// which have their own setter method. If done anyway, the request will fail.
22318 ///
22319 /// # Additional Parameters
22320 ///
22321 /// * *$.xgafv* (query-string) - V1 error format.
22322 /// * *access_token* (query-string) - OAuth access token.
22323 /// * *alt* (query-string) - Data format for response.
22324 /// * *callback* (query-string) - JSONP
22325 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22326 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22327 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22328 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22329 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22330 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22331 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22332 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionPatchCall<'a, C>
22333 where
22334 T: AsRef<str>,
22335 {
22336 self._additional_params
22337 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22338 self
22339 }
22340
22341 /// Identifies the authorization scope for the method you are building.
22342 ///
22343 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22344 /// [`Scope::CloudPlatform`].
22345 ///
22346 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22347 /// tokens for more than one scope.
22348 ///
22349 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22350 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22351 /// sufficient, a read-write scope will do as well.
22352 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionPatchCall<'a, C>
22353 where
22354 St: AsRef<str>,
22355 {
22356 self._scopes.insert(String::from(scope.as_ref()));
22357 self
22358 }
22359 /// Identifies the authorization scope(s) for the method you are building.
22360 ///
22361 /// See [`Self::add_scope()`] for details.
22362 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionPatchCall<'a, C>
22363 where
22364 I: IntoIterator<Item = St>,
22365 St: AsRef<str>,
22366 {
22367 self._scopes
22368 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22369 self
22370 }
22371
22372 /// Removes all scopes, and no default scope will be used either.
22373 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22374 /// for details).
22375 pub fn clear_scopes(mut self) -> SiteVersionPatchCall<'a, C> {
22376 self._scopes.clear();
22377 self
22378 }
22379}
22380
22381/// Adds content files to the specified version. Each file must be under 2 GB.
22382///
22383/// A builder for the *versions.populateFiles* method supported by a *site* resource.
22384/// It is not used directly, but through a [`SiteMethods`] instance.
22385///
22386/// # Example
22387///
22388/// Instantiate a resource method builder
22389///
22390/// ```test_harness,no_run
22391/// # extern crate hyper;
22392/// # extern crate hyper_rustls;
22393/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
22394/// use firebasehosting1_beta1::api::PopulateVersionFilesRequest;
22395/// # async fn dox() {
22396/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22397///
22398/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22399/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22400/// # secret,
22401/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22402/// # ).build().await.unwrap();
22403///
22404/// # let client = hyper_util::client::legacy::Client::builder(
22405/// # hyper_util::rt::TokioExecutor::new()
22406/// # )
22407/// # .build(
22408/// # hyper_rustls::HttpsConnectorBuilder::new()
22409/// # .with_native_roots()
22410/// # .unwrap()
22411/// # .https_or_http()
22412/// # .enable_http1()
22413/// # .build()
22414/// # );
22415/// # let mut hub = FirebaseHosting::new(client, auth);
22416/// // As the method needs a request, you would usually fill it with the desired information
22417/// // into the respective structure. Some of the parts shown here might not be applicable !
22418/// // Values shown here are possibly random and not representative !
22419/// let mut req = PopulateVersionFilesRequest::default();
22420///
22421/// // You can configure optional parameters by calling the respective setters at will, and
22422/// // execute the final call using `doit()`.
22423/// // Values shown here are possibly random and not representative !
22424/// let result = hub.sites().versions_populate_files(req, "parent")
22425/// .doit().await;
22426/// # }
22427/// ```
22428pub struct SiteVersionPopulateFileCall<'a, C>
22429where
22430 C: 'a,
22431{
22432 hub: &'a FirebaseHosting<C>,
22433 _request: PopulateVersionFilesRequest,
22434 _parent: String,
22435 _delegate: Option<&'a mut dyn common::Delegate>,
22436 _additional_params: HashMap<String, String>,
22437 _scopes: BTreeSet<String>,
22438}
22439
22440impl<'a, C> common::CallBuilder for SiteVersionPopulateFileCall<'a, C> {}
22441
22442impl<'a, C> SiteVersionPopulateFileCall<'a, C>
22443where
22444 C: common::Connector,
22445{
22446 /// Perform the operation you have build so far.
22447 pub async fn doit(
22448 mut self,
22449 ) -> common::Result<(common::Response, PopulateVersionFilesResponse)> {
22450 use std::borrow::Cow;
22451 use std::io::{Read, Seek};
22452
22453 use common::{url::Params, ToParts};
22454 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22455
22456 let mut dd = common::DefaultDelegate;
22457 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22458 dlg.begin(common::MethodInfo {
22459 id: "firebasehosting.sites.versions.populateFiles",
22460 http_method: hyper::Method::POST,
22461 });
22462
22463 for &field in ["alt", "parent"].iter() {
22464 if self._additional_params.contains_key(field) {
22465 dlg.finished(false);
22466 return Err(common::Error::FieldClash(field));
22467 }
22468 }
22469
22470 let mut params = Params::with_capacity(4 + self._additional_params.len());
22471 params.push("parent", self._parent);
22472
22473 params.extend(self._additional_params.iter());
22474
22475 params.push("alt", "json");
22476 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:populateFiles";
22477 if self._scopes.is_empty() {
22478 self._scopes
22479 .insert(Scope::CloudPlatform.as_ref().to_string());
22480 }
22481
22482 #[allow(clippy::single_element_loop)]
22483 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22484 url = params.uri_replacement(url, param_name, find_this, true);
22485 }
22486 {
22487 let to_remove = ["parent"];
22488 params.remove_params(&to_remove);
22489 }
22490
22491 let url = params.parse_with_url(&url);
22492
22493 let mut json_mime_type = mime::APPLICATION_JSON;
22494 let mut request_value_reader = {
22495 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22496 common::remove_json_null_values(&mut value);
22497 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22498 serde_json::to_writer(&mut dst, &value).unwrap();
22499 dst
22500 };
22501 let request_size = request_value_reader
22502 .seek(std::io::SeekFrom::End(0))
22503 .unwrap();
22504 request_value_reader
22505 .seek(std::io::SeekFrom::Start(0))
22506 .unwrap();
22507
22508 loop {
22509 let token = match self
22510 .hub
22511 .auth
22512 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22513 .await
22514 {
22515 Ok(token) => token,
22516 Err(e) => match dlg.token(e) {
22517 Ok(token) => token,
22518 Err(e) => {
22519 dlg.finished(false);
22520 return Err(common::Error::MissingToken(e));
22521 }
22522 },
22523 };
22524 request_value_reader
22525 .seek(std::io::SeekFrom::Start(0))
22526 .unwrap();
22527 let mut req_result = {
22528 let client = &self.hub.client;
22529 dlg.pre_request();
22530 let mut req_builder = hyper::Request::builder()
22531 .method(hyper::Method::POST)
22532 .uri(url.as_str())
22533 .header(USER_AGENT, self.hub._user_agent.clone());
22534
22535 if let Some(token) = token.as_ref() {
22536 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22537 }
22538
22539 let request = req_builder
22540 .header(CONTENT_TYPE, json_mime_type.to_string())
22541 .header(CONTENT_LENGTH, request_size as u64)
22542 .body(common::to_body(
22543 request_value_reader.get_ref().clone().into(),
22544 ));
22545
22546 client.request(request.unwrap()).await
22547 };
22548
22549 match req_result {
22550 Err(err) => {
22551 if let common::Retry::After(d) = dlg.http_error(&err) {
22552 sleep(d).await;
22553 continue;
22554 }
22555 dlg.finished(false);
22556 return Err(common::Error::HttpError(err));
22557 }
22558 Ok(res) => {
22559 let (mut parts, body) = res.into_parts();
22560 let mut body = common::Body::new(body);
22561 if !parts.status.is_success() {
22562 let bytes = common::to_bytes(body).await.unwrap_or_default();
22563 let error = serde_json::from_str(&common::to_string(&bytes));
22564 let response = common::to_response(parts, bytes.into());
22565
22566 if let common::Retry::After(d) =
22567 dlg.http_failure(&response, error.as_ref().ok())
22568 {
22569 sleep(d).await;
22570 continue;
22571 }
22572
22573 dlg.finished(false);
22574
22575 return Err(match error {
22576 Ok(value) => common::Error::BadRequest(value),
22577 _ => common::Error::Failure(response),
22578 });
22579 }
22580 let response = {
22581 let bytes = common::to_bytes(body).await.unwrap_or_default();
22582 let encoded = common::to_string(&bytes);
22583 match serde_json::from_str(&encoded) {
22584 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22585 Err(error) => {
22586 dlg.response_json_decode_error(&encoded, &error);
22587 return Err(common::Error::JsonDecodeError(
22588 encoded.to_string(),
22589 error,
22590 ));
22591 }
22592 }
22593 };
22594
22595 dlg.finished(true);
22596 return Ok(response);
22597 }
22598 }
22599 }
22600 }
22601
22602 ///
22603 /// Sets the *request* property to the given value.
22604 ///
22605 /// Even though the property as already been set when instantiating this call,
22606 /// we provide this method for API completeness.
22607 pub fn request(
22608 mut self,
22609 new_value: PopulateVersionFilesRequest,
22610 ) -> SiteVersionPopulateFileCall<'a, C> {
22611 self._request = new_value;
22612 self
22613 }
22614 /// Required. The version to which to add files, in the format: sites/SITE_ID /versions/VERSION_ID
22615 ///
22616 /// Sets the *parent* path property to the given value.
22617 ///
22618 /// Even though the property as already been set when instantiating this call,
22619 /// we provide this method for API completeness.
22620 pub fn parent(mut self, new_value: &str) -> SiteVersionPopulateFileCall<'a, C> {
22621 self._parent = new_value.to_string();
22622 self
22623 }
22624 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22625 /// while executing the actual API request.
22626 ///
22627 /// ````text
22628 /// It should be used to handle progress information, and to implement a certain level of resilience.
22629 /// ````
22630 ///
22631 /// Sets the *delegate* property to the given value.
22632 pub fn delegate(
22633 mut self,
22634 new_value: &'a mut dyn common::Delegate,
22635 ) -> SiteVersionPopulateFileCall<'a, C> {
22636 self._delegate = Some(new_value);
22637 self
22638 }
22639
22640 /// Set any additional parameter of the query string used in the request.
22641 /// It should be used to set parameters which are not yet available through their own
22642 /// setters.
22643 ///
22644 /// Please note that this method must not be used to set any of the known parameters
22645 /// which have their own setter method. If done anyway, the request will fail.
22646 ///
22647 /// # Additional Parameters
22648 ///
22649 /// * *$.xgafv* (query-string) - V1 error format.
22650 /// * *access_token* (query-string) - OAuth access token.
22651 /// * *alt* (query-string) - Data format for response.
22652 /// * *callback* (query-string) - JSONP
22653 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22654 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22655 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22656 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22657 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22658 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22659 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22660 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionPopulateFileCall<'a, C>
22661 where
22662 T: AsRef<str>,
22663 {
22664 self._additional_params
22665 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22666 self
22667 }
22668
22669 /// Identifies the authorization scope for the method you are building.
22670 ///
22671 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22672 /// [`Scope::CloudPlatform`].
22673 ///
22674 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22675 /// tokens for more than one scope.
22676 ///
22677 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22678 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22679 /// sufficient, a read-write scope will do as well.
22680 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionPopulateFileCall<'a, C>
22681 where
22682 St: AsRef<str>,
22683 {
22684 self._scopes.insert(String::from(scope.as_ref()));
22685 self
22686 }
22687 /// Identifies the authorization scope(s) for the method you are building.
22688 ///
22689 /// See [`Self::add_scope()`] for details.
22690 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionPopulateFileCall<'a, C>
22691 where
22692 I: IntoIterator<Item = St>,
22693 St: AsRef<str>,
22694 {
22695 self._scopes
22696 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22697 self
22698 }
22699
22700 /// Removes all scopes, and no default scope will be used either.
22701 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22702 /// for details).
22703 pub fn clear_scopes(mut self) -> SiteVersionPopulateFileCall<'a, C> {
22704 self._scopes.clear();
22705 self
22706 }
22707}
22708
22709/// Gets the Hosting metadata for a specific site.
22710///
22711/// A builder for the *getConfig* method supported by a *site* resource.
22712/// It is not used directly, but through a [`SiteMethods`] instance.
22713///
22714/// # Example
22715///
22716/// Instantiate a resource method builder
22717///
22718/// ```test_harness,no_run
22719/// # extern crate hyper;
22720/// # extern crate hyper_rustls;
22721/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
22722/// # async fn dox() {
22723/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22724///
22725/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22726/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22727/// # secret,
22728/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22729/// # ).build().await.unwrap();
22730///
22731/// # let client = hyper_util::client::legacy::Client::builder(
22732/// # hyper_util::rt::TokioExecutor::new()
22733/// # )
22734/// # .build(
22735/// # hyper_rustls::HttpsConnectorBuilder::new()
22736/// # .with_native_roots()
22737/// # .unwrap()
22738/// # .https_or_http()
22739/// # .enable_http1()
22740/// # .build()
22741/// # );
22742/// # let mut hub = FirebaseHosting::new(client, auth);
22743/// // You can configure optional parameters by calling the respective setters at will, and
22744/// // execute the final call using `doit()`.
22745/// // Values shown here are possibly random and not representative !
22746/// let result = hub.sites().get_config("name")
22747/// .doit().await;
22748/// # }
22749/// ```
22750pub struct SiteGetConfigCall<'a, C>
22751where
22752 C: 'a,
22753{
22754 hub: &'a FirebaseHosting<C>,
22755 _name: String,
22756 _delegate: Option<&'a mut dyn common::Delegate>,
22757 _additional_params: HashMap<String, String>,
22758 _scopes: BTreeSet<String>,
22759}
22760
22761impl<'a, C> common::CallBuilder for SiteGetConfigCall<'a, C> {}
22762
22763impl<'a, C> SiteGetConfigCall<'a, C>
22764where
22765 C: common::Connector,
22766{
22767 /// Perform the operation you have build so far.
22768 pub async fn doit(mut self) -> common::Result<(common::Response, SiteConfig)> {
22769 use std::borrow::Cow;
22770 use std::io::{Read, Seek};
22771
22772 use common::{url::Params, ToParts};
22773 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22774
22775 let mut dd = common::DefaultDelegate;
22776 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22777 dlg.begin(common::MethodInfo {
22778 id: "firebasehosting.sites.getConfig",
22779 http_method: hyper::Method::GET,
22780 });
22781
22782 for &field in ["alt", "name"].iter() {
22783 if self._additional_params.contains_key(field) {
22784 dlg.finished(false);
22785 return Err(common::Error::FieldClash(field));
22786 }
22787 }
22788
22789 let mut params = Params::with_capacity(3 + self._additional_params.len());
22790 params.push("name", self._name);
22791
22792 params.extend(self._additional_params.iter());
22793
22794 params.push("alt", "json");
22795 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
22796 if self._scopes.is_empty() {
22797 self._scopes
22798 .insert(Scope::FirebaseReadonly.as_ref().to_string());
22799 }
22800
22801 #[allow(clippy::single_element_loop)]
22802 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22803 url = params.uri_replacement(url, param_name, find_this, true);
22804 }
22805 {
22806 let to_remove = ["name"];
22807 params.remove_params(&to_remove);
22808 }
22809
22810 let url = params.parse_with_url(&url);
22811
22812 loop {
22813 let token = match self
22814 .hub
22815 .auth
22816 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22817 .await
22818 {
22819 Ok(token) => token,
22820 Err(e) => match dlg.token(e) {
22821 Ok(token) => token,
22822 Err(e) => {
22823 dlg.finished(false);
22824 return Err(common::Error::MissingToken(e));
22825 }
22826 },
22827 };
22828 let mut req_result = {
22829 let client = &self.hub.client;
22830 dlg.pre_request();
22831 let mut req_builder = hyper::Request::builder()
22832 .method(hyper::Method::GET)
22833 .uri(url.as_str())
22834 .header(USER_AGENT, self.hub._user_agent.clone());
22835
22836 if let Some(token) = token.as_ref() {
22837 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22838 }
22839
22840 let request = req_builder
22841 .header(CONTENT_LENGTH, 0_u64)
22842 .body(common::to_body::<String>(None));
22843
22844 client.request(request.unwrap()).await
22845 };
22846
22847 match req_result {
22848 Err(err) => {
22849 if let common::Retry::After(d) = dlg.http_error(&err) {
22850 sleep(d).await;
22851 continue;
22852 }
22853 dlg.finished(false);
22854 return Err(common::Error::HttpError(err));
22855 }
22856 Ok(res) => {
22857 let (mut parts, body) = res.into_parts();
22858 let mut body = common::Body::new(body);
22859 if !parts.status.is_success() {
22860 let bytes = common::to_bytes(body).await.unwrap_or_default();
22861 let error = serde_json::from_str(&common::to_string(&bytes));
22862 let response = common::to_response(parts, bytes.into());
22863
22864 if let common::Retry::After(d) =
22865 dlg.http_failure(&response, error.as_ref().ok())
22866 {
22867 sleep(d).await;
22868 continue;
22869 }
22870
22871 dlg.finished(false);
22872
22873 return Err(match error {
22874 Ok(value) => common::Error::BadRequest(value),
22875 _ => common::Error::Failure(response),
22876 });
22877 }
22878 let response = {
22879 let bytes = common::to_bytes(body).await.unwrap_or_default();
22880 let encoded = common::to_string(&bytes);
22881 match serde_json::from_str(&encoded) {
22882 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22883 Err(error) => {
22884 dlg.response_json_decode_error(&encoded, &error);
22885 return Err(common::Error::JsonDecodeError(
22886 encoded.to_string(),
22887 error,
22888 ));
22889 }
22890 }
22891 };
22892
22893 dlg.finished(true);
22894 return Ok(response);
22895 }
22896 }
22897 }
22898 }
22899
22900 /// Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
22901 ///
22902 /// Sets the *name* path property to the given value.
22903 ///
22904 /// Even though the property as already been set when instantiating this call,
22905 /// we provide this method for API completeness.
22906 pub fn name(mut self, new_value: &str) -> SiteGetConfigCall<'a, C> {
22907 self._name = new_value.to_string();
22908 self
22909 }
22910 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22911 /// while executing the actual API request.
22912 ///
22913 /// ````text
22914 /// It should be used to handle progress information, and to implement a certain level of resilience.
22915 /// ````
22916 ///
22917 /// Sets the *delegate* property to the given value.
22918 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SiteGetConfigCall<'a, C> {
22919 self._delegate = Some(new_value);
22920 self
22921 }
22922
22923 /// Set any additional parameter of the query string used in the request.
22924 /// It should be used to set parameters which are not yet available through their own
22925 /// setters.
22926 ///
22927 /// Please note that this method must not be used to set any of the known parameters
22928 /// which have their own setter method. If done anyway, the request will fail.
22929 ///
22930 /// # Additional Parameters
22931 ///
22932 /// * *$.xgafv* (query-string) - V1 error format.
22933 /// * *access_token* (query-string) - OAuth access token.
22934 /// * *alt* (query-string) - Data format for response.
22935 /// * *callback* (query-string) - JSONP
22936 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22937 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22938 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22939 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22940 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22941 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22942 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22943 pub fn param<T>(mut self, name: T, value: T) -> SiteGetConfigCall<'a, C>
22944 where
22945 T: AsRef<str>,
22946 {
22947 self._additional_params
22948 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22949 self
22950 }
22951
22952 /// Identifies the authorization scope for the method you are building.
22953 ///
22954 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22955 /// [`Scope::FirebaseReadonly`].
22956 ///
22957 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22958 /// tokens for more than one scope.
22959 ///
22960 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22961 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22962 /// sufficient, a read-write scope will do as well.
22963 pub fn add_scope<St>(mut self, scope: St) -> SiteGetConfigCall<'a, C>
22964 where
22965 St: AsRef<str>,
22966 {
22967 self._scopes.insert(String::from(scope.as_ref()));
22968 self
22969 }
22970 /// Identifies the authorization scope(s) for the method you are building.
22971 ///
22972 /// See [`Self::add_scope()`] for details.
22973 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteGetConfigCall<'a, C>
22974 where
22975 I: IntoIterator<Item = St>,
22976 St: AsRef<str>,
22977 {
22978 self._scopes
22979 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22980 self
22981 }
22982
22983 /// Removes all scopes, and no default scope will be used either.
22984 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22985 /// for details).
22986 pub fn clear_scopes(mut self) -> SiteGetConfigCall<'a, C> {
22987 self._scopes.clear();
22988 self
22989 }
22990}
22991
22992/// Sets the Hosting metadata for a specific site.
22993///
22994/// A builder for the *updateConfig* method supported by a *site* resource.
22995/// It is not used directly, but through a [`SiteMethods`] instance.
22996///
22997/// # Example
22998///
22999/// Instantiate a resource method builder
23000///
23001/// ```test_harness,no_run
23002/// # extern crate hyper;
23003/// # extern crate hyper_rustls;
23004/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
23005/// use firebasehosting1_beta1::api::SiteConfig;
23006/// # async fn dox() {
23007/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23008///
23009/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23010/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23011/// # secret,
23012/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23013/// # ).build().await.unwrap();
23014///
23015/// # let client = hyper_util::client::legacy::Client::builder(
23016/// # hyper_util::rt::TokioExecutor::new()
23017/// # )
23018/// # .build(
23019/// # hyper_rustls::HttpsConnectorBuilder::new()
23020/// # .with_native_roots()
23021/// # .unwrap()
23022/// # .https_or_http()
23023/// # .enable_http1()
23024/// # .build()
23025/// # );
23026/// # let mut hub = FirebaseHosting::new(client, auth);
23027/// // As the method needs a request, you would usually fill it with the desired information
23028/// // into the respective structure. Some of the parts shown here might not be applicable !
23029/// // Values shown here are possibly random and not representative !
23030/// let mut req = SiteConfig::default();
23031///
23032/// // You can configure optional parameters by calling the respective setters at will, and
23033/// // execute the final call using `doit()`.
23034/// // Values shown here are possibly random and not representative !
23035/// let result = hub.sites().update_config(req, "name")
23036/// .update_mask(FieldMask::new::<&str>(&[]))
23037/// .doit().await;
23038/// # }
23039/// ```
23040pub struct SiteUpdateConfigCall<'a, C>
23041where
23042 C: 'a,
23043{
23044 hub: &'a FirebaseHosting<C>,
23045 _request: SiteConfig,
23046 _name: String,
23047 _update_mask: Option<common::FieldMask>,
23048 _delegate: Option<&'a mut dyn common::Delegate>,
23049 _additional_params: HashMap<String, String>,
23050 _scopes: BTreeSet<String>,
23051}
23052
23053impl<'a, C> common::CallBuilder for SiteUpdateConfigCall<'a, C> {}
23054
23055impl<'a, C> SiteUpdateConfigCall<'a, C>
23056where
23057 C: common::Connector,
23058{
23059 /// Perform the operation you have build so far.
23060 pub async fn doit(mut self) -> common::Result<(common::Response, SiteConfig)> {
23061 use std::borrow::Cow;
23062 use std::io::{Read, Seek};
23063
23064 use common::{url::Params, ToParts};
23065 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23066
23067 let mut dd = common::DefaultDelegate;
23068 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23069 dlg.begin(common::MethodInfo {
23070 id: "firebasehosting.sites.updateConfig",
23071 http_method: hyper::Method::PATCH,
23072 });
23073
23074 for &field in ["alt", "name", "updateMask"].iter() {
23075 if self._additional_params.contains_key(field) {
23076 dlg.finished(false);
23077 return Err(common::Error::FieldClash(field));
23078 }
23079 }
23080
23081 let mut params = Params::with_capacity(5 + self._additional_params.len());
23082 params.push("name", self._name);
23083 if let Some(value) = self._update_mask.as_ref() {
23084 params.push("updateMask", value.to_string());
23085 }
23086
23087 params.extend(self._additional_params.iter());
23088
23089 params.push("alt", "json");
23090 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
23091 if self._scopes.is_empty() {
23092 self._scopes
23093 .insert(Scope::CloudPlatform.as_ref().to_string());
23094 }
23095
23096 #[allow(clippy::single_element_loop)]
23097 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23098 url = params.uri_replacement(url, param_name, find_this, true);
23099 }
23100 {
23101 let to_remove = ["name"];
23102 params.remove_params(&to_remove);
23103 }
23104
23105 let url = params.parse_with_url(&url);
23106
23107 let mut json_mime_type = mime::APPLICATION_JSON;
23108 let mut request_value_reader = {
23109 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23110 common::remove_json_null_values(&mut value);
23111 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23112 serde_json::to_writer(&mut dst, &value).unwrap();
23113 dst
23114 };
23115 let request_size = request_value_reader
23116 .seek(std::io::SeekFrom::End(0))
23117 .unwrap();
23118 request_value_reader
23119 .seek(std::io::SeekFrom::Start(0))
23120 .unwrap();
23121
23122 loop {
23123 let token = match self
23124 .hub
23125 .auth
23126 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23127 .await
23128 {
23129 Ok(token) => token,
23130 Err(e) => match dlg.token(e) {
23131 Ok(token) => token,
23132 Err(e) => {
23133 dlg.finished(false);
23134 return Err(common::Error::MissingToken(e));
23135 }
23136 },
23137 };
23138 request_value_reader
23139 .seek(std::io::SeekFrom::Start(0))
23140 .unwrap();
23141 let mut req_result = {
23142 let client = &self.hub.client;
23143 dlg.pre_request();
23144 let mut req_builder = hyper::Request::builder()
23145 .method(hyper::Method::PATCH)
23146 .uri(url.as_str())
23147 .header(USER_AGENT, self.hub._user_agent.clone());
23148
23149 if let Some(token) = token.as_ref() {
23150 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23151 }
23152
23153 let request = req_builder
23154 .header(CONTENT_TYPE, json_mime_type.to_string())
23155 .header(CONTENT_LENGTH, request_size as u64)
23156 .body(common::to_body(
23157 request_value_reader.get_ref().clone().into(),
23158 ));
23159
23160 client.request(request.unwrap()).await
23161 };
23162
23163 match req_result {
23164 Err(err) => {
23165 if let common::Retry::After(d) = dlg.http_error(&err) {
23166 sleep(d).await;
23167 continue;
23168 }
23169 dlg.finished(false);
23170 return Err(common::Error::HttpError(err));
23171 }
23172 Ok(res) => {
23173 let (mut parts, body) = res.into_parts();
23174 let mut body = common::Body::new(body);
23175 if !parts.status.is_success() {
23176 let bytes = common::to_bytes(body).await.unwrap_or_default();
23177 let error = serde_json::from_str(&common::to_string(&bytes));
23178 let response = common::to_response(parts, bytes.into());
23179
23180 if let common::Retry::After(d) =
23181 dlg.http_failure(&response, error.as_ref().ok())
23182 {
23183 sleep(d).await;
23184 continue;
23185 }
23186
23187 dlg.finished(false);
23188
23189 return Err(match error {
23190 Ok(value) => common::Error::BadRequest(value),
23191 _ => common::Error::Failure(response),
23192 });
23193 }
23194 let response = {
23195 let bytes = common::to_bytes(body).await.unwrap_or_default();
23196 let encoded = common::to_string(&bytes);
23197 match serde_json::from_str(&encoded) {
23198 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23199 Err(error) => {
23200 dlg.response_json_decode_error(&encoded, &error);
23201 return Err(common::Error::JsonDecodeError(
23202 encoded.to_string(),
23203 error,
23204 ));
23205 }
23206 }
23207 };
23208
23209 dlg.finished(true);
23210 return Ok(response);
23211 }
23212 }
23213 }
23214 }
23215
23216 ///
23217 /// Sets the *request* property to the given value.
23218 ///
23219 /// Even though the property as already been set when instantiating this call,
23220 /// we provide this method for API completeness.
23221 pub fn request(mut self, new_value: SiteConfig) -> SiteUpdateConfigCall<'a, C> {
23222 self._request = new_value;
23223 self
23224 }
23225 /// Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
23226 ///
23227 /// Sets the *name* path property to the given value.
23228 ///
23229 /// Even though the property as already been set when instantiating this call,
23230 /// we provide this method for API completeness.
23231 pub fn name(mut self, new_value: &str) -> SiteUpdateConfigCall<'a, C> {
23232 self._name = new_value.to_string();
23233 self
23234 }
23235 /// A set of field names from your [site configuration](https://firebase.google.com/docs/hosting/../sites.SiteConfig) that you want to update. A field will be overwritten if, and only if, it’s in the mask. If a mask is not provided then a default mask of only [`max_versions`](https://firebase.google.com/docs/hosting/../sites.SiteConfig.max_versions) will be used.
23236 ///
23237 /// Sets the *update mask* query property to the given value.
23238 pub fn update_mask(mut self, new_value: common::FieldMask) -> SiteUpdateConfigCall<'a, C> {
23239 self._update_mask = Some(new_value);
23240 self
23241 }
23242 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23243 /// while executing the actual API request.
23244 ///
23245 /// ````text
23246 /// It should be used to handle progress information, and to implement a certain level of resilience.
23247 /// ````
23248 ///
23249 /// Sets the *delegate* property to the given value.
23250 pub fn delegate(
23251 mut self,
23252 new_value: &'a mut dyn common::Delegate,
23253 ) -> SiteUpdateConfigCall<'a, C> {
23254 self._delegate = Some(new_value);
23255 self
23256 }
23257
23258 /// Set any additional parameter of the query string used in the request.
23259 /// It should be used to set parameters which are not yet available through their own
23260 /// setters.
23261 ///
23262 /// Please note that this method must not be used to set any of the known parameters
23263 /// which have their own setter method. If done anyway, the request will fail.
23264 ///
23265 /// # Additional Parameters
23266 ///
23267 /// * *$.xgafv* (query-string) - V1 error format.
23268 /// * *access_token* (query-string) - OAuth access token.
23269 /// * *alt* (query-string) - Data format for response.
23270 /// * *callback* (query-string) - JSONP
23271 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23272 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23273 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23274 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23275 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23276 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23277 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23278 pub fn param<T>(mut self, name: T, value: T) -> SiteUpdateConfigCall<'a, C>
23279 where
23280 T: AsRef<str>,
23281 {
23282 self._additional_params
23283 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23284 self
23285 }
23286
23287 /// Identifies the authorization scope for the method you are building.
23288 ///
23289 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23290 /// [`Scope::CloudPlatform`].
23291 ///
23292 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23293 /// tokens for more than one scope.
23294 ///
23295 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23296 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23297 /// sufficient, a read-write scope will do as well.
23298 pub fn add_scope<St>(mut self, scope: St) -> SiteUpdateConfigCall<'a, C>
23299 where
23300 St: AsRef<str>,
23301 {
23302 self._scopes.insert(String::from(scope.as_ref()));
23303 self
23304 }
23305 /// Identifies the authorization scope(s) for the method you are building.
23306 ///
23307 /// See [`Self::add_scope()`] for details.
23308 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteUpdateConfigCall<'a, C>
23309 where
23310 I: IntoIterator<Item = St>,
23311 St: AsRef<str>,
23312 {
23313 self._scopes
23314 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23315 self
23316 }
23317
23318 /// Removes all scopes, and no default scope will be used either.
23319 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23320 /// for details).
23321 pub fn clear_scopes(mut self) -> SiteUpdateConfigCall<'a, C> {
23322 self._scopes.clear();
23323 self
23324 }
23325}