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 connector = hyper_rustls::HttpsConnectorBuilder::new()
77/// .with_native_roots()
78/// .unwrap()
79/// .https_only()
80/// .enable_http2()
81/// .build();
82///
83/// let executor = hyper_util::rt::TokioExecutor::new();
84/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
85/// secret,
86/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
87/// yup_oauth2::client::CustomHyperClientBuilder::from(
88/// hyper_util::client::legacy::Client::builder(executor).build(connector),
89/// ),
90/// ).build().await.unwrap();
91///
92/// let client = hyper_util::client::legacy::Client::builder(
93/// hyper_util::rt::TokioExecutor::new()
94/// )
95/// .build(
96/// hyper_rustls::HttpsConnectorBuilder::new()
97/// .with_native_roots()
98/// .unwrap()
99/// .https_or_http()
100/// .enable_http2()
101/// .build()
102/// );
103/// let mut hub = FirebaseHosting::new(client, auth);
104/// // As the method needs a request, you would usually fill it with the desired information
105/// // into the respective structure. Some of the parts shown here might not be applicable !
106/// // Values shown here are possibly random and not representative !
107/// let mut req = Site::default();
108///
109/// // You can configure optional parameters by calling the respective setters at will, and
110/// // execute the final call using `doit()`.
111/// // Values shown here are possibly random and not representative !
112/// let result = hub.projects().sites_create(req, "parent")
113/// .validate_only(true)
114/// .site_id("duo")
115/// .doit().await;
116///
117/// match result {
118/// Err(e) => match e {
119/// // The Error enum provides details about what exactly happened.
120/// // You can also just use its `Debug`, `Display` or `Error` traits
121/// Error::HttpError(_)
122/// |Error::Io(_)
123/// |Error::MissingAPIKey
124/// |Error::MissingToken(_)
125/// |Error::Cancelled
126/// |Error::UploadSizeLimitExceeded(_, _)
127/// |Error::Failure(_)
128/// |Error::BadRequest(_)
129/// |Error::FieldClash(_)
130/// |Error::JsonDecodeError(_, _) => println!("{}", e),
131/// },
132/// Ok(res) => println!("Success: {:?}", res),
133/// }
134/// # }
135/// ```
136#[derive(Clone)]
137pub struct FirebaseHosting<C> {
138 pub client: common::Client<C>,
139 pub auth: Box<dyn common::GetToken>,
140 _user_agent: String,
141 _base_url: String,
142 _root_url: String,
143}
144
145impl<C> common::Hub for FirebaseHosting<C> {}
146
147impl<'a, C> FirebaseHosting<C> {
148 pub fn new<A: 'static + common::GetToken>(
149 client: common::Client<C>,
150 auth: A,
151 ) -> FirebaseHosting<C> {
152 FirebaseHosting {
153 client,
154 auth: Box::new(auth),
155 _user_agent: "google-api-rust-client/7.0.0".to_string(),
156 _base_url: "https://firebasehosting.googleapis.com/".to_string(),
157 _root_url: "https://firebasehosting.googleapis.com/".to_string(),
158 }
159 }
160
161 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
162 ProjectMethods { hub: self }
163 }
164 pub fn sites(&'a self) -> SiteMethods<'a, C> {
165 SiteMethods { hub: self }
166 }
167
168 /// Set the user-agent header field to use in all requests to the server.
169 /// It defaults to `google-api-rust-client/7.0.0`.
170 ///
171 /// Returns the previously set user-agent.
172 pub fn user_agent(&mut self, agent_name: String) -> String {
173 std::mem::replace(&mut self._user_agent, agent_name)
174 }
175
176 /// Set the base url to use in all requests to the server.
177 /// It defaults to `https://firebasehosting.googleapis.com/`.
178 ///
179 /// Returns the previously set base url.
180 pub fn base_url(&mut self, new_base_url: String) -> String {
181 std::mem::replace(&mut self._base_url, new_base_url)
182 }
183
184 /// Set the root url to use in all requests to the server.
185 /// It defaults to `https://firebasehosting.googleapis.com/`.
186 ///
187 /// Returns the previously set root url.
188 pub fn root_url(&mut self, new_root_url: String) -> String {
189 std::mem::replace(&mut self._root_url, new_root_url)
190 }
191}
192
193// ############
194// SCHEMAS ###
195// ##########
196/// Contains metadata about the user who performed an action, such as creating a release or finalizing a version.
197///
198/// This type is not used in any activity, and only used as *part* of another schema.
199///
200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
201#[serde_with::serde_as]
202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
203pub struct ActingUser {
204 /// The email address of the user when the user performed the action.
205 pub email: Option<String>,
206 /// A profile image URL for the user. May not be present if the user has changed their email address or deleted their account.
207 #[serde(rename = "imageUrl")]
208 pub image_url: Option<String>,
209}
210
211impl common::Part for ActingUser {}
212
213/// Represents a DNS certificate challenge.
214///
215/// This type is not used in any activity, and only used as *part* of another schema.
216///
217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
218#[serde_with::serde_as]
219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
220pub struct CertDnsChallenge {
221 /// The domain name upon which the DNS challenge must be satisfied.
222 #[serde(rename = "domainName")]
223 pub domain_name: Option<String>,
224 /// The value that must be present as a TXT record on the domain name to satisfy the challenge.
225 pub token: Option<String>,
226}
227
228impl common::Part for CertDnsChallenge {}
229
230/// Represents an HTTP certificate challenge.
231///
232/// This type is not used in any activity, and only used as *part* of another schema.
233///
234#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
235#[serde_with::serde_as]
236#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
237pub struct CertHttpChallenge {
238 /// The URL path on which to serve the specified token to satisfy the certificate challenge.
239 pub path: Option<String>,
240 /// The token to serve at the specified URL path to satisfy the certificate challenge.
241 pub token: Option<String>,
242}
243
244impl common::Part for CertHttpChallenge {}
245
246/// 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.
247///
248/// This type is not used in any activity, and only used as *part* of another schema.
249///
250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
251#[serde_with::serde_as]
252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
253pub struct CertVerification {
254 /// 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.
255 pub dns: Option<DnsUpdates>,
256 /// 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.
257 pub http: Option<HttpUpdate>,
258}
259
260impl common::Part for CertVerification {}
261
262/// 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.
263///
264/// This type is not used in any activity, and only used as *part* of another schema.
265///
266#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
267#[serde_with::serde_as]
268#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
269pub struct Certificate {
270 /// 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.
271 #[serde(rename = "createTime")]
272 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
273 /// 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.
274 #[serde(rename = "expireTime")]
275 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
276 /// 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.
277 pub issues: Option<Vec<Status>>,
278 /// 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.
279 pub state: Option<String>,
280 /// Output only. The certificate's type.
281 #[serde(rename = "type")]
282 pub type_: Option<String>,
283 /// 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.
284 pub verification: Option<CertVerification>,
285}
286
287impl common::Part for Certificate {}
288
289/// 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.
290///
291/// # Activities
292///
293/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
294/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
295///
296/// * [sites channels create projects](ProjectSiteChannelCreateCall) (request|response)
297/// * [sites channels get projects](ProjectSiteChannelGetCall) (response)
298/// * [sites channels patch projects](ProjectSiteChannelPatchCall) (request|response)
299/// * [channels create sites](SiteChannelCreateCall) (request|response)
300/// * [channels get sites](SiteChannelGetCall) (response)
301/// * [channels patch sites](SiteChannelPatchCall) (request|response)
302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
303#[serde_with::serde_as]
304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
305pub struct Channel {
306 /// Output only. The time at which the channel was created.
307 #[serde(rename = "createTime")]
308 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
309 /// 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.
310 #[serde(rename = "expireTime")]
311 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
312 /// Text labels used for extra metadata and/or filtering.
313 pub labels: Option<HashMap<String, String>>,
314 /// The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
315 pub name: Option<String>,
316 /// Output only. The current release for the channel, if any.
317 pub release: Option<Release>,
318 /// 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.
319 #[serde(rename = "retainedReleaseCount")]
320 pub retained_release_count: Option<i32>,
321 /// Input only. A time-to-live for this channel. Sets `expire_time` to the provided duration past the time of the request.
322 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
323 pub ttl: Option<chrono::Duration>,
324 /// Output only. The time at which the channel was last updated.
325 #[serde(rename = "updateTime")]
326 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
327 /// 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.
328 pub url: Option<String>,
329}
330
331impl common::RequestValue for Channel {}
332impl common::ResponseResult for Channel {}
333
334/// There is no detailed description.
335///
336/// # Activities
337///
338/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
339/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
340///
341/// * [sites versions clone projects](ProjectSiteVersionCloneCall) (request)
342/// * [versions clone sites](SiteVersionCloneCall) (request)
343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
344#[serde_with::serde_as]
345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
346pub struct CloneVersionRequest {
347 /// If provided, only paths that do not match any of the RegEx values in this list will be included in the new version.
348 pub exclude: Option<PathFilter>,
349 /// 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`.
350 pub finalize: Option<bool>,
351 /// If provided, only paths that match one or more RegEx values in this list will be included in the new version.
352 pub include: Option<PathFilter>,
353 /// Required. The unique identifier for the version to be cloned, in the format: sites/SITE_ID/versions/VERSION_ID
354 #[serde(rename = "sourceVersion")]
355 pub source_version: Option<String>,
356}
357
358impl common::RequestValue for CloneVersionRequest {}
359
360/// 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).
361///
362/// This type is not used in any activity, and only used as *part* of another schema.
363///
364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
365#[serde_with::serde_as]
366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
367pub struct CloudRunRewrite {
368 /// Optional. User-provided region where the Cloud Run service is hosted. Defaults to `us-central1` if not supplied.
369 pub region: Option<String>,
370 /// Required. User-defined ID of the Cloud Run service.
371 #[serde(rename = "serviceId")]
372 pub service_id: Option<String>,
373 /// Optional. User-provided TrafficConfig tag to send traffic to. When omitted, traffic is sent to the service-wide URI
374 pub tag: Option<String>,
375}
376
377impl common::Part for CloudRunRewrite {}
378
379/// 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.
380///
381/// # Activities
382///
383/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
384/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
385///
386/// * [sites custom domains create projects](ProjectSiteCustomDomainCreateCall) (request)
387/// * [sites custom domains get projects](ProjectSiteCustomDomainGetCall) (response)
388/// * [sites custom domains patch projects](ProjectSiteCustomDomainPatchCall) (request)
389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
390#[serde_with::serde_as]
391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
392pub struct CustomDomain {
393 /// Annotations you can add to leave both human- and machine-readable metadata about your `CustomDomain`.
394 pub annotations: Option<HashMap<String, String>>,
395 /// 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.
396 pub cert: Option<Certificate>,
397 /// 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.
398 #[serde(rename = "certPreference")]
399 pub cert_preference: Option<String>,
400 /// Output only. The custom domain's create time.
401 #[serde(rename = "createTime")]
402 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
403 /// 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.
404 #[serde(rename = "deleteTime")]
405 pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
406 /// 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.
407 pub etag: Option<String>,
408 /// Output only. The minimum time before a soft-deleted `CustomDomain` is completely removed from Hosting; null for custom domains that haven't been deleted.
409 #[serde(rename = "expireTime")]
410 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
411 /// Output only. The `HostState` of the domain name this `CustomDomain` refers to.
412 #[serde(rename = "hostState")]
413 pub host_state: Option<String>,
414 /// 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.
415 pub issues: Option<Vec<Status>>,
416 /// Labels used for extra metadata and/or filtering.
417 pub labels: Option<HashMap<String, String>>,
418 /// Output only. The fully-qualified name of the `CustomDomain`.
419 pub name: Option<String>,
420 /// Output only. The `OwnershipState` of the domain name this `CustomDomain` refers to.
421 #[serde(rename = "ownershipState")]
422 pub ownership_state: Option<String>,
423 /// 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.
424 pub reconciling: Option<bool>,
425 /// 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.
426 #[serde(rename = "redirectTarget")]
427 pub redirect_target: Option<String>,
428 /// 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.
429 #[serde(rename = "requiredDnsUpdates")]
430 pub required_dns_updates: Option<DnsUpdates>,
431 /// Output only. The last time the `CustomDomain` was updated.
432 #[serde(rename = "updateTime")]
433 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
434}
435
436impl common::RequestValue for CustomDomain {}
437impl common::ResponseResult for CustomDomain {}
438
439/// 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).
440///
441/// This type is not used in any activity, and only used as *part* of another schema.
442///
443#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
444#[serde_with::serde_as]
445#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
446pub struct DnsRecord {
447 /// Output only. The domain name the record pertains to, e.g. `foo.bar.com.`.
448 #[serde(rename = "domainName")]
449 pub domain_name: Option<String>,
450 /// 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"`.
451 pub rdata: Option<String>,
452 /// Output only. An enum that indicates the a required action for this record.
453 #[serde(rename = "requiredAction")]
454 pub required_action: Option<String>,
455 /// Output only. The record's type, which determines what data the record contains.
456 #[serde(rename = "type")]
457 pub type_: Option<String>,
458}
459
460impl common::Part for DnsRecord {}
461
462/// A set of DNS records relevant to the setup and maintenance of a custom domain in Firebase Hosting.
463///
464/// This type is not used in any activity, and only used as *part* of another schema.
465///
466#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
467#[serde_with::serde_as]
468#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
469pub struct DnsRecordSet {
470 /// 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.
471 #[serde(rename = "checkError")]
472 pub check_error: Option<Status>,
473 /// Output only. The domain name the record set pertains to.
474 #[serde(rename = "domainName")]
475 pub domain_name: Option<String>,
476 /// Output only. Records on the domain.
477 pub records: Option<Vec<DnsRecord>>,
478}
479
480impl common::Part for DnsRecordSet {}
481
482/// 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.
483///
484/// This type is not used in any activity, and only used as *part* of another schema.
485///
486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
487#[serde_with::serde_as]
488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
489pub struct DnsUpdates {
490 /// The last time Hosting checked your custom domain's DNS records.
491 #[serde(rename = "checkTime")]
492 pub check_time: Option<chrono::DateTime<chrono::offset::Utc>>,
493 /// The set of DNS records Hosting needs to serve secure content on the domain.
494 pub desired: Option<Vec<DnsRecordSet>>,
495 /// The set of DNS records Hosting discovered when inspecting a domain.
496 pub discovered: Option<Vec<DnsRecordSet>>,
497}
498
499impl common::Part for DnsUpdates {}
500
501/// The intended behavior and status information of a domain.
502///
503/// # Activities
504///
505/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
506/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
507///
508/// * [sites domains create projects](ProjectSiteDomainCreateCall) (request|response)
509/// * [sites domains get projects](ProjectSiteDomainGetCall) (response)
510/// * [sites domains update projects](ProjectSiteDomainUpdateCall) (request|response)
511/// * [domains create sites](SiteDomainCreateCall) (request|response)
512/// * [domains get sites](SiteDomainGetCall) (response)
513/// * [domains update sites](SiteDomainUpdateCall) (request|response)
514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
515#[serde_with::serde_as]
516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
517pub struct Domain {
518 /// Required. The domain name of the association.
519 #[serde(rename = "domainName")]
520 pub domain_name: Option<String>,
521 /// If set, the domain should redirect with the provided parameters.
522 #[serde(rename = "domainRedirect")]
523 pub domain_redirect: Option<DomainRedirect>,
524 /// Output only. Information about the provisioning of certificates and the health of the DNS resolution for the domain.
525 pub provisioning: Option<DomainProvisioning>,
526 /// Required. The site name of the association.
527 pub site: Option<String>,
528 /// Output only. Additional status of the domain association.
529 pub status: Option<String>,
530 /// Output only. The time at which the domain was last updated.
531 #[serde(rename = "updateTime")]
532 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
533}
534
535impl common::RequestValue for Domain {}
536impl common::ResponseResult for Domain {}
537
538/// The current certificate provisioning status information for a domain.
539///
540/// This type is not used in any activity, and only used as *part* of another schema.
541///
542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
543#[serde_with::serde_as]
544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
545pub struct DomainProvisioning {
546 /// The TXT records (for the certificate challenge) that were found at the last DNS fetch.
547 #[serde(rename = "certChallengeDiscoveredTxt")]
548 pub cert_challenge_discovered_txt: Option<Vec<String>>,
549 /// The DNS challenge for generating a certificate.
550 #[serde(rename = "certChallengeDns")]
551 pub cert_challenge_dns: Option<CertDnsChallenge>,
552 /// The HTTP challenge for generating a certificate.
553 #[serde(rename = "certChallengeHttp")]
554 pub cert_challenge_http: Option<CertHttpChallenge>,
555 /// The certificate provisioning status; updated when Firebase Hosting provisions an SSL certificate for the domain.
556 #[serde(rename = "certStatus")]
557 pub cert_status: Option<String>,
558 /// The IPs found at the last DNS fetch.
559 #[serde(rename = "discoveredIps")]
560 pub discovered_ips: Option<Vec<String>>,
561 /// The time at which the last DNS fetch occurred.
562 #[serde(rename = "dnsFetchTime")]
563 pub dns_fetch_time: Option<chrono::DateTime<chrono::offset::Utc>>,
564 /// The DNS record match status as of the last DNS fetch.
565 #[serde(rename = "dnsStatus")]
566 pub dns_status: Option<String>,
567 /// The list of IPs to which the domain is expected to resolve.
568 #[serde(rename = "expectedIps")]
569 pub expected_ips: Option<Vec<String>>,
570}
571
572impl common::Part for DomainProvisioning {}
573
574/// 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.
575///
576/// This type is not used in any activity, and only used as *part* of another schema.
577///
578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
579#[serde_with::serde_as]
580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
581pub struct DomainRedirect {
582 /// Required. The domain name to redirect to.
583 #[serde(rename = "domainName")]
584 pub domain_name: Option<String>,
585 /// Required. The redirect status code.
586 #[serde(rename = "type")]
587 pub type_: Option<String>,
588}
589
590impl common::Part for DomainRedirect {}
591
592/// 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); }
593///
594/// # Activities
595///
596/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
597/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
598///
599/// * [sites channels delete projects](ProjectSiteChannelDeleteCall) (response)
600/// * [sites domains delete projects](ProjectSiteDomainDeleteCall) (response)
601/// * [sites versions delete projects](ProjectSiteVersionDeleteCall) (response)
602/// * [sites delete projects](ProjectSiteDeleteCall) (response)
603/// * [channels delete sites](SiteChannelDeleteCall) (response)
604/// * [domains delete sites](SiteDomainDeleteCall) (response)
605/// * [versions delete sites](SiteVersionDeleteCall) (response)
606#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
607#[serde_with::serde_as]
608#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
609pub struct Empty {
610 _never_set: Option<bool>,
611}
612
613impl common::ResponseResult for Empty {}
614
615/// 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.
616///
617/// This type is not used in any activity, and only used as *part* of another schema.
618///
619#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
620#[serde_with::serde_as]
621#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
622pub struct Header {
623 /// The user-supplied [glob](https://firebase.google.com/docs/hosting/full-config#glob_pattern_matching) to match against the request URL path.
624 pub glob: Option<String>,
625 /// Required. The additional headers to add to the response.
626 pub headers: Option<HashMap<String, String>>,
627 /// The user-supplied RE2 regular expression to match against the request URL path.
628 pub regex: Option<String>,
629}
630
631impl common::Part for Header {}
632
633/// 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.
634///
635/// This type is not used in any activity, and only used as *part* of another schema.
636///
637#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
638#[serde_with::serde_as]
639#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
640pub struct HttpUpdate {
641 /// Output only. An error encountered during the last contents check. If null, the check completed successfully.
642 #[serde(rename = "checkError")]
643 pub check_error: Option<Status>,
644 /// Output only. A text string to serve at the path.
645 pub desired: Option<String>,
646 /// Output only. Whether Hosting was able to find the required file contents on the specified path during its last check.
647 pub discovered: Option<String>,
648 /// Output only. The last time Hosting systems checked for the file contents.
649 #[serde(rename = "lastCheckTime")]
650 pub last_check_time: Option<chrono::DateTime<chrono::offset::Utc>>,
651 /// Output only. The path to the file.
652 pub path: Option<String>,
653}
654
655impl common::Part for HttpUpdate {}
656
657/// If provided, i18n rewrites are enabled.
658///
659/// This type is not used in any activity, and only used as *part* of another schema.
660///
661#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
662#[serde_with::serde_as]
663#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
664pub struct I18nConfig {
665 /// Required. The user-supplied path where country and language specific content will be looked for within the public directory.
666 pub root: Option<String>,
667}
668
669impl common::Part for I18nConfig {}
670
671/// There is no detailed description.
672///
673/// # Activities
674///
675/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
676/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
677///
678/// * [sites channels list projects](ProjectSiteChannelListCall) (response)
679/// * [channels list sites](SiteChannelListCall) (response)
680#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
681#[serde_with::serde_as]
682#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
683pub struct ListChannelsResponse {
684 /// The list of channels.
685 pub channels: Option<Vec<Channel>>,
686 /// 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.
687 #[serde(rename = "nextPageToken")]
688 pub next_page_token: Option<String>,
689}
690
691impl common::ResponseResult for ListChannelsResponse {}
692
693/// The response from `ListCustomDomains`.
694///
695/// # Activities
696///
697/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
698/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
699///
700/// * [sites custom domains list projects](ProjectSiteCustomDomainListCall) (response)
701#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
702#[serde_with::serde_as]
703#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
704pub struct ListCustomDomainsResponse {
705 /// A list of `CustomDomain` entities associated with the specified Firebase `Site`.
706 #[serde(rename = "customDomains")]
707 pub custom_domains: Option<Vec<CustomDomain>>,
708 /// 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.
709 #[serde(rename = "nextPageToken")]
710 pub next_page_token: Option<String>,
711}
712
713impl common::ResponseResult for ListCustomDomainsResponse {}
714
715/// The response to listing Domains.
716///
717/// # Activities
718///
719/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
720/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
721///
722/// * [sites domains list projects](ProjectSiteDomainListCall) (response)
723/// * [domains list sites](SiteDomainListCall) (response)
724#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
725#[serde_with::serde_as]
726#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
727pub struct ListDomainsResponse {
728 /// The list of domains, if any exist.
729 pub domains: Option<Vec<Domain>>,
730 /// The pagination token, if more results exist.
731 #[serde(rename = "nextPageToken")]
732 pub next_page_token: Option<String>,
733}
734
735impl common::ResponseResult for ListDomainsResponse {}
736
737/// The response message for Operations.ListOperations.
738///
739/// # Activities
740///
741/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
742/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
743///
744/// * [sites custom domains operations list projects](ProjectSiteCustomDomainOperationListCall) (response)
745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
746#[serde_with::serde_as]
747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
748pub struct ListOperationsResponse {
749 /// The standard List next-page token.
750 #[serde(rename = "nextPageToken")]
751 pub next_page_token: Option<String>,
752 /// A list of operations that matches the specified filter in the request.
753 pub operations: Option<Vec<Operation>>,
754 /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
755 pub unreachable: Option<Vec<String>>,
756}
757
758impl common::ResponseResult for ListOperationsResponse {}
759
760/// There is no detailed description.
761///
762/// # Activities
763///
764/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
765/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
766///
767/// * [sites channels releases list projects](ProjectSiteChannelReleaseListCall) (response)
768/// * [sites releases list projects](ProjectSiteReleaseListCall) (response)
769/// * [channels releases list sites](SiteChannelReleaseListCall) (response)
770/// * [releases list sites](SiteReleaseListCall) (response)
771#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
772#[serde_with::serde_as]
773#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
774pub struct ListReleasesResponse {
775 /// 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.
776 #[serde(rename = "nextPageToken")]
777 pub next_page_token: Option<String>,
778 /// The list of hashes of files that still need to be uploaded, if any exist.
779 pub releases: Option<Vec<Release>>,
780}
781
782impl common::ResponseResult for ListReleasesResponse {}
783
784/// There is no detailed description.
785///
786/// # Activities
787///
788/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
789/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
790///
791/// * [sites list projects](ProjectSiteListCall) (response)
792#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
793#[serde_with::serde_as]
794#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
795pub struct ListSitesResponse {
796 /// 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.
797 #[serde(rename = "nextPageToken")]
798 pub next_page_token: Option<String>,
799 /// A list of Site objects associated with the specified Firebase project.
800 pub sites: Option<Vec<Site>>,
801}
802
803impl common::ResponseResult for ListSitesResponse {}
804
805/// There is no detailed description.
806///
807/// # Activities
808///
809/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
810/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
811///
812/// * [sites versions files list projects](ProjectSiteVersionFileListCall) (response)
813/// * [versions files list sites](SiteVersionFileListCall) (response)
814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
815#[serde_with::serde_as]
816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
817pub struct ListVersionFilesResponse {
818 /// The list of paths to the hashes of the files in the specified version.
819 pub files: Option<Vec<VersionFile>>,
820 /// 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.
821 #[serde(rename = "nextPageToken")]
822 pub next_page_token: Option<String>,
823}
824
825impl common::ResponseResult for ListVersionFilesResponse {}
826
827/// There is no detailed description.
828///
829/// # Activities
830///
831/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
832/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
833///
834/// * [sites versions list projects](ProjectSiteVersionListCall) (response)
835/// * [versions list sites](SiteVersionListCall) (response)
836#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
837#[serde_with::serde_as]
838#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
839pub struct ListVersionsResponse {
840 /// 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.
841 #[serde(rename = "nextPageToken")]
842 pub next_page_token: Option<String>,
843 /// The list of versions, if any exist.
844 pub versions: Option<Vec<Version>>,
845}
846
847impl common::ResponseResult for ListVersionsResponse {}
848
849/// This resource represents a long-running operation that is the result of a network API call.
850///
851/// # Activities
852///
853/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
854/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
855///
856/// * [operations get projects](ProjectOperationGetCall) (response)
857/// * [sites custom domains operations get projects](ProjectSiteCustomDomainOperationGetCall) (response)
858/// * [sites custom domains create projects](ProjectSiteCustomDomainCreateCall) (response)
859/// * [sites custom domains delete projects](ProjectSiteCustomDomainDeleteCall) (response)
860/// * [sites custom domains patch projects](ProjectSiteCustomDomainPatchCall) (response)
861/// * [sites custom domains undelete projects](ProjectSiteCustomDomainUndeleteCall) (response)
862/// * [sites versions clone projects](ProjectSiteVersionCloneCall) (response)
863/// * [versions clone sites](SiteVersionCloneCall) (response)
864#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
865#[serde_with::serde_as]
866#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
867pub struct Operation {
868 /// 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.
869 pub done: Option<bool>,
870 /// The error result of the operation in case of failure or cancellation.
871 pub error: Option<Status>,
872 /// 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.
873 pub metadata: Option<HashMap<String, serde_json::Value>>,
874 /// 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}`.
875 pub name: Option<String>,
876 /// 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`.
877 pub response: Option<HashMap<String, serde_json::Value>>,
878}
879
880impl common::ResponseResult for Operation {}
881
882/// A representation of filter path.
883///
884/// This type is not used in any activity, and only used as *part* of another schema.
885///
886#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
887#[serde_with::serde_as]
888#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
889pub struct PathFilter {
890 /// An array of RegEx values by which to filter.
891 pub regexes: Option<Vec<String>>,
892}
893
894impl common::Part for PathFilter {}
895
896/// There is no detailed description.
897///
898/// # Activities
899///
900/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
901/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
902///
903/// * [sites versions populate files projects](ProjectSiteVersionPopulateFileCall) (request)
904/// * [versions populate files sites](SiteVersionPopulateFileCall) (request)
905#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
906#[serde_with::serde_as]
907#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
908pub struct PopulateVersionFilesRequest {
909 /// 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.
910 pub files: Option<HashMap<String, String>>,
911}
912
913impl common::RequestValue for PopulateVersionFilesRequest {}
914
915/// There is no detailed description.
916///
917/// # Activities
918///
919/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
920/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
921///
922/// * [sites versions populate files projects](ProjectSiteVersionPopulateFileCall) (response)
923/// * [versions populate files sites](SiteVersionPopulateFileCall) (response)
924#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
925#[serde_with::serde_as]
926#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
927pub struct PopulateVersionFilesResponse {
928 /// The content hashes of the specified files that need to be uploaded to the specified URL.
929 #[serde(rename = "uploadRequiredHashes")]
930 pub upload_required_hashes: Option<Vec<String>>,
931 /// 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.
932 #[serde(rename = "uploadUrl")]
933 pub upload_url: Option<String>,
934}
935
936impl common::ResponseResult for PopulateVersionFilesResponse {}
937
938/// 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.
939///
940/// This type is not used in any activity, and only used as *part* of another schema.
941///
942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
943#[serde_with::serde_as]
944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
945pub struct Redirect {
946 /// The user-supplied [glob](https://firebase.google.com/docs/hosting/full-config#glob_pattern_matching) to match against the request URL path.
947 pub glob: Option<String>,
948 /// 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"
949 pub location: Option<String>,
950 /// The user-supplied RE2 regular expression to match against the request URL path.
951 pub regex: Option<String>,
952 /// Required. The status HTTP code to return in the response. It must be a valid 3xx status code.
953 #[serde(rename = "statusCode")]
954 pub status_code: Option<i32>,
955}
956
957impl common::Part for Redirect {}
958
959/// A `Release` is a particular [collection of configurations and files](sites.versions) that is set to be public at a particular time.
960///
961/// # Activities
962///
963/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
964/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
965///
966/// * [sites channels releases create projects](ProjectSiteChannelReleaseCreateCall) (request|response)
967/// * [sites channels releases get projects](ProjectSiteChannelReleaseGetCall) (response)
968/// * [sites releases create projects](ProjectSiteReleaseCreateCall) (request|response)
969/// * [sites releases get projects](ProjectSiteReleaseGetCall) (response)
970/// * [channels releases create sites](SiteChannelReleaseCreateCall) (request|response)
971/// * [channels releases get sites](SiteChannelReleaseGetCall) (response)
972/// * [releases create sites](SiteReleaseCreateCall) (request|response)
973/// * [releases get sites](SiteReleaseGetCall) (response)
974#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
975#[serde_with::serde_as]
976#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
977pub struct Release {
978 /// The deploy description when the release was created. The value can be up to 512 characters.
979 pub message: Option<String>,
980 /// 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).
981 pub name: Option<String>,
982 /// Output only. The time at which the version is set to be public.
983 #[serde(rename = "releaseTime")]
984 pub release_time: Option<chrono::DateTime<chrono::offset::Utc>>,
985 /// Output only. Identifies the user who created the release.
986 #[serde(rename = "releaseUser")]
987 pub release_user: Option<ActingUser>,
988 /// Explains the reason for the release. Specify a value for this field only when creating a `SITE_DISABLE` type release.
989 #[serde(rename = "type")]
990 pub type_: Option<String>,
991 /// Output only. The configuration and content that was released.
992 pub version: Option<Version>,
993}
994
995impl common::RequestValue for Release {}
996impl common::ResponseResult for Release {}
997
998/// 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.
999///
1000/// This type is not used in any activity, and only used as *part* of another schema.
1001///
1002#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1003#[serde_with::serde_as]
1004#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1005pub struct Rewrite {
1006 /// The request will be forwarded to Firebase Dynamic Links.
1007 #[serde(rename = "dynamicLinks")]
1008 pub dynamic_links: Option<bool>,
1009 /// The function to proxy requests to. Must match the exported function name exactly.
1010 pub function: Option<String>,
1011 /// Optional. Specify a Cloud region for rewritten Functions invocations. If not provided, defaults to us-central1.
1012 #[serde(rename = "functionRegion")]
1013 pub function_region: Option<String>,
1014 /// The user-supplied [glob](https://firebase.google.com/docs/hosting/full-config#glob_pattern_matching) to match against the request URL path.
1015 pub glob: Option<String>,
1016 /// The URL path to rewrite the request to.
1017 pub path: Option<String>,
1018 /// The user-supplied RE2 regular expression to match against the request URL path.
1019 pub regex: Option<String>,
1020 /// The request will be forwarded to Cloud Run.
1021 pub run: Option<CloudRunRewrite>,
1022}
1023
1024impl common::Part for Rewrite {}
1025
1026/// 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).
1027///
1028/// This type is not used in any activity, and only used as *part* of another schema.
1029///
1030#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1031#[serde_with::serde_as]
1032#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1033pub struct ServingConfig {
1034 /// How to handle well known App Association files.
1035 #[serde(rename = "appAssociation")]
1036 pub app_association: Option<String>,
1037 /// Defines whether to drop the file extension from uploaded files.
1038 #[serde(rename = "cleanUrls")]
1039 pub clean_urls: Option<bool>,
1040 /// 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.
1041 pub headers: Option<Vec<Header>>,
1042 /// Optional. Defines i18n rewrite behavior.
1043 pub i18n: Option<I18nConfig>,
1044 /// 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.
1045 pub redirects: Option<Vec<Redirect>>,
1046 /// 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.
1047 pub rewrites: Option<Vec<Rewrite>>,
1048 /// Defines how to handle a trailing slash in the URL path.
1049 #[serde(rename = "trailingSlashBehavior")]
1050 pub trailing_slash_behavior: Option<String>,
1051}
1052
1053impl common::Part for ServingConfig {}
1054
1055/// A `Site` represents a Firebase Hosting site.
1056///
1057/// # Activities
1058///
1059/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1060/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1061///
1062/// * [sites create projects](ProjectSiteCreateCall) (request|response)
1063/// * [sites get projects](ProjectSiteGetCall) (response)
1064/// * [sites patch projects](ProjectSitePatchCall) (request|response)
1065/// * [channels releases create sites](SiteChannelReleaseCreateCall) (none)
1066/// * [channels releases get sites](SiteChannelReleaseGetCall) (none)
1067/// * [channels releases list sites](SiteChannelReleaseListCall) (none)
1068/// * [channels create sites](SiteChannelCreateCall) (none)
1069/// * [channels delete sites](SiteChannelDeleteCall) (none)
1070/// * [channels get sites](SiteChannelGetCall) (none)
1071/// * [channels list sites](SiteChannelListCall) (none)
1072/// * [channels patch sites](SiteChannelPatchCall) (none)
1073/// * [domains create sites](SiteDomainCreateCall) (none)
1074/// * [domains delete sites](SiteDomainDeleteCall) (none)
1075/// * [domains get sites](SiteDomainGetCall) (none)
1076/// * [domains list sites](SiteDomainListCall) (none)
1077/// * [domains update sites](SiteDomainUpdateCall) (none)
1078/// * [releases create sites](SiteReleaseCreateCall) (none)
1079/// * [releases get sites](SiteReleaseGetCall) (none)
1080/// * [releases list sites](SiteReleaseListCall) (none)
1081/// * [versions files list sites](SiteVersionFileListCall) (none)
1082/// * [versions clone sites](SiteVersionCloneCall) (none)
1083/// * [versions create sites](SiteVersionCreateCall) (none)
1084/// * [versions delete sites](SiteVersionDeleteCall) (none)
1085/// * [versions get sites](SiteVersionGetCall) (none)
1086/// * [versions list sites](SiteVersionListCall) (none)
1087/// * [versions patch sites](SiteVersionPatchCall) (none)
1088/// * [versions populate files sites](SiteVersionPopulateFileCall) (none)
1089/// * [get config sites](SiteGetConfigCall) (none)
1090/// * [update config sites](SiteUpdateConfigCall) (none)
1091#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1092#[serde_with::serde_as]
1093#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1094pub struct Site {
1095 /// 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.
1096 #[serde(rename = "appId")]
1097 pub app_id: Option<String>,
1098 /// Output only. The default URL for the Hosting site.
1099 #[serde(rename = "defaultUrl")]
1100 pub default_url: Option<String>,
1101 /// Optional. User-specified labels for the Hosting site.
1102 pub labels: Option<HashMap<String, String>>,
1103 /// 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).
1104 pub name: Option<String>,
1105 /// 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`.
1106 #[serde(rename = "type")]
1107 pub type_: Option<String>,
1108}
1109
1110impl common::RequestValue for Site {}
1111impl common::Resource for Site {}
1112impl common::ResponseResult for Site {}
1113
1114/// A `SiteConfig` contains metadata associated with a specific site that controls Firebase Hosting serving behavior
1115///
1116/// # Activities
1117///
1118/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1119/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1120///
1121/// * [sites get config projects](ProjectSiteGetConfigCall) (response)
1122/// * [sites update config projects](ProjectSiteUpdateConfigCall) (request|response)
1123/// * [get config sites](SiteGetConfigCall) (response)
1124/// * [update config sites](SiteUpdateConfigCall) (request|response)
1125#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1126#[serde_with::serde_as]
1127#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1128pub struct SiteConfig {
1129 /// Whether or not web requests made by site visitors are logged via Cloud Logging.
1130 #[serde(rename = "cloudLoggingEnabled")]
1131 pub cloud_logging_enabled: Option<bool>,
1132 /// 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.
1133 #[serde(rename = "maxVersions")]
1134 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1135 pub max_versions: Option<i64>,
1136}
1137
1138impl common::RequestValue for SiteConfig {}
1139impl common::ResponseResult for SiteConfig {}
1140
1141/// 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).
1142///
1143/// This type is not used in any activity, and only used as *part* of another schema.
1144///
1145#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1146#[serde_with::serde_as]
1147#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1148pub struct Status {
1149 /// The status code, which should be an enum value of google.rpc.Code.
1150 pub code: Option<i32>,
1151 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1152 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1153 /// 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.
1154 pub message: Option<String>,
1155}
1156
1157impl common::Part for Status {}
1158
1159/// The request sent to `UndeleteCustomDomain`.
1160///
1161/// # Activities
1162///
1163/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1164/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1165///
1166/// * [sites custom domains undelete projects](ProjectSiteCustomDomainUndeleteCall) (request)
1167#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1168#[serde_with::serde_as]
1169#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1170pub struct UndeleteCustomDomainRequest {
1171 /// 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.
1172 pub etag: Option<String>,
1173 /// If true, Hosting validates that it's possible to complete your request but doesn't actually delete the `CustomDomain`.
1174 #[serde(rename = "validateOnly")]
1175 pub validate_only: Option<bool>,
1176}
1177
1178impl common::RequestValue for UndeleteCustomDomainRequest {}
1179
1180/// A `Version` is a configuration and a collection of static files which determine how a site is displayed.
1181///
1182/// # Activities
1183///
1184/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1185/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1186///
1187/// * [sites versions create projects](ProjectSiteVersionCreateCall) (request|response)
1188/// * [sites versions get projects](ProjectSiteVersionGetCall) (response)
1189/// * [sites versions patch projects](ProjectSiteVersionPatchCall) (request|response)
1190/// * [versions create sites](SiteVersionCreateCall) (request|response)
1191/// * [versions get sites](SiteVersionGetCall) (response)
1192/// * [versions patch sites](SiteVersionPatchCall) (request|response)
1193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1194#[serde_with::serde_as]
1195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1196pub struct Version {
1197 /// 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.
1198 pub config: Option<ServingConfig>,
1199 /// Output only. The time at which the version was created.
1200 #[serde(rename = "createTime")]
1201 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1202 /// Output only. Identifies the user who created the version.
1203 #[serde(rename = "createUser")]
1204 pub create_user: Option<ActingUser>,
1205 /// Output only. The time at which the version was `DELETED`.
1206 #[serde(rename = "deleteTime")]
1207 pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1208 /// Output only. Identifies the user who `DELETED` the version.
1209 #[serde(rename = "deleteUser")]
1210 pub delete_user: Option<ActingUser>,
1211 /// Output only. The total number of files associated with the version. This value is calculated after a version is `FINALIZED`.
1212 #[serde(rename = "fileCount")]
1213 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1214 pub file_count: Option<i64>,
1215 /// Output only. The time at which the version was `FINALIZED`.
1216 #[serde(rename = "finalizeTime")]
1217 pub finalize_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1218 /// Output only. Identifies the user who `FINALIZED` the version.
1219 #[serde(rename = "finalizeUser")]
1220 pub finalize_user: Option<ActingUser>,
1221 /// The labels used for extra metadata and/or filtering.
1222 pub labels: Option<HashMap<String, String>>,
1223 /// 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).
1224 pub name: Option<String>,
1225 /// 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).
1226 pub status: Option<String>,
1227 /// Output only. The total stored bytesize of the version. This value is calculated after a version is `FINALIZED`.
1228 #[serde(rename = "versionBytes")]
1229 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1230 pub version_bytes: Option<i64>,
1231}
1232
1233impl common::RequestValue for Version {}
1234impl common::ResponseResult for Version {}
1235
1236/// A static content file that is part of a version.
1237///
1238/// This type is not used in any activity, and only used as *part* of another schema.
1239///
1240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1241#[serde_with::serde_as]
1242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1243pub struct VersionFile {
1244 /// The SHA256 content hash of the file.
1245 pub hash: Option<String>,
1246 /// The URI at which the file's content should display.
1247 pub path: Option<String>,
1248 /// Output only. The current status of a particular file in the specified version. The value will be either `pending upload` or `uploaded`.
1249 pub status: Option<String>,
1250}
1251
1252impl common::Part for VersionFile {}
1253
1254// ###################
1255// MethodBuilders ###
1256// #################
1257
1258/// A builder providing access to all methods supported on *project* resources.
1259/// It is not used directly, but through the [`FirebaseHosting`] hub.
1260///
1261/// # Example
1262///
1263/// Instantiate a resource builder
1264///
1265/// ```test_harness,no_run
1266/// extern crate hyper;
1267/// extern crate hyper_rustls;
1268/// extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
1269///
1270/// # async fn dox() {
1271/// use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1272///
1273/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1274/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1275/// .with_native_roots()
1276/// .unwrap()
1277/// .https_only()
1278/// .enable_http2()
1279/// .build();
1280///
1281/// let executor = hyper_util::rt::TokioExecutor::new();
1282/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1283/// secret,
1284/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1285/// yup_oauth2::client::CustomHyperClientBuilder::from(
1286/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1287/// ),
1288/// ).build().await.unwrap();
1289///
1290/// let client = hyper_util::client::legacy::Client::builder(
1291/// hyper_util::rt::TokioExecutor::new()
1292/// )
1293/// .build(
1294/// hyper_rustls::HttpsConnectorBuilder::new()
1295/// .with_native_roots()
1296/// .unwrap()
1297/// .https_or_http()
1298/// .enable_http2()
1299/// .build()
1300/// );
1301/// let mut hub = FirebaseHosting::new(client, auth);
1302/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1303/// // 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(...)`
1304/// // to build up your call.
1305/// let rb = hub.projects();
1306/// # }
1307/// ```
1308pub struct ProjectMethods<'a, C>
1309where
1310 C: 'a,
1311{
1312 hub: &'a FirebaseHosting<C>,
1313}
1314
1315impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1316
1317impl<'a, C> ProjectMethods<'a, C> {
1318 /// Create a builder to help you perform the following task:
1319 ///
1320 /// 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.
1321 ///
1322 /// # Arguments
1323 ///
1324 /// * `name` - The name of the operation resource.
1325 pub fn operations_get(&self, name: &str) -> ProjectOperationGetCall<'a, C> {
1326 ProjectOperationGetCall {
1327 hub: self.hub,
1328 _name: name.to_string(),
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 /// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
1338 ///
1339 /// # Arguments
1340 ///
1341 /// * `request` - No description provided.
1342 /// * `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
1343 pub fn sites_channels_releases_create(
1344 &self,
1345 request: Release,
1346 parent: &str,
1347 ) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
1348 ProjectSiteChannelReleaseCreateCall {
1349 hub: self.hub,
1350 _request: request,
1351 _parent: parent.to_string(),
1352 _version_name: Default::default(),
1353 _delegate: Default::default(),
1354 _additional_params: Default::default(),
1355 _scopes: Default::default(),
1356 }
1357 }
1358
1359 /// Create a builder to help you perform the following task:
1360 ///
1361 /// 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.
1362 ///
1363 /// # Arguments
1364 ///
1365 /// * `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
1366 pub fn sites_channels_releases_get(
1367 &self,
1368 name: &str,
1369 ) -> ProjectSiteChannelReleaseGetCall<'a, C> {
1370 ProjectSiteChannelReleaseGetCall {
1371 hub: self.hub,
1372 _name: name.to_string(),
1373 _delegate: Default::default(),
1374 _additional_params: Default::default(),
1375 _scopes: Default::default(),
1376 }
1377 }
1378
1379 /// Create a builder to help you perform the following task:
1380 ///
1381 /// 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.
1382 ///
1383 /// # Arguments
1384 ///
1385 /// * `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
1386 pub fn sites_channels_releases_list(
1387 &self,
1388 parent: &str,
1389 ) -> ProjectSiteChannelReleaseListCall<'a, C> {
1390 ProjectSiteChannelReleaseListCall {
1391 hub: self.hub,
1392 _parent: parent.to_string(),
1393 _page_token: Default::default(),
1394 _page_size: 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 /// Creates a new channel in the specified site.
1404 ///
1405 /// # Arguments
1406 ///
1407 /// * `request` - No description provided.
1408 /// * `parent` - Required. The site in which to create this channel, in the format: sites/ SITE_ID
1409 pub fn sites_channels_create(
1410 &self,
1411 request: Channel,
1412 parent: &str,
1413 ) -> ProjectSiteChannelCreateCall<'a, C> {
1414 ProjectSiteChannelCreateCall {
1415 hub: self.hub,
1416 _request: request,
1417 _parent: parent.to_string(),
1418 _channel_id: Default::default(),
1419 _delegate: Default::default(),
1420 _additional_params: Default::default(),
1421 _scopes: Default::default(),
1422 }
1423 }
1424
1425 /// Create a builder to help you perform the following task:
1426 ///
1427 /// Deletes the specified channel of the specified site. The `live` channel cannot be deleted.
1428 ///
1429 /// # Arguments
1430 ///
1431 /// * `name` - Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
1432 pub fn sites_channels_delete(&self, name: &str) -> ProjectSiteChannelDeleteCall<'a, C> {
1433 ProjectSiteChannelDeleteCall {
1434 hub: self.hub,
1435 _name: name.to_string(),
1436 _delegate: Default::default(),
1437 _additional_params: Default::default(),
1438 _scopes: Default::default(),
1439 }
1440 }
1441
1442 /// Create a builder to help you perform the following task:
1443 ///
1444 /// Retrieves information for the specified channel of the specified site.
1445 ///
1446 /// # Arguments
1447 ///
1448 /// * `name` - Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
1449 pub fn sites_channels_get(&self, name: &str) -> ProjectSiteChannelGetCall<'a, C> {
1450 ProjectSiteChannelGetCall {
1451 hub: self.hub,
1452 _name: name.to_string(),
1453 _delegate: Default::default(),
1454 _additional_params: Default::default(),
1455 _scopes: Default::default(),
1456 }
1457 }
1458
1459 /// Create a builder to help you perform the following task:
1460 ///
1461 /// Lists the channels for the specified site. All sites have a default `live` channel.
1462 ///
1463 /// # Arguments
1464 ///
1465 /// * `parent` - Required. The site for which to list channels, in the format: sites/SITE_ID
1466 pub fn sites_channels_list(&self, parent: &str) -> ProjectSiteChannelListCall<'a, C> {
1467 ProjectSiteChannelListCall {
1468 hub: self.hub,
1469 _parent: parent.to_string(),
1470 _page_token: Default::default(),
1471 _page_size: 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 /// Updates information for the specified channel of the specified site. Implicitly creates the channel if it doesn't already exist.
1481 ///
1482 /// # Arguments
1483 ///
1484 /// * `request` - No description provided.
1485 /// * `name` - The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
1486 pub fn sites_channels_patch(
1487 &self,
1488 request: Channel,
1489 name: &str,
1490 ) -> ProjectSiteChannelPatchCall<'a, C> {
1491 ProjectSiteChannelPatchCall {
1492 hub: self.hub,
1493 _request: request,
1494 _name: name.to_string(),
1495 _update_mask: Default::default(),
1496 _delegate: Default::default(),
1497 _additional_params: Default::default(),
1498 _scopes: Default::default(),
1499 }
1500 }
1501
1502 /// Create a builder to help you perform the following task:
1503 ///
1504 /// 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.
1505 ///
1506 /// # Arguments
1507 ///
1508 /// * `name` - The name of the operation resource.
1509 pub fn sites_custom_domains_operations_get(
1510 &self,
1511 name: &str,
1512 ) -> ProjectSiteCustomDomainOperationGetCall<'a, C> {
1513 ProjectSiteCustomDomainOperationGetCall {
1514 hub: self.hub,
1515 _name: name.to_string(),
1516 _delegate: Default::default(),
1517 _additional_params: Default::default(),
1518 _scopes: Default::default(),
1519 }
1520 }
1521
1522 /// Create a builder to help you perform the following task:
1523 ///
1524 /// Lists operations that match the specified filter in the request.
1525 ///
1526 /// # Arguments
1527 ///
1528 /// * `name` - The name of the operation's parent resource.
1529 pub fn sites_custom_domains_operations_list(
1530 &self,
1531 name: &str,
1532 ) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
1533 ProjectSiteCustomDomainOperationListCall {
1534 hub: self.hub,
1535 _name: name.to_string(),
1536 _return_partial_success: Default::default(),
1537 _page_token: Default::default(),
1538 _page_size: Default::default(),
1539 _filter: 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 /// Creates a `CustomDomain`.
1549 ///
1550 /// # Arguments
1551 ///
1552 /// * `request` - No description provided.
1553 /// * `parent` - Required. The custom domain's parent, specifically a Firebase Hosting `Site`.
1554 pub fn sites_custom_domains_create(
1555 &self,
1556 request: CustomDomain,
1557 parent: &str,
1558 ) -> ProjectSiteCustomDomainCreateCall<'a, C> {
1559 ProjectSiteCustomDomainCreateCall {
1560 hub: self.hub,
1561 _request: request,
1562 _parent: parent.to_string(),
1563 _validate_only: Default::default(),
1564 _custom_domain_id: Default::default(),
1565 _delegate: Default::default(),
1566 _additional_params: Default::default(),
1567 _scopes: Default::default(),
1568 }
1569 }
1570
1571 /// Create a builder to help you perform the following task:
1572 ///
1573 /// Deletes the specified `CustomDomain`.
1574 ///
1575 /// # Arguments
1576 ///
1577 /// * `name` - Required. The name of the `CustomDomain` to delete.
1578 pub fn sites_custom_domains_delete(
1579 &self,
1580 name: &str,
1581 ) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
1582 ProjectSiteCustomDomainDeleteCall {
1583 hub: self.hub,
1584 _name: name.to_string(),
1585 _validate_only: Default::default(),
1586 _etag: Default::default(),
1587 _allow_missing: Default::default(),
1588 _delegate: Default::default(),
1589 _additional_params: Default::default(),
1590 _scopes: Default::default(),
1591 }
1592 }
1593
1594 /// Create a builder to help you perform the following task:
1595 ///
1596 /// Gets the specified `CustomDomain`.
1597 ///
1598 /// # Arguments
1599 ///
1600 /// * `name` - Required. The name of the `CustomDomain` to get.
1601 pub fn sites_custom_domains_get(&self, name: &str) -> ProjectSiteCustomDomainGetCall<'a, C> {
1602 ProjectSiteCustomDomainGetCall {
1603 hub: self.hub,
1604 _name: name.to_string(),
1605 _delegate: Default::default(),
1606 _additional_params: Default::default(),
1607 _scopes: Default::default(),
1608 }
1609 }
1610
1611 /// Create a builder to help you perform the following task:
1612 ///
1613 /// Lists each `CustomDomain` associated with the specified parent Hosting site. Returns `CustomDomain`s in a consistent, but undefined, order to facilitate pagination.
1614 ///
1615 /// # Arguments
1616 ///
1617 /// * `parent` - Required. The Firebase Hosting `Site` with `CustomDomain` entities you'd like to list.
1618 pub fn sites_custom_domains_list(
1619 &self,
1620 parent: &str,
1621 ) -> ProjectSiteCustomDomainListCall<'a, C> {
1622 ProjectSiteCustomDomainListCall {
1623 hub: self.hub,
1624 _parent: parent.to_string(),
1625 _show_deleted: Default::default(),
1626 _page_token: Default::default(),
1627 _page_size: Default::default(),
1628 _delegate: Default::default(),
1629 _additional_params: Default::default(),
1630 _scopes: Default::default(),
1631 }
1632 }
1633
1634 /// Create a builder to help you perform the following task:
1635 ///
1636 /// Updates the specified `CustomDomain`.
1637 ///
1638 /// # Arguments
1639 ///
1640 /// * `request` - No description provided.
1641 /// * `name` - Output only. The fully-qualified name of the `CustomDomain`.
1642 pub fn sites_custom_domains_patch(
1643 &self,
1644 request: CustomDomain,
1645 name: &str,
1646 ) -> ProjectSiteCustomDomainPatchCall<'a, C> {
1647 ProjectSiteCustomDomainPatchCall {
1648 hub: self.hub,
1649 _request: request,
1650 _name: name.to_string(),
1651 _validate_only: Default::default(),
1652 _update_mask: Default::default(),
1653 _allow_missing: Default::default(),
1654 _delegate: Default::default(),
1655 _additional_params: Default::default(),
1656 _scopes: Default::default(),
1657 }
1658 }
1659
1660 /// Create a builder to help you perform the following task:
1661 ///
1662 /// Undeletes the specified `CustomDomain` if it has been soft-deleted. Hosting retains soft-deleted custom domains for around 30 days before permanently deleting them.
1663 ///
1664 /// # Arguments
1665 ///
1666 /// * `request` - No description provided.
1667 /// * `name` - Required. The name of the `CustomDomain` to delete.
1668 pub fn sites_custom_domains_undelete(
1669 &self,
1670 request: UndeleteCustomDomainRequest,
1671 name: &str,
1672 ) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
1673 ProjectSiteCustomDomainUndeleteCall {
1674 hub: self.hub,
1675 _request: request,
1676 _name: name.to_string(),
1677 _delegate: Default::default(),
1678 _additional_params: Default::default(),
1679 _scopes: Default::default(),
1680 }
1681 }
1682
1683 /// Create a builder to help you perform the following task:
1684 ///
1685 /// Creates a domain mapping on the specified site.
1686 ///
1687 /// # Arguments
1688 ///
1689 /// * `request` - No description provided.
1690 /// * `parent` - Required. The parent to create the domain association for, in the format: sites/site-name
1691 pub fn sites_domains_create(
1692 &self,
1693 request: Domain,
1694 parent: &str,
1695 ) -> ProjectSiteDomainCreateCall<'a, C> {
1696 ProjectSiteDomainCreateCall {
1697 hub: self.hub,
1698 _request: request,
1699 _parent: parent.to_string(),
1700 _delegate: Default::default(),
1701 _additional_params: Default::default(),
1702 _scopes: Default::default(),
1703 }
1704 }
1705
1706 /// Create a builder to help you perform the following task:
1707 ///
1708 /// Deletes the existing domain mapping on the specified site.
1709 ///
1710 /// # Arguments
1711 ///
1712 /// * `name` - Required. The name of the domain association to delete.
1713 pub fn sites_domains_delete(&self, name: &str) -> ProjectSiteDomainDeleteCall<'a, C> {
1714 ProjectSiteDomainDeleteCall {
1715 hub: self.hub,
1716 _name: name.to_string(),
1717 _delegate: Default::default(),
1718 _additional_params: Default::default(),
1719 _scopes: Default::default(),
1720 }
1721 }
1722
1723 /// Create a builder to help you perform the following task:
1724 ///
1725 /// Gets a domain mapping on the specified site.
1726 ///
1727 /// # Arguments
1728 ///
1729 /// * `name` - Required. The name of the domain configuration to get.
1730 pub fn sites_domains_get(&self, name: &str) -> ProjectSiteDomainGetCall<'a, C> {
1731 ProjectSiteDomainGetCall {
1732 hub: self.hub,
1733 _name: name.to_string(),
1734 _delegate: Default::default(),
1735 _additional_params: Default::default(),
1736 _scopes: Default::default(),
1737 }
1738 }
1739
1740 /// Create a builder to help you perform the following task:
1741 ///
1742 /// Lists the domains for the specified site.
1743 ///
1744 /// # Arguments
1745 ///
1746 /// * `parent` - Required. The parent for which to list domains, in the format: sites/ site-name
1747 pub fn sites_domains_list(&self, parent: &str) -> ProjectSiteDomainListCall<'a, C> {
1748 ProjectSiteDomainListCall {
1749 hub: self.hub,
1750 _parent: parent.to_string(),
1751 _page_token: Default::default(),
1752 _page_size: Default::default(),
1753 _delegate: Default::default(),
1754 _additional_params: Default::default(),
1755 _scopes: Default::default(),
1756 }
1757 }
1758
1759 /// Create a builder to help you perform the following task:
1760 ///
1761 /// Updates the specified domain mapping, creating the mapping as if it does not exist.
1762 ///
1763 /// # Arguments
1764 ///
1765 /// * `request` - No description provided.
1766 /// * `name` - Required. The name of the domain association to update or create, if an association doesn't already exist.
1767 pub fn sites_domains_update(
1768 &self,
1769 request: Domain,
1770 name: &str,
1771 ) -> ProjectSiteDomainUpdateCall<'a, C> {
1772 ProjectSiteDomainUpdateCall {
1773 hub: self.hub,
1774 _request: request,
1775 _name: name.to_string(),
1776 _delegate: Default::default(),
1777 _additional_params: Default::default(),
1778 _scopes: Default::default(),
1779 }
1780 }
1781
1782 /// Create a builder to help you perform the following task:
1783 ///
1784 /// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
1785 ///
1786 /// # Arguments
1787 ///
1788 /// * `request` - No description provided.
1789 /// * `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
1790 pub fn sites_releases_create(
1791 &self,
1792 request: Release,
1793 parent: &str,
1794 ) -> ProjectSiteReleaseCreateCall<'a, C> {
1795 ProjectSiteReleaseCreateCall {
1796 hub: self.hub,
1797 _request: request,
1798 _parent: parent.to_string(),
1799 _version_name: Default::default(),
1800 _delegate: Default::default(),
1801 _additional_params: Default::default(),
1802 _scopes: Default::default(),
1803 }
1804 }
1805
1806 /// Create a builder to help you perform the following task:
1807 ///
1808 /// 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.
1809 ///
1810 /// # Arguments
1811 ///
1812 /// * `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
1813 pub fn sites_releases_get(&self, name: &str) -> ProjectSiteReleaseGetCall<'a, C> {
1814 ProjectSiteReleaseGetCall {
1815 hub: self.hub,
1816 _name: name.to_string(),
1817 _delegate: Default::default(),
1818 _additional_params: Default::default(),
1819 _scopes: Default::default(),
1820 }
1821 }
1822
1823 /// Create a builder to help you perform the following task:
1824 ///
1825 /// 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.
1826 ///
1827 /// # Arguments
1828 ///
1829 /// * `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
1830 pub fn sites_releases_list(&self, parent: &str) -> ProjectSiteReleaseListCall<'a, C> {
1831 ProjectSiteReleaseListCall {
1832 hub: self.hub,
1833 _parent: parent.to_string(),
1834 _page_token: Default::default(),
1835 _page_size: Default::default(),
1836 _delegate: Default::default(),
1837 _additional_params: Default::default(),
1838 _scopes: Default::default(),
1839 }
1840 }
1841
1842 /// Create a builder to help you perform the following task:
1843 ///
1844 /// Lists the remaining files to be uploaded for the specified version.
1845 ///
1846 /// # Arguments
1847 ///
1848 /// * `parent` - Required. The version for which to list files, in the format: sites/SITE_ID /versions/VERSION_ID
1849 pub fn sites_versions_files_list(&self, parent: &str) -> ProjectSiteVersionFileListCall<'a, C> {
1850 ProjectSiteVersionFileListCall {
1851 hub: self.hub,
1852 _parent: parent.to_string(),
1853 _status: Default::default(),
1854 _page_token: Default::default(),
1855 _page_size: Default::default(),
1856 _delegate: Default::default(),
1857 _additional_params: Default::default(),
1858 _scopes: Default::default(),
1859 }
1860 }
1861
1862 /// Create a builder to help you perform the following task:
1863 ///
1864 /// Creates a new version on the specified target site using the content of the specified version.
1865 ///
1866 /// # Arguments
1867 ///
1868 /// * `request` - No description provided.
1869 /// * `parent` - Required. The target site for the cloned version, in the format: sites/ SITE_ID
1870 pub fn sites_versions_clone(
1871 &self,
1872 request: CloneVersionRequest,
1873 parent: &str,
1874 ) -> ProjectSiteVersionCloneCall<'a, C> {
1875 ProjectSiteVersionCloneCall {
1876 hub: self.hub,
1877 _request: request,
1878 _parent: parent.to_string(),
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 /// Creates a new version for the specified site.
1888 ///
1889 /// # Arguments
1890 ///
1891 /// * `request` - No description provided.
1892 /// * `parent` - Required. The site in which to create the version, in the format: sites/ SITE_ID
1893 pub fn sites_versions_create(
1894 &self,
1895 request: Version,
1896 parent: &str,
1897 ) -> ProjectSiteVersionCreateCall<'a, C> {
1898 ProjectSiteVersionCreateCall {
1899 hub: self.hub,
1900 _request: request,
1901 _parent: parent.to_string(),
1902 _version_id: Default::default(),
1903 _size_bytes: Default::default(),
1904 _delegate: Default::default(),
1905 _additional_params: Default::default(),
1906 _scopes: Default::default(),
1907 }
1908 }
1909
1910 /// Create a builder to help you perform the following task:
1911 ///
1912 /// Deletes the specified version.
1913 ///
1914 /// # Arguments
1915 ///
1916 /// * `name` - Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
1917 pub fn sites_versions_delete(&self, name: &str) -> ProjectSiteVersionDeleteCall<'a, C> {
1918 ProjectSiteVersionDeleteCall {
1919 hub: self.hub,
1920 _name: name.to_string(),
1921 _delegate: Default::default(),
1922 _additional_params: Default::default(),
1923 _scopes: Default::default(),
1924 }
1925 }
1926
1927 /// Create a builder to help you perform the following task:
1928 ///
1929 /// 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.
1930 ///
1931 /// # Arguments
1932 ///
1933 /// * `name` - Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
1934 pub fn sites_versions_get(&self, name: &str) -> ProjectSiteVersionGetCall<'a, C> {
1935 ProjectSiteVersionGetCall {
1936 hub: self.hub,
1937 _name: name.to_string(),
1938 _delegate: Default::default(),
1939 _additional_params: Default::default(),
1940 _scopes: Default::default(),
1941 }
1942 }
1943
1944 /// Create a builder to help you perform the following task:
1945 ///
1946 /// 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.
1947 ///
1948 /// # Arguments
1949 ///
1950 /// * `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
1951 pub fn sites_versions_list(&self, parent: &str) -> ProjectSiteVersionListCall<'a, C> {
1952 ProjectSiteVersionListCall {
1953 hub: self.hub,
1954 _parent: parent.to_string(),
1955 _page_token: Default::default(),
1956 _page_size: Default::default(),
1957 _filter: Default::default(),
1958 _delegate: Default::default(),
1959 _additional_params: Default::default(),
1960 _scopes: Default::default(),
1961 }
1962 }
1963
1964 /// Create a builder to help you perform the following task:
1965 ///
1966 /// 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`.
1967 ///
1968 /// # Arguments
1969 ///
1970 /// * `request` - No description provided.
1971 /// * `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).
1972 pub fn sites_versions_patch(
1973 &self,
1974 request: Version,
1975 name: &str,
1976 ) -> ProjectSiteVersionPatchCall<'a, C> {
1977 ProjectSiteVersionPatchCall {
1978 hub: self.hub,
1979 _request: request,
1980 _name: name.to_string(),
1981 _update_mask: Default::default(),
1982 _delegate: Default::default(),
1983 _additional_params: Default::default(),
1984 _scopes: Default::default(),
1985 }
1986 }
1987
1988 /// Create a builder to help you perform the following task:
1989 ///
1990 /// Adds content files to the specified version. Each file must be under 2 GB.
1991 ///
1992 /// # Arguments
1993 ///
1994 /// * `request` - No description provided.
1995 /// * `parent` - Required. The version to which to add files, in the format: sites/SITE_ID /versions/VERSION_ID
1996 pub fn sites_versions_populate_files(
1997 &self,
1998 request: PopulateVersionFilesRequest,
1999 parent: &str,
2000 ) -> ProjectSiteVersionPopulateFileCall<'a, C> {
2001 ProjectSiteVersionPopulateFileCall {
2002 hub: self.hub,
2003 _request: request,
2004 _parent: parent.to_string(),
2005 _delegate: Default::default(),
2006 _additional_params: Default::default(),
2007 _scopes: Default::default(),
2008 }
2009 }
2010
2011 /// Create a builder to help you perform the following task:
2012 ///
2013 /// Creates a new Hosting Site in the specified parent Firebase project. Note that Hosting sites can take several minutes to propagate through Firebase systems.
2014 ///
2015 /// # Arguments
2016 ///
2017 /// * `request` - No description provided.
2018 /// * `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.
2019 pub fn sites_create(&self, request: Site, parent: &str) -> ProjectSiteCreateCall<'a, C> {
2020 ProjectSiteCreateCall {
2021 hub: self.hub,
2022 _request: request,
2023 _parent: parent.to_string(),
2024 _validate_only: Default::default(),
2025 _site_id: Default::default(),
2026 _delegate: Default::default(),
2027 _additional_params: Default::default(),
2028 _scopes: Default::default(),
2029 }
2030 }
2031
2032 /// Create a builder to help you perform the following task:
2033 ///
2034 /// Deletes the specified Hosting Site from the specified parent Firebase project.
2035 ///
2036 /// # Arguments
2037 ///
2038 /// * `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.
2039 pub fn sites_delete(&self, name: &str) -> ProjectSiteDeleteCall<'a, C> {
2040 ProjectSiteDeleteCall {
2041 hub: self.hub,
2042 _name: name.to_string(),
2043 _delegate: Default::default(),
2044 _additional_params: Default::default(),
2045 _scopes: Default::default(),
2046 }
2047 }
2048
2049 /// Create a builder to help you perform the following task:
2050 ///
2051 /// Gets the specified Hosting Site.
2052 ///
2053 /// # Arguments
2054 ///
2055 /// * `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
2056 pub fn sites_get(&self, name: &str) -> ProjectSiteGetCall<'a, C> {
2057 ProjectSiteGetCall {
2058 hub: self.hub,
2059 _name: name.to_string(),
2060 _delegate: Default::default(),
2061 _additional_params: Default::default(),
2062 _scopes: Default::default(),
2063 }
2064 }
2065
2066 /// Create a builder to help you perform the following task:
2067 ///
2068 /// Gets the Hosting metadata for a specific site.
2069 ///
2070 /// # Arguments
2071 ///
2072 /// * `name` - Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
2073 pub fn sites_get_config(&self, name: &str) -> ProjectSiteGetConfigCall<'a, C> {
2074 ProjectSiteGetConfigCall {
2075 hub: self.hub,
2076 _name: name.to_string(),
2077 _delegate: Default::default(),
2078 _additional_params: Default::default(),
2079 _scopes: Default::default(),
2080 }
2081 }
2082
2083 /// Create a builder to help you perform the following task:
2084 ///
2085 /// Lists each Hosting Site associated with the specified parent Firebase project.
2086 ///
2087 /// # Arguments
2088 ///
2089 /// * `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.
2090 pub fn sites_list(&self, parent: &str) -> ProjectSiteListCall<'a, C> {
2091 ProjectSiteListCall {
2092 hub: self.hub,
2093 _parent: parent.to_string(),
2094 _page_token: Default::default(),
2095 _page_size: Default::default(),
2096 _delegate: Default::default(),
2097 _additional_params: Default::default(),
2098 _scopes: Default::default(),
2099 }
2100 }
2101
2102 /// Create a builder to help you perform the following task:
2103 ///
2104 /// Updates attributes of the specified Hosting Site.
2105 ///
2106 /// # Arguments
2107 ///
2108 /// * `request` - No description provided.
2109 /// * `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).
2110 pub fn sites_patch(&self, request: Site, name: &str) -> ProjectSitePatchCall<'a, C> {
2111 ProjectSitePatchCall {
2112 hub: self.hub,
2113 _request: request,
2114 _name: name.to_string(),
2115 _update_mask: Default::default(),
2116 _delegate: Default::default(),
2117 _additional_params: Default::default(),
2118 _scopes: Default::default(),
2119 }
2120 }
2121
2122 /// Create a builder to help you perform the following task:
2123 ///
2124 /// Sets the Hosting metadata for a specific site.
2125 ///
2126 /// # Arguments
2127 ///
2128 /// * `request` - No description provided.
2129 /// * `name` - Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
2130 pub fn sites_update_config(
2131 &self,
2132 request: SiteConfig,
2133 name: &str,
2134 ) -> ProjectSiteUpdateConfigCall<'a, C> {
2135 ProjectSiteUpdateConfigCall {
2136 hub: self.hub,
2137 _request: request,
2138 _name: name.to_string(),
2139 _update_mask: Default::default(),
2140 _delegate: Default::default(),
2141 _additional_params: Default::default(),
2142 _scopes: Default::default(),
2143 }
2144 }
2145}
2146
2147/// A builder providing access to all methods supported on *site* resources.
2148/// It is not used directly, but through the [`FirebaseHosting`] hub.
2149///
2150/// # Example
2151///
2152/// Instantiate a resource builder
2153///
2154/// ```test_harness,no_run
2155/// extern crate hyper;
2156/// extern crate hyper_rustls;
2157/// extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
2158///
2159/// # async fn dox() {
2160/// use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2161///
2162/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2163/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2164/// .with_native_roots()
2165/// .unwrap()
2166/// .https_only()
2167/// .enable_http2()
2168/// .build();
2169///
2170/// let executor = hyper_util::rt::TokioExecutor::new();
2171/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2172/// secret,
2173/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2174/// yup_oauth2::client::CustomHyperClientBuilder::from(
2175/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2176/// ),
2177/// ).build().await.unwrap();
2178///
2179/// let client = hyper_util::client::legacy::Client::builder(
2180/// hyper_util::rt::TokioExecutor::new()
2181/// )
2182/// .build(
2183/// hyper_rustls::HttpsConnectorBuilder::new()
2184/// .with_native_roots()
2185/// .unwrap()
2186/// .https_or_http()
2187/// .enable_http2()
2188/// .build()
2189/// );
2190/// let mut hub = FirebaseHosting::new(client, auth);
2191/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2192/// // 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(...)`
2193/// // to build up your call.
2194/// let rb = hub.sites();
2195/// # }
2196/// ```
2197pub struct SiteMethods<'a, C>
2198where
2199 C: 'a,
2200{
2201 hub: &'a FirebaseHosting<C>,
2202}
2203
2204impl<'a, C> common::MethodsBuilder for SiteMethods<'a, C> {}
2205
2206impl<'a, C> SiteMethods<'a, C> {
2207 /// Create a builder to help you perform the following task:
2208 ///
2209 /// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
2210 ///
2211 /// # Arguments
2212 ///
2213 /// * `request` - No description provided.
2214 /// * `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
2215 pub fn channels_releases_create(
2216 &self,
2217 request: Release,
2218 parent: &str,
2219 ) -> SiteChannelReleaseCreateCall<'a, C> {
2220 SiteChannelReleaseCreateCall {
2221 hub: self.hub,
2222 _request: request,
2223 _parent: parent.to_string(),
2224 _version_name: 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 /// 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.
2234 ///
2235 /// # Arguments
2236 ///
2237 /// * `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
2238 pub fn channels_releases_get(&self, name: &str) -> SiteChannelReleaseGetCall<'a, C> {
2239 SiteChannelReleaseGetCall {
2240 hub: self.hub,
2241 _name: name.to_string(),
2242 _delegate: Default::default(),
2243 _additional_params: Default::default(),
2244 _scopes: Default::default(),
2245 }
2246 }
2247
2248 /// Create a builder to help you perform the following task:
2249 ///
2250 /// 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.
2251 ///
2252 /// # Arguments
2253 ///
2254 /// * `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
2255 pub fn channels_releases_list(&self, parent: &str) -> SiteChannelReleaseListCall<'a, C> {
2256 SiteChannelReleaseListCall {
2257 hub: self.hub,
2258 _parent: parent.to_string(),
2259 _page_token: Default::default(),
2260 _page_size: Default::default(),
2261 _delegate: Default::default(),
2262 _additional_params: Default::default(),
2263 _scopes: Default::default(),
2264 }
2265 }
2266
2267 /// Create a builder to help you perform the following task:
2268 ///
2269 /// Creates a new channel in the specified site.
2270 ///
2271 /// # Arguments
2272 ///
2273 /// * `request` - No description provided.
2274 /// * `parent` - Required. The site in which to create this channel, in the format: sites/ SITE_ID
2275 pub fn channels_create(&self, request: Channel, parent: &str) -> SiteChannelCreateCall<'a, C> {
2276 SiteChannelCreateCall {
2277 hub: self.hub,
2278 _request: request,
2279 _parent: parent.to_string(),
2280 _channel_id: Default::default(),
2281 _delegate: Default::default(),
2282 _additional_params: Default::default(),
2283 _scopes: Default::default(),
2284 }
2285 }
2286
2287 /// Create a builder to help you perform the following task:
2288 ///
2289 /// Deletes the specified channel of the specified site. The `live` channel cannot be deleted.
2290 ///
2291 /// # Arguments
2292 ///
2293 /// * `name` - Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
2294 pub fn channels_delete(&self, name: &str) -> SiteChannelDeleteCall<'a, C> {
2295 SiteChannelDeleteCall {
2296 hub: self.hub,
2297 _name: name.to_string(),
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 /// Retrieves information for the specified channel of the specified site.
2307 ///
2308 /// # Arguments
2309 ///
2310 /// * `name` - Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
2311 pub fn channels_get(&self, name: &str) -> SiteChannelGetCall<'a, C> {
2312 SiteChannelGetCall {
2313 hub: self.hub,
2314 _name: name.to_string(),
2315 _delegate: Default::default(),
2316 _additional_params: Default::default(),
2317 _scopes: Default::default(),
2318 }
2319 }
2320
2321 /// Create a builder to help you perform the following task:
2322 ///
2323 /// Lists the channels for the specified site. All sites have a default `live` channel.
2324 ///
2325 /// # Arguments
2326 ///
2327 /// * `parent` - Required. The site for which to list channels, in the format: sites/SITE_ID
2328 pub fn channels_list(&self, parent: &str) -> SiteChannelListCall<'a, C> {
2329 SiteChannelListCall {
2330 hub: self.hub,
2331 _parent: parent.to_string(),
2332 _page_token: Default::default(),
2333 _page_size: Default::default(),
2334 _delegate: Default::default(),
2335 _additional_params: Default::default(),
2336 _scopes: Default::default(),
2337 }
2338 }
2339
2340 /// Create a builder to help you perform the following task:
2341 ///
2342 /// Updates information for the specified channel of the specified site. Implicitly creates the channel if it doesn't already exist.
2343 ///
2344 /// # Arguments
2345 ///
2346 /// * `request` - No description provided.
2347 /// * `name` - The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
2348 pub fn channels_patch(&self, request: Channel, name: &str) -> SiteChannelPatchCall<'a, C> {
2349 SiteChannelPatchCall {
2350 hub: self.hub,
2351 _request: request,
2352 _name: name.to_string(),
2353 _update_mask: Default::default(),
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 /// Creates a domain mapping on the specified site.
2363 ///
2364 /// # Arguments
2365 ///
2366 /// * `request` - No description provided.
2367 /// * `parent` - Required. The parent to create the domain association for, in the format: sites/site-name
2368 pub fn domains_create(&self, request: Domain, parent: &str) -> SiteDomainCreateCall<'a, C> {
2369 SiteDomainCreateCall {
2370 hub: self.hub,
2371 _request: request,
2372 _parent: parent.to_string(),
2373 _delegate: Default::default(),
2374 _additional_params: Default::default(),
2375 _scopes: Default::default(),
2376 }
2377 }
2378
2379 /// Create a builder to help you perform the following task:
2380 ///
2381 /// Deletes the existing domain mapping on the specified site.
2382 ///
2383 /// # Arguments
2384 ///
2385 /// * `name` - Required. The name of the domain association to delete.
2386 pub fn domains_delete(&self, name: &str) -> SiteDomainDeleteCall<'a, C> {
2387 SiteDomainDeleteCall {
2388 hub: self.hub,
2389 _name: name.to_string(),
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 /// Gets a domain mapping on the specified site.
2399 ///
2400 /// # Arguments
2401 ///
2402 /// * `name` - Required. The name of the domain configuration to get.
2403 pub fn domains_get(&self, name: &str) -> SiteDomainGetCall<'a, C> {
2404 SiteDomainGetCall {
2405 hub: self.hub,
2406 _name: name.to_string(),
2407 _delegate: Default::default(),
2408 _additional_params: Default::default(),
2409 _scopes: Default::default(),
2410 }
2411 }
2412
2413 /// Create a builder to help you perform the following task:
2414 ///
2415 /// Lists the domains for the specified site.
2416 ///
2417 /// # Arguments
2418 ///
2419 /// * `parent` - Required. The parent for which to list domains, in the format: sites/ site-name
2420 pub fn domains_list(&self, parent: &str) -> SiteDomainListCall<'a, C> {
2421 SiteDomainListCall {
2422 hub: self.hub,
2423 _parent: parent.to_string(),
2424 _page_token: Default::default(),
2425 _page_size: Default::default(),
2426 _delegate: Default::default(),
2427 _additional_params: Default::default(),
2428 _scopes: Default::default(),
2429 }
2430 }
2431
2432 /// Create a builder to help you perform the following task:
2433 ///
2434 /// Updates the specified domain mapping, creating the mapping as if it does not exist.
2435 ///
2436 /// # Arguments
2437 ///
2438 /// * `request` - No description provided.
2439 /// * `name` - Required. The name of the domain association to update or create, if an association doesn't already exist.
2440 pub fn domains_update(&self, request: Domain, name: &str) -> SiteDomainUpdateCall<'a, C> {
2441 SiteDomainUpdateCall {
2442 hub: self.hub,
2443 _request: request,
2444 _name: name.to_string(),
2445 _delegate: Default::default(),
2446 _additional_params: Default::default(),
2447 _scopes: Default::default(),
2448 }
2449 }
2450
2451 /// Create a builder to help you perform the following task:
2452 ///
2453 /// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
2454 ///
2455 /// # Arguments
2456 ///
2457 /// * `request` - No description provided.
2458 /// * `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
2459 pub fn releases_create(&self, request: Release, parent: &str) -> SiteReleaseCreateCall<'a, C> {
2460 SiteReleaseCreateCall {
2461 hub: self.hub,
2462 _request: request,
2463 _parent: parent.to_string(),
2464 _version_name: 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 /// 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.
2474 ///
2475 /// # Arguments
2476 ///
2477 /// * `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
2478 pub fn releases_get(&self, name: &str) -> SiteReleaseGetCall<'a, C> {
2479 SiteReleaseGetCall {
2480 hub: self.hub,
2481 _name: name.to_string(),
2482 _delegate: Default::default(),
2483 _additional_params: Default::default(),
2484 _scopes: Default::default(),
2485 }
2486 }
2487
2488 /// Create a builder to help you perform the following task:
2489 ///
2490 /// 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.
2491 ///
2492 /// # Arguments
2493 ///
2494 /// * `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
2495 pub fn releases_list(&self, parent: &str) -> SiteReleaseListCall<'a, C> {
2496 SiteReleaseListCall {
2497 hub: self.hub,
2498 _parent: parent.to_string(),
2499 _page_token: Default::default(),
2500 _page_size: Default::default(),
2501 _delegate: Default::default(),
2502 _additional_params: Default::default(),
2503 _scopes: Default::default(),
2504 }
2505 }
2506
2507 /// Create a builder to help you perform the following task:
2508 ///
2509 /// Lists the remaining files to be uploaded for the specified version.
2510 ///
2511 /// # Arguments
2512 ///
2513 /// * `parent` - Required. The version for which to list files, in the format: sites/SITE_ID /versions/VERSION_ID
2514 pub fn versions_files_list(&self, parent: &str) -> SiteVersionFileListCall<'a, C> {
2515 SiteVersionFileListCall {
2516 hub: self.hub,
2517 _parent: parent.to_string(),
2518 _status: Default::default(),
2519 _page_token: Default::default(),
2520 _page_size: Default::default(),
2521 _delegate: Default::default(),
2522 _additional_params: Default::default(),
2523 _scopes: Default::default(),
2524 }
2525 }
2526
2527 /// Create a builder to help you perform the following task:
2528 ///
2529 /// Creates a new version on the specified target site using the content of the specified version.
2530 ///
2531 /// # Arguments
2532 ///
2533 /// * `request` - No description provided.
2534 /// * `parent` - Required. The target site for the cloned version, in the format: sites/ SITE_ID
2535 pub fn versions_clone(
2536 &self,
2537 request: CloneVersionRequest,
2538 parent: &str,
2539 ) -> SiteVersionCloneCall<'a, C> {
2540 SiteVersionCloneCall {
2541 hub: self.hub,
2542 _request: request,
2543 _parent: parent.to_string(),
2544 _delegate: Default::default(),
2545 _additional_params: Default::default(),
2546 _scopes: Default::default(),
2547 }
2548 }
2549
2550 /// Create a builder to help you perform the following task:
2551 ///
2552 /// Creates a new version for the specified site.
2553 ///
2554 /// # Arguments
2555 ///
2556 /// * `request` - No description provided.
2557 /// * `parent` - Required. The site in which to create the version, in the format: sites/ SITE_ID
2558 pub fn versions_create(&self, request: Version, parent: &str) -> SiteVersionCreateCall<'a, C> {
2559 SiteVersionCreateCall {
2560 hub: self.hub,
2561 _request: request,
2562 _parent: parent.to_string(),
2563 _version_id: Default::default(),
2564 _size_bytes: Default::default(),
2565 _delegate: Default::default(),
2566 _additional_params: Default::default(),
2567 _scopes: Default::default(),
2568 }
2569 }
2570
2571 /// Create a builder to help you perform the following task:
2572 ///
2573 /// Deletes the specified version.
2574 ///
2575 /// # Arguments
2576 ///
2577 /// * `name` - Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
2578 pub fn versions_delete(&self, name: &str) -> SiteVersionDeleteCall<'a, C> {
2579 SiteVersionDeleteCall {
2580 hub: self.hub,
2581 _name: name.to_string(),
2582 _delegate: Default::default(),
2583 _additional_params: Default::default(),
2584 _scopes: Default::default(),
2585 }
2586 }
2587
2588 /// Create a builder to help you perform the following task:
2589 ///
2590 /// 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.
2591 ///
2592 /// # Arguments
2593 ///
2594 /// * `name` - Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
2595 pub fn versions_get(&self, name: &str) -> SiteVersionGetCall<'a, C> {
2596 SiteVersionGetCall {
2597 hub: self.hub,
2598 _name: name.to_string(),
2599 _delegate: Default::default(),
2600 _additional_params: Default::default(),
2601 _scopes: Default::default(),
2602 }
2603 }
2604
2605 /// Create a builder to help you perform the following task:
2606 ///
2607 /// 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.
2608 ///
2609 /// # Arguments
2610 ///
2611 /// * `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
2612 pub fn versions_list(&self, parent: &str) -> SiteVersionListCall<'a, C> {
2613 SiteVersionListCall {
2614 hub: self.hub,
2615 _parent: parent.to_string(),
2616 _page_token: Default::default(),
2617 _page_size: Default::default(),
2618 _filter: Default::default(),
2619 _delegate: Default::default(),
2620 _additional_params: Default::default(),
2621 _scopes: Default::default(),
2622 }
2623 }
2624
2625 /// Create a builder to help you perform the following task:
2626 ///
2627 /// 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`.
2628 ///
2629 /// # Arguments
2630 ///
2631 /// * `request` - No description provided.
2632 /// * `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).
2633 pub fn versions_patch(&self, request: Version, name: &str) -> SiteVersionPatchCall<'a, C> {
2634 SiteVersionPatchCall {
2635 hub: self.hub,
2636 _request: request,
2637 _name: name.to_string(),
2638 _update_mask: Default::default(),
2639 _delegate: Default::default(),
2640 _additional_params: Default::default(),
2641 _scopes: Default::default(),
2642 }
2643 }
2644
2645 /// Create a builder to help you perform the following task:
2646 ///
2647 /// Adds content files to the specified version. Each file must be under 2 GB.
2648 ///
2649 /// # Arguments
2650 ///
2651 /// * `request` - No description provided.
2652 /// * `parent` - Required. The version to which to add files, in the format: sites/SITE_ID /versions/VERSION_ID
2653 pub fn versions_populate_files(
2654 &self,
2655 request: PopulateVersionFilesRequest,
2656 parent: &str,
2657 ) -> SiteVersionPopulateFileCall<'a, C> {
2658 SiteVersionPopulateFileCall {
2659 hub: self.hub,
2660 _request: request,
2661 _parent: parent.to_string(),
2662 _delegate: Default::default(),
2663 _additional_params: Default::default(),
2664 _scopes: Default::default(),
2665 }
2666 }
2667
2668 /// Create a builder to help you perform the following task:
2669 ///
2670 /// Gets the Hosting metadata for a specific site.
2671 ///
2672 /// # Arguments
2673 ///
2674 /// * `name` - Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
2675 pub fn get_config(&self, name: &str) -> SiteGetConfigCall<'a, C> {
2676 SiteGetConfigCall {
2677 hub: self.hub,
2678 _name: name.to_string(),
2679 _delegate: Default::default(),
2680 _additional_params: Default::default(),
2681 _scopes: Default::default(),
2682 }
2683 }
2684
2685 /// Create a builder to help you perform the following task:
2686 ///
2687 /// Sets the Hosting metadata for a specific site.
2688 ///
2689 /// # Arguments
2690 ///
2691 /// * `request` - No description provided.
2692 /// * `name` - Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
2693 pub fn update_config(&self, request: SiteConfig, name: &str) -> SiteUpdateConfigCall<'a, C> {
2694 SiteUpdateConfigCall {
2695 hub: self.hub,
2696 _request: request,
2697 _name: name.to_string(),
2698 _update_mask: Default::default(),
2699 _delegate: Default::default(),
2700 _additional_params: Default::default(),
2701 _scopes: Default::default(),
2702 }
2703 }
2704}
2705
2706// ###################
2707// CallBuilders ###
2708// #################
2709
2710/// 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.
2711///
2712/// A builder for the *operations.get* method supported by a *project* resource.
2713/// It is not used directly, but through a [`ProjectMethods`] instance.
2714///
2715/// # Example
2716///
2717/// Instantiate a resource method builder
2718///
2719/// ```test_harness,no_run
2720/// # extern crate hyper;
2721/// # extern crate hyper_rustls;
2722/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
2723/// # async fn dox() {
2724/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2725///
2726/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2727/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2728/// # .with_native_roots()
2729/// # .unwrap()
2730/// # .https_only()
2731/// # .enable_http2()
2732/// # .build();
2733///
2734/// # let executor = hyper_util::rt::TokioExecutor::new();
2735/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2736/// # secret,
2737/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2738/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2739/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2740/// # ),
2741/// # ).build().await.unwrap();
2742///
2743/// # let client = hyper_util::client::legacy::Client::builder(
2744/// # hyper_util::rt::TokioExecutor::new()
2745/// # )
2746/// # .build(
2747/// # hyper_rustls::HttpsConnectorBuilder::new()
2748/// # .with_native_roots()
2749/// # .unwrap()
2750/// # .https_or_http()
2751/// # .enable_http2()
2752/// # .build()
2753/// # );
2754/// # let mut hub = FirebaseHosting::new(client, auth);
2755/// // You can configure optional parameters by calling the respective setters at will, and
2756/// // execute the final call using `doit()`.
2757/// // Values shown here are possibly random and not representative !
2758/// let result = hub.projects().operations_get("name")
2759/// .doit().await;
2760/// # }
2761/// ```
2762pub struct ProjectOperationGetCall<'a, C>
2763where
2764 C: 'a,
2765{
2766 hub: &'a FirebaseHosting<C>,
2767 _name: String,
2768 _delegate: Option<&'a mut dyn common::Delegate>,
2769 _additional_params: HashMap<String, String>,
2770 _scopes: BTreeSet<String>,
2771}
2772
2773impl<'a, C> common::CallBuilder for ProjectOperationGetCall<'a, C> {}
2774
2775impl<'a, C> ProjectOperationGetCall<'a, C>
2776where
2777 C: common::Connector,
2778{
2779 /// Perform the operation you have build so far.
2780 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2781 use std::borrow::Cow;
2782 use std::io::{Read, Seek};
2783
2784 use common::{url::Params, ToParts};
2785 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2786
2787 let mut dd = common::DefaultDelegate;
2788 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2789 dlg.begin(common::MethodInfo {
2790 id: "firebasehosting.projects.operations.get",
2791 http_method: hyper::Method::GET,
2792 });
2793
2794 for &field in ["alt", "name"].iter() {
2795 if self._additional_params.contains_key(field) {
2796 dlg.finished(false);
2797 return Err(common::Error::FieldClash(field));
2798 }
2799 }
2800
2801 let mut params = Params::with_capacity(3 + self._additional_params.len());
2802 params.push("name", self._name);
2803
2804 params.extend(self._additional_params.iter());
2805
2806 params.push("alt", "json");
2807 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2808 if self._scopes.is_empty() {
2809 self._scopes
2810 .insert(Scope::FirebaseReadonly.as_ref().to_string());
2811 }
2812
2813 #[allow(clippy::single_element_loop)]
2814 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2815 url = params.uri_replacement(url, param_name, find_this, true);
2816 }
2817 {
2818 let to_remove = ["name"];
2819 params.remove_params(&to_remove);
2820 }
2821
2822 let url = params.parse_with_url(&url);
2823
2824 loop {
2825 let token = match self
2826 .hub
2827 .auth
2828 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2829 .await
2830 {
2831 Ok(token) => token,
2832 Err(e) => match dlg.token(e) {
2833 Ok(token) => token,
2834 Err(e) => {
2835 dlg.finished(false);
2836 return Err(common::Error::MissingToken(e));
2837 }
2838 },
2839 };
2840 let mut req_result = {
2841 let client = &self.hub.client;
2842 dlg.pre_request();
2843 let mut req_builder = hyper::Request::builder()
2844 .method(hyper::Method::GET)
2845 .uri(url.as_str())
2846 .header(USER_AGENT, self.hub._user_agent.clone());
2847
2848 if let Some(token) = token.as_ref() {
2849 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2850 }
2851
2852 let request = req_builder
2853 .header(CONTENT_LENGTH, 0_u64)
2854 .body(common::to_body::<String>(None));
2855
2856 client.request(request.unwrap()).await
2857 };
2858
2859 match req_result {
2860 Err(err) => {
2861 if let common::Retry::After(d) = dlg.http_error(&err) {
2862 sleep(d).await;
2863 continue;
2864 }
2865 dlg.finished(false);
2866 return Err(common::Error::HttpError(err));
2867 }
2868 Ok(res) => {
2869 let (mut parts, body) = res.into_parts();
2870 let mut body = common::Body::new(body);
2871 if !parts.status.is_success() {
2872 let bytes = common::to_bytes(body).await.unwrap_or_default();
2873 let error = serde_json::from_str(&common::to_string(&bytes));
2874 let response = common::to_response(parts, bytes.into());
2875
2876 if let common::Retry::After(d) =
2877 dlg.http_failure(&response, error.as_ref().ok())
2878 {
2879 sleep(d).await;
2880 continue;
2881 }
2882
2883 dlg.finished(false);
2884
2885 return Err(match error {
2886 Ok(value) => common::Error::BadRequest(value),
2887 _ => common::Error::Failure(response),
2888 });
2889 }
2890 let response = {
2891 let bytes = common::to_bytes(body).await.unwrap_or_default();
2892 let encoded = common::to_string(&bytes);
2893 match serde_json::from_str(&encoded) {
2894 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2895 Err(error) => {
2896 dlg.response_json_decode_error(&encoded, &error);
2897 return Err(common::Error::JsonDecodeError(
2898 encoded.to_string(),
2899 error,
2900 ));
2901 }
2902 }
2903 };
2904
2905 dlg.finished(true);
2906 return Ok(response);
2907 }
2908 }
2909 }
2910 }
2911
2912 /// The name of the operation resource.
2913 ///
2914 /// Sets the *name* path property to the given value.
2915 ///
2916 /// Even though the property as already been set when instantiating this call,
2917 /// we provide this method for API completeness.
2918 pub fn name(mut self, new_value: &str) -> ProjectOperationGetCall<'a, C> {
2919 self._name = new_value.to_string();
2920 self
2921 }
2922 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2923 /// while executing the actual API request.
2924 ///
2925 /// ````text
2926 /// It should be used to handle progress information, and to implement a certain level of resilience.
2927 /// ````
2928 ///
2929 /// Sets the *delegate* property to the given value.
2930 pub fn delegate(
2931 mut self,
2932 new_value: &'a mut dyn common::Delegate,
2933 ) -> ProjectOperationGetCall<'a, C> {
2934 self._delegate = Some(new_value);
2935 self
2936 }
2937
2938 /// Set any additional parameter of the query string used in the request.
2939 /// It should be used to set parameters which are not yet available through their own
2940 /// setters.
2941 ///
2942 /// Please note that this method must not be used to set any of the known parameters
2943 /// which have their own setter method. If done anyway, the request will fail.
2944 ///
2945 /// # Additional Parameters
2946 ///
2947 /// * *$.xgafv* (query-string) - V1 error format.
2948 /// * *access_token* (query-string) - OAuth access token.
2949 /// * *alt* (query-string) - Data format for response.
2950 /// * *callback* (query-string) - JSONP
2951 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2952 /// * *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.
2953 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2954 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2955 /// * *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.
2956 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2957 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2958 pub fn param<T>(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C>
2959 where
2960 T: AsRef<str>,
2961 {
2962 self._additional_params
2963 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2964 self
2965 }
2966
2967 /// Identifies the authorization scope for the method you are building.
2968 ///
2969 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2970 /// [`Scope::FirebaseReadonly`].
2971 ///
2972 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2973 /// tokens for more than one scope.
2974 ///
2975 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2976 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2977 /// sufficient, a read-write scope will do as well.
2978 pub fn add_scope<St>(mut self, scope: St) -> ProjectOperationGetCall<'a, C>
2979 where
2980 St: AsRef<str>,
2981 {
2982 self._scopes.insert(String::from(scope.as_ref()));
2983 self
2984 }
2985 /// Identifies the authorization scope(s) for the method you are building.
2986 ///
2987 /// See [`Self::add_scope()`] for details.
2988 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOperationGetCall<'a, C>
2989 where
2990 I: IntoIterator<Item = St>,
2991 St: AsRef<str>,
2992 {
2993 self._scopes
2994 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2995 self
2996 }
2997
2998 /// Removes all scopes, and no default scope will be used either.
2999 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3000 /// for details).
3001 pub fn clear_scopes(mut self) -> ProjectOperationGetCall<'a, C> {
3002 self._scopes.clear();
3003 self
3004 }
3005}
3006
3007/// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
3008///
3009/// A builder for the *sites.channels.releases.create* method supported by a *project* resource.
3010/// It is not used directly, but through a [`ProjectMethods`] instance.
3011///
3012/// # Example
3013///
3014/// Instantiate a resource method builder
3015///
3016/// ```test_harness,no_run
3017/// # extern crate hyper;
3018/// # extern crate hyper_rustls;
3019/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
3020/// use firebasehosting1_beta1::api::Release;
3021/// # async fn dox() {
3022/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3023///
3024/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3025/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3026/// # .with_native_roots()
3027/// # .unwrap()
3028/// # .https_only()
3029/// # .enable_http2()
3030/// # .build();
3031///
3032/// # let executor = hyper_util::rt::TokioExecutor::new();
3033/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3034/// # secret,
3035/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3036/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3037/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3038/// # ),
3039/// # ).build().await.unwrap();
3040///
3041/// # let client = hyper_util::client::legacy::Client::builder(
3042/// # hyper_util::rt::TokioExecutor::new()
3043/// # )
3044/// # .build(
3045/// # hyper_rustls::HttpsConnectorBuilder::new()
3046/// # .with_native_roots()
3047/// # .unwrap()
3048/// # .https_or_http()
3049/// # .enable_http2()
3050/// # .build()
3051/// # );
3052/// # let mut hub = FirebaseHosting::new(client, auth);
3053/// // As the method needs a request, you would usually fill it with the desired information
3054/// // into the respective structure. Some of the parts shown here might not be applicable !
3055/// // Values shown here are possibly random and not representative !
3056/// let mut req = Release::default();
3057///
3058/// // You can configure optional parameters by calling the respective setters at will, and
3059/// // execute the final call using `doit()`.
3060/// // Values shown here are possibly random and not representative !
3061/// let result = hub.projects().sites_channels_releases_create(req, "parent")
3062/// .version_name("Lorem")
3063/// .doit().await;
3064/// # }
3065/// ```
3066pub struct ProjectSiteChannelReleaseCreateCall<'a, C>
3067where
3068 C: 'a,
3069{
3070 hub: &'a FirebaseHosting<C>,
3071 _request: Release,
3072 _parent: String,
3073 _version_name: Option<String>,
3074 _delegate: Option<&'a mut dyn common::Delegate>,
3075 _additional_params: HashMap<String, String>,
3076 _scopes: BTreeSet<String>,
3077}
3078
3079impl<'a, C> common::CallBuilder for ProjectSiteChannelReleaseCreateCall<'a, C> {}
3080
3081impl<'a, C> ProjectSiteChannelReleaseCreateCall<'a, C>
3082where
3083 C: common::Connector,
3084{
3085 /// Perform the operation you have build so far.
3086 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
3087 use std::borrow::Cow;
3088 use std::io::{Read, Seek};
3089
3090 use common::{url::Params, ToParts};
3091 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3092
3093 let mut dd = common::DefaultDelegate;
3094 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3095 dlg.begin(common::MethodInfo {
3096 id: "firebasehosting.projects.sites.channels.releases.create",
3097 http_method: hyper::Method::POST,
3098 });
3099
3100 for &field in ["alt", "parent", "versionName"].iter() {
3101 if self._additional_params.contains_key(field) {
3102 dlg.finished(false);
3103 return Err(common::Error::FieldClash(field));
3104 }
3105 }
3106
3107 let mut params = Params::with_capacity(5 + self._additional_params.len());
3108 params.push("parent", self._parent);
3109 if let Some(value) = self._version_name.as_ref() {
3110 params.push("versionName", value);
3111 }
3112
3113 params.extend(self._additional_params.iter());
3114
3115 params.push("alt", "json");
3116 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
3117 if self._scopes.is_empty() {
3118 self._scopes
3119 .insert(Scope::CloudPlatform.as_ref().to_string());
3120 }
3121
3122 #[allow(clippy::single_element_loop)]
3123 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3124 url = params.uri_replacement(url, param_name, find_this, true);
3125 }
3126 {
3127 let to_remove = ["parent"];
3128 params.remove_params(&to_remove);
3129 }
3130
3131 let url = params.parse_with_url(&url);
3132
3133 let mut json_mime_type = mime::APPLICATION_JSON;
3134 let mut request_value_reader = {
3135 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3136 common::remove_json_null_values(&mut value);
3137 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3138 serde_json::to_writer(&mut dst, &value).unwrap();
3139 dst
3140 };
3141 let request_size = request_value_reader
3142 .seek(std::io::SeekFrom::End(0))
3143 .unwrap();
3144 request_value_reader
3145 .seek(std::io::SeekFrom::Start(0))
3146 .unwrap();
3147
3148 loop {
3149 let token = match self
3150 .hub
3151 .auth
3152 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3153 .await
3154 {
3155 Ok(token) => token,
3156 Err(e) => match dlg.token(e) {
3157 Ok(token) => token,
3158 Err(e) => {
3159 dlg.finished(false);
3160 return Err(common::Error::MissingToken(e));
3161 }
3162 },
3163 };
3164 request_value_reader
3165 .seek(std::io::SeekFrom::Start(0))
3166 .unwrap();
3167 let mut req_result = {
3168 let client = &self.hub.client;
3169 dlg.pre_request();
3170 let mut req_builder = hyper::Request::builder()
3171 .method(hyper::Method::POST)
3172 .uri(url.as_str())
3173 .header(USER_AGENT, self.hub._user_agent.clone());
3174
3175 if let Some(token) = token.as_ref() {
3176 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3177 }
3178
3179 let request = req_builder
3180 .header(CONTENT_TYPE, json_mime_type.to_string())
3181 .header(CONTENT_LENGTH, request_size as u64)
3182 .body(common::to_body(
3183 request_value_reader.get_ref().clone().into(),
3184 ));
3185
3186 client.request(request.unwrap()).await
3187 };
3188
3189 match req_result {
3190 Err(err) => {
3191 if let common::Retry::After(d) = dlg.http_error(&err) {
3192 sleep(d).await;
3193 continue;
3194 }
3195 dlg.finished(false);
3196 return Err(common::Error::HttpError(err));
3197 }
3198 Ok(res) => {
3199 let (mut parts, body) = res.into_parts();
3200 let mut body = common::Body::new(body);
3201 if !parts.status.is_success() {
3202 let bytes = common::to_bytes(body).await.unwrap_or_default();
3203 let error = serde_json::from_str(&common::to_string(&bytes));
3204 let response = common::to_response(parts, bytes.into());
3205
3206 if let common::Retry::After(d) =
3207 dlg.http_failure(&response, error.as_ref().ok())
3208 {
3209 sleep(d).await;
3210 continue;
3211 }
3212
3213 dlg.finished(false);
3214
3215 return Err(match error {
3216 Ok(value) => common::Error::BadRequest(value),
3217 _ => common::Error::Failure(response),
3218 });
3219 }
3220 let response = {
3221 let bytes = common::to_bytes(body).await.unwrap_or_default();
3222 let encoded = common::to_string(&bytes);
3223 match serde_json::from_str(&encoded) {
3224 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3225 Err(error) => {
3226 dlg.response_json_decode_error(&encoded, &error);
3227 return Err(common::Error::JsonDecodeError(
3228 encoded.to_string(),
3229 error,
3230 ));
3231 }
3232 }
3233 };
3234
3235 dlg.finished(true);
3236 return Ok(response);
3237 }
3238 }
3239 }
3240 }
3241
3242 ///
3243 /// Sets the *request* property to the given value.
3244 ///
3245 /// Even though the property as already been set when instantiating this call,
3246 /// we provide this method for API completeness.
3247 pub fn request(mut self, new_value: Release) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3248 self._request = new_value;
3249 self
3250 }
3251 /// 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
3252 ///
3253 /// Sets the *parent* path property to the given value.
3254 ///
3255 /// Even though the property as already been set when instantiating this call,
3256 /// we provide this method for API completeness.
3257 pub fn parent(mut self, new_value: &str) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3258 self._parent = new_value.to_string();
3259 self
3260 }
3261 /// 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`.
3262 ///
3263 /// Sets the *version name* query property to the given value.
3264 pub fn version_name(mut self, new_value: &str) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3265 self._version_name = Some(new_value.to_string());
3266 self
3267 }
3268 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3269 /// while executing the actual API request.
3270 ///
3271 /// ````text
3272 /// It should be used to handle progress information, and to implement a certain level of resilience.
3273 /// ````
3274 ///
3275 /// Sets the *delegate* property to the given value.
3276 pub fn delegate(
3277 mut self,
3278 new_value: &'a mut dyn common::Delegate,
3279 ) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3280 self._delegate = Some(new_value);
3281 self
3282 }
3283
3284 /// Set any additional parameter of the query string used in the request.
3285 /// It should be used to set parameters which are not yet available through their own
3286 /// setters.
3287 ///
3288 /// Please note that this method must not be used to set any of the known parameters
3289 /// which have their own setter method. If done anyway, the request will fail.
3290 ///
3291 /// # Additional Parameters
3292 ///
3293 /// * *$.xgafv* (query-string) - V1 error format.
3294 /// * *access_token* (query-string) - OAuth access token.
3295 /// * *alt* (query-string) - Data format for response.
3296 /// * *callback* (query-string) - JSONP
3297 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3298 /// * *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.
3299 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3300 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3301 /// * *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.
3302 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3303 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3304 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelReleaseCreateCall<'a, C>
3305 where
3306 T: AsRef<str>,
3307 {
3308 self._additional_params
3309 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3310 self
3311 }
3312
3313 /// Identifies the authorization scope for the method you are building.
3314 ///
3315 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3316 /// [`Scope::CloudPlatform`].
3317 ///
3318 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3319 /// tokens for more than one scope.
3320 ///
3321 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3322 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3323 /// sufficient, a read-write scope will do as well.
3324 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelReleaseCreateCall<'a, C>
3325 where
3326 St: AsRef<str>,
3327 {
3328 self._scopes.insert(String::from(scope.as_ref()));
3329 self
3330 }
3331 /// Identifies the authorization scope(s) for the method you are building.
3332 ///
3333 /// See [`Self::add_scope()`] for details.
3334 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelReleaseCreateCall<'a, C>
3335 where
3336 I: IntoIterator<Item = St>,
3337 St: AsRef<str>,
3338 {
3339 self._scopes
3340 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3341 self
3342 }
3343
3344 /// Removes all scopes, and no default scope will be used either.
3345 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3346 /// for details).
3347 pub fn clear_scopes(mut self) -> ProjectSiteChannelReleaseCreateCall<'a, C> {
3348 self._scopes.clear();
3349 self
3350 }
3351}
3352
3353/// 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.
3354///
3355/// A builder for the *sites.channels.releases.get* method supported by a *project* resource.
3356/// It is not used directly, but through a [`ProjectMethods`] instance.
3357///
3358/// # Example
3359///
3360/// Instantiate a resource method builder
3361///
3362/// ```test_harness,no_run
3363/// # extern crate hyper;
3364/// # extern crate hyper_rustls;
3365/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
3366/// # async fn dox() {
3367/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3368///
3369/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3370/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3371/// # .with_native_roots()
3372/// # .unwrap()
3373/// # .https_only()
3374/// # .enable_http2()
3375/// # .build();
3376///
3377/// # let executor = hyper_util::rt::TokioExecutor::new();
3378/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3379/// # secret,
3380/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3381/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3382/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3383/// # ),
3384/// # ).build().await.unwrap();
3385///
3386/// # let client = hyper_util::client::legacy::Client::builder(
3387/// # hyper_util::rt::TokioExecutor::new()
3388/// # )
3389/// # .build(
3390/// # hyper_rustls::HttpsConnectorBuilder::new()
3391/// # .with_native_roots()
3392/// # .unwrap()
3393/// # .https_or_http()
3394/// # .enable_http2()
3395/// # .build()
3396/// # );
3397/// # let mut hub = FirebaseHosting::new(client, auth);
3398/// // You can configure optional parameters by calling the respective setters at will, and
3399/// // execute the final call using `doit()`.
3400/// // Values shown here are possibly random and not representative !
3401/// let result = hub.projects().sites_channels_releases_get("name")
3402/// .doit().await;
3403/// # }
3404/// ```
3405pub struct ProjectSiteChannelReleaseGetCall<'a, C>
3406where
3407 C: 'a,
3408{
3409 hub: &'a FirebaseHosting<C>,
3410 _name: String,
3411 _delegate: Option<&'a mut dyn common::Delegate>,
3412 _additional_params: HashMap<String, String>,
3413 _scopes: BTreeSet<String>,
3414}
3415
3416impl<'a, C> common::CallBuilder for ProjectSiteChannelReleaseGetCall<'a, C> {}
3417
3418impl<'a, C> ProjectSiteChannelReleaseGetCall<'a, C>
3419where
3420 C: common::Connector,
3421{
3422 /// Perform the operation you have build so far.
3423 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
3424 use std::borrow::Cow;
3425 use std::io::{Read, Seek};
3426
3427 use common::{url::Params, ToParts};
3428 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3429
3430 let mut dd = common::DefaultDelegate;
3431 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3432 dlg.begin(common::MethodInfo {
3433 id: "firebasehosting.projects.sites.channels.releases.get",
3434 http_method: hyper::Method::GET,
3435 });
3436
3437 for &field in ["alt", "name"].iter() {
3438 if self._additional_params.contains_key(field) {
3439 dlg.finished(false);
3440 return Err(common::Error::FieldClash(field));
3441 }
3442 }
3443
3444 let mut params = Params::with_capacity(3 + self._additional_params.len());
3445 params.push("name", self._name);
3446
3447 params.extend(self._additional_params.iter());
3448
3449 params.push("alt", "json");
3450 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3451 if self._scopes.is_empty() {
3452 self._scopes
3453 .insert(Scope::FirebaseReadonly.as_ref().to_string());
3454 }
3455
3456 #[allow(clippy::single_element_loop)]
3457 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3458 url = params.uri_replacement(url, param_name, find_this, true);
3459 }
3460 {
3461 let to_remove = ["name"];
3462 params.remove_params(&to_remove);
3463 }
3464
3465 let url = params.parse_with_url(&url);
3466
3467 loop {
3468 let token = match self
3469 .hub
3470 .auth
3471 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3472 .await
3473 {
3474 Ok(token) => token,
3475 Err(e) => match dlg.token(e) {
3476 Ok(token) => token,
3477 Err(e) => {
3478 dlg.finished(false);
3479 return Err(common::Error::MissingToken(e));
3480 }
3481 },
3482 };
3483 let mut req_result = {
3484 let client = &self.hub.client;
3485 dlg.pre_request();
3486 let mut req_builder = hyper::Request::builder()
3487 .method(hyper::Method::GET)
3488 .uri(url.as_str())
3489 .header(USER_AGENT, self.hub._user_agent.clone());
3490
3491 if let Some(token) = token.as_ref() {
3492 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3493 }
3494
3495 let request = req_builder
3496 .header(CONTENT_LENGTH, 0_u64)
3497 .body(common::to_body::<String>(None));
3498
3499 client.request(request.unwrap()).await
3500 };
3501
3502 match req_result {
3503 Err(err) => {
3504 if let common::Retry::After(d) = dlg.http_error(&err) {
3505 sleep(d).await;
3506 continue;
3507 }
3508 dlg.finished(false);
3509 return Err(common::Error::HttpError(err));
3510 }
3511 Ok(res) => {
3512 let (mut parts, body) = res.into_parts();
3513 let mut body = common::Body::new(body);
3514 if !parts.status.is_success() {
3515 let bytes = common::to_bytes(body).await.unwrap_or_default();
3516 let error = serde_json::from_str(&common::to_string(&bytes));
3517 let response = common::to_response(parts, bytes.into());
3518
3519 if let common::Retry::After(d) =
3520 dlg.http_failure(&response, error.as_ref().ok())
3521 {
3522 sleep(d).await;
3523 continue;
3524 }
3525
3526 dlg.finished(false);
3527
3528 return Err(match error {
3529 Ok(value) => common::Error::BadRequest(value),
3530 _ => common::Error::Failure(response),
3531 });
3532 }
3533 let response = {
3534 let bytes = common::to_bytes(body).await.unwrap_or_default();
3535 let encoded = common::to_string(&bytes);
3536 match serde_json::from_str(&encoded) {
3537 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3538 Err(error) => {
3539 dlg.response_json_decode_error(&encoded, &error);
3540 return Err(common::Error::JsonDecodeError(
3541 encoded.to_string(),
3542 error,
3543 ));
3544 }
3545 }
3546 };
3547
3548 dlg.finished(true);
3549 return Ok(response);
3550 }
3551 }
3552 }
3553 }
3554
3555 /// 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
3556 ///
3557 /// Sets the *name* path property to the given value.
3558 ///
3559 /// Even though the property as already been set when instantiating this call,
3560 /// we provide this method for API completeness.
3561 pub fn name(mut self, new_value: &str) -> ProjectSiteChannelReleaseGetCall<'a, C> {
3562 self._name = new_value.to_string();
3563 self
3564 }
3565 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3566 /// while executing the actual API request.
3567 ///
3568 /// ````text
3569 /// It should be used to handle progress information, and to implement a certain level of resilience.
3570 /// ````
3571 ///
3572 /// Sets the *delegate* property to the given value.
3573 pub fn delegate(
3574 mut self,
3575 new_value: &'a mut dyn common::Delegate,
3576 ) -> ProjectSiteChannelReleaseGetCall<'a, C> {
3577 self._delegate = Some(new_value);
3578 self
3579 }
3580
3581 /// Set any additional parameter of the query string used in the request.
3582 /// It should be used to set parameters which are not yet available through their own
3583 /// setters.
3584 ///
3585 /// Please note that this method must not be used to set any of the known parameters
3586 /// which have their own setter method. If done anyway, the request will fail.
3587 ///
3588 /// # Additional Parameters
3589 ///
3590 /// * *$.xgafv* (query-string) - V1 error format.
3591 /// * *access_token* (query-string) - OAuth access token.
3592 /// * *alt* (query-string) - Data format for response.
3593 /// * *callback* (query-string) - JSONP
3594 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3595 /// * *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.
3596 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3597 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3598 /// * *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.
3599 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3600 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3601 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelReleaseGetCall<'a, C>
3602 where
3603 T: AsRef<str>,
3604 {
3605 self._additional_params
3606 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3607 self
3608 }
3609
3610 /// Identifies the authorization scope for the method you are building.
3611 ///
3612 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3613 /// [`Scope::FirebaseReadonly`].
3614 ///
3615 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3616 /// tokens for more than one scope.
3617 ///
3618 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3619 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3620 /// sufficient, a read-write scope will do as well.
3621 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelReleaseGetCall<'a, C>
3622 where
3623 St: AsRef<str>,
3624 {
3625 self._scopes.insert(String::from(scope.as_ref()));
3626 self
3627 }
3628 /// Identifies the authorization scope(s) for the method you are building.
3629 ///
3630 /// See [`Self::add_scope()`] for details.
3631 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelReleaseGetCall<'a, C>
3632 where
3633 I: IntoIterator<Item = St>,
3634 St: AsRef<str>,
3635 {
3636 self._scopes
3637 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3638 self
3639 }
3640
3641 /// Removes all scopes, and no default scope will be used either.
3642 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3643 /// for details).
3644 pub fn clear_scopes(mut self) -> ProjectSiteChannelReleaseGetCall<'a, C> {
3645 self._scopes.clear();
3646 self
3647 }
3648}
3649
3650/// 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.
3651///
3652/// A builder for the *sites.channels.releases.list* method supported by a *project* resource.
3653/// It is not used directly, but through a [`ProjectMethods`] instance.
3654///
3655/// # Example
3656///
3657/// Instantiate a resource method builder
3658///
3659/// ```test_harness,no_run
3660/// # extern crate hyper;
3661/// # extern crate hyper_rustls;
3662/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
3663/// # async fn dox() {
3664/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3665///
3666/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3667/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3668/// # .with_native_roots()
3669/// # .unwrap()
3670/// # .https_only()
3671/// # .enable_http2()
3672/// # .build();
3673///
3674/// # let executor = hyper_util::rt::TokioExecutor::new();
3675/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3676/// # secret,
3677/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3678/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3679/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3680/// # ),
3681/// # ).build().await.unwrap();
3682///
3683/// # let client = hyper_util::client::legacy::Client::builder(
3684/// # hyper_util::rt::TokioExecutor::new()
3685/// # )
3686/// # .build(
3687/// # hyper_rustls::HttpsConnectorBuilder::new()
3688/// # .with_native_roots()
3689/// # .unwrap()
3690/// # .https_or_http()
3691/// # .enable_http2()
3692/// # .build()
3693/// # );
3694/// # let mut hub = FirebaseHosting::new(client, auth);
3695/// // You can configure optional parameters by calling the respective setters at will, and
3696/// // execute the final call using `doit()`.
3697/// // Values shown here are possibly random and not representative !
3698/// let result = hub.projects().sites_channels_releases_list("parent")
3699/// .page_token("dolor")
3700/// .page_size(-17)
3701/// .doit().await;
3702/// # }
3703/// ```
3704pub struct ProjectSiteChannelReleaseListCall<'a, C>
3705where
3706 C: 'a,
3707{
3708 hub: &'a FirebaseHosting<C>,
3709 _parent: String,
3710 _page_token: Option<String>,
3711 _page_size: Option<i32>,
3712 _delegate: Option<&'a mut dyn common::Delegate>,
3713 _additional_params: HashMap<String, String>,
3714 _scopes: BTreeSet<String>,
3715}
3716
3717impl<'a, C> common::CallBuilder for ProjectSiteChannelReleaseListCall<'a, C> {}
3718
3719impl<'a, C> ProjectSiteChannelReleaseListCall<'a, C>
3720where
3721 C: common::Connector,
3722{
3723 /// Perform the operation you have build so far.
3724 pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
3725 use std::borrow::Cow;
3726 use std::io::{Read, Seek};
3727
3728 use common::{url::Params, ToParts};
3729 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3730
3731 let mut dd = common::DefaultDelegate;
3732 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3733 dlg.begin(common::MethodInfo {
3734 id: "firebasehosting.projects.sites.channels.releases.list",
3735 http_method: hyper::Method::GET,
3736 });
3737
3738 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3739 if self._additional_params.contains_key(field) {
3740 dlg.finished(false);
3741 return Err(common::Error::FieldClash(field));
3742 }
3743 }
3744
3745 let mut params = Params::with_capacity(5 + self._additional_params.len());
3746 params.push("parent", self._parent);
3747 if let Some(value) = self._page_token.as_ref() {
3748 params.push("pageToken", value);
3749 }
3750 if let Some(value) = self._page_size.as_ref() {
3751 params.push("pageSize", value.to_string());
3752 }
3753
3754 params.extend(self._additional_params.iter());
3755
3756 params.push("alt", "json");
3757 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
3758 if self._scopes.is_empty() {
3759 self._scopes
3760 .insert(Scope::FirebaseReadonly.as_ref().to_string());
3761 }
3762
3763 #[allow(clippy::single_element_loop)]
3764 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3765 url = params.uri_replacement(url, param_name, find_this, true);
3766 }
3767 {
3768 let to_remove = ["parent"];
3769 params.remove_params(&to_remove);
3770 }
3771
3772 let url = params.parse_with_url(&url);
3773
3774 loop {
3775 let token = match self
3776 .hub
3777 .auth
3778 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3779 .await
3780 {
3781 Ok(token) => token,
3782 Err(e) => match dlg.token(e) {
3783 Ok(token) => token,
3784 Err(e) => {
3785 dlg.finished(false);
3786 return Err(common::Error::MissingToken(e));
3787 }
3788 },
3789 };
3790 let mut req_result = {
3791 let client = &self.hub.client;
3792 dlg.pre_request();
3793 let mut req_builder = hyper::Request::builder()
3794 .method(hyper::Method::GET)
3795 .uri(url.as_str())
3796 .header(USER_AGENT, self.hub._user_agent.clone());
3797
3798 if let Some(token) = token.as_ref() {
3799 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3800 }
3801
3802 let request = req_builder
3803 .header(CONTENT_LENGTH, 0_u64)
3804 .body(common::to_body::<String>(None));
3805
3806 client.request(request.unwrap()).await
3807 };
3808
3809 match req_result {
3810 Err(err) => {
3811 if let common::Retry::After(d) = dlg.http_error(&err) {
3812 sleep(d).await;
3813 continue;
3814 }
3815 dlg.finished(false);
3816 return Err(common::Error::HttpError(err));
3817 }
3818 Ok(res) => {
3819 let (mut parts, body) = res.into_parts();
3820 let mut body = common::Body::new(body);
3821 if !parts.status.is_success() {
3822 let bytes = common::to_bytes(body).await.unwrap_or_default();
3823 let error = serde_json::from_str(&common::to_string(&bytes));
3824 let response = common::to_response(parts, bytes.into());
3825
3826 if let common::Retry::After(d) =
3827 dlg.http_failure(&response, error.as_ref().ok())
3828 {
3829 sleep(d).await;
3830 continue;
3831 }
3832
3833 dlg.finished(false);
3834
3835 return Err(match error {
3836 Ok(value) => common::Error::BadRequest(value),
3837 _ => common::Error::Failure(response),
3838 });
3839 }
3840 let response = {
3841 let bytes = common::to_bytes(body).await.unwrap_or_default();
3842 let encoded = common::to_string(&bytes);
3843 match serde_json::from_str(&encoded) {
3844 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3845 Err(error) => {
3846 dlg.response_json_decode_error(&encoded, &error);
3847 return Err(common::Error::JsonDecodeError(
3848 encoded.to_string(),
3849 error,
3850 ));
3851 }
3852 }
3853 };
3854
3855 dlg.finished(true);
3856 return Ok(response);
3857 }
3858 }
3859 }
3860 }
3861
3862 /// 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
3863 ///
3864 /// Sets the *parent* path property to the given value.
3865 ///
3866 /// Even though the property as already been set when instantiating this call,
3867 /// we provide this method for API completeness.
3868 pub fn parent(mut self, new_value: &str) -> ProjectSiteChannelReleaseListCall<'a, C> {
3869 self._parent = new_value.to_string();
3870 self
3871 }
3872 /// A token from a previous call to `releases.list` or `channels.releases.list` that tells the server where to resume listing.
3873 ///
3874 /// Sets the *page token* query property to the given value.
3875 pub fn page_token(mut self, new_value: &str) -> ProjectSiteChannelReleaseListCall<'a, C> {
3876 self._page_token = Some(new_value.to_string());
3877 self
3878 }
3879 /// 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.
3880 ///
3881 /// Sets the *page size* query property to the given value.
3882 pub fn page_size(mut self, new_value: i32) -> ProjectSiteChannelReleaseListCall<'a, C> {
3883 self._page_size = Some(new_value);
3884 self
3885 }
3886 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3887 /// while executing the actual API request.
3888 ///
3889 /// ````text
3890 /// It should be used to handle progress information, and to implement a certain level of resilience.
3891 /// ````
3892 ///
3893 /// Sets the *delegate* property to the given value.
3894 pub fn delegate(
3895 mut self,
3896 new_value: &'a mut dyn common::Delegate,
3897 ) -> ProjectSiteChannelReleaseListCall<'a, C> {
3898 self._delegate = Some(new_value);
3899 self
3900 }
3901
3902 /// Set any additional parameter of the query string used in the request.
3903 /// It should be used to set parameters which are not yet available through their own
3904 /// setters.
3905 ///
3906 /// Please note that this method must not be used to set any of the known parameters
3907 /// which have their own setter method. If done anyway, the request will fail.
3908 ///
3909 /// # Additional Parameters
3910 ///
3911 /// * *$.xgafv* (query-string) - V1 error format.
3912 /// * *access_token* (query-string) - OAuth access token.
3913 /// * *alt* (query-string) - Data format for response.
3914 /// * *callback* (query-string) - JSONP
3915 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3916 /// * *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.
3917 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3918 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3919 /// * *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.
3920 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3921 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3922 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelReleaseListCall<'a, C>
3923 where
3924 T: AsRef<str>,
3925 {
3926 self._additional_params
3927 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3928 self
3929 }
3930
3931 /// Identifies the authorization scope for the method you are building.
3932 ///
3933 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3934 /// [`Scope::FirebaseReadonly`].
3935 ///
3936 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3937 /// tokens for more than one scope.
3938 ///
3939 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3940 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3941 /// sufficient, a read-write scope will do as well.
3942 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelReleaseListCall<'a, C>
3943 where
3944 St: AsRef<str>,
3945 {
3946 self._scopes.insert(String::from(scope.as_ref()));
3947 self
3948 }
3949 /// Identifies the authorization scope(s) for the method you are building.
3950 ///
3951 /// See [`Self::add_scope()`] for details.
3952 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelReleaseListCall<'a, C>
3953 where
3954 I: IntoIterator<Item = St>,
3955 St: AsRef<str>,
3956 {
3957 self._scopes
3958 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3959 self
3960 }
3961
3962 /// Removes all scopes, and no default scope will be used either.
3963 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3964 /// for details).
3965 pub fn clear_scopes(mut self) -> ProjectSiteChannelReleaseListCall<'a, C> {
3966 self._scopes.clear();
3967 self
3968 }
3969}
3970
3971/// Creates a new channel in the specified site.
3972///
3973/// A builder for the *sites.channels.create* method supported by a *project* resource.
3974/// It is not used directly, but through a [`ProjectMethods`] instance.
3975///
3976/// # Example
3977///
3978/// Instantiate a resource method builder
3979///
3980/// ```test_harness,no_run
3981/// # extern crate hyper;
3982/// # extern crate hyper_rustls;
3983/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
3984/// use firebasehosting1_beta1::api::Channel;
3985/// # async fn dox() {
3986/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3987///
3988/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3989/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3990/// # .with_native_roots()
3991/// # .unwrap()
3992/// # .https_only()
3993/// # .enable_http2()
3994/// # .build();
3995///
3996/// # let executor = hyper_util::rt::TokioExecutor::new();
3997/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3998/// # secret,
3999/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4000/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4001/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4002/// # ),
4003/// # ).build().await.unwrap();
4004///
4005/// # let client = hyper_util::client::legacy::Client::builder(
4006/// # hyper_util::rt::TokioExecutor::new()
4007/// # )
4008/// # .build(
4009/// # hyper_rustls::HttpsConnectorBuilder::new()
4010/// # .with_native_roots()
4011/// # .unwrap()
4012/// # .https_or_http()
4013/// # .enable_http2()
4014/// # .build()
4015/// # );
4016/// # let mut hub = FirebaseHosting::new(client, auth);
4017/// // As the method needs a request, you would usually fill it with the desired information
4018/// // into the respective structure. Some of the parts shown here might not be applicable !
4019/// // Values shown here are possibly random and not representative !
4020/// let mut req = Channel::default();
4021///
4022/// // You can configure optional parameters by calling the respective setters at will, and
4023/// // execute the final call using `doit()`.
4024/// // Values shown here are possibly random and not representative !
4025/// let result = hub.projects().sites_channels_create(req, "parent")
4026/// .channel_id("invidunt")
4027/// .doit().await;
4028/// # }
4029/// ```
4030pub struct ProjectSiteChannelCreateCall<'a, C>
4031where
4032 C: 'a,
4033{
4034 hub: &'a FirebaseHosting<C>,
4035 _request: Channel,
4036 _parent: String,
4037 _channel_id: Option<String>,
4038 _delegate: Option<&'a mut dyn common::Delegate>,
4039 _additional_params: HashMap<String, String>,
4040 _scopes: BTreeSet<String>,
4041}
4042
4043impl<'a, C> common::CallBuilder for ProjectSiteChannelCreateCall<'a, C> {}
4044
4045impl<'a, C> ProjectSiteChannelCreateCall<'a, C>
4046where
4047 C: common::Connector,
4048{
4049 /// Perform the operation you have build so far.
4050 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
4051 use std::borrow::Cow;
4052 use std::io::{Read, Seek};
4053
4054 use common::{url::Params, ToParts};
4055 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4056
4057 let mut dd = common::DefaultDelegate;
4058 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4059 dlg.begin(common::MethodInfo {
4060 id: "firebasehosting.projects.sites.channels.create",
4061 http_method: hyper::Method::POST,
4062 });
4063
4064 for &field in ["alt", "parent", "channelId"].iter() {
4065 if self._additional_params.contains_key(field) {
4066 dlg.finished(false);
4067 return Err(common::Error::FieldClash(field));
4068 }
4069 }
4070
4071 let mut params = Params::with_capacity(5 + self._additional_params.len());
4072 params.push("parent", self._parent);
4073 if let Some(value) = self._channel_id.as_ref() {
4074 params.push("channelId", value);
4075 }
4076
4077 params.extend(self._additional_params.iter());
4078
4079 params.push("alt", "json");
4080 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/channels";
4081 if self._scopes.is_empty() {
4082 self._scopes
4083 .insert(Scope::CloudPlatform.as_ref().to_string());
4084 }
4085
4086 #[allow(clippy::single_element_loop)]
4087 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4088 url = params.uri_replacement(url, param_name, find_this, true);
4089 }
4090 {
4091 let to_remove = ["parent"];
4092 params.remove_params(&to_remove);
4093 }
4094
4095 let url = params.parse_with_url(&url);
4096
4097 let mut json_mime_type = mime::APPLICATION_JSON;
4098 let mut request_value_reader = {
4099 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4100 common::remove_json_null_values(&mut value);
4101 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4102 serde_json::to_writer(&mut dst, &value).unwrap();
4103 dst
4104 };
4105 let request_size = request_value_reader
4106 .seek(std::io::SeekFrom::End(0))
4107 .unwrap();
4108 request_value_reader
4109 .seek(std::io::SeekFrom::Start(0))
4110 .unwrap();
4111
4112 loop {
4113 let token = match self
4114 .hub
4115 .auth
4116 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4117 .await
4118 {
4119 Ok(token) => token,
4120 Err(e) => match dlg.token(e) {
4121 Ok(token) => token,
4122 Err(e) => {
4123 dlg.finished(false);
4124 return Err(common::Error::MissingToken(e));
4125 }
4126 },
4127 };
4128 request_value_reader
4129 .seek(std::io::SeekFrom::Start(0))
4130 .unwrap();
4131 let mut req_result = {
4132 let client = &self.hub.client;
4133 dlg.pre_request();
4134 let mut req_builder = hyper::Request::builder()
4135 .method(hyper::Method::POST)
4136 .uri(url.as_str())
4137 .header(USER_AGENT, self.hub._user_agent.clone());
4138
4139 if let Some(token) = token.as_ref() {
4140 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4141 }
4142
4143 let request = req_builder
4144 .header(CONTENT_TYPE, json_mime_type.to_string())
4145 .header(CONTENT_LENGTH, request_size as u64)
4146 .body(common::to_body(
4147 request_value_reader.get_ref().clone().into(),
4148 ));
4149
4150 client.request(request.unwrap()).await
4151 };
4152
4153 match req_result {
4154 Err(err) => {
4155 if let common::Retry::After(d) = dlg.http_error(&err) {
4156 sleep(d).await;
4157 continue;
4158 }
4159 dlg.finished(false);
4160 return Err(common::Error::HttpError(err));
4161 }
4162 Ok(res) => {
4163 let (mut parts, body) = res.into_parts();
4164 let mut body = common::Body::new(body);
4165 if !parts.status.is_success() {
4166 let bytes = common::to_bytes(body).await.unwrap_or_default();
4167 let error = serde_json::from_str(&common::to_string(&bytes));
4168 let response = common::to_response(parts, bytes.into());
4169
4170 if let common::Retry::After(d) =
4171 dlg.http_failure(&response, error.as_ref().ok())
4172 {
4173 sleep(d).await;
4174 continue;
4175 }
4176
4177 dlg.finished(false);
4178
4179 return Err(match error {
4180 Ok(value) => common::Error::BadRequest(value),
4181 _ => common::Error::Failure(response),
4182 });
4183 }
4184 let response = {
4185 let bytes = common::to_bytes(body).await.unwrap_or_default();
4186 let encoded = common::to_string(&bytes);
4187 match serde_json::from_str(&encoded) {
4188 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4189 Err(error) => {
4190 dlg.response_json_decode_error(&encoded, &error);
4191 return Err(common::Error::JsonDecodeError(
4192 encoded.to_string(),
4193 error,
4194 ));
4195 }
4196 }
4197 };
4198
4199 dlg.finished(true);
4200 return Ok(response);
4201 }
4202 }
4203 }
4204 }
4205
4206 ///
4207 /// Sets the *request* property to the given value.
4208 ///
4209 /// Even though the property as already been set when instantiating this call,
4210 /// we provide this method for API completeness.
4211 pub fn request(mut self, new_value: Channel) -> ProjectSiteChannelCreateCall<'a, C> {
4212 self._request = new_value;
4213 self
4214 }
4215 /// Required. The site in which to create this channel, in the format: sites/ SITE_ID
4216 ///
4217 /// Sets the *parent* path property to the given value.
4218 ///
4219 /// Even though the property as already been set when instantiating this call,
4220 /// we provide this method for API completeness.
4221 pub fn parent(mut self, new_value: &str) -> ProjectSiteChannelCreateCall<'a, C> {
4222 self._parent = new_value.to_string();
4223 self
4224 }
4225 /// Required. Immutable. A unique ID within the site that identifies the channel.
4226 ///
4227 /// Sets the *channel id* query property to the given value.
4228 pub fn channel_id(mut self, new_value: &str) -> ProjectSiteChannelCreateCall<'a, C> {
4229 self._channel_id = Some(new_value.to_string());
4230 self
4231 }
4232 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4233 /// while executing the actual API request.
4234 ///
4235 /// ````text
4236 /// It should be used to handle progress information, and to implement a certain level of resilience.
4237 /// ````
4238 ///
4239 /// Sets the *delegate* property to the given value.
4240 pub fn delegate(
4241 mut self,
4242 new_value: &'a mut dyn common::Delegate,
4243 ) -> ProjectSiteChannelCreateCall<'a, C> {
4244 self._delegate = Some(new_value);
4245 self
4246 }
4247
4248 /// Set any additional parameter of the query string used in the request.
4249 /// It should be used to set parameters which are not yet available through their own
4250 /// setters.
4251 ///
4252 /// Please note that this method must not be used to set any of the known parameters
4253 /// which have their own setter method. If done anyway, the request will fail.
4254 ///
4255 /// # Additional Parameters
4256 ///
4257 /// * *$.xgafv* (query-string) - V1 error format.
4258 /// * *access_token* (query-string) - OAuth access token.
4259 /// * *alt* (query-string) - Data format for response.
4260 /// * *callback* (query-string) - JSONP
4261 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4262 /// * *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.
4263 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4264 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4265 /// * *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.
4266 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4267 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4268 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelCreateCall<'a, C>
4269 where
4270 T: AsRef<str>,
4271 {
4272 self._additional_params
4273 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4274 self
4275 }
4276
4277 /// Identifies the authorization scope for the method you are building.
4278 ///
4279 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4280 /// [`Scope::CloudPlatform`].
4281 ///
4282 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4283 /// tokens for more than one scope.
4284 ///
4285 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4286 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4287 /// sufficient, a read-write scope will do as well.
4288 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelCreateCall<'a, C>
4289 where
4290 St: AsRef<str>,
4291 {
4292 self._scopes.insert(String::from(scope.as_ref()));
4293 self
4294 }
4295 /// Identifies the authorization scope(s) for the method you are building.
4296 ///
4297 /// See [`Self::add_scope()`] for details.
4298 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelCreateCall<'a, C>
4299 where
4300 I: IntoIterator<Item = St>,
4301 St: AsRef<str>,
4302 {
4303 self._scopes
4304 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4305 self
4306 }
4307
4308 /// Removes all scopes, and no default scope will be used either.
4309 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4310 /// for details).
4311 pub fn clear_scopes(mut self) -> ProjectSiteChannelCreateCall<'a, C> {
4312 self._scopes.clear();
4313 self
4314 }
4315}
4316
4317/// Deletes the specified channel of the specified site. The `live` channel cannot be deleted.
4318///
4319/// A builder for the *sites.channels.delete* method supported by a *project* resource.
4320/// It is not used directly, but through a [`ProjectMethods`] instance.
4321///
4322/// # Example
4323///
4324/// Instantiate a resource method builder
4325///
4326/// ```test_harness,no_run
4327/// # extern crate hyper;
4328/// # extern crate hyper_rustls;
4329/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
4330/// # async fn dox() {
4331/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4332///
4333/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4334/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4335/// # .with_native_roots()
4336/// # .unwrap()
4337/// # .https_only()
4338/// # .enable_http2()
4339/// # .build();
4340///
4341/// # let executor = hyper_util::rt::TokioExecutor::new();
4342/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4343/// # secret,
4344/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4345/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4346/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4347/// # ),
4348/// # ).build().await.unwrap();
4349///
4350/// # let client = hyper_util::client::legacy::Client::builder(
4351/// # hyper_util::rt::TokioExecutor::new()
4352/// # )
4353/// # .build(
4354/// # hyper_rustls::HttpsConnectorBuilder::new()
4355/// # .with_native_roots()
4356/// # .unwrap()
4357/// # .https_or_http()
4358/// # .enable_http2()
4359/// # .build()
4360/// # );
4361/// # let mut hub = FirebaseHosting::new(client, auth);
4362/// // You can configure optional parameters by calling the respective setters at will, and
4363/// // execute the final call using `doit()`.
4364/// // Values shown here are possibly random and not representative !
4365/// let result = hub.projects().sites_channels_delete("name")
4366/// .doit().await;
4367/// # }
4368/// ```
4369pub struct ProjectSiteChannelDeleteCall<'a, C>
4370where
4371 C: 'a,
4372{
4373 hub: &'a FirebaseHosting<C>,
4374 _name: String,
4375 _delegate: Option<&'a mut dyn common::Delegate>,
4376 _additional_params: HashMap<String, String>,
4377 _scopes: BTreeSet<String>,
4378}
4379
4380impl<'a, C> common::CallBuilder for ProjectSiteChannelDeleteCall<'a, C> {}
4381
4382impl<'a, C> ProjectSiteChannelDeleteCall<'a, C>
4383where
4384 C: common::Connector,
4385{
4386 /// Perform the operation you have build so far.
4387 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4388 use std::borrow::Cow;
4389 use std::io::{Read, Seek};
4390
4391 use common::{url::Params, ToParts};
4392 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4393
4394 let mut dd = common::DefaultDelegate;
4395 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4396 dlg.begin(common::MethodInfo {
4397 id: "firebasehosting.projects.sites.channels.delete",
4398 http_method: hyper::Method::DELETE,
4399 });
4400
4401 for &field in ["alt", "name"].iter() {
4402 if self._additional_params.contains_key(field) {
4403 dlg.finished(false);
4404 return Err(common::Error::FieldClash(field));
4405 }
4406 }
4407
4408 let mut params = Params::with_capacity(3 + self._additional_params.len());
4409 params.push("name", self._name);
4410
4411 params.extend(self._additional_params.iter());
4412
4413 params.push("alt", "json");
4414 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4415 if self._scopes.is_empty() {
4416 self._scopes
4417 .insert(Scope::CloudPlatform.as_ref().to_string());
4418 }
4419
4420 #[allow(clippy::single_element_loop)]
4421 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4422 url = params.uri_replacement(url, param_name, find_this, true);
4423 }
4424 {
4425 let to_remove = ["name"];
4426 params.remove_params(&to_remove);
4427 }
4428
4429 let url = params.parse_with_url(&url);
4430
4431 loop {
4432 let token = match self
4433 .hub
4434 .auth
4435 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4436 .await
4437 {
4438 Ok(token) => token,
4439 Err(e) => match dlg.token(e) {
4440 Ok(token) => token,
4441 Err(e) => {
4442 dlg.finished(false);
4443 return Err(common::Error::MissingToken(e));
4444 }
4445 },
4446 };
4447 let mut req_result = {
4448 let client = &self.hub.client;
4449 dlg.pre_request();
4450 let mut req_builder = hyper::Request::builder()
4451 .method(hyper::Method::DELETE)
4452 .uri(url.as_str())
4453 .header(USER_AGENT, self.hub._user_agent.clone());
4454
4455 if let Some(token) = token.as_ref() {
4456 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4457 }
4458
4459 let request = req_builder
4460 .header(CONTENT_LENGTH, 0_u64)
4461 .body(common::to_body::<String>(None));
4462
4463 client.request(request.unwrap()).await
4464 };
4465
4466 match req_result {
4467 Err(err) => {
4468 if let common::Retry::After(d) = dlg.http_error(&err) {
4469 sleep(d).await;
4470 continue;
4471 }
4472 dlg.finished(false);
4473 return Err(common::Error::HttpError(err));
4474 }
4475 Ok(res) => {
4476 let (mut parts, body) = res.into_parts();
4477 let mut body = common::Body::new(body);
4478 if !parts.status.is_success() {
4479 let bytes = common::to_bytes(body).await.unwrap_or_default();
4480 let error = serde_json::from_str(&common::to_string(&bytes));
4481 let response = common::to_response(parts, bytes.into());
4482
4483 if let common::Retry::After(d) =
4484 dlg.http_failure(&response, error.as_ref().ok())
4485 {
4486 sleep(d).await;
4487 continue;
4488 }
4489
4490 dlg.finished(false);
4491
4492 return Err(match error {
4493 Ok(value) => common::Error::BadRequest(value),
4494 _ => common::Error::Failure(response),
4495 });
4496 }
4497 let response = {
4498 let bytes = common::to_bytes(body).await.unwrap_or_default();
4499 let encoded = common::to_string(&bytes);
4500 match serde_json::from_str(&encoded) {
4501 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4502 Err(error) => {
4503 dlg.response_json_decode_error(&encoded, &error);
4504 return Err(common::Error::JsonDecodeError(
4505 encoded.to_string(),
4506 error,
4507 ));
4508 }
4509 }
4510 };
4511
4512 dlg.finished(true);
4513 return Ok(response);
4514 }
4515 }
4516 }
4517 }
4518
4519 /// Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
4520 ///
4521 /// Sets the *name* path property to the given value.
4522 ///
4523 /// Even though the property as already been set when instantiating this call,
4524 /// we provide this method for API completeness.
4525 pub fn name(mut self, new_value: &str) -> ProjectSiteChannelDeleteCall<'a, C> {
4526 self._name = new_value.to_string();
4527 self
4528 }
4529 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4530 /// while executing the actual API request.
4531 ///
4532 /// ````text
4533 /// It should be used to handle progress information, and to implement a certain level of resilience.
4534 /// ````
4535 ///
4536 /// Sets the *delegate* property to the given value.
4537 pub fn delegate(
4538 mut self,
4539 new_value: &'a mut dyn common::Delegate,
4540 ) -> ProjectSiteChannelDeleteCall<'a, C> {
4541 self._delegate = Some(new_value);
4542 self
4543 }
4544
4545 /// Set any additional parameter of the query string used in the request.
4546 /// It should be used to set parameters which are not yet available through their own
4547 /// setters.
4548 ///
4549 /// Please note that this method must not be used to set any of the known parameters
4550 /// which have their own setter method. If done anyway, the request will fail.
4551 ///
4552 /// # Additional Parameters
4553 ///
4554 /// * *$.xgafv* (query-string) - V1 error format.
4555 /// * *access_token* (query-string) - OAuth access token.
4556 /// * *alt* (query-string) - Data format for response.
4557 /// * *callback* (query-string) - JSONP
4558 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4559 /// * *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.
4560 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4561 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4562 /// * *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.
4563 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4564 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4565 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelDeleteCall<'a, C>
4566 where
4567 T: AsRef<str>,
4568 {
4569 self._additional_params
4570 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4571 self
4572 }
4573
4574 /// Identifies the authorization scope for the method you are building.
4575 ///
4576 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4577 /// [`Scope::CloudPlatform`].
4578 ///
4579 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4580 /// tokens for more than one scope.
4581 ///
4582 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4583 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4584 /// sufficient, a read-write scope will do as well.
4585 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelDeleteCall<'a, C>
4586 where
4587 St: AsRef<str>,
4588 {
4589 self._scopes.insert(String::from(scope.as_ref()));
4590 self
4591 }
4592 /// Identifies the authorization scope(s) for the method you are building.
4593 ///
4594 /// See [`Self::add_scope()`] for details.
4595 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelDeleteCall<'a, C>
4596 where
4597 I: IntoIterator<Item = St>,
4598 St: AsRef<str>,
4599 {
4600 self._scopes
4601 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4602 self
4603 }
4604
4605 /// Removes all scopes, and no default scope will be used either.
4606 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4607 /// for details).
4608 pub fn clear_scopes(mut self) -> ProjectSiteChannelDeleteCall<'a, C> {
4609 self._scopes.clear();
4610 self
4611 }
4612}
4613
4614/// Retrieves information for the specified channel of the specified site.
4615///
4616/// A builder for the *sites.channels.get* method supported by a *project* resource.
4617/// It is not used directly, but through a [`ProjectMethods`] instance.
4618///
4619/// # Example
4620///
4621/// Instantiate a resource method builder
4622///
4623/// ```test_harness,no_run
4624/// # extern crate hyper;
4625/// # extern crate hyper_rustls;
4626/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
4627/// # async fn dox() {
4628/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4629///
4630/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4631/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4632/// # .with_native_roots()
4633/// # .unwrap()
4634/// # .https_only()
4635/// # .enable_http2()
4636/// # .build();
4637///
4638/// # let executor = hyper_util::rt::TokioExecutor::new();
4639/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4640/// # secret,
4641/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4642/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4643/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4644/// # ),
4645/// # ).build().await.unwrap();
4646///
4647/// # let client = hyper_util::client::legacy::Client::builder(
4648/// # hyper_util::rt::TokioExecutor::new()
4649/// # )
4650/// # .build(
4651/// # hyper_rustls::HttpsConnectorBuilder::new()
4652/// # .with_native_roots()
4653/// # .unwrap()
4654/// # .https_or_http()
4655/// # .enable_http2()
4656/// # .build()
4657/// # );
4658/// # let mut hub = FirebaseHosting::new(client, auth);
4659/// // You can configure optional parameters by calling the respective setters at will, and
4660/// // execute the final call using `doit()`.
4661/// // Values shown here are possibly random and not representative !
4662/// let result = hub.projects().sites_channels_get("name")
4663/// .doit().await;
4664/// # }
4665/// ```
4666pub struct ProjectSiteChannelGetCall<'a, C>
4667where
4668 C: 'a,
4669{
4670 hub: &'a FirebaseHosting<C>,
4671 _name: String,
4672 _delegate: Option<&'a mut dyn common::Delegate>,
4673 _additional_params: HashMap<String, String>,
4674 _scopes: BTreeSet<String>,
4675}
4676
4677impl<'a, C> common::CallBuilder for ProjectSiteChannelGetCall<'a, C> {}
4678
4679impl<'a, C> ProjectSiteChannelGetCall<'a, C>
4680where
4681 C: common::Connector,
4682{
4683 /// Perform the operation you have build so far.
4684 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
4685 use std::borrow::Cow;
4686 use std::io::{Read, Seek};
4687
4688 use common::{url::Params, ToParts};
4689 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4690
4691 let mut dd = common::DefaultDelegate;
4692 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4693 dlg.begin(common::MethodInfo {
4694 id: "firebasehosting.projects.sites.channels.get",
4695 http_method: hyper::Method::GET,
4696 });
4697
4698 for &field in ["alt", "name"].iter() {
4699 if self._additional_params.contains_key(field) {
4700 dlg.finished(false);
4701 return Err(common::Error::FieldClash(field));
4702 }
4703 }
4704
4705 let mut params = Params::with_capacity(3 + self._additional_params.len());
4706 params.push("name", self._name);
4707
4708 params.extend(self._additional_params.iter());
4709
4710 params.push("alt", "json");
4711 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4712 if self._scopes.is_empty() {
4713 self._scopes
4714 .insert(Scope::FirebaseReadonly.as_ref().to_string());
4715 }
4716
4717 #[allow(clippy::single_element_loop)]
4718 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4719 url = params.uri_replacement(url, param_name, find_this, true);
4720 }
4721 {
4722 let to_remove = ["name"];
4723 params.remove_params(&to_remove);
4724 }
4725
4726 let url = params.parse_with_url(&url);
4727
4728 loop {
4729 let token = match self
4730 .hub
4731 .auth
4732 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4733 .await
4734 {
4735 Ok(token) => token,
4736 Err(e) => match dlg.token(e) {
4737 Ok(token) => token,
4738 Err(e) => {
4739 dlg.finished(false);
4740 return Err(common::Error::MissingToken(e));
4741 }
4742 },
4743 };
4744 let mut req_result = {
4745 let client = &self.hub.client;
4746 dlg.pre_request();
4747 let mut req_builder = hyper::Request::builder()
4748 .method(hyper::Method::GET)
4749 .uri(url.as_str())
4750 .header(USER_AGENT, self.hub._user_agent.clone());
4751
4752 if let Some(token) = token.as_ref() {
4753 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4754 }
4755
4756 let request = req_builder
4757 .header(CONTENT_LENGTH, 0_u64)
4758 .body(common::to_body::<String>(None));
4759
4760 client.request(request.unwrap()).await
4761 };
4762
4763 match req_result {
4764 Err(err) => {
4765 if let common::Retry::After(d) = dlg.http_error(&err) {
4766 sleep(d).await;
4767 continue;
4768 }
4769 dlg.finished(false);
4770 return Err(common::Error::HttpError(err));
4771 }
4772 Ok(res) => {
4773 let (mut parts, body) = res.into_parts();
4774 let mut body = common::Body::new(body);
4775 if !parts.status.is_success() {
4776 let bytes = common::to_bytes(body).await.unwrap_or_default();
4777 let error = serde_json::from_str(&common::to_string(&bytes));
4778 let response = common::to_response(parts, bytes.into());
4779
4780 if let common::Retry::After(d) =
4781 dlg.http_failure(&response, error.as_ref().ok())
4782 {
4783 sleep(d).await;
4784 continue;
4785 }
4786
4787 dlg.finished(false);
4788
4789 return Err(match error {
4790 Ok(value) => common::Error::BadRequest(value),
4791 _ => common::Error::Failure(response),
4792 });
4793 }
4794 let response = {
4795 let bytes = common::to_bytes(body).await.unwrap_or_default();
4796 let encoded = common::to_string(&bytes);
4797 match serde_json::from_str(&encoded) {
4798 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4799 Err(error) => {
4800 dlg.response_json_decode_error(&encoded, &error);
4801 return Err(common::Error::JsonDecodeError(
4802 encoded.to_string(),
4803 error,
4804 ));
4805 }
4806 }
4807 };
4808
4809 dlg.finished(true);
4810 return Ok(response);
4811 }
4812 }
4813 }
4814 }
4815
4816 /// Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
4817 ///
4818 /// Sets the *name* path property to the given value.
4819 ///
4820 /// Even though the property as already been set when instantiating this call,
4821 /// we provide this method for API completeness.
4822 pub fn name(mut self, new_value: &str) -> ProjectSiteChannelGetCall<'a, C> {
4823 self._name = new_value.to_string();
4824 self
4825 }
4826 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4827 /// while executing the actual API request.
4828 ///
4829 /// ````text
4830 /// It should be used to handle progress information, and to implement a certain level of resilience.
4831 /// ````
4832 ///
4833 /// Sets the *delegate* property to the given value.
4834 pub fn delegate(
4835 mut self,
4836 new_value: &'a mut dyn common::Delegate,
4837 ) -> ProjectSiteChannelGetCall<'a, C> {
4838 self._delegate = Some(new_value);
4839 self
4840 }
4841
4842 /// Set any additional parameter of the query string used in the request.
4843 /// It should be used to set parameters which are not yet available through their own
4844 /// setters.
4845 ///
4846 /// Please note that this method must not be used to set any of the known parameters
4847 /// which have their own setter method. If done anyway, the request will fail.
4848 ///
4849 /// # Additional Parameters
4850 ///
4851 /// * *$.xgafv* (query-string) - V1 error format.
4852 /// * *access_token* (query-string) - OAuth access token.
4853 /// * *alt* (query-string) - Data format for response.
4854 /// * *callback* (query-string) - JSONP
4855 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4856 /// * *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.
4857 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4858 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4859 /// * *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.
4860 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4861 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4862 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelGetCall<'a, C>
4863 where
4864 T: AsRef<str>,
4865 {
4866 self._additional_params
4867 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4868 self
4869 }
4870
4871 /// Identifies the authorization scope for the method you are building.
4872 ///
4873 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4874 /// [`Scope::FirebaseReadonly`].
4875 ///
4876 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4877 /// tokens for more than one scope.
4878 ///
4879 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4880 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4881 /// sufficient, a read-write scope will do as well.
4882 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelGetCall<'a, C>
4883 where
4884 St: AsRef<str>,
4885 {
4886 self._scopes.insert(String::from(scope.as_ref()));
4887 self
4888 }
4889 /// Identifies the authorization scope(s) for the method you are building.
4890 ///
4891 /// See [`Self::add_scope()`] for details.
4892 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelGetCall<'a, C>
4893 where
4894 I: IntoIterator<Item = St>,
4895 St: AsRef<str>,
4896 {
4897 self._scopes
4898 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4899 self
4900 }
4901
4902 /// Removes all scopes, and no default scope will be used either.
4903 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4904 /// for details).
4905 pub fn clear_scopes(mut self) -> ProjectSiteChannelGetCall<'a, C> {
4906 self._scopes.clear();
4907 self
4908 }
4909}
4910
4911/// Lists the channels for the specified site. All sites have a default `live` channel.
4912///
4913/// A builder for the *sites.channels.list* method supported by a *project* resource.
4914/// It is not used directly, but through a [`ProjectMethods`] instance.
4915///
4916/// # Example
4917///
4918/// Instantiate a resource method builder
4919///
4920/// ```test_harness,no_run
4921/// # extern crate hyper;
4922/// # extern crate hyper_rustls;
4923/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
4924/// # async fn dox() {
4925/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4926///
4927/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4928/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4929/// # .with_native_roots()
4930/// # .unwrap()
4931/// # .https_only()
4932/// # .enable_http2()
4933/// # .build();
4934///
4935/// # let executor = hyper_util::rt::TokioExecutor::new();
4936/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4937/// # secret,
4938/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4939/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4940/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4941/// # ),
4942/// # ).build().await.unwrap();
4943///
4944/// # let client = hyper_util::client::legacy::Client::builder(
4945/// # hyper_util::rt::TokioExecutor::new()
4946/// # )
4947/// # .build(
4948/// # hyper_rustls::HttpsConnectorBuilder::new()
4949/// # .with_native_roots()
4950/// # .unwrap()
4951/// # .https_or_http()
4952/// # .enable_http2()
4953/// # .build()
4954/// # );
4955/// # let mut hub = FirebaseHosting::new(client, auth);
4956/// // You can configure optional parameters by calling the respective setters at will, and
4957/// // execute the final call using `doit()`.
4958/// // Values shown here are possibly random and not representative !
4959/// let result = hub.projects().sites_channels_list("parent")
4960/// .page_token("sed")
4961/// .page_size(-37)
4962/// .doit().await;
4963/// # }
4964/// ```
4965pub struct ProjectSiteChannelListCall<'a, C>
4966where
4967 C: 'a,
4968{
4969 hub: &'a FirebaseHosting<C>,
4970 _parent: String,
4971 _page_token: Option<String>,
4972 _page_size: Option<i32>,
4973 _delegate: Option<&'a mut dyn common::Delegate>,
4974 _additional_params: HashMap<String, String>,
4975 _scopes: BTreeSet<String>,
4976}
4977
4978impl<'a, C> common::CallBuilder for ProjectSiteChannelListCall<'a, C> {}
4979
4980impl<'a, C> ProjectSiteChannelListCall<'a, C>
4981where
4982 C: common::Connector,
4983{
4984 /// Perform the operation you have build so far.
4985 pub async fn doit(mut self) -> common::Result<(common::Response, ListChannelsResponse)> {
4986 use std::borrow::Cow;
4987 use std::io::{Read, Seek};
4988
4989 use common::{url::Params, ToParts};
4990 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4991
4992 let mut dd = common::DefaultDelegate;
4993 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4994 dlg.begin(common::MethodInfo {
4995 id: "firebasehosting.projects.sites.channels.list",
4996 http_method: hyper::Method::GET,
4997 });
4998
4999 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
5000 if self._additional_params.contains_key(field) {
5001 dlg.finished(false);
5002 return Err(common::Error::FieldClash(field));
5003 }
5004 }
5005
5006 let mut params = Params::with_capacity(5 + self._additional_params.len());
5007 params.push("parent", self._parent);
5008 if let Some(value) = self._page_token.as_ref() {
5009 params.push("pageToken", value);
5010 }
5011 if let Some(value) = self._page_size.as_ref() {
5012 params.push("pageSize", value.to_string());
5013 }
5014
5015 params.extend(self._additional_params.iter());
5016
5017 params.push("alt", "json");
5018 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/channels";
5019 if self._scopes.is_empty() {
5020 self._scopes
5021 .insert(Scope::FirebaseReadonly.as_ref().to_string());
5022 }
5023
5024 #[allow(clippy::single_element_loop)]
5025 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5026 url = params.uri_replacement(url, param_name, find_this, true);
5027 }
5028 {
5029 let to_remove = ["parent"];
5030 params.remove_params(&to_remove);
5031 }
5032
5033 let url = params.parse_with_url(&url);
5034
5035 loop {
5036 let token = match self
5037 .hub
5038 .auth
5039 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5040 .await
5041 {
5042 Ok(token) => token,
5043 Err(e) => match dlg.token(e) {
5044 Ok(token) => token,
5045 Err(e) => {
5046 dlg.finished(false);
5047 return Err(common::Error::MissingToken(e));
5048 }
5049 },
5050 };
5051 let mut req_result = {
5052 let client = &self.hub.client;
5053 dlg.pre_request();
5054 let mut req_builder = hyper::Request::builder()
5055 .method(hyper::Method::GET)
5056 .uri(url.as_str())
5057 .header(USER_AGENT, self.hub._user_agent.clone());
5058
5059 if let Some(token) = token.as_ref() {
5060 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5061 }
5062
5063 let request = req_builder
5064 .header(CONTENT_LENGTH, 0_u64)
5065 .body(common::to_body::<String>(None));
5066
5067 client.request(request.unwrap()).await
5068 };
5069
5070 match req_result {
5071 Err(err) => {
5072 if let common::Retry::After(d) = dlg.http_error(&err) {
5073 sleep(d).await;
5074 continue;
5075 }
5076 dlg.finished(false);
5077 return Err(common::Error::HttpError(err));
5078 }
5079 Ok(res) => {
5080 let (mut parts, body) = res.into_parts();
5081 let mut body = common::Body::new(body);
5082 if !parts.status.is_success() {
5083 let bytes = common::to_bytes(body).await.unwrap_or_default();
5084 let error = serde_json::from_str(&common::to_string(&bytes));
5085 let response = common::to_response(parts, bytes.into());
5086
5087 if let common::Retry::After(d) =
5088 dlg.http_failure(&response, error.as_ref().ok())
5089 {
5090 sleep(d).await;
5091 continue;
5092 }
5093
5094 dlg.finished(false);
5095
5096 return Err(match error {
5097 Ok(value) => common::Error::BadRequest(value),
5098 _ => common::Error::Failure(response),
5099 });
5100 }
5101 let response = {
5102 let bytes = common::to_bytes(body).await.unwrap_or_default();
5103 let encoded = common::to_string(&bytes);
5104 match serde_json::from_str(&encoded) {
5105 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5106 Err(error) => {
5107 dlg.response_json_decode_error(&encoded, &error);
5108 return Err(common::Error::JsonDecodeError(
5109 encoded.to_string(),
5110 error,
5111 ));
5112 }
5113 }
5114 };
5115
5116 dlg.finished(true);
5117 return Ok(response);
5118 }
5119 }
5120 }
5121 }
5122
5123 /// Required. The site for which to list channels, in the format: sites/SITE_ID
5124 ///
5125 /// Sets the *parent* path property to the given value.
5126 ///
5127 /// Even though the property as already been set when instantiating this call,
5128 /// we provide this method for API completeness.
5129 pub fn parent(mut self, new_value: &str) -> ProjectSiteChannelListCall<'a, C> {
5130 self._parent = new_value.to_string();
5131 self
5132 }
5133 /// A token from a previous call to `ListChannels` that tells the server where to resume listing.
5134 ///
5135 /// Sets the *page token* query property to the given value.
5136 pub fn page_token(mut self, new_value: &str) -> ProjectSiteChannelListCall<'a, C> {
5137 self._page_token = Some(new_value.to_string());
5138 self
5139 }
5140 /// 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.
5141 ///
5142 /// Sets the *page size* query property to the given value.
5143 pub fn page_size(mut self, new_value: i32) -> ProjectSiteChannelListCall<'a, C> {
5144 self._page_size = Some(new_value);
5145 self
5146 }
5147 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5148 /// while executing the actual API request.
5149 ///
5150 /// ````text
5151 /// It should be used to handle progress information, and to implement a certain level of resilience.
5152 /// ````
5153 ///
5154 /// Sets the *delegate* property to the given value.
5155 pub fn delegate(
5156 mut self,
5157 new_value: &'a mut dyn common::Delegate,
5158 ) -> ProjectSiteChannelListCall<'a, C> {
5159 self._delegate = Some(new_value);
5160 self
5161 }
5162
5163 /// Set any additional parameter of the query string used in the request.
5164 /// It should be used to set parameters which are not yet available through their own
5165 /// setters.
5166 ///
5167 /// Please note that this method must not be used to set any of the known parameters
5168 /// which have their own setter method. If done anyway, the request will fail.
5169 ///
5170 /// # Additional Parameters
5171 ///
5172 /// * *$.xgafv* (query-string) - V1 error format.
5173 /// * *access_token* (query-string) - OAuth access token.
5174 /// * *alt* (query-string) - Data format for response.
5175 /// * *callback* (query-string) - JSONP
5176 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5177 /// * *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.
5178 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5179 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5180 /// * *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.
5181 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5182 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5183 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelListCall<'a, C>
5184 where
5185 T: AsRef<str>,
5186 {
5187 self._additional_params
5188 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5189 self
5190 }
5191
5192 /// Identifies the authorization scope for the method you are building.
5193 ///
5194 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5195 /// [`Scope::FirebaseReadonly`].
5196 ///
5197 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5198 /// tokens for more than one scope.
5199 ///
5200 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5201 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5202 /// sufficient, a read-write scope will do as well.
5203 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelListCall<'a, C>
5204 where
5205 St: AsRef<str>,
5206 {
5207 self._scopes.insert(String::from(scope.as_ref()));
5208 self
5209 }
5210 /// Identifies the authorization scope(s) for the method you are building.
5211 ///
5212 /// See [`Self::add_scope()`] for details.
5213 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelListCall<'a, C>
5214 where
5215 I: IntoIterator<Item = St>,
5216 St: AsRef<str>,
5217 {
5218 self._scopes
5219 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5220 self
5221 }
5222
5223 /// Removes all scopes, and no default scope will be used either.
5224 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5225 /// for details).
5226 pub fn clear_scopes(mut self) -> ProjectSiteChannelListCall<'a, C> {
5227 self._scopes.clear();
5228 self
5229 }
5230}
5231
5232/// Updates information for the specified channel of the specified site. Implicitly creates the channel if it doesn't already exist.
5233///
5234/// A builder for the *sites.channels.patch* method supported by a *project* resource.
5235/// It is not used directly, but through a [`ProjectMethods`] instance.
5236///
5237/// # Example
5238///
5239/// Instantiate a resource method builder
5240///
5241/// ```test_harness,no_run
5242/// # extern crate hyper;
5243/// # extern crate hyper_rustls;
5244/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
5245/// use firebasehosting1_beta1::api::Channel;
5246/// # async fn dox() {
5247/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5248///
5249/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5250/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5251/// # .with_native_roots()
5252/// # .unwrap()
5253/// # .https_only()
5254/// # .enable_http2()
5255/// # .build();
5256///
5257/// # let executor = hyper_util::rt::TokioExecutor::new();
5258/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5259/// # secret,
5260/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5261/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5262/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5263/// # ),
5264/// # ).build().await.unwrap();
5265///
5266/// # let client = hyper_util::client::legacy::Client::builder(
5267/// # hyper_util::rt::TokioExecutor::new()
5268/// # )
5269/// # .build(
5270/// # hyper_rustls::HttpsConnectorBuilder::new()
5271/// # .with_native_roots()
5272/// # .unwrap()
5273/// # .https_or_http()
5274/// # .enable_http2()
5275/// # .build()
5276/// # );
5277/// # let mut hub = FirebaseHosting::new(client, auth);
5278/// // As the method needs a request, you would usually fill it with the desired information
5279/// // into the respective structure. Some of the parts shown here might not be applicable !
5280/// // Values shown here are possibly random and not representative !
5281/// let mut req = Channel::default();
5282///
5283/// // You can configure optional parameters by calling the respective setters at will, and
5284/// // execute the final call using `doit()`.
5285/// // Values shown here are possibly random and not representative !
5286/// let result = hub.projects().sites_channels_patch(req, "name")
5287/// .update_mask(FieldMask::new::<&str>(&[]))
5288/// .doit().await;
5289/// # }
5290/// ```
5291pub struct ProjectSiteChannelPatchCall<'a, C>
5292where
5293 C: 'a,
5294{
5295 hub: &'a FirebaseHosting<C>,
5296 _request: Channel,
5297 _name: String,
5298 _update_mask: Option<common::FieldMask>,
5299 _delegate: Option<&'a mut dyn common::Delegate>,
5300 _additional_params: HashMap<String, String>,
5301 _scopes: BTreeSet<String>,
5302}
5303
5304impl<'a, C> common::CallBuilder for ProjectSiteChannelPatchCall<'a, C> {}
5305
5306impl<'a, C> ProjectSiteChannelPatchCall<'a, C>
5307where
5308 C: common::Connector,
5309{
5310 /// Perform the operation you have build so far.
5311 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
5312 use std::borrow::Cow;
5313 use std::io::{Read, Seek};
5314
5315 use common::{url::Params, ToParts};
5316 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5317
5318 let mut dd = common::DefaultDelegate;
5319 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5320 dlg.begin(common::MethodInfo {
5321 id: "firebasehosting.projects.sites.channels.patch",
5322 http_method: hyper::Method::PATCH,
5323 });
5324
5325 for &field in ["alt", "name", "updateMask"].iter() {
5326 if self._additional_params.contains_key(field) {
5327 dlg.finished(false);
5328 return Err(common::Error::FieldClash(field));
5329 }
5330 }
5331
5332 let mut params = Params::with_capacity(5 + self._additional_params.len());
5333 params.push("name", self._name);
5334 if let Some(value) = self._update_mask.as_ref() {
5335 params.push("updateMask", value.to_string());
5336 }
5337
5338 params.extend(self._additional_params.iter());
5339
5340 params.push("alt", "json");
5341 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5342 if self._scopes.is_empty() {
5343 self._scopes
5344 .insert(Scope::CloudPlatform.as_ref().to_string());
5345 }
5346
5347 #[allow(clippy::single_element_loop)]
5348 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5349 url = params.uri_replacement(url, param_name, find_this, true);
5350 }
5351 {
5352 let to_remove = ["name"];
5353 params.remove_params(&to_remove);
5354 }
5355
5356 let url = params.parse_with_url(&url);
5357
5358 let mut json_mime_type = mime::APPLICATION_JSON;
5359 let mut request_value_reader = {
5360 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5361 common::remove_json_null_values(&mut value);
5362 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5363 serde_json::to_writer(&mut dst, &value).unwrap();
5364 dst
5365 };
5366 let request_size = request_value_reader
5367 .seek(std::io::SeekFrom::End(0))
5368 .unwrap();
5369 request_value_reader
5370 .seek(std::io::SeekFrom::Start(0))
5371 .unwrap();
5372
5373 loop {
5374 let token = match self
5375 .hub
5376 .auth
5377 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5378 .await
5379 {
5380 Ok(token) => token,
5381 Err(e) => match dlg.token(e) {
5382 Ok(token) => token,
5383 Err(e) => {
5384 dlg.finished(false);
5385 return Err(common::Error::MissingToken(e));
5386 }
5387 },
5388 };
5389 request_value_reader
5390 .seek(std::io::SeekFrom::Start(0))
5391 .unwrap();
5392 let mut req_result = {
5393 let client = &self.hub.client;
5394 dlg.pre_request();
5395 let mut req_builder = hyper::Request::builder()
5396 .method(hyper::Method::PATCH)
5397 .uri(url.as_str())
5398 .header(USER_AGENT, self.hub._user_agent.clone());
5399
5400 if let Some(token) = token.as_ref() {
5401 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5402 }
5403
5404 let request = req_builder
5405 .header(CONTENT_TYPE, json_mime_type.to_string())
5406 .header(CONTENT_LENGTH, request_size as u64)
5407 .body(common::to_body(
5408 request_value_reader.get_ref().clone().into(),
5409 ));
5410
5411 client.request(request.unwrap()).await
5412 };
5413
5414 match req_result {
5415 Err(err) => {
5416 if let common::Retry::After(d) = dlg.http_error(&err) {
5417 sleep(d).await;
5418 continue;
5419 }
5420 dlg.finished(false);
5421 return Err(common::Error::HttpError(err));
5422 }
5423 Ok(res) => {
5424 let (mut parts, body) = res.into_parts();
5425 let mut body = common::Body::new(body);
5426 if !parts.status.is_success() {
5427 let bytes = common::to_bytes(body).await.unwrap_or_default();
5428 let error = serde_json::from_str(&common::to_string(&bytes));
5429 let response = common::to_response(parts, bytes.into());
5430
5431 if let common::Retry::After(d) =
5432 dlg.http_failure(&response, error.as_ref().ok())
5433 {
5434 sleep(d).await;
5435 continue;
5436 }
5437
5438 dlg.finished(false);
5439
5440 return Err(match error {
5441 Ok(value) => common::Error::BadRequest(value),
5442 _ => common::Error::Failure(response),
5443 });
5444 }
5445 let response = {
5446 let bytes = common::to_bytes(body).await.unwrap_or_default();
5447 let encoded = common::to_string(&bytes);
5448 match serde_json::from_str(&encoded) {
5449 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5450 Err(error) => {
5451 dlg.response_json_decode_error(&encoded, &error);
5452 return Err(common::Error::JsonDecodeError(
5453 encoded.to_string(),
5454 error,
5455 ));
5456 }
5457 }
5458 };
5459
5460 dlg.finished(true);
5461 return Ok(response);
5462 }
5463 }
5464 }
5465 }
5466
5467 ///
5468 /// Sets the *request* property to the given value.
5469 ///
5470 /// Even though the property as already been set when instantiating this call,
5471 /// we provide this method for API completeness.
5472 pub fn request(mut self, new_value: Channel) -> ProjectSiteChannelPatchCall<'a, C> {
5473 self._request = new_value;
5474 self
5475 }
5476 /// The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
5477 ///
5478 /// Sets the *name* path property to the given value.
5479 ///
5480 /// Even though the property as already been set when instantiating this call,
5481 /// we provide this method for API completeness.
5482 pub fn name(mut self, new_value: &str) -> ProjectSiteChannelPatchCall<'a, C> {
5483 self._name = new_value.to_string();
5484 self
5485 }
5486 /// A comma-separated list of fields to be updated in this request.
5487 ///
5488 /// Sets the *update mask* query property to the given value.
5489 pub fn update_mask(
5490 mut self,
5491 new_value: common::FieldMask,
5492 ) -> ProjectSiteChannelPatchCall<'a, C> {
5493 self._update_mask = Some(new_value);
5494 self
5495 }
5496 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5497 /// while executing the actual API request.
5498 ///
5499 /// ````text
5500 /// It should be used to handle progress information, and to implement a certain level of resilience.
5501 /// ````
5502 ///
5503 /// Sets the *delegate* property to the given value.
5504 pub fn delegate(
5505 mut self,
5506 new_value: &'a mut dyn common::Delegate,
5507 ) -> ProjectSiteChannelPatchCall<'a, C> {
5508 self._delegate = Some(new_value);
5509 self
5510 }
5511
5512 /// Set any additional parameter of the query string used in the request.
5513 /// It should be used to set parameters which are not yet available through their own
5514 /// setters.
5515 ///
5516 /// Please note that this method must not be used to set any of the known parameters
5517 /// which have their own setter method. If done anyway, the request will fail.
5518 ///
5519 /// # Additional Parameters
5520 ///
5521 /// * *$.xgafv* (query-string) - V1 error format.
5522 /// * *access_token* (query-string) - OAuth access token.
5523 /// * *alt* (query-string) - Data format for response.
5524 /// * *callback* (query-string) - JSONP
5525 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5526 /// * *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.
5527 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5528 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5529 /// * *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.
5530 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5531 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5532 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteChannelPatchCall<'a, C>
5533 where
5534 T: AsRef<str>,
5535 {
5536 self._additional_params
5537 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5538 self
5539 }
5540
5541 /// Identifies the authorization scope for the method you are building.
5542 ///
5543 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5544 /// [`Scope::CloudPlatform`].
5545 ///
5546 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5547 /// tokens for more than one scope.
5548 ///
5549 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5550 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5551 /// sufficient, a read-write scope will do as well.
5552 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteChannelPatchCall<'a, C>
5553 where
5554 St: AsRef<str>,
5555 {
5556 self._scopes.insert(String::from(scope.as_ref()));
5557 self
5558 }
5559 /// Identifies the authorization scope(s) for the method you are building.
5560 ///
5561 /// See [`Self::add_scope()`] for details.
5562 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteChannelPatchCall<'a, C>
5563 where
5564 I: IntoIterator<Item = St>,
5565 St: AsRef<str>,
5566 {
5567 self._scopes
5568 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5569 self
5570 }
5571
5572 /// Removes all scopes, and no default scope will be used either.
5573 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5574 /// for details).
5575 pub fn clear_scopes(mut self) -> ProjectSiteChannelPatchCall<'a, C> {
5576 self._scopes.clear();
5577 self
5578 }
5579}
5580
5581/// 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.
5582///
5583/// A builder for the *sites.customDomains.operations.get* method supported by a *project* resource.
5584/// It is not used directly, but through a [`ProjectMethods`] instance.
5585///
5586/// # Example
5587///
5588/// Instantiate a resource method builder
5589///
5590/// ```test_harness,no_run
5591/// # extern crate hyper;
5592/// # extern crate hyper_rustls;
5593/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
5594/// # async fn dox() {
5595/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5596///
5597/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5598/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5599/// # .with_native_roots()
5600/// # .unwrap()
5601/// # .https_only()
5602/// # .enable_http2()
5603/// # .build();
5604///
5605/// # let executor = hyper_util::rt::TokioExecutor::new();
5606/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5607/// # secret,
5608/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5609/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5610/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5611/// # ),
5612/// # ).build().await.unwrap();
5613///
5614/// # let client = hyper_util::client::legacy::Client::builder(
5615/// # hyper_util::rt::TokioExecutor::new()
5616/// # )
5617/// # .build(
5618/// # hyper_rustls::HttpsConnectorBuilder::new()
5619/// # .with_native_roots()
5620/// # .unwrap()
5621/// # .https_or_http()
5622/// # .enable_http2()
5623/// # .build()
5624/// # );
5625/// # let mut hub = FirebaseHosting::new(client, auth);
5626/// // You can configure optional parameters by calling the respective setters at will, and
5627/// // execute the final call using `doit()`.
5628/// // Values shown here are possibly random and not representative !
5629/// let result = hub.projects().sites_custom_domains_operations_get("name")
5630/// .doit().await;
5631/// # }
5632/// ```
5633pub struct ProjectSiteCustomDomainOperationGetCall<'a, C>
5634where
5635 C: 'a,
5636{
5637 hub: &'a FirebaseHosting<C>,
5638 _name: String,
5639 _delegate: Option<&'a mut dyn common::Delegate>,
5640 _additional_params: HashMap<String, String>,
5641 _scopes: BTreeSet<String>,
5642}
5643
5644impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainOperationGetCall<'a, C> {}
5645
5646impl<'a, C> ProjectSiteCustomDomainOperationGetCall<'a, C>
5647where
5648 C: common::Connector,
5649{
5650 /// Perform the operation you have build so far.
5651 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5652 use std::borrow::Cow;
5653 use std::io::{Read, Seek};
5654
5655 use common::{url::Params, ToParts};
5656 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5657
5658 let mut dd = common::DefaultDelegate;
5659 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5660 dlg.begin(common::MethodInfo {
5661 id: "firebasehosting.projects.sites.customDomains.operations.get",
5662 http_method: hyper::Method::GET,
5663 });
5664
5665 for &field in ["alt", "name"].iter() {
5666 if self._additional_params.contains_key(field) {
5667 dlg.finished(false);
5668 return Err(common::Error::FieldClash(field));
5669 }
5670 }
5671
5672 let mut params = Params::with_capacity(3 + self._additional_params.len());
5673 params.push("name", self._name);
5674
5675 params.extend(self._additional_params.iter());
5676
5677 params.push("alt", "json");
5678 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5679 if self._scopes.is_empty() {
5680 self._scopes
5681 .insert(Scope::FirebaseReadonly.as_ref().to_string());
5682 }
5683
5684 #[allow(clippy::single_element_loop)]
5685 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5686 url = params.uri_replacement(url, param_name, find_this, true);
5687 }
5688 {
5689 let to_remove = ["name"];
5690 params.remove_params(&to_remove);
5691 }
5692
5693 let url = params.parse_with_url(&url);
5694
5695 loop {
5696 let token = match self
5697 .hub
5698 .auth
5699 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5700 .await
5701 {
5702 Ok(token) => token,
5703 Err(e) => match dlg.token(e) {
5704 Ok(token) => token,
5705 Err(e) => {
5706 dlg.finished(false);
5707 return Err(common::Error::MissingToken(e));
5708 }
5709 },
5710 };
5711 let mut req_result = {
5712 let client = &self.hub.client;
5713 dlg.pre_request();
5714 let mut req_builder = hyper::Request::builder()
5715 .method(hyper::Method::GET)
5716 .uri(url.as_str())
5717 .header(USER_AGENT, self.hub._user_agent.clone());
5718
5719 if let Some(token) = token.as_ref() {
5720 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5721 }
5722
5723 let request = req_builder
5724 .header(CONTENT_LENGTH, 0_u64)
5725 .body(common::to_body::<String>(None));
5726
5727 client.request(request.unwrap()).await
5728 };
5729
5730 match req_result {
5731 Err(err) => {
5732 if let common::Retry::After(d) = dlg.http_error(&err) {
5733 sleep(d).await;
5734 continue;
5735 }
5736 dlg.finished(false);
5737 return Err(common::Error::HttpError(err));
5738 }
5739 Ok(res) => {
5740 let (mut parts, body) = res.into_parts();
5741 let mut body = common::Body::new(body);
5742 if !parts.status.is_success() {
5743 let bytes = common::to_bytes(body).await.unwrap_or_default();
5744 let error = serde_json::from_str(&common::to_string(&bytes));
5745 let response = common::to_response(parts, bytes.into());
5746
5747 if let common::Retry::After(d) =
5748 dlg.http_failure(&response, error.as_ref().ok())
5749 {
5750 sleep(d).await;
5751 continue;
5752 }
5753
5754 dlg.finished(false);
5755
5756 return Err(match error {
5757 Ok(value) => common::Error::BadRequest(value),
5758 _ => common::Error::Failure(response),
5759 });
5760 }
5761 let response = {
5762 let bytes = common::to_bytes(body).await.unwrap_or_default();
5763 let encoded = common::to_string(&bytes);
5764 match serde_json::from_str(&encoded) {
5765 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5766 Err(error) => {
5767 dlg.response_json_decode_error(&encoded, &error);
5768 return Err(common::Error::JsonDecodeError(
5769 encoded.to_string(),
5770 error,
5771 ));
5772 }
5773 }
5774 };
5775
5776 dlg.finished(true);
5777 return Ok(response);
5778 }
5779 }
5780 }
5781 }
5782
5783 /// The name of the operation resource.
5784 ///
5785 /// Sets the *name* path property to the given value.
5786 ///
5787 /// Even though the property as already been set when instantiating this call,
5788 /// we provide this method for API completeness.
5789 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainOperationGetCall<'a, C> {
5790 self._name = new_value.to_string();
5791 self
5792 }
5793 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5794 /// while executing the actual API request.
5795 ///
5796 /// ````text
5797 /// It should be used to handle progress information, and to implement a certain level of resilience.
5798 /// ````
5799 ///
5800 /// Sets the *delegate* property to the given value.
5801 pub fn delegate(
5802 mut self,
5803 new_value: &'a mut dyn common::Delegate,
5804 ) -> ProjectSiteCustomDomainOperationGetCall<'a, C> {
5805 self._delegate = Some(new_value);
5806 self
5807 }
5808
5809 /// Set any additional parameter of the query string used in the request.
5810 /// It should be used to set parameters which are not yet available through their own
5811 /// setters.
5812 ///
5813 /// Please note that this method must not be used to set any of the known parameters
5814 /// which have their own setter method. If done anyway, the request will fail.
5815 ///
5816 /// # Additional Parameters
5817 ///
5818 /// * *$.xgafv* (query-string) - V1 error format.
5819 /// * *access_token* (query-string) - OAuth access token.
5820 /// * *alt* (query-string) - Data format for response.
5821 /// * *callback* (query-string) - JSONP
5822 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5823 /// * *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.
5824 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5825 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5826 /// * *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.
5827 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5828 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5829 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainOperationGetCall<'a, C>
5830 where
5831 T: AsRef<str>,
5832 {
5833 self._additional_params
5834 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5835 self
5836 }
5837
5838 /// Identifies the authorization scope for the method you are building.
5839 ///
5840 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5841 /// [`Scope::FirebaseReadonly`].
5842 ///
5843 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5844 /// tokens for more than one scope.
5845 ///
5846 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5847 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5848 /// sufficient, a read-write scope will do as well.
5849 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainOperationGetCall<'a, C>
5850 where
5851 St: AsRef<str>,
5852 {
5853 self._scopes.insert(String::from(scope.as_ref()));
5854 self
5855 }
5856 /// Identifies the authorization scope(s) for the method you are building.
5857 ///
5858 /// See [`Self::add_scope()`] for details.
5859 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainOperationGetCall<'a, C>
5860 where
5861 I: IntoIterator<Item = St>,
5862 St: AsRef<str>,
5863 {
5864 self._scopes
5865 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5866 self
5867 }
5868
5869 /// Removes all scopes, and no default scope will be used either.
5870 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5871 /// for details).
5872 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainOperationGetCall<'a, C> {
5873 self._scopes.clear();
5874 self
5875 }
5876}
5877
5878/// Lists operations that match the specified filter in the request.
5879///
5880/// A builder for the *sites.customDomains.operations.list* method supported by a *project* resource.
5881/// It is not used directly, but through a [`ProjectMethods`] instance.
5882///
5883/// # Example
5884///
5885/// Instantiate a resource method builder
5886///
5887/// ```test_harness,no_run
5888/// # extern crate hyper;
5889/// # extern crate hyper_rustls;
5890/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
5891/// # async fn dox() {
5892/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5893///
5894/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5895/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5896/// # .with_native_roots()
5897/// # .unwrap()
5898/// # .https_only()
5899/// # .enable_http2()
5900/// # .build();
5901///
5902/// # let executor = hyper_util::rt::TokioExecutor::new();
5903/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5904/// # secret,
5905/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5906/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5907/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5908/// # ),
5909/// # ).build().await.unwrap();
5910///
5911/// # let client = hyper_util::client::legacy::Client::builder(
5912/// # hyper_util::rt::TokioExecutor::new()
5913/// # )
5914/// # .build(
5915/// # hyper_rustls::HttpsConnectorBuilder::new()
5916/// # .with_native_roots()
5917/// # .unwrap()
5918/// # .https_or_http()
5919/// # .enable_http2()
5920/// # .build()
5921/// # );
5922/// # let mut hub = FirebaseHosting::new(client, auth);
5923/// // You can configure optional parameters by calling the respective setters at will, and
5924/// // execute the final call using `doit()`.
5925/// // Values shown here are possibly random and not representative !
5926/// let result = hub.projects().sites_custom_domains_operations_list("name")
5927/// .return_partial_success(true)
5928/// .page_token("ipsum")
5929/// .page_size(-7)
5930/// .filter("gubergren")
5931/// .doit().await;
5932/// # }
5933/// ```
5934pub struct ProjectSiteCustomDomainOperationListCall<'a, C>
5935where
5936 C: 'a,
5937{
5938 hub: &'a FirebaseHosting<C>,
5939 _name: String,
5940 _return_partial_success: Option<bool>,
5941 _page_token: Option<String>,
5942 _page_size: Option<i32>,
5943 _filter: Option<String>,
5944 _delegate: Option<&'a mut dyn common::Delegate>,
5945 _additional_params: HashMap<String, String>,
5946 _scopes: BTreeSet<String>,
5947}
5948
5949impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainOperationListCall<'a, C> {}
5950
5951impl<'a, C> ProjectSiteCustomDomainOperationListCall<'a, C>
5952where
5953 C: common::Connector,
5954{
5955 /// Perform the operation you have build so far.
5956 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
5957 use std::borrow::Cow;
5958 use std::io::{Read, Seek};
5959
5960 use common::{url::Params, ToParts};
5961 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5962
5963 let mut dd = common::DefaultDelegate;
5964 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5965 dlg.begin(common::MethodInfo {
5966 id: "firebasehosting.projects.sites.customDomains.operations.list",
5967 http_method: hyper::Method::GET,
5968 });
5969
5970 for &field in [
5971 "alt",
5972 "name",
5973 "returnPartialSuccess",
5974 "pageToken",
5975 "pageSize",
5976 "filter",
5977 ]
5978 .iter()
5979 {
5980 if self._additional_params.contains_key(field) {
5981 dlg.finished(false);
5982 return Err(common::Error::FieldClash(field));
5983 }
5984 }
5985
5986 let mut params = Params::with_capacity(7 + self._additional_params.len());
5987 params.push("name", self._name);
5988 if let Some(value) = self._return_partial_success.as_ref() {
5989 params.push("returnPartialSuccess", value.to_string());
5990 }
5991 if let Some(value) = self._page_token.as_ref() {
5992 params.push("pageToken", value);
5993 }
5994 if let Some(value) = self._page_size.as_ref() {
5995 params.push("pageSize", value.to_string());
5996 }
5997 if let Some(value) = self._filter.as_ref() {
5998 params.push("filter", value);
5999 }
6000
6001 params.extend(self._additional_params.iter());
6002
6003 params.push("alt", "json");
6004 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/operations";
6005 if self._scopes.is_empty() {
6006 self._scopes
6007 .insert(Scope::FirebaseReadonly.as_ref().to_string());
6008 }
6009
6010 #[allow(clippy::single_element_loop)]
6011 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6012 url = params.uri_replacement(url, param_name, find_this, true);
6013 }
6014 {
6015 let to_remove = ["name"];
6016 params.remove_params(&to_remove);
6017 }
6018
6019 let url = params.parse_with_url(&url);
6020
6021 loop {
6022 let token = match self
6023 .hub
6024 .auth
6025 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6026 .await
6027 {
6028 Ok(token) => token,
6029 Err(e) => match dlg.token(e) {
6030 Ok(token) => token,
6031 Err(e) => {
6032 dlg.finished(false);
6033 return Err(common::Error::MissingToken(e));
6034 }
6035 },
6036 };
6037 let mut req_result = {
6038 let client = &self.hub.client;
6039 dlg.pre_request();
6040 let mut req_builder = hyper::Request::builder()
6041 .method(hyper::Method::GET)
6042 .uri(url.as_str())
6043 .header(USER_AGENT, self.hub._user_agent.clone());
6044
6045 if let Some(token) = token.as_ref() {
6046 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6047 }
6048
6049 let request = req_builder
6050 .header(CONTENT_LENGTH, 0_u64)
6051 .body(common::to_body::<String>(None));
6052
6053 client.request(request.unwrap()).await
6054 };
6055
6056 match req_result {
6057 Err(err) => {
6058 if let common::Retry::After(d) = dlg.http_error(&err) {
6059 sleep(d).await;
6060 continue;
6061 }
6062 dlg.finished(false);
6063 return Err(common::Error::HttpError(err));
6064 }
6065 Ok(res) => {
6066 let (mut parts, body) = res.into_parts();
6067 let mut body = common::Body::new(body);
6068 if !parts.status.is_success() {
6069 let bytes = common::to_bytes(body).await.unwrap_or_default();
6070 let error = serde_json::from_str(&common::to_string(&bytes));
6071 let response = common::to_response(parts, bytes.into());
6072
6073 if let common::Retry::After(d) =
6074 dlg.http_failure(&response, error.as_ref().ok())
6075 {
6076 sleep(d).await;
6077 continue;
6078 }
6079
6080 dlg.finished(false);
6081
6082 return Err(match error {
6083 Ok(value) => common::Error::BadRequest(value),
6084 _ => common::Error::Failure(response),
6085 });
6086 }
6087 let response = {
6088 let bytes = common::to_bytes(body).await.unwrap_or_default();
6089 let encoded = common::to_string(&bytes);
6090 match serde_json::from_str(&encoded) {
6091 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6092 Err(error) => {
6093 dlg.response_json_decode_error(&encoded, &error);
6094 return Err(common::Error::JsonDecodeError(
6095 encoded.to_string(),
6096 error,
6097 ));
6098 }
6099 }
6100 };
6101
6102 dlg.finished(true);
6103 return Ok(response);
6104 }
6105 }
6106 }
6107 }
6108
6109 /// The name of the operation's parent resource.
6110 ///
6111 /// Sets the *name* path property to the given value.
6112 ///
6113 /// Even though the property as already been set when instantiating this call,
6114 /// we provide this method for API completeness.
6115 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
6116 self._name = new_value.to_string();
6117 self
6118 }
6119 /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
6120 ///
6121 /// Sets the *return partial success* query property to the given value.
6122 pub fn return_partial_success(
6123 mut self,
6124 new_value: bool,
6125 ) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
6126 self._return_partial_success = Some(new_value);
6127 self
6128 }
6129 /// The standard list page token.
6130 ///
6131 /// Sets the *page token* query property to the given value.
6132 pub fn page_token(
6133 mut self,
6134 new_value: &str,
6135 ) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
6136 self._page_token = Some(new_value.to_string());
6137 self
6138 }
6139 /// The standard list page size.
6140 ///
6141 /// Sets the *page size* query property to the given value.
6142 pub fn page_size(mut self, new_value: i32) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
6143 self._page_size = Some(new_value);
6144 self
6145 }
6146 /// The standard list filter.
6147 ///
6148 /// Sets the *filter* query property to the given value.
6149 pub fn filter(mut self, new_value: &str) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
6150 self._filter = Some(new_value.to_string());
6151 self
6152 }
6153 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6154 /// while executing the actual API request.
6155 ///
6156 /// ````text
6157 /// It should be used to handle progress information, and to implement a certain level of resilience.
6158 /// ````
6159 ///
6160 /// Sets the *delegate* property to the given value.
6161 pub fn delegate(
6162 mut self,
6163 new_value: &'a mut dyn common::Delegate,
6164 ) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
6165 self._delegate = Some(new_value);
6166 self
6167 }
6168
6169 /// Set any additional parameter of the query string used in the request.
6170 /// It should be used to set parameters which are not yet available through their own
6171 /// setters.
6172 ///
6173 /// Please note that this method must not be used to set any of the known parameters
6174 /// which have their own setter method. If done anyway, the request will fail.
6175 ///
6176 /// # Additional Parameters
6177 ///
6178 /// * *$.xgafv* (query-string) - V1 error format.
6179 /// * *access_token* (query-string) - OAuth access token.
6180 /// * *alt* (query-string) - Data format for response.
6181 /// * *callback* (query-string) - JSONP
6182 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6183 /// * *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.
6184 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6185 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6186 /// * *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.
6187 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6188 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6189 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainOperationListCall<'a, C>
6190 where
6191 T: AsRef<str>,
6192 {
6193 self._additional_params
6194 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6195 self
6196 }
6197
6198 /// Identifies the authorization scope for the method you are building.
6199 ///
6200 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6201 /// [`Scope::FirebaseReadonly`].
6202 ///
6203 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6204 /// tokens for more than one scope.
6205 ///
6206 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6207 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6208 /// sufficient, a read-write scope will do as well.
6209 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainOperationListCall<'a, C>
6210 where
6211 St: AsRef<str>,
6212 {
6213 self._scopes.insert(String::from(scope.as_ref()));
6214 self
6215 }
6216 /// Identifies the authorization scope(s) for the method you are building.
6217 ///
6218 /// See [`Self::add_scope()`] for details.
6219 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainOperationListCall<'a, C>
6220 where
6221 I: IntoIterator<Item = St>,
6222 St: AsRef<str>,
6223 {
6224 self._scopes
6225 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6226 self
6227 }
6228
6229 /// Removes all scopes, and no default scope will be used either.
6230 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6231 /// for details).
6232 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainOperationListCall<'a, C> {
6233 self._scopes.clear();
6234 self
6235 }
6236}
6237
6238/// Creates a `CustomDomain`.
6239///
6240/// A builder for the *sites.customDomains.create* method supported by a *project* resource.
6241/// It is not used directly, but through a [`ProjectMethods`] instance.
6242///
6243/// # Example
6244///
6245/// Instantiate a resource method builder
6246///
6247/// ```test_harness,no_run
6248/// # extern crate hyper;
6249/// # extern crate hyper_rustls;
6250/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
6251/// use firebasehosting1_beta1::api::CustomDomain;
6252/// # async fn dox() {
6253/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6254///
6255/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6256/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6257/// # .with_native_roots()
6258/// # .unwrap()
6259/// # .https_only()
6260/// # .enable_http2()
6261/// # .build();
6262///
6263/// # let executor = hyper_util::rt::TokioExecutor::new();
6264/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6265/// # secret,
6266/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6267/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6268/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6269/// # ),
6270/// # ).build().await.unwrap();
6271///
6272/// # let client = hyper_util::client::legacy::Client::builder(
6273/// # hyper_util::rt::TokioExecutor::new()
6274/// # )
6275/// # .build(
6276/// # hyper_rustls::HttpsConnectorBuilder::new()
6277/// # .with_native_roots()
6278/// # .unwrap()
6279/// # .https_or_http()
6280/// # .enable_http2()
6281/// # .build()
6282/// # );
6283/// # let mut hub = FirebaseHosting::new(client, auth);
6284/// // As the method needs a request, you would usually fill it with the desired information
6285/// // into the respective structure. Some of the parts shown here might not be applicable !
6286/// // Values shown here are possibly random and not representative !
6287/// let mut req = CustomDomain::default();
6288///
6289/// // You can configure optional parameters by calling the respective setters at will, and
6290/// // execute the final call using `doit()`.
6291/// // Values shown here are possibly random and not representative !
6292/// let result = hub.projects().sites_custom_domains_create(req, "parent")
6293/// .validate_only(false)
6294/// .custom_domain_id("Lorem")
6295/// .doit().await;
6296/// # }
6297/// ```
6298pub struct ProjectSiteCustomDomainCreateCall<'a, C>
6299where
6300 C: 'a,
6301{
6302 hub: &'a FirebaseHosting<C>,
6303 _request: CustomDomain,
6304 _parent: String,
6305 _validate_only: Option<bool>,
6306 _custom_domain_id: Option<String>,
6307 _delegate: Option<&'a mut dyn common::Delegate>,
6308 _additional_params: HashMap<String, String>,
6309 _scopes: BTreeSet<String>,
6310}
6311
6312impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainCreateCall<'a, C> {}
6313
6314impl<'a, C> ProjectSiteCustomDomainCreateCall<'a, C>
6315where
6316 C: common::Connector,
6317{
6318 /// Perform the operation you have build so far.
6319 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6320 use std::borrow::Cow;
6321 use std::io::{Read, Seek};
6322
6323 use common::{url::Params, ToParts};
6324 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6325
6326 let mut dd = common::DefaultDelegate;
6327 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6328 dlg.begin(common::MethodInfo {
6329 id: "firebasehosting.projects.sites.customDomains.create",
6330 http_method: hyper::Method::POST,
6331 });
6332
6333 for &field in ["alt", "parent", "validateOnly", "customDomainId"].iter() {
6334 if self._additional_params.contains_key(field) {
6335 dlg.finished(false);
6336 return Err(common::Error::FieldClash(field));
6337 }
6338 }
6339
6340 let mut params = Params::with_capacity(6 + self._additional_params.len());
6341 params.push("parent", self._parent);
6342 if let Some(value) = self._validate_only.as_ref() {
6343 params.push("validateOnly", value.to_string());
6344 }
6345 if let Some(value) = self._custom_domain_id.as_ref() {
6346 params.push("customDomainId", value);
6347 }
6348
6349 params.extend(self._additional_params.iter());
6350
6351 params.push("alt", "json");
6352 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/customDomains";
6353 if self._scopes.is_empty() {
6354 self._scopes
6355 .insert(Scope::CloudPlatform.as_ref().to_string());
6356 }
6357
6358 #[allow(clippy::single_element_loop)]
6359 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6360 url = params.uri_replacement(url, param_name, find_this, true);
6361 }
6362 {
6363 let to_remove = ["parent"];
6364 params.remove_params(&to_remove);
6365 }
6366
6367 let url = params.parse_with_url(&url);
6368
6369 let mut json_mime_type = mime::APPLICATION_JSON;
6370 let mut request_value_reader = {
6371 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6372 common::remove_json_null_values(&mut value);
6373 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6374 serde_json::to_writer(&mut dst, &value).unwrap();
6375 dst
6376 };
6377 let request_size = request_value_reader
6378 .seek(std::io::SeekFrom::End(0))
6379 .unwrap();
6380 request_value_reader
6381 .seek(std::io::SeekFrom::Start(0))
6382 .unwrap();
6383
6384 loop {
6385 let token = match self
6386 .hub
6387 .auth
6388 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6389 .await
6390 {
6391 Ok(token) => token,
6392 Err(e) => match dlg.token(e) {
6393 Ok(token) => token,
6394 Err(e) => {
6395 dlg.finished(false);
6396 return Err(common::Error::MissingToken(e));
6397 }
6398 },
6399 };
6400 request_value_reader
6401 .seek(std::io::SeekFrom::Start(0))
6402 .unwrap();
6403 let mut req_result = {
6404 let client = &self.hub.client;
6405 dlg.pre_request();
6406 let mut req_builder = hyper::Request::builder()
6407 .method(hyper::Method::POST)
6408 .uri(url.as_str())
6409 .header(USER_AGENT, self.hub._user_agent.clone());
6410
6411 if let Some(token) = token.as_ref() {
6412 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6413 }
6414
6415 let request = req_builder
6416 .header(CONTENT_TYPE, json_mime_type.to_string())
6417 .header(CONTENT_LENGTH, request_size as u64)
6418 .body(common::to_body(
6419 request_value_reader.get_ref().clone().into(),
6420 ));
6421
6422 client.request(request.unwrap()).await
6423 };
6424
6425 match req_result {
6426 Err(err) => {
6427 if let common::Retry::After(d) = dlg.http_error(&err) {
6428 sleep(d).await;
6429 continue;
6430 }
6431 dlg.finished(false);
6432 return Err(common::Error::HttpError(err));
6433 }
6434 Ok(res) => {
6435 let (mut parts, body) = res.into_parts();
6436 let mut body = common::Body::new(body);
6437 if !parts.status.is_success() {
6438 let bytes = common::to_bytes(body).await.unwrap_or_default();
6439 let error = serde_json::from_str(&common::to_string(&bytes));
6440 let response = common::to_response(parts, bytes.into());
6441
6442 if let common::Retry::After(d) =
6443 dlg.http_failure(&response, error.as_ref().ok())
6444 {
6445 sleep(d).await;
6446 continue;
6447 }
6448
6449 dlg.finished(false);
6450
6451 return Err(match error {
6452 Ok(value) => common::Error::BadRequest(value),
6453 _ => common::Error::Failure(response),
6454 });
6455 }
6456 let response = {
6457 let bytes = common::to_bytes(body).await.unwrap_or_default();
6458 let encoded = common::to_string(&bytes);
6459 match serde_json::from_str(&encoded) {
6460 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6461 Err(error) => {
6462 dlg.response_json_decode_error(&encoded, &error);
6463 return Err(common::Error::JsonDecodeError(
6464 encoded.to_string(),
6465 error,
6466 ));
6467 }
6468 }
6469 };
6470
6471 dlg.finished(true);
6472 return Ok(response);
6473 }
6474 }
6475 }
6476 }
6477
6478 ///
6479 /// Sets the *request* property to the given value.
6480 ///
6481 /// Even though the property as already been set when instantiating this call,
6482 /// we provide this method for API completeness.
6483 pub fn request(mut self, new_value: CustomDomain) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6484 self._request = new_value;
6485 self
6486 }
6487 /// Required. The custom domain's parent, specifically a Firebase Hosting `Site`.
6488 ///
6489 /// Sets the *parent* path property to the given value.
6490 ///
6491 /// Even though the property as already been set when instantiating this call,
6492 /// we provide this method for API completeness.
6493 pub fn parent(mut self, new_value: &str) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6494 self._parent = new_value.to_string();
6495 self
6496 }
6497 /// If true, Hosting validates that it's possible to complete your request but doesn't actually create a new `CustomDomain`.
6498 ///
6499 /// Sets the *validate only* query property to the given value.
6500 pub fn validate_only(mut self, new_value: bool) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6501 self._validate_only = Some(new_value);
6502 self
6503 }
6504 /// Required. The ID of the `CustomDomain`, which is the domain name you'd like to use with Firebase Hosting.
6505 ///
6506 /// Sets the *custom domain id* query property to the given value.
6507 pub fn custom_domain_id(mut self, new_value: &str) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6508 self._custom_domain_id = Some(new_value.to_string());
6509 self
6510 }
6511 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6512 /// while executing the actual API request.
6513 ///
6514 /// ````text
6515 /// It should be used to handle progress information, and to implement a certain level of resilience.
6516 /// ````
6517 ///
6518 /// Sets the *delegate* property to the given value.
6519 pub fn delegate(
6520 mut self,
6521 new_value: &'a mut dyn common::Delegate,
6522 ) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6523 self._delegate = Some(new_value);
6524 self
6525 }
6526
6527 /// Set any additional parameter of the query string used in the request.
6528 /// It should be used to set parameters which are not yet available through their own
6529 /// setters.
6530 ///
6531 /// Please note that this method must not be used to set any of the known parameters
6532 /// which have their own setter method. If done anyway, the request will fail.
6533 ///
6534 /// # Additional Parameters
6535 ///
6536 /// * *$.xgafv* (query-string) - V1 error format.
6537 /// * *access_token* (query-string) - OAuth access token.
6538 /// * *alt* (query-string) - Data format for response.
6539 /// * *callback* (query-string) - JSONP
6540 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6541 /// * *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.
6542 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6543 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6544 /// * *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.
6545 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6546 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6547 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainCreateCall<'a, C>
6548 where
6549 T: AsRef<str>,
6550 {
6551 self._additional_params
6552 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6553 self
6554 }
6555
6556 /// Identifies the authorization scope for the method you are building.
6557 ///
6558 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6559 /// [`Scope::CloudPlatform`].
6560 ///
6561 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6562 /// tokens for more than one scope.
6563 ///
6564 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6565 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6566 /// sufficient, a read-write scope will do as well.
6567 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainCreateCall<'a, C>
6568 where
6569 St: AsRef<str>,
6570 {
6571 self._scopes.insert(String::from(scope.as_ref()));
6572 self
6573 }
6574 /// Identifies the authorization scope(s) for the method you are building.
6575 ///
6576 /// See [`Self::add_scope()`] for details.
6577 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainCreateCall<'a, C>
6578 where
6579 I: IntoIterator<Item = St>,
6580 St: AsRef<str>,
6581 {
6582 self._scopes
6583 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6584 self
6585 }
6586
6587 /// Removes all scopes, and no default scope will be used either.
6588 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6589 /// for details).
6590 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainCreateCall<'a, C> {
6591 self._scopes.clear();
6592 self
6593 }
6594}
6595
6596/// Deletes the specified `CustomDomain`.
6597///
6598/// A builder for the *sites.customDomains.delete* method supported by a *project* resource.
6599/// It is not used directly, but through a [`ProjectMethods`] instance.
6600///
6601/// # Example
6602///
6603/// Instantiate a resource method builder
6604///
6605/// ```test_harness,no_run
6606/// # extern crate hyper;
6607/// # extern crate hyper_rustls;
6608/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
6609/// # async fn dox() {
6610/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6611///
6612/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6613/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6614/// # .with_native_roots()
6615/// # .unwrap()
6616/// # .https_only()
6617/// # .enable_http2()
6618/// # .build();
6619///
6620/// # let executor = hyper_util::rt::TokioExecutor::new();
6621/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6622/// # secret,
6623/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6624/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6625/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6626/// # ),
6627/// # ).build().await.unwrap();
6628///
6629/// # let client = hyper_util::client::legacy::Client::builder(
6630/// # hyper_util::rt::TokioExecutor::new()
6631/// # )
6632/// # .build(
6633/// # hyper_rustls::HttpsConnectorBuilder::new()
6634/// # .with_native_roots()
6635/// # .unwrap()
6636/// # .https_or_http()
6637/// # .enable_http2()
6638/// # .build()
6639/// # );
6640/// # let mut hub = FirebaseHosting::new(client, auth);
6641/// // You can configure optional parameters by calling the respective setters at will, and
6642/// // execute the final call using `doit()`.
6643/// // Values shown here are possibly random and not representative !
6644/// let result = hub.projects().sites_custom_domains_delete("name")
6645/// .validate_only(false)
6646/// .etag("sed")
6647/// .allow_missing(false)
6648/// .doit().await;
6649/// # }
6650/// ```
6651pub struct ProjectSiteCustomDomainDeleteCall<'a, C>
6652where
6653 C: 'a,
6654{
6655 hub: &'a FirebaseHosting<C>,
6656 _name: String,
6657 _validate_only: Option<bool>,
6658 _etag: Option<String>,
6659 _allow_missing: Option<bool>,
6660 _delegate: Option<&'a mut dyn common::Delegate>,
6661 _additional_params: HashMap<String, String>,
6662 _scopes: BTreeSet<String>,
6663}
6664
6665impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainDeleteCall<'a, C> {}
6666
6667impl<'a, C> ProjectSiteCustomDomainDeleteCall<'a, C>
6668where
6669 C: common::Connector,
6670{
6671 /// Perform the operation you have build so far.
6672 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6673 use std::borrow::Cow;
6674 use std::io::{Read, Seek};
6675
6676 use common::{url::Params, ToParts};
6677 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6678
6679 let mut dd = common::DefaultDelegate;
6680 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6681 dlg.begin(common::MethodInfo {
6682 id: "firebasehosting.projects.sites.customDomains.delete",
6683 http_method: hyper::Method::DELETE,
6684 });
6685
6686 for &field in ["alt", "name", "validateOnly", "etag", "allowMissing"].iter() {
6687 if self._additional_params.contains_key(field) {
6688 dlg.finished(false);
6689 return Err(common::Error::FieldClash(field));
6690 }
6691 }
6692
6693 let mut params = Params::with_capacity(6 + self._additional_params.len());
6694 params.push("name", self._name);
6695 if let Some(value) = self._validate_only.as_ref() {
6696 params.push("validateOnly", value.to_string());
6697 }
6698 if let Some(value) = self._etag.as_ref() {
6699 params.push("etag", value);
6700 }
6701 if let Some(value) = self._allow_missing.as_ref() {
6702 params.push("allowMissing", value.to_string());
6703 }
6704
6705 params.extend(self._additional_params.iter());
6706
6707 params.push("alt", "json");
6708 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6709 if self._scopes.is_empty() {
6710 self._scopes
6711 .insert(Scope::CloudPlatform.as_ref().to_string());
6712 }
6713
6714 #[allow(clippy::single_element_loop)]
6715 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6716 url = params.uri_replacement(url, param_name, find_this, true);
6717 }
6718 {
6719 let to_remove = ["name"];
6720 params.remove_params(&to_remove);
6721 }
6722
6723 let url = params.parse_with_url(&url);
6724
6725 loop {
6726 let token = match self
6727 .hub
6728 .auth
6729 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6730 .await
6731 {
6732 Ok(token) => token,
6733 Err(e) => match dlg.token(e) {
6734 Ok(token) => token,
6735 Err(e) => {
6736 dlg.finished(false);
6737 return Err(common::Error::MissingToken(e));
6738 }
6739 },
6740 };
6741 let mut req_result = {
6742 let client = &self.hub.client;
6743 dlg.pre_request();
6744 let mut req_builder = hyper::Request::builder()
6745 .method(hyper::Method::DELETE)
6746 .uri(url.as_str())
6747 .header(USER_AGENT, self.hub._user_agent.clone());
6748
6749 if let Some(token) = token.as_ref() {
6750 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6751 }
6752
6753 let request = req_builder
6754 .header(CONTENT_LENGTH, 0_u64)
6755 .body(common::to_body::<String>(None));
6756
6757 client.request(request.unwrap()).await
6758 };
6759
6760 match req_result {
6761 Err(err) => {
6762 if let common::Retry::After(d) = dlg.http_error(&err) {
6763 sleep(d).await;
6764 continue;
6765 }
6766 dlg.finished(false);
6767 return Err(common::Error::HttpError(err));
6768 }
6769 Ok(res) => {
6770 let (mut parts, body) = res.into_parts();
6771 let mut body = common::Body::new(body);
6772 if !parts.status.is_success() {
6773 let bytes = common::to_bytes(body).await.unwrap_or_default();
6774 let error = serde_json::from_str(&common::to_string(&bytes));
6775 let response = common::to_response(parts, bytes.into());
6776
6777 if let common::Retry::After(d) =
6778 dlg.http_failure(&response, error.as_ref().ok())
6779 {
6780 sleep(d).await;
6781 continue;
6782 }
6783
6784 dlg.finished(false);
6785
6786 return Err(match error {
6787 Ok(value) => common::Error::BadRequest(value),
6788 _ => common::Error::Failure(response),
6789 });
6790 }
6791 let response = {
6792 let bytes = common::to_bytes(body).await.unwrap_or_default();
6793 let encoded = common::to_string(&bytes);
6794 match serde_json::from_str(&encoded) {
6795 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6796 Err(error) => {
6797 dlg.response_json_decode_error(&encoded, &error);
6798 return Err(common::Error::JsonDecodeError(
6799 encoded.to_string(),
6800 error,
6801 ));
6802 }
6803 }
6804 };
6805
6806 dlg.finished(true);
6807 return Ok(response);
6808 }
6809 }
6810 }
6811 }
6812
6813 /// Required. The name of the `CustomDomain` to delete.
6814 ///
6815 /// Sets the *name* path property to the given value.
6816 ///
6817 /// Even though the property as already been set when instantiating this call,
6818 /// we provide this method for API completeness.
6819 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6820 self._name = new_value.to_string();
6821 self
6822 }
6823 /// If true, Hosting validates that it's possible to complete your request but doesn't actually delete the `CustomDomain`.
6824 ///
6825 /// Sets the *validate only* query property to the given value.
6826 pub fn validate_only(mut self, new_value: bool) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6827 self._validate_only = Some(new_value);
6828 self
6829 }
6830 /// 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.
6831 ///
6832 /// Sets the *etag* query property to the given value.
6833 pub fn etag(mut self, new_value: &str) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6834 self._etag = Some(new_value.to_string());
6835 self
6836 }
6837 /// If true, the request succeeds even if the `CustomDomain` doesn't exist.
6838 ///
6839 /// Sets the *allow missing* query property to the given value.
6840 pub fn allow_missing(mut self, new_value: bool) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6841 self._allow_missing = Some(new_value);
6842 self
6843 }
6844 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6845 /// while executing the actual API request.
6846 ///
6847 /// ````text
6848 /// It should be used to handle progress information, and to implement a certain level of resilience.
6849 /// ````
6850 ///
6851 /// Sets the *delegate* property to the given value.
6852 pub fn delegate(
6853 mut self,
6854 new_value: &'a mut dyn common::Delegate,
6855 ) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6856 self._delegate = Some(new_value);
6857 self
6858 }
6859
6860 /// Set any additional parameter of the query string used in the request.
6861 /// It should be used to set parameters which are not yet available through their own
6862 /// setters.
6863 ///
6864 /// Please note that this method must not be used to set any of the known parameters
6865 /// which have their own setter method. If done anyway, the request will fail.
6866 ///
6867 /// # Additional Parameters
6868 ///
6869 /// * *$.xgafv* (query-string) - V1 error format.
6870 /// * *access_token* (query-string) - OAuth access token.
6871 /// * *alt* (query-string) - Data format for response.
6872 /// * *callback* (query-string) - JSONP
6873 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6874 /// * *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.
6875 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6876 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6877 /// * *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.
6878 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6879 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6880 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainDeleteCall<'a, C>
6881 where
6882 T: AsRef<str>,
6883 {
6884 self._additional_params
6885 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6886 self
6887 }
6888
6889 /// Identifies the authorization scope for the method you are building.
6890 ///
6891 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6892 /// [`Scope::CloudPlatform`].
6893 ///
6894 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6895 /// tokens for more than one scope.
6896 ///
6897 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6898 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6899 /// sufficient, a read-write scope will do as well.
6900 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainDeleteCall<'a, C>
6901 where
6902 St: AsRef<str>,
6903 {
6904 self._scopes.insert(String::from(scope.as_ref()));
6905 self
6906 }
6907 /// Identifies the authorization scope(s) for the method you are building.
6908 ///
6909 /// See [`Self::add_scope()`] for details.
6910 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainDeleteCall<'a, C>
6911 where
6912 I: IntoIterator<Item = St>,
6913 St: AsRef<str>,
6914 {
6915 self._scopes
6916 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6917 self
6918 }
6919
6920 /// Removes all scopes, and no default scope will be used either.
6921 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6922 /// for details).
6923 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainDeleteCall<'a, C> {
6924 self._scopes.clear();
6925 self
6926 }
6927}
6928
6929/// Gets the specified `CustomDomain`.
6930///
6931/// A builder for the *sites.customDomains.get* method supported by a *project* resource.
6932/// It is not used directly, but through a [`ProjectMethods`] instance.
6933///
6934/// # Example
6935///
6936/// Instantiate a resource method builder
6937///
6938/// ```test_harness,no_run
6939/// # extern crate hyper;
6940/// # extern crate hyper_rustls;
6941/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
6942/// # async fn dox() {
6943/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6944///
6945/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6946/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6947/// # .with_native_roots()
6948/// # .unwrap()
6949/// # .https_only()
6950/// # .enable_http2()
6951/// # .build();
6952///
6953/// # let executor = hyper_util::rt::TokioExecutor::new();
6954/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6955/// # secret,
6956/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6957/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6958/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6959/// # ),
6960/// # ).build().await.unwrap();
6961///
6962/// # let client = hyper_util::client::legacy::Client::builder(
6963/// # hyper_util::rt::TokioExecutor::new()
6964/// # )
6965/// # .build(
6966/// # hyper_rustls::HttpsConnectorBuilder::new()
6967/// # .with_native_roots()
6968/// # .unwrap()
6969/// # .https_or_http()
6970/// # .enable_http2()
6971/// # .build()
6972/// # );
6973/// # let mut hub = FirebaseHosting::new(client, auth);
6974/// // You can configure optional parameters by calling the respective setters at will, and
6975/// // execute the final call using `doit()`.
6976/// // Values shown here are possibly random and not representative !
6977/// let result = hub.projects().sites_custom_domains_get("name")
6978/// .doit().await;
6979/// # }
6980/// ```
6981pub struct ProjectSiteCustomDomainGetCall<'a, C>
6982where
6983 C: 'a,
6984{
6985 hub: &'a FirebaseHosting<C>,
6986 _name: String,
6987 _delegate: Option<&'a mut dyn common::Delegate>,
6988 _additional_params: HashMap<String, String>,
6989 _scopes: BTreeSet<String>,
6990}
6991
6992impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainGetCall<'a, C> {}
6993
6994impl<'a, C> ProjectSiteCustomDomainGetCall<'a, C>
6995where
6996 C: common::Connector,
6997{
6998 /// Perform the operation you have build so far.
6999 pub async fn doit(mut self) -> common::Result<(common::Response, CustomDomain)> {
7000 use std::borrow::Cow;
7001 use std::io::{Read, Seek};
7002
7003 use common::{url::Params, ToParts};
7004 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7005
7006 let mut dd = common::DefaultDelegate;
7007 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7008 dlg.begin(common::MethodInfo {
7009 id: "firebasehosting.projects.sites.customDomains.get",
7010 http_method: hyper::Method::GET,
7011 });
7012
7013 for &field in ["alt", "name"].iter() {
7014 if self._additional_params.contains_key(field) {
7015 dlg.finished(false);
7016 return Err(common::Error::FieldClash(field));
7017 }
7018 }
7019
7020 let mut params = Params::with_capacity(3 + self._additional_params.len());
7021 params.push("name", self._name);
7022
7023 params.extend(self._additional_params.iter());
7024
7025 params.push("alt", "json");
7026 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7027 if self._scopes.is_empty() {
7028 self._scopes
7029 .insert(Scope::FirebaseReadonly.as_ref().to_string());
7030 }
7031
7032 #[allow(clippy::single_element_loop)]
7033 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7034 url = params.uri_replacement(url, param_name, find_this, true);
7035 }
7036 {
7037 let to_remove = ["name"];
7038 params.remove_params(&to_remove);
7039 }
7040
7041 let url = params.parse_with_url(&url);
7042
7043 loop {
7044 let token = match self
7045 .hub
7046 .auth
7047 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7048 .await
7049 {
7050 Ok(token) => token,
7051 Err(e) => match dlg.token(e) {
7052 Ok(token) => token,
7053 Err(e) => {
7054 dlg.finished(false);
7055 return Err(common::Error::MissingToken(e));
7056 }
7057 },
7058 };
7059 let mut req_result = {
7060 let client = &self.hub.client;
7061 dlg.pre_request();
7062 let mut req_builder = hyper::Request::builder()
7063 .method(hyper::Method::GET)
7064 .uri(url.as_str())
7065 .header(USER_AGENT, self.hub._user_agent.clone());
7066
7067 if let Some(token) = token.as_ref() {
7068 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7069 }
7070
7071 let request = req_builder
7072 .header(CONTENT_LENGTH, 0_u64)
7073 .body(common::to_body::<String>(None));
7074
7075 client.request(request.unwrap()).await
7076 };
7077
7078 match req_result {
7079 Err(err) => {
7080 if let common::Retry::After(d) = dlg.http_error(&err) {
7081 sleep(d).await;
7082 continue;
7083 }
7084 dlg.finished(false);
7085 return Err(common::Error::HttpError(err));
7086 }
7087 Ok(res) => {
7088 let (mut parts, body) = res.into_parts();
7089 let mut body = common::Body::new(body);
7090 if !parts.status.is_success() {
7091 let bytes = common::to_bytes(body).await.unwrap_or_default();
7092 let error = serde_json::from_str(&common::to_string(&bytes));
7093 let response = common::to_response(parts, bytes.into());
7094
7095 if let common::Retry::After(d) =
7096 dlg.http_failure(&response, error.as_ref().ok())
7097 {
7098 sleep(d).await;
7099 continue;
7100 }
7101
7102 dlg.finished(false);
7103
7104 return Err(match error {
7105 Ok(value) => common::Error::BadRequest(value),
7106 _ => common::Error::Failure(response),
7107 });
7108 }
7109 let response = {
7110 let bytes = common::to_bytes(body).await.unwrap_or_default();
7111 let encoded = common::to_string(&bytes);
7112 match serde_json::from_str(&encoded) {
7113 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7114 Err(error) => {
7115 dlg.response_json_decode_error(&encoded, &error);
7116 return Err(common::Error::JsonDecodeError(
7117 encoded.to_string(),
7118 error,
7119 ));
7120 }
7121 }
7122 };
7123
7124 dlg.finished(true);
7125 return Ok(response);
7126 }
7127 }
7128 }
7129 }
7130
7131 /// Required. The name of the `CustomDomain` to get.
7132 ///
7133 /// Sets the *name* path property to the given value.
7134 ///
7135 /// Even though the property as already been set when instantiating this call,
7136 /// we provide this method for API completeness.
7137 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainGetCall<'a, C> {
7138 self._name = new_value.to_string();
7139 self
7140 }
7141 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7142 /// while executing the actual API request.
7143 ///
7144 /// ````text
7145 /// It should be used to handle progress information, and to implement a certain level of resilience.
7146 /// ````
7147 ///
7148 /// Sets the *delegate* property to the given value.
7149 pub fn delegate(
7150 mut self,
7151 new_value: &'a mut dyn common::Delegate,
7152 ) -> ProjectSiteCustomDomainGetCall<'a, C> {
7153 self._delegate = Some(new_value);
7154 self
7155 }
7156
7157 /// Set any additional parameter of the query string used in the request.
7158 /// It should be used to set parameters which are not yet available through their own
7159 /// setters.
7160 ///
7161 /// Please note that this method must not be used to set any of the known parameters
7162 /// which have their own setter method. If done anyway, the request will fail.
7163 ///
7164 /// # Additional Parameters
7165 ///
7166 /// * *$.xgafv* (query-string) - V1 error format.
7167 /// * *access_token* (query-string) - OAuth access token.
7168 /// * *alt* (query-string) - Data format for response.
7169 /// * *callback* (query-string) - JSONP
7170 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7171 /// * *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.
7172 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7173 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7174 /// * *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.
7175 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7176 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7177 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainGetCall<'a, C>
7178 where
7179 T: AsRef<str>,
7180 {
7181 self._additional_params
7182 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7183 self
7184 }
7185
7186 /// Identifies the authorization scope for the method you are building.
7187 ///
7188 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7189 /// [`Scope::FirebaseReadonly`].
7190 ///
7191 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7192 /// tokens for more than one scope.
7193 ///
7194 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7195 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7196 /// sufficient, a read-write scope will do as well.
7197 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainGetCall<'a, C>
7198 where
7199 St: AsRef<str>,
7200 {
7201 self._scopes.insert(String::from(scope.as_ref()));
7202 self
7203 }
7204 /// Identifies the authorization scope(s) for the method you are building.
7205 ///
7206 /// See [`Self::add_scope()`] for details.
7207 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainGetCall<'a, C>
7208 where
7209 I: IntoIterator<Item = St>,
7210 St: AsRef<str>,
7211 {
7212 self._scopes
7213 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7214 self
7215 }
7216
7217 /// Removes all scopes, and no default scope will be used either.
7218 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7219 /// for details).
7220 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainGetCall<'a, C> {
7221 self._scopes.clear();
7222 self
7223 }
7224}
7225
7226/// Lists each `CustomDomain` associated with the specified parent Hosting site. Returns `CustomDomain`s in a consistent, but undefined, order to facilitate pagination.
7227///
7228/// A builder for the *sites.customDomains.list* method supported by a *project* resource.
7229/// It is not used directly, but through a [`ProjectMethods`] instance.
7230///
7231/// # Example
7232///
7233/// Instantiate a resource method builder
7234///
7235/// ```test_harness,no_run
7236/// # extern crate hyper;
7237/// # extern crate hyper_rustls;
7238/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
7239/// # async fn dox() {
7240/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7241///
7242/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7243/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7244/// # .with_native_roots()
7245/// # .unwrap()
7246/// # .https_only()
7247/// # .enable_http2()
7248/// # .build();
7249///
7250/// # let executor = hyper_util::rt::TokioExecutor::new();
7251/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7252/// # secret,
7253/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7254/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7255/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7256/// # ),
7257/// # ).build().await.unwrap();
7258///
7259/// # let client = hyper_util::client::legacy::Client::builder(
7260/// # hyper_util::rt::TokioExecutor::new()
7261/// # )
7262/// # .build(
7263/// # hyper_rustls::HttpsConnectorBuilder::new()
7264/// # .with_native_roots()
7265/// # .unwrap()
7266/// # .https_or_http()
7267/// # .enable_http2()
7268/// # .build()
7269/// # );
7270/// # let mut hub = FirebaseHosting::new(client, auth);
7271/// // You can configure optional parameters by calling the respective setters at will, and
7272/// // execute the final call using `doit()`.
7273/// // Values shown here are possibly random and not representative !
7274/// let result = hub.projects().sites_custom_domains_list("parent")
7275/// .show_deleted(true)
7276/// .page_token("et")
7277/// .page_size(-68)
7278/// .doit().await;
7279/// # }
7280/// ```
7281pub struct ProjectSiteCustomDomainListCall<'a, C>
7282where
7283 C: 'a,
7284{
7285 hub: &'a FirebaseHosting<C>,
7286 _parent: String,
7287 _show_deleted: Option<bool>,
7288 _page_token: Option<String>,
7289 _page_size: Option<i32>,
7290 _delegate: Option<&'a mut dyn common::Delegate>,
7291 _additional_params: HashMap<String, String>,
7292 _scopes: BTreeSet<String>,
7293}
7294
7295impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainListCall<'a, C> {}
7296
7297impl<'a, C> ProjectSiteCustomDomainListCall<'a, C>
7298where
7299 C: common::Connector,
7300{
7301 /// Perform the operation you have build so far.
7302 pub async fn doit(mut self) -> common::Result<(common::Response, ListCustomDomainsResponse)> {
7303 use std::borrow::Cow;
7304 use std::io::{Read, Seek};
7305
7306 use common::{url::Params, ToParts};
7307 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7308
7309 let mut dd = common::DefaultDelegate;
7310 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7311 dlg.begin(common::MethodInfo {
7312 id: "firebasehosting.projects.sites.customDomains.list",
7313 http_method: hyper::Method::GET,
7314 });
7315
7316 for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
7317 if self._additional_params.contains_key(field) {
7318 dlg.finished(false);
7319 return Err(common::Error::FieldClash(field));
7320 }
7321 }
7322
7323 let mut params = Params::with_capacity(6 + self._additional_params.len());
7324 params.push("parent", self._parent);
7325 if let Some(value) = self._show_deleted.as_ref() {
7326 params.push("showDeleted", value.to_string());
7327 }
7328 if let Some(value) = self._page_token.as_ref() {
7329 params.push("pageToken", value);
7330 }
7331 if let Some(value) = self._page_size.as_ref() {
7332 params.push("pageSize", value.to_string());
7333 }
7334
7335 params.extend(self._additional_params.iter());
7336
7337 params.push("alt", "json");
7338 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/customDomains";
7339 if self._scopes.is_empty() {
7340 self._scopes
7341 .insert(Scope::FirebaseReadonly.as_ref().to_string());
7342 }
7343
7344 #[allow(clippy::single_element_loop)]
7345 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7346 url = params.uri_replacement(url, param_name, find_this, true);
7347 }
7348 {
7349 let to_remove = ["parent"];
7350 params.remove_params(&to_remove);
7351 }
7352
7353 let url = params.parse_with_url(&url);
7354
7355 loop {
7356 let token = match self
7357 .hub
7358 .auth
7359 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7360 .await
7361 {
7362 Ok(token) => token,
7363 Err(e) => match dlg.token(e) {
7364 Ok(token) => token,
7365 Err(e) => {
7366 dlg.finished(false);
7367 return Err(common::Error::MissingToken(e));
7368 }
7369 },
7370 };
7371 let mut req_result = {
7372 let client = &self.hub.client;
7373 dlg.pre_request();
7374 let mut req_builder = hyper::Request::builder()
7375 .method(hyper::Method::GET)
7376 .uri(url.as_str())
7377 .header(USER_AGENT, self.hub._user_agent.clone());
7378
7379 if let Some(token) = token.as_ref() {
7380 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7381 }
7382
7383 let request = req_builder
7384 .header(CONTENT_LENGTH, 0_u64)
7385 .body(common::to_body::<String>(None));
7386
7387 client.request(request.unwrap()).await
7388 };
7389
7390 match req_result {
7391 Err(err) => {
7392 if let common::Retry::After(d) = dlg.http_error(&err) {
7393 sleep(d).await;
7394 continue;
7395 }
7396 dlg.finished(false);
7397 return Err(common::Error::HttpError(err));
7398 }
7399 Ok(res) => {
7400 let (mut parts, body) = res.into_parts();
7401 let mut body = common::Body::new(body);
7402 if !parts.status.is_success() {
7403 let bytes = common::to_bytes(body).await.unwrap_or_default();
7404 let error = serde_json::from_str(&common::to_string(&bytes));
7405 let response = common::to_response(parts, bytes.into());
7406
7407 if let common::Retry::After(d) =
7408 dlg.http_failure(&response, error.as_ref().ok())
7409 {
7410 sleep(d).await;
7411 continue;
7412 }
7413
7414 dlg.finished(false);
7415
7416 return Err(match error {
7417 Ok(value) => common::Error::BadRequest(value),
7418 _ => common::Error::Failure(response),
7419 });
7420 }
7421 let response = {
7422 let bytes = common::to_bytes(body).await.unwrap_or_default();
7423 let encoded = common::to_string(&bytes);
7424 match serde_json::from_str(&encoded) {
7425 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7426 Err(error) => {
7427 dlg.response_json_decode_error(&encoded, &error);
7428 return Err(common::Error::JsonDecodeError(
7429 encoded.to_string(),
7430 error,
7431 ));
7432 }
7433 }
7434 };
7435
7436 dlg.finished(true);
7437 return Ok(response);
7438 }
7439 }
7440 }
7441 }
7442
7443 /// Required. The Firebase Hosting `Site` with `CustomDomain` entities you'd like to list.
7444 ///
7445 /// Sets the *parent* path property to the given value.
7446 ///
7447 /// Even though the property as already been set when instantiating this call,
7448 /// we provide this method for API completeness.
7449 pub fn parent(mut self, new_value: &str) -> ProjectSiteCustomDomainListCall<'a, C> {
7450 self._parent = new_value.to_string();
7451 self
7452 }
7453 /// 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.
7454 ///
7455 /// Sets the *show deleted* query property to the given value.
7456 pub fn show_deleted(mut self, new_value: bool) -> ProjectSiteCustomDomainListCall<'a, C> {
7457 self._show_deleted = Some(new_value);
7458 self
7459 }
7460 /// A token from a previous call to `ListCustomDomains` that tells the server where to resume listing.
7461 ///
7462 /// Sets the *page token* query property to the given value.
7463 pub fn page_token(mut self, new_value: &str) -> ProjectSiteCustomDomainListCall<'a, C> {
7464 self._page_token = Some(new_value.to_string());
7465 self
7466 }
7467 /// The max number of `CustomDomain` entities to return in a request. Defaults to 10.
7468 ///
7469 /// Sets the *page size* query property to the given value.
7470 pub fn page_size(mut self, new_value: i32) -> ProjectSiteCustomDomainListCall<'a, C> {
7471 self._page_size = Some(new_value);
7472 self
7473 }
7474 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7475 /// while executing the actual API request.
7476 ///
7477 /// ````text
7478 /// It should be used to handle progress information, and to implement a certain level of resilience.
7479 /// ````
7480 ///
7481 /// Sets the *delegate* property to the given value.
7482 pub fn delegate(
7483 mut self,
7484 new_value: &'a mut dyn common::Delegate,
7485 ) -> ProjectSiteCustomDomainListCall<'a, C> {
7486 self._delegate = Some(new_value);
7487 self
7488 }
7489
7490 /// Set any additional parameter of the query string used in the request.
7491 /// It should be used to set parameters which are not yet available through their own
7492 /// setters.
7493 ///
7494 /// Please note that this method must not be used to set any of the known parameters
7495 /// which have their own setter method. If done anyway, the request will fail.
7496 ///
7497 /// # Additional Parameters
7498 ///
7499 /// * *$.xgafv* (query-string) - V1 error format.
7500 /// * *access_token* (query-string) - OAuth access token.
7501 /// * *alt* (query-string) - Data format for response.
7502 /// * *callback* (query-string) - JSONP
7503 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7504 /// * *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.
7505 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7506 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7507 /// * *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.
7508 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7509 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7510 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainListCall<'a, C>
7511 where
7512 T: AsRef<str>,
7513 {
7514 self._additional_params
7515 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7516 self
7517 }
7518
7519 /// Identifies the authorization scope for the method you are building.
7520 ///
7521 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7522 /// [`Scope::FirebaseReadonly`].
7523 ///
7524 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7525 /// tokens for more than one scope.
7526 ///
7527 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7528 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7529 /// sufficient, a read-write scope will do as well.
7530 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainListCall<'a, C>
7531 where
7532 St: AsRef<str>,
7533 {
7534 self._scopes.insert(String::from(scope.as_ref()));
7535 self
7536 }
7537 /// Identifies the authorization scope(s) for the method you are building.
7538 ///
7539 /// See [`Self::add_scope()`] for details.
7540 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainListCall<'a, C>
7541 where
7542 I: IntoIterator<Item = St>,
7543 St: AsRef<str>,
7544 {
7545 self._scopes
7546 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7547 self
7548 }
7549
7550 /// Removes all scopes, and no default scope will be used either.
7551 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7552 /// for details).
7553 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainListCall<'a, C> {
7554 self._scopes.clear();
7555 self
7556 }
7557}
7558
7559/// Updates the specified `CustomDomain`.
7560///
7561/// A builder for the *sites.customDomains.patch* method supported by a *project* resource.
7562/// It is not used directly, but through a [`ProjectMethods`] instance.
7563///
7564/// # Example
7565///
7566/// Instantiate a resource method builder
7567///
7568/// ```test_harness,no_run
7569/// # extern crate hyper;
7570/// # extern crate hyper_rustls;
7571/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
7572/// use firebasehosting1_beta1::api::CustomDomain;
7573/// # async fn dox() {
7574/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7575///
7576/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7577/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7578/// # .with_native_roots()
7579/// # .unwrap()
7580/// # .https_only()
7581/// # .enable_http2()
7582/// # .build();
7583///
7584/// # let executor = hyper_util::rt::TokioExecutor::new();
7585/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7586/// # secret,
7587/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7588/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7589/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7590/// # ),
7591/// # ).build().await.unwrap();
7592///
7593/// # let client = hyper_util::client::legacy::Client::builder(
7594/// # hyper_util::rt::TokioExecutor::new()
7595/// # )
7596/// # .build(
7597/// # hyper_rustls::HttpsConnectorBuilder::new()
7598/// # .with_native_roots()
7599/// # .unwrap()
7600/// # .https_or_http()
7601/// # .enable_http2()
7602/// # .build()
7603/// # );
7604/// # let mut hub = FirebaseHosting::new(client, auth);
7605/// // As the method needs a request, you would usually fill it with the desired information
7606/// // into the respective structure. Some of the parts shown here might not be applicable !
7607/// // Values shown here are possibly random and not representative !
7608/// let mut req = CustomDomain::default();
7609///
7610/// // You can configure optional parameters by calling the respective setters at will, and
7611/// // execute the final call using `doit()`.
7612/// // Values shown here are possibly random and not representative !
7613/// let result = hub.projects().sites_custom_domains_patch(req, "name")
7614/// .validate_only(false)
7615/// .update_mask(FieldMask::new::<&str>(&[]))
7616/// .allow_missing(false)
7617/// .doit().await;
7618/// # }
7619/// ```
7620pub struct ProjectSiteCustomDomainPatchCall<'a, C>
7621where
7622 C: 'a,
7623{
7624 hub: &'a FirebaseHosting<C>,
7625 _request: CustomDomain,
7626 _name: String,
7627 _validate_only: Option<bool>,
7628 _update_mask: Option<common::FieldMask>,
7629 _allow_missing: Option<bool>,
7630 _delegate: Option<&'a mut dyn common::Delegate>,
7631 _additional_params: HashMap<String, String>,
7632 _scopes: BTreeSet<String>,
7633}
7634
7635impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainPatchCall<'a, C> {}
7636
7637impl<'a, C> ProjectSiteCustomDomainPatchCall<'a, C>
7638where
7639 C: common::Connector,
7640{
7641 /// Perform the operation you have build so far.
7642 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7643 use std::borrow::Cow;
7644 use std::io::{Read, Seek};
7645
7646 use common::{url::Params, ToParts};
7647 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7648
7649 let mut dd = common::DefaultDelegate;
7650 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7651 dlg.begin(common::MethodInfo {
7652 id: "firebasehosting.projects.sites.customDomains.patch",
7653 http_method: hyper::Method::PATCH,
7654 });
7655
7656 for &field in ["alt", "name", "validateOnly", "updateMask", "allowMissing"].iter() {
7657 if self._additional_params.contains_key(field) {
7658 dlg.finished(false);
7659 return Err(common::Error::FieldClash(field));
7660 }
7661 }
7662
7663 let mut params = Params::with_capacity(7 + self._additional_params.len());
7664 params.push("name", self._name);
7665 if let Some(value) = self._validate_only.as_ref() {
7666 params.push("validateOnly", value.to_string());
7667 }
7668 if let Some(value) = self._update_mask.as_ref() {
7669 params.push("updateMask", value.to_string());
7670 }
7671 if let Some(value) = self._allow_missing.as_ref() {
7672 params.push("allowMissing", value.to_string());
7673 }
7674
7675 params.extend(self._additional_params.iter());
7676
7677 params.push("alt", "json");
7678 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7679 if self._scopes.is_empty() {
7680 self._scopes
7681 .insert(Scope::CloudPlatform.as_ref().to_string());
7682 }
7683
7684 #[allow(clippy::single_element_loop)]
7685 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7686 url = params.uri_replacement(url, param_name, find_this, true);
7687 }
7688 {
7689 let to_remove = ["name"];
7690 params.remove_params(&to_remove);
7691 }
7692
7693 let url = params.parse_with_url(&url);
7694
7695 let mut json_mime_type = mime::APPLICATION_JSON;
7696 let mut request_value_reader = {
7697 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7698 common::remove_json_null_values(&mut value);
7699 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7700 serde_json::to_writer(&mut dst, &value).unwrap();
7701 dst
7702 };
7703 let request_size = request_value_reader
7704 .seek(std::io::SeekFrom::End(0))
7705 .unwrap();
7706 request_value_reader
7707 .seek(std::io::SeekFrom::Start(0))
7708 .unwrap();
7709
7710 loop {
7711 let token = match self
7712 .hub
7713 .auth
7714 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7715 .await
7716 {
7717 Ok(token) => token,
7718 Err(e) => match dlg.token(e) {
7719 Ok(token) => token,
7720 Err(e) => {
7721 dlg.finished(false);
7722 return Err(common::Error::MissingToken(e));
7723 }
7724 },
7725 };
7726 request_value_reader
7727 .seek(std::io::SeekFrom::Start(0))
7728 .unwrap();
7729 let mut req_result = {
7730 let client = &self.hub.client;
7731 dlg.pre_request();
7732 let mut req_builder = hyper::Request::builder()
7733 .method(hyper::Method::PATCH)
7734 .uri(url.as_str())
7735 .header(USER_AGENT, self.hub._user_agent.clone());
7736
7737 if let Some(token) = token.as_ref() {
7738 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7739 }
7740
7741 let request = req_builder
7742 .header(CONTENT_TYPE, json_mime_type.to_string())
7743 .header(CONTENT_LENGTH, request_size as u64)
7744 .body(common::to_body(
7745 request_value_reader.get_ref().clone().into(),
7746 ));
7747
7748 client.request(request.unwrap()).await
7749 };
7750
7751 match req_result {
7752 Err(err) => {
7753 if let common::Retry::After(d) = dlg.http_error(&err) {
7754 sleep(d).await;
7755 continue;
7756 }
7757 dlg.finished(false);
7758 return Err(common::Error::HttpError(err));
7759 }
7760 Ok(res) => {
7761 let (mut parts, body) = res.into_parts();
7762 let mut body = common::Body::new(body);
7763 if !parts.status.is_success() {
7764 let bytes = common::to_bytes(body).await.unwrap_or_default();
7765 let error = serde_json::from_str(&common::to_string(&bytes));
7766 let response = common::to_response(parts, bytes.into());
7767
7768 if let common::Retry::After(d) =
7769 dlg.http_failure(&response, error.as_ref().ok())
7770 {
7771 sleep(d).await;
7772 continue;
7773 }
7774
7775 dlg.finished(false);
7776
7777 return Err(match error {
7778 Ok(value) => common::Error::BadRequest(value),
7779 _ => common::Error::Failure(response),
7780 });
7781 }
7782 let response = {
7783 let bytes = common::to_bytes(body).await.unwrap_or_default();
7784 let encoded = common::to_string(&bytes);
7785 match serde_json::from_str(&encoded) {
7786 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7787 Err(error) => {
7788 dlg.response_json_decode_error(&encoded, &error);
7789 return Err(common::Error::JsonDecodeError(
7790 encoded.to_string(),
7791 error,
7792 ));
7793 }
7794 }
7795 };
7796
7797 dlg.finished(true);
7798 return Ok(response);
7799 }
7800 }
7801 }
7802 }
7803
7804 ///
7805 /// Sets the *request* property to the given value.
7806 ///
7807 /// Even though the property as already been set when instantiating this call,
7808 /// we provide this method for API completeness.
7809 pub fn request(mut self, new_value: CustomDomain) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7810 self._request = new_value;
7811 self
7812 }
7813 /// Output only. The fully-qualified name of the `CustomDomain`.
7814 ///
7815 /// Sets the *name* path property to the given value.
7816 ///
7817 /// Even though the property as already been set when instantiating this call,
7818 /// we provide this method for API completeness.
7819 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7820 self._name = new_value.to_string();
7821 self
7822 }
7823 /// If true, Hosting validates that it's possible to complete your request but doesn't actually create or update the `CustomDomain`.
7824 ///
7825 /// Sets the *validate only* query property to the given value.
7826 pub fn validate_only(mut self, new_value: bool) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7827 self._validate_only = Some(new_value);
7828 self
7829 }
7830 /// 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`.
7831 ///
7832 /// Sets the *update mask* query property to the given value.
7833 pub fn update_mask(
7834 mut self,
7835 new_value: common::FieldMask,
7836 ) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7837 self._update_mask = Some(new_value);
7838 self
7839 }
7840 /// If true, Hosting creates the `CustomDomain` if it doesn't already exist.
7841 ///
7842 /// Sets the *allow missing* query property to the given value.
7843 pub fn allow_missing(mut self, new_value: bool) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7844 self._allow_missing = Some(new_value);
7845 self
7846 }
7847 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7848 /// while executing the actual API request.
7849 ///
7850 /// ````text
7851 /// It should be used to handle progress information, and to implement a certain level of resilience.
7852 /// ````
7853 ///
7854 /// Sets the *delegate* property to the given value.
7855 pub fn delegate(
7856 mut self,
7857 new_value: &'a mut dyn common::Delegate,
7858 ) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7859 self._delegate = Some(new_value);
7860 self
7861 }
7862
7863 /// Set any additional parameter of the query string used in the request.
7864 /// It should be used to set parameters which are not yet available through their own
7865 /// setters.
7866 ///
7867 /// Please note that this method must not be used to set any of the known parameters
7868 /// which have their own setter method. If done anyway, the request will fail.
7869 ///
7870 /// # Additional Parameters
7871 ///
7872 /// * *$.xgafv* (query-string) - V1 error format.
7873 /// * *access_token* (query-string) - OAuth access token.
7874 /// * *alt* (query-string) - Data format for response.
7875 /// * *callback* (query-string) - JSONP
7876 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7877 /// * *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.
7878 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7879 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7880 /// * *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.
7881 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7882 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7883 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainPatchCall<'a, C>
7884 where
7885 T: AsRef<str>,
7886 {
7887 self._additional_params
7888 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7889 self
7890 }
7891
7892 /// Identifies the authorization scope for the method you are building.
7893 ///
7894 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7895 /// [`Scope::CloudPlatform`].
7896 ///
7897 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7898 /// tokens for more than one scope.
7899 ///
7900 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7901 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7902 /// sufficient, a read-write scope will do as well.
7903 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainPatchCall<'a, C>
7904 where
7905 St: AsRef<str>,
7906 {
7907 self._scopes.insert(String::from(scope.as_ref()));
7908 self
7909 }
7910 /// Identifies the authorization scope(s) for the method you are building.
7911 ///
7912 /// See [`Self::add_scope()`] for details.
7913 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainPatchCall<'a, C>
7914 where
7915 I: IntoIterator<Item = St>,
7916 St: AsRef<str>,
7917 {
7918 self._scopes
7919 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7920 self
7921 }
7922
7923 /// Removes all scopes, and no default scope will be used either.
7924 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7925 /// for details).
7926 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainPatchCall<'a, C> {
7927 self._scopes.clear();
7928 self
7929 }
7930}
7931
7932/// Undeletes the specified `CustomDomain` if it has been soft-deleted. Hosting retains soft-deleted custom domains for around 30 days before permanently deleting them.
7933///
7934/// A builder for the *sites.customDomains.undelete* method supported by a *project* resource.
7935/// It is not used directly, but through a [`ProjectMethods`] instance.
7936///
7937/// # Example
7938///
7939/// Instantiate a resource method builder
7940///
7941/// ```test_harness,no_run
7942/// # extern crate hyper;
7943/// # extern crate hyper_rustls;
7944/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
7945/// use firebasehosting1_beta1::api::UndeleteCustomDomainRequest;
7946/// # async fn dox() {
7947/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7948///
7949/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7950/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7951/// # .with_native_roots()
7952/// # .unwrap()
7953/// # .https_only()
7954/// # .enable_http2()
7955/// # .build();
7956///
7957/// # let executor = hyper_util::rt::TokioExecutor::new();
7958/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7959/// # secret,
7960/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7961/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7962/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7963/// # ),
7964/// # ).build().await.unwrap();
7965///
7966/// # let client = hyper_util::client::legacy::Client::builder(
7967/// # hyper_util::rt::TokioExecutor::new()
7968/// # )
7969/// # .build(
7970/// # hyper_rustls::HttpsConnectorBuilder::new()
7971/// # .with_native_roots()
7972/// # .unwrap()
7973/// # .https_or_http()
7974/// # .enable_http2()
7975/// # .build()
7976/// # );
7977/// # let mut hub = FirebaseHosting::new(client, auth);
7978/// // As the method needs a request, you would usually fill it with the desired information
7979/// // into the respective structure. Some of the parts shown here might not be applicable !
7980/// // Values shown here are possibly random and not representative !
7981/// let mut req = UndeleteCustomDomainRequest::default();
7982///
7983/// // You can configure optional parameters by calling the respective setters at will, and
7984/// // execute the final call using `doit()`.
7985/// // Values shown here are possibly random and not representative !
7986/// let result = hub.projects().sites_custom_domains_undelete(req, "name")
7987/// .doit().await;
7988/// # }
7989/// ```
7990pub struct ProjectSiteCustomDomainUndeleteCall<'a, C>
7991where
7992 C: 'a,
7993{
7994 hub: &'a FirebaseHosting<C>,
7995 _request: UndeleteCustomDomainRequest,
7996 _name: String,
7997 _delegate: Option<&'a mut dyn common::Delegate>,
7998 _additional_params: HashMap<String, String>,
7999 _scopes: BTreeSet<String>,
8000}
8001
8002impl<'a, C> common::CallBuilder for ProjectSiteCustomDomainUndeleteCall<'a, C> {}
8003
8004impl<'a, C> ProjectSiteCustomDomainUndeleteCall<'a, C>
8005where
8006 C: common::Connector,
8007{
8008 /// Perform the operation you have build so far.
8009 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8010 use std::borrow::Cow;
8011 use std::io::{Read, Seek};
8012
8013 use common::{url::Params, ToParts};
8014 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8015
8016 let mut dd = common::DefaultDelegate;
8017 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8018 dlg.begin(common::MethodInfo {
8019 id: "firebasehosting.projects.sites.customDomains.undelete",
8020 http_method: hyper::Method::POST,
8021 });
8022
8023 for &field in ["alt", "name"].iter() {
8024 if self._additional_params.contains_key(field) {
8025 dlg.finished(false);
8026 return Err(common::Error::FieldClash(field));
8027 }
8028 }
8029
8030 let mut params = Params::with_capacity(4 + self._additional_params.len());
8031 params.push("name", self._name);
8032
8033 params.extend(self._additional_params.iter());
8034
8035 params.push("alt", "json");
8036 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:undelete";
8037 if self._scopes.is_empty() {
8038 self._scopes
8039 .insert(Scope::CloudPlatform.as_ref().to_string());
8040 }
8041
8042 #[allow(clippy::single_element_loop)]
8043 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8044 url = params.uri_replacement(url, param_name, find_this, true);
8045 }
8046 {
8047 let to_remove = ["name"];
8048 params.remove_params(&to_remove);
8049 }
8050
8051 let url = params.parse_with_url(&url);
8052
8053 let mut json_mime_type = mime::APPLICATION_JSON;
8054 let mut request_value_reader = {
8055 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8056 common::remove_json_null_values(&mut value);
8057 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8058 serde_json::to_writer(&mut dst, &value).unwrap();
8059 dst
8060 };
8061 let request_size = request_value_reader
8062 .seek(std::io::SeekFrom::End(0))
8063 .unwrap();
8064 request_value_reader
8065 .seek(std::io::SeekFrom::Start(0))
8066 .unwrap();
8067
8068 loop {
8069 let token = match self
8070 .hub
8071 .auth
8072 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8073 .await
8074 {
8075 Ok(token) => token,
8076 Err(e) => match dlg.token(e) {
8077 Ok(token) => token,
8078 Err(e) => {
8079 dlg.finished(false);
8080 return Err(common::Error::MissingToken(e));
8081 }
8082 },
8083 };
8084 request_value_reader
8085 .seek(std::io::SeekFrom::Start(0))
8086 .unwrap();
8087 let mut req_result = {
8088 let client = &self.hub.client;
8089 dlg.pre_request();
8090 let mut req_builder = hyper::Request::builder()
8091 .method(hyper::Method::POST)
8092 .uri(url.as_str())
8093 .header(USER_AGENT, self.hub._user_agent.clone());
8094
8095 if let Some(token) = token.as_ref() {
8096 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8097 }
8098
8099 let request = req_builder
8100 .header(CONTENT_TYPE, json_mime_type.to_string())
8101 .header(CONTENT_LENGTH, request_size as u64)
8102 .body(common::to_body(
8103 request_value_reader.get_ref().clone().into(),
8104 ));
8105
8106 client.request(request.unwrap()).await
8107 };
8108
8109 match req_result {
8110 Err(err) => {
8111 if let common::Retry::After(d) = dlg.http_error(&err) {
8112 sleep(d).await;
8113 continue;
8114 }
8115 dlg.finished(false);
8116 return Err(common::Error::HttpError(err));
8117 }
8118 Ok(res) => {
8119 let (mut parts, body) = res.into_parts();
8120 let mut body = common::Body::new(body);
8121 if !parts.status.is_success() {
8122 let bytes = common::to_bytes(body).await.unwrap_or_default();
8123 let error = serde_json::from_str(&common::to_string(&bytes));
8124 let response = common::to_response(parts, bytes.into());
8125
8126 if let common::Retry::After(d) =
8127 dlg.http_failure(&response, error.as_ref().ok())
8128 {
8129 sleep(d).await;
8130 continue;
8131 }
8132
8133 dlg.finished(false);
8134
8135 return Err(match error {
8136 Ok(value) => common::Error::BadRequest(value),
8137 _ => common::Error::Failure(response),
8138 });
8139 }
8140 let response = {
8141 let bytes = common::to_bytes(body).await.unwrap_or_default();
8142 let encoded = common::to_string(&bytes);
8143 match serde_json::from_str(&encoded) {
8144 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8145 Err(error) => {
8146 dlg.response_json_decode_error(&encoded, &error);
8147 return Err(common::Error::JsonDecodeError(
8148 encoded.to_string(),
8149 error,
8150 ));
8151 }
8152 }
8153 };
8154
8155 dlg.finished(true);
8156 return Ok(response);
8157 }
8158 }
8159 }
8160 }
8161
8162 ///
8163 /// Sets the *request* property to the given value.
8164 ///
8165 /// Even though the property as already been set when instantiating this call,
8166 /// we provide this method for API completeness.
8167 pub fn request(
8168 mut self,
8169 new_value: UndeleteCustomDomainRequest,
8170 ) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
8171 self._request = new_value;
8172 self
8173 }
8174 /// Required. The name of the `CustomDomain` to delete.
8175 ///
8176 /// Sets the *name* path property to the given value.
8177 ///
8178 /// Even though the property as already been set when instantiating this call,
8179 /// we provide this method for API completeness.
8180 pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
8181 self._name = new_value.to_string();
8182 self
8183 }
8184 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8185 /// while executing the actual API request.
8186 ///
8187 /// ````text
8188 /// It should be used to handle progress information, and to implement a certain level of resilience.
8189 /// ````
8190 ///
8191 /// Sets the *delegate* property to the given value.
8192 pub fn delegate(
8193 mut self,
8194 new_value: &'a mut dyn common::Delegate,
8195 ) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
8196 self._delegate = Some(new_value);
8197 self
8198 }
8199
8200 /// Set any additional parameter of the query string used in the request.
8201 /// It should be used to set parameters which are not yet available through their own
8202 /// setters.
8203 ///
8204 /// Please note that this method must not be used to set any of the known parameters
8205 /// which have their own setter method. If done anyway, the request will fail.
8206 ///
8207 /// # Additional Parameters
8208 ///
8209 /// * *$.xgafv* (query-string) - V1 error format.
8210 /// * *access_token* (query-string) - OAuth access token.
8211 /// * *alt* (query-string) - Data format for response.
8212 /// * *callback* (query-string) - JSONP
8213 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8214 /// * *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.
8215 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8216 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8217 /// * *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.
8218 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8219 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8220 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainUndeleteCall<'a, C>
8221 where
8222 T: AsRef<str>,
8223 {
8224 self._additional_params
8225 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8226 self
8227 }
8228
8229 /// Identifies the authorization scope for the method you are building.
8230 ///
8231 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8232 /// [`Scope::CloudPlatform`].
8233 ///
8234 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8235 /// tokens for more than one scope.
8236 ///
8237 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8238 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8239 /// sufficient, a read-write scope will do as well.
8240 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainUndeleteCall<'a, C>
8241 where
8242 St: AsRef<str>,
8243 {
8244 self._scopes.insert(String::from(scope.as_ref()));
8245 self
8246 }
8247 /// Identifies the authorization scope(s) for the method you are building.
8248 ///
8249 /// See [`Self::add_scope()`] for details.
8250 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainUndeleteCall<'a, C>
8251 where
8252 I: IntoIterator<Item = St>,
8253 St: AsRef<str>,
8254 {
8255 self._scopes
8256 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8257 self
8258 }
8259
8260 /// Removes all scopes, and no default scope will be used either.
8261 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8262 /// for details).
8263 pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainUndeleteCall<'a, C> {
8264 self._scopes.clear();
8265 self
8266 }
8267}
8268
8269/// Creates a domain mapping on the specified site.
8270///
8271/// A builder for the *sites.domains.create* method supported by a *project* resource.
8272/// It is not used directly, but through a [`ProjectMethods`] instance.
8273///
8274/// # Example
8275///
8276/// Instantiate a resource method builder
8277///
8278/// ```test_harness,no_run
8279/// # extern crate hyper;
8280/// # extern crate hyper_rustls;
8281/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
8282/// use firebasehosting1_beta1::api::Domain;
8283/// # async fn dox() {
8284/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8285///
8286/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8287/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8288/// # .with_native_roots()
8289/// # .unwrap()
8290/// # .https_only()
8291/// # .enable_http2()
8292/// # .build();
8293///
8294/// # let executor = hyper_util::rt::TokioExecutor::new();
8295/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8296/// # secret,
8297/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8298/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8299/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8300/// # ),
8301/// # ).build().await.unwrap();
8302///
8303/// # let client = hyper_util::client::legacy::Client::builder(
8304/// # hyper_util::rt::TokioExecutor::new()
8305/// # )
8306/// # .build(
8307/// # hyper_rustls::HttpsConnectorBuilder::new()
8308/// # .with_native_roots()
8309/// # .unwrap()
8310/// # .https_or_http()
8311/// # .enable_http2()
8312/// # .build()
8313/// # );
8314/// # let mut hub = FirebaseHosting::new(client, auth);
8315/// // As the method needs a request, you would usually fill it with the desired information
8316/// // into the respective structure. Some of the parts shown here might not be applicable !
8317/// // Values shown here are possibly random and not representative !
8318/// let mut req = Domain::default();
8319///
8320/// // You can configure optional parameters by calling the respective setters at will, and
8321/// // execute the final call using `doit()`.
8322/// // Values shown here are possibly random and not representative !
8323/// let result = hub.projects().sites_domains_create(req, "parent")
8324/// .doit().await;
8325/// # }
8326/// ```
8327pub struct ProjectSiteDomainCreateCall<'a, C>
8328where
8329 C: 'a,
8330{
8331 hub: &'a FirebaseHosting<C>,
8332 _request: Domain,
8333 _parent: String,
8334 _delegate: Option<&'a mut dyn common::Delegate>,
8335 _additional_params: HashMap<String, String>,
8336 _scopes: BTreeSet<String>,
8337}
8338
8339impl<'a, C> common::CallBuilder for ProjectSiteDomainCreateCall<'a, C> {}
8340
8341impl<'a, C> ProjectSiteDomainCreateCall<'a, C>
8342where
8343 C: common::Connector,
8344{
8345 /// Perform the operation you have build so far.
8346 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
8347 use std::borrow::Cow;
8348 use std::io::{Read, Seek};
8349
8350 use common::{url::Params, ToParts};
8351 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8352
8353 let mut dd = common::DefaultDelegate;
8354 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8355 dlg.begin(common::MethodInfo {
8356 id: "firebasehosting.projects.sites.domains.create",
8357 http_method: hyper::Method::POST,
8358 });
8359
8360 for &field in ["alt", "parent"].iter() {
8361 if self._additional_params.contains_key(field) {
8362 dlg.finished(false);
8363 return Err(common::Error::FieldClash(field));
8364 }
8365 }
8366
8367 let mut params = Params::with_capacity(4 + self._additional_params.len());
8368 params.push("parent", self._parent);
8369
8370 params.extend(self._additional_params.iter());
8371
8372 params.push("alt", "json");
8373 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/domains";
8374 if self._scopes.is_empty() {
8375 self._scopes
8376 .insert(Scope::CloudPlatform.as_ref().to_string());
8377 }
8378
8379 #[allow(clippy::single_element_loop)]
8380 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8381 url = params.uri_replacement(url, param_name, find_this, true);
8382 }
8383 {
8384 let to_remove = ["parent"];
8385 params.remove_params(&to_remove);
8386 }
8387
8388 let url = params.parse_with_url(&url);
8389
8390 let mut json_mime_type = mime::APPLICATION_JSON;
8391 let mut request_value_reader = {
8392 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8393 common::remove_json_null_values(&mut value);
8394 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8395 serde_json::to_writer(&mut dst, &value).unwrap();
8396 dst
8397 };
8398 let request_size = request_value_reader
8399 .seek(std::io::SeekFrom::End(0))
8400 .unwrap();
8401 request_value_reader
8402 .seek(std::io::SeekFrom::Start(0))
8403 .unwrap();
8404
8405 loop {
8406 let token = match self
8407 .hub
8408 .auth
8409 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8410 .await
8411 {
8412 Ok(token) => token,
8413 Err(e) => match dlg.token(e) {
8414 Ok(token) => token,
8415 Err(e) => {
8416 dlg.finished(false);
8417 return Err(common::Error::MissingToken(e));
8418 }
8419 },
8420 };
8421 request_value_reader
8422 .seek(std::io::SeekFrom::Start(0))
8423 .unwrap();
8424 let mut req_result = {
8425 let client = &self.hub.client;
8426 dlg.pre_request();
8427 let mut req_builder = hyper::Request::builder()
8428 .method(hyper::Method::POST)
8429 .uri(url.as_str())
8430 .header(USER_AGENT, self.hub._user_agent.clone());
8431
8432 if let Some(token) = token.as_ref() {
8433 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8434 }
8435
8436 let request = req_builder
8437 .header(CONTENT_TYPE, json_mime_type.to_string())
8438 .header(CONTENT_LENGTH, request_size as u64)
8439 .body(common::to_body(
8440 request_value_reader.get_ref().clone().into(),
8441 ));
8442
8443 client.request(request.unwrap()).await
8444 };
8445
8446 match req_result {
8447 Err(err) => {
8448 if let common::Retry::After(d) = dlg.http_error(&err) {
8449 sleep(d).await;
8450 continue;
8451 }
8452 dlg.finished(false);
8453 return Err(common::Error::HttpError(err));
8454 }
8455 Ok(res) => {
8456 let (mut parts, body) = res.into_parts();
8457 let mut body = common::Body::new(body);
8458 if !parts.status.is_success() {
8459 let bytes = common::to_bytes(body).await.unwrap_or_default();
8460 let error = serde_json::from_str(&common::to_string(&bytes));
8461 let response = common::to_response(parts, bytes.into());
8462
8463 if let common::Retry::After(d) =
8464 dlg.http_failure(&response, error.as_ref().ok())
8465 {
8466 sleep(d).await;
8467 continue;
8468 }
8469
8470 dlg.finished(false);
8471
8472 return Err(match error {
8473 Ok(value) => common::Error::BadRequest(value),
8474 _ => common::Error::Failure(response),
8475 });
8476 }
8477 let response = {
8478 let bytes = common::to_bytes(body).await.unwrap_or_default();
8479 let encoded = common::to_string(&bytes);
8480 match serde_json::from_str(&encoded) {
8481 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8482 Err(error) => {
8483 dlg.response_json_decode_error(&encoded, &error);
8484 return Err(common::Error::JsonDecodeError(
8485 encoded.to_string(),
8486 error,
8487 ));
8488 }
8489 }
8490 };
8491
8492 dlg.finished(true);
8493 return Ok(response);
8494 }
8495 }
8496 }
8497 }
8498
8499 ///
8500 /// Sets the *request* property to the given value.
8501 ///
8502 /// Even though the property as already been set when instantiating this call,
8503 /// we provide this method for API completeness.
8504 pub fn request(mut self, new_value: Domain) -> ProjectSiteDomainCreateCall<'a, C> {
8505 self._request = new_value;
8506 self
8507 }
8508 /// Required. The parent to create the domain association for, in the format: sites/site-name
8509 ///
8510 /// Sets the *parent* path property to the given value.
8511 ///
8512 /// Even though the property as already been set when instantiating this call,
8513 /// we provide this method for API completeness.
8514 pub fn parent(mut self, new_value: &str) -> ProjectSiteDomainCreateCall<'a, C> {
8515 self._parent = new_value.to_string();
8516 self
8517 }
8518 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8519 /// while executing the actual API request.
8520 ///
8521 /// ````text
8522 /// It should be used to handle progress information, and to implement a certain level of resilience.
8523 /// ````
8524 ///
8525 /// Sets the *delegate* property to the given value.
8526 pub fn delegate(
8527 mut self,
8528 new_value: &'a mut dyn common::Delegate,
8529 ) -> ProjectSiteDomainCreateCall<'a, C> {
8530 self._delegate = Some(new_value);
8531 self
8532 }
8533
8534 /// Set any additional parameter of the query string used in the request.
8535 /// It should be used to set parameters which are not yet available through their own
8536 /// setters.
8537 ///
8538 /// Please note that this method must not be used to set any of the known parameters
8539 /// which have their own setter method. If done anyway, the request will fail.
8540 ///
8541 /// # Additional Parameters
8542 ///
8543 /// * *$.xgafv* (query-string) - V1 error format.
8544 /// * *access_token* (query-string) - OAuth access token.
8545 /// * *alt* (query-string) - Data format for response.
8546 /// * *callback* (query-string) - JSONP
8547 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8548 /// * *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.
8549 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8550 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8551 /// * *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.
8552 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8553 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8554 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainCreateCall<'a, C>
8555 where
8556 T: AsRef<str>,
8557 {
8558 self._additional_params
8559 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8560 self
8561 }
8562
8563 /// Identifies the authorization scope for the method you are building.
8564 ///
8565 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8566 /// [`Scope::CloudPlatform`].
8567 ///
8568 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8569 /// tokens for more than one scope.
8570 ///
8571 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8572 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8573 /// sufficient, a read-write scope will do as well.
8574 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainCreateCall<'a, C>
8575 where
8576 St: AsRef<str>,
8577 {
8578 self._scopes.insert(String::from(scope.as_ref()));
8579 self
8580 }
8581 /// Identifies the authorization scope(s) for the method you are building.
8582 ///
8583 /// See [`Self::add_scope()`] for details.
8584 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainCreateCall<'a, C>
8585 where
8586 I: IntoIterator<Item = St>,
8587 St: AsRef<str>,
8588 {
8589 self._scopes
8590 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8591 self
8592 }
8593
8594 /// Removes all scopes, and no default scope will be used either.
8595 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8596 /// for details).
8597 pub fn clear_scopes(mut self) -> ProjectSiteDomainCreateCall<'a, C> {
8598 self._scopes.clear();
8599 self
8600 }
8601}
8602
8603/// Deletes the existing domain mapping on the specified site.
8604///
8605/// A builder for the *sites.domains.delete* method supported by a *project* resource.
8606/// It is not used directly, but through a [`ProjectMethods`] instance.
8607///
8608/// # Example
8609///
8610/// Instantiate a resource method builder
8611///
8612/// ```test_harness,no_run
8613/// # extern crate hyper;
8614/// # extern crate hyper_rustls;
8615/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
8616/// # async fn dox() {
8617/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8618///
8619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8620/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8621/// # .with_native_roots()
8622/// # .unwrap()
8623/// # .https_only()
8624/// # .enable_http2()
8625/// # .build();
8626///
8627/// # let executor = hyper_util::rt::TokioExecutor::new();
8628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8629/// # secret,
8630/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8631/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8632/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8633/// # ),
8634/// # ).build().await.unwrap();
8635///
8636/// # let client = hyper_util::client::legacy::Client::builder(
8637/// # hyper_util::rt::TokioExecutor::new()
8638/// # )
8639/// # .build(
8640/// # hyper_rustls::HttpsConnectorBuilder::new()
8641/// # .with_native_roots()
8642/// # .unwrap()
8643/// # .https_or_http()
8644/// # .enable_http2()
8645/// # .build()
8646/// # );
8647/// # let mut hub = FirebaseHosting::new(client, auth);
8648/// // You can configure optional parameters by calling the respective setters at will, and
8649/// // execute the final call using `doit()`.
8650/// // Values shown here are possibly random and not representative !
8651/// let result = hub.projects().sites_domains_delete("name")
8652/// .doit().await;
8653/// # }
8654/// ```
8655pub struct ProjectSiteDomainDeleteCall<'a, C>
8656where
8657 C: 'a,
8658{
8659 hub: &'a FirebaseHosting<C>,
8660 _name: String,
8661 _delegate: Option<&'a mut dyn common::Delegate>,
8662 _additional_params: HashMap<String, String>,
8663 _scopes: BTreeSet<String>,
8664}
8665
8666impl<'a, C> common::CallBuilder for ProjectSiteDomainDeleteCall<'a, C> {}
8667
8668impl<'a, C> ProjectSiteDomainDeleteCall<'a, C>
8669where
8670 C: common::Connector,
8671{
8672 /// Perform the operation you have build so far.
8673 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8674 use std::borrow::Cow;
8675 use std::io::{Read, Seek};
8676
8677 use common::{url::Params, ToParts};
8678 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8679
8680 let mut dd = common::DefaultDelegate;
8681 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8682 dlg.begin(common::MethodInfo {
8683 id: "firebasehosting.projects.sites.domains.delete",
8684 http_method: hyper::Method::DELETE,
8685 });
8686
8687 for &field in ["alt", "name"].iter() {
8688 if self._additional_params.contains_key(field) {
8689 dlg.finished(false);
8690 return Err(common::Error::FieldClash(field));
8691 }
8692 }
8693
8694 let mut params = Params::with_capacity(3 + self._additional_params.len());
8695 params.push("name", self._name);
8696
8697 params.extend(self._additional_params.iter());
8698
8699 params.push("alt", "json");
8700 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8701 if self._scopes.is_empty() {
8702 self._scopes
8703 .insert(Scope::CloudPlatform.as_ref().to_string());
8704 }
8705
8706 #[allow(clippy::single_element_loop)]
8707 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8708 url = params.uri_replacement(url, param_name, find_this, true);
8709 }
8710 {
8711 let to_remove = ["name"];
8712 params.remove_params(&to_remove);
8713 }
8714
8715 let url = params.parse_with_url(&url);
8716
8717 loop {
8718 let token = match self
8719 .hub
8720 .auth
8721 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8722 .await
8723 {
8724 Ok(token) => token,
8725 Err(e) => match dlg.token(e) {
8726 Ok(token) => token,
8727 Err(e) => {
8728 dlg.finished(false);
8729 return Err(common::Error::MissingToken(e));
8730 }
8731 },
8732 };
8733 let mut req_result = {
8734 let client = &self.hub.client;
8735 dlg.pre_request();
8736 let mut req_builder = hyper::Request::builder()
8737 .method(hyper::Method::DELETE)
8738 .uri(url.as_str())
8739 .header(USER_AGENT, self.hub._user_agent.clone());
8740
8741 if let Some(token) = token.as_ref() {
8742 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8743 }
8744
8745 let request = req_builder
8746 .header(CONTENT_LENGTH, 0_u64)
8747 .body(common::to_body::<String>(None));
8748
8749 client.request(request.unwrap()).await
8750 };
8751
8752 match req_result {
8753 Err(err) => {
8754 if let common::Retry::After(d) = dlg.http_error(&err) {
8755 sleep(d).await;
8756 continue;
8757 }
8758 dlg.finished(false);
8759 return Err(common::Error::HttpError(err));
8760 }
8761 Ok(res) => {
8762 let (mut parts, body) = res.into_parts();
8763 let mut body = common::Body::new(body);
8764 if !parts.status.is_success() {
8765 let bytes = common::to_bytes(body).await.unwrap_or_default();
8766 let error = serde_json::from_str(&common::to_string(&bytes));
8767 let response = common::to_response(parts, bytes.into());
8768
8769 if let common::Retry::After(d) =
8770 dlg.http_failure(&response, error.as_ref().ok())
8771 {
8772 sleep(d).await;
8773 continue;
8774 }
8775
8776 dlg.finished(false);
8777
8778 return Err(match error {
8779 Ok(value) => common::Error::BadRequest(value),
8780 _ => common::Error::Failure(response),
8781 });
8782 }
8783 let response = {
8784 let bytes = common::to_bytes(body).await.unwrap_or_default();
8785 let encoded = common::to_string(&bytes);
8786 match serde_json::from_str(&encoded) {
8787 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8788 Err(error) => {
8789 dlg.response_json_decode_error(&encoded, &error);
8790 return Err(common::Error::JsonDecodeError(
8791 encoded.to_string(),
8792 error,
8793 ));
8794 }
8795 }
8796 };
8797
8798 dlg.finished(true);
8799 return Ok(response);
8800 }
8801 }
8802 }
8803 }
8804
8805 /// Required. The name of the domain association to delete.
8806 ///
8807 /// Sets the *name* path property to the given value.
8808 ///
8809 /// Even though the property as already been set when instantiating this call,
8810 /// we provide this method for API completeness.
8811 pub fn name(mut self, new_value: &str) -> ProjectSiteDomainDeleteCall<'a, C> {
8812 self._name = new_value.to_string();
8813 self
8814 }
8815 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8816 /// while executing the actual API request.
8817 ///
8818 /// ````text
8819 /// It should be used to handle progress information, and to implement a certain level of resilience.
8820 /// ````
8821 ///
8822 /// Sets the *delegate* property to the given value.
8823 pub fn delegate(
8824 mut self,
8825 new_value: &'a mut dyn common::Delegate,
8826 ) -> ProjectSiteDomainDeleteCall<'a, C> {
8827 self._delegate = Some(new_value);
8828 self
8829 }
8830
8831 /// Set any additional parameter of the query string used in the request.
8832 /// It should be used to set parameters which are not yet available through their own
8833 /// setters.
8834 ///
8835 /// Please note that this method must not be used to set any of the known parameters
8836 /// which have their own setter method. If done anyway, the request will fail.
8837 ///
8838 /// # Additional Parameters
8839 ///
8840 /// * *$.xgafv* (query-string) - V1 error format.
8841 /// * *access_token* (query-string) - OAuth access token.
8842 /// * *alt* (query-string) - Data format for response.
8843 /// * *callback* (query-string) - JSONP
8844 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8845 /// * *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.
8846 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8847 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8848 /// * *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.
8849 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8850 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8851 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainDeleteCall<'a, C>
8852 where
8853 T: AsRef<str>,
8854 {
8855 self._additional_params
8856 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8857 self
8858 }
8859
8860 /// Identifies the authorization scope for the method you are building.
8861 ///
8862 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8863 /// [`Scope::CloudPlatform`].
8864 ///
8865 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8866 /// tokens for more than one scope.
8867 ///
8868 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8869 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8870 /// sufficient, a read-write scope will do as well.
8871 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainDeleteCall<'a, C>
8872 where
8873 St: AsRef<str>,
8874 {
8875 self._scopes.insert(String::from(scope.as_ref()));
8876 self
8877 }
8878 /// Identifies the authorization scope(s) for the method you are building.
8879 ///
8880 /// See [`Self::add_scope()`] for details.
8881 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainDeleteCall<'a, C>
8882 where
8883 I: IntoIterator<Item = St>,
8884 St: AsRef<str>,
8885 {
8886 self._scopes
8887 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8888 self
8889 }
8890
8891 /// Removes all scopes, and no default scope will be used either.
8892 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8893 /// for details).
8894 pub fn clear_scopes(mut self) -> ProjectSiteDomainDeleteCall<'a, C> {
8895 self._scopes.clear();
8896 self
8897 }
8898}
8899
8900/// Gets a domain mapping on the specified site.
8901///
8902/// A builder for the *sites.domains.get* method supported by a *project* resource.
8903/// It is not used directly, but through a [`ProjectMethods`] instance.
8904///
8905/// # Example
8906///
8907/// Instantiate a resource method builder
8908///
8909/// ```test_harness,no_run
8910/// # extern crate hyper;
8911/// # extern crate hyper_rustls;
8912/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
8913/// # async fn dox() {
8914/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8915///
8916/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8917/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8918/// # .with_native_roots()
8919/// # .unwrap()
8920/// # .https_only()
8921/// # .enable_http2()
8922/// # .build();
8923///
8924/// # let executor = hyper_util::rt::TokioExecutor::new();
8925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8926/// # secret,
8927/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8928/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8929/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8930/// # ),
8931/// # ).build().await.unwrap();
8932///
8933/// # let client = hyper_util::client::legacy::Client::builder(
8934/// # hyper_util::rt::TokioExecutor::new()
8935/// # )
8936/// # .build(
8937/// # hyper_rustls::HttpsConnectorBuilder::new()
8938/// # .with_native_roots()
8939/// # .unwrap()
8940/// # .https_or_http()
8941/// # .enable_http2()
8942/// # .build()
8943/// # );
8944/// # let mut hub = FirebaseHosting::new(client, auth);
8945/// // You can configure optional parameters by calling the respective setters at will, and
8946/// // execute the final call using `doit()`.
8947/// // Values shown here are possibly random and not representative !
8948/// let result = hub.projects().sites_domains_get("name")
8949/// .doit().await;
8950/// # }
8951/// ```
8952pub struct ProjectSiteDomainGetCall<'a, C>
8953where
8954 C: 'a,
8955{
8956 hub: &'a FirebaseHosting<C>,
8957 _name: String,
8958 _delegate: Option<&'a mut dyn common::Delegate>,
8959 _additional_params: HashMap<String, String>,
8960 _scopes: BTreeSet<String>,
8961}
8962
8963impl<'a, C> common::CallBuilder for ProjectSiteDomainGetCall<'a, C> {}
8964
8965impl<'a, C> ProjectSiteDomainGetCall<'a, C>
8966where
8967 C: common::Connector,
8968{
8969 /// Perform the operation you have build so far.
8970 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
8971 use std::borrow::Cow;
8972 use std::io::{Read, Seek};
8973
8974 use common::{url::Params, ToParts};
8975 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8976
8977 let mut dd = common::DefaultDelegate;
8978 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8979 dlg.begin(common::MethodInfo {
8980 id: "firebasehosting.projects.sites.domains.get",
8981 http_method: hyper::Method::GET,
8982 });
8983
8984 for &field in ["alt", "name"].iter() {
8985 if self._additional_params.contains_key(field) {
8986 dlg.finished(false);
8987 return Err(common::Error::FieldClash(field));
8988 }
8989 }
8990
8991 let mut params = Params::with_capacity(3 + self._additional_params.len());
8992 params.push("name", self._name);
8993
8994 params.extend(self._additional_params.iter());
8995
8996 params.push("alt", "json");
8997 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8998 if self._scopes.is_empty() {
8999 self._scopes
9000 .insert(Scope::FirebaseReadonly.as_ref().to_string());
9001 }
9002
9003 #[allow(clippy::single_element_loop)]
9004 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9005 url = params.uri_replacement(url, param_name, find_this, true);
9006 }
9007 {
9008 let to_remove = ["name"];
9009 params.remove_params(&to_remove);
9010 }
9011
9012 let url = params.parse_with_url(&url);
9013
9014 loop {
9015 let token = match self
9016 .hub
9017 .auth
9018 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9019 .await
9020 {
9021 Ok(token) => token,
9022 Err(e) => match dlg.token(e) {
9023 Ok(token) => token,
9024 Err(e) => {
9025 dlg.finished(false);
9026 return Err(common::Error::MissingToken(e));
9027 }
9028 },
9029 };
9030 let mut req_result = {
9031 let client = &self.hub.client;
9032 dlg.pre_request();
9033 let mut req_builder = hyper::Request::builder()
9034 .method(hyper::Method::GET)
9035 .uri(url.as_str())
9036 .header(USER_AGENT, self.hub._user_agent.clone());
9037
9038 if let Some(token) = token.as_ref() {
9039 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9040 }
9041
9042 let request = req_builder
9043 .header(CONTENT_LENGTH, 0_u64)
9044 .body(common::to_body::<String>(None));
9045
9046 client.request(request.unwrap()).await
9047 };
9048
9049 match req_result {
9050 Err(err) => {
9051 if let common::Retry::After(d) = dlg.http_error(&err) {
9052 sleep(d).await;
9053 continue;
9054 }
9055 dlg.finished(false);
9056 return Err(common::Error::HttpError(err));
9057 }
9058 Ok(res) => {
9059 let (mut parts, body) = res.into_parts();
9060 let mut body = common::Body::new(body);
9061 if !parts.status.is_success() {
9062 let bytes = common::to_bytes(body).await.unwrap_or_default();
9063 let error = serde_json::from_str(&common::to_string(&bytes));
9064 let response = common::to_response(parts, bytes.into());
9065
9066 if let common::Retry::After(d) =
9067 dlg.http_failure(&response, error.as_ref().ok())
9068 {
9069 sleep(d).await;
9070 continue;
9071 }
9072
9073 dlg.finished(false);
9074
9075 return Err(match error {
9076 Ok(value) => common::Error::BadRequest(value),
9077 _ => common::Error::Failure(response),
9078 });
9079 }
9080 let response = {
9081 let bytes = common::to_bytes(body).await.unwrap_or_default();
9082 let encoded = common::to_string(&bytes);
9083 match serde_json::from_str(&encoded) {
9084 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9085 Err(error) => {
9086 dlg.response_json_decode_error(&encoded, &error);
9087 return Err(common::Error::JsonDecodeError(
9088 encoded.to_string(),
9089 error,
9090 ));
9091 }
9092 }
9093 };
9094
9095 dlg.finished(true);
9096 return Ok(response);
9097 }
9098 }
9099 }
9100 }
9101
9102 /// Required. The name of the domain configuration to get.
9103 ///
9104 /// Sets the *name* path property to the given value.
9105 ///
9106 /// Even though the property as already been set when instantiating this call,
9107 /// we provide this method for API completeness.
9108 pub fn name(mut self, new_value: &str) -> ProjectSiteDomainGetCall<'a, C> {
9109 self._name = new_value.to_string();
9110 self
9111 }
9112 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9113 /// while executing the actual API request.
9114 ///
9115 /// ````text
9116 /// It should be used to handle progress information, and to implement a certain level of resilience.
9117 /// ````
9118 ///
9119 /// Sets the *delegate* property to the given value.
9120 pub fn delegate(
9121 mut self,
9122 new_value: &'a mut dyn common::Delegate,
9123 ) -> ProjectSiteDomainGetCall<'a, C> {
9124 self._delegate = Some(new_value);
9125 self
9126 }
9127
9128 /// Set any additional parameter of the query string used in the request.
9129 /// It should be used to set parameters which are not yet available through their own
9130 /// setters.
9131 ///
9132 /// Please note that this method must not be used to set any of the known parameters
9133 /// which have their own setter method. If done anyway, the request will fail.
9134 ///
9135 /// # Additional Parameters
9136 ///
9137 /// * *$.xgafv* (query-string) - V1 error format.
9138 /// * *access_token* (query-string) - OAuth access token.
9139 /// * *alt* (query-string) - Data format for response.
9140 /// * *callback* (query-string) - JSONP
9141 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9142 /// * *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.
9143 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9144 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9145 /// * *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.
9146 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9147 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9148 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainGetCall<'a, C>
9149 where
9150 T: AsRef<str>,
9151 {
9152 self._additional_params
9153 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9154 self
9155 }
9156
9157 /// Identifies the authorization scope for the method you are building.
9158 ///
9159 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9160 /// [`Scope::FirebaseReadonly`].
9161 ///
9162 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9163 /// tokens for more than one scope.
9164 ///
9165 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9166 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9167 /// sufficient, a read-write scope will do as well.
9168 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainGetCall<'a, C>
9169 where
9170 St: AsRef<str>,
9171 {
9172 self._scopes.insert(String::from(scope.as_ref()));
9173 self
9174 }
9175 /// Identifies the authorization scope(s) for the method you are building.
9176 ///
9177 /// See [`Self::add_scope()`] for details.
9178 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainGetCall<'a, C>
9179 where
9180 I: IntoIterator<Item = St>,
9181 St: AsRef<str>,
9182 {
9183 self._scopes
9184 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9185 self
9186 }
9187
9188 /// Removes all scopes, and no default scope will be used either.
9189 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9190 /// for details).
9191 pub fn clear_scopes(mut self) -> ProjectSiteDomainGetCall<'a, C> {
9192 self._scopes.clear();
9193 self
9194 }
9195}
9196
9197/// Lists the domains for the specified site.
9198///
9199/// A builder for the *sites.domains.list* method supported by a *project* resource.
9200/// It is not used directly, but through a [`ProjectMethods`] instance.
9201///
9202/// # Example
9203///
9204/// Instantiate a resource method builder
9205///
9206/// ```test_harness,no_run
9207/// # extern crate hyper;
9208/// # extern crate hyper_rustls;
9209/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
9210/// # async fn dox() {
9211/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9212///
9213/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9214/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9215/// # .with_native_roots()
9216/// # .unwrap()
9217/// # .https_only()
9218/// # .enable_http2()
9219/// # .build();
9220///
9221/// # let executor = hyper_util::rt::TokioExecutor::new();
9222/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9223/// # secret,
9224/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9225/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9226/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9227/// # ),
9228/// # ).build().await.unwrap();
9229///
9230/// # let client = hyper_util::client::legacy::Client::builder(
9231/// # hyper_util::rt::TokioExecutor::new()
9232/// # )
9233/// # .build(
9234/// # hyper_rustls::HttpsConnectorBuilder::new()
9235/// # .with_native_roots()
9236/// # .unwrap()
9237/// # .https_or_http()
9238/// # .enable_http2()
9239/// # .build()
9240/// # );
9241/// # let mut hub = FirebaseHosting::new(client, auth);
9242/// // You can configure optional parameters by calling the respective setters at will, and
9243/// // execute the final call using `doit()`.
9244/// // Values shown here are possibly random and not representative !
9245/// let result = hub.projects().sites_domains_list("parent")
9246/// .page_token("Stet")
9247/// .page_size(-99)
9248/// .doit().await;
9249/// # }
9250/// ```
9251pub struct ProjectSiteDomainListCall<'a, C>
9252where
9253 C: 'a,
9254{
9255 hub: &'a FirebaseHosting<C>,
9256 _parent: String,
9257 _page_token: Option<String>,
9258 _page_size: Option<i32>,
9259 _delegate: Option<&'a mut dyn common::Delegate>,
9260 _additional_params: HashMap<String, String>,
9261 _scopes: BTreeSet<String>,
9262}
9263
9264impl<'a, C> common::CallBuilder for ProjectSiteDomainListCall<'a, C> {}
9265
9266impl<'a, C> ProjectSiteDomainListCall<'a, C>
9267where
9268 C: common::Connector,
9269{
9270 /// Perform the operation you have build so far.
9271 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainsResponse)> {
9272 use std::borrow::Cow;
9273 use std::io::{Read, Seek};
9274
9275 use common::{url::Params, ToParts};
9276 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9277
9278 let mut dd = common::DefaultDelegate;
9279 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9280 dlg.begin(common::MethodInfo {
9281 id: "firebasehosting.projects.sites.domains.list",
9282 http_method: hyper::Method::GET,
9283 });
9284
9285 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
9286 if self._additional_params.contains_key(field) {
9287 dlg.finished(false);
9288 return Err(common::Error::FieldClash(field));
9289 }
9290 }
9291
9292 let mut params = Params::with_capacity(5 + self._additional_params.len());
9293 params.push("parent", self._parent);
9294 if let Some(value) = self._page_token.as_ref() {
9295 params.push("pageToken", value);
9296 }
9297 if let Some(value) = self._page_size.as_ref() {
9298 params.push("pageSize", value.to_string());
9299 }
9300
9301 params.extend(self._additional_params.iter());
9302
9303 params.push("alt", "json");
9304 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/domains";
9305 if self._scopes.is_empty() {
9306 self._scopes
9307 .insert(Scope::FirebaseReadonly.as_ref().to_string());
9308 }
9309
9310 #[allow(clippy::single_element_loop)]
9311 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9312 url = params.uri_replacement(url, param_name, find_this, true);
9313 }
9314 {
9315 let to_remove = ["parent"];
9316 params.remove_params(&to_remove);
9317 }
9318
9319 let url = params.parse_with_url(&url);
9320
9321 loop {
9322 let token = match self
9323 .hub
9324 .auth
9325 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9326 .await
9327 {
9328 Ok(token) => token,
9329 Err(e) => match dlg.token(e) {
9330 Ok(token) => token,
9331 Err(e) => {
9332 dlg.finished(false);
9333 return Err(common::Error::MissingToken(e));
9334 }
9335 },
9336 };
9337 let mut req_result = {
9338 let client = &self.hub.client;
9339 dlg.pre_request();
9340 let mut req_builder = hyper::Request::builder()
9341 .method(hyper::Method::GET)
9342 .uri(url.as_str())
9343 .header(USER_AGENT, self.hub._user_agent.clone());
9344
9345 if let Some(token) = token.as_ref() {
9346 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9347 }
9348
9349 let request = req_builder
9350 .header(CONTENT_LENGTH, 0_u64)
9351 .body(common::to_body::<String>(None));
9352
9353 client.request(request.unwrap()).await
9354 };
9355
9356 match req_result {
9357 Err(err) => {
9358 if let common::Retry::After(d) = dlg.http_error(&err) {
9359 sleep(d).await;
9360 continue;
9361 }
9362 dlg.finished(false);
9363 return Err(common::Error::HttpError(err));
9364 }
9365 Ok(res) => {
9366 let (mut parts, body) = res.into_parts();
9367 let mut body = common::Body::new(body);
9368 if !parts.status.is_success() {
9369 let bytes = common::to_bytes(body).await.unwrap_or_default();
9370 let error = serde_json::from_str(&common::to_string(&bytes));
9371 let response = common::to_response(parts, bytes.into());
9372
9373 if let common::Retry::After(d) =
9374 dlg.http_failure(&response, error.as_ref().ok())
9375 {
9376 sleep(d).await;
9377 continue;
9378 }
9379
9380 dlg.finished(false);
9381
9382 return Err(match error {
9383 Ok(value) => common::Error::BadRequest(value),
9384 _ => common::Error::Failure(response),
9385 });
9386 }
9387 let response = {
9388 let bytes = common::to_bytes(body).await.unwrap_or_default();
9389 let encoded = common::to_string(&bytes);
9390 match serde_json::from_str(&encoded) {
9391 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9392 Err(error) => {
9393 dlg.response_json_decode_error(&encoded, &error);
9394 return Err(common::Error::JsonDecodeError(
9395 encoded.to_string(),
9396 error,
9397 ));
9398 }
9399 }
9400 };
9401
9402 dlg.finished(true);
9403 return Ok(response);
9404 }
9405 }
9406 }
9407 }
9408
9409 /// Required. The parent for which to list domains, in the format: sites/ site-name
9410 ///
9411 /// Sets the *parent* path property to the given value.
9412 ///
9413 /// Even though the property as already been set when instantiating this call,
9414 /// we provide this method for API completeness.
9415 pub fn parent(mut self, new_value: &str) -> ProjectSiteDomainListCall<'a, C> {
9416 self._parent = new_value.to_string();
9417 self
9418 }
9419 /// The next_page_token from a previous request, if provided.
9420 ///
9421 /// Sets the *page token* query property to the given value.
9422 pub fn page_token(mut self, new_value: &str) -> ProjectSiteDomainListCall<'a, C> {
9423 self._page_token = Some(new_value.to_string());
9424 self
9425 }
9426 /// The page size to return. Defaults to 50.
9427 ///
9428 /// Sets the *page size* query property to the given value.
9429 pub fn page_size(mut self, new_value: i32) -> ProjectSiteDomainListCall<'a, C> {
9430 self._page_size = Some(new_value);
9431 self
9432 }
9433 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9434 /// while executing the actual API request.
9435 ///
9436 /// ````text
9437 /// It should be used to handle progress information, and to implement a certain level of resilience.
9438 /// ````
9439 ///
9440 /// Sets the *delegate* property to the given value.
9441 pub fn delegate(
9442 mut self,
9443 new_value: &'a mut dyn common::Delegate,
9444 ) -> ProjectSiteDomainListCall<'a, C> {
9445 self._delegate = Some(new_value);
9446 self
9447 }
9448
9449 /// Set any additional parameter of the query string used in the request.
9450 /// It should be used to set parameters which are not yet available through their own
9451 /// setters.
9452 ///
9453 /// Please note that this method must not be used to set any of the known parameters
9454 /// which have their own setter method. If done anyway, the request will fail.
9455 ///
9456 /// # Additional Parameters
9457 ///
9458 /// * *$.xgafv* (query-string) - V1 error format.
9459 /// * *access_token* (query-string) - OAuth access token.
9460 /// * *alt* (query-string) - Data format for response.
9461 /// * *callback* (query-string) - JSONP
9462 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9463 /// * *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.
9464 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9465 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9466 /// * *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.
9467 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9468 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9469 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainListCall<'a, C>
9470 where
9471 T: AsRef<str>,
9472 {
9473 self._additional_params
9474 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9475 self
9476 }
9477
9478 /// Identifies the authorization scope for the method you are building.
9479 ///
9480 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9481 /// [`Scope::FirebaseReadonly`].
9482 ///
9483 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9484 /// tokens for more than one scope.
9485 ///
9486 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9487 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9488 /// sufficient, a read-write scope will do as well.
9489 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainListCall<'a, C>
9490 where
9491 St: AsRef<str>,
9492 {
9493 self._scopes.insert(String::from(scope.as_ref()));
9494 self
9495 }
9496 /// Identifies the authorization scope(s) for the method you are building.
9497 ///
9498 /// See [`Self::add_scope()`] for details.
9499 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainListCall<'a, C>
9500 where
9501 I: IntoIterator<Item = St>,
9502 St: AsRef<str>,
9503 {
9504 self._scopes
9505 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9506 self
9507 }
9508
9509 /// Removes all scopes, and no default scope will be used either.
9510 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9511 /// for details).
9512 pub fn clear_scopes(mut self) -> ProjectSiteDomainListCall<'a, C> {
9513 self._scopes.clear();
9514 self
9515 }
9516}
9517
9518/// Updates the specified domain mapping, creating the mapping as if it does not exist.
9519///
9520/// A builder for the *sites.domains.update* method supported by a *project* resource.
9521/// It is not used directly, but through a [`ProjectMethods`] instance.
9522///
9523/// # Example
9524///
9525/// Instantiate a resource method builder
9526///
9527/// ```test_harness,no_run
9528/// # extern crate hyper;
9529/// # extern crate hyper_rustls;
9530/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
9531/// use firebasehosting1_beta1::api::Domain;
9532/// # async fn dox() {
9533/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9534///
9535/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9536/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9537/// # .with_native_roots()
9538/// # .unwrap()
9539/// # .https_only()
9540/// # .enable_http2()
9541/// # .build();
9542///
9543/// # let executor = hyper_util::rt::TokioExecutor::new();
9544/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9545/// # secret,
9546/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9547/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9548/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9549/// # ),
9550/// # ).build().await.unwrap();
9551///
9552/// # let client = hyper_util::client::legacy::Client::builder(
9553/// # hyper_util::rt::TokioExecutor::new()
9554/// # )
9555/// # .build(
9556/// # hyper_rustls::HttpsConnectorBuilder::new()
9557/// # .with_native_roots()
9558/// # .unwrap()
9559/// # .https_or_http()
9560/// # .enable_http2()
9561/// # .build()
9562/// # );
9563/// # let mut hub = FirebaseHosting::new(client, auth);
9564/// // As the method needs a request, you would usually fill it with the desired information
9565/// // into the respective structure. Some of the parts shown here might not be applicable !
9566/// // Values shown here are possibly random and not representative !
9567/// let mut req = Domain::default();
9568///
9569/// // You can configure optional parameters by calling the respective setters at will, and
9570/// // execute the final call using `doit()`.
9571/// // Values shown here are possibly random and not representative !
9572/// let result = hub.projects().sites_domains_update(req, "name")
9573/// .doit().await;
9574/// # }
9575/// ```
9576pub struct ProjectSiteDomainUpdateCall<'a, C>
9577where
9578 C: 'a,
9579{
9580 hub: &'a FirebaseHosting<C>,
9581 _request: Domain,
9582 _name: String,
9583 _delegate: Option<&'a mut dyn common::Delegate>,
9584 _additional_params: HashMap<String, String>,
9585 _scopes: BTreeSet<String>,
9586}
9587
9588impl<'a, C> common::CallBuilder for ProjectSiteDomainUpdateCall<'a, C> {}
9589
9590impl<'a, C> ProjectSiteDomainUpdateCall<'a, C>
9591where
9592 C: common::Connector,
9593{
9594 /// Perform the operation you have build so far.
9595 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
9596 use std::borrow::Cow;
9597 use std::io::{Read, Seek};
9598
9599 use common::{url::Params, ToParts};
9600 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9601
9602 let mut dd = common::DefaultDelegate;
9603 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9604 dlg.begin(common::MethodInfo {
9605 id: "firebasehosting.projects.sites.domains.update",
9606 http_method: hyper::Method::PUT,
9607 });
9608
9609 for &field in ["alt", "name"].iter() {
9610 if self._additional_params.contains_key(field) {
9611 dlg.finished(false);
9612 return Err(common::Error::FieldClash(field));
9613 }
9614 }
9615
9616 let mut params = Params::with_capacity(4 + self._additional_params.len());
9617 params.push("name", self._name);
9618
9619 params.extend(self._additional_params.iter());
9620
9621 params.push("alt", "json");
9622 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
9623 if self._scopes.is_empty() {
9624 self._scopes
9625 .insert(Scope::CloudPlatform.as_ref().to_string());
9626 }
9627
9628 #[allow(clippy::single_element_loop)]
9629 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9630 url = params.uri_replacement(url, param_name, find_this, true);
9631 }
9632 {
9633 let to_remove = ["name"];
9634 params.remove_params(&to_remove);
9635 }
9636
9637 let url = params.parse_with_url(&url);
9638
9639 let mut json_mime_type = mime::APPLICATION_JSON;
9640 let mut request_value_reader = {
9641 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9642 common::remove_json_null_values(&mut value);
9643 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9644 serde_json::to_writer(&mut dst, &value).unwrap();
9645 dst
9646 };
9647 let request_size = request_value_reader
9648 .seek(std::io::SeekFrom::End(0))
9649 .unwrap();
9650 request_value_reader
9651 .seek(std::io::SeekFrom::Start(0))
9652 .unwrap();
9653
9654 loop {
9655 let token = match self
9656 .hub
9657 .auth
9658 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9659 .await
9660 {
9661 Ok(token) => token,
9662 Err(e) => match dlg.token(e) {
9663 Ok(token) => token,
9664 Err(e) => {
9665 dlg.finished(false);
9666 return Err(common::Error::MissingToken(e));
9667 }
9668 },
9669 };
9670 request_value_reader
9671 .seek(std::io::SeekFrom::Start(0))
9672 .unwrap();
9673 let mut req_result = {
9674 let client = &self.hub.client;
9675 dlg.pre_request();
9676 let mut req_builder = hyper::Request::builder()
9677 .method(hyper::Method::PUT)
9678 .uri(url.as_str())
9679 .header(USER_AGENT, self.hub._user_agent.clone());
9680
9681 if let Some(token) = token.as_ref() {
9682 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9683 }
9684
9685 let request = req_builder
9686 .header(CONTENT_TYPE, json_mime_type.to_string())
9687 .header(CONTENT_LENGTH, request_size as u64)
9688 .body(common::to_body(
9689 request_value_reader.get_ref().clone().into(),
9690 ));
9691
9692 client.request(request.unwrap()).await
9693 };
9694
9695 match req_result {
9696 Err(err) => {
9697 if let common::Retry::After(d) = dlg.http_error(&err) {
9698 sleep(d).await;
9699 continue;
9700 }
9701 dlg.finished(false);
9702 return Err(common::Error::HttpError(err));
9703 }
9704 Ok(res) => {
9705 let (mut parts, body) = res.into_parts();
9706 let mut body = common::Body::new(body);
9707 if !parts.status.is_success() {
9708 let bytes = common::to_bytes(body).await.unwrap_or_default();
9709 let error = serde_json::from_str(&common::to_string(&bytes));
9710 let response = common::to_response(parts, bytes.into());
9711
9712 if let common::Retry::After(d) =
9713 dlg.http_failure(&response, error.as_ref().ok())
9714 {
9715 sleep(d).await;
9716 continue;
9717 }
9718
9719 dlg.finished(false);
9720
9721 return Err(match error {
9722 Ok(value) => common::Error::BadRequest(value),
9723 _ => common::Error::Failure(response),
9724 });
9725 }
9726 let response = {
9727 let bytes = common::to_bytes(body).await.unwrap_or_default();
9728 let encoded = common::to_string(&bytes);
9729 match serde_json::from_str(&encoded) {
9730 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9731 Err(error) => {
9732 dlg.response_json_decode_error(&encoded, &error);
9733 return Err(common::Error::JsonDecodeError(
9734 encoded.to_string(),
9735 error,
9736 ));
9737 }
9738 }
9739 };
9740
9741 dlg.finished(true);
9742 return Ok(response);
9743 }
9744 }
9745 }
9746 }
9747
9748 ///
9749 /// Sets the *request* property to the given value.
9750 ///
9751 /// Even though the property as already been set when instantiating this call,
9752 /// we provide this method for API completeness.
9753 pub fn request(mut self, new_value: Domain) -> ProjectSiteDomainUpdateCall<'a, C> {
9754 self._request = new_value;
9755 self
9756 }
9757 /// Required. The name of the domain association to update or create, if an association doesn't already exist.
9758 ///
9759 /// Sets the *name* path property to the given value.
9760 ///
9761 /// Even though the property as already been set when instantiating this call,
9762 /// we provide this method for API completeness.
9763 pub fn name(mut self, new_value: &str) -> ProjectSiteDomainUpdateCall<'a, C> {
9764 self._name = new_value.to_string();
9765 self
9766 }
9767 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9768 /// while executing the actual API request.
9769 ///
9770 /// ````text
9771 /// It should be used to handle progress information, and to implement a certain level of resilience.
9772 /// ````
9773 ///
9774 /// Sets the *delegate* property to the given value.
9775 pub fn delegate(
9776 mut self,
9777 new_value: &'a mut dyn common::Delegate,
9778 ) -> ProjectSiteDomainUpdateCall<'a, C> {
9779 self._delegate = Some(new_value);
9780 self
9781 }
9782
9783 /// Set any additional parameter of the query string used in the request.
9784 /// It should be used to set parameters which are not yet available through their own
9785 /// setters.
9786 ///
9787 /// Please note that this method must not be used to set any of the known parameters
9788 /// which have their own setter method. If done anyway, the request will fail.
9789 ///
9790 /// # Additional Parameters
9791 ///
9792 /// * *$.xgafv* (query-string) - V1 error format.
9793 /// * *access_token* (query-string) - OAuth access token.
9794 /// * *alt* (query-string) - Data format for response.
9795 /// * *callback* (query-string) - JSONP
9796 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9797 /// * *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.
9798 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9799 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9800 /// * *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.
9801 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9802 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9803 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDomainUpdateCall<'a, C>
9804 where
9805 T: AsRef<str>,
9806 {
9807 self._additional_params
9808 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9809 self
9810 }
9811
9812 /// Identifies the authorization scope for the method you are building.
9813 ///
9814 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9815 /// [`Scope::CloudPlatform`].
9816 ///
9817 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9818 /// tokens for more than one scope.
9819 ///
9820 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9821 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9822 /// sufficient, a read-write scope will do as well.
9823 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDomainUpdateCall<'a, C>
9824 where
9825 St: AsRef<str>,
9826 {
9827 self._scopes.insert(String::from(scope.as_ref()));
9828 self
9829 }
9830 /// Identifies the authorization scope(s) for the method you are building.
9831 ///
9832 /// See [`Self::add_scope()`] for details.
9833 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDomainUpdateCall<'a, C>
9834 where
9835 I: IntoIterator<Item = St>,
9836 St: AsRef<str>,
9837 {
9838 self._scopes
9839 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9840 self
9841 }
9842
9843 /// Removes all scopes, and no default scope will be used either.
9844 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9845 /// for details).
9846 pub fn clear_scopes(mut self) -> ProjectSiteDomainUpdateCall<'a, C> {
9847 self._scopes.clear();
9848 self
9849 }
9850}
9851
9852/// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
9853///
9854/// A builder for the *sites.releases.create* method supported by a *project* resource.
9855/// It is not used directly, but through a [`ProjectMethods`] instance.
9856///
9857/// # Example
9858///
9859/// Instantiate a resource method builder
9860///
9861/// ```test_harness,no_run
9862/// # extern crate hyper;
9863/// # extern crate hyper_rustls;
9864/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
9865/// use firebasehosting1_beta1::api::Release;
9866/// # async fn dox() {
9867/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9868///
9869/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9870/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9871/// # .with_native_roots()
9872/// # .unwrap()
9873/// # .https_only()
9874/// # .enable_http2()
9875/// # .build();
9876///
9877/// # let executor = hyper_util::rt::TokioExecutor::new();
9878/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9879/// # secret,
9880/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9881/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9882/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9883/// # ),
9884/// # ).build().await.unwrap();
9885///
9886/// # let client = hyper_util::client::legacy::Client::builder(
9887/// # hyper_util::rt::TokioExecutor::new()
9888/// # )
9889/// # .build(
9890/// # hyper_rustls::HttpsConnectorBuilder::new()
9891/// # .with_native_roots()
9892/// # .unwrap()
9893/// # .https_or_http()
9894/// # .enable_http2()
9895/// # .build()
9896/// # );
9897/// # let mut hub = FirebaseHosting::new(client, auth);
9898/// // As the method needs a request, you would usually fill it with the desired information
9899/// // into the respective structure. Some of the parts shown here might not be applicable !
9900/// // Values shown here are possibly random and not representative !
9901/// let mut req = Release::default();
9902///
9903/// // You can configure optional parameters by calling the respective setters at will, and
9904/// // execute the final call using `doit()`.
9905/// // Values shown here are possibly random and not representative !
9906/// let result = hub.projects().sites_releases_create(req, "parent")
9907/// .version_name("vero")
9908/// .doit().await;
9909/// # }
9910/// ```
9911pub struct ProjectSiteReleaseCreateCall<'a, C>
9912where
9913 C: 'a,
9914{
9915 hub: &'a FirebaseHosting<C>,
9916 _request: Release,
9917 _parent: String,
9918 _version_name: Option<String>,
9919 _delegate: Option<&'a mut dyn common::Delegate>,
9920 _additional_params: HashMap<String, String>,
9921 _scopes: BTreeSet<String>,
9922}
9923
9924impl<'a, C> common::CallBuilder for ProjectSiteReleaseCreateCall<'a, C> {}
9925
9926impl<'a, C> ProjectSiteReleaseCreateCall<'a, C>
9927where
9928 C: common::Connector,
9929{
9930 /// Perform the operation you have build so far.
9931 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
9932 use std::borrow::Cow;
9933 use std::io::{Read, Seek};
9934
9935 use common::{url::Params, ToParts};
9936 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9937
9938 let mut dd = common::DefaultDelegate;
9939 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9940 dlg.begin(common::MethodInfo {
9941 id: "firebasehosting.projects.sites.releases.create",
9942 http_method: hyper::Method::POST,
9943 });
9944
9945 for &field in ["alt", "parent", "versionName"].iter() {
9946 if self._additional_params.contains_key(field) {
9947 dlg.finished(false);
9948 return Err(common::Error::FieldClash(field));
9949 }
9950 }
9951
9952 let mut params = Params::with_capacity(5 + self._additional_params.len());
9953 params.push("parent", self._parent);
9954 if let Some(value) = self._version_name.as_ref() {
9955 params.push("versionName", value);
9956 }
9957
9958 params.extend(self._additional_params.iter());
9959
9960 params.push("alt", "json");
9961 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
9962 if self._scopes.is_empty() {
9963 self._scopes
9964 .insert(Scope::CloudPlatform.as_ref().to_string());
9965 }
9966
9967 #[allow(clippy::single_element_loop)]
9968 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9969 url = params.uri_replacement(url, param_name, find_this, true);
9970 }
9971 {
9972 let to_remove = ["parent"];
9973 params.remove_params(&to_remove);
9974 }
9975
9976 let url = params.parse_with_url(&url);
9977
9978 let mut json_mime_type = mime::APPLICATION_JSON;
9979 let mut request_value_reader = {
9980 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9981 common::remove_json_null_values(&mut value);
9982 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9983 serde_json::to_writer(&mut dst, &value).unwrap();
9984 dst
9985 };
9986 let request_size = request_value_reader
9987 .seek(std::io::SeekFrom::End(0))
9988 .unwrap();
9989 request_value_reader
9990 .seek(std::io::SeekFrom::Start(0))
9991 .unwrap();
9992
9993 loop {
9994 let token = match self
9995 .hub
9996 .auth
9997 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9998 .await
9999 {
10000 Ok(token) => token,
10001 Err(e) => match dlg.token(e) {
10002 Ok(token) => token,
10003 Err(e) => {
10004 dlg.finished(false);
10005 return Err(common::Error::MissingToken(e));
10006 }
10007 },
10008 };
10009 request_value_reader
10010 .seek(std::io::SeekFrom::Start(0))
10011 .unwrap();
10012 let mut req_result = {
10013 let client = &self.hub.client;
10014 dlg.pre_request();
10015 let mut req_builder = hyper::Request::builder()
10016 .method(hyper::Method::POST)
10017 .uri(url.as_str())
10018 .header(USER_AGENT, self.hub._user_agent.clone());
10019
10020 if let Some(token) = token.as_ref() {
10021 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10022 }
10023
10024 let request = req_builder
10025 .header(CONTENT_TYPE, json_mime_type.to_string())
10026 .header(CONTENT_LENGTH, request_size as u64)
10027 .body(common::to_body(
10028 request_value_reader.get_ref().clone().into(),
10029 ));
10030
10031 client.request(request.unwrap()).await
10032 };
10033
10034 match req_result {
10035 Err(err) => {
10036 if let common::Retry::After(d) = dlg.http_error(&err) {
10037 sleep(d).await;
10038 continue;
10039 }
10040 dlg.finished(false);
10041 return Err(common::Error::HttpError(err));
10042 }
10043 Ok(res) => {
10044 let (mut parts, body) = res.into_parts();
10045 let mut body = common::Body::new(body);
10046 if !parts.status.is_success() {
10047 let bytes = common::to_bytes(body).await.unwrap_or_default();
10048 let error = serde_json::from_str(&common::to_string(&bytes));
10049 let response = common::to_response(parts, bytes.into());
10050
10051 if let common::Retry::After(d) =
10052 dlg.http_failure(&response, error.as_ref().ok())
10053 {
10054 sleep(d).await;
10055 continue;
10056 }
10057
10058 dlg.finished(false);
10059
10060 return Err(match error {
10061 Ok(value) => common::Error::BadRequest(value),
10062 _ => common::Error::Failure(response),
10063 });
10064 }
10065 let response = {
10066 let bytes = common::to_bytes(body).await.unwrap_or_default();
10067 let encoded = common::to_string(&bytes);
10068 match serde_json::from_str(&encoded) {
10069 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10070 Err(error) => {
10071 dlg.response_json_decode_error(&encoded, &error);
10072 return Err(common::Error::JsonDecodeError(
10073 encoded.to_string(),
10074 error,
10075 ));
10076 }
10077 }
10078 };
10079
10080 dlg.finished(true);
10081 return Ok(response);
10082 }
10083 }
10084 }
10085 }
10086
10087 ///
10088 /// Sets the *request* property to the given value.
10089 ///
10090 /// Even though the property as already been set when instantiating this call,
10091 /// we provide this method for API completeness.
10092 pub fn request(mut self, new_value: Release) -> ProjectSiteReleaseCreateCall<'a, C> {
10093 self._request = new_value;
10094 self
10095 }
10096 /// 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
10097 ///
10098 /// Sets the *parent* path property to the given value.
10099 ///
10100 /// Even though the property as already been set when instantiating this call,
10101 /// we provide this method for API completeness.
10102 pub fn parent(mut self, new_value: &str) -> ProjectSiteReleaseCreateCall<'a, C> {
10103 self._parent = new_value.to_string();
10104 self
10105 }
10106 /// 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`.
10107 ///
10108 /// Sets the *version name* query property to the given value.
10109 pub fn version_name(mut self, new_value: &str) -> ProjectSiteReleaseCreateCall<'a, C> {
10110 self._version_name = Some(new_value.to_string());
10111 self
10112 }
10113 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10114 /// while executing the actual API request.
10115 ///
10116 /// ````text
10117 /// It should be used to handle progress information, and to implement a certain level of resilience.
10118 /// ````
10119 ///
10120 /// Sets the *delegate* property to the given value.
10121 pub fn delegate(
10122 mut self,
10123 new_value: &'a mut dyn common::Delegate,
10124 ) -> ProjectSiteReleaseCreateCall<'a, C> {
10125 self._delegate = Some(new_value);
10126 self
10127 }
10128
10129 /// Set any additional parameter of the query string used in the request.
10130 /// It should be used to set parameters which are not yet available through their own
10131 /// setters.
10132 ///
10133 /// Please note that this method must not be used to set any of the known parameters
10134 /// which have their own setter method. If done anyway, the request will fail.
10135 ///
10136 /// # Additional Parameters
10137 ///
10138 /// * *$.xgafv* (query-string) - V1 error format.
10139 /// * *access_token* (query-string) - OAuth access token.
10140 /// * *alt* (query-string) - Data format for response.
10141 /// * *callback* (query-string) - JSONP
10142 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10143 /// * *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.
10144 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10145 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10146 /// * *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.
10147 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10148 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10149 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteReleaseCreateCall<'a, C>
10150 where
10151 T: AsRef<str>,
10152 {
10153 self._additional_params
10154 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10155 self
10156 }
10157
10158 /// Identifies the authorization scope for the method you are building.
10159 ///
10160 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10161 /// [`Scope::CloudPlatform`].
10162 ///
10163 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10164 /// tokens for more than one scope.
10165 ///
10166 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10167 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10168 /// sufficient, a read-write scope will do as well.
10169 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteReleaseCreateCall<'a, C>
10170 where
10171 St: AsRef<str>,
10172 {
10173 self._scopes.insert(String::from(scope.as_ref()));
10174 self
10175 }
10176 /// Identifies the authorization scope(s) for the method you are building.
10177 ///
10178 /// See [`Self::add_scope()`] for details.
10179 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteReleaseCreateCall<'a, C>
10180 where
10181 I: IntoIterator<Item = St>,
10182 St: AsRef<str>,
10183 {
10184 self._scopes
10185 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10186 self
10187 }
10188
10189 /// Removes all scopes, and no default scope will be used either.
10190 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10191 /// for details).
10192 pub fn clear_scopes(mut self) -> ProjectSiteReleaseCreateCall<'a, C> {
10193 self._scopes.clear();
10194 self
10195 }
10196}
10197
10198/// 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.
10199///
10200/// A builder for the *sites.releases.get* method supported by a *project* resource.
10201/// It is not used directly, but through a [`ProjectMethods`] instance.
10202///
10203/// # Example
10204///
10205/// Instantiate a resource method builder
10206///
10207/// ```test_harness,no_run
10208/// # extern crate hyper;
10209/// # extern crate hyper_rustls;
10210/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
10211/// # async fn dox() {
10212/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10213///
10214/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10215/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10216/// # .with_native_roots()
10217/// # .unwrap()
10218/// # .https_only()
10219/// # .enable_http2()
10220/// # .build();
10221///
10222/// # let executor = hyper_util::rt::TokioExecutor::new();
10223/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10224/// # secret,
10225/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10226/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10227/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10228/// # ),
10229/// # ).build().await.unwrap();
10230///
10231/// # let client = hyper_util::client::legacy::Client::builder(
10232/// # hyper_util::rt::TokioExecutor::new()
10233/// # )
10234/// # .build(
10235/// # hyper_rustls::HttpsConnectorBuilder::new()
10236/// # .with_native_roots()
10237/// # .unwrap()
10238/// # .https_or_http()
10239/// # .enable_http2()
10240/// # .build()
10241/// # );
10242/// # let mut hub = FirebaseHosting::new(client, auth);
10243/// // You can configure optional parameters by calling the respective setters at will, and
10244/// // execute the final call using `doit()`.
10245/// // Values shown here are possibly random and not representative !
10246/// let result = hub.projects().sites_releases_get("name")
10247/// .doit().await;
10248/// # }
10249/// ```
10250pub struct ProjectSiteReleaseGetCall<'a, C>
10251where
10252 C: 'a,
10253{
10254 hub: &'a FirebaseHosting<C>,
10255 _name: String,
10256 _delegate: Option<&'a mut dyn common::Delegate>,
10257 _additional_params: HashMap<String, String>,
10258 _scopes: BTreeSet<String>,
10259}
10260
10261impl<'a, C> common::CallBuilder for ProjectSiteReleaseGetCall<'a, C> {}
10262
10263impl<'a, C> ProjectSiteReleaseGetCall<'a, C>
10264where
10265 C: common::Connector,
10266{
10267 /// Perform the operation you have build so far.
10268 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
10269 use std::borrow::Cow;
10270 use std::io::{Read, Seek};
10271
10272 use common::{url::Params, ToParts};
10273 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10274
10275 let mut dd = common::DefaultDelegate;
10276 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10277 dlg.begin(common::MethodInfo {
10278 id: "firebasehosting.projects.sites.releases.get",
10279 http_method: hyper::Method::GET,
10280 });
10281
10282 for &field in ["alt", "name"].iter() {
10283 if self._additional_params.contains_key(field) {
10284 dlg.finished(false);
10285 return Err(common::Error::FieldClash(field));
10286 }
10287 }
10288
10289 let mut params = Params::with_capacity(3 + self._additional_params.len());
10290 params.push("name", self._name);
10291
10292 params.extend(self._additional_params.iter());
10293
10294 params.push("alt", "json");
10295 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
10296 if self._scopes.is_empty() {
10297 self._scopes
10298 .insert(Scope::FirebaseReadonly.as_ref().to_string());
10299 }
10300
10301 #[allow(clippy::single_element_loop)]
10302 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10303 url = params.uri_replacement(url, param_name, find_this, true);
10304 }
10305 {
10306 let to_remove = ["name"];
10307 params.remove_params(&to_remove);
10308 }
10309
10310 let url = params.parse_with_url(&url);
10311
10312 loop {
10313 let token = match self
10314 .hub
10315 .auth
10316 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10317 .await
10318 {
10319 Ok(token) => token,
10320 Err(e) => match dlg.token(e) {
10321 Ok(token) => token,
10322 Err(e) => {
10323 dlg.finished(false);
10324 return Err(common::Error::MissingToken(e));
10325 }
10326 },
10327 };
10328 let mut req_result = {
10329 let client = &self.hub.client;
10330 dlg.pre_request();
10331 let mut req_builder = hyper::Request::builder()
10332 .method(hyper::Method::GET)
10333 .uri(url.as_str())
10334 .header(USER_AGENT, self.hub._user_agent.clone());
10335
10336 if let Some(token) = token.as_ref() {
10337 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10338 }
10339
10340 let request = req_builder
10341 .header(CONTENT_LENGTH, 0_u64)
10342 .body(common::to_body::<String>(None));
10343
10344 client.request(request.unwrap()).await
10345 };
10346
10347 match req_result {
10348 Err(err) => {
10349 if let common::Retry::After(d) = dlg.http_error(&err) {
10350 sleep(d).await;
10351 continue;
10352 }
10353 dlg.finished(false);
10354 return Err(common::Error::HttpError(err));
10355 }
10356 Ok(res) => {
10357 let (mut parts, body) = res.into_parts();
10358 let mut body = common::Body::new(body);
10359 if !parts.status.is_success() {
10360 let bytes = common::to_bytes(body).await.unwrap_or_default();
10361 let error = serde_json::from_str(&common::to_string(&bytes));
10362 let response = common::to_response(parts, bytes.into());
10363
10364 if let common::Retry::After(d) =
10365 dlg.http_failure(&response, error.as_ref().ok())
10366 {
10367 sleep(d).await;
10368 continue;
10369 }
10370
10371 dlg.finished(false);
10372
10373 return Err(match error {
10374 Ok(value) => common::Error::BadRequest(value),
10375 _ => common::Error::Failure(response),
10376 });
10377 }
10378 let response = {
10379 let bytes = common::to_bytes(body).await.unwrap_or_default();
10380 let encoded = common::to_string(&bytes);
10381 match serde_json::from_str(&encoded) {
10382 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10383 Err(error) => {
10384 dlg.response_json_decode_error(&encoded, &error);
10385 return Err(common::Error::JsonDecodeError(
10386 encoded.to_string(),
10387 error,
10388 ));
10389 }
10390 }
10391 };
10392
10393 dlg.finished(true);
10394 return Ok(response);
10395 }
10396 }
10397 }
10398 }
10399
10400 /// 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
10401 ///
10402 /// Sets the *name* path property to the given value.
10403 ///
10404 /// Even though the property as already been set when instantiating this call,
10405 /// we provide this method for API completeness.
10406 pub fn name(mut self, new_value: &str) -> ProjectSiteReleaseGetCall<'a, C> {
10407 self._name = new_value.to_string();
10408 self
10409 }
10410 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10411 /// while executing the actual API request.
10412 ///
10413 /// ````text
10414 /// It should be used to handle progress information, and to implement a certain level of resilience.
10415 /// ````
10416 ///
10417 /// Sets the *delegate* property to the given value.
10418 pub fn delegate(
10419 mut self,
10420 new_value: &'a mut dyn common::Delegate,
10421 ) -> ProjectSiteReleaseGetCall<'a, C> {
10422 self._delegate = Some(new_value);
10423 self
10424 }
10425
10426 /// Set any additional parameter of the query string used in the request.
10427 /// It should be used to set parameters which are not yet available through their own
10428 /// setters.
10429 ///
10430 /// Please note that this method must not be used to set any of the known parameters
10431 /// which have their own setter method. If done anyway, the request will fail.
10432 ///
10433 /// # Additional Parameters
10434 ///
10435 /// * *$.xgafv* (query-string) - V1 error format.
10436 /// * *access_token* (query-string) - OAuth access token.
10437 /// * *alt* (query-string) - Data format for response.
10438 /// * *callback* (query-string) - JSONP
10439 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10440 /// * *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.
10441 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10442 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10443 /// * *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.
10444 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10445 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10446 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteReleaseGetCall<'a, C>
10447 where
10448 T: AsRef<str>,
10449 {
10450 self._additional_params
10451 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10452 self
10453 }
10454
10455 /// Identifies the authorization scope for the method you are building.
10456 ///
10457 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10458 /// [`Scope::FirebaseReadonly`].
10459 ///
10460 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10461 /// tokens for more than one scope.
10462 ///
10463 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10464 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10465 /// sufficient, a read-write scope will do as well.
10466 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteReleaseGetCall<'a, C>
10467 where
10468 St: AsRef<str>,
10469 {
10470 self._scopes.insert(String::from(scope.as_ref()));
10471 self
10472 }
10473 /// Identifies the authorization scope(s) for the method you are building.
10474 ///
10475 /// See [`Self::add_scope()`] for details.
10476 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteReleaseGetCall<'a, C>
10477 where
10478 I: IntoIterator<Item = St>,
10479 St: AsRef<str>,
10480 {
10481 self._scopes
10482 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10483 self
10484 }
10485
10486 /// Removes all scopes, and no default scope will be used either.
10487 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10488 /// for details).
10489 pub fn clear_scopes(mut self) -> ProjectSiteReleaseGetCall<'a, C> {
10490 self._scopes.clear();
10491 self
10492 }
10493}
10494
10495/// 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.
10496///
10497/// A builder for the *sites.releases.list* method supported by a *project* resource.
10498/// It is not used directly, but through a [`ProjectMethods`] instance.
10499///
10500/// # Example
10501///
10502/// Instantiate a resource method builder
10503///
10504/// ```test_harness,no_run
10505/// # extern crate hyper;
10506/// # extern crate hyper_rustls;
10507/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
10508/// # async fn dox() {
10509/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10510///
10511/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10512/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10513/// # .with_native_roots()
10514/// # .unwrap()
10515/// # .https_only()
10516/// # .enable_http2()
10517/// # .build();
10518///
10519/// # let executor = hyper_util::rt::TokioExecutor::new();
10520/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10521/// # secret,
10522/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10523/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10524/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10525/// # ),
10526/// # ).build().await.unwrap();
10527///
10528/// # let client = hyper_util::client::legacy::Client::builder(
10529/// # hyper_util::rt::TokioExecutor::new()
10530/// # )
10531/// # .build(
10532/// # hyper_rustls::HttpsConnectorBuilder::new()
10533/// # .with_native_roots()
10534/// # .unwrap()
10535/// # .https_or_http()
10536/// # .enable_http2()
10537/// # .build()
10538/// # );
10539/// # let mut hub = FirebaseHosting::new(client, auth);
10540/// // You can configure optional parameters by calling the respective setters at will, and
10541/// // execute the final call using `doit()`.
10542/// // Values shown here are possibly random and not representative !
10543/// let result = hub.projects().sites_releases_list("parent")
10544/// .page_token("vero")
10545/// .page_size(-44)
10546/// .doit().await;
10547/// # }
10548/// ```
10549pub struct ProjectSiteReleaseListCall<'a, C>
10550where
10551 C: 'a,
10552{
10553 hub: &'a FirebaseHosting<C>,
10554 _parent: String,
10555 _page_token: Option<String>,
10556 _page_size: Option<i32>,
10557 _delegate: Option<&'a mut dyn common::Delegate>,
10558 _additional_params: HashMap<String, String>,
10559 _scopes: BTreeSet<String>,
10560}
10561
10562impl<'a, C> common::CallBuilder for ProjectSiteReleaseListCall<'a, C> {}
10563
10564impl<'a, C> ProjectSiteReleaseListCall<'a, C>
10565where
10566 C: common::Connector,
10567{
10568 /// Perform the operation you have build so far.
10569 pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
10570 use std::borrow::Cow;
10571 use std::io::{Read, Seek};
10572
10573 use common::{url::Params, ToParts};
10574 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10575
10576 let mut dd = common::DefaultDelegate;
10577 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10578 dlg.begin(common::MethodInfo {
10579 id: "firebasehosting.projects.sites.releases.list",
10580 http_method: hyper::Method::GET,
10581 });
10582
10583 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
10584 if self._additional_params.contains_key(field) {
10585 dlg.finished(false);
10586 return Err(common::Error::FieldClash(field));
10587 }
10588 }
10589
10590 let mut params = Params::with_capacity(5 + self._additional_params.len());
10591 params.push("parent", self._parent);
10592 if let Some(value) = self._page_token.as_ref() {
10593 params.push("pageToken", value);
10594 }
10595 if let Some(value) = self._page_size.as_ref() {
10596 params.push("pageSize", value.to_string());
10597 }
10598
10599 params.extend(self._additional_params.iter());
10600
10601 params.push("alt", "json");
10602 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
10603 if self._scopes.is_empty() {
10604 self._scopes
10605 .insert(Scope::FirebaseReadonly.as_ref().to_string());
10606 }
10607
10608 #[allow(clippy::single_element_loop)]
10609 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10610 url = params.uri_replacement(url, param_name, find_this, true);
10611 }
10612 {
10613 let to_remove = ["parent"];
10614 params.remove_params(&to_remove);
10615 }
10616
10617 let url = params.parse_with_url(&url);
10618
10619 loop {
10620 let token = match self
10621 .hub
10622 .auth
10623 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10624 .await
10625 {
10626 Ok(token) => token,
10627 Err(e) => match dlg.token(e) {
10628 Ok(token) => token,
10629 Err(e) => {
10630 dlg.finished(false);
10631 return Err(common::Error::MissingToken(e));
10632 }
10633 },
10634 };
10635 let mut req_result = {
10636 let client = &self.hub.client;
10637 dlg.pre_request();
10638 let mut req_builder = hyper::Request::builder()
10639 .method(hyper::Method::GET)
10640 .uri(url.as_str())
10641 .header(USER_AGENT, self.hub._user_agent.clone());
10642
10643 if let Some(token) = token.as_ref() {
10644 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10645 }
10646
10647 let request = req_builder
10648 .header(CONTENT_LENGTH, 0_u64)
10649 .body(common::to_body::<String>(None));
10650
10651 client.request(request.unwrap()).await
10652 };
10653
10654 match req_result {
10655 Err(err) => {
10656 if let common::Retry::After(d) = dlg.http_error(&err) {
10657 sleep(d).await;
10658 continue;
10659 }
10660 dlg.finished(false);
10661 return Err(common::Error::HttpError(err));
10662 }
10663 Ok(res) => {
10664 let (mut parts, body) = res.into_parts();
10665 let mut body = common::Body::new(body);
10666 if !parts.status.is_success() {
10667 let bytes = common::to_bytes(body).await.unwrap_or_default();
10668 let error = serde_json::from_str(&common::to_string(&bytes));
10669 let response = common::to_response(parts, bytes.into());
10670
10671 if let common::Retry::After(d) =
10672 dlg.http_failure(&response, error.as_ref().ok())
10673 {
10674 sleep(d).await;
10675 continue;
10676 }
10677
10678 dlg.finished(false);
10679
10680 return Err(match error {
10681 Ok(value) => common::Error::BadRequest(value),
10682 _ => common::Error::Failure(response),
10683 });
10684 }
10685 let response = {
10686 let bytes = common::to_bytes(body).await.unwrap_or_default();
10687 let encoded = common::to_string(&bytes);
10688 match serde_json::from_str(&encoded) {
10689 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10690 Err(error) => {
10691 dlg.response_json_decode_error(&encoded, &error);
10692 return Err(common::Error::JsonDecodeError(
10693 encoded.to_string(),
10694 error,
10695 ));
10696 }
10697 }
10698 };
10699
10700 dlg.finished(true);
10701 return Ok(response);
10702 }
10703 }
10704 }
10705 }
10706
10707 /// 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
10708 ///
10709 /// Sets the *parent* path property to the given value.
10710 ///
10711 /// Even though the property as already been set when instantiating this call,
10712 /// we provide this method for API completeness.
10713 pub fn parent(mut self, new_value: &str) -> ProjectSiteReleaseListCall<'a, C> {
10714 self._parent = new_value.to_string();
10715 self
10716 }
10717 /// A token from a previous call to `releases.list` or `channels.releases.list` that tells the server where to resume listing.
10718 ///
10719 /// Sets the *page token* query property to the given value.
10720 pub fn page_token(mut self, new_value: &str) -> ProjectSiteReleaseListCall<'a, C> {
10721 self._page_token = Some(new_value.to_string());
10722 self
10723 }
10724 /// 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.
10725 ///
10726 /// Sets the *page size* query property to the given value.
10727 pub fn page_size(mut self, new_value: i32) -> ProjectSiteReleaseListCall<'a, C> {
10728 self._page_size = Some(new_value);
10729 self
10730 }
10731 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10732 /// while executing the actual API request.
10733 ///
10734 /// ````text
10735 /// It should be used to handle progress information, and to implement a certain level of resilience.
10736 /// ````
10737 ///
10738 /// Sets the *delegate* property to the given value.
10739 pub fn delegate(
10740 mut self,
10741 new_value: &'a mut dyn common::Delegate,
10742 ) -> ProjectSiteReleaseListCall<'a, C> {
10743 self._delegate = Some(new_value);
10744 self
10745 }
10746
10747 /// Set any additional parameter of the query string used in the request.
10748 /// It should be used to set parameters which are not yet available through their own
10749 /// setters.
10750 ///
10751 /// Please note that this method must not be used to set any of the known parameters
10752 /// which have their own setter method. If done anyway, the request will fail.
10753 ///
10754 /// # Additional Parameters
10755 ///
10756 /// * *$.xgafv* (query-string) - V1 error format.
10757 /// * *access_token* (query-string) - OAuth access token.
10758 /// * *alt* (query-string) - Data format for response.
10759 /// * *callback* (query-string) - JSONP
10760 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10761 /// * *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.
10762 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10763 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10764 /// * *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.
10765 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10766 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10767 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteReleaseListCall<'a, C>
10768 where
10769 T: AsRef<str>,
10770 {
10771 self._additional_params
10772 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10773 self
10774 }
10775
10776 /// Identifies the authorization scope for the method you are building.
10777 ///
10778 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10779 /// [`Scope::FirebaseReadonly`].
10780 ///
10781 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10782 /// tokens for more than one scope.
10783 ///
10784 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10785 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10786 /// sufficient, a read-write scope will do as well.
10787 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteReleaseListCall<'a, C>
10788 where
10789 St: AsRef<str>,
10790 {
10791 self._scopes.insert(String::from(scope.as_ref()));
10792 self
10793 }
10794 /// Identifies the authorization scope(s) for the method you are building.
10795 ///
10796 /// See [`Self::add_scope()`] for details.
10797 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteReleaseListCall<'a, C>
10798 where
10799 I: IntoIterator<Item = St>,
10800 St: AsRef<str>,
10801 {
10802 self._scopes
10803 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10804 self
10805 }
10806
10807 /// Removes all scopes, and no default scope will be used either.
10808 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10809 /// for details).
10810 pub fn clear_scopes(mut self) -> ProjectSiteReleaseListCall<'a, C> {
10811 self._scopes.clear();
10812 self
10813 }
10814}
10815
10816/// Lists the remaining files to be uploaded for the specified version.
10817///
10818/// A builder for the *sites.versions.files.list* method supported by a *project* resource.
10819/// It is not used directly, but through a [`ProjectMethods`] instance.
10820///
10821/// # Example
10822///
10823/// Instantiate a resource method builder
10824///
10825/// ```test_harness,no_run
10826/// # extern crate hyper;
10827/// # extern crate hyper_rustls;
10828/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
10829/// # async fn dox() {
10830/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10831///
10832/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10833/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10834/// # .with_native_roots()
10835/// # .unwrap()
10836/// # .https_only()
10837/// # .enable_http2()
10838/// # .build();
10839///
10840/// # let executor = hyper_util::rt::TokioExecutor::new();
10841/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10842/// # secret,
10843/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10844/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10845/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10846/// # ),
10847/// # ).build().await.unwrap();
10848///
10849/// # let client = hyper_util::client::legacy::Client::builder(
10850/// # hyper_util::rt::TokioExecutor::new()
10851/// # )
10852/// # .build(
10853/// # hyper_rustls::HttpsConnectorBuilder::new()
10854/// # .with_native_roots()
10855/// # .unwrap()
10856/// # .https_or_http()
10857/// # .enable_http2()
10858/// # .build()
10859/// # );
10860/// # let mut hub = FirebaseHosting::new(client, auth);
10861/// // You can configure optional parameters by calling the respective setters at will, and
10862/// // execute the final call using `doit()`.
10863/// // Values shown here are possibly random and not representative !
10864/// let result = hub.projects().sites_versions_files_list("parent")
10865/// .status("diam")
10866/// .page_token("no")
10867/// .page_size(-100)
10868/// .doit().await;
10869/// # }
10870/// ```
10871pub struct ProjectSiteVersionFileListCall<'a, C>
10872where
10873 C: 'a,
10874{
10875 hub: &'a FirebaseHosting<C>,
10876 _parent: String,
10877 _status: Option<String>,
10878 _page_token: Option<String>,
10879 _page_size: Option<i32>,
10880 _delegate: Option<&'a mut dyn common::Delegate>,
10881 _additional_params: HashMap<String, String>,
10882 _scopes: BTreeSet<String>,
10883}
10884
10885impl<'a, C> common::CallBuilder for ProjectSiteVersionFileListCall<'a, C> {}
10886
10887impl<'a, C> ProjectSiteVersionFileListCall<'a, C>
10888where
10889 C: common::Connector,
10890{
10891 /// Perform the operation you have build so far.
10892 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionFilesResponse)> {
10893 use std::borrow::Cow;
10894 use std::io::{Read, Seek};
10895
10896 use common::{url::Params, ToParts};
10897 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10898
10899 let mut dd = common::DefaultDelegate;
10900 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10901 dlg.begin(common::MethodInfo {
10902 id: "firebasehosting.projects.sites.versions.files.list",
10903 http_method: hyper::Method::GET,
10904 });
10905
10906 for &field in ["alt", "parent", "status", "pageToken", "pageSize"].iter() {
10907 if self._additional_params.contains_key(field) {
10908 dlg.finished(false);
10909 return Err(common::Error::FieldClash(field));
10910 }
10911 }
10912
10913 let mut params = Params::with_capacity(6 + self._additional_params.len());
10914 params.push("parent", self._parent);
10915 if let Some(value) = self._status.as_ref() {
10916 params.push("status", value);
10917 }
10918 if let Some(value) = self._page_token.as_ref() {
10919 params.push("pageToken", value);
10920 }
10921 if let Some(value) = self._page_size.as_ref() {
10922 params.push("pageSize", value.to_string());
10923 }
10924
10925 params.extend(self._additional_params.iter());
10926
10927 params.push("alt", "json");
10928 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/files";
10929 if self._scopes.is_empty() {
10930 self._scopes
10931 .insert(Scope::FirebaseReadonly.as_ref().to_string());
10932 }
10933
10934 #[allow(clippy::single_element_loop)]
10935 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10936 url = params.uri_replacement(url, param_name, find_this, true);
10937 }
10938 {
10939 let to_remove = ["parent"];
10940 params.remove_params(&to_remove);
10941 }
10942
10943 let url = params.parse_with_url(&url);
10944
10945 loop {
10946 let token = match self
10947 .hub
10948 .auth
10949 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10950 .await
10951 {
10952 Ok(token) => token,
10953 Err(e) => match dlg.token(e) {
10954 Ok(token) => token,
10955 Err(e) => {
10956 dlg.finished(false);
10957 return Err(common::Error::MissingToken(e));
10958 }
10959 },
10960 };
10961 let mut req_result = {
10962 let client = &self.hub.client;
10963 dlg.pre_request();
10964 let mut req_builder = hyper::Request::builder()
10965 .method(hyper::Method::GET)
10966 .uri(url.as_str())
10967 .header(USER_AGENT, self.hub._user_agent.clone());
10968
10969 if let Some(token) = token.as_ref() {
10970 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10971 }
10972
10973 let request = req_builder
10974 .header(CONTENT_LENGTH, 0_u64)
10975 .body(common::to_body::<String>(None));
10976
10977 client.request(request.unwrap()).await
10978 };
10979
10980 match req_result {
10981 Err(err) => {
10982 if let common::Retry::After(d) = dlg.http_error(&err) {
10983 sleep(d).await;
10984 continue;
10985 }
10986 dlg.finished(false);
10987 return Err(common::Error::HttpError(err));
10988 }
10989 Ok(res) => {
10990 let (mut parts, body) = res.into_parts();
10991 let mut body = common::Body::new(body);
10992 if !parts.status.is_success() {
10993 let bytes = common::to_bytes(body).await.unwrap_or_default();
10994 let error = serde_json::from_str(&common::to_string(&bytes));
10995 let response = common::to_response(parts, bytes.into());
10996
10997 if let common::Retry::After(d) =
10998 dlg.http_failure(&response, error.as_ref().ok())
10999 {
11000 sleep(d).await;
11001 continue;
11002 }
11003
11004 dlg.finished(false);
11005
11006 return Err(match error {
11007 Ok(value) => common::Error::BadRequest(value),
11008 _ => common::Error::Failure(response),
11009 });
11010 }
11011 let response = {
11012 let bytes = common::to_bytes(body).await.unwrap_or_default();
11013 let encoded = common::to_string(&bytes);
11014 match serde_json::from_str(&encoded) {
11015 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11016 Err(error) => {
11017 dlg.response_json_decode_error(&encoded, &error);
11018 return Err(common::Error::JsonDecodeError(
11019 encoded.to_string(),
11020 error,
11021 ));
11022 }
11023 }
11024 };
11025
11026 dlg.finished(true);
11027 return Ok(response);
11028 }
11029 }
11030 }
11031 }
11032
11033 /// Required. The version for which to list files, in the format: sites/SITE_ID /versions/VERSION_ID
11034 ///
11035 /// Sets the *parent* path property to the given value.
11036 ///
11037 /// Even though the property as already been set when instantiating this call,
11038 /// we provide this method for API completeness.
11039 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionFileListCall<'a, C> {
11040 self._parent = new_value.to_string();
11041 self
11042 }
11043 /// The type of files that should be listed for the specified version.
11044 ///
11045 /// Sets the *status* query property to the given value.
11046 pub fn status(mut self, new_value: &str) -> ProjectSiteVersionFileListCall<'a, C> {
11047 self._status = Some(new_value.to_string());
11048 self
11049 }
11050 /// A token from a previous call to `ListVersionFiles` that tells the server where to resume listing.
11051 ///
11052 /// Sets the *page token* query property to the given value.
11053 pub fn page_token(mut self, new_value: &str) -> ProjectSiteVersionFileListCall<'a, C> {
11054 self._page_token = Some(new_value.to_string());
11055 self
11056 }
11057 /// 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.
11058 ///
11059 /// Sets the *page size* query property to the given value.
11060 pub fn page_size(mut self, new_value: i32) -> ProjectSiteVersionFileListCall<'a, C> {
11061 self._page_size = Some(new_value);
11062 self
11063 }
11064 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11065 /// while executing the actual API request.
11066 ///
11067 /// ````text
11068 /// It should be used to handle progress information, and to implement a certain level of resilience.
11069 /// ````
11070 ///
11071 /// Sets the *delegate* property to the given value.
11072 pub fn delegate(
11073 mut self,
11074 new_value: &'a mut dyn common::Delegate,
11075 ) -> ProjectSiteVersionFileListCall<'a, C> {
11076 self._delegate = Some(new_value);
11077 self
11078 }
11079
11080 /// Set any additional parameter of the query string used in the request.
11081 /// It should be used to set parameters which are not yet available through their own
11082 /// setters.
11083 ///
11084 /// Please note that this method must not be used to set any of the known parameters
11085 /// which have their own setter method. If done anyway, the request will fail.
11086 ///
11087 /// # Additional Parameters
11088 ///
11089 /// * *$.xgafv* (query-string) - V1 error format.
11090 /// * *access_token* (query-string) - OAuth access token.
11091 /// * *alt* (query-string) - Data format for response.
11092 /// * *callback* (query-string) - JSONP
11093 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11094 /// * *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.
11095 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11096 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11097 /// * *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.
11098 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11099 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11100 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionFileListCall<'a, C>
11101 where
11102 T: AsRef<str>,
11103 {
11104 self._additional_params
11105 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11106 self
11107 }
11108
11109 /// Identifies the authorization scope for the method you are building.
11110 ///
11111 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11112 /// [`Scope::FirebaseReadonly`].
11113 ///
11114 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11115 /// tokens for more than one scope.
11116 ///
11117 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11118 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11119 /// sufficient, a read-write scope will do as well.
11120 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionFileListCall<'a, C>
11121 where
11122 St: AsRef<str>,
11123 {
11124 self._scopes.insert(String::from(scope.as_ref()));
11125 self
11126 }
11127 /// Identifies the authorization scope(s) for the method you are building.
11128 ///
11129 /// See [`Self::add_scope()`] for details.
11130 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionFileListCall<'a, C>
11131 where
11132 I: IntoIterator<Item = St>,
11133 St: AsRef<str>,
11134 {
11135 self._scopes
11136 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11137 self
11138 }
11139
11140 /// Removes all scopes, and no default scope will be used either.
11141 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11142 /// for details).
11143 pub fn clear_scopes(mut self) -> ProjectSiteVersionFileListCall<'a, C> {
11144 self._scopes.clear();
11145 self
11146 }
11147}
11148
11149/// Creates a new version on the specified target site using the content of the specified version.
11150///
11151/// A builder for the *sites.versions.clone* method supported by a *project* resource.
11152/// It is not used directly, but through a [`ProjectMethods`] instance.
11153///
11154/// # Example
11155///
11156/// Instantiate a resource method builder
11157///
11158/// ```test_harness,no_run
11159/// # extern crate hyper;
11160/// # extern crate hyper_rustls;
11161/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
11162/// use firebasehosting1_beta1::api::CloneVersionRequest;
11163/// # async fn dox() {
11164/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11165///
11166/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11167/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11168/// # .with_native_roots()
11169/// # .unwrap()
11170/// # .https_only()
11171/// # .enable_http2()
11172/// # .build();
11173///
11174/// # let executor = hyper_util::rt::TokioExecutor::new();
11175/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11176/// # secret,
11177/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11178/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11179/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11180/// # ),
11181/// # ).build().await.unwrap();
11182///
11183/// # let client = hyper_util::client::legacy::Client::builder(
11184/// # hyper_util::rt::TokioExecutor::new()
11185/// # )
11186/// # .build(
11187/// # hyper_rustls::HttpsConnectorBuilder::new()
11188/// # .with_native_roots()
11189/// # .unwrap()
11190/// # .https_or_http()
11191/// # .enable_http2()
11192/// # .build()
11193/// # );
11194/// # let mut hub = FirebaseHosting::new(client, auth);
11195/// // As the method needs a request, you would usually fill it with the desired information
11196/// // into the respective structure. Some of the parts shown here might not be applicable !
11197/// // Values shown here are possibly random and not representative !
11198/// let mut req = CloneVersionRequest::default();
11199///
11200/// // You can configure optional parameters by calling the respective setters at will, and
11201/// // execute the final call using `doit()`.
11202/// // Values shown here are possibly random and not representative !
11203/// let result = hub.projects().sites_versions_clone(req, "parent")
11204/// .doit().await;
11205/// # }
11206/// ```
11207pub struct ProjectSiteVersionCloneCall<'a, C>
11208where
11209 C: 'a,
11210{
11211 hub: &'a FirebaseHosting<C>,
11212 _request: CloneVersionRequest,
11213 _parent: String,
11214 _delegate: Option<&'a mut dyn common::Delegate>,
11215 _additional_params: HashMap<String, String>,
11216 _scopes: BTreeSet<String>,
11217}
11218
11219impl<'a, C> common::CallBuilder for ProjectSiteVersionCloneCall<'a, C> {}
11220
11221impl<'a, C> ProjectSiteVersionCloneCall<'a, C>
11222where
11223 C: common::Connector,
11224{
11225 /// Perform the operation you have build so far.
11226 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11227 use std::borrow::Cow;
11228 use std::io::{Read, Seek};
11229
11230 use common::{url::Params, ToParts};
11231 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11232
11233 let mut dd = common::DefaultDelegate;
11234 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11235 dlg.begin(common::MethodInfo {
11236 id: "firebasehosting.projects.sites.versions.clone",
11237 http_method: hyper::Method::POST,
11238 });
11239
11240 for &field in ["alt", "parent"].iter() {
11241 if self._additional_params.contains_key(field) {
11242 dlg.finished(false);
11243 return Err(common::Error::FieldClash(field));
11244 }
11245 }
11246
11247 let mut params = Params::with_capacity(4 + self._additional_params.len());
11248 params.push("parent", self._parent);
11249
11250 params.extend(self._additional_params.iter());
11251
11252 params.push("alt", "json");
11253 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions:clone";
11254 if self._scopes.is_empty() {
11255 self._scopes
11256 .insert(Scope::CloudPlatform.as_ref().to_string());
11257 }
11258
11259 #[allow(clippy::single_element_loop)]
11260 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11261 url = params.uri_replacement(url, param_name, find_this, true);
11262 }
11263 {
11264 let to_remove = ["parent"];
11265 params.remove_params(&to_remove);
11266 }
11267
11268 let url = params.parse_with_url(&url);
11269
11270 let mut json_mime_type = mime::APPLICATION_JSON;
11271 let mut request_value_reader = {
11272 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11273 common::remove_json_null_values(&mut value);
11274 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11275 serde_json::to_writer(&mut dst, &value).unwrap();
11276 dst
11277 };
11278 let request_size = request_value_reader
11279 .seek(std::io::SeekFrom::End(0))
11280 .unwrap();
11281 request_value_reader
11282 .seek(std::io::SeekFrom::Start(0))
11283 .unwrap();
11284
11285 loop {
11286 let token = match self
11287 .hub
11288 .auth
11289 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11290 .await
11291 {
11292 Ok(token) => token,
11293 Err(e) => match dlg.token(e) {
11294 Ok(token) => token,
11295 Err(e) => {
11296 dlg.finished(false);
11297 return Err(common::Error::MissingToken(e));
11298 }
11299 },
11300 };
11301 request_value_reader
11302 .seek(std::io::SeekFrom::Start(0))
11303 .unwrap();
11304 let mut req_result = {
11305 let client = &self.hub.client;
11306 dlg.pre_request();
11307 let mut req_builder = hyper::Request::builder()
11308 .method(hyper::Method::POST)
11309 .uri(url.as_str())
11310 .header(USER_AGENT, self.hub._user_agent.clone());
11311
11312 if let Some(token) = token.as_ref() {
11313 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11314 }
11315
11316 let request = req_builder
11317 .header(CONTENT_TYPE, json_mime_type.to_string())
11318 .header(CONTENT_LENGTH, request_size as u64)
11319 .body(common::to_body(
11320 request_value_reader.get_ref().clone().into(),
11321 ));
11322
11323 client.request(request.unwrap()).await
11324 };
11325
11326 match req_result {
11327 Err(err) => {
11328 if let common::Retry::After(d) = dlg.http_error(&err) {
11329 sleep(d).await;
11330 continue;
11331 }
11332 dlg.finished(false);
11333 return Err(common::Error::HttpError(err));
11334 }
11335 Ok(res) => {
11336 let (mut parts, body) = res.into_parts();
11337 let mut body = common::Body::new(body);
11338 if !parts.status.is_success() {
11339 let bytes = common::to_bytes(body).await.unwrap_or_default();
11340 let error = serde_json::from_str(&common::to_string(&bytes));
11341 let response = common::to_response(parts, bytes.into());
11342
11343 if let common::Retry::After(d) =
11344 dlg.http_failure(&response, error.as_ref().ok())
11345 {
11346 sleep(d).await;
11347 continue;
11348 }
11349
11350 dlg.finished(false);
11351
11352 return Err(match error {
11353 Ok(value) => common::Error::BadRequest(value),
11354 _ => common::Error::Failure(response),
11355 });
11356 }
11357 let response = {
11358 let bytes = common::to_bytes(body).await.unwrap_or_default();
11359 let encoded = common::to_string(&bytes);
11360 match serde_json::from_str(&encoded) {
11361 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11362 Err(error) => {
11363 dlg.response_json_decode_error(&encoded, &error);
11364 return Err(common::Error::JsonDecodeError(
11365 encoded.to_string(),
11366 error,
11367 ));
11368 }
11369 }
11370 };
11371
11372 dlg.finished(true);
11373 return Ok(response);
11374 }
11375 }
11376 }
11377 }
11378
11379 ///
11380 /// Sets the *request* property to the given value.
11381 ///
11382 /// Even though the property as already been set when instantiating this call,
11383 /// we provide this method for API completeness.
11384 pub fn request(mut self, new_value: CloneVersionRequest) -> ProjectSiteVersionCloneCall<'a, C> {
11385 self._request = new_value;
11386 self
11387 }
11388 /// Required. The target site for the cloned version, in the format: sites/ SITE_ID
11389 ///
11390 /// Sets the *parent* path property to the given value.
11391 ///
11392 /// Even though the property as already been set when instantiating this call,
11393 /// we provide this method for API completeness.
11394 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionCloneCall<'a, C> {
11395 self._parent = new_value.to_string();
11396 self
11397 }
11398 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11399 /// while executing the actual API request.
11400 ///
11401 /// ````text
11402 /// It should be used to handle progress information, and to implement a certain level of resilience.
11403 /// ````
11404 ///
11405 /// Sets the *delegate* property to the given value.
11406 pub fn delegate(
11407 mut self,
11408 new_value: &'a mut dyn common::Delegate,
11409 ) -> ProjectSiteVersionCloneCall<'a, C> {
11410 self._delegate = Some(new_value);
11411 self
11412 }
11413
11414 /// Set any additional parameter of the query string used in the request.
11415 /// It should be used to set parameters which are not yet available through their own
11416 /// setters.
11417 ///
11418 /// Please note that this method must not be used to set any of the known parameters
11419 /// which have their own setter method. If done anyway, the request will fail.
11420 ///
11421 /// # Additional Parameters
11422 ///
11423 /// * *$.xgafv* (query-string) - V1 error format.
11424 /// * *access_token* (query-string) - OAuth access token.
11425 /// * *alt* (query-string) - Data format for response.
11426 /// * *callback* (query-string) - JSONP
11427 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11428 /// * *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.
11429 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11430 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11431 /// * *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.
11432 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11433 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11434 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionCloneCall<'a, C>
11435 where
11436 T: AsRef<str>,
11437 {
11438 self._additional_params
11439 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11440 self
11441 }
11442
11443 /// Identifies the authorization scope for the method you are building.
11444 ///
11445 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11446 /// [`Scope::CloudPlatform`].
11447 ///
11448 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11449 /// tokens for more than one scope.
11450 ///
11451 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11452 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11453 /// sufficient, a read-write scope will do as well.
11454 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionCloneCall<'a, C>
11455 where
11456 St: AsRef<str>,
11457 {
11458 self._scopes.insert(String::from(scope.as_ref()));
11459 self
11460 }
11461 /// Identifies the authorization scope(s) for the method you are building.
11462 ///
11463 /// See [`Self::add_scope()`] for details.
11464 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionCloneCall<'a, C>
11465 where
11466 I: IntoIterator<Item = St>,
11467 St: AsRef<str>,
11468 {
11469 self._scopes
11470 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11471 self
11472 }
11473
11474 /// Removes all scopes, and no default scope will be used either.
11475 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11476 /// for details).
11477 pub fn clear_scopes(mut self) -> ProjectSiteVersionCloneCall<'a, C> {
11478 self._scopes.clear();
11479 self
11480 }
11481}
11482
11483/// Creates a new version for the specified site.
11484///
11485/// A builder for the *sites.versions.create* method supported by a *project* resource.
11486/// It is not used directly, but through a [`ProjectMethods`] instance.
11487///
11488/// # Example
11489///
11490/// Instantiate a resource method builder
11491///
11492/// ```test_harness,no_run
11493/// # extern crate hyper;
11494/// # extern crate hyper_rustls;
11495/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
11496/// use firebasehosting1_beta1::api::Version;
11497/// # async fn dox() {
11498/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11499///
11500/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11501/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11502/// # .with_native_roots()
11503/// # .unwrap()
11504/// # .https_only()
11505/// # .enable_http2()
11506/// # .build();
11507///
11508/// # let executor = hyper_util::rt::TokioExecutor::new();
11509/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11510/// # secret,
11511/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11512/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11513/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11514/// # ),
11515/// # ).build().await.unwrap();
11516///
11517/// # let client = hyper_util::client::legacy::Client::builder(
11518/// # hyper_util::rt::TokioExecutor::new()
11519/// # )
11520/// # .build(
11521/// # hyper_rustls::HttpsConnectorBuilder::new()
11522/// # .with_native_roots()
11523/// # .unwrap()
11524/// # .https_or_http()
11525/// # .enable_http2()
11526/// # .build()
11527/// # );
11528/// # let mut hub = FirebaseHosting::new(client, auth);
11529/// // As the method needs a request, you would usually fill it with the desired information
11530/// // into the respective structure. Some of the parts shown here might not be applicable !
11531/// // Values shown here are possibly random and not representative !
11532/// let mut req = Version::default();
11533///
11534/// // You can configure optional parameters by calling the respective setters at will, and
11535/// // execute the final call using `doit()`.
11536/// // Values shown here are possibly random and not representative !
11537/// let result = hub.projects().sites_versions_create(req, "parent")
11538/// .version_id("consetetur")
11539/// .size_bytes(-28)
11540/// .doit().await;
11541/// # }
11542/// ```
11543pub struct ProjectSiteVersionCreateCall<'a, C>
11544where
11545 C: 'a,
11546{
11547 hub: &'a FirebaseHosting<C>,
11548 _request: Version,
11549 _parent: String,
11550 _version_id: Option<String>,
11551 _size_bytes: Option<i64>,
11552 _delegate: Option<&'a mut dyn common::Delegate>,
11553 _additional_params: HashMap<String, String>,
11554 _scopes: BTreeSet<String>,
11555}
11556
11557impl<'a, C> common::CallBuilder for ProjectSiteVersionCreateCall<'a, C> {}
11558
11559impl<'a, C> ProjectSiteVersionCreateCall<'a, C>
11560where
11561 C: common::Connector,
11562{
11563 /// Perform the operation you have build so far.
11564 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
11565 use std::borrow::Cow;
11566 use std::io::{Read, Seek};
11567
11568 use common::{url::Params, ToParts};
11569 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11570
11571 let mut dd = common::DefaultDelegate;
11572 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11573 dlg.begin(common::MethodInfo {
11574 id: "firebasehosting.projects.sites.versions.create",
11575 http_method: hyper::Method::POST,
11576 });
11577
11578 for &field in ["alt", "parent", "versionId", "sizeBytes"].iter() {
11579 if self._additional_params.contains_key(field) {
11580 dlg.finished(false);
11581 return Err(common::Error::FieldClash(field));
11582 }
11583 }
11584
11585 let mut params = Params::with_capacity(6 + self._additional_params.len());
11586 params.push("parent", self._parent);
11587 if let Some(value) = self._version_id.as_ref() {
11588 params.push("versionId", value);
11589 }
11590 if let Some(value) = self._size_bytes.as_ref() {
11591 params.push("sizeBytes", value.to_string());
11592 }
11593
11594 params.extend(self._additional_params.iter());
11595
11596 params.push("alt", "json");
11597 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
11598 if self._scopes.is_empty() {
11599 self._scopes
11600 .insert(Scope::CloudPlatform.as_ref().to_string());
11601 }
11602
11603 #[allow(clippy::single_element_loop)]
11604 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11605 url = params.uri_replacement(url, param_name, find_this, true);
11606 }
11607 {
11608 let to_remove = ["parent"];
11609 params.remove_params(&to_remove);
11610 }
11611
11612 let url = params.parse_with_url(&url);
11613
11614 let mut json_mime_type = mime::APPLICATION_JSON;
11615 let mut request_value_reader = {
11616 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11617 common::remove_json_null_values(&mut value);
11618 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11619 serde_json::to_writer(&mut dst, &value).unwrap();
11620 dst
11621 };
11622 let request_size = request_value_reader
11623 .seek(std::io::SeekFrom::End(0))
11624 .unwrap();
11625 request_value_reader
11626 .seek(std::io::SeekFrom::Start(0))
11627 .unwrap();
11628
11629 loop {
11630 let token = match self
11631 .hub
11632 .auth
11633 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11634 .await
11635 {
11636 Ok(token) => token,
11637 Err(e) => match dlg.token(e) {
11638 Ok(token) => token,
11639 Err(e) => {
11640 dlg.finished(false);
11641 return Err(common::Error::MissingToken(e));
11642 }
11643 },
11644 };
11645 request_value_reader
11646 .seek(std::io::SeekFrom::Start(0))
11647 .unwrap();
11648 let mut req_result = {
11649 let client = &self.hub.client;
11650 dlg.pre_request();
11651 let mut req_builder = hyper::Request::builder()
11652 .method(hyper::Method::POST)
11653 .uri(url.as_str())
11654 .header(USER_AGENT, self.hub._user_agent.clone());
11655
11656 if let Some(token) = token.as_ref() {
11657 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11658 }
11659
11660 let request = req_builder
11661 .header(CONTENT_TYPE, json_mime_type.to_string())
11662 .header(CONTENT_LENGTH, request_size as u64)
11663 .body(common::to_body(
11664 request_value_reader.get_ref().clone().into(),
11665 ));
11666
11667 client.request(request.unwrap()).await
11668 };
11669
11670 match req_result {
11671 Err(err) => {
11672 if let common::Retry::After(d) = dlg.http_error(&err) {
11673 sleep(d).await;
11674 continue;
11675 }
11676 dlg.finished(false);
11677 return Err(common::Error::HttpError(err));
11678 }
11679 Ok(res) => {
11680 let (mut parts, body) = res.into_parts();
11681 let mut body = common::Body::new(body);
11682 if !parts.status.is_success() {
11683 let bytes = common::to_bytes(body).await.unwrap_or_default();
11684 let error = serde_json::from_str(&common::to_string(&bytes));
11685 let response = common::to_response(parts, bytes.into());
11686
11687 if let common::Retry::After(d) =
11688 dlg.http_failure(&response, error.as_ref().ok())
11689 {
11690 sleep(d).await;
11691 continue;
11692 }
11693
11694 dlg.finished(false);
11695
11696 return Err(match error {
11697 Ok(value) => common::Error::BadRequest(value),
11698 _ => common::Error::Failure(response),
11699 });
11700 }
11701 let response = {
11702 let bytes = common::to_bytes(body).await.unwrap_or_default();
11703 let encoded = common::to_string(&bytes);
11704 match serde_json::from_str(&encoded) {
11705 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11706 Err(error) => {
11707 dlg.response_json_decode_error(&encoded, &error);
11708 return Err(common::Error::JsonDecodeError(
11709 encoded.to_string(),
11710 error,
11711 ));
11712 }
11713 }
11714 };
11715
11716 dlg.finished(true);
11717 return Ok(response);
11718 }
11719 }
11720 }
11721 }
11722
11723 ///
11724 /// Sets the *request* property to the given value.
11725 ///
11726 /// Even though the property as already been set when instantiating this call,
11727 /// we provide this method for API completeness.
11728 pub fn request(mut self, new_value: Version) -> ProjectSiteVersionCreateCall<'a, C> {
11729 self._request = new_value;
11730 self
11731 }
11732 /// Required. The site in which to create the version, in the format: sites/ SITE_ID
11733 ///
11734 /// Sets the *parent* path property to the given value.
11735 ///
11736 /// Even though the property as already been set when instantiating this call,
11737 /// we provide this method for API completeness.
11738 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionCreateCall<'a, C> {
11739 self._parent = new_value.to_string();
11740 self
11741 }
11742 /// A unique id for the new version. This is was only specified for legacy version creations, and should be blank.
11743 ///
11744 /// Sets the *version id* query property to the given value.
11745 pub fn version_id(mut self, new_value: &str) -> ProjectSiteVersionCreateCall<'a, C> {
11746 self._version_id = Some(new_value.to_string());
11747 self
11748 }
11749 /// The self-reported size of the version. This value is used for a pre-emptive quota check for legacy version uploads.
11750 ///
11751 /// Sets the *size bytes* query property to the given value.
11752 pub fn size_bytes(mut self, new_value: i64) -> ProjectSiteVersionCreateCall<'a, C> {
11753 self._size_bytes = Some(new_value);
11754 self
11755 }
11756 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11757 /// while executing the actual API request.
11758 ///
11759 /// ````text
11760 /// It should be used to handle progress information, and to implement a certain level of resilience.
11761 /// ````
11762 ///
11763 /// Sets the *delegate* property to the given value.
11764 pub fn delegate(
11765 mut self,
11766 new_value: &'a mut dyn common::Delegate,
11767 ) -> ProjectSiteVersionCreateCall<'a, C> {
11768 self._delegate = Some(new_value);
11769 self
11770 }
11771
11772 /// Set any additional parameter of the query string used in the request.
11773 /// It should be used to set parameters which are not yet available through their own
11774 /// setters.
11775 ///
11776 /// Please note that this method must not be used to set any of the known parameters
11777 /// which have their own setter method. If done anyway, the request will fail.
11778 ///
11779 /// # Additional Parameters
11780 ///
11781 /// * *$.xgafv* (query-string) - V1 error format.
11782 /// * *access_token* (query-string) - OAuth access token.
11783 /// * *alt* (query-string) - Data format for response.
11784 /// * *callback* (query-string) - JSONP
11785 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11786 /// * *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.
11787 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11788 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11789 /// * *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.
11790 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11791 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11792 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionCreateCall<'a, C>
11793 where
11794 T: AsRef<str>,
11795 {
11796 self._additional_params
11797 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11798 self
11799 }
11800
11801 /// Identifies the authorization scope for the method you are building.
11802 ///
11803 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11804 /// [`Scope::CloudPlatform`].
11805 ///
11806 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11807 /// tokens for more than one scope.
11808 ///
11809 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11810 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11811 /// sufficient, a read-write scope will do as well.
11812 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionCreateCall<'a, C>
11813 where
11814 St: AsRef<str>,
11815 {
11816 self._scopes.insert(String::from(scope.as_ref()));
11817 self
11818 }
11819 /// Identifies the authorization scope(s) for the method you are building.
11820 ///
11821 /// See [`Self::add_scope()`] for details.
11822 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionCreateCall<'a, C>
11823 where
11824 I: IntoIterator<Item = St>,
11825 St: AsRef<str>,
11826 {
11827 self._scopes
11828 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11829 self
11830 }
11831
11832 /// Removes all scopes, and no default scope will be used either.
11833 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11834 /// for details).
11835 pub fn clear_scopes(mut self) -> ProjectSiteVersionCreateCall<'a, C> {
11836 self._scopes.clear();
11837 self
11838 }
11839}
11840
11841/// Deletes the specified version.
11842///
11843/// A builder for the *sites.versions.delete* method supported by a *project* resource.
11844/// It is not used directly, but through a [`ProjectMethods`] instance.
11845///
11846/// # Example
11847///
11848/// Instantiate a resource method builder
11849///
11850/// ```test_harness,no_run
11851/// # extern crate hyper;
11852/// # extern crate hyper_rustls;
11853/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
11854/// # async fn dox() {
11855/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11856///
11857/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11858/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11859/// # .with_native_roots()
11860/// # .unwrap()
11861/// # .https_only()
11862/// # .enable_http2()
11863/// # .build();
11864///
11865/// # let executor = hyper_util::rt::TokioExecutor::new();
11866/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11867/// # secret,
11868/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11869/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11870/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11871/// # ),
11872/// # ).build().await.unwrap();
11873///
11874/// # let client = hyper_util::client::legacy::Client::builder(
11875/// # hyper_util::rt::TokioExecutor::new()
11876/// # )
11877/// # .build(
11878/// # hyper_rustls::HttpsConnectorBuilder::new()
11879/// # .with_native_roots()
11880/// # .unwrap()
11881/// # .https_or_http()
11882/// # .enable_http2()
11883/// # .build()
11884/// # );
11885/// # let mut hub = FirebaseHosting::new(client, auth);
11886/// // You can configure optional parameters by calling the respective setters at will, and
11887/// // execute the final call using `doit()`.
11888/// // Values shown here are possibly random and not representative !
11889/// let result = hub.projects().sites_versions_delete("name")
11890/// .doit().await;
11891/// # }
11892/// ```
11893pub struct ProjectSiteVersionDeleteCall<'a, C>
11894where
11895 C: 'a,
11896{
11897 hub: &'a FirebaseHosting<C>,
11898 _name: String,
11899 _delegate: Option<&'a mut dyn common::Delegate>,
11900 _additional_params: HashMap<String, String>,
11901 _scopes: BTreeSet<String>,
11902}
11903
11904impl<'a, C> common::CallBuilder for ProjectSiteVersionDeleteCall<'a, C> {}
11905
11906impl<'a, C> ProjectSiteVersionDeleteCall<'a, C>
11907where
11908 C: common::Connector,
11909{
11910 /// Perform the operation you have build so far.
11911 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
11912 use std::borrow::Cow;
11913 use std::io::{Read, Seek};
11914
11915 use common::{url::Params, ToParts};
11916 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11917
11918 let mut dd = common::DefaultDelegate;
11919 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11920 dlg.begin(common::MethodInfo {
11921 id: "firebasehosting.projects.sites.versions.delete",
11922 http_method: hyper::Method::DELETE,
11923 });
11924
11925 for &field in ["alt", "name"].iter() {
11926 if self._additional_params.contains_key(field) {
11927 dlg.finished(false);
11928 return Err(common::Error::FieldClash(field));
11929 }
11930 }
11931
11932 let mut params = Params::with_capacity(3 + self._additional_params.len());
11933 params.push("name", self._name);
11934
11935 params.extend(self._additional_params.iter());
11936
11937 params.push("alt", "json");
11938 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
11939 if self._scopes.is_empty() {
11940 self._scopes
11941 .insert(Scope::CloudPlatform.as_ref().to_string());
11942 }
11943
11944 #[allow(clippy::single_element_loop)]
11945 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11946 url = params.uri_replacement(url, param_name, find_this, true);
11947 }
11948 {
11949 let to_remove = ["name"];
11950 params.remove_params(&to_remove);
11951 }
11952
11953 let url = params.parse_with_url(&url);
11954
11955 loop {
11956 let token = match self
11957 .hub
11958 .auth
11959 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11960 .await
11961 {
11962 Ok(token) => token,
11963 Err(e) => match dlg.token(e) {
11964 Ok(token) => token,
11965 Err(e) => {
11966 dlg.finished(false);
11967 return Err(common::Error::MissingToken(e));
11968 }
11969 },
11970 };
11971 let mut req_result = {
11972 let client = &self.hub.client;
11973 dlg.pre_request();
11974 let mut req_builder = hyper::Request::builder()
11975 .method(hyper::Method::DELETE)
11976 .uri(url.as_str())
11977 .header(USER_AGENT, self.hub._user_agent.clone());
11978
11979 if let Some(token) = token.as_ref() {
11980 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11981 }
11982
11983 let request = req_builder
11984 .header(CONTENT_LENGTH, 0_u64)
11985 .body(common::to_body::<String>(None));
11986
11987 client.request(request.unwrap()).await
11988 };
11989
11990 match req_result {
11991 Err(err) => {
11992 if let common::Retry::After(d) = dlg.http_error(&err) {
11993 sleep(d).await;
11994 continue;
11995 }
11996 dlg.finished(false);
11997 return Err(common::Error::HttpError(err));
11998 }
11999 Ok(res) => {
12000 let (mut parts, body) = res.into_parts();
12001 let mut body = common::Body::new(body);
12002 if !parts.status.is_success() {
12003 let bytes = common::to_bytes(body).await.unwrap_or_default();
12004 let error = serde_json::from_str(&common::to_string(&bytes));
12005 let response = common::to_response(parts, bytes.into());
12006
12007 if let common::Retry::After(d) =
12008 dlg.http_failure(&response, error.as_ref().ok())
12009 {
12010 sleep(d).await;
12011 continue;
12012 }
12013
12014 dlg.finished(false);
12015
12016 return Err(match error {
12017 Ok(value) => common::Error::BadRequest(value),
12018 _ => common::Error::Failure(response),
12019 });
12020 }
12021 let response = {
12022 let bytes = common::to_bytes(body).await.unwrap_or_default();
12023 let encoded = common::to_string(&bytes);
12024 match serde_json::from_str(&encoded) {
12025 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12026 Err(error) => {
12027 dlg.response_json_decode_error(&encoded, &error);
12028 return Err(common::Error::JsonDecodeError(
12029 encoded.to_string(),
12030 error,
12031 ));
12032 }
12033 }
12034 };
12035
12036 dlg.finished(true);
12037 return Ok(response);
12038 }
12039 }
12040 }
12041 }
12042
12043 /// Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
12044 ///
12045 /// Sets the *name* path property to the given value.
12046 ///
12047 /// Even though the property as already been set when instantiating this call,
12048 /// we provide this method for API completeness.
12049 pub fn name(mut self, new_value: &str) -> ProjectSiteVersionDeleteCall<'a, C> {
12050 self._name = new_value.to_string();
12051 self
12052 }
12053 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12054 /// while executing the actual API request.
12055 ///
12056 /// ````text
12057 /// It should be used to handle progress information, and to implement a certain level of resilience.
12058 /// ````
12059 ///
12060 /// Sets the *delegate* property to the given value.
12061 pub fn delegate(
12062 mut self,
12063 new_value: &'a mut dyn common::Delegate,
12064 ) -> ProjectSiteVersionDeleteCall<'a, C> {
12065 self._delegate = Some(new_value);
12066 self
12067 }
12068
12069 /// Set any additional parameter of the query string used in the request.
12070 /// It should be used to set parameters which are not yet available through their own
12071 /// setters.
12072 ///
12073 /// Please note that this method must not be used to set any of the known parameters
12074 /// which have their own setter method. If done anyway, the request will fail.
12075 ///
12076 /// # Additional Parameters
12077 ///
12078 /// * *$.xgafv* (query-string) - V1 error format.
12079 /// * *access_token* (query-string) - OAuth access token.
12080 /// * *alt* (query-string) - Data format for response.
12081 /// * *callback* (query-string) - JSONP
12082 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12083 /// * *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.
12084 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12085 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12086 /// * *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.
12087 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12088 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12089 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionDeleteCall<'a, C>
12090 where
12091 T: AsRef<str>,
12092 {
12093 self._additional_params
12094 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12095 self
12096 }
12097
12098 /// Identifies the authorization scope for the method you are building.
12099 ///
12100 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12101 /// [`Scope::CloudPlatform`].
12102 ///
12103 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12104 /// tokens for more than one scope.
12105 ///
12106 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12107 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12108 /// sufficient, a read-write scope will do as well.
12109 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionDeleteCall<'a, C>
12110 where
12111 St: AsRef<str>,
12112 {
12113 self._scopes.insert(String::from(scope.as_ref()));
12114 self
12115 }
12116 /// Identifies the authorization scope(s) for the method you are building.
12117 ///
12118 /// See [`Self::add_scope()`] for details.
12119 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionDeleteCall<'a, C>
12120 where
12121 I: IntoIterator<Item = St>,
12122 St: AsRef<str>,
12123 {
12124 self._scopes
12125 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12126 self
12127 }
12128
12129 /// Removes all scopes, and no default scope will be used either.
12130 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12131 /// for details).
12132 pub fn clear_scopes(mut self) -> ProjectSiteVersionDeleteCall<'a, C> {
12133 self._scopes.clear();
12134 self
12135 }
12136}
12137
12138/// 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.
12139///
12140/// A builder for the *sites.versions.get* method supported by a *project* resource.
12141/// It is not used directly, but through a [`ProjectMethods`] instance.
12142///
12143/// # Example
12144///
12145/// Instantiate a resource method builder
12146///
12147/// ```test_harness,no_run
12148/// # extern crate hyper;
12149/// # extern crate hyper_rustls;
12150/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
12151/// # async fn dox() {
12152/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12153///
12154/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12155/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12156/// # .with_native_roots()
12157/// # .unwrap()
12158/// # .https_only()
12159/// # .enable_http2()
12160/// # .build();
12161///
12162/// # let executor = hyper_util::rt::TokioExecutor::new();
12163/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12164/// # secret,
12165/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12166/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12167/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12168/// # ),
12169/// # ).build().await.unwrap();
12170///
12171/// # let client = hyper_util::client::legacy::Client::builder(
12172/// # hyper_util::rt::TokioExecutor::new()
12173/// # )
12174/// # .build(
12175/// # hyper_rustls::HttpsConnectorBuilder::new()
12176/// # .with_native_roots()
12177/// # .unwrap()
12178/// # .https_or_http()
12179/// # .enable_http2()
12180/// # .build()
12181/// # );
12182/// # let mut hub = FirebaseHosting::new(client, auth);
12183/// // You can configure optional parameters by calling the respective setters at will, and
12184/// // execute the final call using `doit()`.
12185/// // Values shown here are possibly random and not representative !
12186/// let result = hub.projects().sites_versions_get("name")
12187/// .doit().await;
12188/// # }
12189/// ```
12190pub struct ProjectSiteVersionGetCall<'a, C>
12191where
12192 C: 'a,
12193{
12194 hub: &'a FirebaseHosting<C>,
12195 _name: String,
12196 _delegate: Option<&'a mut dyn common::Delegate>,
12197 _additional_params: HashMap<String, String>,
12198 _scopes: BTreeSet<String>,
12199}
12200
12201impl<'a, C> common::CallBuilder for ProjectSiteVersionGetCall<'a, C> {}
12202
12203impl<'a, C> ProjectSiteVersionGetCall<'a, C>
12204where
12205 C: common::Connector,
12206{
12207 /// Perform the operation you have build so far.
12208 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
12209 use std::borrow::Cow;
12210 use std::io::{Read, Seek};
12211
12212 use common::{url::Params, ToParts};
12213 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12214
12215 let mut dd = common::DefaultDelegate;
12216 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12217 dlg.begin(common::MethodInfo {
12218 id: "firebasehosting.projects.sites.versions.get",
12219 http_method: hyper::Method::GET,
12220 });
12221
12222 for &field in ["alt", "name"].iter() {
12223 if self._additional_params.contains_key(field) {
12224 dlg.finished(false);
12225 return Err(common::Error::FieldClash(field));
12226 }
12227 }
12228
12229 let mut params = Params::with_capacity(3 + self._additional_params.len());
12230 params.push("name", self._name);
12231
12232 params.extend(self._additional_params.iter());
12233
12234 params.push("alt", "json");
12235 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
12236 if self._scopes.is_empty() {
12237 self._scopes
12238 .insert(Scope::FirebaseReadonly.as_ref().to_string());
12239 }
12240
12241 #[allow(clippy::single_element_loop)]
12242 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12243 url = params.uri_replacement(url, param_name, find_this, true);
12244 }
12245 {
12246 let to_remove = ["name"];
12247 params.remove_params(&to_remove);
12248 }
12249
12250 let url = params.parse_with_url(&url);
12251
12252 loop {
12253 let token = match self
12254 .hub
12255 .auth
12256 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12257 .await
12258 {
12259 Ok(token) => token,
12260 Err(e) => match dlg.token(e) {
12261 Ok(token) => token,
12262 Err(e) => {
12263 dlg.finished(false);
12264 return Err(common::Error::MissingToken(e));
12265 }
12266 },
12267 };
12268 let mut req_result = {
12269 let client = &self.hub.client;
12270 dlg.pre_request();
12271 let mut req_builder = hyper::Request::builder()
12272 .method(hyper::Method::GET)
12273 .uri(url.as_str())
12274 .header(USER_AGENT, self.hub._user_agent.clone());
12275
12276 if let Some(token) = token.as_ref() {
12277 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12278 }
12279
12280 let request = req_builder
12281 .header(CONTENT_LENGTH, 0_u64)
12282 .body(common::to_body::<String>(None));
12283
12284 client.request(request.unwrap()).await
12285 };
12286
12287 match req_result {
12288 Err(err) => {
12289 if let common::Retry::After(d) = dlg.http_error(&err) {
12290 sleep(d).await;
12291 continue;
12292 }
12293 dlg.finished(false);
12294 return Err(common::Error::HttpError(err));
12295 }
12296 Ok(res) => {
12297 let (mut parts, body) = res.into_parts();
12298 let mut body = common::Body::new(body);
12299 if !parts.status.is_success() {
12300 let bytes = common::to_bytes(body).await.unwrap_or_default();
12301 let error = serde_json::from_str(&common::to_string(&bytes));
12302 let response = common::to_response(parts, bytes.into());
12303
12304 if let common::Retry::After(d) =
12305 dlg.http_failure(&response, error.as_ref().ok())
12306 {
12307 sleep(d).await;
12308 continue;
12309 }
12310
12311 dlg.finished(false);
12312
12313 return Err(match error {
12314 Ok(value) => common::Error::BadRequest(value),
12315 _ => common::Error::Failure(response),
12316 });
12317 }
12318 let response = {
12319 let bytes = common::to_bytes(body).await.unwrap_or_default();
12320 let encoded = common::to_string(&bytes);
12321 match serde_json::from_str(&encoded) {
12322 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12323 Err(error) => {
12324 dlg.response_json_decode_error(&encoded, &error);
12325 return Err(common::Error::JsonDecodeError(
12326 encoded.to_string(),
12327 error,
12328 ));
12329 }
12330 }
12331 };
12332
12333 dlg.finished(true);
12334 return Ok(response);
12335 }
12336 }
12337 }
12338 }
12339
12340 /// Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
12341 ///
12342 /// Sets the *name* path property to the given value.
12343 ///
12344 /// Even though the property as already been set when instantiating this call,
12345 /// we provide this method for API completeness.
12346 pub fn name(mut self, new_value: &str) -> ProjectSiteVersionGetCall<'a, C> {
12347 self._name = new_value.to_string();
12348 self
12349 }
12350 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12351 /// while executing the actual API request.
12352 ///
12353 /// ````text
12354 /// It should be used to handle progress information, and to implement a certain level of resilience.
12355 /// ````
12356 ///
12357 /// Sets the *delegate* property to the given value.
12358 pub fn delegate(
12359 mut self,
12360 new_value: &'a mut dyn common::Delegate,
12361 ) -> ProjectSiteVersionGetCall<'a, C> {
12362 self._delegate = Some(new_value);
12363 self
12364 }
12365
12366 /// Set any additional parameter of the query string used in the request.
12367 /// It should be used to set parameters which are not yet available through their own
12368 /// setters.
12369 ///
12370 /// Please note that this method must not be used to set any of the known parameters
12371 /// which have their own setter method. If done anyway, the request will fail.
12372 ///
12373 /// # Additional Parameters
12374 ///
12375 /// * *$.xgafv* (query-string) - V1 error format.
12376 /// * *access_token* (query-string) - OAuth access token.
12377 /// * *alt* (query-string) - Data format for response.
12378 /// * *callback* (query-string) - JSONP
12379 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12380 /// * *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.
12381 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12382 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12383 /// * *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.
12384 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12385 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12386 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionGetCall<'a, C>
12387 where
12388 T: AsRef<str>,
12389 {
12390 self._additional_params
12391 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12392 self
12393 }
12394
12395 /// Identifies the authorization scope for the method you are building.
12396 ///
12397 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12398 /// [`Scope::FirebaseReadonly`].
12399 ///
12400 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12401 /// tokens for more than one scope.
12402 ///
12403 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12404 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12405 /// sufficient, a read-write scope will do as well.
12406 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionGetCall<'a, C>
12407 where
12408 St: AsRef<str>,
12409 {
12410 self._scopes.insert(String::from(scope.as_ref()));
12411 self
12412 }
12413 /// Identifies the authorization scope(s) for the method you are building.
12414 ///
12415 /// See [`Self::add_scope()`] for details.
12416 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionGetCall<'a, C>
12417 where
12418 I: IntoIterator<Item = St>,
12419 St: AsRef<str>,
12420 {
12421 self._scopes
12422 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12423 self
12424 }
12425
12426 /// Removes all scopes, and no default scope will be used either.
12427 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12428 /// for details).
12429 pub fn clear_scopes(mut self) -> ProjectSiteVersionGetCall<'a, C> {
12430 self._scopes.clear();
12431 self
12432 }
12433}
12434
12435/// 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.
12436///
12437/// A builder for the *sites.versions.list* method supported by a *project* resource.
12438/// It is not used directly, but through a [`ProjectMethods`] instance.
12439///
12440/// # Example
12441///
12442/// Instantiate a resource method builder
12443///
12444/// ```test_harness,no_run
12445/// # extern crate hyper;
12446/// # extern crate hyper_rustls;
12447/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
12448/// # async fn dox() {
12449/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12450///
12451/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12452/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12453/// # .with_native_roots()
12454/// # .unwrap()
12455/// # .https_only()
12456/// # .enable_http2()
12457/// # .build();
12458///
12459/// # let executor = hyper_util::rt::TokioExecutor::new();
12460/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12461/// # secret,
12462/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12463/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12464/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12465/// # ),
12466/// # ).build().await.unwrap();
12467///
12468/// # let client = hyper_util::client::legacy::Client::builder(
12469/// # hyper_util::rt::TokioExecutor::new()
12470/// # )
12471/// # .build(
12472/// # hyper_rustls::HttpsConnectorBuilder::new()
12473/// # .with_native_roots()
12474/// # .unwrap()
12475/// # .https_or_http()
12476/// # .enable_http2()
12477/// # .build()
12478/// # );
12479/// # let mut hub = FirebaseHosting::new(client, auth);
12480/// // You can configure optional parameters by calling the respective setters at will, and
12481/// // execute the final call using `doit()`.
12482/// // Values shown here are possibly random and not representative !
12483/// let result = hub.projects().sites_versions_list("parent")
12484/// .page_token("amet.")
12485/// .page_size(-30)
12486/// .filter("takimata")
12487/// .doit().await;
12488/// # }
12489/// ```
12490pub struct ProjectSiteVersionListCall<'a, C>
12491where
12492 C: 'a,
12493{
12494 hub: &'a FirebaseHosting<C>,
12495 _parent: String,
12496 _page_token: Option<String>,
12497 _page_size: Option<i32>,
12498 _filter: Option<String>,
12499 _delegate: Option<&'a mut dyn common::Delegate>,
12500 _additional_params: HashMap<String, String>,
12501 _scopes: BTreeSet<String>,
12502}
12503
12504impl<'a, C> common::CallBuilder for ProjectSiteVersionListCall<'a, C> {}
12505
12506impl<'a, C> ProjectSiteVersionListCall<'a, C>
12507where
12508 C: common::Connector,
12509{
12510 /// Perform the operation you have build so far.
12511 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionsResponse)> {
12512 use std::borrow::Cow;
12513 use std::io::{Read, Seek};
12514
12515 use common::{url::Params, ToParts};
12516 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12517
12518 let mut dd = common::DefaultDelegate;
12519 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12520 dlg.begin(common::MethodInfo {
12521 id: "firebasehosting.projects.sites.versions.list",
12522 http_method: hyper::Method::GET,
12523 });
12524
12525 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
12526 if self._additional_params.contains_key(field) {
12527 dlg.finished(false);
12528 return Err(common::Error::FieldClash(field));
12529 }
12530 }
12531
12532 let mut params = Params::with_capacity(6 + self._additional_params.len());
12533 params.push("parent", self._parent);
12534 if let Some(value) = self._page_token.as_ref() {
12535 params.push("pageToken", value);
12536 }
12537 if let Some(value) = self._page_size.as_ref() {
12538 params.push("pageSize", value.to_string());
12539 }
12540 if let Some(value) = self._filter.as_ref() {
12541 params.push("filter", value);
12542 }
12543
12544 params.extend(self._additional_params.iter());
12545
12546 params.push("alt", "json");
12547 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
12548 if self._scopes.is_empty() {
12549 self._scopes
12550 .insert(Scope::FirebaseReadonly.as_ref().to_string());
12551 }
12552
12553 #[allow(clippy::single_element_loop)]
12554 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12555 url = params.uri_replacement(url, param_name, find_this, true);
12556 }
12557 {
12558 let to_remove = ["parent"];
12559 params.remove_params(&to_remove);
12560 }
12561
12562 let url = params.parse_with_url(&url);
12563
12564 loop {
12565 let token = match self
12566 .hub
12567 .auth
12568 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12569 .await
12570 {
12571 Ok(token) => token,
12572 Err(e) => match dlg.token(e) {
12573 Ok(token) => token,
12574 Err(e) => {
12575 dlg.finished(false);
12576 return Err(common::Error::MissingToken(e));
12577 }
12578 },
12579 };
12580 let mut req_result = {
12581 let client = &self.hub.client;
12582 dlg.pre_request();
12583 let mut req_builder = hyper::Request::builder()
12584 .method(hyper::Method::GET)
12585 .uri(url.as_str())
12586 .header(USER_AGENT, self.hub._user_agent.clone());
12587
12588 if let Some(token) = token.as_ref() {
12589 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12590 }
12591
12592 let request = req_builder
12593 .header(CONTENT_LENGTH, 0_u64)
12594 .body(common::to_body::<String>(None));
12595
12596 client.request(request.unwrap()).await
12597 };
12598
12599 match req_result {
12600 Err(err) => {
12601 if let common::Retry::After(d) = dlg.http_error(&err) {
12602 sleep(d).await;
12603 continue;
12604 }
12605 dlg.finished(false);
12606 return Err(common::Error::HttpError(err));
12607 }
12608 Ok(res) => {
12609 let (mut parts, body) = res.into_parts();
12610 let mut body = common::Body::new(body);
12611 if !parts.status.is_success() {
12612 let bytes = common::to_bytes(body).await.unwrap_or_default();
12613 let error = serde_json::from_str(&common::to_string(&bytes));
12614 let response = common::to_response(parts, bytes.into());
12615
12616 if let common::Retry::After(d) =
12617 dlg.http_failure(&response, error.as_ref().ok())
12618 {
12619 sleep(d).await;
12620 continue;
12621 }
12622
12623 dlg.finished(false);
12624
12625 return Err(match error {
12626 Ok(value) => common::Error::BadRequest(value),
12627 _ => common::Error::Failure(response),
12628 });
12629 }
12630 let response = {
12631 let bytes = common::to_bytes(body).await.unwrap_or_default();
12632 let encoded = common::to_string(&bytes);
12633 match serde_json::from_str(&encoded) {
12634 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12635 Err(error) => {
12636 dlg.response_json_decode_error(&encoded, &error);
12637 return Err(common::Error::JsonDecodeError(
12638 encoded.to_string(),
12639 error,
12640 ));
12641 }
12642 }
12643 };
12644
12645 dlg.finished(true);
12646 return Ok(response);
12647 }
12648 }
12649 }
12650 }
12651
12652 /// 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
12653 ///
12654 /// Sets the *parent* path property to the given value.
12655 ///
12656 /// Even though the property as already been set when instantiating this call,
12657 /// we provide this method for API completeness.
12658 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionListCall<'a, C> {
12659 self._parent = new_value.to_string();
12660 self
12661 }
12662 /// A token from a previous call to `ListVersions` that tells the server where to resume listing.
12663 ///
12664 /// Sets the *page token* query property to the given value.
12665 pub fn page_token(mut self, new_value: &str) -> ProjectSiteVersionListCall<'a, C> {
12666 self._page_token = Some(new_value.to_string());
12667 self
12668 }
12669 /// 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.
12670 ///
12671 /// Sets the *page size* query property to the given value.
12672 pub fn page_size(mut self, new_value: i32) -> ProjectSiteVersionListCall<'a, C> {
12673 self._page_size = Some(new_value);
12674 self
12675 }
12676 /// 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).
12677 ///
12678 /// Sets the *filter* query property to the given value.
12679 pub fn filter(mut self, new_value: &str) -> ProjectSiteVersionListCall<'a, C> {
12680 self._filter = Some(new_value.to_string());
12681 self
12682 }
12683 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12684 /// while executing the actual API request.
12685 ///
12686 /// ````text
12687 /// It should be used to handle progress information, and to implement a certain level of resilience.
12688 /// ````
12689 ///
12690 /// Sets the *delegate* property to the given value.
12691 pub fn delegate(
12692 mut self,
12693 new_value: &'a mut dyn common::Delegate,
12694 ) -> ProjectSiteVersionListCall<'a, C> {
12695 self._delegate = Some(new_value);
12696 self
12697 }
12698
12699 /// Set any additional parameter of the query string used in the request.
12700 /// It should be used to set parameters which are not yet available through their own
12701 /// setters.
12702 ///
12703 /// Please note that this method must not be used to set any of the known parameters
12704 /// which have their own setter method. If done anyway, the request will fail.
12705 ///
12706 /// # Additional Parameters
12707 ///
12708 /// * *$.xgafv* (query-string) - V1 error format.
12709 /// * *access_token* (query-string) - OAuth access token.
12710 /// * *alt* (query-string) - Data format for response.
12711 /// * *callback* (query-string) - JSONP
12712 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12713 /// * *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.
12714 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12715 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12716 /// * *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.
12717 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12718 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12719 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionListCall<'a, C>
12720 where
12721 T: AsRef<str>,
12722 {
12723 self._additional_params
12724 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12725 self
12726 }
12727
12728 /// Identifies the authorization scope for the method you are building.
12729 ///
12730 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12731 /// [`Scope::FirebaseReadonly`].
12732 ///
12733 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12734 /// tokens for more than one scope.
12735 ///
12736 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12737 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12738 /// sufficient, a read-write scope will do as well.
12739 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionListCall<'a, C>
12740 where
12741 St: AsRef<str>,
12742 {
12743 self._scopes.insert(String::from(scope.as_ref()));
12744 self
12745 }
12746 /// Identifies the authorization scope(s) for the method you are building.
12747 ///
12748 /// See [`Self::add_scope()`] for details.
12749 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionListCall<'a, C>
12750 where
12751 I: IntoIterator<Item = St>,
12752 St: AsRef<str>,
12753 {
12754 self._scopes
12755 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12756 self
12757 }
12758
12759 /// Removes all scopes, and no default scope will be used either.
12760 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12761 /// for details).
12762 pub fn clear_scopes(mut self) -> ProjectSiteVersionListCall<'a, C> {
12763 self._scopes.clear();
12764 self
12765 }
12766}
12767
12768/// 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`.
12769///
12770/// A builder for the *sites.versions.patch* method supported by a *project* resource.
12771/// It is not used directly, but through a [`ProjectMethods`] instance.
12772///
12773/// # Example
12774///
12775/// Instantiate a resource method builder
12776///
12777/// ```test_harness,no_run
12778/// # extern crate hyper;
12779/// # extern crate hyper_rustls;
12780/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
12781/// use firebasehosting1_beta1::api::Version;
12782/// # async fn dox() {
12783/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12784///
12785/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12786/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12787/// # .with_native_roots()
12788/// # .unwrap()
12789/// # .https_only()
12790/// # .enable_http2()
12791/// # .build();
12792///
12793/// # let executor = hyper_util::rt::TokioExecutor::new();
12794/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12795/// # secret,
12796/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12797/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12798/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12799/// # ),
12800/// # ).build().await.unwrap();
12801///
12802/// # let client = hyper_util::client::legacy::Client::builder(
12803/// # hyper_util::rt::TokioExecutor::new()
12804/// # )
12805/// # .build(
12806/// # hyper_rustls::HttpsConnectorBuilder::new()
12807/// # .with_native_roots()
12808/// # .unwrap()
12809/// # .https_or_http()
12810/// # .enable_http2()
12811/// # .build()
12812/// # );
12813/// # let mut hub = FirebaseHosting::new(client, auth);
12814/// // As the method needs a request, you would usually fill it with the desired information
12815/// // into the respective structure. Some of the parts shown here might not be applicable !
12816/// // Values shown here are possibly random and not representative !
12817/// let mut req = Version::default();
12818///
12819/// // You can configure optional parameters by calling the respective setters at will, and
12820/// // execute the final call using `doit()`.
12821/// // Values shown here are possibly random and not representative !
12822/// let result = hub.projects().sites_versions_patch(req, "name")
12823/// .update_mask(FieldMask::new::<&str>(&[]))
12824/// .doit().await;
12825/// # }
12826/// ```
12827pub struct ProjectSiteVersionPatchCall<'a, C>
12828where
12829 C: 'a,
12830{
12831 hub: &'a FirebaseHosting<C>,
12832 _request: Version,
12833 _name: String,
12834 _update_mask: Option<common::FieldMask>,
12835 _delegate: Option<&'a mut dyn common::Delegate>,
12836 _additional_params: HashMap<String, String>,
12837 _scopes: BTreeSet<String>,
12838}
12839
12840impl<'a, C> common::CallBuilder for ProjectSiteVersionPatchCall<'a, C> {}
12841
12842impl<'a, C> ProjectSiteVersionPatchCall<'a, C>
12843where
12844 C: common::Connector,
12845{
12846 /// Perform the operation you have build so far.
12847 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
12848 use std::borrow::Cow;
12849 use std::io::{Read, Seek};
12850
12851 use common::{url::Params, ToParts};
12852 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12853
12854 let mut dd = common::DefaultDelegate;
12855 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12856 dlg.begin(common::MethodInfo {
12857 id: "firebasehosting.projects.sites.versions.patch",
12858 http_method: hyper::Method::PATCH,
12859 });
12860
12861 for &field in ["alt", "name", "updateMask"].iter() {
12862 if self._additional_params.contains_key(field) {
12863 dlg.finished(false);
12864 return Err(common::Error::FieldClash(field));
12865 }
12866 }
12867
12868 let mut params = Params::with_capacity(5 + self._additional_params.len());
12869 params.push("name", self._name);
12870 if let Some(value) = self._update_mask.as_ref() {
12871 params.push("updateMask", value.to_string());
12872 }
12873
12874 params.extend(self._additional_params.iter());
12875
12876 params.push("alt", "json");
12877 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
12878 if self._scopes.is_empty() {
12879 self._scopes
12880 .insert(Scope::CloudPlatform.as_ref().to_string());
12881 }
12882
12883 #[allow(clippy::single_element_loop)]
12884 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12885 url = params.uri_replacement(url, param_name, find_this, true);
12886 }
12887 {
12888 let to_remove = ["name"];
12889 params.remove_params(&to_remove);
12890 }
12891
12892 let url = params.parse_with_url(&url);
12893
12894 let mut json_mime_type = mime::APPLICATION_JSON;
12895 let mut request_value_reader = {
12896 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12897 common::remove_json_null_values(&mut value);
12898 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12899 serde_json::to_writer(&mut dst, &value).unwrap();
12900 dst
12901 };
12902 let request_size = request_value_reader
12903 .seek(std::io::SeekFrom::End(0))
12904 .unwrap();
12905 request_value_reader
12906 .seek(std::io::SeekFrom::Start(0))
12907 .unwrap();
12908
12909 loop {
12910 let token = match self
12911 .hub
12912 .auth
12913 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12914 .await
12915 {
12916 Ok(token) => token,
12917 Err(e) => match dlg.token(e) {
12918 Ok(token) => token,
12919 Err(e) => {
12920 dlg.finished(false);
12921 return Err(common::Error::MissingToken(e));
12922 }
12923 },
12924 };
12925 request_value_reader
12926 .seek(std::io::SeekFrom::Start(0))
12927 .unwrap();
12928 let mut req_result = {
12929 let client = &self.hub.client;
12930 dlg.pre_request();
12931 let mut req_builder = hyper::Request::builder()
12932 .method(hyper::Method::PATCH)
12933 .uri(url.as_str())
12934 .header(USER_AGENT, self.hub._user_agent.clone());
12935
12936 if let Some(token) = token.as_ref() {
12937 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12938 }
12939
12940 let request = req_builder
12941 .header(CONTENT_TYPE, json_mime_type.to_string())
12942 .header(CONTENT_LENGTH, request_size as u64)
12943 .body(common::to_body(
12944 request_value_reader.get_ref().clone().into(),
12945 ));
12946
12947 client.request(request.unwrap()).await
12948 };
12949
12950 match req_result {
12951 Err(err) => {
12952 if let common::Retry::After(d) = dlg.http_error(&err) {
12953 sleep(d).await;
12954 continue;
12955 }
12956 dlg.finished(false);
12957 return Err(common::Error::HttpError(err));
12958 }
12959 Ok(res) => {
12960 let (mut parts, body) = res.into_parts();
12961 let mut body = common::Body::new(body);
12962 if !parts.status.is_success() {
12963 let bytes = common::to_bytes(body).await.unwrap_or_default();
12964 let error = serde_json::from_str(&common::to_string(&bytes));
12965 let response = common::to_response(parts, bytes.into());
12966
12967 if let common::Retry::After(d) =
12968 dlg.http_failure(&response, error.as_ref().ok())
12969 {
12970 sleep(d).await;
12971 continue;
12972 }
12973
12974 dlg.finished(false);
12975
12976 return Err(match error {
12977 Ok(value) => common::Error::BadRequest(value),
12978 _ => common::Error::Failure(response),
12979 });
12980 }
12981 let response = {
12982 let bytes = common::to_bytes(body).await.unwrap_or_default();
12983 let encoded = common::to_string(&bytes);
12984 match serde_json::from_str(&encoded) {
12985 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12986 Err(error) => {
12987 dlg.response_json_decode_error(&encoded, &error);
12988 return Err(common::Error::JsonDecodeError(
12989 encoded.to_string(),
12990 error,
12991 ));
12992 }
12993 }
12994 };
12995
12996 dlg.finished(true);
12997 return Ok(response);
12998 }
12999 }
13000 }
13001 }
13002
13003 ///
13004 /// Sets the *request* property to the given value.
13005 ///
13006 /// Even though the property as already been set when instantiating this call,
13007 /// we provide this method for API completeness.
13008 pub fn request(mut self, new_value: Version) -> ProjectSiteVersionPatchCall<'a, C> {
13009 self._request = new_value;
13010 self
13011 }
13012 /// 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).
13013 ///
13014 /// Sets the *name* path property to the given value.
13015 ///
13016 /// Even though the property as already been set when instantiating this call,
13017 /// we provide this method for API completeness.
13018 pub fn name(mut self, new_value: &str) -> ProjectSiteVersionPatchCall<'a, C> {
13019 self._name = new_value.to_string();
13020 self
13021 }
13022 /// 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.
13023 ///
13024 /// Sets the *update mask* query property to the given value.
13025 pub fn update_mask(
13026 mut self,
13027 new_value: common::FieldMask,
13028 ) -> ProjectSiteVersionPatchCall<'a, C> {
13029 self._update_mask = Some(new_value);
13030 self
13031 }
13032 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13033 /// while executing the actual API request.
13034 ///
13035 /// ````text
13036 /// It should be used to handle progress information, and to implement a certain level of resilience.
13037 /// ````
13038 ///
13039 /// Sets the *delegate* property to the given value.
13040 pub fn delegate(
13041 mut self,
13042 new_value: &'a mut dyn common::Delegate,
13043 ) -> ProjectSiteVersionPatchCall<'a, C> {
13044 self._delegate = Some(new_value);
13045 self
13046 }
13047
13048 /// Set any additional parameter of the query string used in the request.
13049 /// It should be used to set parameters which are not yet available through their own
13050 /// setters.
13051 ///
13052 /// Please note that this method must not be used to set any of the known parameters
13053 /// which have their own setter method. If done anyway, the request will fail.
13054 ///
13055 /// # Additional Parameters
13056 ///
13057 /// * *$.xgafv* (query-string) - V1 error format.
13058 /// * *access_token* (query-string) - OAuth access token.
13059 /// * *alt* (query-string) - Data format for response.
13060 /// * *callback* (query-string) - JSONP
13061 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13062 /// * *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.
13063 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13064 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13065 /// * *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.
13066 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13067 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13068 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionPatchCall<'a, C>
13069 where
13070 T: AsRef<str>,
13071 {
13072 self._additional_params
13073 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13074 self
13075 }
13076
13077 /// Identifies the authorization scope for the method you are building.
13078 ///
13079 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13080 /// [`Scope::CloudPlatform`].
13081 ///
13082 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13083 /// tokens for more than one scope.
13084 ///
13085 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13086 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13087 /// sufficient, a read-write scope will do as well.
13088 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionPatchCall<'a, C>
13089 where
13090 St: AsRef<str>,
13091 {
13092 self._scopes.insert(String::from(scope.as_ref()));
13093 self
13094 }
13095 /// Identifies the authorization scope(s) for the method you are building.
13096 ///
13097 /// See [`Self::add_scope()`] for details.
13098 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionPatchCall<'a, C>
13099 where
13100 I: IntoIterator<Item = St>,
13101 St: AsRef<str>,
13102 {
13103 self._scopes
13104 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13105 self
13106 }
13107
13108 /// Removes all scopes, and no default scope will be used either.
13109 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13110 /// for details).
13111 pub fn clear_scopes(mut self) -> ProjectSiteVersionPatchCall<'a, C> {
13112 self._scopes.clear();
13113 self
13114 }
13115}
13116
13117/// Adds content files to the specified version. Each file must be under 2 GB.
13118///
13119/// A builder for the *sites.versions.populateFiles* method supported by a *project* resource.
13120/// It is not used directly, but through a [`ProjectMethods`] instance.
13121///
13122/// # Example
13123///
13124/// Instantiate a resource method builder
13125///
13126/// ```test_harness,no_run
13127/// # extern crate hyper;
13128/// # extern crate hyper_rustls;
13129/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
13130/// use firebasehosting1_beta1::api::PopulateVersionFilesRequest;
13131/// # async fn dox() {
13132/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13133///
13134/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13135/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13136/// # .with_native_roots()
13137/// # .unwrap()
13138/// # .https_only()
13139/// # .enable_http2()
13140/// # .build();
13141///
13142/// # let executor = hyper_util::rt::TokioExecutor::new();
13143/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13144/// # secret,
13145/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13146/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13147/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13148/// # ),
13149/// # ).build().await.unwrap();
13150///
13151/// # let client = hyper_util::client::legacy::Client::builder(
13152/// # hyper_util::rt::TokioExecutor::new()
13153/// # )
13154/// # .build(
13155/// # hyper_rustls::HttpsConnectorBuilder::new()
13156/// # .with_native_roots()
13157/// # .unwrap()
13158/// # .https_or_http()
13159/// # .enable_http2()
13160/// # .build()
13161/// # );
13162/// # let mut hub = FirebaseHosting::new(client, auth);
13163/// // As the method needs a request, you would usually fill it with the desired information
13164/// // into the respective structure. Some of the parts shown here might not be applicable !
13165/// // Values shown here are possibly random and not representative !
13166/// let mut req = PopulateVersionFilesRequest::default();
13167///
13168/// // You can configure optional parameters by calling the respective setters at will, and
13169/// // execute the final call using `doit()`.
13170/// // Values shown here are possibly random and not representative !
13171/// let result = hub.projects().sites_versions_populate_files(req, "parent")
13172/// .doit().await;
13173/// # }
13174/// ```
13175pub struct ProjectSiteVersionPopulateFileCall<'a, C>
13176where
13177 C: 'a,
13178{
13179 hub: &'a FirebaseHosting<C>,
13180 _request: PopulateVersionFilesRequest,
13181 _parent: String,
13182 _delegate: Option<&'a mut dyn common::Delegate>,
13183 _additional_params: HashMap<String, String>,
13184 _scopes: BTreeSet<String>,
13185}
13186
13187impl<'a, C> common::CallBuilder for ProjectSiteVersionPopulateFileCall<'a, C> {}
13188
13189impl<'a, C> ProjectSiteVersionPopulateFileCall<'a, C>
13190where
13191 C: common::Connector,
13192{
13193 /// Perform the operation you have build so far.
13194 pub async fn doit(
13195 mut self,
13196 ) -> common::Result<(common::Response, PopulateVersionFilesResponse)> {
13197 use std::borrow::Cow;
13198 use std::io::{Read, Seek};
13199
13200 use common::{url::Params, ToParts};
13201 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13202
13203 let mut dd = common::DefaultDelegate;
13204 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13205 dlg.begin(common::MethodInfo {
13206 id: "firebasehosting.projects.sites.versions.populateFiles",
13207 http_method: hyper::Method::POST,
13208 });
13209
13210 for &field in ["alt", "parent"].iter() {
13211 if self._additional_params.contains_key(field) {
13212 dlg.finished(false);
13213 return Err(common::Error::FieldClash(field));
13214 }
13215 }
13216
13217 let mut params = Params::with_capacity(4 + self._additional_params.len());
13218 params.push("parent", self._parent);
13219
13220 params.extend(self._additional_params.iter());
13221
13222 params.push("alt", "json");
13223 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:populateFiles";
13224 if self._scopes.is_empty() {
13225 self._scopes
13226 .insert(Scope::CloudPlatform.as_ref().to_string());
13227 }
13228
13229 #[allow(clippy::single_element_loop)]
13230 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13231 url = params.uri_replacement(url, param_name, find_this, true);
13232 }
13233 {
13234 let to_remove = ["parent"];
13235 params.remove_params(&to_remove);
13236 }
13237
13238 let url = params.parse_with_url(&url);
13239
13240 let mut json_mime_type = mime::APPLICATION_JSON;
13241 let mut request_value_reader = {
13242 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13243 common::remove_json_null_values(&mut value);
13244 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13245 serde_json::to_writer(&mut dst, &value).unwrap();
13246 dst
13247 };
13248 let request_size = request_value_reader
13249 .seek(std::io::SeekFrom::End(0))
13250 .unwrap();
13251 request_value_reader
13252 .seek(std::io::SeekFrom::Start(0))
13253 .unwrap();
13254
13255 loop {
13256 let token = match self
13257 .hub
13258 .auth
13259 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13260 .await
13261 {
13262 Ok(token) => token,
13263 Err(e) => match dlg.token(e) {
13264 Ok(token) => token,
13265 Err(e) => {
13266 dlg.finished(false);
13267 return Err(common::Error::MissingToken(e));
13268 }
13269 },
13270 };
13271 request_value_reader
13272 .seek(std::io::SeekFrom::Start(0))
13273 .unwrap();
13274 let mut req_result = {
13275 let client = &self.hub.client;
13276 dlg.pre_request();
13277 let mut req_builder = hyper::Request::builder()
13278 .method(hyper::Method::POST)
13279 .uri(url.as_str())
13280 .header(USER_AGENT, self.hub._user_agent.clone());
13281
13282 if let Some(token) = token.as_ref() {
13283 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13284 }
13285
13286 let request = req_builder
13287 .header(CONTENT_TYPE, json_mime_type.to_string())
13288 .header(CONTENT_LENGTH, request_size as u64)
13289 .body(common::to_body(
13290 request_value_reader.get_ref().clone().into(),
13291 ));
13292
13293 client.request(request.unwrap()).await
13294 };
13295
13296 match req_result {
13297 Err(err) => {
13298 if let common::Retry::After(d) = dlg.http_error(&err) {
13299 sleep(d).await;
13300 continue;
13301 }
13302 dlg.finished(false);
13303 return Err(common::Error::HttpError(err));
13304 }
13305 Ok(res) => {
13306 let (mut parts, body) = res.into_parts();
13307 let mut body = common::Body::new(body);
13308 if !parts.status.is_success() {
13309 let bytes = common::to_bytes(body).await.unwrap_or_default();
13310 let error = serde_json::from_str(&common::to_string(&bytes));
13311 let response = common::to_response(parts, bytes.into());
13312
13313 if let common::Retry::After(d) =
13314 dlg.http_failure(&response, error.as_ref().ok())
13315 {
13316 sleep(d).await;
13317 continue;
13318 }
13319
13320 dlg.finished(false);
13321
13322 return Err(match error {
13323 Ok(value) => common::Error::BadRequest(value),
13324 _ => common::Error::Failure(response),
13325 });
13326 }
13327 let response = {
13328 let bytes = common::to_bytes(body).await.unwrap_or_default();
13329 let encoded = common::to_string(&bytes);
13330 match serde_json::from_str(&encoded) {
13331 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13332 Err(error) => {
13333 dlg.response_json_decode_error(&encoded, &error);
13334 return Err(common::Error::JsonDecodeError(
13335 encoded.to_string(),
13336 error,
13337 ));
13338 }
13339 }
13340 };
13341
13342 dlg.finished(true);
13343 return Ok(response);
13344 }
13345 }
13346 }
13347 }
13348
13349 ///
13350 /// Sets the *request* property to the given value.
13351 ///
13352 /// Even though the property as already been set when instantiating this call,
13353 /// we provide this method for API completeness.
13354 pub fn request(
13355 mut self,
13356 new_value: PopulateVersionFilesRequest,
13357 ) -> ProjectSiteVersionPopulateFileCall<'a, C> {
13358 self._request = new_value;
13359 self
13360 }
13361 /// Required. The version to which to add files, in the format: sites/SITE_ID /versions/VERSION_ID
13362 ///
13363 /// Sets the *parent* path property to the given value.
13364 ///
13365 /// Even though the property as already been set when instantiating this call,
13366 /// we provide this method for API completeness.
13367 pub fn parent(mut self, new_value: &str) -> ProjectSiteVersionPopulateFileCall<'a, C> {
13368 self._parent = new_value.to_string();
13369 self
13370 }
13371 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13372 /// while executing the actual API request.
13373 ///
13374 /// ````text
13375 /// It should be used to handle progress information, and to implement a certain level of resilience.
13376 /// ````
13377 ///
13378 /// Sets the *delegate* property to the given value.
13379 pub fn delegate(
13380 mut self,
13381 new_value: &'a mut dyn common::Delegate,
13382 ) -> ProjectSiteVersionPopulateFileCall<'a, C> {
13383 self._delegate = Some(new_value);
13384 self
13385 }
13386
13387 /// Set any additional parameter of the query string used in the request.
13388 /// It should be used to set parameters which are not yet available through their own
13389 /// setters.
13390 ///
13391 /// Please note that this method must not be used to set any of the known parameters
13392 /// which have their own setter method. If done anyway, the request will fail.
13393 ///
13394 /// # Additional Parameters
13395 ///
13396 /// * *$.xgafv* (query-string) - V1 error format.
13397 /// * *access_token* (query-string) - OAuth access token.
13398 /// * *alt* (query-string) - Data format for response.
13399 /// * *callback* (query-string) - JSONP
13400 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13401 /// * *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.
13402 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13403 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13404 /// * *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.
13405 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13406 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13407 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteVersionPopulateFileCall<'a, C>
13408 where
13409 T: AsRef<str>,
13410 {
13411 self._additional_params
13412 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13413 self
13414 }
13415
13416 /// Identifies the authorization scope for the method you are building.
13417 ///
13418 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13419 /// [`Scope::CloudPlatform`].
13420 ///
13421 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13422 /// tokens for more than one scope.
13423 ///
13424 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13425 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13426 /// sufficient, a read-write scope will do as well.
13427 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteVersionPopulateFileCall<'a, C>
13428 where
13429 St: AsRef<str>,
13430 {
13431 self._scopes.insert(String::from(scope.as_ref()));
13432 self
13433 }
13434 /// Identifies the authorization scope(s) for the method you are building.
13435 ///
13436 /// See [`Self::add_scope()`] for details.
13437 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteVersionPopulateFileCall<'a, C>
13438 where
13439 I: IntoIterator<Item = St>,
13440 St: AsRef<str>,
13441 {
13442 self._scopes
13443 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13444 self
13445 }
13446
13447 /// Removes all scopes, and no default scope will be used either.
13448 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13449 /// for details).
13450 pub fn clear_scopes(mut self) -> ProjectSiteVersionPopulateFileCall<'a, C> {
13451 self._scopes.clear();
13452 self
13453 }
13454}
13455
13456/// Creates a new Hosting Site in the specified parent Firebase project. Note that Hosting sites can take several minutes to propagate through Firebase systems.
13457///
13458/// A builder for the *sites.create* method supported by a *project* resource.
13459/// It is not used directly, but through a [`ProjectMethods`] instance.
13460///
13461/// # Example
13462///
13463/// Instantiate a resource method builder
13464///
13465/// ```test_harness,no_run
13466/// # extern crate hyper;
13467/// # extern crate hyper_rustls;
13468/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
13469/// use firebasehosting1_beta1::api::Site;
13470/// # async fn dox() {
13471/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13472///
13473/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13474/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13475/// # .with_native_roots()
13476/// # .unwrap()
13477/// # .https_only()
13478/// # .enable_http2()
13479/// # .build();
13480///
13481/// # let executor = hyper_util::rt::TokioExecutor::new();
13482/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13483/// # secret,
13484/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13485/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13486/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13487/// # ),
13488/// # ).build().await.unwrap();
13489///
13490/// # let client = hyper_util::client::legacy::Client::builder(
13491/// # hyper_util::rt::TokioExecutor::new()
13492/// # )
13493/// # .build(
13494/// # hyper_rustls::HttpsConnectorBuilder::new()
13495/// # .with_native_roots()
13496/// # .unwrap()
13497/// # .https_or_http()
13498/// # .enable_http2()
13499/// # .build()
13500/// # );
13501/// # let mut hub = FirebaseHosting::new(client, auth);
13502/// // As the method needs a request, you would usually fill it with the desired information
13503/// // into the respective structure. Some of the parts shown here might not be applicable !
13504/// // Values shown here are possibly random and not representative !
13505/// let mut req = Site::default();
13506///
13507/// // You can configure optional parameters by calling the respective setters at will, and
13508/// // execute the final call using `doit()`.
13509/// // Values shown here are possibly random and not representative !
13510/// let result = hub.projects().sites_create(req, "parent")
13511/// .validate_only(false)
13512/// .site_id("dolore")
13513/// .doit().await;
13514/// # }
13515/// ```
13516pub struct ProjectSiteCreateCall<'a, C>
13517where
13518 C: 'a,
13519{
13520 hub: &'a FirebaseHosting<C>,
13521 _request: Site,
13522 _parent: String,
13523 _validate_only: Option<bool>,
13524 _site_id: Option<String>,
13525 _delegate: Option<&'a mut dyn common::Delegate>,
13526 _additional_params: HashMap<String, String>,
13527 _scopes: BTreeSet<String>,
13528}
13529
13530impl<'a, C> common::CallBuilder for ProjectSiteCreateCall<'a, C> {}
13531
13532impl<'a, C> ProjectSiteCreateCall<'a, C>
13533where
13534 C: common::Connector,
13535{
13536 /// Perform the operation you have build so far.
13537 pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
13538 use std::borrow::Cow;
13539 use std::io::{Read, Seek};
13540
13541 use common::{url::Params, ToParts};
13542 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13543
13544 let mut dd = common::DefaultDelegate;
13545 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13546 dlg.begin(common::MethodInfo {
13547 id: "firebasehosting.projects.sites.create",
13548 http_method: hyper::Method::POST,
13549 });
13550
13551 for &field in ["alt", "parent", "validateOnly", "siteId"].iter() {
13552 if self._additional_params.contains_key(field) {
13553 dlg.finished(false);
13554 return Err(common::Error::FieldClash(field));
13555 }
13556 }
13557
13558 let mut params = Params::with_capacity(6 + self._additional_params.len());
13559 params.push("parent", self._parent);
13560 if let Some(value) = self._validate_only.as_ref() {
13561 params.push("validateOnly", value.to_string());
13562 }
13563 if let Some(value) = self._site_id.as_ref() {
13564 params.push("siteId", value);
13565 }
13566
13567 params.extend(self._additional_params.iter());
13568
13569 params.push("alt", "json");
13570 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/sites";
13571 if self._scopes.is_empty() {
13572 self._scopes
13573 .insert(Scope::CloudPlatform.as_ref().to_string());
13574 }
13575
13576 #[allow(clippy::single_element_loop)]
13577 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13578 url = params.uri_replacement(url, param_name, find_this, true);
13579 }
13580 {
13581 let to_remove = ["parent"];
13582 params.remove_params(&to_remove);
13583 }
13584
13585 let url = params.parse_with_url(&url);
13586
13587 let mut json_mime_type = mime::APPLICATION_JSON;
13588 let mut request_value_reader = {
13589 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13590 common::remove_json_null_values(&mut value);
13591 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13592 serde_json::to_writer(&mut dst, &value).unwrap();
13593 dst
13594 };
13595 let request_size = request_value_reader
13596 .seek(std::io::SeekFrom::End(0))
13597 .unwrap();
13598 request_value_reader
13599 .seek(std::io::SeekFrom::Start(0))
13600 .unwrap();
13601
13602 loop {
13603 let token = match self
13604 .hub
13605 .auth
13606 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13607 .await
13608 {
13609 Ok(token) => token,
13610 Err(e) => match dlg.token(e) {
13611 Ok(token) => token,
13612 Err(e) => {
13613 dlg.finished(false);
13614 return Err(common::Error::MissingToken(e));
13615 }
13616 },
13617 };
13618 request_value_reader
13619 .seek(std::io::SeekFrom::Start(0))
13620 .unwrap();
13621 let mut req_result = {
13622 let client = &self.hub.client;
13623 dlg.pre_request();
13624 let mut req_builder = hyper::Request::builder()
13625 .method(hyper::Method::POST)
13626 .uri(url.as_str())
13627 .header(USER_AGENT, self.hub._user_agent.clone());
13628
13629 if let Some(token) = token.as_ref() {
13630 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13631 }
13632
13633 let request = req_builder
13634 .header(CONTENT_TYPE, json_mime_type.to_string())
13635 .header(CONTENT_LENGTH, request_size as u64)
13636 .body(common::to_body(
13637 request_value_reader.get_ref().clone().into(),
13638 ));
13639
13640 client.request(request.unwrap()).await
13641 };
13642
13643 match req_result {
13644 Err(err) => {
13645 if let common::Retry::After(d) = dlg.http_error(&err) {
13646 sleep(d).await;
13647 continue;
13648 }
13649 dlg.finished(false);
13650 return Err(common::Error::HttpError(err));
13651 }
13652 Ok(res) => {
13653 let (mut parts, body) = res.into_parts();
13654 let mut body = common::Body::new(body);
13655 if !parts.status.is_success() {
13656 let bytes = common::to_bytes(body).await.unwrap_or_default();
13657 let error = serde_json::from_str(&common::to_string(&bytes));
13658 let response = common::to_response(parts, bytes.into());
13659
13660 if let common::Retry::After(d) =
13661 dlg.http_failure(&response, error.as_ref().ok())
13662 {
13663 sleep(d).await;
13664 continue;
13665 }
13666
13667 dlg.finished(false);
13668
13669 return Err(match error {
13670 Ok(value) => common::Error::BadRequest(value),
13671 _ => common::Error::Failure(response),
13672 });
13673 }
13674 let response = {
13675 let bytes = common::to_bytes(body).await.unwrap_or_default();
13676 let encoded = common::to_string(&bytes);
13677 match serde_json::from_str(&encoded) {
13678 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13679 Err(error) => {
13680 dlg.response_json_decode_error(&encoded, &error);
13681 return Err(common::Error::JsonDecodeError(
13682 encoded.to_string(),
13683 error,
13684 ));
13685 }
13686 }
13687 };
13688
13689 dlg.finished(true);
13690 return Ok(response);
13691 }
13692 }
13693 }
13694 }
13695
13696 ///
13697 /// Sets the *request* property to the given value.
13698 ///
13699 /// Even though the property as already been set when instantiating this call,
13700 /// we provide this method for API completeness.
13701 pub fn request(mut self, new_value: Site) -> ProjectSiteCreateCall<'a, C> {
13702 self._request = new_value;
13703 self
13704 }
13705 /// 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.
13706 ///
13707 /// Sets the *parent* path property to the given value.
13708 ///
13709 /// Even though the property as already been set when instantiating this call,
13710 /// we provide this method for API completeness.
13711 pub fn parent(mut self, new_value: &str) -> ProjectSiteCreateCall<'a, C> {
13712 self._parent = new_value.to_string();
13713 self
13714 }
13715 /// Optional. If set, validates that the site_id is available and that the request would succeed, returning the expected resulting site or error.
13716 ///
13717 /// Sets the *validate only* query property to the given value.
13718 pub fn validate_only(mut self, new_value: bool) -> ProjectSiteCreateCall<'a, C> {
13719 self._validate_only = Some(new_value);
13720 self
13721 }
13722 /// 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.
13723 ///
13724 /// Sets the *site id* query property to the given value.
13725 pub fn site_id(mut self, new_value: &str) -> ProjectSiteCreateCall<'a, C> {
13726 self._site_id = Some(new_value.to_string());
13727 self
13728 }
13729 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13730 /// while executing the actual API request.
13731 ///
13732 /// ````text
13733 /// It should be used to handle progress information, and to implement a certain level of resilience.
13734 /// ````
13735 ///
13736 /// Sets the *delegate* property to the given value.
13737 pub fn delegate(
13738 mut self,
13739 new_value: &'a mut dyn common::Delegate,
13740 ) -> ProjectSiteCreateCall<'a, C> {
13741 self._delegate = Some(new_value);
13742 self
13743 }
13744
13745 /// Set any additional parameter of the query string used in the request.
13746 /// It should be used to set parameters which are not yet available through their own
13747 /// setters.
13748 ///
13749 /// Please note that this method must not be used to set any of the known parameters
13750 /// which have their own setter method. If done anyway, the request will fail.
13751 ///
13752 /// # Additional Parameters
13753 ///
13754 /// * *$.xgafv* (query-string) - V1 error format.
13755 /// * *access_token* (query-string) - OAuth access token.
13756 /// * *alt* (query-string) - Data format for response.
13757 /// * *callback* (query-string) - JSONP
13758 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13759 /// * *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.
13760 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13761 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13762 /// * *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.
13763 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13764 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13765 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCreateCall<'a, C>
13766 where
13767 T: AsRef<str>,
13768 {
13769 self._additional_params
13770 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13771 self
13772 }
13773
13774 /// Identifies the authorization scope for the method you are building.
13775 ///
13776 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13777 /// [`Scope::CloudPlatform`].
13778 ///
13779 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13780 /// tokens for more than one scope.
13781 ///
13782 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13783 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13784 /// sufficient, a read-write scope will do as well.
13785 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCreateCall<'a, C>
13786 where
13787 St: AsRef<str>,
13788 {
13789 self._scopes.insert(String::from(scope.as_ref()));
13790 self
13791 }
13792 /// Identifies the authorization scope(s) for the method you are building.
13793 ///
13794 /// See [`Self::add_scope()`] for details.
13795 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCreateCall<'a, C>
13796 where
13797 I: IntoIterator<Item = St>,
13798 St: AsRef<str>,
13799 {
13800 self._scopes
13801 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13802 self
13803 }
13804
13805 /// Removes all scopes, and no default scope will be used either.
13806 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13807 /// for details).
13808 pub fn clear_scopes(mut self) -> ProjectSiteCreateCall<'a, C> {
13809 self._scopes.clear();
13810 self
13811 }
13812}
13813
13814/// Deletes the specified Hosting Site from the specified parent Firebase project.
13815///
13816/// A builder for the *sites.delete* method supported by a *project* resource.
13817/// It is not used directly, but through a [`ProjectMethods`] instance.
13818///
13819/// # Example
13820///
13821/// Instantiate a resource method builder
13822///
13823/// ```test_harness,no_run
13824/// # extern crate hyper;
13825/// # extern crate hyper_rustls;
13826/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
13827/// # async fn dox() {
13828/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13829///
13830/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13831/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13832/// # .with_native_roots()
13833/// # .unwrap()
13834/// # .https_only()
13835/// # .enable_http2()
13836/// # .build();
13837///
13838/// # let executor = hyper_util::rt::TokioExecutor::new();
13839/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13840/// # secret,
13841/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13842/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13843/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13844/// # ),
13845/// # ).build().await.unwrap();
13846///
13847/// # let client = hyper_util::client::legacy::Client::builder(
13848/// # hyper_util::rt::TokioExecutor::new()
13849/// # )
13850/// # .build(
13851/// # hyper_rustls::HttpsConnectorBuilder::new()
13852/// # .with_native_roots()
13853/// # .unwrap()
13854/// # .https_or_http()
13855/// # .enable_http2()
13856/// # .build()
13857/// # );
13858/// # let mut hub = FirebaseHosting::new(client, auth);
13859/// // You can configure optional parameters by calling the respective setters at will, and
13860/// // execute the final call using `doit()`.
13861/// // Values shown here are possibly random and not representative !
13862/// let result = hub.projects().sites_delete("name")
13863/// .doit().await;
13864/// # }
13865/// ```
13866pub struct ProjectSiteDeleteCall<'a, C>
13867where
13868 C: 'a,
13869{
13870 hub: &'a FirebaseHosting<C>,
13871 _name: String,
13872 _delegate: Option<&'a mut dyn common::Delegate>,
13873 _additional_params: HashMap<String, String>,
13874 _scopes: BTreeSet<String>,
13875}
13876
13877impl<'a, C> common::CallBuilder for ProjectSiteDeleteCall<'a, C> {}
13878
13879impl<'a, C> ProjectSiteDeleteCall<'a, C>
13880where
13881 C: common::Connector,
13882{
13883 /// Perform the operation you have build so far.
13884 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
13885 use std::borrow::Cow;
13886 use std::io::{Read, Seek};
13887
13888 use common::{url::Params, ToParts};
13889 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13890
13891 let mut dd = common::DefaultDelegate;
13892 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13893 dlg.begin(common::MethodInfo {
13894 id: "firebasehosting.projects.sites.delete",
13895 http_method: hyper::Method::DELETE,
13896 });
13897
13898 for &field in ["alt", "name"].iter() {
13899 if self._additional_params.contains_key(field) {
13900 dlg.finished(false);
13901 return Err(common::Error::FieldClash(field));
13902 }
13903 }
13904
13905 let mut params = Params::with_capacity(3 + self._additional_params.len());
13906 params.push("name", self._name);
13907
13908 params.extend(self._additional_params.iter());
13909
13910 params.push("alt", "json");
13911 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
13912 if self._scopes.is_empty() {
13913 self._scopes
13914 .insert(Scope::CloudPlatform.as_ref().to_string());
13915 }
13916
13917 #[allow(clippy::single_element_loop)]
13918 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13919 url = params.uri_replacement(url, param_name, find_this, true);
13920 }
13921 {
13922 let to_remove = ["name"];
13923 params.remove_params(&to_remove);
13924 }
13925
13926 let url = params.parse_with_url(&url);
13927
13928 loop {
13929 let token = match self
13930 .hub
13931 .auth
13932 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13933 .await
13934 {
13935 Ok(token) => token,
13936 Err(e) => match dlg.token(e) {
13937 Ok(token) => token,
13938 Err(e) => {
13939 dlg.finished(false);
13940 return Err(common::Error::MissingToken(e));
13941 }
13942 },
13943 };
13944 let mut req_result = {
13945 let client = &self.hub.client;
13946 dlg.pre_request();
13947 let mut req_builder = hyper::Request::builder()
13948 .method(hyper::Method::DELETE)
13949 .uri(url.as_str())
13950 .header(USER_AGENT, self.hub._user_agent.clone());
13951
13952 if let Some(token) = token.as_ref() {
13953 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13954 }
13955
13956 let request = req_builder
13957 .header(CONTENT_LENGTH, 0_u64)
13958 .body(common::to_body::<String>(None));
13959
13960 client.request(request.unwrap()).await
13961 };
13962
13963 match req_result {
13964 Err(err) => {
13965 if let common::Retry::After(d) = dlg.http_error(&err) {
13966 sleep(d).await;
13967 continue;
13968 }
13969 dlg.finished(false);
13970 return Err(common::Error::HttpError(err));
13971 }
13972 Ok(res) => {
13973 let (mut parts, body) = res.into_parts();
13974 let mut body = common::Body::new(body);
13975 if !parts.status.is_success() {
13976 let bytes = common::to_bytes(body).await.unwrap_or_default();
13977 let error = serde_json::from_str(&common::to_string(&bytes));
13978 let response = common::to_response(parts, bytes.into());
13979
13980 if let common::Retry::After(d) =
13981 dlg.http_failure(&response, error.as_ref().ok())
13982 {
13983 sleep(d).await;
13984 continue;
13985 }
13986
13987 dlg.finished(false);
13988
13989 return Err(match error {
13990 Ok(value) => common::Error::BadRequest(value),
13991 _ => common::Error::Failure(response),
13992 });
13993 }
13994 let response = {
13995 let bytes = common::to_bytes(body).await.unwrap_or_default();
13996 let encoded = common::to_string(&bytes);
13997 match serde_json::from_str(&encoded) {
13998 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13999 Err(error) => {
14000 dlg.response_json_decode_error(&encoded, &error);
14001 return Err(common::Error::JsonDecodeError(
14002 encoded.to_string(),
14003 error,
14004 ));
14005 }
14006 }
14007 };
14008
14009 dlg.finished(true);
14010 return Ok(response);
14011 }
14012 }
14013 }
14014 }
14015
14016 /// 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.
14017 ///
14018 /// Sets the *name* path property to the given value.
14019 ///
14020 /// Even though the property as already been set when instantiating this call,
14021 /// we provide this method for API completeness.
14022 pub fn name(mut self, new_value: &str) -> ProjectSiteDeleteCall<'a, C> {
14023 self._name = new_value.to_string();
14024 self
14025 }
14026 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14027 /// while executing the actual API request.
14028 ///
14029 /// ````text
14030 /// It should be used to handle progress information, and to implement a certain level of resilience.
14031 /// ````
14032 ///
14033 /// Sets the *delegate* property to the given value.
14034 pub fn delegate(
14035 mut self,
14036 new_value: &'a mut dyn common::Delegate,
14037 ) -> ProjectSiteDeleteCall<'a, C> {
14038 self._delegate = Some(new_value);
14039 self
14040 }
14041
14042 /// Set any additional parameter of the query string used in the request.
14043 /// It should be used to set parameters which are not yet available through their own
14044 /// setters.
14045 ///
14046 /// Please note that this method must not be used to set any of the known parameters
14047 /// which have their own setter method. If done anyway, the request will fail.
14048 ///
14049 /// # Additional Parameters
14050 ///
14051 /// * *$.xgafv* (query-string) - V1 error format.
14052 /// * *access_token* (query-string) - OAuth access token.
14053 /// * *alt* (query-string) - Data format for response.
14054 /// * *callback* (query-string) - JSONP
14055 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14056 /// * *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.
14057 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14058 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14059 /// * *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.
14060 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14061 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14062 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteDeleteCall<'a, C>
14063 where
14064 T: AsRef<str>,
14065 {
14066 self._additional_params
14067 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14068 self
14069 }
14070
14071 /// Identifies the authorization scope for the method you are building.
14072 ///
14073 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14074 /// [`Scope::CloudPlatform`].
14075 ///
14076 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14077 /// tokens for more than one scope.
14078 ///
14079 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14080 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14081 /// sufficient, a read-write scope will do as well.
14082 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteDeleteCall<'a, C>
14083 where
14084 St: AsRef<str>,
14085 {
14086 self._scopes.insert(String::from(scope.as_ref()));
14087 self
14088 }
14089 /// Identifies the authorization scope(s) for the method you are building.
14090 ///
14091 /// See [`Self::add_scope()`] for details.
14092 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteDeleteCall<'a, C>
14093 where
14094 I: IntoIterator<Item = St>,
14095 St: AsRef<str>,
14096 {
14097 self._scopes
14098 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14099 self
14100 }
14101
14102 /// Removes all scopes, and no default scope will be used either.
14103 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14104 /// for details).
14105 pub fn clear_scopes(mut self) -> ProjectSiteDeleteCall<'a, C> {
14106 self._scopes.clear();
14107 self
14108 }
14109}
14110
14111/// Gets the specified Hosting Site.
14112///
14113/// A builder for the *sites.get* method supported by a *project* resource.
14114/// It is not used directly, but through a [`ProjectMethods`] instance.
14115///
14116/// # Example
14117///
14118/// Instantiate a resource method builder
14119///
14120/// ```test_harness,no_run
14121/// # extern crate hyper;
14122/// # extern crate hyper_rustls;
14123/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
14124/// # async fn dox() {
14125/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14126///
14127/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14128/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14129/// # .with_native_roots()
14130/// # .unwrap()
14131/// # .https_only()
14132/// # .enable_http2()
14133/// # .build();
14134///
14135/// # let executor = hyper_util::rt::TokioExecutor::new();
14136/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14137/// # secret,
14138/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14139/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14140/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14141/// # ),
14142/// # ).build().await.unwrap();
14143///
14144/// # let client = hyper_util::client::legacy::Client::builder(
14145/// # hyper_util::rt::TokioExecutor::new()
14146/// # )
14147/// # .build(
14148/// # hyper_rustls::HttpsConnectorBuilder::new()
14149/// # .with_native_roots()
14150/// # .unwrap()
14151/// # .https_or_http()
14152/// # .enable_http2()
14153/// # .build()
14154/// # );
14155/// # let mut hub = FirebaseHosting::new(client, auth);
14156/// // You can configure optional parameters by calling the respective setters at will, and
14157/// // execute the final call using `doit()`.
14158/// // Values shown here are possibly random and not representative !
14159/// let result = hub.projects().sites_get("name")
14160/// .doit().await;
14161/// # }
14162/// ```
14163pub struct ProjectSiteGetCall<'a, C>
14164where
14165 C: 'a,
14166{
14167 hub: &'a FirebaseHosting<C>,
14168 _name: String,
14169 _delegate: Option<&'a mut dyn common::Delegate>,
14170 _additional_params: HashMap<String, String>,
14171 _scopes: BTreeSet<String>,
14172}
14173
14174impl<'a, C> common::CallBuilder for ProjectSiteGetCall<'a, C> {}
14175
14176impl<'a, C> ProjectSiteGetCall<'a, C>
14177where
14178 C: common::Connector,
14179{
14180 /// Perform the operation you have build so far.
14181 pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
14182 use std::borrow::Cow;
14183 use std::io::{Read, Seek};
14184
14185 use common::{url::Params, ToParts};
14186 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14187
14188 let mut dd = common::DefaultDelegate;
14189 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14190 dlg.begin(common::MethodInfo {
14191 id: "firebasehosting.projects.sites.get",
14192 http_method: hyper::Method::GET,
14193 });
14194
14195 for &field in ["alt", "name"].iter() {
14196 if self._additional_params.contains_key(field) {
14197 dlg.finished(false);
14198 return Err(common::Error::FieldClash(field));
14199 }
14200 }
14201
14202 let mut params = Params::with_capacity(3 + self._additional_params.len());
14203 params.push("name", self._name);
14204
14205 params.extend(self._additional_params.iter());
14206
14207 params.push("alt", "json");
14208 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
14209 if self._scopes.is_empty() {
14210 self._scopes
14211 .insert(Scope::FirebaseReadonly.as_ref().to_string());
14212 }
14213
14214 #[allow(clippy::single_element_loop)]
14215 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14216 url = params.uri_replacement(url, param_name, find_this, true);
14217 }
14218 {
14219 let to_remove = ["name"];
14220 params.remove_params(&to_remove);
14221 }
14222
14223 let url = params.parse_with_url(&url);
14224
14225 loop {
14226 let token = match self
14227 .hub
14228 .auth
14229 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14230 .await
14231 {
14232 Ok(token) => token,
14233 Err(e) => match dlg.token(e) {
14234 Ok(token) => token,
14235 Err(e) => {
14236 dlg.finished(false);
14237 return Err(common::Error::MissingToken(e));
14238 }
14239 },
14240 };
14241 let mut req_result = {
14242 let client = &self.hub.client;
14243 dlg.pre_request();
14244 let mut req_builder = hyper::Request::builder()
14245 .method(hyper::Method::GET)
14246 .uri(url.as_str())
14247 .header(USER_AGENT, self.hub._user_agent.clone());
14248
14249 if let Some(token) = token.as_ref() {
14250 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14251 }
14252
14253 let request = req_builder
14254 .header(CONTENT_LENGTH, 0_u64)
14255 .body(common::to_body::<String>(None));
14256
14257 client.request(request.unwrap()).await
14258 };
14259
14260 match req_result {
14261 Err(err) => {
14262 if let common::Retry::After(d) = dlg.http_error(&err) {
14263 sleep(d).await;
14264 continue;
14265 }
14266 dlg.finished(false);
14267 return Err(common::Error::HttpError(err));
14268 }
14269 Ok(res) => {
14270 let (mut parts, body) = res.into_parts();
14271 let mut body = common::Body::new(body);
14272 if !parts.status.is_success() {
14273 let bytes = common::to_bytes(body).await.unwrap_or_default();
14274 let error = serde_json::from_str(&common::to_string(&bytes));
14275 let response = common::to_response(parts, bytes.into());
14276
14277 if let common::Retry::After(d) =
14278 dlg.http_failure(&response, error.as_ref().ok())
14279 {
14280 sleep(d).await;
14281 continue;
14282 }
14283
14284 dlg.finished(false);
14285
14286 return Err(match error {
14287 Ok(value) => common::Error::BadRequest(value),
14288 _ => common::Error::Failure(response),
14289 });
14290 }
14291 let response = {
14292 let bytes = common::to_bytes(body).await.unwrap_or_default();
14293 let encoded = common::to_string(&bytes);
14294 match serde_json::from_str(&encoded) {
14295 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14296 Err(error) => {
14297 dlg.response_json_decode_error(&encoded, &error);
14298 return Err(common::Error::JsonDecodeError(
14299 encoded.to_string(),
14300 error,
14301 ));
14302 }
14303 }
14304 };
14305
14306 dlg.finished(true);
14307 return Ok(response);
14308 }
14309 }
14310 }
14311 }
14312
14313 /// 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
14314 ///
14315 /// Sets the *name* path property to the given value.
14316 ///
14317 /// Even though the property as already been set when instantiating this call,
14318 /// we provide this method for API completeness.
14319 pub fn name(mut self, new_value: &str) -> ProjectSiteGetCall<'a, C> {
14320 self._name = new_value.to_string();
14321 self
14322 }
14323 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14324 /// while executing the actual API request.
14325 ///
14326 /// ````text
14327 /// It should be used to handle progress information, and to implement a certain level of resilience.
14328 /// ````
14329 ///
14330 /// Sets the *delegate* property to the given value.
14331 pub fn delegate(
14332 mut self,
14333 new_value: &'a mut dyn common::Delegate,
14334 ) -> ProjectSiteGetCall<'a, C> {
14335 self._delegate = Some(new_value);
14336 self
14337 }
14338
14339 /// Set any additional parameter of the query string used in the request.
14340 /// It should be used to set parameters which are not yet available through their own
14341 /// setters.
14342 ///
14343 /// Please note that this method must not be used to set any of the known parameters
14344 /// which have their own setter method. If done anyway, the request will fail.
14345 ///
14346 /// # Additional Parameters
14347 ///
14348 /// * *$.xgafv* (query-string) - V1 error format.
14349 /// * *access_token* (query-string) - OAuth access token.
14350 /// * *alt* (query-string) - Data format for response.
14351 /// * *callback* (query-string) - JSONP
14352 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14353 /// * *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.
14354 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14355 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14356 /// * *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.
14357 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14358 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14359 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteGetCall<'a, C>
14360 where
14361 T: AsRef<str>,
14362 {
14363 self._additional_params
14364 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14365 self
14366 }
14367
14368 /// Identifies the authorization scope for the method you are building.
14369 ///
14370 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14371 /// [`Scope::FirebaseReadonly`].
14372 ///
14373 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14374 /// tokens for more than one scope.
14375 ///
14376 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14377 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14378 /// sufficient, a read-write scope will do as well.
14379 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteGetCall<'a, C>
14380 where
14381 St: AsRef<str>,
14382 {
14383 self._scopes.insert(String::from(scope.as_ref()));
14384 self
14385 }
14386 /// Identifies the authorization scope(s) for the method you are building.
14387 ///
14388 /// See [`Self::add_scope()`] for details.
14389 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteGetCall<'a, C>
14390 where
14391 I: IntoIterator<Item = St>,
14392 St: AsRef<str>,
14393 {
14394 self._scopes
14395 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14396 self
14397 }
14398
14399 /// Removes all scopes, and no default scope will be used either.
14400 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14401 /// for details).
14402 pub fn clear_scopes(mut self) -> ProjectSiteGetCall<'a, C> {
14403 self._scopes.clear();
14404 self
14405 }
14406}
14407
14408/// Gets the Hosting metadata for a specific site.
14409///
14410/// A builder for the *sites.getConfig* method supported by a *project* resource.
14411/// It is not used directly, but through a [`ProjectMethods`] instance.
14412///
14413/// # Example
14414///
14415/// Instantiate a resource method builder
14416///
14417/// ```test_harness,no_run
14418/// # extern crate hyper;
14419/// # extern crate hyper_rustls;
14420/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
14421/// # async fn dox() {
14422/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14423///
14424/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14425/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14426/// # .with_native_roots()
14427/// # .unwrap()
14428/// # .https_only()
14429/// # .enable_http2()
14430/// # .build();
14431///
14432/// # let executor = hyper_util::rt::TokioExecutor::new();
14433/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14434/// # secret,
14435/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14436/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14437/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14438/// # ),
14439/// # ).build().await.unwrap();
14440///
14441/// # let client = hyper_util::client::legacy::Client::builder(
14442/// # hyper_util::rt::TokioExecutor::new()
14443/// # )
14444/// # .build(
14445/// # hyper_rustls::HttpsConnectorBuilder::new()
14446/// # .with_native_roots()
14447/// # .unwrap()
14448/// # .https_or_http()
14449/// # .enable_http2()
14450/// # .build()
14451/// # );
14452/// # let mut hub = FirebaseHosting::new(client, auth);
14453/// // You can configure optional parameters by calling the respective setters at will, and
14454/// // execute the final call using `doit()`.
14455/// // Values shown here are possibly random and not representative !
14456/// let result = hub.projects().sites_get_config("name")
14457/// .doit().await;
14458/// # }
14459/// ```
14460pub struct ProjectSiteGetConfigCall<'a, C>
14461where
14462 C: 'a,
14463{
14464 hub: &'a FirebaseHosting<C>,
14465 _name: String,
14466 _delegate: Option<&'a mut dyn common::Delegate>,
14467 _additional_params: HashMap<String, String>,
14468 _scopes: BTreeSet<String>,
14469}
14470
14471impl<'a, C> common::CallBuilder for ProjectSiteGetConfigCall<'a, C> {}
14472
14473impl<'a, C> ProjectSiteGetConfigCall<'a, C>
14474where
14475 C: common::Connector,
14476{
14477 /// Perform the operation you have build so far.
14478 pub async fn doit(mut self) -> common::Result<(common::Response, SiteConfig)> {
14479 use std::borrow::Cow;
14480 use std::io::{Read, Seek};
14481
14482 use common::{url::Params, ToParts};
14483 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14484
14485 let mut dd = common::DefaultDelegate;
14486 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14487 dlg.begin(common::MethodInfo {
14488 id: "firebasehosting.projects.sites.getConfig",
14489 http_method: hyper::Method::GET,
14490 });
14491
14492 for &field in ["alt", "name"].iter() {
14493 if self._additional_params.contains_key(field) {
14494 dlg.finished(false);
14495 return Err(common::Error::FieldClash(field));
14496 }
14497 }
14498
14499 let mut params = Params::with_capacity(3 + self._additional_params.len());
14500 params.push("name", self._name);
14501
14502 params.extend(self._additional_params.iter());
14503
14504 params.push("alt", "json");
14505 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
14506 if self._scopes.is_empty() {
14507 self._scopes
14508 .insert(Scope::FirebaseReadonly.as_ref().to_string());
14509 }
14510
14511 #[allow(clippy::single_element_loop)]
14512 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14513 url = params.uri_replacement(url, param_name, find_this, true);
14514 }
14515 {
14516 let to_remove = ["name"];
14517 params.remove_params(&to_remove);
14518 }
14519
14520 let url = params.parse_with_url(&url);
14521
14522 loop {
14523 let token = match self
14524 .hub
14525 .auth
14526 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14527 .await
14528 {
14529 Ok(token) => token,
14530 Err(e) => match dlg.token(e) {
14531 Ok(token) => token,
14532 Err(e) => {
14533 dlg.finished(false);
14534 return Err(common::Error::MissingToken(e));
14535 }
14536 },
14537 };
14538 let mut req_result = {
14539 let client = &self.hub.client;
14540 dlg.pre_request();
14541 let mut req_builder = hyper::Request::builder()
14542 .method(hyper::Method::GET)
14543 .uri(url.as_str())
14544 .header(USER_AGENT, self.hub._user_agent.clone());
14545
14546 if let Some(token) = token.as_ref() {
14547 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14548 }
14549
14550 let request = req_builder
14551 .header(CONTENT_LENGTH, 0_u64)
14552 .body(common::to_body::<String>(None));
14553
14554 client.request(request.unwrap()).await
14555 };
14556
14557 match req_result {
14558 Err(err) => {
14559 if let common::Retry::After(d) = dlg.http_error(&err) {
14560 sleep(d).await;
14561 continue;
14562 }
14563 dlg.finished(false);
14564 return Err(common::Error::HttpError(err));
14565 }
14566 Ok(res) => {
14567 let (mut parts, body) = res.into_parts();
14568 let mut body = common::Body::new(body);
14569 if !parts.status.is_success() {
14570 let bytes = common::to_bytes(body).await.unwrap_or_default();
14571 let error = serde_json::from_str(&common::to_string(&bytes));
14572 let response = common::to_response(parts, bytes.into());
14573
14574 if let common::Retry::After(d) =
14575 dlg.http_failure(&response, error.as_ref().ok())
14576 {
14577 sleep(d).await;
14578 continue;
14579 }
14580
14581 dlg.finished(false);
14582
14583 return Err(match error {
14584 Ok(value) => common::Error::BadRequest(value),
14585 _ => common::Error::Failure(response),
14586 });
14587 }
14588 let response = {
14589 let bytes = common::to_bytes(body).await.unwrap_or_default();
14590 let encoded = common::to_string(&bytes);
14591 match serde_json::from_str(&encoded) {
14592 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14593 Err(error) => {
14594 dlg.response_json_decode_error(&encoded, &error);
14595 return Err(common::Error::JsonDecodeError(
14596 encoded.to_string(),
14597 error,
14598 ));
14599 }
14600 }
14601 };
14602
14603 dlg.finished(true);
14604 return Ok(response);
14605 }
14606 }
14607 }
14608 }
14609
14610 /// Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
14611 ///
14612 /// Sets the *name* path property to the given value.
14613 ///
14614 /// Even though the property as already been set when instantiating this call,
14615 /// we provide this method for API completeness.
14616 pub fn name(mut self, new_value: &str) -> ProjectSiteGetConfigCall<'a, C> {
14617 self._name = new_value.to_string();
14618 self
14619 }
14620 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14621 /// while executing the actual API request.
14622 ///
14623 /// ````text
14624 /// It should be used to handle progress information, and to implement a certain level of resilience.
14625 /// ````
14626 ///
14627 /// Sets the *delegate* property to the given value.
14628 pub fn delegate(
14629 mut self,
14630 new_value: &'a mut dyn common::Delegate,
14631 ) -> ProjectSiteGetConfigCall<'a, C> {
14632 self._delegate = Some(new_value);
14633 self
14634 }
14635
14636 /// Set any additional parameter of the query string used in the request.
14637 /// It should be used to set parameters which are not yet available through their own
14638 /// setters.
14639 ///
14640 /// Please note that this method must not be used to set any of the known parameters
14641 /// which have their own setter method. If done anyway, the request will fail.
14642 ///
14643 /// # Additional Parameters
14644 ///
14645 /// * *$.xgafv* (query-string) - V1 error format.
14646 /// * *access_token* (query-string) - OAuth access token.
14647 /// * *alt* (query-string) - Data format for response.
14648 /// * *callback* (query-string) - JSONP
14649 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14650 /// * *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.
14651 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14652 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14653 /// * *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.
14654 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14655 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14656 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteGetConfigCall<'a, C>
14657 where
14658 T: AsRef<str>,
14659 {
14660 self._additional_params
14661 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14662 self
14663 }
14664
14665 /// Identifies the authorization scope for the method you are building.
14666 ///
14667 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14668 /// [`Scope::FirebaseReadonly`].
14669 ///
14670 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14671 /// tokens for more than one scope.
14672 ///
14673 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14674 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14675 /// sufficient, a read-write scope will do as well.
14676 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteGetConfigCall<'a, C>
14677 where
14678 St: AsRef<str>,
14679 {
14680 self._scopes.insert(String::from(scope.as_ref()));
14681 self
14682 }
14683 /// Identifies the authorization scope(s) for the method you are building.
14684 ///
14685 /// See [`Self::add_scope()`] for details.
14686 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteGetConfigCall<'a, C>
14687 where
14688 I: IntoIterator<Item = St>,
14689 St: AsRef<str>,
14690 {
14691 self._scopes
14692 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14693 self
14694 }
14695
14696 /// Removes all scopes, and no default scope will be used either.
14697 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14698 /// for details).
14699 pub fn clear_scopes(mut self) -> ProjectSiteGetConfigCall<'a, C> {
14700 self._scopes.clear();
14701 self
14702 }
14703}
14704
14705/// Lists each Hosting Site associated with the specified parent Firebase project.
14706///
14707/// A builder for the *sites.list* method supported by a *project* resource.
14708/// It is not used directly, but through a [`ProjectMethods`] instance.
14709///
14710/// # Example
14711///
14712/// Instantiate a resource method builder
14713///
14714/// ```test_harness,no_run
14715/// # extern crate hyper;
14716/// # extern crate hyper_rustls;
14717/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
14718/// # async fn dox() {
14719/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14720///
14721/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14722/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14723/// # .with_native_roots()
14724/// # .unwrap()
14725/// # .https_only()
14726/// # .enable_http2()
14727/// # .build();
14728///
14729/// # let executor = hyper_util::rt::TokioExecutor::new();
14730/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14731/// # secret,
14732/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14733/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14734/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14735/// # ),
14736/// # ).build().await.unwrap();
14737///
14738/// # let client = hyper_util::client::legacy::Client::builder(
14739/// # hyper_util::rt::TokioExecutor::new()
14740/// # )
14741/// # .build(
14742/// # hyper_rustls::HttpsConnectorBuilder::new()
14743/// # .with_native_roots()
14744/// # .unwrap()
14745/// # .https_or_http()
14746/// # .enable_http2()
14747/// # .build()
14748/// # );
14749/// # let mut hub = FirebaseHosting::new(client, auth);
14750/// // You can configure optional parameters by calling the respective setters at will, and
14751/// // execute the final call using `doit()`.
14752/// // Values shown here are possibly random and not representative !
14753/// let result = hub.projects().sites_list("parent")
14754/// .page_token("ea")
14755/// .page_size(-95)
14756/// .doit().await;
14757/// # }
14758/// ```
14759pub struct ProjectSiteListCall<'a, C>
14760where
14761 C: 'a,
14762{
14763 hub: &'a FirebaseHosting<C>,
14764 _parent: String,
14765 _page_token: Option<String>,
14766 _page_size: Option<i32>,
14767 _delegate: Option<&'a mut dyn common::Delegate>,
14768 _additional_params: HashMap<String, String>,
14769 _scopes: BTreeSet<String>,
14770}
14771
14772impl<'a, C> common::CallBuilder for ProjectSiteListCall<'a, C> {}
14773
14774impl<'a, C> ProjectSiteListCall<'a, C>
14775where
14776 C: common::Connector,
14777{
14778 /// Perform the operation you have build so far.
14779 pub async fn doit(mut self) -> common::Result<(common::Response, ListSitesResponse)> {
14780 use std::borrow::Cow;
14781 use std::io::{Read, Seek};
14782
14783 use common::{url::Params, ToParts};
14784 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14785
14786 let mut dd = common::DefaultDelegate;
14787 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14788 dlg.begin(common::MethodInfo {
14789 id: "firebasehosting.projects.sites.list",
14790 http_method: hyper::Method::GET,
14791 });
14792
14793 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
14794 if self._additional_params.contains_key(field) {
14795 dlg.finished(false);
14796 return Err(common::Error::FieldClash(field));
14797 }
14798 }
14799
14800 let mut params = Params::with_capacity(5 + self._additional_params.len());
14801 params.push("parent", self._parent);
14802 if let Some(value) = self._page_token.as_ref() {
14803 params.push("pageToken", value);
14804 }
14805 if let Some(value) = self._page_size.as_ref() {
14806 params.push("pageSize", value.to_string());
14807 }
14808
14809 params.extend(self._additional_params.iter());
14810
14811 params.push("alt", "json");
14812 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/sites";
14813 if self._scopes.is_empty() {
14814 self._scopes
14815 .insert(Scope::FirebaseReadonly.as_ref().to_string());
14816 }
14817
14818 #[allow(clippy::single_element_loop)]
14819 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14820 url = params.uri_replacement(url, param_name, find_this, true);
14821 }
14822 {
14823 let to_remove = ["parent"];
14824 params.remove_params(&to_remove);
14825 }
14826
14827 let url = params.parse_with_url(&url);
14828
14829 loop {
14830 let token = match self
14831 .hub
14832 .auth
14833 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14834 .await
14835 {
14836 Ok(token) => token,
14837 Err(e) => match dlg.token(e) {
14838 Ok(token) => token,
14839 Err(e) => {
14840 dlg.finished(false);
14841 return Err(common::Error::MissingToken(e));
14842 }
14843 },
14844 };
14845 let mut req_result = {
14846 let client = &self.hub.client;
14847 dlg.pre_request();
14848 let mut req_builder = hyper::Request::builder()
14849 .method(hyper::Method::GET)
14850 .uri(url.as_str())
14851 .header(USER_AGENT, self.hub._user_agent.clone());
14852
14853 if let Some(token) = token.as_ref() {
14854 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14855 }
14856
14857 let request = req_builder
14858 .header(CONTENT_LENGTH, 0_u64)
14859 .body(common::to_body::<String>(None));
14860
14861 client.request(request.unwrap()).await
14862 };
14863
14864 match req_result {
14865 Err(err) => {
14866 if let common::Retry::After(d) = dlg.http_error(&err) {
14867 sleep(d).await;
14868 continue;
14869 }
14870 dlg.finished(false);
14871 return Err(common::Error::HttpError(err));
14872 }
14873 Ok(res) => {
14874 let (mut parts, body) = res.into_parts();
14875 let mut body = common::Body::new(body);
14876 if !parts.status.is_success() {
14877 let bytes = common::to_bytes(body).await.unwrap_or_default();
14878 let error = serde_json::from_str(&common::to_string(&bytes));
14879 let response = common::to_response(parts, bytes.into());
14880
14881 if let common::Retry::After(d) =
14882 dlg.http_failure(&response, error.as_ref().ok())
14883 {
14884 sleep(d).await;
14885 continue;
14886 }
14887
14888 dlg.finished(false);
14889
14890 return Err(match error {
14891 Ok(value) => common::Error::BadRequest(value),
14892 _ => common::Error::Failure(response),
14893 });
14894 }
14895 let response = {
14896 let bytes = common::to_bytes(body).await.unwrap_or_default();
14897 let encoded = common::to_string(&bytes);
14898 match serde_json::from_str(&encoded) {
14899 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14900 Err(error) => {
14901 dlg.response_json_decode_error(&encoded, &error);
14902 return Err(common::Error::JsonDecodeError(
14903 encoded.to_string(),
14904 error,
14905 ));
14906 }
14907 }
14908 };
14909
14910 dlg.finished(true);
14911 return Ok(response);
14912 }
14913 }
14914 }
14915 }
14916
14917 /// 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.
14918 ///
14919 /// Sets the *parent* path property to the given value.
14920 ///
14921 /// Even though the property as already been set when instantiating this call,
14922 /// we provide this method for API completeness.
14923 pub fn parent(mut self, new_value: &str) -> ProjectSiteListCall<'a, C> {
14924 self._parent = new_value.to_string();
14925 self
14926 }
14927 /// Optional. A token from a previous call to `ListSites` that tells the server where to resume listing.
14928 ///
14929 /// Sets the *page token* query property to the given value.
14930 pub fn page_token(mut self, new_value: &str) -> ProjectSiteListCall<'a, C> {
14931 self._page_token = Some(new_value.to_string());
14932 self
14933 }
14934 /// 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.
14935 ///
14936 /// Sets the *page size* query property to the given value.
14937 pub fn page_size(mut self, new_value: i32) -> ProjectSiteListCall<'a, C> {
14938 self._page_size = Some(new_value);
14939 self
14940 }
14941 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14942 /// while executing the actual API request.
14943 ///
14944 /// ````text
14945 /// It should be used to handle progress information, and to implement a certain level of resilience.
14946 /// ````
14947 ///
14948 /// Sets the *delegate* property to the given value.
14949 pub fn delegate(
14950 mut self,
14951 new_value: &'a mut dyn common::Delegate,
14952 ) -> ProjectSiteListCall<'a, C> {
14953 self._delegate = Some(new_value);
14954 self
14955 }
14956
14957 /// Set any additional parameter of the query string used in the request.
14958 /// It should be used to set parameters which are not yet available through their own
14959 /// setters.
14960 ///
14961 /// Please note that this method must not be used to set any of the known parameters
14962 /// which have their own setter method. If done anyway, the request will fail.
14963 ///
14964 /// # Additional Parameters
14965 ///
14966 /// * *$.xgafv* (query-string) - V1 error format.
14967 /// * *access_token* (query-string) - OAuth access token.
14968 /// * *alt* (query-string) - Data format for response.
14969 /// * *callback* (query-string) - JSONP
14970 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14971 /// * *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.
14972 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14973 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14974 /// * *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.
14975 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14976 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14977 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteListCall<'a, C>
14978 where
14979 T: AsRef<str>,
14980 {
14981 self._additional_params
14982 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14983 self
14984 }
14985
14986 /// Identifies the authorization scope for the method you are building.
14987 ///
14988 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14989 /// [`Scope::FirebaseReadonly`].
14990 ///
14991 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14992 /// tokens for more than one scope.
14993 ///
14994 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14995 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14996 /// sufficient, a read-write scope will do as well.
14997 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteListCall<'a, C>
14998 where
14999 St: AsRef<str>,
15000 {
15001 self._scopes.insert(String::from(scope.as_ref()));
15002 self
15003 }
15004 /// Identifies the authorization scope(s) for the method you are building.
15005 ///
15006 /// See [`Self::add_scope()`] for details.
15007 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteListCall<'a, C>
15008 where
15009 I: IntoIterator<Item = St>,
15010 St: AsRef<str>,
15011 {
15012 self._scopes
15013 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15014 self
15015 }
15016
15017 /// Removes all scopes, and no default scope will be used either.
15018 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15019 /// for details).
15020 pub fn clear_scopes(mut self) -> ProjectSiteListCall<'a, C> {
15021 self._scopes.clear();
15022 self
15023 }
15024}
15025
15026/// Updates attributes of the specified Hosting Site.
15027///
15028/// A builder for the *sites.patch* method supported by a *project* resource.
15029/// It is not used directly, but through a [`ProjectMethods`] instance.
15030///
15031/// # Example
15032///
15033/// Instantiate a resource method builder
15034///
15035/// ```test_harness,no_run
15036/// # extern crate hyper;
15037/// # extern crate hyper_rustls;
15038/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
15039/// use firebasehosting1_beta1::api::Site;
15040/// # async fn dox() {
15041/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15042///
15043/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15044/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15045/// # .with_native_roots()
15046/// # .unwrap()
15047/// # .https_only()
15048/// # .enable_http2()
15049/// # .build();
15050///
15051/// # let executor = hyper_util::rt::TokioExecutor::new();
15052/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15053/// # secret,
15054/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15055/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15056/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15057/// # ),
15058/// # ).build().await.unwrap();
15059///
15060/// # let client = hyper_util::client::legacy::Client::builder(
15061/// # hyper_util::rt::TokioExecutor::new()
15062/// # )
15063/// # .build(
15064/// # hyper_rustls::HttpsConnectorBuilder::new()
15065/// # .with_native_roots()
15066/// # .unwrap()
15067/// # .https_or_http()
15068/// # .enable_http2()
15069/// # .build()
15070/// # );
15071/// # let mut hub = FirebaseHosting::new(client, auth);
15072/// // As the method needs a request, you would usually fill it with the desired information
15073/// // into the respective structure. Some of the parts shown here might not be applicable !
15074/// // Values shown here are possibly random and not representative !
15075/// let mut req = Site::default();
15076///
15077/// // You can configure optional parameters by calling the respective setters at will, and
15078/// // execute the final call using `doit()`.
15079/// // Values shown here are possibly random and not representative !
15080/// let result = hub.projects().sites_patch(req, "name")
15081/// .update_mask(FieldMask::new::<&str>(&[]))
15082/// .doit().await;
15083/// # }
15084/// ```
15085pub struct ProjectSitePatchCall<'a, C>
15086where
15087 C: 'a,
15088{
15089 hub: &'a FirebaseHosting<C>,
15090 _request: Site,
15091 _name: String,
15092 _update_mask: Option<common::FieldMask>,
15093 _delegate: Option<&'a mut dyn common::Delegate>,
15094 _additional_params: HashMap<String, String>,
15095 _scopes: BTreeSet<String>,
15096}
15097
15098impl<'a, C> common::CallBuilder for ProjectSitePatchCall<'a, C> {}
15099
15100impl<'a, C> ProjectSitePatchCall<'a, C>
15101where
15102 C: common::Connector,
15103{
15104 /// Perform the operation you have build so far.
15105 pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
15106 use std::borrow::Cow;
15107 use std::io::{Read, Seek};
15108
15109 use common::{url::Params, ToParts};
15110 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15111
15112 let mut dd = common::DefaultDelegate;
15113 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15114 dlg.begin(common::MethodInfo {
15115 id: "firebasehosting.projects.sites.patch",
15116 http_method: hyper::Method::PATCH,
15117 });
15118
15119 for &field in ["alt", "name", "updateMask"].iter() {
15120 if self._additional_params.contains_key(field) {
15121 dlg.finished(false);
15122 return Err(common::Error::FieldClash(field));
15123 }
15124 }
15125
15126 let mut params = Params::with_capacity(5 + self._additional_params.len());
15127 params.push("name", self._name);
15128 if let Some(value) = self._update_mask.as_ref() {
15129 params.push("updateMask", value.to_string());
15130 }
15131
15132 params.extend(self._additional_params.iter());
15133
15134 params.push("alt", "json");
15135 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
15136 if self._scopes.is_empty() {
15137 self._scopes
15138 .insert(Scope::CloudPlatform.as_ref().to_string());
15139 }
15140
15141 #[allow(clippy::single_element_loop)]
15142 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15143 url = params.uri_replacement(url, param_name, find_this, true);
15144 }
15145 {
15146 let to_remove = ["name"];
15147 params.remove_params(&to_remove);
15148 }
15149
15150 let url = params.parse_with_url(&url);
15151
15152 let mut json_mime_type = mime::APPLICATION_JSON;
15153 let mut request_value_reader = {
15154 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15155 common::remove_json_null_values(&mut value);
15156 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15157 serde_json::to_writer(&mut dst, &value).unwrap();
15158 dst
15159 };
15160 let request_size = request_value_reader
15161 .seek(std::io::SeekFrom::End(0))
15162 .unwrap();
15163 request_value_reader
15164 .seek(std::io::SeekFrom::Start(0))
15165 .unwrap();
15166
15167 loop {
15168 let token = match self
15169 .hub
15170 .auth
15171 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15172 .await
15173 {
15174 Ok(token) => token,
15175 Err(e) => match dlg.token(e) {
15176 Ok(token) => token,
15177 Err(e) => {
15178 dlg.finished(false);
15179 return Err(common::Error::MissingToken(e));
15180 }
15181 },
15182 };
15183 request_value_reader
15184 .seek(std::io::SeekFrom::Start(0))
15185 .unwrap();
15186 let mut req_result = {
15187 let client = &self.hub.client;
15188 dlg.pre_request();
15189 let mut req_builder = hyper::Request::builder()
15190 .method(hyper::Method::PATCH)
15191 .uri(url.as_str())
15192 .header(USER_AGENT, self.hub._user_agent.clone());
15193
15194 if let Some(token) = token.as_ref() {
15195 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15196 }
15197
15198 let request = req_builder
15199 .header(CONTENT_TYPE, json_mime_type.to_string())
15200 .header(CONTENT_LENGTH, request_size as u64)
15201 .body(common::to_body(
15202 request_value_reader.get_ref().clone().into(),
15203 ));
15204
15205 client.request(request.unwrap()).await
15206 };
15207
15208 match req_result {
15209 Err(err) => {
15210 if let common::Retry::After(d) = dlg.http_error(&err) {
15211 sleep(d).await;
15212 continue;
15213 }
15214 dlg.finished(false);
15215 return Err(common::Error::HttpError(err));
15216 }
15217 Ok(res) => {
15218 let (mut parts, body) = res.into_parts();
15219 let mut body = common::Body::new(body);
15220 if !parts.status.is_success() {
15221 let bytes = common::to_bytes(body).await.unwrap_or_default();
15222 let error = serde_json::from_str(&common::to_string(&bytes));
15223 let response = common::to_response(parts, bytes.into());
15224
15225 if let common::Retry::After(d) =
15226 dlg.http_failure(&response, error.as_ref().ok())
15227 {
15228 sleep(d).await;
15229 continue;
15230 }
15231
15232 dlg.finished(false);
15233
15234 return Err(match error {
15235 Ok(value) => common::Error::BadRequest(value),
15236 _ => common::Error::Failure(response),
15237 });
15238 }
15239 let response = {
15240 let bytes = common::to_bytes(body).await.unwrap_or_default();
15241 let encoded = common::to_string(&bytes);
15242 match serde_json::from_str(&encoded) {
15243 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15244 Err(error) => {
15245 dlg.response_json_decode_error(&encoded, &error);
15246 return Err(common::Error::JsonDecodeError(
15247 encoded.to_string(),
15248 error,
15249 ));
15250 }
15251 }
15252 };
15253
15254 dlg.finished(true);
15255 return Ok(response);
15256 }
15257 }
15258 }
15259 }
15260
15261 ///
15262 /// Sets the *request* property to the given value.
15263 ///
15264 /// Even though the property as already been set when instantiating this call,
15265 /// we provide this method for API completeness.
15266 pub fn request(mut self, new_value: Site) -> ProjectSitePatchCall<'a, C> {
15267 self._request = new_value;
15268 self
15269 }
15270 /// 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).
15271 ///
15272 /// Sets the *name* path property to the given value.
15273 ///
15274 /// Even though the property as already been set when instantiating this call,
15275 /// we provide this method for API completeness.
15276 pub fn name(mut self, new_value: &str) -> ProjectSitePatchCall<'a, C> {
15277 self._name = new_value.to_string();
15278 self
15279 }
15280 /// A set of field names from your Site that you want to update.
15281 ///
15282 /// Sets the *update mask* query property to the given value.
15283 pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectSitePatchCall<'a, C> {
15284 self._update_mask = Some(new_value);
15285 self
15286 }
15287 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15288 /// while executing the actual API request.
15289 ///
15290 /// ````text
15291 /// It should be used to handle progress information, and to implement a certain level of resilience.
15292 /// ````
15293 ///
15294 /// Sets the *delegate* property to the given value.
15295 pub fn delegate(
15296 mut self,
15297 new_value: &'a mut dyn common::Delegate,
15298 ) -> ProjectSitePatchCall<'a, C> {
15299 self._delegate = Some(new_value);
15300 self
15301 }
15302
15303 /// Set any additional parameter of the query string used in the request.
15304 /// It should be used to set parameters which are not yet available through their own
15305 /// setters.
15306 ///
15307 /// Please note that this method must not be used to set any of the known parameters
15308 /// which have their own setter method. If done anyway, the request will fail.
15309 ///
15310 /// # Additional Parameters
15311 ///
15312 /// * *$.xgafv* (query-string) - V1 error format.
15313 /// * *access_token* (query-string) - OAuth access token.
15314 /// * *alt* (query-string) - Data format for response.
15315 /// * *callback* (query-string) - JSONP
15316 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15317 /// * *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.
15318 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15319 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15320 /// * *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.
15321 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15322 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15323 pub fn param<T>(mut self, name: T, value: T) -> ProjectSitePatchCall<'a, C>
15324 where
15325 T: AsRef<str>,
15326 {
15327 self._additional_params
15328 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15329 self
15330 }
15331
15332 /// Identifies the authorization scope for the method you are building.
15333 ///
15334 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15335 /// [`Scope::CloudPlatform`].
15336 ///
15337 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15338 /// tokens for more than one scope.
15339 ///
15340 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15341 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15342 /// sufficient, a read-write scope will do as well.
15343 pub fn add_scope<St>(mut self, scope: St) -> ProjectSitePatchCall<'a, C>
15344 where
15345 St: AsRef<str>,
15346 {
15347 self._scopes.insert(String::from(scope.as_ref()));
15348 self
15349 }
15350 /// Identifies the authorization scope(s) for the method you are building.
15351 ///
15352 /// See [`Self::add_scope()`] for details.
15353 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSitePatchCall<'a, C>
15354 where
15355 I: IntoIterator<Item = St>,
15356 St: AsRef<str>,
15357 {
15358 self._scopes
15359 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15360 self
15361 }
15362
15363 /// Removes all scopes, and no default scope will be used either.
15364 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15365 /// for details).
15366 pub fn clear_scopes(mut self) -> ProjectSitePatchCall<'a, C> {
15367 self._scopes.clear();
15368 self
15369 }
15370}
15371
15372/// Sets the Hosting metadata for a specific site.
15373///
15374/// A builder for the *sites.updateConfig* method supported by a *project* resource.
15375/// It is not used directly, but through a [`ProjectMethods`] instance.
15376///
15377/// # Example
15378///
15379/// Instantiate a resource method builder
15380///
15381/// ```test_harness,no_run
15382/// # extern crate hyper;
15383/// # extern crate hyper_rustls;
15384/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
15385/// use firebasehosting1_beta1::api::SiteConfig;
15386/// # async fn dox() {
15387/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15388///
15389/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15390/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15391/// # .with_native_roots()
15392/// # .unwrap()
15393/// # .https_only()
15394/// # .enable_http2()
15395/// # .build();
15396///
15397/// # let executor = hyper_util::rt::TokioExecutor::new();
15398/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15399/// # secret,
15400/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15401/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15402/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15403/// # ),
15404/// # ).build().await.unwrap();
15405///
15406/// # let client = hyper_util::client::legacy::Client::builder(
15407/// # hyper_util::rt::TokioExecutor::new()
15408/// # )
15409/// # .build(
15410/// # hyper_rustls::HttpsConnectorBuilder::new()
15411/// # .with_native_roots()
15412/// # .unwrap()
15413/// # .https_or_http()
15414/// # .enable_http2()
15415/// # .build()
15416/// # );
15417/// # let mut hub = FirebaseHosting::new(client, auth);
15418/// // As the method needs a request, you would usually fill it with the desired information
15419/// // into the respective structure. Some of the parts shown here might not be applicable !
15420/// // Values shown here are possibly random and not representative !
15421/// let mut req = SiteConfig::default();
15422///
15423/// // You can configure optional parameters by calling the respective setters at will, and
15424/// // execute the final call using `doit()`.
15425/// // Values shown here are possibly random and not representative !
15426/// let result = hub.projects().sites_update_config(req, "name")
15427/// .update_mask(FieldMask::new::<&str>(&[]))
15428/// .doit().await;
15429/// # }
15430/// ```
15431pub struct ProjectSiteUpdateConfigCall<'a, C>
15432where
15433 C: 'a,
15434{
15435 hub: &'a FirebaseHosting<C>,
15436 _request: SiteConfig,
15437 _name: String,
15438 _update_mask: Option<common::FieldMask>,
15439 _delegate: Option<&'a mut dyn common::Delegate>,
15440 _additional_params: HashMap<String, String>,
15441 _scopes: BTreeSet<String>,
15442}
15443
15444impl<'a, C> common::CallBuilder for ProjectSiteUpdateConfigCall<'a, C> {}
15445
15446impl<'a, C> ProjectSiteUpdateConfigCall<'a, C>
15447where
15448 C: common::Connector,
15449{
15450 /// Perform the operation you have build so far.
15451 pub async fn doit(mut self) -> common::Result<(common::Response, SiteConfig)> {
15452 use std::borrow::Cow;
15453 use std::io::{Read, Seek};
15454
15455 use common::{url::Params, ToParts};
15456 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15457
15458 let mut dd = common::DefaultDelegate;
15459 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15460 dlg.begin(common::MethodInfo {
15461 id: "firebasehosting.projects.sites.updateConfig",
15462 http_method: hyper::Method::PATCH,
15463 });
15464
15465 for &field in ["alt", "name", "updateMask"].iter() {
15466 if self._additional_params.contains_key(field) {
15467 dlg.finished(false);
15468 return Err(common::Error::FieldClash(field));
15469 }
15470 }
15471
15472 let mut params = Params::with_capacity(5 + self._additional_params.len());
15473 params.push("name", self._name);
15474 if let Some(value) = self._update_mask.as_ref() {
15475 params.push("updateMask", value.to_string());
15476 }
15477
15478 params.extend(self._additional_params.iter());
15479
15480 params.push("alt", "json");
15481 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
15482 if self._scopes.is_empty() {
15483 self._scopes
15484 .insert(Scope::CloudPlatform.as_ref().to_string());
15485 }
15486
15487 #[allow(clippy::single_element_loop)]
15488 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15489 url = params.uri_replacement(url, param_name, find_this, true);
15490 }
15491 {
15492 let to_remove = ["name"];
15493 params.remove_params(&to_remove);
15494 }
15495
15496 let url = params.parse_with_url(&url);
15497
15498 let mut json_mime_type = mime::APPLICATION_JSON;
15499 let mut request_value_reader = {
15500 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15501 common::remove_json_null_values(&mut value);
15502 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15503 serde_json::to_writer(&mut dst, &value).unwrap();
15504 dst
15505 };
15506 let request_size = request_value_reader
15507 .seek(std::io::SeekFrom::End(0))
15508 .unwrap();
15509 request_value_reader
15510 .seek(std::io::SeekFrom::Start(0))
15511 .unwrap();
15512
15513 loop {
15514 let token = match self
15515 .hub
15516 .auth
15517 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15518 .await
15519 {
15520 Ok(token) => token,
15521 Err(e) => match dlg.token(e) {
15522 Ok(token) => token,
15523 Err(e) => {
15524 dlg.finished(false);
15525 return Err(common::Error::MissingToken(e));
15526 }
15527 },
15528 };
15529 request_value_reader
15530 .seek(std::io::SeekFrom::Start(0))
15531 .unwrap();
15532 let mut req_result = {
15533 let client = &self.hub.client;
15534 dlg.pre_request();
15535 let mut req_builder = hyper::Request::builder()
15536 .method(hyper::Method::PATCH)
15537 .uri(url.as_str())
15538 .header(USER_AGENT, self.hub._user_agent.clone());
15539
15540 if let Some(token) = token.as_ref() {
15541 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15542 }
15543
15544 let request = req_builder
15545 .header(CONTENT_TYPE, json_mime_type.to_string())
15546 .header(CONTENT_LENGTH, request_size as u64)
15547 .body(common::to_body(
15548 request_value_reader.get_ref().clone().into(),
15549 ));
15550
15551 client.request(request.unwrap()).await
15552 };
15553
15554 match req_result {
15555 Err(err) => {
15556 if let common::Retry::After(d) = dlg.http_error(&err) {
15557 sleep(d).await;
15558 continue;
15559 }
15560 dlg.finished(false);
15561 return Err(common::Error::HttpError(err));
15562 }
15563 Ok(res) => {
15564 let (mut parts, body) = res.into_parts();
15565 let mut body = common::Body::new(body);
15566 if !parts.status.is_success() {
15567 let bytes = common::to_bytes(body).await.unwrap_or_default();
15568 let error = serde_json::from_str(&common::to_string(&bytes));
15569 let response = common::to_response(parts, bytes.into());
15570
15571 if let common::Retry::After(d) =
15572 dlg.http_failure(&response, error.as_ref().ok())
15573 {
15574 sleep(d).await;
15575 continue;
15576 }
15577
15578 dlg.finished(false);
15579
15580 return Err(match error {
15581 Ok(value) => common::Error::BadRequest(value),
15582 _ => common::Error::Failure(response),
15583 });
15584 }
15585 let response = {
15586 let bytes = common::to_bytes(body).await.unwrap_or_default();
15587 let encoded = common::to_string(&bytes);
15588 match serde_json::from_str(&encoded) {
15589 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15590 Err(error) => {
15591 dlg.response_json_decode_error(&encoded, &error);
15592 return Err(common::Error::JsonDecodeError(
15593 encoded.to_string(),
15594 error,
15595 ));
15596 }
15597 }
15598 };
15599
15600 dlg.finished(true);
15601 return Ok(response);
15602 }
15603 }
15604 }
15605 }
15606
15607 ///
15608 /// Sets the *request* property to the given value.
15609 ///
15610 /// Even though the property as already been set when instantiating this call,
15611 /// we provide this method for API completeness.
15612 pub fn request(mut self, new_value: SiteConfig) -> ProjectSiteUpdateConfigCall<'a, C> {
15613 self._request = new_value;
15614 self
15615 }
15616 /// Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
15617 ///
15618 /// Sets the *name* path property to the given value.
15619 ///
15620 /// Even though the property as already been set when instantiating this call,
15621 /// we provide this method for API completeness.
15622 pub fn name(mut self, new_value: &str) -> ProjectSiteUpdateConfigCall<'a, C> {
15623 self._name = new_value.to_string();
15624 self
15625 }
15626 /// 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.
15627 ///
15628 /// Sets the *update mask* query property to the given value.
15629 pub fn update_mask(
15630 mut self,
15631 new_value: common::FieldMask,
15632 ) -> ProjectSiteUpdateConfigCall<'a, C> {
15633 self._update_mask = Some(new_value);
15634 self
15635 }
15636 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15637 /// while executing the actual API request.
15638 ///
15639 /// ````text
15640 /// It should be used to handle progress information, and to implement a certain level of resilience.
15641 /// ````
15642 ///
15643 /// Sets the *delegate* property to the given value.
15644 pub fn delegate(
15645 mut self,
15646 new_value: &'a mut dyn common::Delegate,
15647 ) -> ProjectSiteUpdateConfigCall<'a, C> {
15648 self._delegate = Some(new_value);
15649 self
15650 }
15651
15652 /// Set any additional parameter of the query string used in the request.
15653 /// It should be used to set parameters which are not yet available through their own
15654 /// setters.
15655 ///
15656 /// Please note that this method must not be used to set any of the known parameters
15657 /// which have their own setter method. If done anyway, the request will fail.
15658 ///
15659 /// # Additional Parameters
15660 ///
15661 /// * *$.xgafv* (query-string) - V1 error format.
15662 /// * *access_token* (query-string) - OAuth access token.
15663 /// * *alt* (query-string) - Data format for response.
15664 /// * *callback* (query-string) - JSONP
15665 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15666 /// * *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.
15667 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15668 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15669 /// * *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.
15670 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15671 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15672 pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteUpdateConfigCall<'a, C>
15673 where
15674 T: AsRef<str>,
15675 {
15676 self._additional_params
15677 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15678 self
15679 }
15680
15681 /// Identifies the authorization scope for the method you are building.
15682 ///
15683 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15684 /// [`Scope::CloudPlatform`].
15685 ///
15686 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15687 /// tokens for more than one scope.
15688 ///
15689 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15690 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15691 /// sufficient, a read-write scope will do as well.
15692 pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteUpdateConfigCall<'a, C>
15693 where
15694 St: AsRef<str>,
15695 {
15696 self._scopes.insert(String::from(scope.as_ref()));
15697 self
15698 }
15699 /// Identifies the authorization scope(s) for the method you are building.
15700 ///
15701 /// See [`Self::add_scope()`] for details.
15702 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteUpdateConfigCall<'a, C>
15703 where
15704 I: IntoIterator<Item = St>,
15705 St: AsRef<str>,
15706 {
15707 self._scopes
15708 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15709 self
15710 }
15711
15712 /// Removes all scopes, and no default scope will be used either.
15713 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15714 /// for details).
15715 pub fn clear_scopes(mut self) -> ProjectSiteUpdateConfigCall<'a, C> {
15716 self._scopes.clear();
15717 self
15718 }
15719}
15720
15721/// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
15722///
15723/// A builder for the *channels.releases.create* method supported by a *site* resource.
15724/// It is not used directly, but through a [`SiteMethods`] instance.
15725///
15726/// # Example
15727///
15728/// Instantiate a resource method builder
15729///
15730/// ```test_harness,no_run
15731/// # extern crate hyper;
15732/// # extern crate hyper_rustls;
15733/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
15734/// use firebasehosting1_beta1::api::Release;
15735/// # async fn dox() {
15736/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15737///
15738/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15739/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15740/// # .with_native_roots()
15741/// # .unwrap()
15742/// # .https_only()
15743/// # .enable_http2()
15744/// # .build();
15745///
15746/// # let executor = hyper_util::rt::TokioExecutor::new();
15747/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15748/// # secret,
15749/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15750/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15751/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15752/// # ),
15753/// # ).build().await.unwrap();
15754///
15755/// # let client = hyper_util::client::legacy::Client::builder(
15756/// # hyper_util::rt::TokioExecutor::new()
15757/// # )
15758/// # .build(
15759/// # hyper_rustls::HttpsConnectorBuilder::new()
15760/// # .with_native_roots()
15761/// # .unwrap()
15762/// # .https_or_http()
15763/// # .enable_http2()
15764/// # .build()
15765/// # );
15766/// # let mut hub = FirebaseHosting::new(client, auth);
15767/// // As the method needs a request, you would usually fill it with the desired information
15768/// // into the respective structure. Some of the parts shown here might not be applicable !
15769/// // Values shown here are possibly random and not representative !
15770/// let mut req = Release::default();
15771///
15772/// // You can configure optional parameters by calling the respective setters at will, and
15773/// // execute the final call using `doit()`.
15774/// // Values shown here are possibly random and not representative !
15775/// let result = hub.sites().channels_releases_create(req, "parent")
15776/// .version_name("est")
15777/// .doit().await;
15778/// # }
15779/// ```
15780pub struct SiteChannelReleaseCreateCall<'a, C>
15781where
15782 C: 'a,
15783{
15784 hub: &'a FirebaseHosting<C>,
15785 _request: Release,
15786 _parent: String,
15787 _version_name: Option<String>,
15788 _delegate: Option<&'a mut dyn common::Delegate>,
15789 _additional_params: HashMap<String, String>,
15790 _scopes: BTreeSet<String>,
15791}
15792
15793impl<'a, C> common::CallBuilder for SiteChannelReleaseCreateCall<'a, C> {}
15794
15795impl<'a, C> SiteChannelReleaseCreateCall<'a, C>
15796where
15797 C: common::Connector,
15798{
15799 /// Perform the operation you have build so far.
15800 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
15801 use std::borrow::Cow;
15802 use std::io::{Read, Seek};
15803
15804 use common::{url::Params, ToParts};
15805 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15806
15807 let mut dd = common::DefaultDelegate;
15808 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15809 dlg.begin(common::MethodInfo {
15810 id: "firebasehosting.sites.channels.releases.create",
15811 http_method: hyper::Method::POST,
15812 });
15813
15814 for &field in ["alt", "parent", "versionName"].iter() {
15815 if self._additional_params.contains_key(field) {
15816 dlg.finished(false);
15817 return Err(common::Error::FieldClash(field));
15818 }
15819 }
15820
15821 let mut params = Params::with_capacity(5 + self._additional_params.len());
15822 params.push("parent", self._parent);
15823 if let Some(value) = self._version_name.as_ref() {
15824 params.push("versionName", value);
15825 }
15826
15827 params.extend(self._additional_params.iter());
15828
15829 params.push("alt", "json");
15830 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
15831 if self._scopes.is_empty() {
15832 self._scopes
15833 .insert(Scope::CloudPlatform.as_ref().to_string());
15834 }
15835
15836 #[allow(clippy::single_element_loop)]
15837 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15838 url = params.uri_replacement(url, param_name, find_this, true);
15839 }
15840 {
15841 let to_remove = ["parent"];
15842 params.remove_params(&to_remove);
15843 }
15844
15845 let url = params.parse_with_url(&url);
15846
15847 let mut json_mime_type = mime::APPLICATION_JSON;
15848 let mut request_value_reader = {
15849 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15850 common::remove_json_null_values(&mut value);
15851 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15852 serde_json::to_writer(&mut dst, &value).unwrap();
15853 dst
15854 };
15855 let request_size = request_value_reader
15856 .seek(std::io::SeekFrom::End(0))
15857 .unwrap();
15858 request_value_reader
15859 .seek(std::io::SeekFrom::Start(0))
15860 .unwrap();
15861
15862 loop {
15863 let token = match self
15864 .hub
15865 .auth
15866 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15867 .await
15868 {
15869 Ok(token) => token,
15870 Err(e) => match dlg.token(e) {
15871 Ok(token) => token,
15872 Err(e) => {
15873 dlg.finished(false);
15874 return Err(common::Error::MissingToken(e));
15875 }
15876 },
15877 };
15878 request_value_reader
15879 .seek(std::io::SeekFrom::Start(0))
15880 .unwrap();
15881 let mut req_result = {
15882 let client = &self.hub.client;
15883 dlg.pre_request();
15884 let mut req_builder = hyper::Request::builder()
15885 .method(hyper::Method::POST)
15886 .uri(url.as_str())
15887 .header(USER_AGENT, self.hub._user_agent.clone());
15888
15889 if let Some(token) = token.as_ref() {
15890 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15891 }
15892
15893 let request = req_builder
15894 .header(CONTENT_TYPE, json_mime_type.to_string())
15895 .header(CONTENT_LENGTH, request_size as u64)
15896 .body(common::to_body(
15897 request_value_reader.get_ref().clone().into(),
15898 ));
15899
15900 client.request(request.unwrap()).await
15901 };
15902
15903 match req_result {
15904 Err(err) => {
15905 if let common::Retry::After(d) = dlg.http_error(&err) {
15906 sleep(d).await;
15907 continue;
15908 }
15909 dlg.finished(false);
15910 return Err(common::Error::HttpError(err));
15911 }
15912 Ok(res) => {
15913 let (mut parts, body) = res.into_parts();
15914 let mut body = common::Body::new(body);
15915 if !parts.status.is_success() {
15916 let bytes = common::to_bytes(body).await.unwrap_or_default();
15917 let error = serde_json::from_str(&common::to_string(&bytes));
15918 let response = common::to_response(parts, bytes.into());
15919
15920 if let common::Retry::After(d) =
15921 dlg.http_failure(&response, error.as_ref().ok())
15922 {
15923 sleep(d).await;
15924 continue;
15925 }
15926
15927 dlg.finished(false);
15928
15929 return Err(match error {
15930 Ok(value) => common::Error::BadRequest(value),
15931 _ => common::Error::Failure(response),
15932 });
15933 }
15934 let response = {
15935 let bytes = common::to_bytes(body).await.unwrap_or_default();
15936 let encoded = common::to_string(&bytes);
15937 match serde_json::from_str(&encoded) {
15938 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15939 Err(error) => {
15940 dlg.response_json_decode_error(&encoded, &error);
15941 return Err(common::Error::JsonDecodeError(
15942 encoded.to_string(),
15943 error,
15944 ));
15945 }
15946 }
15947 };
15948
15949 dlg.finished(true);
15950 return Ok(response);
15951 }
15952 }
15953 }
15954 }
15955
15956 ///
15957 /// Sets the *request* property to the given value.
15958 ///
15959 /// Even though the property as already been set when instantiating this call,
15960 /// we provide this method for API completeness.
15961 pub fn request(mut self, new_value: Release) -> SiteChannelReleaseCreateCall<'a, C> {
15962 self._request = new_value;
15963 self
15964 }
15965 /// 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
15966 ///
15967 /// Sets the *parent* path property to the given value.
15968 ///
15969 /// Even though the property as already been set when instantiating this call,
15970 /// we provide this method for API completeness.
15971 pub fn parent(mut self, new_value: &str) -> SiteChannelReleaseCreateCall<'a, C> {
15972 self._parent = new_value.to_string();
15973 self
15974 }
15975 /// 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`.
15976 ///
15977 /// Sets the *version name* query property to the given value.
15978 pub fn version_name(mut self, new_value: &str) -> SiteChannelReleaseCreateCall<'a, C> {
15979 self._version_name = Some(new_value.to_string());
15980 self
15981 }
15982 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15983 /// while executing the actual API request.
15984 ///
15985 /// ````text
15986 /// It should be used to handle progress information, and to implement a certain level of resilience.
15987 /// ````
15988 ///
15989 /// Sets the *delegate* property to the given value.
15990 pub fn delegate(
15991 mut self,
15992 new_value: &'a mut dyn common::Delegate,
15993 ) -> SiteChannelReleaseCreateCall<'a, C> {
15994 self._delegate = Some(new_value);
15995 self
15996 }
15997
15998 /// Set any additional parameter of the query string used in the request.
15999 /// It should be used to set parameters which are not yet available through their own
16000 /// setters.
16001 ///
16002 /// Please note that this method must not be used to set any of the known parameters
16003 /// which have their own setter method. If done anyway, the request will fail.
16004 ///
16005 /// # Additional Parameters
16006 ///
16007 /// * *$.xgafv* (query-string) - V1 error format.
16008 /// * *access_token* (query-string) - OAuth access token.
16009 /// * *alt* (query-string) - Data format for response.
16010 /// * *callback* (query-string) - JSONP
16011 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16012 /// * *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.
16013 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16014 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16015 /// * *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.
16016 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16017 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16018 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelReleaseCreateCall<'a, C>
16019 where
16020 T: AsRef<str>,
16021 {
16022 self._additional_params
16023 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16024 self
16025 }
16026
16027 /// Identifies the authorization scope for the method you are building.
16028 ///
16029 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16030 /// [`Scope::CloudPlatform`].
16031 ///
16032 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16033 /// tokens for more than one scope.
16034 ///
16035 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16036 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16037 /// sufficient, a read-write scope will do as well.
16038 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelReleaseCreateCall<'a, C>
16039 where
16040 St: AsRef<str>,
16041 {
16042 self._scopes.insert(String::from(scope.as_ref()));
16043 self
16044 }
16045 /// Identifies the authorization scope(s) for the method you are building.
16046 ///
16047 /// See [`Self::add_scope()`] for details.
16048 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelReleaseCreateCall<'a, C>
16049 where
16050 I: IntoIterator<Item = St>,
16051 St: AsRef<str>,
16052 {
16053 self._scopes
16054 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16055 self
16056 }
16057
16058 /// Removes all scopes, and no default scope will be used either.
16059 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16060 /// for details).
16061 pub fn clear_scopes(mut self) -> SiteChannelReleaseCreateCall<'a, C> {
16062 self._scopes.clear();
16063 self
16064 }
16065}
16066
16067/// 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.
16068///
16069/// A builder for the *channels.releases.get* method supported by a *site* resource.
16070/// It is not used directly, but through a [`SiteMethods`] instance.
16071///
16072/// # Example
16073///
16074/// Instantiate a resource method builder
16075///
16076/// ```test_harness,no_run
16077/// # extern crate hyper;
16078/// # extern crate hyper_rustls;
16079/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
16080/// # async fn dox() {
16081/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16082///
16083/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16084/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16085/// # .with_native_roots()
16086/// # .unwrap()
16087/// # .https_only()
16088/// # .enable_http2()
16089/// # .build();
16090///
16091/// # let executor = hyper_util::rt::TokioExecutor::new();
16092/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16093/// # secret,
16094/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16095/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16096/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16097/// # ),
16098/// # ).build().await.unwrap();
16099///
16100/// # let client = hyper_util::client::legacy::Client::builder(
16101/// # hyper_util::rt::TokioExecutor::new()
16102/// # )
16103/// # .build(
16104/// # hyper_rustls::HttpsConnectorBuilder::new()
16105/// # .with_native_roots()
16106/// # .unwrap()
16107/// # .https_or_http()
16108/// # .enable_http2()
16109/// # .build()
16110/// # );
16111/// # let mut hub = FirebaseHosting::new(client, auth);
16112/// // You can configure optional parameters by calling the respective setters at will, and
16113/// // execute the final call using `doit()`.
16114/// // Values shown here are possibly random and not representative !
16115/// let result = hub.sites().channels_releases_get("name")
16116/// .doit().await;
16117/// # }
16118/// ```
16119pub struct SiteChannelReleaseGetCall<'a, C>
16120where
16121 C: 'a,
16122{
16123 hub: &'a FirebaseHosting<C>,
16124 _name: String,
16125 _delegate: Option<&'a mut dyn common::Delegate>,
16126 _additional_params: HashMap<String, String>,
16127 _scopes: BTreeSet<String>,
16128}
16129
16130impl<'a, C> common::CallBuilder for SiteChannelReleaseGetCall<'a, C> {}
16131
16132impl<'a, C> SiteChannelReleaseGetCall<'a, C>
16133where
16134 C: common::Connector,
16135{
16136 /// Perform the operation you have build so far.
16137 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
16138 use std::borrow::Cow;
16139 use std::io::{Read, Seek};
16140
16141 use common::{url::Params, ToParts};
16142 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16143
16144 let mut dd = common::DefaultDelegate;
16145 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16146 dlg.begin(common::MethodInfo {
16147 id: "firebasehosting.sites.channels.releases.get",
16148 http_method: hyper::Method::GET,
16149 });
16150
16151 for &field in ["alt", "name"].iter() {
16152 if self._additional_params.contains_key(field) {
16153 dlg.finished(false);
16154 return Err(common::Error::FieldClash(field));
16155 }
16156 }
16157
16158 let mut params = Params::with_capacity(3 + self._additional_params.len());
16159 params.push("name", self._name);
16160
16161 params.extend(self._additional_params.iter());
16162
16163 params.push("alt", "json");
16164 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
16165 if self._scopes.is_empty() {
16166 self._scopes
16167 .insert(Scope::FirebaseReadonly.as_ref().to_string());
16168 }
16169
16170 #[allow(clippy::single_element_loop)]
16171 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16172 url = params.uri_replacement(url, param_name, find_this, true);
16173 }
16174 {
16175 let to_remove = ["name"];
16176 params.remove_params(&to_remove);
16177 }
16178
16179 let url = params.parse_with_url(&url);
16180
16181 loop {
16182 let token = match self
16183 .hub
16184 .auth
16185 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16186 .await
16187 {
16188 Ok(token) => token,
16189 Err(e) => match dlg.token(e) {
16190 Ok(token) => token,
16191 Err(e) => {
16192 dlg.finished(false);
16193 return Err(common::Error::MissingToken(e));
16194 }
16195 },
16196 };
16197 let mut req_result = {
16198 let client = &self.hub.client;
16199 dlg.pre_request();
16200 let mut req_builder = hyper::Request::builder()
16201 .method(hyper::Method::GET)
16202 .uri(url.as_str())
16203 .header(USER_AGENT, self.hub._user_agent.clone());
16204
16205 if let Some(token) = token.as_ref() {
16206 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16207 }
16208
16209 let request = req_builder
16210 .header(CONTENT_LENGTH, 0_u64)
16211 .body(common::to_body::<String>(None));
16212
16213 client.request(request.unwrap()).await
16214 };
16215
16216 match req_result {
16217 Err(err) => {
16218 if let common::Retry::After(d) = dlg.http_error(&err) {
16219 sleep(d).await;
16220 continue;
16221 }
16222 dlg.finished(false);
16223 return Err(common::Error::HttpError(err));
16224 }
16225 Ok(res) => {
16226 let (mut parts, body) = res.into_parts();
16227 let mut body = common::Body::new(body);
16228 if !parts.status.is_success() {
16229 let bytes = common::to_bytes(body).await.unwrap_or_default();
16230 let error = serde_json::from_str(&common::to_string(&bytes));
16231 let response = common::to_response(parts, bytes.into());
16232
16233 if let common::Retry::After(d) =
16234 dlg.http_failure(&response, error.as_ref().ok())
16235 {
16236 sleep(d).await;
16237 continue;
16238 }
16239
16240 dlg.finished(false);
16241
16242 return Err(match error {
16243 Ok(value) => common::Error::BadRequest(value),
16244 _ => common::Error::Failure(response),
16245 });
16246 }
16247 let response = {
16248 let bytes = common::to_bytes(body).await.unwrap_or_default();
16249 let encoded = common::to_string(&bytes);
16250 match serde_json::from_str(&encoded) {
16251 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16252 Err(error) => {
16253 dlg.response_json_decode_error(&encoded, &error);
16254 return Err(common::Error::JsonDecodeError(
16255 encoded.to_string(),
16256 error,
16257 ));
16258 }
16259 }
16260 };
16261
16262 dlg.finished(true);
16263 return Ok(response);
16264 }
16265 }
16266 }
16267 }
16268
16269 /// 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
16270 ///
16271 /// Sets the *name* path property to the given value.
16272 ///
16273 /// Even though the property as already been set when instantiating this call,
16274 /// we provide this method for API completeness.
16275 pub fn name(mut self, new_value: &str) -> SiteChannelReleaseGetCall<'a, C> {
16276 self._name = new_value.to_string();
16277 self
16278 }
16279 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16280 /// while executing the actual API request.
16281 ///
16282 /// ````text
16283 /// It should be used to handle progress information, and to implement a certain level of resilience.
16284 /// ````
16285 ///
16286 /// Sets the *delegate* property to the given value.
16287 pub fn delegate(
16288 mut self,
16289 new_value: &'a mut dyn common::Delegate,
16290 ) -> SiteChannelReleaseGetCall<'a, C> {
16291 self._delegate = Some(new_value);
16292 self
16293 }
16294
16295 /// Set any additional parameter of the query string used in the request.
16296 /// It should be used to set parameters which are not yet available through their own
16297 /// setters.
16298 ///
16299 /// Please note that this method must not be used to set any of the known parameters
16300 /// which have their own setter method. If done anyway, the request will fail.
16301 ///
16302 /// # Additional Parameters
16303 ///
16304 /// * *$.xgafv* (query-string) - V1 error format.
16305 /// * *access_token* (query-string) - OAuth access token.
16306 /// * *alt* (query-string) - Data format for response.
16307 /// * *callback* (query-string) - JSONP
16308 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16309 /// * *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.
16310 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16311 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16312 /// * *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.
16313 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16314 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16315 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelReleaseGetCall<'a, C>
16316 where
16317 T: AsRef<str>,
16318 {
16319 self._additional_params
16320 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16321 self
16322 }
16323
16324 /// Identifies the authorization scope for the method you are building.
16325 ///
16326 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16327 /// [`Scope::FirebaseReadonly`].
16328 ///
16329 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16330 /// tokens for more than one scope.
16331 ///
16332 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16333 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16334 /// sufficient, a read-write scope will do as well.
16335 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelReleaseGetCall<'a, C>
16336 where
16337 St: AsRef<str>,
16338 {
16339 self._scopes.insert(String::from(scope.as_ref()));
16340 self
16341 }
16342 /// Identifies the authorization scope(s) for the method you are building.
16343 ///
16344 /// See [`Self::add_scope()`] for details.
16345 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelReleaseGetCall<'a, C>
16346 where
16347 I: IntoIterator<Item = St>,
16348 St: AsRef<str>,
16349 {
16350 self._scopes
16351 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16352 self
16353 }
16354
16355 /// Removes all scopes, and no default scope will be used either.
16356 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16357 /// for details).
16358 pub fn clear_scopes(mut self) -> SiteChannelReleaseGetCall<'a, C> {
16359 self._scopes.clear();
16360 self
16361 }
16362}
16363
16364/// 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.
16365///
16366/// A builder for the *channels.releases.list* method supported by a *site* resource.
16367/// It is not used directly, but through a [`SiteMethods`] instance.
16368///
16369/// # Example
16370///
16371/// Instantiate a resource method builder
16372///
16373/// ```test_harness,no_run
16374/// # extern crate hyper;
16375/// # extern crate hyper_rustls;
16376/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
16377/// # async fn dox() {
16378/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16379///
16380/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16381/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16382/// # .with_native_roots()
16383/// # .unwrap()
16384/// # .https_only()
16385/// # .enable_http2()
16386/// # .build();
16387///
16388/// # let executor = hyper_util::rt::TokioExecutor::new();
16389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16390/// # secret,
16391/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16392/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16393/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16394/// # ),
16395/// # ).build().await.unwrap();
16396///
16397/// # let client = hyper_util::client::legacy::Client::builder(
16398/// # hyper_util::rt::TokioExecutor::new()
16399/// # )
16400/// # .build(
16401/// # hyper_rustls::HttpsConnectorBuilder::new()
16402/// # .with_native_roots()
16403/// # .unwrap()
16404/// # .https_or_http()
16405/// # .enable_http2()
16406/// # .build()
16407/// # );
16408/// # let mut hub = FirebaseHosting::new(client, auth);
16409/// // You can configure optional parameters by calling the respective setters at will, and
16410/// // execute the final call using `doit()`.
16411/// // Values shown here are possibly random and not representative !
16412/// let result = hub.sites().channels_releases_list("parent")
16413/// .page_token("sit")
16414/// .page_size(-35)
16415/// .doit().await;
16416/// # }
16417/// ```
16418pub struct SiteChannelReleaseListCall<'a, C>
16419where
16420 C: 'a,
16421{
16422 hub: &'a FirebaseHosting<C>,
16423 _parent: String,
16424 _page_token: Option<String>,
16425 _page_size: Option<i32>,
16426 _delegate: Option<&'a mut dyn common::Delegate>,
16427 _additional_params: HashMap<String, String>,
16428 _scopes: BTreeSet<String>,
16429}
16430
16431impl<'a, C> common::CallBuilder for SiteChannelReleaseListCall<'a, C> {}
16432
16433impl<'a, C> SiteChannelReleaseListCall<'a, C>
16434where
16435 C: common::Connector,
16436{
16437 /// Perform the operation you have build so far.
16438 pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
16439 use std::borrow::Cow;
16440 use std::io::{Read, Seek};
16441
16442 use common::{url::Params, ToParts};
16443 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16444
16445 let mut dd = common::DefaultDelegate;
16446 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16447 dlg.begin(common::MethodInfo {
16448 id: "firebasehosting.sites.channels.releases.list",
16449 http_method: hyper::Method::GET,
16450 });
16451
16452 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
16453 if self._additional_params.contains_key(field) {
16454 dlg.finished(false);
16455 return Err(common::Error::FieldClash(field));
16456 }
16457 }
16458
16459 let mut params = Params::with_capacity(5 + self._additional_params.len());
16460 params.push("parent", self._parent);
16461 if let Some(value) = self._page_token.as_ref() {
16462 params.push("pageToken", value);
16463 }
16464 if let Some(value) = self._page_size.as_ref() {
16465 params.push("pageSize", value.to_string());
16466 }
16467
16468 params.extend(self._additional_params.iter());
16469
16470 params.push("alt", "json");
16471 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
16472 if self._scopes.is_empty() {
16473 self._scopes
16474 .insert(Scope::FirebaseReadonly.as_ref().to_string());
16475 }
16476
16477 #[allow(clippy::single_element_loop)]
16478 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16479 url = params.uri_replacement(url, param_name, find_this, true);
16480 }
16481 {
16482 let to_remove = ["parent"];
16483 params.remove_params(&to_remove);
16484 }
16485
16486 let url = params.parse_with_url(&url);
16487
16488 loop {
16489 let token = match self
16490 .hub
16491 .auth
16492 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16493 .await
16494 {
16495 Ok(token) => token,
16496 Err(e) => match dlg.token(e) {
16497 Ok(token) => token,
16498 Err(e) => {
16499 dlg.finished(false);
16500 return Err(common::Error::MissingToken(e));
16501 }
16502 },
16503 };
16504 let mut req_result = {
16505 let client = &self.hub.client;
16506 dlg.pre_request();
16507 let mut req_builder = hyper::Request::builder()
16508 .method(hyper::Method::GET)
16509 .uri(url.as_str())
16510 .header(USER_AGENT, self.hub._user_agent.clone());
16511
16512 if let Some(token) = token.as_ref() {
16513 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16514 }
16515
16516 let request = req_builder
16517 .header(CONTENT_LENGTH, 0_u64)
16518 .body(common::to_body::<String>(None));
16519
16520 client.request(request.unwrap()).await
16521 };
16522
16523 match req_result {
16524 Err(err) => {
16525 if let common::Retry::After(d) = dlg.http_error(&err) {
16526 sleep(d).await;
16527 continue;
16528 }
16529 dlg.finished(false);
16530 return Err(common::Error::HttpError(err));
16531 }
16532 Ok(res) => {
16533 let (mut parts, body) = res.into_parts();
16534 let mut body = common::Body::new(body);
16535 if !parts.status.is_success() {
16536 let bytes = common::to_bytes(body).await.unwrap_or_default();
16537 let error = serde_json::from_str(&common::to_string(&bytes));
16538 let response = common::to_response(parts, bytes.into());
16539
16540 if let common::Retry::After(d) =
16541 dlg.http_failure(&response, error.as_ref().ok())
16542 {
16543 sleep(d).await;
16544 continue;
16545 }
16546
16547 dlg.finished(false);
16548
16549 return Err(match error {
16550 Ok(value) => common::Error::BadRequest(value),
16551 _ => common::Error::Failure(response),
16552 });
16553 }
16554 let response = {
16555 let bytes = common::to_bytes(body).await.unwrap_or_default();
16556 let encoded = common::to_string(&bytes);
16557 match serde_json::from_str(&encoded) {
16558 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16559 Err(error) => {
16560 dlg.response_json_decode_error(&encoded, &error);
16561 return Err(common::Error::JsonDecodeError(
16562 encoded.to_string(),
16563 error,
16564 ));
16565 }
16566 }
16567 };
16568
16569 dlg.finished(true);
16570 return Ok(response);
16571 }
16572 }
16573 }
16574 }
16575
16576 /// 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
16577 ///
16578 /// Sets the *parent* path property to the given value.
16579 ///
16580 /// Even though the property as already been set when instantiating this call,
16581 /// we provide this method for API completeness.
16582 pub fn parent(mut self, new_value: &str) -> SiteChannelReleaseListCall<'a, C> {
16583 self._parent = new_value.to_string();
16584 self
16585 }
16586 /// A token from a previous call to `releases.list` or `channels.releases.list` that tells the server where to resume listing.
16587 ///
16588 /// Sets the *page token* query property to the given value.
16589 pub fn page_token(mut self, new_value: &str) -> SiteChannelReleaseListCall<'a, C> {
16590 self._page_token = Some(new_value.to_string());
16591 self
16592 }
16593 /// 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.
16594 ///
16595 /// Sets the *page size* query property to the given value.
16596 pub fn page_size(mut self, new_value: i32) -> SiteChannelReleaseListCall<'a, C> {
16597 self._page_size = Some(new_value);
16598 self
16599 }
16600 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16601 /// while executing the actual API request.
16602 ///
16603 /// ````text
16604 /// It should be used to handle progress information, and to implement a certain level of resilience.
16605 /// ````
16606 ///
16607 /// Sets the *delegate* property to the given value.
16608 pub fn delegate(
16609 mut self,
16610 new_value: &'a mut dyn common::Delegate,
16611 ) -> SiteChannelReleaseListCall<'a, C> {
16612 self._delegate = Some(new_value);
16613 self
16614 }
16615
16616 /// Set any additional parameter of the query string used in the request.
16617 /// It should be used to set parameters which are not yet available through their own
16618 /// setters.
16619 ///
16620 /// Please note that this method must not be used to set any of the known parameters
16621 /// which have their own setter method. If done anyway, the request will fail.
16622 ///
16623 /// # Additional Parameters
16624 ///
16625 /// * *$.xgafv* (query-string) - V1 error format.
16626 /// * *access_token* (query-string) - OAuth access token.
16627 /// * *alt* (query-string) - Data format for response.
16628 /// * *callback* (query-string) - JSONP
16629 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16630 /// * *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.
16631 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16632 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16633 /// * *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.
16634 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16635 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16636 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelReleaseListCall<'a, C>
16637 where
16638 T: AsRef<str>,
16639 {
16640 self._additional_params
16641 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16642 self
16643 }
16644
16645 /// Identifies the authorization scope for the method you are building.
16646 ///
16647 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16648 /// [`Scope::FirebaseReadonly`].
16649 ///
16650 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16651 /// tokens for more than one scope.
16652 ///
16653 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16654 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16655 /// sufficient, a read-write scope will do as well.
16656 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelReleaseListCall<'a, C>
16657 where
16658 St: AsRef<str>,
16659 {
16660 self._scopes.insert(String::from(scope.as_ref()));
16661 self
16662 }
16663 /// Identifies the authorization scope(s) for the method you are building.
16664 ///
16665 /// See [`Self::add_scope()`] for details.
16666 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelReleaseListCall<'a, C>
16667 where
16668 I: IntoIterator<Item = St>,
16669 St: AsRef<str>,
16670 {
16671 self._scopes
16672 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16673 self
16674 }
16675
16676 /// Removes all scopes, and no default scope will be used either.
16677 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16678 /// for details).
16679 pub fn clear_scopes(mut self) -> SiteChannelReleaseListCall<'a, C> {
16680 self._scopes.clear();
16681 self
16682 }
16683}
16684
16685/// Creates a new channel in the specified site.
16686///
16687/// A builder for the *channels.create* method supported by a *site* resource.
16688/// It is not used directly, but through a [`SiteMethods`] instance.
16689///
16690/// # Example
16691///
16692/// Instantiate a resource method builder
16693///
16694/// ```test_harness,no_run
16695/// # extern crate hyper;
16696/// # extern crate hyper_rustls;
16697/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
16698/// use firebasehosting1_beta1::api::Channel;
16699/// # async fn dox() {
16700/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16701///
16702/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16703/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16704/// # .with_native_roots()
16705/// # .unwrap()
16706/// # .https_only()
16707/// # .enable_http2()
16708/// # .build();
16709///
16710/// # let executor = hyper_util::rt::TokioExecutor::new();
16711/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16712/// # secret,
16713/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16714/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16715/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16716/// # ),
16717/// # ).build().await.unwrap();
16718///
16719/// # let client = hyper_util::client::legacy::Client::builder(
16720/// # hyper_util::rt::TokioExecutor::new()
16721/// # )
16722/// # .build(
16723/// # hyper_rustls::HttpsConnectorBuilder::new()
16724/// # .with_native_roots()
16725/// # .unwrap()
16726/// # .https_or_http()
16727/// # .enable_http2()
16728/// # .build()
16729/// # );
16730/// # let mut hub = FirebaseHosting::new(client, auth);
16731/// // As the method needs a request, you would usually fill it with the desired information
16732/// // into the respective structure. Some of the parts shown here might not be applicable !
16733/// // Values shown here are possibly random and not representative !
16734/// let mut req = Channel::default();
16735///
16736/// // You can configure optional parameters by calling the respective setters at will, and
16737/// // execute the final call using `doit()`.
16738/// // Values shown here are possibly random and not representative !
16739/// let result = hub.sites().channels_create(req, "parent")
16740/// .channel_id("aliquyam")
16741/// .doit().await;
16742/// # }
16743/// ```
16744pub struct SiteChannelCreateCall<'a, C>
16745where
16746 C: 'a,
16747{
16748 hub: &'a FirebaseHosting<C>,
16749 _request: Channel,
16750 _parent: String,
16751 _channel_id: Option<String>,
16752 _delegate: Option<&'a mut dyn common::Delegate>,
16753 _additional_params: HashMap<String, String>,
16754 _scopes: BTreeSet<String>,
16755}
16756
16757impl<'a, C> common::CallBuilder for SiteChannelCreateCall<'a, C> {}
16758
16759impl<'a, C> SiteChannelCreateCall<'a, C>
16760where
16761 C: common::Connector,
16762{
16763 /// Perform the operation you have build so far.
16764 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
16765 use std::borrow::Cow;
16766 use std::io::{Read, Seek};
16767
16768 use common::{url::Params, ToParts};
16769 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16770
16771 let mut dd = common::DefaultDelegate;
16772 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16773 dlg.begin(common::MethodInfo {
16774 id: "firebasehosting.sites.channels.create",
16775 http_method: hyper::Method::POST,
16776 });
16777
16778 for &field in ["alt", "parent", "channelId"].iter() {
16779 if self._additional_params.contains_key(field) {
16780 dlg.finished(false);
16781 return Err(common::Error::FieldClash(field));
16782 }
16783 }
16784
16785 let mut params = Params::with_capacity(5 + self._additional_params.len());
16786 params.push("parent", self._parent);
16787 if let Some(value) = self._channel_id.as_ref() {
16788 params.push("channelId", value);
16789 }
16790
16791 params.extend(self._additional_params.iter());
16792
16793 params.push("alt", "json");
16794 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/channels";
16795 if self._scopes.is_empty() {
16796 self._scopes
16797 .insert(Scope::CloudPlatform.as_ref().to_string());
16798 }
16799
16800 #[allow(clippy::single_element_loop)]
16801 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16802 url = params.uri_replacement(url, param_name, find_this, true);
16803 }
16804 {
16805 let to_remove = ["parent"];
16806 params.remove_params(&to_remove);
16807 }
16808
16809 let url = params.parse_with_url(&url);
16810
16811 let mut json_mime_type = mime::APPLICATION_JSON;
16812 let mut request_value_reader = {
16813 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16814 common::remove_json_null_values(&mut value);
16815 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16816 serde_json::to_writer(&mut dst, &value).unwrap();
16817 dst
16818 };
16819 let request_size = request_value_reader
16820 .seek(std::io::SeekFrom::End(0))
16821 .unwrap();
16822 request_value_reader
16823 .seek(std::io::SeekFrom::Start(0))
16824 .unwrap();
16825
16826 loop {
16827 let token = match self
16828 .hub
16829 .auth
16830 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16831 .await
16832 {
16833 Ok(token) => token,
16834 Err(e) => match dlg.token(e) {
16835 Ok(token) => token,
16836 Err(e) => {
16837 dlg.finished(false);
16838 return Err(common::Error::MissingToken(e));
16839 }
16840 },
16841 };
16842 request_value_reader
16843 .seek(std::io::SeekFrom::Start(0))
16844 .unwrap();
16845 let mut req_result = {
16846 let client = &self.hub.client;
16847 dlg.pre_request();
16848 let mut req_builder = hyper::Request::builder()
16849 .method(hyper::Method::POST)
16850 .uri(url.as_str())
16851 .header(USER_AGENT, self.hub._user_agent.clone());
16852
16853 if let Some(token) = token.as_ref() {
16854 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16855 }
16856
16857 let request = req_builder
16858 .header(CONTENT_TYPE, json_mime_type.to_string())
16859 .header(CONTENT_LENGTH, request_size as u64)
16860 .body(common::to_body(
16861 request_value_reader.get_ref().clone().into(),
16862 ));
16863
16864 client.request(request.unwrap()).await
16865 };
16866
16867 match req_result {
16868 Err(err) => {
16869 if let common::Retry::After(d) = dlg.http_error(&err) {
16870 sleep(d).await;
16871 continue;
16872 }
16873 dlg.finished(false);
16874 return Err(common::Error::HttpError(err));
16875 }
16876 Ok(res) => {
16877 let (mut parts, body) = res.into_parts();
16878 let mut body = common::Body::new(body);
16879 if !parts.status.is_success() {
16880 let bytes = common::to_bytes(body).await.unwrap_or_default();
16881 let error = serde_json::from_str(&common::to_string(&bytes));
16882 let response = common::to_response(parts, bytes.into());
16883
16884 if let common::Retry::After(d) =
16885 dlg.http_failure(&response, error.as_ref().ok())
16886 {
16887 sleep(d).await;
16888 continue;
16889 }
16890
16891 dlg.finished(false);
16892
16893 return Err(match error {
16894 Ok(value) => common::Error::BadRequest(value),
16895 _ => common::Error::Failure(response),
16896 });
16897 }
16898 let response = {
16899 let bytes = common::to_bytes(body).await.unwrap_or_default();
16900 let encoded = common::to_string(&bytes);
16901 match serde_json::from_str(&encoded) {
16902 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16903 Err(error) => {
16904 dlg.response_json_decode_error(&encoded, &error);
16905 return Err(common::Error::JsonDecodeError(
16906 encoded.to_string(),
16907 error,
16908 ));
16909 }
16910 }
16911 };
16912
16913 dlg.finished(true);
16914 return Ok(response);
16915 }
16916 }
16917 }
16918 }
16919
16920 ///
16921 /// Sets the *request* property to the given value.
16922 ///
16923 /// Even though the property as already been set when instantiating this call,
16924 /// we provide this method for API completeness.
16925 pub fn request(mut self, new_value: Channel) -> SiteChannelCreateCall<'a, C> {
16926 self._request = new_value;
16927 self
16928 }
16929 /// Required. The site in which to create this channel, in the format: sites/ SITE_ID
16930 ///
16931 /// Sets the *parent* path property to the given value.
16932 ///
16933 /// Even though the property as already been set when instantiating this call,
16934 /// we provide this method for API completeness.
16935 pub fn parent(mut self, new_value: &str) -> SiteChannelCreateCall<'a, C> {
16936 self._parent = new_value.to_string();
16937 self
16938 }
16939 /// Required. Immutable. A unique ID within the site that identifies the channel.
16940 ///
16941 /// Sets the *channel id* query property to the given value.
16942 pub fn channel_id(mut self, new_value: &str) -> SiteChannelCreateCall<'a, C> {
16943 self._channel_id = Some(new_value.to_string());
16944 self
16945 }
16946 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16947 /// while executing the actual API request.
16948 ///
16949 /// ````text
16950 /// It should be used to handle progress information, and to implement a certain level of resilience.
16951 /// ````
16952 ///
16953 /// Sets the *delegate* property to the given value.
16954 pub fn delegate(
16955 mut self,
16956 new_value: &'a mut dyn common::Delegate,
16957 ) -> SiteChannelCreateCall<'a, C> {
16958 self._delegate = Some(new_value);
16959 self
16960 }
16961
16962 /// Set any additional parameter of the query string used in the request.
16963 /// It should be used to set parameters which are not yet available through their own
16964 /// setters.
16965 ///
16966 /// Please note that this method must not be used to set any of the known parameters
16967 /// which have their own setter method. If done anyway, the request will fail.
16968 ///
16969 /// # Additional Parameters
16970 ///
16971 /// * *$.xgafv* (query-string) - V1 error format.
16972 /// * *access_token* (query-string) - OAuth access token.
16973 /// * *alt* (query-string) - Data format for response.
16974 /// * *callback* (query-string) - JSONP
16975 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16976 /// * *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.
16977 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16978 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16979 /// * *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.
16980 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16981 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16982 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelCreateCall<'a, C>
16983 where
16984 T: AsRef<str>,
16985 {
16986 self._additional_params
16987 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16988 self
16989 }
16990
16991 /// Identifies the authorization scope for the method you are building.
16992 ///
16993 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16994 /// [`Scope::CloudPlatform`].
16995 ///
16996 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16997 /// tokens for more than one scope.
16998 ///
16999 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17000 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17001 /// sufficient, a read-write scope will do as well.
17002 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelCreateCall<'a, C>
17003 where
17004 St: AsRef<str>,
17005 {
17006 self._scopes.insert(String::from(scope.as_ref()));
17007 self
17008 }
17009 /// Identifies the authorization scope(s) for the method you are building.
17010 ///
17011 /// See [`Self::add_scope()`] for details.
17012 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelCreateCall<'a, C>
17013 where
17014 I: IntoIterator<Item = St>,
17015 St: AsRef<str>,
17016 {
17017 self._scopes
17018 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17019 self
17020 }
17021
17022 /// Removes all scopes, and no default scope will be used either.
17023 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17024 /// for details).
17025 pub fn clear_scopes(mut self) -> SiteChannelCreateCall<'a, C> {
17026 self._scopes.clear();
17027 self
17028 }
17029}
17030
17031/// Deletes the specified channel of the specified site. The `live` channel cannot be deleted.
17032///
17033/// A builder for the *channels.delete* method supported by a *site* resource.
17034/// It is not used directly, but through a [`SiteMethods`] instance.
17035///
17036/// # Example
17037///
17038/// Instantiate a resource method builder
17039///
17040/// ```test_harness,no_run
17041/// # extern crate hyper;
17042/// # extern crate hyper_rustls;
17043/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
17044/// # async fn dox() {
17045/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17046///
17047/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17048/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17049/// # .with_native_roots()
17050/// # .unwrap()
17051/// # .https_only()
17052/// # .enable_http2()
17053/// # .build();
17054///
17055/// # let executor = hyper_util::rt::TokioExecutor::new();
17056/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17057/// # secret,
17058/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17059/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17060/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17061/// # ),
17062/// # ).build().await.unwrap();
17063///
17064/// # let client = hyper_util::client::legacy::Client::builder(
17065/// # hyper_util::rt::TokioExecutor::new()
17066/// # )
17067/// # .build(
17068/// # hyper_rustls::HttpsConnectorBuilder::new()
17069/// # .with_native_roots()
17070/// # .unwrap()
17071/// # .https_or_http()
17072/// # .enable_http2()
17073/// # .build()
17074/// # );
17075/// # let mut hub = FirebaseHosting::new(client, auth);
17076/// // You can configure optional parameters by calling the respective setters at will, and
17077/// // execute the final call using `doit()`.
17078/// // Values shown here are possibly random and not representative !
17079/// let result = hub.sites().channels_delete("name")
17080/// .doit().await;
17081/// # }
17082/// ```
17083pub struct SiteChannelDeleteCall<'a, C>
17084where
17085 C: 'a,
17086{
17087 hub: &'a FirebaseHosting<C>,
17088 _name: String,
17089 _delegate: Option<&'a mut dyn common::Delegate>,
17090 _additional_params: HashMap<String, String>,
17091 _scopes: BTreeSet<String>,
17092}
17093
17094impl<'a, C> common::CallBuilder for SiteChannelDeleteCall<'a, C> {}
17095
17096impl<'a, C> SiteChannelDeleteCall<'a, C>
17097where
17098 C: common::Connector,
17099{
17100 /// Perform the operation you have build so far.
17101 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
17102 use std::borrow::Cow;
17103 use std::io::{Read, Seek};
17104
17105 use common::{url::Params, ToParts};
17106 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17107
17108 let mut dd = common::DefaultDelegate;
17109 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17110 dlg.begin(common::MethodInfo {
17111 id: "firebasehosting.sites.channels.delete",
17112 http_method: hyper::Method::DELETE,
17113 });
17114
17115 for &field in ["alt", "name"].iter() {
17116 if self._additional_params.contains_key(field) {
17117 dlg.finished(false);
17118 return Err(common::Error::FieldClash(field));
17119 }
17120 }
17121
17122 let mut params = Params::with_capacity(3 + self._additional_params.len());
17123 params.push("name", self._name);
17124
17125 params.extend(self._additional_params.iter());
17126
17127 params.push("alt", "json");
17128 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
17129 if self._scopes.is_empty() {
17130 self._scopes
17131 .insert(Scope::CloudPlatform.as_ref().to_string());
17132 }
17133
17134 #[allow(clippy::single_element_loop)]
17135 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17136 url = params.uri_replacement(url, param_name, find_this, true);
17137 }
17138 {
17139 let to_remove = ["name"];
17140 params.remove_params(&to_remove);
17141 }
17142
17143 let url = params.parse_with_url(&url);
17144
17145 loop {
17146 let token = match self
17147 .hub
17148 .auth
17149 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17150 .await
17151 {
17152 Ok(token) => token,
17153 Err(e) => match dlg.token(e) {
17154 Ok(token) => token,
17155 Err(e) => {
17156 dlg.finished(false);
17157 return Err(common::Error::MissingToken(e));
17158 }
17159 },
17160 };
17161 let mut req_result = {
17162 let client = &self.hub.client;
17163 dlg.pre_request();
17164 let mut req_builder = hyper::Request::builder()
17165 .method(hyper::Method::DELETE)
17166 .uri(url.as_str())
17167 .header(USER_AGENT, self.hub._user_agent.clone());
17168
17169 if let Some(token) = token.as_ref() {
17170 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17171 }
17172
17173 let request = req_builder
17174 .header(CONTENT_LENGTH, 0_u64)
17175 .body(common::to_body::<String>(None));
17176
17177 client.request(request.unwrap()).await
17178 };
17179
17180 match req_result {
17181 Err(err) => {
17182 if let common::Retry::After(d) = dlg.http_error(&err) {
17183 sleep(d).await;
17184 continue;
17185 }
17186 dlg.finished(false);
17187 return Err(common::Error::HttpError(err));
17188 }
17189 Ok(res) => {
17190 let (mut parts, body) = res.into_parts();
17191 let mut body = common::Body::new(body);
17192 if !parts.status.is_success() {
17193 let bytes = common::to_bytes(body).await.unwrap_or_default();
17194 let error = serde_json::from_str(&common::to_string(&bytes));
17195 let response = common::to_response(parts, bytes.into());
17196
17197 if let common::Retry::After(d) =
17198 dlg.http_failure(&response, error.as_ref().ok())
17199 {
17200 sleep(d).await;
17201 continue;
17202 }
17203
17204 dlg.finished(false);
17205
17206 return Err(match error {
17207 Ok(value) => common::Error::BadRequest(value),
17208 _ => common::Error::Failure(response),
17209 });
17210 }
17211 let response = {
17212 let bytes = common::to_bytes(body).await.unwrap_or_default();
17213 let encoded = common::to_string(&bytes);
17214 match serde_json::from_str(&encoded) {
17215 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17216 Err(error) => {
17217 dlg.response_json_decode_error(&encoded, &error);
17218 return Err(common::Error::JsonDecodeError(
17219 encoded.to_string(),
17220 error,
17221 ));
17222 }
17223 }
17224 };
17225
17226 dlg.finished(true);
17227 return Ok(response);
17228 }
17229 }
17230 }
17231 }
17232
17233 /// Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
17234 ///
17235 /// Sets the *name* path property to the given value.
17236 ///
17237 /// Even though the property as already been set when instantiating this call,
17238 /// we provide this method for API completeness.
17239 pub fn name(mut self, new_value: &str) -> SiteChannelDeleteCall<'a, C> {
17240 self._name = new_value.to_string();
17241 self
17242 }
17243 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17244 /// while executing the actual API request.
17245 ///
17246 /// ````text
17247 /// It should be used to handle progress information, and to implement a certain level of resilience.
17248 /// ````
17249 ///
17250 /// Sets the *delegate* property to the given value.
17251 pub fn delegate(
17252 mut self,
17253 new_value: &'a mut dyn common::Delegate,
17254 ) -> SiteChannelDeleteCall<'a, C> {
17255 self._delegate = Some(new_value);
17256 self
17257 }
17258
17259 /// Set any additional parameter of the query string used in the request.
17260 /// It should be used to set parameters which are not yet available through their own
17261 /// setters.
17262 ///
17263 /// Please note that this method must not be used to set any of the known parameters
17264 /// which have their own setter method. If done anyway, the request will fail.
17265 ///
17266 /// # Additional Parameters
17267 ///
17268 /// * *$.xgafv* (query-string) - V1 error format.
17269 /// * *access_token* (query-string) - OAuth access token.
17270 /// * *alt* (query-string) - Data format for response.
17271 /// * *callback* (query-string) - JSONP
17272 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17273 /// * *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.
17274 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17275 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17276 /// * *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.
17277 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17278 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17279 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelDeleteCall<'a, C>
17280 where
17281 T: AsRef<str>,
17282 {
17283 self._additional_params
17284 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17285 self
17286 }
17287
17288 /// Identifies the authorization scope for the method you are building.
17289 ///
17290 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17291 /// [`Scope::CloudPlatform`].
17292 ///
17293 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17294 /// tokens for more than one scope.
17295 ///
17296 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17297 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17298 /// sufficient, a read-write scope will do as well.
17299 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelDeleteCall<'a, C>
17300 where
17301 St: AsRef<str>,
17302 {
17303 self._scopes.insert(String::from(scope.as_ref()));
17304 self
17305 }
17306 /// Identifies the authorization scope(s) for the method you are building.
17307 ///
17308 /// See [`Self::add_scope()`] for details.
17309 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelDeleteCall<'a, C>
17310 where
17311 I: IntoIterator<Item = St>,
17312 St: AsRef<str>,
17313 {
17314 self._scopes
17315 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17316 self
17317 }
17318
17319 /// Removes all scopes, and no default scope will be used either.
17320 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17321 /// for details).
17322 pub fn clear_scopes(mut self) -> SiteChannelDeleteCall<'a, C> {
17323 self._scopes.clear();
17324 self
17325 }
17326}
17327
17328/// Retrieves information for the specified channel of the specified site.
17329///
17330/// A builder for the *channels.get* method supported by a *site* resource.
17331/// It is not used directly, but through a [`SiteMethods`] instance.
17332///
17333/// # Example
17334///
17335/// Instantiate a resource method builder
17336///
17337/// ```test_harness,no_run
17338/// # extern crate hyper;
17339/// # extern crate hyper_rustls;
17340/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
17341/// # async fn dox() {
17342/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17343///
17344/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17345/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17346/// # .with_native_roots()
17347/// # .unwrap()
17348/// # .https_only()
17349/// # .enable_http2()
17350/// # .build();
17351///
17352/// # let executor = hyper_util::rt::TokioExecutor::new();
17353/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17354/// # secret,
17355/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17356/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17357/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17358/// # ),
17359/// # ).build().await.unwrap();
17360///
17361/// # let client = hyper_util::client::legacy::Client::builder(
17362/// # hyper_util::rt::TokioExecutor::new()
17363/// # )
17364/// # .build(
17365/// # hyper_rustls::HttpsConnectorBuilder::new()
17366/// # .with_native_roots()
17367/// # .unwrap()
17368/// # .https_or_http()
17369/// # .enable_http2()
17370/// # .build()
17371/// # );
17372/// # let mut hub = FirebaseHosting::new(client, auth);
17373/// // You can configure optional parameters by calling the respective setters at will, and
17374/// // execute the final call using `doit()`.
17375/// // Values shown here are possibly random and not representative !
17376/// let result = hub.sites().channels_get("name")
17377/// .doit().await;
17378/// # }
17379/// ```
17380pub struct SiteChannelGetCall<'a, C>
17381where
17382 C: 'a,
17383{
17384 hub: &'a FirebaseHosting<C>,
17385 _name: String,
17386 _delegate: Option<&'a mut dyn common::Delegate>,
17387 _additional_params: HashMap<String, String>,
17388 _scopes: BTreeSet<String>,
17389}
17390
17391impl<'a, C> common::CallBuilder for SiteChannelGetCall<'a, C> {}
17392
17393impl<'a, C> SiteChannelGetCall<'a, C>
17394where
17395 C: common::Connector,
17396{
17397 /// Perform the operation you have build so far.
17398 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
17399 use std::borrow::Cow;
17400 use std::io::{Read, Seek};
17401
17402 use common::{url::Params, ToParts};
17403 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17404
17405 let mut dd = common::DefaultDelegate;
17406 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17407 dlg.begin(common::MethodInfo {
17408 id: "firebasehosting.sites.channels.get",
17409 http_method: hyper::Method::GET,
17410 });
17411
17412 for &field in ["alt", "name"].iter() {
17413 if self._additional_params.contains_key(field) {
17414 dlg.finished(false);
17415 return Err(common::Error::FieldClash(field));
17416 }
17417 }
17418
17419 let mut params = Params::with_capacity(3 + self._additional_params.len());
17420 params.push("name", self._name);
17421
17422 params.extend(self._additional_params.iter());
17423
17424 params.push("alt", "json");
17425 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
17426 if self._scopes.is_empty() {
17427 self._scopes
17428 .insert(Scope::FirebaseReadonly.as_ref().to_string());
17429 }
17430
17431 #[allow(clippy::single_element_loop)]
17432 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17433 url = params.uri_replacement(url, param_name, find_this, true);
17434 }
17435 {
17436 let to_remove = ["name"];
17437 params.remove_params(&to_remove);
17438 }
17439
17440 let url = params.parse_with_url(&url);
17441
17442 loop {
17443 let token = match self
17444 .hub
17445 .auth
17446 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17447 .await
17448 {
17449 Ok(token) => token,
17450 Err(e) => match dlg.token(e) {
17451 Ok(token) => token,
17452 Err(e) => {
17453 dlg.finished(false);
17454 return Err(common::Error::MissingToken(e));
17455 }
17456 },
17457 };
17458 let mut req_result = {
17459 let client = &self.hub.client;
17460 dlg.pre_request();
17461 let mut req_builder = hyper::Request::builder()
17462 .method(hyper::Method::GET)
17463 .uri(url.as_str())
17464 .header(USER_AGENT, self.hub._user_agent.clone());
17465
17466 if let Some(token) = token.as_ref() {
17467 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17468 }
17469
17470 let request = req_builder
17471 .header(CONTENT_LENGTH, 0_u64)
17472 .body(common::to_body::<String>(None));
17473
17474 client.request(request.unwrap()).await
17475 };
17476
17477 match req_result {
17478 Err(err) => {
17479 if let common::Retry::After(d) = dlg.http_error(&err) {
17480 sleep(d).await;
17481 continue;
17482 }
17483 dlg.finished(false);
17484 return Err(common::Error::HttpError(err));
17485 }
17486 Ok(res) => {
17487 let (mut parts, body) = res.into_parts();
17488 let mut body = common::Body::new(body);
17489 if !parts.status.is_success() {
17490 let bytes = common::to_bytes(body).await.unwrap_or_default();
17491 let error = serde_json::from_str(&common::to_string(&bytes));
17492 let response = common::to_response(parts, bytes.into());
17493
17494 if let common::Retry::After(d) =
17495 dlg.http_failure(&response, error.as_ref().ok())
17496 {
17497 sleep(d).await;
17498 continue;
17499 }
17500
17501 dlg.finished(false);
17502
17503 return Err(match error {
17504 Ok(value) => common::Error::BadRequest(value),
17505 _ => common::Error::Failure(response),
17506 });
17507 }
17508 let response = {
17509 let bytes = common::to_bytes(body).await.unwrap_or_default();
17510 let encoded = common::to_string(&bytes);
17511 match serde_json::from_str(&encoded) {
17512 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17513 Err(error) => {
17514 dlg.response_json_decode_error(&encoded, &error);
17515 return Err(common::Error::JsonDecodeError(
17516 encoded.to_string(),
17517 error,
17518 ));
17519 }
17520 }
17521 };
17522
17523 dlg.finished(true);
17524 return Ok(response);
17525 }
17526 }
17527 }
17528 }
17529
17530 /// Required. The fully-qualified resource name for the channel, in the format: sites/SITE_ID/channels/CHANNEL_ID
17531 ///
17532 /// Sets the *name* path property to the given value.
17533 ///
17534 /// Even though the property as already been set when instantiating this call,
17535 /// we provide this method for API completeness.
17536 pub fn name(mut self, new_value: &str) -> SiteChannelGetCall<'a, C> {
17537 self._name = new_value.to_string();
17538 self
17539 }
17540 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17541 /// while executing the actual API request.
17542 ///
17543 /// ````text
17544 /// It should be used to handle progress information, and to implement a certain level of resilience.
17545 /// ````
17546 ///
17547 /// Sets the *delegate* property to the given value.
17548 pub fn delegate(
17549 mut self,
17550 new_value: &'a mut dyn common::Delegate,
17551 ) -> SiteChannelGetCall<'a, C> {
17552 self._delegate = Some(new_value);
17553 self
17554 }
17555
17556 /// Set any additional parameter of the query string used in the request.
17557 /// It should be used to set parameters which are not yet available through their own
17558 /// setters.
17559 ///
17560 /// Please note that this method must not be used to set any of the known parameters
17561 /// which have their own setter method. If done anyway, the request will fail.
17562 ///
17563 /// # Additional Parameters
17564 ///
17565 /// * *$.xgafv* (query-string) - V1 error format.
17566 /// * *access_token* (query-string) - OAuth access token.
17567 /// * *alt* (query-string) - Data format for response.
17568 /// * *callback* (query-string) - JSONP
17569 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17570 /// * *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.
17571 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17572 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17573 /// * *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.
17574 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17575 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17576 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelGetCall<'a, C>
17577 where
17578 T: AsRef<str>,
17579 {
17580 self._additional_params
17581 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17582 self
17583 }
17584
17585 /// Identifies the authorization scope for the method you are building.
17586 ///
17587 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17588 /// [`Scope::FirebaseReadonly`].
17589 ///
17590 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17591 /// tokens for more than one scope.
17592 ///
17593 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17594 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17595 /// sufficient, a read-write scope will do as well.
17596 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelGetCall<'a, C>
17597 where
17598 St: AsRef<str>,
17599 {
17600 self._scopes.insert(String::from(scope.as_ref()));
17601 self
17602 }
17603 /// Identifies the authorization scope(s) for the method you are building.
17604 ///
17605 /// See [`Self::add_scope()`] for details.
17606 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelGetCall<'a, C>
17607 where
17608 I: IntoIterator<Item = St>,
17609 St: AsRef<str>,
17610 {
17611 self._scopes
17612 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17613 self
17614 }
17615
17616 /// Removes all scopes, and no default scope will be used either.
17617 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17618 /// for details).
17619 pub fn clear_scopes(mut self) -> SiteChannelGetCall<'a, C> {
17620 self._scopes.clear();
17621 self
17622 }
17623}
17624
17625/// Lists the channels for the specified site. All sites have a default `live` channel.
17626///
17627/// A builder for the *channels.list* method supported by a *site* resource.
17628/// It is not used directly, but through a [`SiteMethods`] instance.
17629///
17630/// # Example
17631///
17632/// Instantiate a resource method builder
17633///
17634/// ```test_harness,no_run
17635/// # extern crate hyper;
17636/// # extern crate hyper_rustls;
17637/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
17638/// # async fn dox() {
17639/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17640///
17641/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17642/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17643/// # .with_native_roots()
17644/// # .unwrap()
17645/// # .https_only()
17646/// # .enable_http2()
17647/// # .build();
17648///
17649/// # let executor = hyper_util::rt::TokioExecutor::new();
17650/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17651/// # secret,
17652/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17653/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17654/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17655/// # ),
17656/// # ).build().await.unwrap();
17657///
17658/// # let client = hyper_util::client::legacy::Client::builder(
17659/// # hyper_util::rt::TokioExecutor::new()
17660/// # )
17661/// # .build(
17662/// # hyper_rustls::HttpsConnectorBuilder::new()
17663/// # .with_native_roots()
17664/// # .unwrap()
17665/// # .https_or_http()
17666/// # .enable_http2()
17667/// # .build()
17668/// # );
17669/// # let mut hub = FirebaseHosting::new(client, auth);
17670/// // You can configure optional parameters by calling the respective setters at will, and
17671/// // execute the final call using `doit()`.
17672/// // Values shown here are possibly random and not representative !
17673/// let result = hub.sites().channels_list("parent")
17674/// .page_token("Lorem")
17675/// .page_size(-7)
17676/// .doit().await;
17677/// # }
17678/// ```
17679pub struct SiteChannelListCall<'a, C>
17680where
17681 C: 'a,
17682{
17683 hub: &'a FirebaseHosting<C>,
17684 _parent: String,
17685 _page_token: Option<String>,
17686 _page_size: Option<i32>,
17687 _delegate: Option<&'a mut dyn common::Delegate>,
17688 _additional_params: HashMap<String, String>,
17689 _scopes: BTreeSet<String>,
17690}
17691
17692impl<'a, C> common::CallBuilder for SiteChannelListCall<'a, C> {}
17693
17694impl<'a, C> SiteChannelListCall<'a, C>
17695where
17696 C: common::Connector,
17697{
17698 /// Perform the operation you have build so far.
17699 pub async fn doit(mut self) -> common::Result<(common::Response, ListChannelsResponse)> {
17700 use std::borrow::Cow;
17701 use std::io::{Read, Seek};
17702
17703 use common::{url::Params, ToParts};
17704 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17705
17706 let mut dd = common::DefaultDelegate;
17707 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17708 dlg.begin(common::MethodInfo {
17709 id: "firebasehosting.sites.channels.list",
17710 http_method: hyper::Method::GET,
17711 });
17712
17713 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
17714 if self._additional_params.contains_key(field) {
17715 dlg.finished(false);
17716 return Err(common::Error::FieldClash(field));
17717 }
17718 }
17719
17720 let mut params = Params::with_capacity(5 + self._additional_params.len());
17721 params.push("parent", self._parent);
17722 if let Some(value) = self._page_token.as_ref() {
17723 params.push("pageToken", value);
17724 }
17725 if let Some(value) = self._page_size.as_ref() {
17726 params.push("pageSize", value.to_string());
17727 }
17728
17729 params.extend(self._additional_params.iter());
17730
17731 params.push("alt", "json");
17732 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/channels";
17733 if self._scopes.is_empty() {
17734 self._scopes
17735 .insert(Scope::FirebaseReadonly.as_ref().to_string());
17736 }
17737
17738 #[allow(clippy::single_element_loop)]
17739 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17740 url = params.uri_replacement(url, param_name, find_this, true);
17741 }
17742 {
17743 let to_remove = ["parent"];
17744 params.remove_params(&to_remove);
17745 }
17746
17747 let url = params.parse_with_url(&url);
17748
17749 loop {
17750 let token = match self
17751 .hub
17752 .auth
17753 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17754 .await
17755 {
17756 Ok(token) => token,
17757 Err(e) => match dlg.token(e) {
17758 Ok(token) => token,
17759 Err(e) => {
17760 dlg.finished(false);
17761 return Err(common::Error::MissingToken(e));
17762 }
17763 },
17764 };
17765 let mut req_result = {
17766 let client = &self.hub.client;
17767 dlg.pre_request();
17768 let mut req_builder = hyper::Request::builder()
17769 .method(hyper::Method::GET)
17770 .uri(url.as_str())
17771 .header(USER_AGENT, self.hub._user_agent.clone());
17772
17773 if let Some(token) = token.as_ref() {
17774 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17775 }
17776
17777 let request = req_builder
17778 .header(CONTENT_LENGTH, 0_u64)
17779 .body(common::to_body::<String>(None));
17780
17781 client.request(request.unwrap()).await
17782 };
17783
17784 match req_result {
17785 Err(err) => {
17786 if let common::Retry::After(d) = dlg.http_error(&err) {
17787 sleep(d).await;
17788 continue;
17789 }
17790 dlg.finished(false);
17791 return Err(common::Error::HttpError(err));
17792 }
17793 Ok(res) => {
17794 let (mut parts, body) = res.into_parts();
17795 let mut body = common::Body::new(body);
17796 if !parts.status.is_success() {
17797 let bytes = common::to_bytes(body).await.unwrap_or_default();
17798 let error = serde_json::from_str(&common::to_string(&bytes));
17799 let response = common::to_response(parts, bytes.into());
17800
17801 if let common::Retry::After(d) =
17802 dlg.http_failure(&response, error.as_ref().ok())
17803 {
17804 sleep(d).await;
17805 continue;
17806 }
17807
17808 dlg.finished(false);
17809
17810 return Err(match error {
17811 Ok(value) => common::Error::BadRequest(value),
17812 _ => common::Error::Failure(response),
17813 });
17814 }
17815 let response = {
17816 let bytes = common::to_bytes(body).await.unwrap_or_default();
17817 let encoded = common::to_string(&bytes);
17818 match serde_json::from_str(&encoded) {
17819 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17820 Err(error) => {
17821 dlg.response_json_decode_error(&encoded, &error);
17822 return Err(common::Error::JsonDecodeError(
17823 encoded.to_string(),
17824 error,
17825 ));
17826 }
17827 }
17828 };
17829
17830 dlg.finished(true);
17831 return Ok(response);
17832 }
17833 }
17834 }
17835 }
17836
17837 /// Required. The site for which to list channels, in the format: sites/SITE_ID
17838 ///
17839 /// Sets the *parent* path property to the given value.
17840 ///
17841 /// Even though the property as already been set when instantiating this call,
17842 /// we provide this method for API completeness.
17843 pub fn parent(mut self, new_value: &str) -> SiteChannelListCall<'a, C> {
17844 self._parent = new_value.to_string();
17845 self
17846 }
17847 /// A token from a previous call to `ListChannels` that tells the server where to resume listing.
17848 ///
17849 /// Sets the *page token* query property to the given value.
17850 pub fn page_token(mut self, new_value: &str) -> SiteChannelListCall<'a, C> {
17851 self._page_token = Some(new_value.to_string());
17852 self
17853 }
17854 /// 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.
17855 ///
17856 /// Sets the *page size* query property to the given value.
17857 pub fn page_size(mut self, new_value: i32) -> SiteChannelListCall<'a, C> {
17858 self._page_size = Some(new_value);
17859 self
17860 }
17861 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17862 /// while executing the actual API request.
17863 ///
17864 /// ````text
17865 /// It should be used to handle progress information, and to implement a certain level of resilience.
17866 /// ````
17867 ///
17868 /// Sets the *delegate* property to the given value.
17869 pub fn delegate(
17870 mut self,
17871 new_value: &'a mut dyn common::Delegate,
17872 ) -> SiteChannelListCall<'a, C> {
17873 self._delegate = Some(new_value);
17874 self
17875 }
17876
17877 /// Set any additional parameter of the query string used in the request.
17878 /// It should be used to set parameters which are not yet available through their own
17879 /// setters.
17880 ///
17881 /// Please note that this method must not be used to set any of the known parameters
17882 /// which have their own setter method. If done anyway, the request will fail.
17883 ///
17884 /// # Additional Parameters
17885 ///
17886 /// * *$.xgafv* (query-string) - V1 error format.
17887 /// * *access_token* (query-string) - OAuth access token.
17888 /// * *alt* (query-string) - Data format for response.
17889 /// * *callback* (query-string) - JSONP
17890 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17891 /// * *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.
17892 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17893 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17894 /// * *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.
17895 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17896 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17897 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelListCall<'a, C>
17898 where
17899 T: AsRef<str>,
17900 {
17901 self._additional_params
17902 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17903 self
17904 }
17905
17906 /// Identifies the authorization scope for the method you are building.
17907 ///
17908 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17909 /// [`Scope::FirebaseReadonly`].
17910 ///
17911 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17912 /// tokens for more than one scope.
17913 ///
17914 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17915 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17916 /// sufficient, a read-write scope will do as well.
17917 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelListCall<'a, C>
17918 where
17919 St: AsRef<str>,
17920 {
17921 self._scopes.insert(String::from(scope.as_ref()));
17922 self
17923 }
17924 /// Identifies the authorization scope(s) for the method you are building.
17925 ///
17926 /// See [`Self::add_scope()`] for details.
17927 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelListCall<'a, C>
17928 where
17929 I: IntoIterator<Item = St>,
17930 St: AsRef<str>,
17931 {
17932 self._scopes
17933 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17934 self
17935 }
17936
17937 /// Removes all scopes, and no default scope will be used either.
17938 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17939 /// for details).
17940 pub fn clear_scopes(mut self) -> SiteChannelListCall<'a, C> {
17941 self._scopes.clear();
17942 self
17943 }
17944}
17945
17946/// Updates information for the specified channel of the specified site. Implicitly creates the channel if it doesn't already exist.
17947///
17948/// A builder for the *channels.patch* method supported by a *site* resource.
17949/// It is not used directly, but through a [`SiteMethods`] instance.
17950///
17951/// # Example
17952///
17953/// Instantiate a resource method builder
17954///
17955/// ```test_harness,no_run
17956/// # extern crate hyper;
17957/// # extern crate hyper_rustls;
17958/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
17959/// use firebasehosting1_beta1::api::Channel;
17960/// # async fn dox() {
17961/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17962///
17963/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17964/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17965/// # .with_native_roots()
17966/// # .unwrap()
17967/// # .https_only()
17968/// # .enable_http2()
17969/// # .build();
17970///
17971/// # let executor = hyper_util::rt::TokioExecutor::new();
17972/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17973/// # secret,
17974/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17975/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17976/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17977/// # ),
17978/// # ).build().await.unwrap();
17979///
17980/// # let client = hyper_util::client::legacy::Client::builder(
17981/// # hyper_util::rt::TokioExecutor::new()
17982/// # )
17983/// # .build(
17984/// # hyper_rustls::HttpsConnectorBuilder::new()
17985/// # .with_native_roots()
17986/// # .unwrap()
17987/// # .https_or_http()
17988/// # .enable_http2()
17989/// # .build()
17990/// # );
17991/// # let mut hub = FirebaseHosting::new(client, auth);
17992/// // As the method needs a request, you would usually fill it with the desired information
17993/// // into the respective structure. Some of the parts shown here might not be applicable !
17994/// // Values shown here are possibly random and not representative !
17995/// let mut req = Channel::default();
17996///
17997/// // You can configure optional parameters by calling the respective setters at will, and
17998/// // execute the final call using `doit()`.
17999/// // Values shown here are possibly random and not representative !
18000/// let result = hub.sites().channels_patch(req, "name")
18001/// .update_mask(FieldMask::new::<&str>(&[]))
18002/// .doit().await;
18003/// # }
18004/// ```
18005pub struct SiteChannelPatchCall<'a, C>
18006where
18007 C: 'a,
18008{
18009 hub: &'a FirebaseHosting<C>,
18010 _request: Channel,
18011 _name: String,
18012 _update_mask: Option<common::FieldMask>,
18013 _delegate: Option<&'a mut dyn common::Delegate>,
18014 _additional_params: HashMap<String, String>,
18015 _scopes: BTreeSet<String>,
18016}
18017
18018impl<'a, C> common::CallBuilder for SiteChannelPatchCall<'a, C> {}
18019
18020impl<'a, C> SiteChannelPatchCall<'a, C>
18021where
18022 C: common::Connector,
18023{
18024 /// Perform the operation you have build so far.
18025 pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
18026 use std::borrow::Cow;
18027 use std::io::{Read, Seek};
18028
18029 use common::{url::Params, ToParts};
18030 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18031
18032 let mut dd = common::DefaultDelegate;
18033 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18034 dlg.begin(common::MethodInfo {
18035 id: "firebasehosting.sites.channels.patch",
18036 http_method: hyper::Method::PATCH,
18037 });
18038
18039 for &field in ["alt", "name", "updateMask"].iter() {
18040 if self._additional_params.contains_key(field) {
18041 dlg.finished(false);
18042 return Err(common::Error::FieldClash(field));
18043 }
18044 }
18045
18046 let mut params = Params::with_capacity(5 + self._additional_params.len());
18047 params.push("name", self._name);
18048 if let Some(value) = self._update_mask.as_ref() {
18049 params.push("updateMask", value.to_string());
18050 }
18051
18052 params.extend(self._additional_params.iter());
18053
18054 params.push("alt", "json");
18055 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
18056 if self._scopes.is_empty() {
18057 self._scopes
18058 .insert(Scope::CloudPlatform.as_ref().to_string());
18059 }
18060
18061 #[allow(clippy::single_element_loop)]
18062 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18063 url = params.uri_replacement(url, param_name, find_this, true);
18064 }
18065 {
18066 let to_remove = ["name"];
18067 params.remove_params(&to_remove);
18068 }
18069
18070 let url = params.parse_with_url(&url);
18071
18072 let mut json_mime_type = mime::APPLICATION_JSON;
18073 let mut request_value_reader = {
18074 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18075 common::remove_json_null_values(&mut value);
18076 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18077 serde_json::to_writer(&mut dst, &value).unwrap();
18078 dst
18079 };
18080 let request_size = request_value_reader
18081 .seek(std::io::SeekFrom::End(0))
18082 .unwrap();
18083 request_value_reader
18084 .seek(std::io::SeekFrom::Start(0))
18085 .unwrap();
18086
18087 loop {
18088 let token = match self
18089 .hub
18090 .auth
18091 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18092 .await
18093 {
18094 Ok(token) => token,
18095 Err(e) => match dlg.token(e) {
18096 Ok(token) => token,
18097 Err(e) => {
18098 dlg.finished(false);
18099 return Err(common::Error::MissingToken(e));
18100 }
18101 },
18102 };
18103 request_value_reader
18104 .seek(std::io::SeekFrom::Start(0))
18105 .unwrap();
18106 let mut req_result = {
18107 let client = &self.hub.client;
18108 dlg.pre_request();
18109 let mut req_builder = hyper::Request::builder()
18110 .method(hyper::Method::PATCH)
18111 .uri(url.as_str())
18112 .header(USER_AGENT, self.hub._user_agent.clone());
18113
18114 if let Some(token) = token.as_ref() {
18115 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18116 }
18117
18118 let request = req_builder
18119 .header(CONTENT_TYPE, json_mime_type.to_string())
18120 .header(CONTENT_LENGTH, request_size as u64)
18121 .body(common::to_body(
18122 request_value_reader.get_ref().clone().into(),
18123 ));
18124
18125 client.request(request.unwrap()).await
18126 };
18127
18128 match req_result {
18129 Err(err) => {
18130 if let common::Retry::After(d) = dlg.http_error(&err) {
18131 sleep(d).await;
18132 continue;
18133 }
18134 dlg.finished(false);
18135 return Err(common::Error::HttpError(err));
18136 }
18137 Ok(res) => {
18138 let (mut parts, body) = res.into_parts();
18139 let mut body = common::Body::new(body);
18140 if !parts.status.is_success() {
18141 let bytes = common::to_bytes(body).await.unwrap_or_default();
18142 let error = serde_json::from_str(&common::to_string(&bytes));
18143 let response = common::to_response(parts, bytes.into());
18144
18145 if let common::Retry::After(d) =
18146 dlg.http_failure(&response, error.as_ref().ok())
18147 {
18148 sleep(d).await;
18149 continue;
18150 }
18151
18152 dlg.finished(false);
18153
18154 return Err(match error {
18155 Ok(value) => common::Error::BadRequest(value),
18156 _ => common::Error::Failure(response),
18157 });
18158 }
18159 let response = {
18160 let bytes = common::to_bytes(body).await.unwrap_or_default();
18161 let encoded = common::to_string(&bytes);
18162 match serde_json::from_str(&encoded) {
18163 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18164 Err(error) => {
18165 dlg.response_json_decode_error(&encoded, &error);
18166 return Err(common::Error::JsonDecodeError(
18167 encoded.to_string(),
18168 error,
18169 ));
18170 }
18171 }
18172 };
18173
18174 dlg.finished(true);
18175 return Ok(response);
18176 }
18177 }
18178 }
18179 }
18180
18181 ///
18182 /// Sets the *request* property to the given value.
18183 ///
18184 /// Even though the property as already been set when instantiating this call,
18185 /// we provide this method for API completeness.
18186 pub fn request(mut self, new_value: Channel) -> SiteChannelPatchCall<'a, C> {
18187 self._request = new_value;
18188 self
18189 }
18190 /// The fully-qualified resource name for the channel, in the format: sites/ SITE_ID/channels/CHANNEL_ID
18191 ///
18192 /// Sets the *name* path property to the given value.
18193 ///
18194 /// Even though the property as already been set when instantiating this call,
18195 /// we provide this method for API completeness.
18196 pub fn name(mut self, new_value: &str) -> SiteChannelPatchCall<'a, C> {
18197 self._name = new_value.to_string();
18198 self
18199 }
18200 /// A comma-separated list of fields to be updated in this request.
18201 ///
18202 /// Sets the *update mask* query property to the given value.
18203 pub fn update_mask(mut self, new_value: common::FieldMask) -> SiteChannelPatchCall<'a, C> {
18204 self._update_mask = Some(new_value);
18205 self
18206 }
18207 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18208 /// while executing the actual API request.
18209 ///
18210 /// ````text
18211 /// It should be used to handle progress information, and to implement a certain level of resilience.
18212 /// ````
18213 ///
18214 /// Sets the *delegate* property to the given value.
18215 pub fn delegate(
18216 mut self,
18217 new_value: &'a mut dyn common::Delegate,
18218 ) -> SiteChannelPatchCall<'a, C> {
18219 self._delegate = Some(new_value);
18220 self
18221 }
18222
18223 /// Set any additional parameter of the query string used in the request.
18224 /// It should be used to set parameters which are not yet available through their own
18225 /// setters.
18226 ///
18227 /// Please note that this method must not be used to set any of the known parameters
18228 /// which have their own setter method. If done anyway, the request will fail.
18229 ///
18230 /// # Additional Parameters
18231 ///
18232 /// * *$.xgafv* (query-string) - V1 error format.
18233 /// * *access_token* (query-string) - OAuth access token.
18234 /// * *alt* (query-string) - Data format for response.
18235 /// * *callback* (query-string) - JSONP
18236 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18237 /// * *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.
18238 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18239 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18240 /// * *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.
18241 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18242 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18243 pub fn param<T>(mut self, name: T, value: T) -> SiteChannelPatchCall<'a, C>
18244 where
18245 T: AsRef<str>,
18246 {
18247 self._additional_params
18248 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18249 self
18250 }
18251
18252 /// Identifies the authorization scope for the method you are building.
18253 ///
18254 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18255 /// [`Scope::CloudPlatform`].
18256 ///
18257 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18258 /// tokens for more than one scope.
18259 ///
18260 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18261 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18262 /// sufficient, a read-write scope will do as well.
18263 pub fn add_scope<St>(mut self, scope: St) -> SiteChannelPatchCall<'a, C>
18264 where
18265 St: AsRef<str>,
18266 {
18267 self._scopes.insert(String::from(scope.as_ref()));
18268 self
18269 }
18270 /// Identifies the authorization scope(s) for the method you are building.
18271 ///
18272 /// See [`Self::add_scope()`] for details.
18273 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteChannelPatchCall<'a, C>
18274 where
18275 I: IntoIterator<Item = St>,
18276 St: AsRef<str>,
18277 {
18278 self._scopes
18279 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18280 self
18281 }
18282
18283 /// Removes all scopes, and no default scope will be used either.
18284 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18285 /// for details).
18286 pub fn clear_scopes(mut self) -> SiteChannelPatchCall<'a, C> {
18287 self._scopes.clear();
18288 self
18289 }
18290}
18291
18292/// Creates a domain mapping on the specified site.
18293///
18294/// A builder for the *domains.create* method supported by a *site* resource.
18295/// It is not used directly, but through a [`SiteMethods`] instance.
18296///
18297/// # Example
18298///
18299/// Instantiate a resource method builder
18300///
18301/// ```test_harness,no_run
18302/// # extern crate hyper;
18303/// # extern crate hyper_rustls;
18304/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
18305/// use firebasehosting1_beta1::api::Domain;
18306/// # async fn dox() {
18307/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18308///
18309/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18310/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18311/// # .with_native_roots()
18312/// # .unwrap()
18313/// # .https_only()
18314/// # .enable_http2()
18315/// # .build();
18316///
18317/// # let executor = hyper_util::rt::TokioExecutor::new();
18318/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18319/// # secret,
18320/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18321/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18322/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18323/// # ),
18324/// # ).build().await.unwrap();
18325///
18326/// # let client = hyper_util::client::legacy::Client::builder(
18327/// # hyper_util::rt::TokioExecutor::new()
18328/// # )
18329/// # .build(
18330/// # hyper_rustls::HttpsConnectorBuilder::new()
18331/// # .with_native_roots()
18332/// # .unwrap()
18333/// # .https_or_http()
18334/// # .enable_http2()
18335/// # .build()
18336/// # );
18337/// # let mut hub = FirebaseHosting::new(client, auth);
18338/// // As the method needs a request, you would usually fill it with the desired information
18339/// // into the respective structure. Some of the parts shown here might not be applicable !
18340/// // Values shown here are possibly random and not representative !
18341/// let mut req = Domain::default();
18342///
18343/// // You can configure optional parameters by calling the respective setters at will, and
18344/// // execute the final call using `doit()`.
18345/// // Values shown here are possibly random and not representative !
18346/// let result = hub.sites().domains_create(req, "parent")
18347/// .doit().await;
18348/// # }
18349/// ```
18350pub struct SiteDomainCreateCall<'a, C>
18351where
18352 C: 'a,
18353{
18354 hub: &'a FirebaseHosting<C>,
18355 _request: Domain,
18356 _parent: String,
18357 _delegate: Option<&'a mut dyn common::Delegate>,
18358 _additional_params: HashMap<String, String>,
18359 _scopes: BTreeSet<String>,
18360}
18361
18362impl<'a, C> common::CallBuilder for SiteDomainCreateCall<'a, C> {}
18363
18364impl<'a, C> SiteDomainCreateCall<'a, C>
18365where
18366 C: common::Connector,
18367{
18368 /// Perform the operation you have build so far.
18369 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
18370 use std::borrow::Cow;
18371 use std::io::{Read, Seek};
18372
18373 use common::{url::Params, ToParts};
18374 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18375
18376 let mut dd = common::DefaultDelegate;
18377 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18378 dlg.begin(common::MethodInfo {
18379 id: "firebasehosting.sites.domains.create",
18380 http_method: hyper::Method::POST,
18381 });
18382
18383 for &field in ["alt", "parent"].iter() {
18384 if self._additional_params.contains_key(field) {
18385 dlg.finished(false);
18386 return Err(common::Error::FieldClash(field));
18387 }
18388 }
18389
18390 let mut params = Params::with_capacity(4 + self._additional_params.len());
18391 params.push("parent", self._parent);
18392
18393 params.extend(self._additional_params.iter());
18394
18395 params.push("alt", "json");
18396 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/domains";
18397 if self._scopes.is_empty() {
18398 self._scopes
18399 .insert(Scope::CloudPlatform.as_ref().to_string());
18400 }
18401
18402 #[allow(clippy::single_element_loop)]
18403 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18404 url = params.uri_replacement(url, param_name, find_this, true);
18405 }
18406 {
18407 let to_remove = ["parent"];
18408 params.remove_params(&to_remove);
18409 }
18410
18411 let url = params.parse_with_url(&url);
18412
18413 let mut json_mime_type = mime::APPLICATION_JSON;
18414 let mut request_value_reader = {
18415 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18416 common::remove_json_null_values(&mut value);
18417 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18418 serde_json::to_writer(&mut dst, &value).unwrap();
18419 dst
18420 };
18421 let request_size = request_value_reader
18422 .seek(std::io::SeekFrom::End(0))
18423 .unwrap();
18424 request_value_reader
18425 .seek(std::io::SeekFrom::Start(0))
18426 .unwrap();
18427
18428 loop {
18429 let token = match self
18430 .hub
18431 .auth
18432 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18433 .await
18434 {
18435 Ok(token) => token,
18436 Err(e) => match dlg.token(e) {
18437 Ok(token) => token,
18438 Err(e) => {
18439 dlg.finished(false);
18440 return Err(common::Error::MissingToken(e));
18441 }
18442 },
18443 };
18444 request_value_reader
18445 .seek(std::io::SeekFrom::Start(0))
18446 .unwrap();
18447 let mut req_result = {
18448 let client = &self.hub.client;
18449 dlg.pre_request();
18450 let mut req_builder = hyper::Request::builder()
18451 .method(hyper::Method::POST)
18452 .uri(url.as_str())
18453 .header(USER_AGENT, self.hub._user_agent.clone());
18454
18455 if let Some(token) = token.as_ref() {
18456 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18457 }
18458
18459 let request = req_builder
18460 .header(CONTENT_TYPE, json_mime_type.to_string())
18461 .header(CONTENT_LENGTH, request_size as u64)
18462 .body(common::to_body(
18463 request_value_reader.get_ref().clone().into(),
18464 ));
18465
18466 client.request(request.unwrap()).await
18467 };
18468
18469 match req_result {
18470 Err(err) => {
18471 if let common::Retry::After(d) = dlg.http_error(&err) {
18472 sleep(d).await;
18473 continue;
18474 }
18475 dlg.finished(false);
18476 return Err(common::Error::HttpError(err));
18477 }
18478 Ok(res) => {
18479 let (mut parts, body) = res.into_parts();
18480 let mut body = common::Body::new(body);
18481 if !parts.status.is_success() {
18482 let bytes = common::to_bytes(body).await.unwrap_or_default();
18483 let error = serde_json::from_str(&common::to_string(&bytes));
18484 let response = common::to_response(parts, bytes.into());
18485
18486 if let common::Retry::After(d) =
18487 dlg.http_failure(&response, error.as_ref().ok())
18488 {
18489 sleep(d).await;
18490 continue;
18491 }
18492
18493 dlg.finished(false);
18494
18495 return Err(match error {
18496 Ok(value) => common::Error::BadRequest(value),
18497 _ => common::Error::Failure(response),
18498 });
18499 }
18500 let response = {
18501 let bytes = common::to_bytes(body).await.unwrap_or_default();
18502 let encoded = common::to_string(&bytes);
18503 match serde_json::from_str(&encoded) {
18504 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18505 Err(error) => {
18506 dlg.response_json_decode_error(&encoded, &error);
18507 return Err(common::Error::JsonDecodeError(
18508 encoded.to_string(),
18509 error,
18510 ));
18511 }
18512 }
18513 };
18514
18515 dlg.finished(true);
18516 return Ok(response);
18517 }
18518 }
18519 }
18520 }
18521
18522 ///
18523 /// Sets the *request* property to the given value.
18524 ///
18525 /// Even though the property as already been set when instantiating this call,
18526 /// we provide this method for API completeness.
18527 pub fn request(mut self, new_value: Domain) -> SiteDomainCreateCall<'a, C> {
18528 self._request = new_value;
18529 self
18530 }
18531 /// Required. The parent to create the domain association for, in the format: sites/site-name
18532 ///
18533 /// Sets the *parent* path property to the given value.
18534 ///
18535 /// Even though the property as already been set when instantiating this call,
18536 /// we provide this method for API completeness.
18537 pub fn parent(mut self, new_value: &str) -> SiteDomainCreateCall<'a, C> {
18538 self._parent = new_value.to_string();
18539 self
18540 }
18541 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18542 /// while executing the actual API request.
18543 ///
18544 /// ````text
18545 /// It should be used to handle progress information, and to implement a certain level of resilience.
18546 /// ````
18547 ///
18548 /// Sets the *delegate* property to the given value.
18549 pub fn delegate(
18550 mut self,
18551 new_value: &'a mut dyn common::Delegate,
18552 ) -> SiteDomainCreateCall<'a, C> {
18553 self._delegate = Some(new_value);
18554 self
18555 }
18556
18557 /// Set any additional parameter of the query string used in the request.
18558 /// It should be used to set parameters which are not yet available through their own
18559 /// setters.
18560 ///
18561 /// Please note that this method must not be used to set any of the known parameters
18562 /// which have their own setter method. If done anyway, the request will fail.
18563 ///
18564 /// # Additional Parameters
18565 ///
18566 /// * *$.xgafv* (query-string) - V1 error format.
18567 /// * *access_token* (query-string) - OAuth access token.
18568 /// * *alt* (query-string) - Data format for response.
18569 /// * *callback* (query-string) - JSONP
18570 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18571 /// * *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.
18572 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18573 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18574 /// * *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.
18575 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18576 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18577 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainCreateCall<'a, C>
18578 where
18579 T: AsRef<str>,
18580 {
18581 self._additional_params
18582 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18583 self
18584 }
18585
18586 /// Identifies the authorization scope for the method you are building.
18587 ///
18588 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18589 /// [`Scope::CloudPlatform`].
18590 ///
18591 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18592 /// tokens for more than one scope.
18593 ///
18594 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18595 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18596 /// sufficient, a read-write scope will do as well.
18597 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainCreateCall<'a, C>
18598 where
18599 St: AsRef<str>,
18600 {
18601 self._scopes.insert(String::from(scope.as_ref()));
18602 self
18603 }
18604 /// Identifies the authorization scope(s) for the method you are building.
18605 ///
18606 /// See [`Self::add_scope()`] for details.
18607 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainCreateCall<'a, C>
18608 where
18609 I: IntoIterator<Item = St>,
18610 St: AsRef<str>,
18611 {
18612 self._scopes
18613 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18614 self
18615 }
18616
18617 /// Removes all scopes, and no default scope will be used either.
18618 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18619 /// for details).
18620 pub fn clear_scopes(mut self) -> SiteDomainCreateCall<'a, C> {
18621 self._scopes.clear();
18622 self
18623 }
18624}
18625
18626/// Deletes the existing domain mapping on the specified site.
18627///
18628/// A builder for the *domains.delete* method supported by a *site* resource.
18629/// It is not used directly, but through a [`SiteMethods`] instance.
18630///
18631/// # Example
18632///
18633/// Instantiate a resource method builder
18634///
18635/// ```test_harness,no_run
18636/// # extern crate hyper;
18637/// # extern crate hyper_rustls;
18638/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
18639/// # async fn dox() {
18640/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18641///
18642/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18643/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18644/// # .with_native_roots()
18645/// # .unwrap()
18646/// # .https_only()
18647/// # .enable_http2()
18648/// # .build();
18649///
18650/// # let executor = hyper_util::rt::TokioExecutor::new();
18651/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18652/// # secret,
18653/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18654/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18655/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18656/// # ),
18657/// # ).build().await.unwrap();
18658///
18659/// # let client = hyper_util::client::legacy::Client::builder(
18660/// # hyper_util::rt::TokioExecutor::new()
18661/// # )
18662/// # .build(
18663/// # hyper_rustls::HttpsConnectorBuilder::new()
18664/// # .with_native_roots()
18665/// # .unwrap()
18666/// # .https_or_http()
18667/// # .enable_http2()
18668/// # .build()
18669/// # );
18670/// # let mut hub = FirebaseHosting::new(client, auth);
18671/// // You can configure optional parameters by calling the respective setters at will, and
18672/// // execute the final call using `doit()`.
18673/// // Values shown here are possibly random and not representative !
18674/// let result = hub.sites().domains_delete("name")
18675/// .doit().await;
18676/// # }
18677/// ```
18678pub struct SiteDomainDeleteCall<'a, C>
18679where
18680 C: 'a,
18681{
18682 hub: &'a FirebaseHosting<C>,
18683 _name: String,
18684 _delegate: Option<&'a mut dyn common::Delegate>,
18685 _additional_params: HashMap<String, String>,
18686 _scopes: BTreeSet<String>,
18687}
18688
18689impl<'a, C> common::CallBuilder for SiteDomainDeleteCall<'a, C> {}
18690
18691impl<'a, C> SiteDomainDeleteCall<'a, C>
18692where
18693 C: common::Connector,
18694{
18695 /// Perform the operation you have build so far.
18696 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
18697 use std::borrow::Cow;
18698 use std::io::{Read, Seek};
18699
18700 use common::{url::Params, ToParts};
18701 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18702
18703 let mut dd = common::DefaultDelegate;
18704 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18705 dlg.begin(common::MethodInfo {
18706 id: "firebasehosting.sites.domains.delete",
18707 http_method: hyper::Method::DELETE,
18708 });
18709
18710 for &field in ["alt", "name"].iter() {
18711 if self._additional_params.contains_key(field) {
18712 dlg.finished(false);
18713 return Err(common::Error::FieldClash(field));
18714 }
18715 }
18716
18717 let mut params = Params::with_capacity(3 + self._additional_params.len());
18718 params.push("name", self._name);
18719
18720 params.extend(self._additional_params.iter());
18721
18722 params.push("alt", "json");
18723 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
18724 if self._scopes.is_empty() {
18725 self._scopes
18726 .insert(Scope::CloudPlatform.as_ref().to_string());
18727 }
18728
18729 #[allow(clippy::single_element_loop)]
18730 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18731 url = params.uri_replacement(url, param_name, find_this, true);
18732 }
18733 {
18734 let to_remove = ["name"];
18735 params.remove_params(&to_remove);
18736 }
18737
18738 let url = params.parse_with_url(&url);
18739
18740 loop {
18741 let token = match self
18742 .hub
18743 .auth
18744 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18745 .await
18746 {
18747 Ok(token) => token,
18748 Err(e) => match dlg.token(e) {
18749 Ok(token) => token,
18750 Err(e) => {
18751 dlg.finished(false);
18752 return Err(common::Error::MissingToken(e));
18753 }
18754 },
18755 };
18756 let mut req_result = {
18757 let client = &self.hub.client;
18758 dlg.pre_request();
18759 let mut req_builder = hyper::Request::builder()
18760 .method(hyper::Method::DELETE)
18761 .uri(url.as_str())
18762 .header(USER_AGENT, self.hub._user_agent.clone());
18763
18764 if let Some(token) = token.as_ref() {
18765 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18766 }
18767
18768 let request = req_builder
18769 .header(CONTENT_LENGTH, 0_u64)
18770 .body(common::to_body::<String>(None));
18771
18772 client.request(request.unwrap()).await
18773 };
18774
18775 match req_result {
18776 Err(err) => {
18777 if let common::Retry::After(d) = dlg.http_error(&err) {
18778 sleep(d).await;
18779 continue;
18780 }
18781 dlg.finished(false);
18782 return Err(common::Error::HttpError(err));
18783 }
18784 Ok(res) => {
18785 let (mut parts, body) = res.into_parts();
18786 let mut body = common::Body::new(body);
18787 if !parts.status.is_success() {
18788 let bytes = common::to_bytes(body).await.unwrap_or_default();
18789 let error = serde_json::from_str(&common::to_string(&bytes));
18790 let response = common::to_response(parts, bytes.into());
18791
18792 if let common::Retry::After(d) =
18793 dlg.http_failure(&response, error.as_ref().ok())
18794 {
18795 sleep(d).await;
18796 continue;
18797 }
18798
18799 dlg.finished(false);
18800
18801 return Err(match error {
18802 Ok(value) => common::Error::BadRequest(value),
18803 _ => common::Error::Failure(response),
18804 });
18805 }
18806 let response = {
18807 let bytes = common::to_bytes(body).await.unwrap_or_default();
18808 let encoded = common::to_string(&bytes);
18809 match serde_json::from_str(&encoded) {
18810 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18811 Err(error) => {
18812 dlg.response_json_decode_error(&encoded, &error);
18813 return Err(common::Error::JsonDecodeError(
18814 encoded.to_string(),
18815 error,
18816 ));
18817 }
18818 }
18819 };
18820
18821 dlg.finished(true);
18822 return Ok(response);
18823 }
18824 }
18825 }
18826 }
18827
18828 /// Required. The name of the domain association to delete.
18829 ///
18830 /// Sets the *name* path property to the given value.
18831 ///
18832 /// Even though the property as already been set when instantiating this call,
18833 /// we provide this method for API completeness.
18834 pub fn name(mut self, new_value: &str) -> SiteDomainDeleteCall<'a, C> {
18835 self._name = new_value.to_string();
18836 self
18837 }
18838 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18839 /// while executing the actual API request.
18840 ///
18841 /// ````text
18842 /// It should be used to handle progress information, and to implement a certain level of resilience.
18843 /// ````
18844 ///
18845 /// Sets the *delegate* property to the given value.
18846 pub fn delegate(
18847 mut self,
18848 new_value: &'a mut dyn common::Delegate,
18849 ) -> SiteDomainDeleteCall<'a, C> {
18850 self._delegate = Some(new_value);
18851 self
18852 }
18853
18854 /// Set any additional parameter of the query string used in the request.
18855 /// It should be used to set parameters which are not yet available through their own
18856 /// setters.
18857 ///
18858 /// Please note that this method must not be used to set any of the known parameters
18859 /// which have their own setter method. If done anyway, the request will fail.
18860 ///
18861 /// # Additional Parameters
18862 ///
18863 /// * *$.xgafv* (query-string) - V1 error format.
18864 /// * *access_token* (query-string) - OAuth access token.
18865 /// * *alt* (query-string) - Data format for response.
18866 /// * *callback* (query-string) - JSONP
18867 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18868 /// * *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.
18869 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18870 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18871 /// * *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.
18872 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18873 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18874 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainDeleteCall<'a, C>
18875 where
18876 T: AsRef<str>,
18877 {
18878 self._additional_params
18879 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18880 self
18881 }
18882
18883 /// Identifies the authorization scope for the method you are building.
18884 ///
18885 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18886 /// [`Scope::CloudPlatform`].
18887 ///
18888 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18889 /// tokens for more than one scope.
18890 ///
18891 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18892 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18893 /// sufficient, a read-write scope will do as well.
18894 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainDeleteCall<'a, C>
18895 where
18896 St: AsRef<str>,
18897 {
18898 self._scopes.insert(String::from(scope.as_ref()));
18899 self
18900 }
18901 /// Identifies the authorization scope(s) for the method you are building.
18902 ///
18903 /// See [`Self::add_scope()`] for details.
18904 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainDeleteCall<'a, C>
18905 where
18906 I: IntoIterator<Item = St>,
18907 St: AsRef<str>,
18908 {
18909 self._scopes
18910 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18911 self
18912 }
18913
18914 /// Removes all scopes, and no default scope will be used either.
18915 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18916 /// for details).
18917 pub fn clear_scopes(mut self) -> SiteDomainDeleteCall<'a, C> {
18918 self._scopes.clear();
18919 self
18920 }
18921}
18922
18923/// Gets a domain mapping on the specified site.
18924///
18925/// A builder for the *domains.get* method supported by a *site* resource.
18926/// It is not used directly, but through a [`SiteMethods`] instance.
18927///
18928/// # Example
18929///
18930/// Instantiate a resource method builder
18931///
18932/// ```test_harness,no_run
18933/// # extern crate hyper;
18934/// # extern crate hyper_rustls;
18935/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
18936/// # async fn dox() {
18937/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18938///
18939/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18940/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18941/// # .with_native_roots()
18942/// # .unwrap()
18943/// # .https_only()
18944/// # .enable_http2()
18945/// # .build();
18946///
18947/// # let executor = hyper_util::rt::TokioExecutor::new();
18948/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18949/// # secret,
18950/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18951/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18952/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18953/// # ),
18954/// # ).build().await.unwrap();
18955///
18956/// # let client = hyper_util::client::legacy::Client::builder(
18957/// # hyper_util::rt::TokioExecutor::new()
18958/// # )
18959/// # .build(
18960/// # hyper_rustls::HttpsConnectorBuilder::new()
18961/// # .with_native_roots()
18962/// # .unwrap()
18963/// # .https_or_http()
18964/// # .enable_http2()
18965/// # .build()
18966/// # );
18967/// # let mut hub = FirebaseHosting::new(client, auth);
18968/// // You can configure optional parameters by calling the respective setters at will, and
18969/// // execute the final call using `doit()`.
18970/// // Values shown here are possibly random and not representative !
18971/// let result = hub.sites().domains_get("name")
18972/// .doit().await;
18973/// # }
18974/// ```
18975pub struct SiteDomainGetCall<'a, C>
18976where
18977 C: 'a,
18978{
18979 hub: &'a FirebaseHosting<C>,
18980 _name: String,
18981 _delegate: Option<&'a mut dyn common::Delegate>,
18982 _additional_params: HashMap<String, String>,
18983 _scopes: BTreeSet<String>,
18984}
18985
18986impl<'a, C> common::CallBuilder for SiteDomainGetCall<'a, C> {}
18987
18988impl<'a, C> SiteDomainGetCall<'a, C>
18989where
18990 C: common::Connector,
18991{
18992 /// Perform the operation you have build so far.
18993 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
18994 use std::borrow::Cow;
18995 use std::io::{Read, Seek};
18996
18997 use common::{url::Params, ToParts};
18998 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18999
19000 let mut dd = common::DefaultDelegate;
19001 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19002 dlg.begin(common::MethodInfo {
19003 id: "firebasehosting.sites.domains.get",
19004 http_method: hyper::Method::GET,
19005 });
19006
19007 for &field in ["alt", "name"].iter() {
19008 if self._additional_params.contains_key(field) {
19009 dlg.finished(false);
19010 return Err(common::Error::FieldClash(field));
19011 }
19012 }
19013
19014 let mut params = Params::with_capacity(3 + self._additional_params.len());
19015 params.push("name", self._name);
19016
19017 params.extend(self._additional_params.iter());
19018
19019 params.push("alt", "json");
19020 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
19021 if self._scopes.is_empty() {
19022 self._scopes
19023 .insert(Scope::FirebaseReadonly.as_ref().to_string());
19024 }
19025
19026 #[allow(clippy::single_element_loop)]
19027 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19028 url = params.uri_replacement(url, param_name, find_this, true);
19029 }
19030 {
19031 let to_remove = ["name"];
19032 params.remove_params(&to_remove);
19033 }
19034
19035 let url = params.parse_with_url(&url);
19036
19037 loop {
19038 let token = match self
19039 .hub
19040 .auth
19041 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19042 .await
19043 {
19044 Ok(token) => token,
19045 Err(e) => match dlg.token(e) {
19046 Ok(token) => token,
19047 Err(e) => {
19048 dlg.finished(false);
19049 return Err(common::Error::MissingToken(e));
19050 }
19051 },
19052 };
19053 let mut req_result = {
19054 let client = &self.hub.client;
19055 dlg.pre_request();
19056 let mut req_builder = hyper::Request::builder()
19057 .method(hyper::Method::GET)
19058 .uri(url.as_str())
19059 .header(USER_AGENT, self.hub._user_agent.clone());
19060
19061 if let Some(token) = token.as_ref() {
19062 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19063 }
19064
19065 let request = req_builder
19066 .header(CONTENT_LENGTH, 0_u64)
19067 .body(common::to_body::<String>(None));
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 /// Required. The name of the domain configuration to get.
19126 ///
19127 /// Sets the *name* path property to the given value.
19128 ///
19129 /// Even though the property as already been set when instantiating this call,
19130 /// we provide this method for API completeness.
19131 pub fn name(mut self, new_value: &str) -> SiteDomainGetCall<'a, C> {
19132 self._name = new_value.to_string();
19133 self
19134 }
19135 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19136 /// while executing the actual API request.
19137 ///
19138 /// ````text
19139 /// It should be used to handle progress information, and to implement a certain level of resilience.
19140 /// ````
19141 ///
19142 /// Sets the *delegate* property to the given value.
19143 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SiteDomainGetCall<'a, C> {
19144 self._delegate = Some(new_value);
19145 self
19146 }
19147
19148 /// Set any additional parameter of the query string used in the request.
19149 /// It should be used to set parameters which are not yet available through their own
19150 /// setters.
19151 ///
19152 /// Please note that this method must not be used to set any of the known parameters
19153 /// which have their own setter method. If done anyway, the request will fail.
19154 ///
19155 /// # Additional Parameters
19156 ///
19157 /// * *$.xgafv* (query-string) - V1 error format.
19158 /// * *access_token* (query-string) - OAuth access token.
19159 /// * *alt* (query-string) - Data format for response.
19160 /// * *callback* (query-string) - JSONP
19161 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19162 /// * *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.
19163 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19164 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19165 /// * *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.
19166 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19167 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19168 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainGetCall<'a, C>
19169 where
19170 T: AsRef<str>,
19171 {
19172 self._additional_params
19173 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19174 self
19175 }
19176
19177 /// Identifies the authorization scope for the method you are building.
19178 ///
19179 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19180 /// [`Scope::FirebaseReadonly`].
19181 ///
19182 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19183 /// tokens for more than one scope.
19184 ///
19185 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19186 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19187 /// sufficient, a read-write scope will do as well.
19188 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainGetCall<'a, C>
19189 where
19190 St: AsRef<str>,
19191 {
19192 self._scopes.insert(String::from(scope.as_ref()));
19193 self
19194 }
19195 /// Identifies the authorization scope(s) for the method you are building.
19196 ///
19197 /// See [`Self::add_scope()`] for details.
19198 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainGetCall<'a, C>
19199 where
19200 I: IntoIterator<Item = St>,
19201 St: AsRef<str>,
19202 {
19203 self._scopes
19204 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19205 self
19206 }
19207
19208 /// Removes all scopes, and no default scope will be used either.
19209 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19210 /// for details).
19211 pub fn clear_scopes(mut self) -> SiteDomainGetCall<'a, C> {
19212 self._scopes.clear();
19213 self
19214 }
19215}
19216
19217/// Lists the domains for the specified site.
19218///
19219/// A builder for the *domains.list* method supported by a *site* resource.
19220/// It is not used directly, but through a [`SiteMethods`] instance.
19221///
19222/// # Example
19223///
19224/// Instantiate a resource method builder
19225///
19226/// ```test_harness,no_run
19227/// # extern crate hyper;
19228/// # extern crate hyper_rustls;
19229/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
19230/// # async fn dox() {
19231/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19232///
19233/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19234/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19235/// # .with_native_roots()
19236/// # .unwrap()
19237/// # .https_only()
19238/// # .enable_http2()
19239/// # .build();
19240///
19241/// # let executor = hyper_util::rt::TokioExecutor::new();
19242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19243/// # secret,
19244/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19245/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19246/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19247/// # ),
19248/// # ).build().await.unwrap();
19249///
19250/// # let client = hyper_util::client::legacy::Client::builder(
19251/// # hyper_util::rt::TokioExecutor::new()
19252/// # )
19253/// # .build(
19254/// # hyper_rustls::HttpsConnectorBuilder::new()
19255/// # .with_native_roots()
19256/// # .unwrap()
19257/// # .https_or_http()
19258/// # .enable_http2()
19259/// # .build()
19260/// # );
19261/// # let mut hub = FirebaseHosting::new(client, auth);
19262/// // You can configure optional parameters by calling the respective setters at will, and
19263/// // execute the final call using `doit()`.
19264/// // Values shown here are possibly random and not representative !
19265/// let result = hub.sites().domains_list("parent")
19266/// .page_token("sed")
19267/// .page_size(-11)
19268/// .doit().await;
19269/// # }
19270/// ```
19271pub struct SiteDomainListCall<'a, C>
19272where
19273 C: 'a,
19274{
19275 hub: &'a FirebaseHosting<C>,
19276 _parent: String,
19277 _page_token: Option<String>,
19278 _page_size: Option<i32>,
19279 _delegate: Option<&'a mut dyn common::Delegate>,
19280 _additional_params: HashMap<String, String>,
19281 _scopes: BTreeSet<String>,
19282}
19283
19284impl<'a, C> common::CallBuilder for SiteDomainListCall<'a, C> {}
19285
19286impl<'a, C> SiteDomainListCall<'a, C>
19287where
19288 C: common::Connector,
19289{
19290 /// Perform the operation you have build so far.
19291 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainsResponse)> {
19292 use std::borrow::Cow;
19293 use std::io::{Read, Seek};
19294
19295 use common::{url::Params, ToParts};
19296 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19297
19298 let mut dd = common::DefaultDelegate;
19299 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19300 dlg.begin(common::MethodInfo {
19301 id: "firebasehosting.sites.domains.list",
19302 http_method: hyper::Method::GET,
19303 });
19304
19305 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
19306 if self._additional_params.contains_key(field) {
19307 dlg.finished(false);
19308 return Err(common::Error::FieldClash(field));
19309 }
19310 }
19311
19312 let mut params = Params::with_capacity(5 + self._additional_params.len());
19313 params.push("parent", self._parent);
19314 if let Some(value) = self._page_token.as_ref() {
19315 params.push("pageToken", value);
19316 }
19317 if let Some(value) = self._page_size.as_ref() {
19318 params.push("pageSize", value.to_string());
19319 }
19320
19321 params.extend(self._additional_params.iter());
19322
19323 params.push("alt", "json");
19324 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/domains";
19325 if self._scopes.is_empty() {
19326 self._scopes
19327 .insert(Scope::FirebaseReadonly.as_ref().to_string());
19328 }
19329
19330 #[allow(clippy::single_element_loop)]
19331 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19332 url = params.uri_replacement(url, param_name, find_this, true);
19333 }
19334 {
19335 let to_remove = ["parent"];
19336 params.remove_params(&to_remove);
19337 }
19338
19339 let url = params.parse_with_url(&url);
19340
19341 loop {
19342 let token = match self
19343 .hub
19344 .auth
19345 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19346 .await
19347 {
19348 Ok(token) => token,
19349 Err(e) => match dlg.token(e) {
19350 Ok(token) => token,
19351 Err(e) => {
19352 dlg.finished(false);
19353 return Err(common::Error::MissingToken(e));
19354 }
19355 },
19356 };
19357 let mut req_result = {
19358 let client = &self.hub.client;
19359 dlg.pre_request();
19360 let mut req_builder = hyper::Request::builder()
19361 .method(hyper::Method::GET)
19362 .uri(url.as_str())
19363 .header(USER_AGENT, self.hub._user_agent.clone());
19364
19365 if let Some(token) = token.as_ref() {
19366 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19367 }
19368
19369 let request = req_builder
19370 .header(CONTENT_LENGTH, 0_u64)
19371 .body(common::to_body::<String>(None));
19372
19373 client.request(request.unwrap()).await
19374 };
19375
19376 match req_result {
19377 Err(err) => {
19378 if let common::Retry::After(d) = dlg.http_error(&err) {
19379 sleep(d).await;
19380 continue;
19381 }
19382 dlg.finished(false);
19383 return Err(common::Error::HttpError(err));
19384 }
19385 Ok(res) => {
19386 let (mut parts, body) = res.into_parts();
19387 let mut body = common::Body::new(body);
19388 if !parts.status.is_success() {
19389 let bytes = common::to_bytes(body).await.unwrap_or_default();
19390 let error = serde_json::from_str(&common::to_string(&bytes));
19391 let response = common::to_response(parts, bytes.into());
19392
19393 if let common::Retry::After(d) =
19394 dlg.http_failure(&response, error.as_ref().ok())
19395 {
19396 sleep(d).await;
19397 continue;
19398 }
19399
19400 dlg.finished(false);
19401
19402 return Err(match error {
19403 Ok(value) => common::Error::BadRequest(value),
19404 _ => common::Error::Failure(response),
19405 });
19406 }
19407 let response = {
19408 let bytes = common::to_bytes(body).await.unwrap_or_default();
19409 let encoded = common::to_string(&bytes);
19410 match serde_json::from_str(&encoded) {
19411 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19412 Err(error) => {
19413 dlg.response_json_decode_error(&encoded, &error);
19414 return Err(common::Error::JsonDecodeError(
19415 encoded.to_string(),
19416 error,
19417 ));
19418 }
19419 }
19420 };
19421
19422 dlg.finished(true);
19423 return Ok(response);
19424 }
19425 }
19426 }
19427 }
19428
19429 /// Required. The parent for which to list domains, in the format: sites/ site-name
19430 ///
19431 /// Sets the *parent* path property to the given value.
19432 ///
19433 /// Even though the property as already been set when instantiating this call,
19434 /// we provide this method for API completeness.
19435 pub fn parent(mut self, new_value: &str) -> SiteDomainListCall<'a, C> {
19436 self._parent = new_value.to_string();
19437 self
19438 }
19439 /// The next_page_token from a previous request, if provided.
19440 ///
19441 /// Sets the *page token* query property to the given value.
19442 pub fn page_token(mut self, new_value: &str) -> SiteDomainListCall<'a, C> {
19443 self._page_token = Some(new_value.to_string());
19444 self
19445 }
19446 /// The page size to return. Defaults to 50.
19447 ///
19448 /// Sets the *page size* query property to the given value.
19449 pub fn page_size(mut self, new_value: i32) -> SiteDomainListCall<'a, C> {
19450 self._page_size = Some(new_value);
19451 self
19452 }
19453 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19454 /// while executing the actual API request.
19455 ///
19456 /// ````text
19457 /// It should be used to handle progress information, and to implement a certain level of resilience.
19458 /// ````
19459 ///
19460 /// Sets the *delegate* property to the given value.
19461 pub fn delegate(
19462 mut self,
19463 new_value: &'a mut dyn common::Delegate,
19464 ) -> SiteDomainListCall<'a, C> {
19465 self._delegate = Some(new_value);
19466 self
19467 }
19468
19469 /// Set any additional parameter of the query string used in the request.
19470 /// It should be used to set parameters which are not yet available through their own
19471 /// setters.
19472 ///
19473 /// Please note that this method must not be used to set any of the known parameters
19474 /// which have their own setter method. If done anyway, the request will fail.
19475 ///
19476 /// # Additional Parameters
19477 ///
19478 /// * *$.xgafv* (query-string) - V1 error format.
19479 /// * *access_token* (query-string) - OAuth access token.
19480 /// * *alt* (query-string) - Data format for response.
19481 /// * *callback* (query-string) - JSONP
19482 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19483 /// * *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.
19484 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19485 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19486 /// * *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.
19487 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19488 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19489 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainListCall<'a, C>
19490 where
19491 T: AsRef<str>,
19492 {
19493 self._additional_params
19494 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19495 self
19496 }
19497
19498 /// Identifies the authorization scope for the method you are building.
19499 ///
19500 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19501 /// [`Scope::FirebaseReadonly`].
19502 ///
19503 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19504 /// tokens for more than one scope.
19505 ///
19506 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19507 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19508 /// sufficient, a read-write scope will do as well.
19509 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainListCall<'a, C>
19510 where
19511 St: AsRef<str>,
19512 {
19513 self._scopes.insert(String::from(scope.as_ref()));
19514 self
19515 }
19516 /// Identifies the authorization scope(s) for the method you are building.
19517 ///
19518 /// See [`Self::add_scope()`] for details.
19519 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainListCall<'a, C>
19520 where
19521 I: IntoIterator<Item = St>,
19522 St: AsRef<str>,
19523 {
19524 self._scopes
19525 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19526 self
19527 }
19528
19529 /// Removes all scopes, and no default scope will be used either.
19530 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19531 /// for details).
19532 pub fn clear_scopes(mut self) -> SiteDomainListCall<'a, C> {
19533 self._scopes.clear();
19534 self
19535 }
19536}
19537
19538/// Updates the specified domain mapping, creating the mapping as if it does not exist.
19539///
19540/// A builder for the *domains.update* method supported by a *site* resource.
19541/// It is not used directly, but through a [`SiteMethods`] instance.
19542///
19543/// # Example
19544///
19545/// Instantiate a resource method builder
19546///
19547/// ```test_harness,no_run
19548/// # extern crate hyper;
19549/// # extern crate hyper_rustls;
19550/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
19551/// use firebasehosting1_beta1::api::Domain;
19552/// # async fn dox() {
19553/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19554///
19555/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19556/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19557/// # .with_native_roots()
19558/// # .unwrap()
19559/// # .https_only()
19560/// # .enable_http2()
19561/// # .build();
19562///
19563/// # let executor = hyper_util::rt::TokioExecutor::new();
19564/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19565/// # secret,
19566/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19567/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19568/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19569/// # ),
19570/// # ).build().await.unwrap();
19571///
19572/// # let client = hyper_util::client::legacy::Client::builder(
19573/// # hyper_util::rt::TokioExecutor::new()
19574/// # )
19575/// # .build(
19576/// # hyper_rustls::HttpsConnectorBuilder::new()
19577/// # .with_native_roots()
19578/// # .unwrap()
19579/// # .https_or_http()
19580/// # .enable_http2()
19581/// # .build()
19582/// # );
19583/// # let mut hub = FirebaseHosting::new(client, auth);
19584/// // As the method needs a request, you would usually fill it with the desired information
19585/// // into the respective structure. Some of the parts shown here might not be applicable !
19586/// // Values shown here are possibly random and not representative !
19587/// let mut req = Domain::default();
19588///
19589/// // You can configure optional parameters by calling the respective setters at will, and
19590/// // execute the final call using `doit()`.
19591/// // Values shown here are possibly random and not representative !
19592/// let result = hub.sites().domains_update(req, "name")
19593/// .doit().await;
19594/// # }
19595/// ```
19596pub struct SiteDomainUpdateCall<'a, C>
19597where
19598 C: 'a,
19599{
19600 hub: &'a FirebaseHosting<C>,
19601 _request: Domain,
19602 _name: String,
19603 _delegate: Option<&'a mut dyn common::Delegate>,
19604 _additional_params: HashMap<String, String>,
19605 _scopes: BTreeSet<String>,
19606}
19607
19608impl<'a, C> common::CallBuilder for SiteDomainUpdateCall<'a, C> {}
19609
19610impl<'a, C> SiteDomainUpdateCall<'a, C>
19611where
19612 C: common::Connector,
19613{
19614 /// Perform the operation you have build so far.
19615 pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
19616 use std::borrow::Cow;
19617 use std::io::{Read, Seek};
19618
19619 use common::{url::Params, ToParts};
19620 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19621
19622 let mut dd = common::DefaultDelegate;
19623 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19624 dlg.begin(common::MethodInfo {
19625 id: "firebasehosting.sites.domains.update",
19626 http_method: hyper::Method::PUT,
19627 });
19628
19629 for &field in ["alt", "name"].iter() {
19630 if self._additional_params.contains_key(field) {
19631 dlg.finished(false);
19632 return Err(common::Error::FieldClash(field));
19633 }
19634 }
19635
19636 let mut params = Params::with_capacity(4 + self._additional_params.len());
19637 params.push("name", self._name);
19638
19639 params.extend(self._additional_params.iter());
19640
19641 params.push("alt", "json");
19642 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
19643 if self._scopes.is_empty() {
19644 self._scopes
19645 .insert(Scope::CloudPlatform.as_ref().to_string());
19646 }
19647
19648 #[allow(clippy::single_element_loop)]
19649 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19650 url = params.uri_replacement(url, param_name, find_this, true);
19651 }
19652 {
19653 let to_remove = ["name"];
19654 params.remove_params(&to_remove);
19655 }
19656
19657 let url = params.parse_with_url(&url);
19658
19659 let mut json_mime_type = mime::APPLICATION_JSON;
19660 let mut request_value_reader = {
19661 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19662 common::remove_json_null_values(&mut value);
19663 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19664 serde_json::to_writer(&mut dst, &value).unwrap();
19665 dst
19666 };
19667 let request_size = request_value_reader
19668 .seek(std::io::SeekFrom::End(0))
19669 .unwrap();
19670 request_value_reader
19671 .seek(std::io::SeekFrom::Start(0))
19672 .unwrap();
19673
19674 loop {
19675 let token = match self
19676 .hub
19677 .auth
19678 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19679 .await
19680 {
19681 Ok(token) => token,
19682 Err(e) => match dlg.token(e) {
19683 Ok(token) => token,
19684 Err(e) => {
19685 dlg.finished(false);
19686 return Err(common::Error::MissingToken(e));
19687 }
19688 },
19689 };
19690 request_value_reader
19691 .seek(std::io::SeekFrom::Start(0))
19692 .unwrap();
19693 let mut req_result = {
19694 let client = &self.hub.client;
19695 dlg.pre_request();
19696 let mut req_builder = hyper::Request::builder()
19697 .method(hyper::Method::PUT)
19698 .uri(url.as_str())
19699 .header(USER_AGENT, self.hub._user_agent.clone());
19700
19701 if let Some(token) = token.as_ref() {
19702 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19703 }
19704
19705 let request = req_builder
19706 .header(CONTENT_TYPE, json_mime_type.to_string())
19707 .header(CONTENT_LENGTH, request_size as u64)
19708 .body(common::to_body(
19709 request_value_reader.get_ref().clone().into(),
19710 ));
19711
19712 client.request(request.unwrap()).await
19713 };
19714
19715 match req_result {
19716 Err(err) => {
19717 if let common::Retry::After(d) = dlg.http_error(&err) {
19718 sleep(d).await;
19719 continue;
19720 }
19721 dlg.finished(false);
19722 return Err(common::Error::HttpError(err));
19723 }
19724 Ok(res) => {
19725 let (mut parts, body) = res.into_parts();
19726 let mut body = common::Body::new(body);
19727 if !parts.status.is_success() {
19728 let bytes = common::to_bytes(body).await.unwrap_or_default();
19729 let error = serde_json::from_str(&common::to_string(&bytes));
19730 let response = common::to_response(parts, bytes.into());
19731
19732 if let common::Retry::After(d) =
19733 dlg.http_failure(&response, error.as_ref().ok())
19734 {
19735 sleep(d).await;
19736 continue;
19737 }
19738
19739 dlg.finished(false);
19740
19741 return Err(match error {
19742 Ok(value) => common::Error::BadRequest(value),
19743 _ => common::Error::Failure(response),
19744 });
19745 }
19746 let response = {
19747 let bytes = common::to_bytes(body).await.unwrap_or_default();
19748 let encoded = common::to_string(&bytes);
19749 match serde_json::from_str(&encoded) {
19750 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19751 Err(error) => {
19752 dlg.response_json_decode_error(&encoded, &error);
19753 return Err(common::Error::JsonDecodeError(
19754 encoded.to_string(),
19755 error,
19756 ));
19757 }
19758 }
19759 };
19760
19761 dlg.finished(true);
19762 return Ok(response);
19763 }
19764 }
19765 }
19766 }
19767
19768 ///
19769 /// Sets the *request* property to the given value.
19770 ///
19771 /// Even though the property as already been set when instantiating this call,
19772 /// we provide this method for API completeness.
19773 pub fn request(mut self, new_value: Domain) -> SiteDomainUpdateCall<'a, C> {
19774 self._request = new_value;
19775 self
19776 }
19777 /// Required. The name of the domain association to update or create, if an association doesn't already exist.
19778 ///
19779 /// Sets the *name* path property to the given value.
19780 ///
19781 /// Even though the property as already been set when instantiating this call,
19782 /// we provide this method for API completeness.
19783 pub fn name(mut self, new_value: &str) -> SiteDomainUpdateCall<'a, C> {
19784 self._name = new_value.to_string();
19785 self
19786 }
19787 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19788 /// while executing the actual API request.
19789 ///
19790 /// ````text
19791 /// It should be used to handle progress information, and to implement a certain level of resilience.
19792 /// ````
19793 ///
19794 /// Sets the *delegate* property to the given value.
19795 pub fn delegate(
19796 mut self,
19797 new_value: &'a mut dyn common::Delegate,
19798 ) -> SiteDomainUpdateCall<'a, C> {
19799 self._delegate = Some(new_value);
19800 self
19801 }
19802
19803 /// Set any additional parameter of the query string used in the request.
19804 /// It should be used to set parameters which are not yet available through their own
19805 /// setters.
19806 ///
19807 /// Please note that this method must not be used to set any of the known parameters
19808 /// which have their own setter method. If done anyway, the request will fail.
19809 ///
19810 /// # Additional Parameters
19811 ///
19812 /// * *$.xgafv* (query-string) - V1 error format.
19813 /// * *access_token* (query-string) - OAuth access token.
19814 /// * *alt* (query-string) - Data format for response.
19815 /// * *callback* (query-string) - JSONP
19816 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19817 /// * *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.
19818 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19819 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19820 /// * *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.
19821 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19822 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19823 pub fn param<T>(mut self, name: T, value: T) -> SiteDomainUpdateCall<'a, C>
19824 where
19825 T: AsRef<str>,
19826 {
19827 self._additional_params
19828 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19829 self
19830 }
19831
19832 /// Identifies the authorization scope for the method you are building.
19833 ///
19834 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19835 /// [`Scope::CloudPlatform`].
19836 ///
19837 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19838 /// tokens for more than one scope.
19839 ///
19840 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19841 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19842 /// sufficient, a read-write scope will do as well.
19843 pub fn add_scope<St>(mut self, scope: St) -> SiteDomainUpdateCall<'a, C>
19844 where
19845 St: AsRef<str>,
19846 {
19847 self._scopes.insert(String::from(scope.as_ref()));
19848 self
19849 }
19850 /// Identifies the authorization scope(s) for the method you are building.
19851 ///
19852 /// See [`Self::add_scope()`] for details.
19853 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteDomainUpdateCall<'a, C>
19854 where
19855 I: IntoIterator<Item = St>,
19856 St: AsRef<str>,
19857 {
19858 self._scopes
19859 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19860 self
19861 }
19862
19863 /// Removes all scopes, and no default scope will be used either.
19864 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19865 /// for details).
19866 pub fn clear_scopes(mut self) -> SiteDomainUpdateCall<'a, C> {
19867 self._scopes.clear();
19868 self
19869 }
19870}
19871
19872/// Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).
19873///
19874/// A builder for the *releases.create* method supported by a *site* resource.
19875/// It is not used directly, but through a [`SiteMethods`] instance.
19876///
19877/// # Example
19878///
19879/// Instantiate a resource method builder
19880///
19881/// ```test_harness,no_run
19882/// # extern crate hyper;
19883/// # extern crate hyper_rustls;
19884/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
19885/// use firebasehosting1_beta1::api::Release;
19886/// # async fn dox() {
19887/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19888///
19889/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19890/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19891/// # .with_native_roots()
19892/// # .unwrap()
19893/// # .https_only()
19894/// # .enable_http2()
19895/// # .build();
19896///
19897/// # let executor = hyper_util::rt::TokioExecutor::new();
19898/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19899/// # secret,
19900/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19901/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19902/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19903/// # ),
19904/// # ).build().await.unwrap();
19905///
19906/// # let client = hyper_util::client::legacy::Client::builder(
19907/// # hyper_util::rt::TokioExecutor::new()
19908/// # )
19909/// # .build(
19910/// # hyper_rustls::HttpsConnectorBuilder::new()
19911/// # .with_native_roots()
19912/// # .unwrap()
19913/// # .https_or_http()
19914/// # .enable_http2()
19915/// # .build()
19916/// # );
19917/// # let mut hub = FirebaseHosting::new(client, auth);
19918/// // As the method needs a request, you would usually fill it with the desired information
19919/// // into the respective structure. Some of the parts shown here might not be applicable !
19920/// // Values shown here are possibly random and not representative !
19921/// let mut req = Release::default();
19922///
19923/// // You can configure optional parameters by calling the respective setters at will, and
19924/// // execute the final call using `doit()`.
19925/// // Values shown here are possibly random and not representative !
19926/// let result = hub.sites().releases_create(req, "parent")
19927/// .version_name("sed")
19928/// .doit().await;
19929/// # }
19930/// ```
19931pub struct SiteReleaseCreateCall<'a, C>
19932where
19933 C: 'a,
19934{
19935 hub: &'a FirebaseHosting<C>,
19936 _request: Release,
19937 _parent: String,
19938 _version_name: Option<String>,
19939 _delegate: Option<&'a mut dyn common::Delegate>,
19940 _additional_params: HashMap<String, String>,
19941 _scopes: BTreeSet<String>,
19942}
19943
19944impl<'a, C> common::CallBuilder for SiteReleaseCreateCall<'a, C> {}
19945
19946impl<'a, C> SiteReleaseCreateCall<'a, C>
19947where
19948 C: common::Connector,
19949{
19950 /// Perform the operation you have build so far.
19951 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
19952 use std::borrow::Cow;
19953 use std::io::{Read, Seek};
19954
19955 use common::{url::Params, ToParts};
19956 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19957
19958 let mut dd = common::DefaultDelegate;
19959 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19960 dlg.begin(common::MethodInfo {
19961 id: "firebasehosting.sites.releases.create",
19962 http_method: hyper::Method::POST,
19963 });
19964
19965 for &field in ["alt", "parent", "versionName"].iter() {
19966 if self._additional_params.contains_key(field) {
19967 dlg.finished(false);
19968 return Err(common::Error::FieldClash(field));
19969 }
19970 }
19971
19972 let mut params = Params::with_capacity(5 + self._additional_params.len());
19973 params.push("parent", self._parent);
19974 if let Some(value) = self._version_name.as_ref() {
19975 params.push("versionName", value);
19976 }
19977
19978 params.extend(self._additional_params.iter());
19979
19980 params.push("alt", "json");
19981 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
19982 if self._scopes.is_empty() {
19983 self._scopes
19984 .insert(Scope::CloudPlatform.as_ref().to_string());
19985 }
19986
19987 #[allow(clippy::single_element_loop)]
19988 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19989 url = params.uri_replacement(url, param_name, find_this, true);
19990 }
19991 {
19992 let to_remove = ["parent"];
19993 params.remove_params(&to_remove);
19994 }
19995
19996 let url = params.parse_with_url(&url);
19997
19998 let mut json_mime_type = mime::APPLICATION_JSON;
19999 let mut request_value_reader = {
20000 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20001 common::remove_json_null_values(&mut value);
20002 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20003 serde_json::to_writer(&mut dst, &value).unwrap();
20004 dst
20005 };
20006 let request_size = request_value_reader
20007 .seek(std::io::SeekFrom::End(0))
20008 .unwrap();
20009 request_value_reader
20010 .seek(std::io::SeekFrom::Start(0))
20011 .unwrap();
20012
20013 loop {
20014 let token = match self
20015 .hub
20016 .auth
20017 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20018 .await
20019 {
20020 Ok(token) => token,
20021 Err(e) => match dlg.token(e) {
20022 Ok(token) => token,
20023 Err(e) => {
20024 dlg.finished(false);
20025 return Err(common::Error::MissingToken(e));
20026 }
20027 },
20028 };
20029 request_value_reader
20030 .seek(std::io::SeekFrom::Start(0))
20031 .unwrap();
20032 let mut req_result = {
20033 let client = &self.hub.client;
20034 dlg.pre_request();
20035 let mut req_builder = hyper::Request::builder()
20036 .method(hyper::Method::POST)
20037 .uri(url.as_str())
20038 .header(USER_AGENT, self.hub._user_agent.clone());
20039
20040 if let Some(token) = token.as_ref() {
20041 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20042 }
20043
20044 let request = req_builder
20045 .header(CONTENT_TYPE, json_mime_type.to_string())
20046 .header(CONTENT_LENGTH, request_size as u64)
20047 .body(common::to_body(
20048 request_value_reader.get_ref().clone().into(),
20049 ));
20050
20051 client.request(request.unwrap()).await
20052 };
20053
20054 match req_result {
20055 Err(err) => {
20056 if let common::Retry::After(d) = dlg.http_error(&err) {
20057 sleep(d).await;
20058 continue;
20059 }
20060 dlg.finished(false);
20061 return Err(common::Error::HttpError(err));
20062 }
20063 Ok(res) => {
20064 let (mut parts, body) = res.into_parts();
20065 let mut body = common::Body::new(body);
20066 if !parts.status.is_success() {
20067 let bytes = common::to_bytes(body).await.unwrap_or_default();
20068 let error = serde_json::from_str(&common::to_string(&bytes));
20069 let response = common::to_response(parts, bytes.into());
20070
20071 if let common::Retry::After(d) =
20072 dlg.http_failure(&response, error.as_ref().ok())
20073 {
20074 sleep(d).await;
20075 continue;
20076 }
20077
20078 dlg.finished(false);
20079
20080 return Err(match error {
20081 Ok(value) => common::Error::BadRequest(value),
20082 _ => common::Error::Failure(response),
20083 });
20084 }
20085 let response = {
20086 let bytes = common::to_bytes(body).await.unwrap_or_default();
20087 let encoded = common::to_string(&bytes);
20088 match serde_json::from_str(&encoded) {
20089 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20090 Err(error) => {
20091 dlg.response_json_decode_error(&encoded, &error);
20092 return Err(common::Error::JsonDecodeError(
20093 encoded.to_string(),
20094 error,
20095 ));
20096 }
20097 }
20098 };
20099
20100 dlg.finished(true);
20101 return Ok(response);
20102 }
20103 }
20104 }
20105 }
20106
20107 ///
20108 /// Sets the *request* property to the given value.
20109 ///
20110 /// Even though the property as already been set when instantiating this call,
20111 /// we provide this method for API completeness.
20112 pub fn request(mut self, new_value: Release) -> SiteReleaseCreateCall<'a, C> {
20113 self._request = new_value;
20114 self
20115 }
20116 /// 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
20117 ///
20118 /// Sets the *parent* path property to the given value.
20119 ///
20120 /// Even though the property as already been set when instantiating this call,
20121 /// we provide this method for API completeness.
20122 pub fn parent(mut self, new_value: &str) -> SiteReleaseCreateCall<'a, C> {
20123 self._parent = new_value.to_string();
20124 self
20125 }
20126 /// 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`.
20127 ///
20128 /// Sets the *version name* query property to the given value.
20129 pub fn version_name(mut self, new_value: &str) -> SiteReleaseCreateCall<'a, C> {
20130 self._version_name = Some(new_value.to_string());
20131 self
20132 }
20133 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20134 /// while executing the actual API request.
20135 ///
20136 /// ````text
20137 /// It should be used to handle progress information, and to implement a certain level of resilience.
20138 /// ````
20139 ///
20140 /// Sets the *delegate* property to the given value.
20141 pub fn delegate(
20142 mut self,
20143 new_value: &'a mut dyn common::Delegate,
20144 ) -> SiteReleaseCreateCall<'a, C> {
20145 self._delegate = Some(new_value);
20146 self
20147 }
20148
20149 /// Set any additional parameter of the query string used in the request.
20150 /// It should be used to set parameters which are not yet available through their own
20151 /// setters.
20152 ///
20153 /// Please note that this method must not be used to set any of the known parameters
20154 /// which have their own setter method. If done anyway, the request will fail.
20155 ///
20156 /// # Additional Parameters
20157 ///
20158 /// * *$.xgafv* (query-string) - V1 error format.
20159 /// * *access_token* (query-string) - OAuth access token.
20160 /// * *alt* (query-string) - Data format for response.
20161 /// * *callback* (query-string) - JSONP
20162 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20163 /// * *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.
20164 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20165 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20166 /// * *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.
20167 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20168 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20169 pub fn param<T>(mut self, name: T, value: T) -> SiteReleaseCreateCall<'a, C>
20170 where
20171 T: AsRef<str>,
20172 {
20173 self._additional_params
20174 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20175 self
20176 }
20177
20178 /// Identifies the authorization scope for the method you are building.
20179 ///
20180 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20181 /// [`Scope::CloudPlatform`].
20182 ///
20183 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20184 /// tokens for more than one scope.
20185 ///
20186 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20187 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20188 /// sufficient, a read-write scope will do as well.
20189 pub fn add_scope<St>(mut self, scope: St) -> SiteReleaseCreateCall<'a, C>
20190 where
20191 St: AsRef<str>,
20192 {
20193 self._scopes.insert(String::from(scope.as_ref()));
20194 self
20195 }
20196 /// Identifies the authorization scope(s) for the method you are building.
20197 ///
20198 /// See [`Self::add_scope()`] for details.
20199 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteReleaseCreateCall<'a, C>
20200 where
20201 I: IntoIterator<Item = St>,
20202 St: AsRef<str>,
20203 {
20204 self._scopes
20205 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20206 self
20207 }
20208
20209 /// Removes all scopes, and no default scope will be used either.
20210 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20211 /// for details).
20212 pub fn clear_scopes(mut self) -> SiteReleaseCreateCall<'a, C> {
20213 self._scopes.clear();
20214 self
20215 }
20216}
20217
20218/// 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.
20219///
20220/// A builder for the *releases.get* method supported by a *site* resource.
20221/// It is not used directly, but through a [`SiteMethods`] instance.
20222///
20223/// # Example
20224///
20225/// Instantiate a resource method builder
20226///
20227/// ```test_harness,no_run
20228/// # extern crate hyper;
20229/// # extern crate hyper_rustls;
20230/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
20231/// # async fn dox() {
20232/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20233///
20234/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20235/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20236/// # .with_native_roots()
20237/// # .unwrap()
20238/// # .https_only()
20239/// # .enable_http2()
20240/// # .build();
20241///
20242/// # let executor = hyper_util::rt::TokioExecutor::new();
20243/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20244/// # secret,
20245/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20246/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20247/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20248/// # ),
20249/// # ).build().await.unwrap();
20250///
20251/// # let client = hyper_util::client::legacy::Client::builder(
20252/// # hyper_util::rt::TokioExecutor::new()
20253/// # )
20254/// # .build(
20255/// # hyper_rustls::HttpsConnectorBuilder::new()
20256/// # .with_native_roots()
20257/// # .unwrap()
20258/// # .https_or_http()
20259/// # .enable_http2()
20260/// # .build()
20261/// # );
20262/// # let mut hub = FirebaseHosting::new(client, auth);
20263/// // You can configure optional parameters by calling the respective setters at will, and
20264/// // execute the final call using `doit()`.
20265/// // Values shown here are possibly random and not representative !
20266/// let result = hub.sites().releases_get("name")
20267/// .doit().await;
20268/// # }
20269/// ```
20270pub struct SiteReleaseGetCall<'a, C>
20271where
20272 C: 'a,
20273{
20274 hub: &'a FirebaseHosting<C>,
20275 _name: String,
20276 _delegate: Option<&'a mut dyn common::Delegate>,
20277 _additional_params: HashMap<String, String>,
20278 _scopes: BTreeSet<String>,
20279}
20280
20281impl<'a, C> common::CallBuilder for SiteReleaseGetCall<'a, C> {}
20282
20283impl<'a, C> SiteReleaseGetCall<'a, C>
20284where
20285 C: common::Connector,
20286{
20287 /// Perform the operation you have build so far.
20288 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
20289 use std::borrow::Cow;
20290 use std::io::{Read, Seek};
20291
20292 use common::{url::Params, ToParts};
20293 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20294
20295 let mut dd = common::DefaultDelegate;
20296 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20297 dlg.begin(common::MethodInfo {
20298 id: "firebasehosting.sites.releases.get",
20299 http_method: hyper::Method::GET,
20300 });
20301
20302 for &field in ["alt", "name"].iter() {
20303 if self._additional_params.contains_key(field) {
20304 dlg.finished(false);
20305 return Err(common::Error::FieldClash(field));
20306 }
20307 }
20308
20309 let mut params = Params::with_capacity(3 + self._additional_params.len());
20310 params.push("name", self._name);
20311
20312 params.extend(self._additional_params.iter());
20313
20314 params.push("alt", "json");
20315 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
20316 if self._scopes.is_empty() {
20317 self._scopes
20318 .insert(Scope::FirebaseReadonly.as_ref().to_string());
20319 }
20320
20321 #[allow(clippy::single_element_loop)]
20322 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20323 url = params.uri_replacement(url, param_name, find_this, true);
20324 }
20325 {
20326 let to_remove = ["name"];
20327 params.remove_params(&to_remove);
20328 }
20329
20330 let url = params.parse_with_url(&url);
20331
20332 loop {
20333 let token = match self
20334 .hub
20335 .auth
20336 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20337 .await
20338 {
20339 Ok(token) => token,
20340 Err(e) => match dlg.token(e) {
20341 Ok(token) => token,
20342 Err(e) => {
20343 dlg.finished(false);
20344 return Err(common::Error::MissingToken(e));
20345 }
20346 },
20347 };
20348 let mut req_result = {
20349 let client = &self.hub.client;
20350 dlg.pre_request();
20351 let mut req_builder = hyper::Request::builder()
20352 .method(hyper::Method::GET)
20353 .uri(url.as_str())
20354 .header(USER_AGENT, self.hub._user_agent.clone());
20355
20356 if let Some(token) = token.as_ref() {
20357 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20358 }
20359
20360 let request = req_builder
20361 .header(CONTENT_LENGTH, 0_u64)
20362 .body(common::to_body::<String>(None));
20363
20364 client.request(request.unwrap()).await
20365 };
20366
20367 match req_result {
20368 Err(err) => {
20369 if let common::Retry::After(d) = dlg.http_error(&err) {
20370 sleep(d).await;
20371 continue;
20372 }
20373 dlg.finished(false);
20374 return Err(common::Error::HttpError(err));
20375 }
20376 Ok(res) => {
20377 let (mut parts, body) = res.into_parts();
20378 let mut body = common::Body::new(body);
20379 if !parts.status.is_success() {
20380 let bytes = common::to_bytes(body).await.unwrap_or_default();
20381 let error = serde_json::from_str(&common::to_string(&bytes));
20382 let response = common::to_response(parts, bytes.into());
20383
20384 if let common::Retry::After(d) =
20385 dlg.http_failure(&response, error.as_ref().ok())
20386 {
20387 sleep(d).await;
20388 continue;
20389 }
20390
20391 dlg.finished(false);
20392
20393 return Err(match error {
20394 Ok(value) => common::Error::BadRequest(value),
20395 _ => common::Error::Failure(response),
20396 });
20397 }
20398 let response = {
20399 let bytes = common::to_bytes(body).await.unwrap_or_default();
20400 let encoded = common::to_string(&bytes);
20401 match serde_json::from_str(&encoded) {
20402 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20403 Err(error) => {
20404 dlg.response_json_decode_error(&encoded, &error);
20405 return Err(common::Error::JsonDecodeError(
20406 encoded.to_string(),
20407 error,
20408 ));
20409 }
20410 }
20411 };
20412
20413 dlg.finished(true);
20414 return Ok(response);
20415 }
20416 }
20417 }
20418 }
20419
20420 /// 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
20421 ///
20422 /// Sets the *name* path property to the given value.
20423 ///
20424 /// Even though the property as already been set when instantiating this call,
20425 /// we provide this method for API completeness.
20426 pub fn name(mut self, new_value: &str) -> SiteReleaseGetCall<'a, C> {
20427 self._name = new_value.to_string();
20428 self
20429 }
20430 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20431 /// while executing the actual API request.
20432 ///
20433 /// ````text
20434 /// It should be used to handle progress information, and to implement a certain level of resilience.
20435 /// ````
20436 ///
20437 /// Sets the *delegate* property to the given value.
20438 pub fn delegate(
20439 mut self,
20440 new_value: &'a mut dyn common::Delegate,
20441 ) -> SiteReleaseGetCall<'a, C> {
20442 self._delegate = Some(new_value);
20443 self
20444 }
20445
20446 /// Set any additional parameter of the query string used in the request.
20447 /// It should be used to set parameters which are not yet available through their own
20448 /// setters.
20449 ///
20450 /// Please note that this method must not be used to set any of the known parameters
20451 /// which have their own setter method. If done anyway, the request will fail.
20452 ///
20453 /// # Additional Parameters
20454 ///
20455 /// * *$.xgafv* (query-string) - V1 error format.
20456 /// * *access_token* (query-string) - OAuth access token.
20457 /// * *alt* (query-string) - Data format for response.
20458 /// * *callback* (query-string) - JSONP
20459 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20460 /// * *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.
20461 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20462 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20463 /// * *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.
20464 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20465 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20466 pub fn param<T>(mut self, name: T, value: T) -> SiteReleaseGetCall<'a, C>
20467 where
20468 T: AsRef<str>,
20469 {
20470 self._additional_params
20471 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20472 self
20473 }
20474
20475 /// Identifies the authorization scope for the method you are building.
20476 ///
20477 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20478 /// [`Scope::FirebaseReadonly`].
20479 ///
20480 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20481 /// tokens for more than one scope.
20482 ///
20483 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20484 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20485 /// sufficient, a read-write scope will do as well.
20486 pub fn add_scope<St>(mut self, scope: St) -> SiteReleaseGetCall<'a, C>
20487 where
20488 St: AsRef<str>,
20489 {
20490 self._scopes.insert(String::from(scope.as_ref()));
20491 self
20492 }
20493 /// Identifies the authorization scope(s) for the method you are building.
20494 ///
20495 /// See [`Self::add_scope()`] for details.
20496 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteReleaseGetCall<'a, C>
20497 where
20498 I: IntoIterator<Item = St>,
20499 St: AsRef<str>,
20500 {
20501 self._scopes
20502 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20503 self
20504 }
20505
20506 /// Removes all scopes, and no default scope will be used either.
20507 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20508 /// for details).
20509 pub fn clear_scopes(mut self) -> SiteReleaseGetCall<'a, C> {
20510 self._scopes.clear();
20511 self
20512 }
20513}
20514
20515/// 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.
20516///
20517/// A builder for the *releases.list* method supported by a *site* resource.
20518/// It is not used directly, but through a [`SiteMethods`] instance.
20519///
20520/// # Example
20521///
20522/// Instantiate a resource method builder
20523///
20524/// ```test_harness,no_run
20525/// # extern crate hyper;
20526/// # extern crate hyper_rustls;
20527/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
20528/// # async fn dox() {
20529/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20530///
20531/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20532/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20533/// # .with_native_roots()
20534/// # .unwrap()
20535/// # .https_only()
20536/// # .enable_http2()
20537/// # .build();
20538///
20539/// # let executor = hyper_util::rt::TokioExecutor::new();
20540/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20541/// # secret,
20542/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20543/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20544/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20545/// # ),
20546/// # ).build().await.unwrap();
20547///
20548/// # let client = hyper_util::client::legacy::Client::builder(
20549/// # hyper_util::rt::TokioExecutor::new()
20550/// # )
20551/// # .build(
20552/// # hyper_rustls::HttpsConnectorBuilder::new()
20553/// # .with_native_roots()
20554/// # .unwrap()
20555/// # .https_or_http()
20556/// # .enable_http2()
20557/// # .build()
20558/// # );
20559/// # let mut hub = FirebaseHosting::new(client, auth);
20560/// // You can configure optional parameters by calling the respective setters at will, and
20561/// // execute the final call using `doit()`.
20562/// // Values shown here are possibly random and not representative !
20563/// let result = hub.sites().releases_list("parent")
20564/// .page_token("At")
20565/// .page_size(-45)
20566/// .doit().await;
20567/// # }
20568/// ```
20569pub struct SiteReleaseListCall<'a, C>
20570where
20571 C: 'a,
20572{
20573 hub: &'a FirebaseHosting<C>,
20574 _parent: String,
20575 _page_token: Option<String>,
20576 _page_size: Option<i32>,
20577 _delegate: Option<&'a mut dyn common::Delegate>,
20578 _additional_params: HashMap<String, String>,
20579 _scopes: BTreeSet<String>,
20580}
20581
20582impl<'a, C> common::CallBuilder for SiteReleaseListCall<'a, C> {}
20583
20584impl<'a, C> SiteReleaseListCall<'a, C>
20585where
20586 C: common::Connector,
20587{
20588 /// Perform the operation you have build so far.
20589 pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
20590 use std::borrow::Cow;
20591 use std::io::{Read, Seek};
20592
20593 use common::{url::Params, ToParts};
20594 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20595
20596 let mut dd = common::DefaultDelegate;
20597 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20598 dlg.begin(common::MethodInfo {
20599 id: "firebasehosting.sites.releases.list",
20600 http_method: hyper::Method::GET,
20601 });
20602
20603 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
20604 if self._additional_params.contains_key(field) {
20605 dlg.finished(false);
20606 return Err(common::Error::FieldClash(field));
20607 }
20608 }
20609
20610 let mut params = Params::with_capacity(5 + self._additional_params.len());
20611 params.push("parent", self._parent);
20612 if let Some(value) = self._page_token.as_ref() {
20613 params.push("pageToken", value);
20614 }
20615 if let Some(value) = self._page_size.as_ref() {
20616 params.push("pageSize", value.to_string());
20617 }
20618
20619 params.extend(self._additional_params.iter());
20620
20621 params.push("alt", "json");
20622 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/releases";
20623 if self._scopes.is_empty() {
20624 self._scopes
20625 .insert(Scope::FirebaseReadonly.as_ref().to_string());
20626 }
20627
20628 #[allow(clippy::single_element_loop)]
20629 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20630 url = params.uri_replacement(url, param_name, find_this, true);
20631 }
20632 {
20633 let to_remove = ["parent"];
20634 params.remove_params(&to_remove);
20635 }
20636
20637 let url = params.parse_with_url(&url);
20638
20639 loop {
20640 let token = match self
20641 .hub
20642 .auth
20643 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20644 .await
20645 {
20646 Ok(token) => token,
20647 Err(e) => match dlg.token(e) {
20648 Ok(token) => token,
20649 Err(e) => {
20650 dlg.finished(false);
20651 return Err(common::Error::MissingToken(e));
20652 }
20653 },
20654 };
20655 let mut req_result = {
20656 let client = &self.hub.client;
20657 dlg.pre_request();
20658 let mut req_builder = hyper::Request::builder()
20659 .method(hyper::Method::GET)
20660 .uri(url.as_str())
20661 .header(USER_AGENT, self.hub._user_agent.clone());
20662
20663 if let Some(token) = token.as_ref() {
20664 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20665 }
20666
20667 let request = req_builder
20668 .header(CONTENT_LENGTH, 0_u64)
20669 .body(common::to_body::<String>(None));
20670
20671 client.request(request.unwrap()).await
20672 };
20673
20674 match req_result {
20675 Err(err) => {
20676 if let common::Retry::After(d) = dlg.http_error(&err) {
20677 sleep(d).await;
20678 continue;
20679 }
20680 dlg.finished(false);
20681 return Err(common::Error::HttpError(err));
20682 }
20683 Ok(res) => {
20684 let (mut parts, body) = res.into_parts();
20685 let mut body = common::Body::new(body);
20686 if !parts.status.is_success() {
20687 let bytes = common::to_bytes(body).await.unwrap_or_default();
20688 let error = serde_json::from_str(&common::to_string(&bytes));
20689 let response = common::to_response(parts, bytes.into());
20690
20691 if let common::Retry::After(d) =
20692 dlg.http_failure(&response, error.as_ref().ok())
20693 {
20694 sleep(d).await;
20695 continue;
20696 }
20697
20698 dlg.finished(false);
20699
20700 return Err(match error {
20701 Ok(value) => common::Error::BadRequest(value),
20702 _ => common::Error::Failure(response),
20703 });
20704 }
20705 let response = {
20706 let bytes = common::to_bytes(body).await.unwrap_or_default();
20707 let encoded = common::to_string(&bytes);
20708 match serde_json::from_str(&encoded) {
20709 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20710 Err(error) => {
20711 dlg.response_json_decode_error(&encoded, &error);
20712 return Err(common::Error::JsonDecodeError(
20713 encoded.to_string(),
20714 error,
20715 ));
20716 }
20717 }
20718 };
20719
20720 dlg.finished(true);
20721 return Ok(response);
20722 }
20723 }
20724 }
20725 }
20726
20727 /// 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
20728 ///
20729 /// Sets the *parent* path property to the given value.
20730 ///
20731 /// Even though the property as already been set when instantiating this call,
20732 /// we provide this method for API completeness.
20733 pub fn parent(mut self, new_value: &str) -> SiteReleaseListCall<'a, C> {
20734 self._parent = new_value.to_string();
20735 self
20736 }
20737 /// A token from a previous call to `releases.list` or `channels.releases.list` that tells the server where to resume listing.
20738 ///
20739 /// Sets the *page token* query property to the given value.
20740 pub fn page_token(mut self, new_value: &str) -> SiteReleaseListCall<'a, C> {
20741 self._page_token = Some(new_value.to_string());
20742 self
20743 }
20744 /// 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.
20745 ///
20746 /// Sets the *page size* query property to the given value.
20747 pub fn page_size(mut self, new_value: i32) -> SiteReleaseListCall<'a, C> {
20748 self._page_size = Some(new_value);
20749 self
20750 }
20751 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20752 /// while executing the actual API request.
20753 ///
20754 /// ````text
20755 /// It should be used to handle progress information, and to implement a certain level of resilience.
20756 /// ````
20757 ///
20758 /// Sets the *delegate* property to the given value.
20759 pub fn delegate(
20760 mut self,
20761 new_value: &'a mut dyn common::Delegate,
20762 ) -> SiteReleaseListCall<'a, C> {
20763 self._delegate = Some(new_value);
20764 self
20765 }
20766
20767 /// Set any additional parameter of the query string used in the request.
20768 /// It should be used to set parameters which are not yet available through their own
20769 /// setters.
20770 ///
20771 /// Please note that this method must not be used to set any of the known parameters
20772 /// which have their own setter method. If done anyway, the request will fail.
20773 ///
20774 /// # Additional Parameters
20775 ///
20776 /// * *$.xgafv* (query-string) - V1 error format.
20777 /// * *access_token* (query-string) - OAuth access token.
20778 /// * *alt* (query-string) - Data format for response.
20779 /// * *callback* (query-string) - JSONP
20780 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20781 /// * *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.
20782 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20783 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20784 /// * *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.
20785 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20786 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20787 pub fn param<T>(mut self, name: T, value: T) -> SiteReleaseListCall<'a, C>
20788 where
20789 T: AsRef<str>,
20790 {
20791 self._additional_params
20792 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20793 self
20794 }
20795
20796 /// Identifies the authorization scope for the method you are building.
20797 ///
20798 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20799 /// [`Scope::FirebaseReadonly`].
20800 ///
20801 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20802 /// tokens for more than one scope.
20803 ///
20804 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20805 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20806 /// sufficient, a read-write scope will do as well.
20807 pub fn add_scope<St>(mut self, scope: St) -> SiteReleaseListCall<'a, C>
20808 where
20809 St: AsRef<str>,
20810 {
20811 self._scopes.insert(String::from(scope.as_ref()));
20812 self
20813 }
20814 /// Identifies the authorization scope(s) for the method you are building.
20815 ///
20816 /// See [`Self::add_scope()`] for details.
20817 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteReleaseListCall<'a, C>
20818 where
20819 I: IntoIterator<Item = St>,
20820 St: AsRef<str>,
20821 {
20822 self._scopes
20823 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20824 self
20825 }
20826
20827 /// Removes all scopes, and no default scope will be used either.
20828 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20829 /// for details).
20830 pub fn clear_scopes(mut self) -> SiteReleaseListCall<'a, C> {
20831 self._scopes.clear();
20832 self
20833 }
20834}
20835
20836/// Lists the remaining files to be uploaded for the specified version.
20837///
20838/// A builder for the *versions.files.list* method supported by a *site* resource.
20839/// It is not used directly, but through a [`SiteMethods`] instance.
20840///
20841/// # Example
20842///
20843/// Instantiate a resource method builder
20844///
20845/// ```test_harness,no_run
20846/// # extern crate hyper;
20847/// # extern crate hyper_rustls;
20848/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
20849/// # async fn dox() {
20850/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20851///
20852/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20853/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20854/// # .with_native_roots()
20855/// # .unwrap()
20856/// # .https_only()
20857/// # .enable_http2()
20858/// # .build();
20859///
20860/// # let executor = hyper_util::rt::TokioExecutor::new();
20861/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20862/// # secret,
20863/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20864/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20865/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20866/// # ),
20867/// # ).build().await.unwrap();
20868///
20869/// # let client = hyper_util::client::legacy::Client::builder(
20870/// # hyper_util::rt::TokioExecutor::new()
20871/// # )
20872/// # .build(
20873/// # hyper_rustls::HttpsConnectorBuilder::new()
20874/// # .with_native_roots()
20875/// # .unwrap()
20876/// # .https_or_http()
20877/// # .enable_http2()
20878/// # .build()
20879/// # );
20880/// # let mut hub = FirebaseHosting::new(client, auth);
20881/// // You can configure optional parameters by calling the respective setters at will, and
20882/// // execute the final call using `doit()`.
20883/// // Values shown here are possibly random and not representative !
20884/// let result = hub.sites().versions_files_list("parent")
20885/// .status("dolores")
20886/// .page_token("sadipscing")
20887/// .page_size(-31)
20888/// .doit().await;
20889/// # }
20890/// ```
20891pub struct SiteVersionFileListCall<'a, C>
20892where
20893 C: 'a,
20894{
20895 hub: &'a FirebaseHosting<C>,
20896 _parent: String,
20897 _status: Option<String>,
20898 _page_token: Option<String>,
20899 _page_size: Option<i32>,
20900 _delegate: Option<&'a mut dyn common::Delegate>,
20901 _additional_params: HashMap<String, String>,
20902 _scopes: BTreeSet<String>,
20903}
20904
20905impl<'a, C> common::CallBuilder for SiteVersionFileListCall<'a, C> {}
20906
20907impl<'a, C> SiteVersionFileListCall<'a, C>
20908where
20909 C: common::Connector,
20910{
20911 /// Perform the operation you have build so far.
20912 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionFilesResponse)> {
20913 use std::borrow::Cow;
20914 use std::io::{Read, Seek};
20915
20916 use common::{url::Params, ToParts};
20917 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20918
20919 let mut dd = common::DefaultDelegate;
20920 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20921 dlg.begin(common::MethodInfo {
20922 id: "firebasehosting.sites.versions.files.list",
20923 http_method: hyper::Method::GET,
20924 });
20925
20926 for &field in ["alt", "parent", "status", "pageToken", "pageSize"].iter() {
20927 if self._additional_params.contains_key(field) {
20928 dlg.finished(false);
20929 return Err(common::Error::FieldClash(field));
20930 }
20931 }
20932
20933 let mut params = Params::with_capacity(6 + self._additional_params.len());
20934 params.push("parent", self._parent);
20935 if let Some(value) = self._status.as_ref() {
20936 params.push("status", value);
20937 }
20938 if let Some(value) = self._page_token.as_ref() {
20939 params.push("pageToken", value);
20940 }
20941 if let Some(value) = self._page_size.as_ref() {
20942 params.push("pageSize", value.to_string());
20943 }
20944
20945 params.extend(self._additional_params.iter());
20946
20947 params.push("alt", "json");
20948 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/files";
20949 if self._scopes.is_empty() {
20950 self._scopes
20951 .insert(Scope::FirebaseReadonly.as_ref().to_string());
20952 }
20953
20954 #[allow(clippy::single_element_loop)]
20955 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20956 url = params.uri_replacement(url, param_name, find_this, true);
20957 }
20958 {
20959 let to_remove = ["parent"];
20960 params.remove_params(&to_remove);
20961 }
20962
20963 let url = params.parse_with_url(&url);
20964
20965 loop {
20966 let token = match self
20967 .hub
20968 .auth
20969 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20970 .await
20971 {
20972 Ok(token) => token,
20973 Err(e) => match dlg.token(e) {
20974 Ok(token) => token,
20975 Err(e) => {
20976 dlg.finished(false);
20977 return Err(common::Error::MissingToken(e));
20978 }
20979 },
20980 };
20981 let mut req_result = {
20982 let client = &self.hub.client;
20983 dlg.pre_request();
20984 let mut req_builder = hyper::Request::builder()
20985 .method(hyper::Method::GET)
20986 .uri(url.as_str())
20987 .header(USER_AGENT, self.hub._user_agent.clone());
20988
20989 if let Some(token) = token.as_ref() {
20990 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20991 }
20992
20993 let request = req_builder
20994 .header(CONTENT_LENGTH, 0_u64)
20995 .body(common::to_body::<String>(None));
20996
20997 client.request(request.unwrap()).await
20998 };
20999
21000 match req_result {
21001 Err(err) => {
21002 if let common::Retry::After(d) = dlg.http_error(&err) {
21003 sleep(d).await;
21004 continue;
21005 }
21006 dlg.finished(false);
21007 return Err(common::Error::HttpError(err));
21008 }
21009 Ok(res) => {
21010 let (mut parts, body) = res.into_parts();
21011 let mut body = common::Body::new(body);
21012 if !parts.status.is_success() {
21013 let bytes = common::to_bytes(body).await.unwrap_or_default();
21014 let error = serde_json::from_str(&common::to_string(&bytes));
21015 let response = common::to_response(parts, bytes.into());
21016
21017 if let common::Retry::After(d) =
21018 dlg.http_failure(&response, error.as_ref().ok())
21019 {
21020 sleep(d).await;
21021 continue;
21022 }
21023
21024 dlg.finished(false);
21025
21026 return Err(match error {
21027 Ok(value) => common::Error::BadRequest(value),
21028 _ => common::Error::Failure(response),
21029 });
21030 }
21031 let response = {
21032 let bytes = common::to_bytes(body).await.unwrap_or_default();
21033 let encoded = common::to_string(&bytes);
21034 match serde_json::from_str(&encoded) {
21035 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21036 Err(error) => {
21037 dlg.response_json_decode_error(&encoded, &error);
21038 return Err(common::Error::JsonDecodeError(
21039 encoded.to_string(),
21040 error,
21041 ));
21042 }
21043 }
21044 };
21045
21046 dlg.finished(true);
21047 return Ok(response);
21048 }
21049 }
21050 }
21051 }
21052
21053 /// Required. The version for which to list files, in the format: sites/SITE_ID /versions/VERSION_ID
21054 ///
21055 /// Sets the *parent* path property to the given value.
21056 ///
21057 /// Even though the property as already been set when instantiating this call,
21058 /// we provide this method for API completeness.
21059 pub fn parent(mut self, new_value: &str) -> SiteVersionFileListCall<'a, C> {
21060 self._parent = new_value.to_string();
21061 self
21062 }
21063 /// The type of files that should be listed for the specified version.
21064 ///
21065 /// Sets the *status* query property to the given value.
21066 pub fn status(mut self, new_value: &str) -> SiteVersionFileListCall<'a, C> {
21067 self._status = Some(new_value.to_string());
21068 self
21069 }
21070 /// A token from a previous call to `ListVersionFiles` that tells the server where to resume listing.
21071 ///
21072 /// Sets the *page token* query property to the given value.
21073 pub fn page_token(mut self, new_value: &str) -> SiteVersionFileListCall<'a, C> {
21074 self._page_token = Some(new_value.to_string());
21075 self
21076 }
21077 /// 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.
21078 ///
21079 /// Sets the *page size* query property to the given value.
21080 pub fn page_size(mut self, new_value: i32) -> SiteVersionFileListCall<'a, C> {
21081 self._page_size = Some(new_value);
21082 self
21083 }
21084 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21085 /// while executing the actual API request.
21086 ///
21087 /// ````text
21088 /// It should be used to handle progress information, and to implement a certain level of resilience.
21089 /// ````
21090 ///
21091 /// Sets the *delegate* property to the given value.
21092 pub fn delegate(
21093 mut self,
21094 new_value: &'a mut dyn common::Delegate,
21095 ) -> SiteVersionFileListCall<'a, C> {
21096 self._delegate = Some(new_value);
21097 self
21098 }
21099
21100 /// Set any additional parameter of the query string used in the request.
21101 /// It should be used to set parameters which are not yet available through their own
21102 /// setters.
21103 ///
21104 /// Please note that this method must not be used to set any of the known parameters
21105 /// which have their own setter method. If done anyway, the request will fail.
21106 ///
21107 /// # Additional Parameters
21108 ///
21109 /// * *$.xgafv* (query-string) - V1 error format.
21110 /// * *access_token* (query-string) - OAuth access token.
21111 /// * *alt* (query-string) - Data format for response.
21112 /// * *callback* (query-string) - JSONP
21113 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21114 /// * *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.
21115 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21116 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21117 /// * *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.
21118 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21119 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21120 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionFileListCall<'a, C>
21121 where
21122 T: AsRef<str>,
21123 {
21124 self._additional_params
21125 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21126 self
21127 }
21128
21129 /// Identifies the authorization scope for the method you are building.
21130 ///
21131 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21132 /// [`Scope::FirebaseReadonly`].
21133 ///
21134 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21135 /// tokens for more than one scope.
21136 ///
21137 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21138 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21139 /// sufficient, a read-write scope will do as well.
21140 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionFileListCall<'a, C>
21141 where
21142 St: AsRef<str>,
21143 {
21144 self._scopes.insert(String::from(scope.as_ref()));
21145 self
21146 }
21147 /// Identifies the authorization scope(s) for the method you are building.
21148 ///
21149 /// See [`Self::add_scope()`] for details.
21150 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionFileListCall<'a, C>
21151 where
21152 I: IntoIterator<Item = St>,
21153 St: AsRef<str>,
21154 {
21155 self._scopes
21156 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21157 self
21158 }
21159
21160 /// Removes all scopes, and no default scope will be used either.
21161 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21162 /// for details).
21163 pub fn clear_scopes(mut self) -> SiteVersionFileListCall<'a, C> {
21164 self._scopes.clear();
21165 self
21166 }
21167}
21168
21169/// Creates a new version on the specified target site using the content of the specified version.
21170///
21171/// A builder for the *versions.clone* method supported by a *site* resource.
21172/// It is not used directly, but through a [`SiteMethods`] instance.
21173///
21174/// # Example
21175///
21176/// Instantiate a resource method builder
21177///
21178/// ```test_harness,no_run
21179/// # extern crate hyper;
21180/// # extern crate hyper_rustls;
21181/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
21182/// use firebasehosting1_beta1::api::CloneVersionRequest;
21183/// # async fn dox() {
21184/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21185///
21186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21187/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21188/// # .with_native_roots()
21189/// # .unwrap()
21190/// # .https_only()
21191/// # .enable_http2()
21192/// # .build();
21193///
21194/// # let executor = hyper_util::rt::TokioExecutor::new();
21195/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21196/// # secret,
21197/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21198/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21199/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21200/// # ),
21201/// # ).build().await.unwrap();
21202///
21203/// # let client = hyper_util::client::legacy::Client::builder(
21204/// # hyper_util::rt::TokioExecutor::new()
21205/// # )
21206/// # .build(
21207/// # hyper_rustls::HttpsConnectorBuilder::new()
21208/// # .with_native_roots()
21209/// # .unwrap()
21210/// # .https_or_http()
21211/// # .enable_http2()
21212/// # .build()
21213/// # );
21214/// # let mut hub = FirebaseHosting::new(client, auth);
21215/// // As the method needs a request, you would usually fill it with the desired information
21216/// // into the respective structure. Some of the parts shown here might not be applicable !
21217/// // Values shown here are possibly random and not representative !
21218/// let mut req = CloneVersionRequest::default();
21219///
21220/// // You can configure optional parameters by calling the respective setters at will, and
21221/// // execute the final call using `doit()`.
21222/// // Values shown here are possibly random and not representative !
21223/// let result = hub.sites().versions_clone(req, "parent")
21224/// .doit().await;
21225/// # }
21226/// ```
21227pub struct SiteVersionCloneCall<'a, C>
21228where
21229 C: 'a,
21230{
21231 hub: &'a FirebaseHosting<C>,
21232 _request: CloneVersionRequest,
21233 _parent: String,
21234 _delegate: Option<&'a mut dyn common::Delegate>,
21235 _additional_params: HashMap<String, String>,
21236 _scopes: BTreeSet<String>,
21237}
21238
21239impl<'a, C> common::CallBuilder for SiteVersionCloneCall<'a, C> {}
21240
21241impl<'a, C> SiteVersionCloneCall<'a, C>
21242where
21243 C: common::Connector,
21244{
21245 /// Perform the operation you have build so far.
21246 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21247 use std::borrow::Cow;
21248 use std::io::{Read, Seek};
21249
21250 use common::{url::Params, ToParts};
21251 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21252
21253 let mut dd = common::DefaultDelegate;
21254 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21255 dlg.begin(common::MethodInfo {
21256 id: "firebasehosting.sites.versions.clone",
21257 http_method: hyper::Method::POST,
21258 });
21259
21260 for &field in ["alt", "parent"].iter() {
21261 if self._additional_params.contains_key(field) {
21262 dlg.finished(false);
21263 return Err(common::Error::FieldClash(field));
21264 }
21265 }
21266
21267 let mut params = Params::with_capacity(4 + self._additional_params.len());
21268 params.push("parent", self._parent);
21269
21270 params.extend(self._additional_params.iter());
21271
21272 params.push("alt", "json");
21273 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions:clone";
21274 if self._scopes.is_empty() {
21275 self._scopes
21276 .insert(Scope::CloudPlatform.as_ref().to_string());
21277 }
21278
21279 #[allow(clippy::single_element_loop)]
21280 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21281 url = params.uri_replacement(url, param_name, find_this, true);
21282 }
21283 {
21284 let to_remove = ["parent"];
21285 params.remove_params(&to_remove);
21286 }
21287
21288 let url = params.parse_with_url(&url);
21289
21290 let mut json_mime_type = mime::APPLICATION_JSON;
21291 let mut request_value_reader = {
21292 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21293 common::remove_json_null_values(&mut value);
21294 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21295 serde_json::to_writer(&mut dst, &value).unwrap();
21296 dst
21297 };
21298 let request_size = request_value_reader
21299 .seek(std::io::SeekFrom::End(0))
21300 .unwrap();
21301 request_value_reader
21302 .seek(std::io::SeekFrom::Start(0))
21303 .unwrap();
21304
21305 loop {
21306 let token = match self
21307 .hub
21308 .auth
21309 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21310 .await
21311 {
21312 Ok(token) => token,
21313 Err(e) => match dlg.token(e) {
21314 Ok(token) => token,
21315 Err(e) => {
21316 dlg.finished(false);
21317 return Err(common::Error::MissingToken(e));
21318 }
21319 },
21320 };
21321 request_value_reader
21322 .seek(std::io::SeekFrom::Start(0))
21323 .unwrap();
21324 let mut req_result = {
21325 let client = &self.hub.client;
21326 dlg.pre_request();
21327 let mut req_builder = hyper::Request::builder()
21328 .method(hyper::Method::POST)
21329 .uri(url.as_str())
21330 .header(USER_AGENT, self.hub._user_agent.clone());
21331
21332 if let Some(token) = token.as_ref() {
21333 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21334 }
21335
21336 let request = req_builder
21337 .header(CONTENT_TYPE, json_mime_type.to_string())
21338 .header(CONTENT_LENGTH, request_size as u64)
21339 .body(common::to_body(
21340 request_value_reader.get_ref().clone().into(),
21341 ));
21342
21343 client.request(request.unwrap()).await
21344 };
21345
21346 match req_result {
21347 Err(err) => {
21348 if let common::Retry::After(d) = dlg.http_error(&err) {
21349 sleep(d).await;
21350 continue;
21351 }
21352 dlg.finished(false);
21353 return Err(common::Error::HttpError(err));
21354 }
21355 Ok(res) => {
21356 let (mut parts, body) = res.into_parts();
21357 let mut body = common::Body::new(body);
21358 if !parts.status.is_success() {
21359 let bytes = common::to_bytes(body).await.unwrap_or_default();
21360 let error = serde_json::from_str(&common::to_string(&bytes));
21361 let response = common::to_response(parts, bytes.into());
21362
21363 if let common::Retry::After(d) =
21364 dlg.http_failure(&response, error.as_ref().ok())
21365 {
21366 sleep(d).await;
21367 continue;
21368 }
21369
21370 dlg.finished(false);
21371
21372 return Err(match error {
21373 Ok(value) => common::Error::BadRequest(value),
21374 _ => common::Error::Failure(response),
21375 });
21376 }
21377 let response = {
21378 let bytes = common::to_bytes(body).await.unwrap_or_default();
21379 let encoded = common::to_string(&bytes);
21380 match serde_json::from_str(&encoded) {
21381 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21382 Err(error) => {
21383 dlg.response_json_decode_error(&encoded, &error);
21384 return Err(common::Error::JsonDecodeError(
21385 encoded.to_string(),
21386 error,
21387 ));
21388 }
21389 }
21390 };
21391
21392 dlg.finished(true);
21393 return Ok(response);
21394 }
21395 }
21396 }
21397 }
21398
21399 ///
21400 /// Sets the *request* property to the given value.
21401 ///
21402 /// Even though the property as already been set when instantiating this call,
21403 /// we provide this method for API completeness.
21404 pub fn request(mut self, new_value: CloneVersionRequest) -> SiteVersionCloneCall<'a, C> {
21405 self._request = new_value;
21406 self
21407 }
21408 /// Required. The target site for the cloned version, in the format: sites/ SITE_ID
21409 ///
21410 /// Sets the *parent* path property to the given value.
21411 ///
21412 /// Even though the property as already been set when instantiating this call,
21413 /// we provide this method for API completeness.
21414 pub fn parent(mut self, new_value: &str) -> SiteVersionCloneCall<'a, C> {
21415 self._parent = new_value.to_string();
21416 self
21417 }
21418 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21419 /// while executing the actual API request.
21420 ///
21421 /// ````text
21422 /// It should be used to handle progress information, and to implement a certain level of resilience.
21423 /// ````
21424 ///
21425 /// Sets the *delegate* property to the given value.
21426 pub fn delegate(
21427 mut self,
21428 new_value: &'a mut dyn common::Delegate,
21429 ) -> SiteVersionCloneCall<'a, C> {
21430 self._delegate = Some(new_value);
21431 self
21432 }
21433
21434 /// Set any additional parameter of the query string used in the request.
21435 /// It should be used to set parameters which are not yet available through their own
21436 /// setters.
21437 ///
21438 /// Please note that this method must not be used to set any of the known parameters
21439 /// which have their own setter method. If done anyway, the request will fail.
21440 ///
21441 /// # Additional Parameters
21442 ///
21443 /// * *$.xgafv* (query-string) - V1 error format.
21444 /// * *access_token* (query-string) - OAuth access token.
21445 /// * *alt* (query-string) - Data format for response.
21446 /// * *callback* (query-string) - JSONP
21447 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21448 /// * *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.
21449 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21450 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21451 /// * *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.
21452 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21453 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21454 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionCloneCall<'a, C>
21455 where
21456 T: AsRef<str>,
21457 {
21458 self._additional_params
21459 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21460 self
21461 }
21462
21463 /// Identifies the authorization scope for the method you are building.
21464 ///
21465 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21466 /// [`Scope::CloudPlatform`].
21467 ///
21468 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21469 /// tokens for more than one scope.
21470 ///
21471 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21472 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21473 /// sufficient, a read-write scope will do as well.
21474 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionCloneCall<'a, C>
21475 where
21476 St: AsRef<str>,
21477 {
21478 self._scopes.insert(String::from(scope.as_ref()));
21479 self
21480 }
21481 /// Identifies the authorization scope(s) for the method you are building.
21482 ///
21483 /// See [`Self::add_scope()`] for details.
21484 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionCloneCall<'a, C>
21485 where
21486 I: IntoIterator<Item = St>,
21487 St: AsRef<str>,
21488 {
21489 self._scopes
21490 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21491 self
21492 }
21493
21494 /// Removes all scopes, and no default scope will be used either.
21495 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21496 /// for details).
21497 pub fn clear_scopes(mut self) -> SiteVersionCloneCall<'a, C> {
21498 self._scopes.clear();
21499 self
21500 }
21501}
21502
21503/// Creates a new version for the specified site.
21504///
21505/// A builder for the *versions.create* method supported by a *site* resource.
21506/// It is not used directly, but through a [`SiteMethods`] instance.
21507///
21508/// # Example
21509///
21510/// Instantiate a resource method builder
21511///
21512/// ```test_harness,no_run
21513/// # extern crate hyper;
21514/// # extern crate hyper_rustls;
21515/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
21516/// use firebasehosting1_beta1::api::Version;
21517/// # async fn dox() {
21518/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21519///
21520/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21521/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21522/// # .with_native_roots()
21523/// # .unwrap()
21524/// # .https_only()
21525/// # .enable_http2()
21526/// # .build();
21527///
21528/// # let executor = hyper_util::rt::TokioExecutor::new();
21529/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21530/// # secret,
21531/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21532/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21533/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21534/// # ),
21535/// # ).build().await.unwrap();
21536///
21537/// # let client = hyper_util::client::legacy::Client::builder(
21538/// # hyper_util::rt::TokioExecutor::new()
21539/// # )
21540/// # .build(
21541/// # hyper_rustls::HttpsConnectorBuilder::new()
21542/// # .with_native_roots()
21543/// # .unwrap()
21544/// # .https_or_http()
21545/// # .enable_http2()
21546/// # .build()
21547/// # );
21548/// # let mut hub = FirebaseHosting::new(client, auth);
21549/// // As the method needs a request, you would usually fill it with the desired information
21550/// // into the respective structure. Some of the parts shown here might not be applicable !
21551/// // Values shown here are possibly random and not representative !
21552/// let mut req = Version::default();
21553///
21554/// // You can configure optional parameters by calling the respective setters at will, and
21555/// // execute the final call using `doit()`.
21556/// // Values shown here are possibly random and not representative !
21557/// let result = hub.sites().versions_create(req, "parent")
21558/// .version_id("est")
21559/// .size_bytes(-24)
21560/// .doit().await;
21561/// # }
21562/// ```
21563pub struct SiteVersionCreateCall<'a, C>
21564where
21565 C: 'a,
21566{
21567 hub: &'a FirebaseHosting<C>,
21568 _request: Version,
21569 _parent: String,
21570 _version_id: Option<String>,
21571 _size_bytes: Option<i64>,
21572 _delegate: Option<&'a mut dyn common::Delegate>,
21573 _additional_params: HashMap<String, String>,
21574 _scopes: BTreeSet<String>,
21575}
21576
21577impl<'a, C> common::CallBuilder for SiteVersionCreateCall<'a, C> {}
21578
21579impl<'a, C> SiteVersionCreateCall<'a, C>
21580where
21581 C: common::Connector,
21582{
21583 /// Perform the operation you have build so far.
21584 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
21585 use std::borrow::Cow;
21586 use std::io::{Read, Seek};
21587
21588 use common::{url::Params, ToParts};
21589 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21590
21591 let mut dd = common::DefaultDelegate;
21592 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21593 dlg.begin(common::MethodInfo {
21594 id: "firebasehosting.sites.versions.create",
21595 http_method: hyper::Method::POST,
21596 });
21597
21598 for &field in ["alt", "parent", "versionId", "sizeBytes"].iter() {
21599 if self._additional_params.contains_key(field) {
21600 dlg.finished(false);
21601 return Err(common::Error::FieldClash(field));
21602 }
21603 }
21604
21605 let mut params = Params::with_capacity(6 + self._additional_params.len());
21606 params.push("parent", self._parent);
21607 if let Some(value) = self._version_id.as_ref() {
21608 params.push("versionId", value);
21609 }
21610 if let Some(value) = self._size_bytes.as_ref() {
21611 params.push("sizeBytes", value.to_string());
21612 }
21613
21614 params.extend(self._additional_params.iter());
21615
21616 params.push("alt", "json");
21617 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
21618 if self._scopes.is_empty() {
21619 self._scopes
21620 .insert(Scope::CloudPlatform.as_ref().to_string());
21621 }
21622
21623 #[allow(clippy::single_element_loop)]
21624 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21625 url = params.uri_replacement(url, param_name, find_this, true);
21626 }
21627 {
21628 let to_remove = ["parent"];
21629 params.remove_params(&to_remove);
21630 }
21631
21632 let url = params.parse_with_url(&url);
21633
21634 let mut json_mime_type = mime::APPLICATION_JSON;
21635 let mut request_value_reader = {
21636 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21637 common::remove_json_null_values(&mut value);
21638 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21639 serde_json::to_writer(&mut dst, &value).unwrap();
21640 dst
21641 };
21642 let request_size = request_value_reader
21643 .seek(std::io::SeekFrom::End(0))
21644 .unwrap();
21645 request_value_reader
21646 .seek(std::io::SeekFrom::Start(0))
21647 .unwrap();
21648
21649 loop {
21650 let token = match self
21651 .hub
21652 .auth
21653 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21654 .await
21655 {
21656 Ok(token) => token,
21657 Err(e) => match dlg.token(e) {
21658 Ok(token) => token,
21659 Err(e) => {
21660 dlg.finished(false);
21661 return Err(common::Error::MissingToken(e));
21662 }
21663 },
21664 };
21665 request_value_reader
21666 .seek(std::io::SeekFrom::Start(0))
21667 .unwrap();
21668 let mut req_result = {
21669 let client = &self.hub.client;
21670 dlg.pre_request();
21671 let mut req_builder = hyper::Request::builder()
21672 .method(hyper::Method::POST)
21673 .uri(url.as_str())
21674 .header(USER_AGENT, self.hub._user_agent.clone());
21675
21676 if let Some(token) = token.as_ref() {
21677 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21678 }
21679
21680 let request = req_builder
21681 .header(CONTENT_TYPE, json_mime_type.to_string())
21682 .header(CONTENT_LENGTH, request_size as u64)
21683 .body(common::to_body(
21684 request_value_reader.get_ref().clone().into(),
21685 ));
21686
21687 client.request(request.unwrap()).await
21688 };
21689
21690 match req_result {
21691 Err(err) => {
21692 if let common::Retry::After(d) = dlg.http_error(&err) {
21693 sleep(d).await;
21694 continue;
21695 }
21696 dlg.finished(false);
21697 return Err(common::Error::HttpError(err));
21698 }
21699 Ok(res) => {
21700 let (mut parts, body) = res.into_parts();
21701 let mut body = common::Body::new(body);
21702 if !parts.status.is_success() {
21703 let bytes = common::to_bytes(body).await.unwrap_or_default();
21704 let error = serde_json::from_str(&common::to_string(&bytes));
21705 let response = common::to_response(parts, bytes.into());
21706
21707 if let common::Retry::After(d) =
21708 dlg.http_failure(&response, error.as_ref().ok())
21709 {
21710 sleep(d).await;
21711 continue;
21712 }
21713
21714 dlg.finished(false);
21715
21716 return Err(match error {
21717 Ok(value) => common::Error::BadRequest(value),
21718 _ => common::Error::Failure(response),
21719 });
21720 }
21721 let response = {
21722 let bytes = common::to_bytes(body).await.unwrap_or_default();
21723 let encoded = common::to_string(&bytes);
21724 match serde_json::from_str(&encoded) {
21725 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21726 Err(error) => {
21727 dlg.response_json_decode_error(&encoded, &error);
21728 return Err(common::Error::JsonDecodeError(
21729 encoded.to_string(),
21730 error,
21731 ));
21732 }
21733 }
21734 };
21735
21736 dlg.finished(true);
21737 return Ok(response);
21738 }
21739 }
21740 }
21741 }
21742
21743 ///
21744 /// Sets the *request* property to the given value.
21745 ///
21746 /// Even though the property as already been set when instantiating this call,
21747 /// we provide this method for API completeness.
21748 pub fn request(mut self, new_value: Version) -> SiteVersionCreateCall<'a, C> {
21749 self._request = new_value;
21750 self
21751 }
21752 /// Required. The site in which to create the version, in the format: sites/ SITE_ID
21753 ///
21754 /// Sets the *parent* path property to the given value.
21755 ///
21756 /// Even though the property as already been set when instantiating this call,
21757 /// we provide this method for API completeness.
21758 pub fn parent(mut self, new_value: &str) -> SiteVersionCreateCall<'a, C> {
21759 self._parent = new_value.to_string();
21760 self
21761 }
21762 /// A unique id for the new version. This is was only specified for legacy version creations, and should be blank.
21763 ///
21764 /// Sets the *version id* query property to the given value.
21765 pub fn version_id(mut self, new_value: &str) -> SiteVersionCreateCall<'a, C> {
21766 self._version_id = Some(new_value.to_string());
21767 self
21768 }
21769 /// The self-reported size of the version. This value is used for a pre-emptive quota check for legacy version uploads.
21770 ///
21771 /// Sets the *size bytes* query property to the given value.
21772 pub fn size_bytes(mut self, new_value: i64) -> SiteVersionCreateCall<'a, C> {
21773 self._size_bytes = Some(new_value);
21774 self
21775 }
21776 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21777 /// while executing the actual API request.
21778 ///
21779 /// ````text
21780 /// It should be used to handle progress information, and to implement a certain level of resilience.
21781 /// ````
21782 ///
21783 /// Sets the *delegate* property to the given value.
21784 pub fn delegate(
21785 mut self,
21786 new_value: &'a mut dyn common::Delegate,
21787 ) -> SiteVersionCreateCall<'a, C> {
21788 self._delegate = Some(new_value);
21789 self
21790 }
21791
21792 /// Set any additional parameter of the query string used in the request.
21793 /// It should be used to set parameters which are not yet available through their own
21794 /// setters.
21795 ///
21796 /// Please note that this method must not be used to set any of the known parameters
21797 /// which have their own setter method. If done anyway, the request will fail.
21798 ///
21799 /// # Additional Parameters
21800 ///
21801 /// * *$.xgafv* (query-string) - V1 error format.
21802 /// * *access_token* (query-string) - OAuth access token.
21803 /// * *alt* (query-string) - Data format for response.
21804 /// * *callback* (query-string) - JSONP
21805 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21806 /// * *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.
21807 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21808 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21809 /// * *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.
21810 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21811 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21812 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionCreateCall<'a, C>
21813 where
21814 T: AsRef<str>,
21815 {
21816 self._additional_params
21817 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21818 self
21819 }
21820
21821 /// Identifies the authorization scope for the method you are building.
21822 ///
21823 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21824 /// [`Scope::CloudPlatform`].
21825 ///
21826 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21827 /// tokens for more than one scope.
21828 ///
21829 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21830 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21831 /// sufficient, a read-write scope will do as well.
21832 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionCreateCall<'a, C>
21833 where
21834 St: AsRef<str>,
21835 {
21836 self._scopes.insert(String::from(scope.as_ref()));
21837 self
21838 }
21839 /// Identifies the authorization scope(s) for the method you are building.
21840 ///
21841 /// See [`Self::add_scope()`] for details.
21842 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionCreateCall<'a, C>
21843 where
21844 I: IntoIterator<Item = St>,
21845 St: AsRef<str>,
21846 {
21847 self._scopes
21848 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21849 self
21850 }
21851
21852 /// Removes all scopes, and no default scope will be used either.
21853 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21854 /// for details).
21855 pub fn clear_scopes(mut self) -> SiteVersionCreateCall<'a, C> {
21856 self._scopes.clear();
21857 self
21858 }
21859}
21860
21861/// Deletes the specified version.
21862///
21863/// A builder for the *versions.delete* method supported by a *site* resource.
21864/// It is not used directly, but through a [`SiteMethods`] instance.
21865///
21866/// # Example
21867///
21868/// Instantiate a resource method builder
21869///
21870/// ```test_harness,no_run
21871/// # extern crate hyper;
21872/// # extern crate hyper_rustls;
21873/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
21874/// # async fn dox() {
21875/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21876///
21877/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21878/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21879/// # .with_native_roots()
21880/// # .unwrap()
21881/// # .https_only()
21882/// # .enable_http2()
21883/// # .build();
21884///
21885/// # let executor = hyper_util::rt::TokioExecutor::new();
21886/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21887/// # secret,
21888/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21889/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21890/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21891/// # ),
21892/// # ).build().await.unwrap();
21893///
21894/// # let client = hyper_util::client::legacy::Client::builder(
21895/// # hyper_util::rt::TokioExecutor::new()
21896/// # )
21897/// # .build(
21898/// # hyper_rustls::HttpsConnectorBuilder::new()
21899/// # .with_native_roots()
21900/// # .unwrap()
21901/// # .https_or_http()
21902/// # .enable_http2()
21903/// # .build()
21904/// # );
21905/// # let mut hub = FirebaseHosting::new(client, auth);
21906/// // You can configure optional parameters by calling the respective setters at will, and
21907/// // execute the final call using `doit()`.
21908/// // Values shown here are possibly random and not representative !
21909/// let result = hub.sites().versions_delete("name")
21910/// .doit().await;
21911/// # }
21912/// ```
21913pub struct SiteVersionDeleteCall<'a, C>
21914where
21915 C: 'a,
21916{
21917 hub: &'a FirebaseHosting<C>,
21918 _name: String,
21919 _delegate: Option<&'a mut dyn common::Delegate>,
21920 _additional_params: HashMap<String, String>,
21921 _scopes: BTreeSet<String>,
21922}
21923
21924impl<'a, C> common::CallBuilder for SiteVersionDeleteCall<'a, C> {}
21925
21926impl<'a, C> SiteVersionDeleteCall<'a, C>
21927where
21928 C: common::Connector,
21929{
21930 /// Perform the operation you have build so far.
21931 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
21932 use std::borrow::Cow;
21933 use std::io::{Read, Seek};
21934
21935 use common::{url::Params, ToParts};
21936 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21937
21938 let mut dd = common::DefaultDelegate;
21939 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21940 dlg.begin(common::MethodInfo {
21941 id: "firebasehosting.sites.versions.delete",
21942 http_method: hyper::Method::DELETE,
21943 });
21944
21945 for &field in ["alt", "name"].iter() {
21946 if self._additional_params.contains_key(field) {
21947 dlg.finished(false);
21948 return Err(common::Error::FieldClash(field));
21949 }
21950 }
21951
21952 let mut params = Params::with_capacity(3 + self._additional_params.len());
21953 params.push("name", self._name);
21954
21955 params.extend(self._additional_params.iter());
21956
21957 params.push("alt", "json");
21958 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
21959 if self._scopes.is_empty() {
21960 self._scopes
21961 .insert(Scope::CloudPlatform.as_ref().to_string());
21962 }
21963
21964 #[allow(clippy::single_element_loop)]
21965 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21966 url = params.uri_replacement(url, param_name, find_this, true);
21967 }
21968 {
21969 let to_remove = ["name"];
21970 params.remove_params(&to_remove);
21971 }
21972
21973 let url = params.parse_with_url(&url);
21974
21975 loop {
21976 let token = match self
21977 .hub
21978 .auth
21979 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21980 .await
21981 {
21982 Ok(token) => token,
21983 Err(e) => match dlg.token(e) {
21984 Ok(token) => token,
21985 Err(e) => {
21986 dlg.finished(false);
21987 return Err(common::Error::MissingToken(e));
21988 }
21989 },
21990 };
21991 let mut req_result = {
21992 let client = &self.hub.client;
21993 dlg.pre_request();
21994 let mut req_builder = hyper::Request::builder()
21995 .method(hyper::Method::DELETE)
21996 .uri(url.as_str())
21997 .header(USER_AGENT, self.hub._user_agent.clone());
21998
21999 if let Some(token) = token.as_ref() {
22000 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22001 }
22002
22003 let request = req_builder
22004 .header(CONTENT_LENGTH, 0_u64)
22005 .body(common::to_body::<String>(None));
22006
22007 client.request(request.unwrap()).await
22008 };
22009
22010 match req_result {
22011 Err(err) => {
22012 if let common::Retry::After(d) = dlg.http_error(&err) {
22013 sleep(d).await;
22014 continue;
22015 }
22016 dlg.finished(false);
22017 return Err(common::Error::HttpError(err));
22018 }
22019 Ok(res) => {
22020 let (mut parts, body) = res.into_parts();
22021 let mut body = common::Body::new(body);
22022 if !parts.status.is_success() {
22023 let bytes = common::to_bytes(body).await.unwrap_or_default();
22024 let error = serde_json::from_str(&common::to_string(&bytes));
22025 let response = common::to_response(parts, bytes.into());
22026
22027 if let common::Retry::After(d) =
22028 dlg.http_failure(&response, error.as_ref().ok())
22029 {
22030 sleep(d).await;
22031 continue;
22032 }
22033
22034 dlg.finished(false);
22035
22036 return Err(match error {
22037 Ok(value) => common::Error::BadRequest(value),
22038 _ => common::Error::Failure(response),
22039 });
22040 }
22041 let response = {
22042 let bytes = common::to_bytes(body).await.unwrap_or_default();
22043 let encoded = common::to_string(&bytes);
22044 match serde_json::from_str(&encoded) {
22045 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22046 Err(error) => {
22047 dlg.response_json_decode_error(&encoded, &error);
22048 return Err(common::Error::JsonDecodeError(
22049 encoded.to_string(),
22050 error,
22051 ));
22052 }
22053 }
22054 };
22055
22056 dlg.finished(true);
22057 return Ok(response);
22058 }
22059 }
22060 }
22061 }
22062
22063 /// Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
22064 ///
22065 /// Sets the *name* path property to the given value.
22066 ///
22067 /// Even though the property as already been set when instantiating this call,
22068 /// we provide this method for API completeness.
22069 pub fn name(mut self, new_value: &str) -> SiteVersionDeleteCall<'a, C> {
22070 self._name = new_value.to_string();
22071 self
22072 }
22073 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22074 /// while executing the actual API request.
22075 ///
22076 /// ````text
22077 /// It should be used to handle progress information, and to implement a certain level of resilience.
22078 /// ````
22079 ///
22080 /// Sets the *delegate* property to the given value.
22081 pub fn delegate(
22082 mut self,
22083 new_value: &'a mut dyn common::Delegate,
22084 ) -> SiteVersionDeleteCall<'a, C> {
22085 self._delegate = Some(new_value);
22086 self
22087 }
22088
22089 /// Set any additional parameter of the query string used in the request.
22090 /// It should be used to set parameters which are not yet available through their own
22091 /// setters.
22092 ///
22093 /// Please note that this method must not be used to set any of the known parameters
22094 /// which have their own setter method. If done anyway, the request will fail.
22095 ///
22096 /// # Additional Parameters
22097 ///
22098 /// * *$.xgafv* (query-string) - V1 error format.
22099 /// * *access_token* (query-string) - OAuth access token.
22100 /// * *alt* (query-string) - Data format for response.
22101 /// * *callback* (query-string) - JSONP
22102 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22103 /// * *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.
22104 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22105 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22106 /// * *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.
22107 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22108 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22109 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionDeleteCall<'a, C>
22110 where
22111 T: AsRef<str>,
22112 {
22113 self._additional_params
22114 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22115 self
22116 }
22117
22118 /// Identifies the authorization scope for the method you are building.
22119 ///
22120 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22121 /// [`Scope::CloudPlatform`].
22122 ///
22123 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22124 /// tokens for more than one scope.
22125 ///
22126 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22127 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22128 /// sufficient, a read-write scope will do as well.
22129 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionDeleteCall<'a, C>
22130 where
22131 St: AsRef<str>,
22132 {
22133 self._scopes.insert(String::from(scope.as_ref()));
22134 self
22135 }
22136 /// Identifies the authorization scope(s) for the method you are building.
22137 ///
22138 /// See [`Self::add_scope()`] for details.
22139 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionDeleteCall<'a, C>
22140 where
22141 I: IntoIterator<Item = St>,
22142 St: AsRef<str>,
22143 {
22144 self._scopes
22145 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22146 self
22147 }
22148
22149 /// Removes all scopes, and no default scope will be used either.
22150 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22151 /// for details).
22152 pub fn clear_scopes(mut self) -> SiteVersionDeleteCall<'a, C> {
22153 self._scopes.clear();
22154 self
22155 }
22156}
22157
22158/// 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.
22159///
22160/// A builder for the *versions.get* method supported by a *site* resource.
22161/// It is not used directly, but through a [`SiteMethods`] instance.
22162///
22163/// # Example
22164///
22165/// Instantiate a resource method builder
22166///
22167/// ```test_harness,no_run
22168/// # extern crate hyper;
22169/// # extern crate hyper_rustls;
22170/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
22171/// # async fn dox() {
22172/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22173///
22174/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22175/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22176/// # .with_native_roots()
22177/// # .unwrap()
22178/// # .https_only()
22179/// # .enable_http2()
22180/// # .build();
22181///
22182/// # let executor = hyper_util::rt::TokioExecutor::new();
22183/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22184/// # secret,
22185/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22186/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22187/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22188/// # ),
22189/// # ).build().await.unwrap();
22190///
22191/// # let client = hyper_util::client::legacy::Client::builder(
22192/// # hyper_util::rt::TokioExecutor::new()
22193/// # )
22194/// # .build(
22195/// # hyper_rustls::HttpsConnectorBuilder::new()
22196/// # .with_native_roots()
22197/// # .unwrap()
22198/// # .https_or_http()
22199/// # .enable_http2()
22200/// # .build()
22201/// # );
22202/// # let mut hub = FirebaseHosting::new(client, auth);
22203/// // You can configure optional parameters by calling the respective setters at will, and
22204/// // execute the final call using `doit()`.
22205/// // Values shown here are possibly random and not representative !
22206/// let result = hub.sites().versions_get("name")
22207/// .doit().await;
22208/// # }
22209/// ```
22210pub struct SiteVersionGetCall<'a, C>
22211where
22212 C: 'a,
22213{
22214 hub: &'a FirebaseHosting<C>,
22215 _name: String,
22216 _delegate: Option<&'a mut dyn common::Delegate>,
22217 _additional_params: HashMap<String, String>,
22218 _scopes: BTreeSet<String>,
22219}
22220
22221impl<'a, C> common::CallBuilder for SiteVersionGetCall<'a, C> {}
22222
22223impl<'a, C> SiteVersionGetCall<'a, C>
22224where
22225 C: common::Connector,
22226{
22227 /// Perform the operation you have build so far.
22228 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
22229 use std::borrow::Cow;
22230 use std::io::{Read, Seek};
22231
22232 use common::{url::Params, ToParts};
22233 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22234
22235 let mut dd = common::DefaultDelegate;
22236 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22237 dlg.begin(common::MethodInfo {
22238 id: "firebasehosting.sites.versions.get",
22239 http_method: hyper::Method::GET,
22240 });
22241
22242 for &field in ["alt", "name"].iter() {
22243 if self._additional_params.contains_key(field) {
22244 dlg.finished(false);
22245 return Err(common::Error::FieldClash(field));
22246 }
22247 }
22248
22249 let mut params = Params::with_capacity(3 + self._additional_params.len());
22250 params.push("name", self._name);
22251
22252 params.extend(self._additional_params.iter());
22253
22254 params.push("alt", "json");
22255 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
22256 if self._scopes.is_empty() {
22257 self._scopes
22258 .insert(Scope::FirebaseReadonly.as_ref().to_string());
22259 }
22260
22261 #[allow(clippy::single_element_loop)]
22262 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22263 url = params.uri_replacement(url, param_name, find_this, true);
22264 }
22265 {
22266 let to_remove = ["name"];
22267 params.remove_params(&to_remove);
22268 }
22269
22270 let url = params.parse_with_url(&url);
22271
22272 loop {
22273 let token = match self
22274 .hub
22275 .auth
22276 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22277 .await
22278 {
22279 Ok(token) => token,
22280 Err(e) => match dlg.token(e) {
22281 Ok(token) => token,
22282 Err(e) => {
22283 dlg.finished(false);
22284 return Err(common::Error::MissingToken(e));
22285 }
22286 },
22287 };
22288 let mut req_result = {
22289 let client = &self.hub.client;
22290 dlg.pre_request();
22291 let mut req_builder = hyper::Request::builder()
22292 .method(hyper::Method::GET)
22293 .uri(url.as_str())
22294 .header(USER_AGENT, self.hub._user_agent.clone());
22295
22296 if let Some(token) = token.as_ref() {
22297 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22298 }
22299
22300 let request = req_builder
22301 .header(CONTENT_LENGTH, 0_u64)
22302 .body(common::to_body::<String>(None));
22303
22304 client.request(request.unwrap()).await
22305 };
22306
22307 match req_result {
22308 Err(err) => {
22309 if let common::Retry::After(d) = dlg.http_error(&err) {
22310 sleep(d).await;
22311 continue;
22312 }
22313 dlg.finished(false);
22314 return Err(common::Error::HttpError(err));
22315 }
22316 Ok(res) => {
22317 let (mut parts, body) = res.into_parts();
22318 let mut body = common::Body::new(body);
22319 if !parts.status.is_success() {
22320 let bytes = common::to_bytes(body).await.unwrap_or_default();
22321 let error = serde_json::from_str(&common::to_string(&bytes));
22322 let response = common::to_response(parts, bytes.into());
22323
22324 if let common::Retry::After(d) =
22325 dlg.http_failure(&response, error.as_ref().ok())
22326 {
22327 sleep(d).await;
22328 continue;
22329 }
22330
22331 dlg.finished(false);
22332
22333 return Err(match error {
22334 Ok(value) => common::Error::BadRequest(value),
22335 _ => common::Error::Failure(response),
22336 });
22337 }
22338 let response = {
22339 let bytes = common::to_bytes(body).await.unwrap_or_default();
22340 let encoded = common::to_string(&bytes);
22341 match serde_json::from_str(&encoded) {
22342 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22343 Err(error) => {
22344 dlg.response_json_decode_error(&encoded, &error);
22345 return Err(common::Error::JsonDecodeError(
22346 encoded.to_string(),
22347 error,
22348 ));
22349 }
22350 }
22351 };
22352
22353 dlg.finished(true);
22354 return Ok(response);
22355 }
22356 }
22357 }
22358 }
22359
22360 /// Required. The fully-qualified resource name for the version, in the format: sites/SITE_ID/versions/VERSION_ID
22361 ///
22362 /// Sets the *name* path property to the given value.
22363 ///
22364 /// Even though the property as already been set when instantiating this call,
22365 /// we provide this method for API completeness.
22366 pub fn name(mut self, new_value: &str) -> SiteVersionGetCall<'a, C> {
22367 self._name = new_value.to_string();
22368 self
22369 }
22370 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22371 /// while executing the actual API request.
22372 ///
22373 /// ````text
22374 /// It should be used to handle progress information, and to implement a certain level of resilience.
22375 /// ````
22376 ///
22377 /// Sets the *delegate* property to the given value.
22378 pub fn delegate(
22379 mut self,
22380 new_value: &'a mut dyn common::Delegate,
22381 ) -> SiteVersionGetCall<'a, C> {
22382 self._delegate = Some(new_value);
22383 self
22384 }
22385
22386 /// Set any additional parameter of the query string used in the request.
22387 /// It should be used to set parameters which are not yet available through their own
22388 /// setters.
22389 ///
22390 /// Please note that this method must not be used to set any of the known parameters
22391 /// which have their own setter method. If done anyway, the request will fail.
22392 ///
22393 /// # Additional Parameters
22394 ///
22395 /// * *$.xgafv* (query-string) - V1 error format.
22396 /// * *access_token* (query-string) - OAuth access token.
22397 /// * *alt* (query-string) - Data format for response.
22398 /// * *callback* (query-string) - JSONP
22399 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22400 /// * *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.
22401 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22402 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22403 /// * *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.
22404 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22405 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22406 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionGetCall<'a, C>
22407 where
22408 T: AsRef<str>,
22409 {
22410 self._additional_params
22411 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22412 self
22413 }
22414
22415 /// Identifies the authorization scope for the method you are building.
22416 ///
22417 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22418 /// [`Scope::FirebaseReadonly`].
22419 ///
22420 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22421 /// tokens for more than one scope.
22422 ///
22423 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22424 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22425 /// sufficient, a read-write scope will do as well.
22426 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionGetCall<'a, C>
22427 where
22428 St: AsRef<str>,
22429 {
22430 self._scopes.insert(String::from(scope.as_ref()));
22431 self
22432 }
22433 /// Identifies the authorization scope(s) for the method you are building.
22434 ///
22435 /// See [`Self::add_scope()`] for details.
22436 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionGetCall<'a, C>
22437 where
22438 I: IntoIterator<Item = St>,
22439 St: AsRef<str>,
22440 {
22441 self._scopes
22442 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22443 self
22444 }
22445
22446 /// Removes all scopes, and no default scope will be used either.
22447 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22448 /// for details).
22449 pub fn clear_scopes(mut self) -> SiteVersionGetCall<'a, C> {
22450 self._scopes.clear();
22451 self
22452 }
22453}
22454
22455/// 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.
22456///
22457/// A builder for the *versions.list* method supported by a *site* resource.
22458/// It is not used directly, but through a [`SiteMethods`] instance.
22459///
22460/// # Example
22461///
22462/// Instantiate a resource method builder
22463///
22464/// ```test_harness,no_run
22465/// # extern crate hyper;
22466/// # extern crate hyper_rustls;
22467/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
22468/// # async fn dox() {
22469/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22470///
22471/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22472/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22473/// # .with_native_roots()
22474/// # .unwrap()
22475/// # .https_only()
22476/// # .enable_http2()
22477/// # .build();
22478///
22479/// # let executor = hyper_util::rt::TokioExecutor::new();
22480/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22481/// # secret,
22482/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22483/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22484/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22485/// # ),
22486/// # ).build().await.unwrap();
22487///
22488/// # let client = hyper_util::client::legacy::Client::builder(
22489/// # hyper_util::rt::TokioExecutor::new()
22490/// # )
22491/// # .build(
22492/// # hyper_rustls::HttpsConnectorBuilder::new()
22493/// # .with_native_roots()
22494/// # .unwrap()
22495/// # .https_or_http()
22496/// # .enable_http2()
22497/// # .build()
22498/// # );
22499/// # let mut hub = FirebaseHosting::new(client, auth);
22500/// // You can configure optional parameters by calling the respective setters at will, and
22501/// // execute the final call using `doit()`.
22502/// // Values shown here are possibly random and not representative !
22503/// let result = hub.sites().versions_list("parent")
22504/// .page_token("Stet")
22505/// .page_size(-7)
22506/// .filter("aliquyam")
22507/// .doit().await;
22508/// # }
22509/// ```
22510pub struct SiteVersionListCall<'a, C>
22511where
22512 C: 'a,
22513{
22514 hub: &'a FirebaseHosting<C>,
22515 _parent: String,
22516 _page_token: Option<String>,
22517 _page_size: Option<i32>,
22518 _filter: Option<String>,
22519 _delegate: Option<&'a mut dyn common::Delegate>,
22520 _additional_params: HashMap<String, String>,
22521 _scopes: BTreeSet<String>,
22522}
22523
22524impl<'a, C> common::CallBuilder for SiteVersionListCall<'a, C> {}
22525
22526impl<'a, C> SiteVersionListCall<'a, C>
22527where
22528 C: common::Connector,
22529{
22530 /// Perform the operation you have build so far.
22531 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionsResponse)> {
22532 use std::borrow::Cow;
22533 use std::io::{Read, Seek};
22534
22535 use common::{url::Params, ToParts};
22536 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22537
22538 let mut dd = common::DefaultDelegate;
22539 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22540 dlg.begin(common::MethodInfo {
22541 id: "firebasehosting.sites.versions.list",
22542 http_method: hyper::Method::GET,
22543 });
22544
22545 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
22546 if self._additional_params.contains_key(field) {
22547 dlg.finished(false);
22548 return Err(common::Error::FieldClash(field));
22549 }
22550 }
22551
22552 let mut params = Params::with_capacity(6 + self._additional_params.len());
22553 params.push("parent", self._parent);
22554 if let Some(value) = self._page_token.as_ref() {
22555 params.push("pageToken", value);
22556 }
22557 if let Some(value) = self._page_size.as_ref() {
22558 params.push("pageSize", value.to_string());
22559 }
22560 if let Some(value) = self._filter.as_ref() {
22561 params.push("filter", value);
22562 }
22563
22564 params.extend(self._additional_params.iter());
22565
22566 params.push("alt", "json");
22567 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
22568 if self._scopes.is_empty() {
22569 self._scopes
22570 .insert(Scope::FirebaseReadonly.as_ref().to_string());
22571 }
22572
22573 #[allow(clippy::single_element_loop)]
22574 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22575 url = params.uri_replacement(url, param_name, find_this, true);
22576 }
22577 {
22578 let to_remove = ["parent"];
22579 params.remove_params(&to_remove);
22580 }
22581
22582 let url = params.parse_with_url(&url);
22583
22584 loop {
22585 let token = match self
22586 .hub
22587 .auth
22588 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22589 .await
22590 {
22591 Ok(token) => token,
22592 Err(e) => match dlg.token(e) {
22593 Ok(token) => token,
22594 Err(e) => {
22595 dlg.finished(false);
22596 return Err(common::Error::MissingToken(e));
22597 }
22598 },
22599 };
22600 let mut req_result = {
22601 let client = &self.hub.client;
22602 dlg.pre_request();
22603 let mut req_builder = hyper::Request::builder()
22604 .method(hyper::Method::GET)
22605 .uri(url.as_str())
22606 .header(USER_AGENT, self.hub._user_agent.clone());
22607
22608 if let Some(token) = token.as_ref() {
22609 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22610 }
22611
22612 let request = req_builder
22613 .header(CONTENT_LENGTH, 0_u64)
22614 .body(common::to_body::<String>(None));
22615
22616 client.request(request.unwrap()).await
22617 };
22618
22619 match req_result {
22620 Err(err) => {
22621 if let common::Retry::After(d) = dlg.http_error(&err) {
22622 sleep(d).await;
22623 continue;
22624 }
22625 dlg.finished(false);
22626 return Err(common::Error::HttpError(err));
22627 }
22628 Ok(res) => {
22629 let (mut parts, body) = res.into_parts();
22630 let mut body = common::Body::new(body);
22631 if !parts.status.is_success() {
22632 let bytes = common::to_bytes(body).await.unwrap_or_default();
22633 let error = serde_json::from_str(&common::to_string(&bytes));
22634 let response = common::to_response(parts, bytes.into());
22635
22636 if let common::Retry::After(d) =
22637 dlg.http_failure(&response, error.as_ref().ok())
22638 {
22639 sleep(d).await;
22640 continue;
22641 }
22642
22643 dlg.finished(false);
22644
22645 return Err(match error {
22646 Ok(value) => common::Error::BadRequest(value),
22647 _ => common::Error::Failure(response),
22648 });
22649 }
22650 let response = {
22651 let bytes = common::to_bytes(body).await.unwrap_or_default();
22652 let encoded = common::to_string(&bytes);
22653 match serde_json::from_str(&encoded) {
22654 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22655 Err(error) => {
22656 dlg.response_json_decode_error(&encoded, &error);
22657 return Err(common::Error::JsonDecodeError(
22658 encoded.to_string(),
22659 error,
22660 ));
22661 }
22662 }
22663 };
22664
22665 dlg.finished(true);
22666 return Ok(response);
22667 }
22668 }
22669 }
22670 }
22671
22672 /// 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
22673 ///
22674 /// Sets the *parent* path property to the given value.
22675 ///
22676 /// Even though the property as already been set when instantiating this call,
22677 /// we provide this method for API completeness.
22678 pub fn parent(mut self, new_value: &str) -> SiteVersionListCall<'a, C> {
22679 self._parent = new_value.to_string();
22680 self
22681 }
22682 /// A token from a previous call to `ListVersions` that tells the server where to resume listing.
22683 ///
22684 /// Sets the *page token* query property to the given value.
22685 pub fn page_token(mut self, new_value: &str) -> SiteVersionListCall<'a, C> {
22686 self._page_token = Some(new_value.to_string());
22687 self
22688 }
22689 /// 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.
22690 ///
22691 /// Sets the *page size* query property to the given value.
22692 pub fn page_size(mut self, new_value: i32) -> SiteVersionListCall<'a, C> {
22693 self._page_size = Some(new_value);
22694 self
22695 }
22696 /// 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).
22697 ///
22698 /// Sets the *filter* query property to the given value.
22699 pub fn filter(mut self, new_value: &str) -> SiteVersionListCall<'a, C> {
22700 self._filter = Some(new_value.to_string());
22701 self
22702 }
22703 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22704 /// while executing the actual API request.
22705 ///
22706 /// ````text
22707 /// It should be used to handle progress information, and to implement a certain level of resilience.
22708 /// ````
22709 ///
22710 /// Sets the *delegate* property to the given value.
22711 pub fn delegate(
22712 mut self,
22713 new_value: &'a mut dyn common::Delegate,
22714 ) -> SiteVersionListCall<'a, C> {
22715 self._delegate = Some(new_value);
22716 self
22717 }
22718
22719 /// Set any additional parameter of the query string used in the request.
22720 /// It should be used to set parameters which are not yet available through their own
22721 /// setters.
22722 ///
22723 /// Please note that this method must not be used to set any of the known parameters
22724 /// which have their own setter method. If done anyway, the request will fail.
22725 ///
22726 /// # Additional Parameters
22727 ///
22728 /// * *$.xgafv* (query-string) - V1 error format.
22729 /// * *access_token* (query-string) - OAuth access token.
22730 /// * *alt* (query-string) - Data format for response.
22731 /// * *callback* (query-string) - JSONP
22732 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22733 /// * *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.
22734 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22735 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22736 /// * *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.
22737 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22738 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22739 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionListCall<'a, C>
22740 where
22741 T: AsRef<str>,
22742 {
22743 self._additional_params
22744 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22745 self
22746 }
22747
22748 /// Identifies the authorization scope for the method you are building.
22749 ///
22750 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22751 /// [`Scope::FirebaseReadonly`].
22752 ///
22753 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22754 /// tokens for more than one scope.
22755 ///
22756 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22757 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22758 /// sufficient, a read-write scope will do as well.
22759 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionListCall<'a, C>
22760 where
22761 St: AsRef<str>,
22762 {
22763 self._scopes.insert(String::from(scope.as_ref()));
22764 self
22765 }
22766 /// Identifies the authorization scope(s) for the method you are building.
22767 ///
22768 /// See [`Self::add_scope()`] for details.
22769 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionListCall<'a, C>
22770 where
22771 I: IntoIterator<Item = St>,
22772 St: AsRef<str>,
22773 {
22774 self._scopes
22775 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22776 self
22777 }
22778
22779 /// Removes all scopes, and no default scope will be used either.
22780 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22781 /// for details).
22782 pub fn clear_scopes(mut self) -> SiteVersionListCall<'a, C> {
22783 self._scopes.clear();
22784 self
22785 }
22786}
22787
22788/// 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`.
22789///
22790/// A builder for the *versions.patch* method supported by a *site* resource.
22791/// It is not used directly, but through a [`SiteMethods`] instance.
22792///
22793/// # Example
22794///
22795/// Instantiate a resource method builder
22796///
22797/// ```test_harness,no_run
22798/// # extern crate hyper;
22799/// # extern crate hyper_rustls;
22800/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
22801/// use firebasehosting1_beta1::api::Version;
22802/// # async fn dox() {
22803/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22804///
22805/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22806/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22807/// # .with_native_roots()
22808/// # .unwrap()
22809/// # .https_only()
22810/// # .enable_http2()
22811/// # .build();
22812///
22813/// # let executor = hyper_util::rt::TokioExecutor::new();
22814/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22815/// # secret,
22816/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22817/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22818/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22819/// # ),
22820/// # ).build().await.unwrap();
22821///
22822/// # let client = hyper_util::client::legacy::Client::builder(
22823/// # hyper_util::rt::TokioExecutor::new()
22824/// # )
22825/// # .build(
22826/// # hyper_rustls::HttpsConnectorBuilder::new()
22827/// # .with_native_roots()
22828/// # .unwrap()
22829/// # .https_or_http()
22830/// # .enable_http2()
22831/// # .build()
22832/// # );
22833/// # let mut hub = FirebaseHosting::new(client, auth);
22834/// // As the method needs a request, you would usually fill it with the desired information
22835/// // into the respective structure. Some of the parts shown here might not be applicable !
22836/// // Values shown here are possibly random and not representative !
22837/// let mut req = Version::default();
22838///
22839/// // You can configure optional parameters by calling the respective setters at will, and
22840/// // execute the final call using `doit()`.
22841/// // Values shown here are possibly random and not representative !
22842/// let result = hub.sites().versions_patch(req, "name")
22843/// .update_mask(FieldMask::new::<&str>(&[]))
22844/// .doit().await;
22845/// # }
22846/// ```
22847pub struct SiteVersionPatchCall<'a, C>
22848where
22849 C: 'a,
22850{
22851 hub: &'a FirebaseHosting<C>,
22852 _request: Version,
22853 _name: String,
22854 _update_mask: Option<common::FieldMask>,
22855 _delegate: Option<&'a mut dyn common::Delegate>,
22856 _additional_params: HashMap<String, String>,
22857 _scopes: BTreeSet<String>,
22858}
22859
22860impl<'a, C> common::CallBuilder for SiteVersionPatchCall<'a, C> {}
22861
22862impl<'a, C> SiteVersionPatchCall<'a, C>
22863where
22864 C: common::Connector,
22865{
22866 /// Perform the operation you have build so far.
22867 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
22868 use std::borrow::Cow;
22869 use std::io::{Read, Seek};
22870
22871 use common::{url::Params, ToParts};
22872 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22873
22874 let mut dd = common::DefaultDelegate;
22875 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22876 dlg.begin(common::MethodInfo {
22877 id: "firebasehosting.sites.versions.patch",
22878 http_method: hyper::Method::PATCH,
22879 });
22880
22881 for &field in ["alt", "name", "updateMask"].iter() {
22882 if self._additional_params.contains_key(field) {
22883 dlg.finished(false);
22884 return Err(common::Error::FieldClash(field));
22885 }
22886 }
22887
22888 let mut params = Params::with_capacity(5 + self._additional_params.len());
22889 params.push("name", self._name);
22890 if let Some(value) = self._update_mask.as_ref() {
22891 params.push("updateMask", value.to_string());
22892 }
22893
22894 params.extend(self._additional_params.iter());
22895
22896 params.push("alt", "json");
22897 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
22898 if self._scopes.is_empty() {
22899 self._scopes
22900 .insert(Scope::CloudPlatform.as_ref().to_string());
22901 }
22902
22903 #[allow(clippy::single_element_loop)]
22904 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22905 url = params.uri_replacement(url, param_name, find_this, true);
22906 }
22907 {
22908 let to_remove = ["name"];
22909 params.remove_params(&to_remove);
22910 }
22911
22912 let url = params.parse_with_url(&url);
22913
22914 let mut json_mime_type = mime::APPLICATION_JSON;
22915 let mut request_value_reader = {
22916 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22917 common::remove_json_null_values(&mut value);
22918 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22919 serde_json::to_writer(&mut dst, &value).unwrap();
22920 dst
22921 };
22922 let request_size = request_value_reader
22923 .seek(std::io::SeekFrom::End(0))
22924 .unwrap();
22925 request_value_reader
22926 .seek(std::io::SeekFrom::Start(0))
22927 .unwrap();
22928
22929 loop {
22930 let token = match self
22931 .hub
22932 .auth
22933 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22934 .await
22935 {
22936 Ok(token) => token,
22937 Err(e) => match dlg.token(e) {
22938 Ok(token) => token,
22939 Err(e) => {
22940 dlg.finished(false);
22941 return Err(common::Error::MissingToken(e));
22942 }
22943 },
22944 };
22945 request_value_reader
22946 .seek(std::io::SeekFrom::Start(0))
22947 .unwrap();
22948 let mut req_result = {
22949 let client = &self.hub.client;
22950 dlg.pre_request();
22951 let mut req_builder = hyper::Request::builder()
22952 .method(hyper::Method::PATCH)
22953 .uri(url.as_str())
22954 .header(USER_AGENT, self.hub._user_agent.clone());
22955
22956 if let Some(token) = token.as_ref() {
22957 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22958 }
22959
22960 let request = req_builder
22961 .header(CONTENT_TYPE, json_mime_type.to_string())
22962 .header(CONTENT_LENGTH, request_size as u64)
22963 .body(common::to_body(
22964 request_value_reader.get_ref().clone().into(),
22965 ));
22966
22967 client.request(request.unwrap()).await
22968 };
22969
22970 match req_result {
22971 Err(err) => {
22972 if let common::Retry::After(d) = dlg.http_error(&err) {
22973 sleep(d).await;
22974 continue;
22975 }
22976 dlg.finished(false);
22977 return Err(common::Error::HttpError(err));
22978 }
22979 Ok(res) => {
22980 let (mut parts, body) = res.into_parts();
22981 let mut body = common::Body::new(body);
22982 if !parts.status.is_success() {
22983 let bytes = common::to_bytes(body).await.unwrap_or_default();
22984 let error = serde_json::from_str(&common::to_string(&bytes));
22985 let response = common::to_response(parts, bytes.into());
22986
22987 if let common::Retry::After(d) =
22988 dlg.http_failure(&response, error.as_ref().ok())
22989 {
22990 sleep(d).await;
22991 continue;
22992 }
22993
22994 dlg.finished(false);
22995
22996 return Err(match error {
22997 Ok(value) => common::Error::BadRequest(value),
22998 _ => common::Error::Failure(response),
22999 });
23000 }
23001 let response = {
23002 let bytes = common::to_bytes(body).await.unwrap_or_default();
23003 let encoded = common::to_string(&bytes);
23004 match serde_json::from_str(&encoded) {
23005 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23006 Err(error) => {
23007 dlg.response_json_decode_error(&encoded, &error);
23008 return Err(common::Error::JsonDecodeError(
23009 encoded.to_string(),
23010 error,
23011 ));
23012 }
23013 }
23014 };
23015
23016 dlg.finished(true);
23017 return Ok(response);
23018 }
23019 }
23020 }
23021 }
23022
23023 ///
23024 /// Sets the *request* property to the given value.
23025 ///
23026 /// Even though the property as already been set when instantiating this call,
23027 /// we provide this method for API completeness.
23028 pub fn request(mut self, new_value: Version) -> SiteVersionPatchCall<'a, C> {
23029 self._request = new_value;
23030 self
23031 }
23032 /// 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).
23033 ///
23034 /// Sets the *name* path property to the given value.
23035 ///
23036 /// Even though the property as already been set when instantiating this call,
23037 /// we provide this method for API completeness.
23038 pub fn name(mut self, new_value: &str) -> SiteVersionPatchCall<'a, C> {
23039 self._name = new_value.to_string();
23040 self
23041 }
23042 /// 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.
23043 ///
23044 /// Sets the *update mask* query property to the given value.
23045 pub fn update_mask(mut self, new_value: common::FieldMask) -> SiteVersionPatchCall<'a, C> {
23046 self._update_mask = Some(new_value);
23047 self
23048 }
23049 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23050 /// while executing the actual API request.
23051 ///
23052 /// ````text
23053 /// It should be used to handle progress information, and to implement a certain level of resilience.
23054 /// ````
23055 ///
23056 /// Sets the *delegate* property to the given value.
23057 pub fn delegate(
23058 mut self,
23059 new_value: &'a mut dyn common::Delegate,
23060 ) -> SiteVersionPatchCall<'a, C> {
23061 self._delegate = Some(new_value);
23062 self
23063 }
23064
23065 /// Set any additional parameter of the query string used in the request.
23066 /// It should be used to set parameters which are not yet available through their own
23067 /// setters.
23068 ///
23069 /// Please note that this method must not be used to set any of the known parameters
23070 /// which have their own setter method. If done anyway, the request will fail.
23071 ///
23072 /// # Additional Parameters
23073 ///
23074 /// * *$.xgafv* (query-string) - V1 error format.
23075 /// * *access_token* (query-string) - OAuth access token.
23076 /// * *alt* (query-string) - Data format for response.
23077 /// * *callback* (query-string) - JSONP
23078 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23079 /// * *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.
23080 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23081 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23082 /// * *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.
23083 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23084 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23085 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionPatchCall<'a, C>
23086 where
23087 T: AsRef<str>,
23088 {
23089 self._additional_params
23090 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23091 self
23092 }
23093
23094 /// Identifies the authorization scope for the method you are building.
23095 ///
23096 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23097 /// [`Scope::CloudPlatform`].
23098 ///
23099 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23100 /// tokens for more than one scope.
23101 ///
23102 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23103 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23104 /// sufficient, a read-write scope will do as well.
23105 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionPatchCall<'a, C>
23106 where
23107 St: AsRef<str>,
23108 {
23109 self._scopes.insert(String::from(scope.as_ref()));
23110 self
23111 }
23112 /// Identifies the authorization scope(s) for the method you are building.
23113 ///
23114 /// See [`Self::add_scope()`] for details.
23115 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionPatchCall<'a, C>
23116 where
23117 I: IntoIterator<Item = St>,
23118 St: AsRef<str>,
23119 {
23120 self._scopes
23121 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23122 self
23123 }
23124
23125 /// Removes all scopes, and no default scope will be used either.
23126 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23127 /// for details).
23128 pub fn clear_scopes(mut self) -> SiteVersionPatchCall<'a, C> {
23129 self._scopes.clear();
23130 self
23131 }
23132}
23133
23134/// Adds content files to the specified version. Each file must be under 2 GB.
23135///
23136/// A builder for the *versions.populateFiles* method supported by a *site* resource.
23137/// It is not used directly, but through a [`SiteMethods`] instance.
23138///
23139/// # Example
23140///
23141/// Instantiate a resource method builder
23142///
23143/// ```test_harness,no_run
23144/// # extern crate hyper;
23145/// # extern crate hyper_rustls;
23146/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
23147/// use firebasehosting1_beta1::api::PopulateVersionFilesRequest;
23148/// # async fn dox() {
23149/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23150///
23151/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23152/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23153/// # .with_native_roots()
23154/// # .unwrap()
23155/// # .https_only()
23156/// # .enable_http2()
23157/// # .build();
23158///
23159/// # let executor = hyper_util::rt::TokioExecutor::new();
23160/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23161/// # secret,
23162/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23163/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23164/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23165/// # ),
23166/// # ).build().await.unwrap();
23167///
23168/// # let client = hyper_util::client::legacy::Client::builder(
23169/// # hyper_util::rt::TokioExecutor::new()
23170/// # )
23171/// # .build(
23172/// # hyper_rustls::HttpsConnectorBuilder::new()
23173/// # .with_native_roots()
23174/// # .unwrap()
23175/// # .https_or_http()
23176/// # .enable_http2()
23177/// # .build()
23178/// # );
23179/// # let mut hub = FirebaseHosting::new(client, auth);
23180/// // As the method needs a request, you would usually fill it with the desired information
23181/// // into the respective structure. Some of the parts shown here might not be applicable !
23182/// // Values shown here are possibly random and not representative !
23183/// let mut req = PopulateVersionFilesRequest::default();
23184///
23185/// // You can configure optional parameters by calling the respective setters at will, and
23186/// // execute the final call using `doit()`.
23187/// // Values shown here are possibly random and not representative !
23188/// let result = hub.sites().versions_populate_files(req, "parent")
23189/// .doit().await;
23190/// # }
23191/// ```
23192pub struct SiteVersionPopulateFileCall<'a, C>
23193where
23194 C: 'a,
23195{
23196 hub: &'a FirebaseHosting<C>,
23197 _request: PopulateVersionFilesRequest,
23198 _parent: String,
23199 _delegate: Option<&'a mut dyn common::Delegate>,
23200 _additional_params: HashMap<String, String>,
23201 _scopes: BTreeSet<String>,
23202}
23203
23204impl<'a, C> common::CallBuilder for SiteVersionPopulateFileCall<'a, C> {}
23205
23206impl<'a, C> SiteVersionPopulateFileCall<'a, C>
23207where
23208 C: common::Connector,
23209{
23210 /// Perform the operation you have build so far.
23211 pub async fn doit(
23212 mut self,
23213 ) -> common::Result<(common::Response, PopulateVersionFilesResponse)> {
23214 use std::borrow::Cow;
23215 use std::io::{Read, Seek};
23216
23217 use common::{url::Params, ToParts};
23218 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23219
23220 let mut dd = common::DefaultDelegate;
23221 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23222 dlg.begin(common::MethodInfo {
23223 id: "firebasehosting.sites.versions.populateFiles",
23224 http_method: hyper::Method::POST,
23225 });
23226
23227 for &field in ["alt", "parent"].iter() {
23228 if self._additional_params.contains_key(field) {
23229 dlg.finished(false);
23230 return Err(common::Error::FieldClash(field));
23231 }
23232 }
23233
23234 let mut params = Params::with_capacity(4 + self._additional_params.len());
23235 params.push("parent", self._parent);
23236
23237 params.extend(self._additional_params.iter());
23238
23239 params.push("alt", "json");
23240 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:populateFiles";
23241 if self._scopes.is_empty() {
23242 self._scopes
23243 .insert(Scope::CloudPlatform.as_ref().to_string());
23244 }
23245
23246 #[allow(clippy::single_element_loop)]
23247 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23248 url = params.uri_replacement(url, param_name, find_this, true);
23249 }
23250 {
23251 let to_remove = ["parent"];
23252 params.remove_params(&to_remove);
23253 }
23254
23255 let url = params.parse_with_url(&url);
23256
23257 let mut json_mime_type = mime::APPLICATION_JSON;
23258 let mut request_value_reader = {
23259 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23260 common::remove_json_null_values(&mut value);
23261 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23262 serde_json::to_writer(&mut dst, &value).unwrap();
23263 dst
23264 };
23265 let request_size = request_value_reader
23266 .seek(std::io::SeekFrom::End(0))
23267 .unwrap();
23268 request_value_reader
23269 .seek(std::io::SeekFrom::Start(0))
23270 .unwrap();
23271
23272 loop {
23273 let token = match self
23274 .hub
23275 .auth
23276 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23277 .await
23278 {
23279 Ok(token) => token,
23280 Err(e) => match dlg.token(e) {
23281 Ok(token) => token,
23282 Err(e) => {
23283 dlg.finished(false);
23284 return Err(common::Error::MissingToken(e));
23285 }
23286 },
23287 };
23288 request_value_reader
23289 .seek(std::io::SeekFrom::Start(0))
23290 .unwrap();
23291 let mut req_result = {
23292 let client = &self.hub.client;
23293 dlg.pre_request();
23294 let mut req_builder = hyper::Request::builder()
23295 .method(hyper::Method::POST)
23296 .uri(url.as_str())
23297 .header(USER_AGENT, self.hub._user_agent.clone());
23298
23299 if let Some(token) = token.as_ref() {
23300 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23301 }
23302
23303 let request = req_builder
23304 .header(CONTENT_TYPE, json_mime_type.to_string())
23305 .header(CONTENT_LENGTH, request_size as u64)
23306 .body(common::to_body(
23307 request_value_reader.get_ref().clone().into(),
23308 ));
23309
23310 client.request(request.unwrap()).await
23311 };
23312
23313 match req_result {
23314 Err(err) => {
23315 if let common::Retry::After(d) = dlg.http_error(&err) {
23316 sleep(d).await;
23317 continue;
23318 }
23319 dlg.finished(false);
23320 return Err(common::Error::HttpError(err));
23321 }
23322 Ok(res) => {
23323 let (mut parts, body) = res.into_parts();
23324 let mut body = common::Body::new(body);
23325 if !parts.status.is_success() {
23326 let bytes = common::to_bytes(body).await.unwrap_or_default();
23327 let error = serde_json::from_str(&common::to_string(&bytes));
23328 let response = common::to_response(parts, bytes.into());
23329
23330 if let common::Retry::After(d) =
23331 dlg.http_failure(&response, error.as_ref().ok())
23332 {
23333 sleep(d).await;
23334 continue;
23335 }
23336
23337 dlg.finished(false);
23338
23339 return Err(match error {
23340 Ok(value) => common::Error::BadRequest(value),
23341 _ => common::Error::Failure(response),
23342 });
23343 }
23344 let response = {
23345 let bytes = common::to_bytes(body).await.unwrap_or_default();
23346 let encoded = common::to_string(&bytes);
23347 match serde_json::from_str(&encoded) {
23348 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23349 Err(error) => {
23350 dlg.response_json_decode_error(&encoded, &error);
23351 return Err(common::Error::JsonDecodeError(
23352 encoded.to_string(),
23353 error,
23354 ));
23355 }
23356 }
23357 };
23358
23359 dlg.finished(true);
23360 return Ok(response);
23361 }
23362 }
23363 }
23364 }
23365
23366 ///
23367 /// Sets the *request* property to the given value.
23368 ///
23369 /// Even though the property as already been set when instantiating this call,
23370 /// we provide this method for API completeness.
23371 pub fn request(
23372 mut self,
23373 new_value: PopulateVersionFilesRequest,
23374 ) -> SiteVersionPopulateFileCall<'a, C> {
23375 self._request = new_value;
23376 self
23377 }
23378 /// Required. The version to which to add files, in the format: sites/SITE_ID /versions/VERSION_ID
23379 ///
23380 /// Sets the *parent* path property to the given value.
23381 ///
23382 /// Even though the property as already been set when instantiating this call,
23383 /// we provide this method for API completeness.
23384 pub fn parent(mut self, new_value: &str) -> SiteVersionPopulateFileCall<'a, C> {
23385 self._parent = new_value.to_string();
23386 self
23387 }
23388 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23389 /// while executing the actual API request.
23390 ///
23391 /// ````text
23392 /// It should be used to handle progress information, and to implement a certain level of resilience.
23393 /// ````
23394 ///
23395 /// Sets the *delegate* property to the given value.
23396 pub fn delegate(
23397 mut self,
23398 new_value: &'a mut dyn common::Delegate,
23399 ) -> SiteVersionPopulateFileCall<'a, C> {
23400 self._delegate = Some(new_value);
23401 self
23402 }
23403
23404 /// Set any additional parameter of the query string used in the request.
23405 /// It should be used to set parameters which are not yet available through their own
23406 /// setters.
23407 ///
23408 /// Please note that this method must not be used to set any of the known parameters
23409 /// which have their own setter method. If done anyway, the request will fail.
23410 ///
23411 /// # Additional Parameters
23412 ///
23413 /// * *$.xgafv* (query-string) - V1 error format.
23414 /// * *access_token* (query-string) - OAuth access token.
23415 /// * *alt* (query-string) - Data format for response.
23416 /// * *callback* (query-string) - JSONP
23417 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23418 /// * *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.
23419 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23420 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23421 /// * *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.
23422 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23423 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23424 pub fn param<T>(mut self, name: T, value: T) -> SiteVersionPopulateFileCall<'a, C>
23425 where
23426 T: AsRef<str>,
23427 {
23428 self._additional_params
23429 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23430 self
23431 }
23432
23433 /// Identifies the authorization scope for the method you are building.
23434 ///
23435 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23436 /// [`Scope::CloudPlatform`].
23437 ///
23438 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23439 /// tokens for more than one scope.
23440 ///
23441 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23442 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23443 /// sufficient, a read-write scope will do as well.
23444 pub fn add_scope<St>(mut self, scope: St) -> SiteVersionPopulateFileCall<'a, C>
23445 where
23446 St: AsRef<str>,
23447 {
23448 self._scopes.insert(String::from(scope.as_ref()));
23449 self
23450 }
23451 /// Identifies the authorization scope(s) for the method you are building.
23452 ///
23453 /// See [`Self::add_scope()`] for details.
23454 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteVersionPopulateFileCall<'a, C>
23455 where
23456 I: IntoIterator<Item = St>,
23457 St: AsRef<str>,
23458 {
23459 self._scopes
23460 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23461 self
23462 }
23463
23464 /// Removes all scopes, and no default scope will be used either.
23465 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23466 /// for details).
23467 pub fn clear_scopes(mut self) -> SiteVersionPopulateFileCall<'a, C> {
23468 self._scopes.clear();
23469 self
23470 }
23471}
23472
23473/// Gets the Hosting metadata for a specific site.
23474///
23475/// A builder for the *getConfig* method supported by a *site* resource.
23476/// It is not used directly, but through a [`SiteMethods`] instance.
23477///
23478/// # Example
23479///
23480/// Instantiate a resource method builder
23481///
23482/// ```test_harness,no_run
23483/// # extern crate hyper;
23484/// # extern crate hyper_rustls;
23485/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
23486/// # async fn dox() {
23487/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23488///
23489/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23490/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23491/// # .with_native_roots()
23492/// # .unwrap()
23493/// # .https_only()
23494/// # .enable_http2()
23495/// # .build();
23496///
23497/// # let executor = hyper_util::rt::TokioExecutor::new();
23498/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23499/// # secret,
23500/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23501/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23502/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23503/// # ),
23504/// # ).build().await.unwrap();
23505///
23506/// # let client = hyper_util::client::legacy::Client::builder(
23507/// # hyper_util::rt::TokioExecutor::new()
23508/// # )
23509/// # .build(
23510/// # hyper_rustls::HttpsConnectorBuilder::new()
23511/// # .with_native_roots()
23512/// # .unwrap()
23513/// # .https_or_http()
23514/// # .enable_http2()
23515/// # .build()
23516/// # );
23517/// # let mut hub = FirebaseHosting::new(client, auth);
23518/// // You can configure optional parameters by calling the respective setters at will, and
23519/// // execute the final call using `doit()`.
23520/// // Values shown here are possibly random and not representative !
23521/// let result = hub.sites().get_config("name")
23522/// .doit().await;
23523/// # }
23524/// ```
23525pub struct SiteGetConfigCall<'a, C>
23526where
23527 C: 'a,
23528{
23529 hub: &'a FirebaseHosting<C>,
23530 _name: String,
23531 _delegate: Option<&'a mut dyn common::Delegate>,
23532 _additional_params: HashMap<String, String>,
23533 _scopes: BTreeSet<String>,
23534}
23535
23536impl<'a, C> common::CallBuilder for SiteGetConfigCall<'a, C> {}
23537
23538impl<'a, C> SiteGetConfigCall<'a, C>
23539where
23540 C: common::Connector,
23541{
23542 /// Perform the operation you have build so far.
23543 pub async fn doit(mut self) -> common::Result<(common::Response, SiteConfig)> {
23544 use std::borrow::Cow;
23545 use std::io::{Read, Seek};
23546
23547 use common::{url::Params, ToParts};
23548 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23549
23550 let mut dd = common::DefaultDelegate;
23551 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23552 dlg.begin(common::MethodInfo {
23553 id: "firebasehosting.sites.getConfig",
23554 http_method: hyper::Method::GET,
23555 });
23556
23557 for &field in ["alt", "name"].iter() {
23558 if self._additional_params.contains_key(field) {
23559 dlg.finished(false);
23560 return Err(common::Error::FieldClash(field));
23561 }
23562 }
23563
23564 let mut params = Params::with_capacity(3 + self._additional_params.len());
23565 params.push("name", self._name);
23566
23567 params.extend(self._additional_params.iter());
23568
23569 params.push("alt", "json");
23570 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
23571 if self._scopes.is_empty() {
23572 self._scopes
23573 .insert(Scope::FirebaseReadonly.as_ref().to_string());
23574 }
23575
23576 #[allow(clippy::single_element_loop)]
23577 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23578 url = params.uri_replacement(url, param_name, find_this, true);
23579 }
23580 {
23581 let to_remove = ["name"];
23582 params.remove_params(&to_remove);
23583 }
23584
23585 let url = params.parse_with_url(&url);
23586
23587 loop {
23588 let token = match self
23589 .hub
23590 .auth
23591 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23592 .await
23593 {
23594 Ok(token) => token,
23595 Err(e) => match dlg.token(e) {
23596 Ok(token) => token,
23597 Err(e) => {
23598 dlg.finished(false);
23599 return Err(common::Error::MissingToken(e));
23600 }
23601 },
23602 };
23603 let mut req_result = {
23604 let client = &self.hub.client;
23605 dlg.pre_request();
23606 let mut req_builder = hyper::Request::builder()
23607 .method(hyper::Method::GET)
23608 .uri(url.as_str())
23609 .header(USER_AGENT, self.hub._user_agent.clone());
23610
23611 if let Some(token) = token.as_ref() {
23612 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23613 }
23614
23615 let request = req_builder
23616 .header(CONTENT_LENGTH, 0_u64)
23617 .body(common::to_body::<String>(None));
23618
23619 client.request(request.unwrap()).await
23620 };
23621
23622 match req_result {
23623 Err(err) => {
23624 if let common::Retry::After(d) = dlg.http_error(&err) {
23625 sleep(d).await;
23626 continue;
23627 }
23628 dlg.finished(false);
23629 return Err(common::Error::HttpError(err));
23630 }
23631 Ok(res) => {
23632 let (mut parts, body) = res.into_parts();
23633 let mut body = common::Body::new(body);
23634 if !parts.status.is_success() {
23635 let bytes = common::to_bytes(body).await.unwrap_or_default();
23636 let error = serde_json::from_str(&common::to_string(&bytes));
23637 let response = common::to_response(parts, bytes.into());
23638
23639 if let common::Retry::After(d) =
23640 dlg.http_failure(&response, error.as_ref().ok())
23641 {
23642 sleep(d).await;
23643 continue;
23644 }
23645
23646 dlg.finished(false);
23647
23648 return Err(match error {
23649 Ok(value) => common::Error::BadRequest(value),
23650 _ => common::Error::Failure(response),
23651 });
23652 }
23653 let response = {
23654 let bytes = common::to_bytes(body).await.unwrap_or_default();
23655 let encoded = common::to_string(&bytes);
23656 match serde_json::from_str(&encoded) {
23657 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23658 Err(error) => {
23659 dlg.response_json_decode_error(&encoded, &error);
23660 return Err(common::Error::JsonDecodeError(
23661 encoded.to_string(),
23662 error,
23663 ));
23664 }
23665 }
23666 };
23667
23668 dlg.finished(true);
23669 return Ok(response);
23670 }
23671 }
23672 }
23673 }
23674
23675 /// Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
23676 ///
23677 /// Sets the *name* path property to the given value.
23678 ///
23679 /// Even though the property as already been set when instantiating this call,
23680 /// we provide this method for API completeness.
23681 pub fn name(mut self, new_value: &str) -> SiteGetConfigCall<'a, C> {
23682 self._name = new_value.to_string();
23683 self
23684 }
23685 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23686 /// while executing the actual API request.
23687 ///
23688 /// ````text
23689 /// It should be used to handle progress information, and to implement a certain level of resilience.
23690 /// ````
23691 ///
23692 /// Sets the *delegate* property to the given value.
23693 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SiteGetConfigCall<'a, C> {
23694 self._delegate = Some(new_value);
23695 self
23696 }
23697
23698 /// Set any additional parameter of the query string used in the request.
23699 /// It should be used to set parameters which are not yet available through their own
23700 /// setters.
23701 ///
23702 /// Please note that this method must not be used to set any of the known parameters
23703 /// which have their own setter method. If done anyway, the request will fail.
23704 ///
23705 /// # Additional Parameters
23706 ///
23707 /// * *$.xgafv* (query-string) - V1 error format.
23708 /// * *access_token* (query-string) - OAuth access token.
23709 /// * *alt* (query-string) - Data format for response.
23710 /// * *callback* (query-string) - JSONP
23711 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23712 /// * *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.
23713 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23714 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23715 /// * *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.
23716 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23717 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23718 pub fn param<T>(mut self, name: T, value: T) -> SiteGetConfigCall<'a, C>
23719 where
23720 T: AsRef<str>,
23721 {
23722 self._additional_params
23723 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23724 self
23725 }
23726
23727 /// Identifies the authorization scope for the method you are building.
23728 ///
23729 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23730 /// [`Scope::FirebaseReadonly`].
23731 ///
23732 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23733 /// tokens for more than one scope.
23734 ///
23735 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23736 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23737 /// sufficient, a read-write scope will do as well.
23738 pub fn add_scope<St>(mut self, scope: St) -> SiteGetConfigCall<'a, C>
23739 where
23740 St: AsRef<str>,
23741 {
23742 self._scopes.insert(String::from(scope.as_ref()));
23743 self
23744 }
23745 /// Identifies the authorization scope(s) for the method you are building.
23746 ///
23747 /// See [`Self::add_scope()`] for details.
23748 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteGetConfigCall<'a, C>
23749 where
23750 I: IntoIterator<Item = St>,
23751 St: AsRef<str>,
23752 {
23753 self._scopes
23754 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23755 self
23756 }
23757
23758 /// Removes all scopes, and no default scope will be used either.
23759 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23760 /// for details).
23761 pub fn clear_scopes(mut self) -> SiteGetConfigCall<'a, C> {
23762 self._scopes.clear();
23763 self
23764 }
23765}
23766
23767/// Sets the Hosting metadata for a specific site.
23768///
23769/// A builder for the *updateConfig* method supported by a *site* resource.
23770/// It is not used directly, but through a [`SiteMethods`] instance.
23771///
23772/// # Example
23773///
23774/// Instantiate a resource method builder
23775///
23776/// ```test_harness,no_run
23777/// # extern crate hyper;
23778/// # extern crate hyper_rustls;
23779/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1;
23780/// use firebasehosting1_beta1::api::SiteConfig;
23781/// # async fn dox() {
23782/// # use firebasehosting1_beta1::{FirebaseHosting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23783///
23784/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23785/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23786/// # .with_native_roots()
23787/// # .unwrap()
23788/// # .https_only()
23789/// # .enable_http2()
23790/// # .build();
23791///
23792/// # let executor = hyper_util::rt::TokioExecutor::new();
23793/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23794/// # secret,
23795/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23796/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23797/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23798/// # ),
23799/// # ).build().await.unwrap();
23800///
23801/// # let client = hyper_util::client::legacy::Client::builder(
23802/// # hyper_util::rt::TokioExecutor::new()
23803/// # )
23804/// # .build(
23805/// # hyper_rustls::HttpsConnectorBuilder::new()
23806/// # .with_native_roots()
23807/// # .unwrap()
23808/// # .https_or_http()
23809/// # .enable_http2()
23810/// # .build()
23811/// # );
23812/// # let mut hub = FirebaseHosting::new(client, auth);
23813/// // As the method needs a request, you would usually fill it with the desired information
23814/// // into the respective structure. Some of the parts shown here might not be applicable !
23815/// // Values shown here are possibly random and not representative !
23816/// let mut req = SiteConfig::default();
23817///
23818/// // You can configure optional parameters by calling the respective setters at will, and
23819/// // execute the final call using `doit()`.
23820/// // Values shown here are possibly random and not representative !
23821/// let result = hub.sites().update_config(req, "name")
23822/// .update_mask(FieldMask::new::<&str>(&[]))
23823/// .doit().await;
23824/// # }
23825/// ```
23826pub struct SiteUpdateConfigCall<'a, C>
23827where
23828 C: 'a,
23829{
23830 hub: &'a FirebaseHosting<C>,
23831 _request: SiteConfig,
23832 _name: String,
23833 _update_mask: Option<common::FieldMask>,
23834 _delegate: Option<&'a mut dyn common::Delegate>,
23835 _additional_params: HashMap<String, String>,
23836 _scopes: BTreeSet<String>,
23837}
23838
23839impl<'a, C> common::CallBuilder for SiteUpdateConfigCall<'a, C> {}
23840
23841impl<'a, C> SiteUpdateConfigCall<'a, C>
23842where
23843 C: common::Connector,
23844{
23845 /// Perform the operation you have build so far.
23846 pub async fn doit(mut self) -> common::Result<(common::Response, SiteConfig)> {
23847 use std::borrow::Cow;
23848 use std::io::{Read, Seek};
23849
23850 use common::{url::Params, ToParts};
23851 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23852
23853 let mut dd = common::DefaultDelegate;
23854 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23855 dlg.begin(common::MethodInfo {
23856 id: "firebasehosting.sites.updateConfig",
23857 http_method: hyper::Method::PATCH,
23858 });
23859
23860 for &field in ["alt", "name", "updateMask"].iter() {
23861 if self._additional_params.contains_key(field) {
23862 dlg.finished(false);
23863 return Err(common::Error::FieldClash(field));
23864 }
23865 }
23866
23867 let mut params = Params::with_capacity(5 + self._additional_params.len());
23868 params.push("name", self._name);
23869 if let Some(value) = self._update_mask.as_ref() {
23870 params.push("updateMask", value.to_string());
23871 }
23872
23873 params.extend(self._additional_params.iter());
23874
23875 params.push("alt", "json");
23876 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
23877 if self._scopes.is_empty() {
23878 self._scopes
23879 .insert(Scope::CloudPlatform.as_ref().to_string());
23880 }
23881
23882 #[allow(clippy::single_element_loop)]
23883 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23884 url = params.uri_replacement(url, param_name, find_this, true);
23885 }
23886 {
23887 let to_remove = ["name"];
23888 params.remove_params(&to_remove);
23889 }
23890
23891 let url = params.parse_with_url(&url);
23892
23893 let mut json_mime_type = mime::APPLICATION_JSON;
23894 let mut request_value_reader = {
23895 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23896 common::remove_json_null_values(&mut value);
23897 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23898 serde_json::to_writer(&mut dst, &value).unwrap();
23899 dst
23900 };
23901 let request_size = request_value_reader
23902 .seek(std::io::SeekFrom::End(0))
23903 .unwrap();
23904 request_value_reader
23905 .seek(std::io::SeekFrom::Start(0))
23906 .unwrap();
23907
23908 loop {
23909 let token = match self
23910 .hub
23911 .auth
23912 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23913 .await
23914 {
23915 Ok(token) => token,
23916 Err(e) => match dlg.token(e) {
23917 Ok(token) => token,
23918 Err(e) => {
23919 dlg.finished(false);
23920 return Err(common::Error::MissingToken(e));
23921 }
23922 },
23923 };
23924 request_value_reader
23925 .seek(std::io::SeekFrom::Start(0))
23926 .unwrap();
23927 let mut req_result = {
23928 let client = &self.hub.client;
23929 dlg.pre_request();
23930 let mut req_builder = hyper::Request::builder()
23931 .method(hyper::Method::PATCH)
23932 .uri(url.as_str())
23933 .header(USER_AGENT, self.hub._user_agent.clone());
23934
23935 if let Some(token) = token.as_ref() {
23936 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23937 }
23938
23939 let request = req_builder
23940 .header(CONTENT_TYPE, json_mime_type.to_string())
23941 .header(CONTENT_LENGTH, request_size as u64)
23942 .body(common::to_body(
23943 request_value_reader.get_ref().clone().into(),
23944 ));
23945
23946 client.request(request.unwrap()).await
23947 };
23948
23949 match req_result {
23950 Err(err) => {
23951 if let common::Retry::After(d) = dlg.http_error(&err) {
23952 sleep(d).await;
23953 continue;
23954 }
23955 dlg.finished(false);
23956 return Err(common::Error::HttpError(err));
23957 }
23958 Ok(res) => {
23959 let (mut parts, body) = res.into_parts();
23960 let mut body = common::Body::new(body);
23961 if !parts.status.is_success() {
23962 let bytes = common::to_bytes(body).await.unwrap_or_default();
23963 let error = serde_json::from_str(&common::to_string(&bytes));
23964 let response = common::to_response(parts, bytes.into());
23965
23966 if let common::Retry::After(d) =
23967 dlg.http_failure(&response, error.as_ref().ok())
23968 {
23969 sleep(d).await;
23970 continue;
23971 }
23972
23973 dlg.finished(false);
23974
23975 return Err(match error {
23976 Ok(value) => common::Error::BadRequest(value),
23977 _ => common::Error::Failure(response),
23978 });
23979 }
23980 let response = {
23981 let bytes = common::to_bytes(body).await.unwrap_or_default();
23982 let encoded = common::to_string(&bytes);
23983 match serde_json::from_str(&encoded) {
23984 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23985 Err(error) => {
23986 dlg.response_json_decode_error(&encoded, &error);
23987 return Err(common::Error::JsonDecodeError(
23988 encoded.to_string(),
23989 error,
23990 ));
23991 }
23992 }
23993 };
23994
23995 dlg.finished(true);
23996 return Ok(response);
23997 }
23998 }
23999 }
24000 }
24001
24002 ///
24003 /// Sets the *request* property to the given value.
24004 ///
24005 /// Even though the property as already been set when instantiating this call,
24006 /// we provide this method for API completeness.
24007 pub fn request(mut self, new_value: SiteConfig) -> SiteUpdateConfigCall<'a, C> {
24008 self._request = new_value;
24009 self
24010 }
24011 /// Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
24012 ///
24013 /// Sets the *name* path property to the given value.
24014 ///
24015 /// Even though the property as already been set when instantiating this call,
24016 /// we provide this method for API completeness.
24017 pub fn name(mut self, new_value: &str) -> SiteUpdateConfigCall<'a, C> {
24018 self._name = new_value.to_string();
24019 self
24020 }
24021 /// 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.
24022 ///
24023 /// Sets the *update mask* query property to the given value.
24024 pub fn update_mask(mut self, new_value: common::FieldMask) -> SiteUpdateConfigCall<'a, C> {
24025 self._update_mask = Some(new_value);
24026 self
24027 }
24028 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24029 /// while executing the actual API request.
24030 ///
24031 /// ````text
24032 /// It should be used to handle progress information, and to implement a certain level of resilience.
24033 /// ````
24034 ///
24035 /// Sets the *delegate* property to the given value.
24036 pub fn delegate(
24037 mut self,
24038 new_value: &'a mut dyn common::Delegate,
24039 ) -> SiteUpdateConfigCall<'a, C> {
24040 self._delegate = Some(new_value);
24041 self
24042 }
24043
24044 /// Set any additional parameter of the query string used in the request.
24045 /// It should be used to set parameters which are not yet available through their own
24046 /// setters.
24047 ///
24048 /// Please note that this method must not be used to set any of the known parameters
24049 /// which have their own setter method. If done anyway, the request will fail.
24050 ///
24051 /// # Additional Parameters
24052 ///
24053 /// * *$.xgafv* (query-string) - V1 error format.
24054 /// * *access_token* (query-string) - OAuth access token.
24055 /// * *alt* (query-string) - Data format for response.
24056 /// * *callback* (query-string) - JSONP
24057 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24058 /// * *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.
24059 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24060 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24061 /// * *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.
24062 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24063 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24064 pub fn param<T>(mut self, name: T, value: T) -> SiteUpdateConfigCall<'a, C>
24065 where
24066 T: AsRef<str>,
24067 {
24068 self._additional_params
24069 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24070 self
24071 }
24072
24073 /// Identifies the authorization scope for the method you are building.
24074 ///
24075 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24076 /// [`Scope::CloudPlatform`].
24077 ///
24078 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24079 /// tokens for more than one scope.
24080 ///
24081 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24082 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24083 /// sufficient, a read-write scope will do as well.
24084 pub fn add_scope<St>(mut self, scope: St) -> SiteUpdateConfigCall<'a, C>
24085 where
24086 St: AsRef<str>,
24087 {
24088 self._scopes.insert(String::from(scope.as_ref()));
24089 self
24090 }
24091 /// Identifies the authorization scope(s) for the method you are building.
24092 ///
24093 /// See [`Self::add_scope()`] for details.
24094 pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteUpdateConfigCall<'a, C>
24095 where
24096 I: IntoIterator<Item = St>,
24097 St: AsRef<str>,
24098 {
24099 self._scopes
24100 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24101 self
24102 }
24103
24104 /// Removes all scopes, and no default scope will be used either.
24105 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24106 /// for details).
24107 pub fn clear_scopes(mut self) -> SiteUpdateConfigCall<'a, C> {
24108 self._scopes.clear();
24109 self
24110 }
24111}