google_walletobjects1/
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    /// Private Service: https://www.googleapis.com/auth/wallet_object.issuer
17    WalletObjectIssuer,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::WalletObjectIssuer => "https://www.googleapis.com/auth/wallet_object.issuer",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::WalletObjectIssuer
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all Walletobjects related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_walletobjects1 as walletobjects1;
49/// use walletobjects1::api::AddMessageRequest;
50/// use walletobjects1::{Result, Error};
51/// # async fn dox() {
52/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63///     .with_native_roots()
64///     .unwrap()
65///     .https_only()
66///     .enable_http2()
67///     .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71///     secret,
72///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73///     yup_oauth2::client::CustomHyperClientBuilder::from(
74///         hyper_util::client::legacy::Client::builder(executor).build(connector),
75///     ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79///     hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82///     hyper_rustls::HttpsConnectorBuilder::new()
83///         .with_native_roots()
84///         .unwrap()
85///         .https_or_http()
86///         .enable_http2()
87///         .build()
88/// );
89/// let mut hub = Walletobjects::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = AddMessageRequest::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.eventticketclass().addmessage(req, "resourceId")
99///              .doit().await;
100///
101/// match result {
102///     Err(e) => match e {
103///         // The Error enum provides details about what exactly happened.
104///         // You can also just use its `Debug`, `Display` or `Error` traits
105///          Error::HttpError(_)
106///         |Error::Io(_)
107///         |Error::MissingAPIKey
108///         |Error::MissingToken(_)
109///         |Error::Cancelled
110///         |Error::UploadSizeLimitExceeded(_, _)
111///         |Error::Failure(_)
112///         |Error::BadRequest(_)
113///         |Error::FieldClash(_)
114///         |Error::JsonDecodeError(_, _) => println!("{}", e),
115///     },
116///     Ok(res) => println!("Success: {:?}", res),
117/// }
118/// # }
119/// ```
120#[derive(Clone)]
121pub struct Walletobjects<C> {
122    pub client: common::Client<C>,
123    pub auth: Box<dyn common::GetToken>,
124    _user_agent: String,
125    _base_url: String,
126    _root_url: String,
127}
128
129impl<C> common::Hub for Walletobjects<C> {}
130
131impl<'a, C> Walletobjects<C> {
132    pub fn new<A: 'static + common::GetToken>(
133        client: common::Client<C>,
134        auth: A,
135    ) -> Walletobjects<C> {
136        Walletobjects {
137            client,
138            auth: Box::new(auth),
139            _user_agent: "google-api-rust-client/7.0.0".to_string(),
140            _base_url: "https://walletobjects.googleapis.com/".to_string(),
141            _root_url: "https://walletobjects.googleapis.com/".to_string(),
142        }
143    }
144
145    pub fn eventticketclass(&'a self) -> EventticketclasMethods<'a, C> {
146        EventticketclasMethods { hub: self }
147    }
148    pub fn eventticketobject(&'a self) -> EventticketobjectMethods<'a, C> {
149        EventticketobjectMethods { hub: self }
150    }
151    pub fn flightclass(&'a self) -> FlightclasMethods<'a, C> {
152        FlightclasMethods { hub: self }
153    }
154    pub fn flightobject(&'a self) -> FlightobjectMethods<'a, C> {
155        FlightobjectMethods { hub: self }
156    }
157    pub fn genericclass(&'a self) -> GenericclasMethods<'a, C> {
158        GenericclasMethods { hub: self }
159    }
160    pub fn genericobject(&'a self) -> GenericobjectMethods<'a, C> {
161        GenericobjectMethods { hub: self }
162    }
163    pub fn giftcardclass(&'a self) -> GiftcardclasMethods<'a, C> {
164        GiftcardclasMethods { hub: self }
165    }
166    pub fn giftcardobject(&'a self) -> GiftcardobjectMethods<'a, C> {
167        GiftcardobjectMethods { hub: self }
168    }
169    pub fn issuer(&'a self) -> IssuerMethods<'a, C> {
170        IssuerMethods { hub: self }
171    }
172    pub fn jwt(&'a self) -> JwtMethods<'a, C> {
173        JwtMethods { hub: self }
174    }
175    pub fn loyaltyclass(&'a self) -> LoyaltyclasMethods<'a, C> {
176        LoyaltyclasMethods { hub: self }
177    }
178    pub fn loyaltyobject(&'a self) -> LoyaltyobjectMethods<'a, C> {
179        LoyaltyobjectMethods { hub: self }
180    }
181    pub fn media(&'a self) -> MediaMethods<'a, C> {
182        MediaMethods { hub: self }
183    }
184    pub fn offerclass(&'a self) -> OfferclasMethods<'a, C> {
185        OfferclasMethods { hub: self }
186    }
187    pub fn offerobject(&'a self) -> OfferobjectMethods<'a, C> {
188        OfferobjectMethods { hub: self }
189    }
190    pub fn permissions(&'a self) -> PermissionMethods<'a, C> {
191        PermissionMethods { hub: self }
192    }
193    pub fn smarttap(&'a self) -> SmarttapMethods<'a, C> {
194        SmarttapMethods { hub: self }
195    }
196    pub fn transitclass(&'a self) -> TransitclasMethods<'a, C> {
197        TransitclasMethods { hub: self }
198    }
199    pub fn transitobject(&'a self) -> TransitobjectMethods<'a, C> {
200        TransitobjectMethods { hub: self }
201    }
202    pub fn walletobjects(&'a self) -> WalletobjectMethods<'a, C> {
203        WalletobjectMethods { hub: self }
204    }
205
206    /// Set the user-agent header field to use in all requests to the server.
207    /// It defaults to `google-api-rust-client/7.0.0`.
208    ///
209    /// Returns the previously set user-agent.
210    pub fn user_agent(&mut self, agent_name: String) -> String {
211        std::mem::replace(&mut self._user_agent, agent_name)
212    }
213
214    /// Set the base url to use in all requests to the server.
215    /// It defaults to `https://walletobjects.googleapis.com/`.
216    ///
217    /// Returns the previously set base url.
218    pub fn base_url(&mut self, new_base_url: String) -> String {
219        std::mem::replace(&mut self._base_url, new_base_url)
220    }
221
222    /// Set the root url to use in all requests to the server.
223    /// It defaults to `https://walletobjects.googleapis.com/`.
224    ///
225    /// Returns the previously set root url.
226    pub fn root_url(&mut self, new_root_url: String) -> String {
227        std::mem::replace(&mut self._root_url, new_root_url)
228    }
229}
230
231// ############
232// SCHEMAS ###
233// ##########
234/// ActivationOptions for the class
235///
236/// This type is not used in any activity, and only used as *part* of another schema.
237///
238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
239#[serde_with::serde_as]
240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
241pub struct ActivationOptions {
242    /// HTTPS URL that supports REST semantics. Would be used for requesting activation from partners for given valuable, triggered by the users.
243    #[serde(rename = "activationUrl")]
244    pub activation_url: Option<String>,
245    /// Flag to allow users to make activation call from different device. This allows client to render the activation button enabled even if the activationStatus is ACTIVATED but the requested device is different than the current device.
246    #[serde(rename = "allowReactivation")]
247    pub allow_reactivation: Option<bool>,
248}
249
250impl common::Part for ActivationOptions {}
251
252/// The activation status of the object. This field includes activation status if valuable supports activation.
253///
254/// This type is not used in any activity, and only used as *part* of another schema.
255///
256#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
257#[serde_with::serde_as]
258#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
259pub struct ActivationStatus {
260    /// no description provided
261    pub state: Option<String>,
262}
263
264impl common::Part for ActivationStatus {}
265
266/// Resource used when the AddMessage endpoints are called.
267///
268/// # Activities
269///
270/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
271/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
272///
273/// * [addmessage eventticketclass](EventticketclasAddmessageCall) (request)
274/// * [addmessage eventticketobject](EventticketobjectAddmessageCall) (request)
275/// * [addmessage flightclass](FlightclasAddmessageCall) (request)
276/// * [addmessage flightobject](FlightobjectAddmessageCall) (request)
277/// * [addmessage genericclass](GenericclasAddmessageCall) (request)
278/// * [addmessage genericobject](GenericobjectAddmessageCall) (request)
279/// * [addmessage giftcardclass](GiftcardclasAddmessageCall) (request)
280/// * [addmessage giftcardobject](GiftcardobjectAddmessageCall) (request)
281/// * [addmessage loyaltyclass](LoyaltyclasAddmessageCall) (request)
282/// * [addmessage loyaltyobject](LoyaltyobjectAddmessageCall) (request)
283/// * [addmessage offerclass](OfferclasAddmessageCall) (request)
284/// * [addmessage offerobject](OfferobjectAddmessageCall) (request)
285/// * [addmessage transitclass](TransitclasAddmessageCall) (request)
286/// * [addmessage transitobject](TransitobjectAddmessageCall) (request)
287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
288#[serde_with::serde_as]
289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
290pub struct AddMessageRequest {
291    /// no description provided
292    pub message: Option<Message>,
293}
294
295impl common::RequestValue for AddMessageRequest {}
296
297/// There is no detailed description.
298///
299/// This type is not used in any activity, and only used as *part* of another schema.
300///
301#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
302#[serde_with::serde_as]
303#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
304pub struct AirportInfo {
305    /// Three character IATA airport code. This is a required field for `origin` and `destination`. Eg: "SFO"
306    #[serde(rename = "airportIataCode")]
307    pub airport_iata_code: Option<String>,
308    /// Optional field that overrides the airport city name defined by IATA. By default, Google takes the `airportIataCode` provided and maps it to the official airport city name defined by IATA. Official IATA airport city names can be found at IATA airport city names website. For example, for the airport IATA code "LTN", IATA website tells us that the corresponding airport city is "London". If this field is not populated, Google would display "London". However, populating this field with a custom name (eg: "London Luton") would override it.
309    #[serde(rename = "airportNameOverride")]
310    pub airport_name_override: Option<LocalizedString>,
311    /// A name of the gate. Eg: "B59" or "59"
312    pub gate: Option<String>,
313    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#airportInfo"`.
314    pub kind: Option<String>,
315    /// Terminal name. Eg: "INTL" or "I"
316    pub terminal: Option<String>,
317}
318
319impl common::Part for AirportInfo {}
320
321/// There is no detailed description.
322///
323/// This type is not used in any activity, and only used as *part* of another schema.
324///
325#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
326#[serde_with::serde_as]
327#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
328pub struct AppLinkData {
329    /// Optional information about the partner app link.
330    #[serde(rename = "androidAppLinkInfo")]
331    pub android_app_link_info: Option<AppLinkDataAppLinkInfo>,
332    /// Optional display text for the app link button. Character limit is 30.
333    #[serde(rename = "displayText")]
334    pub display_text: Option<LocalizedString>,
335    /// Deprecated. Links to open iOS apps are not supported.
336    #[serde(rename = "iosAppLinkInfo")]
337    pub ios_app_link_info: Option<AppLinkDataAppLinkInfo>,
338    /// Optional information about the partner web link.
339    #[serde(rename = "webAppLinkInfo")]
340    pub web_app_link_info: Option<AppLinkDataAppLinkInfo>,
341}
342
343impl common::Part for AppLinkData {}
344
345/// There is no detailed description.
346///
347/// This type is not used in any activity, and only used as *part* of another schema.
348///
349#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
350#[serde_with::serde_as]
351#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
352pub struct AppLinkDataAppLinkInfo {
353    /// Deprecated. Image isn't supported in the app link module.
354    #[serde(rename = "appLogoImage")]
355    pub app_logo_image: Option<Image>,
356    /// Target to follow when opening the app link on clients. It will be used by partners to open their app or webpage.
357    #[serde(rename = "appTarget")]
358    pub app_target: Option<AppLinkDataAppLinkInfoAppTarget>,
359    /// Deprecated. Description isn't supported in the app link module.
360    pub description: Option<LocalizedString>,
361    /// Deprecated. Title isn't supported in the app link module.
362    pub title: Option<LocalizedString>,
363}
364
365impl common::Part for AppLinkDataAppLinkInfo {}
366
367/// There is no detailed description.
368///
369/// This type is not used in any activity, and only used as *part* of another schema.
370///
371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
372#[serde_with::serde_as]
373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
374pub struct AppLinkDataAppLinkInfoAppTarget {
375    /// Package name for AppTarget. For example: com.google.android.gm
376    #[serde(rename = "packageName")]
377    pub package_name: Option<String>,
378    /// URI for AppTarget. The description on the URI must be set. Prefer setting package field instead, if this target is defined for your application.
379    #[serde(rename = "targetUri")]
380    pub target_uri: Option<Uri>,
381}
382
383impl common::Part for AppLinkDataAppLinkInfoAppTarget {}
384
385/// There is no detailed description.
386///
387/// This type is not used in any activity, and only used as *part* of another schema.
388///
389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
390#[serde_with::serde_as]
391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
392pub struct AuthenticationKey {
393    /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
394    pub id: Option<i32>,
395    /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
396    #[serde(rename = "publicKeyPem")]
397    pub public_key_pem: Option<String>,
398}
399
400impl common::Part for AuthenticationKey {}
401
402/// There is no detailed description.
403///
404/// This type is not used in any activity, and only used as *part* of another schema.
405///
406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
407#[serde_with::serde_as]
408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
409pub struct Barcode {
410    /// An optional text that will override the default text that shows under the barcode. This field is intended for a human readable equivalent of the barcode value, used when the barcode cannot be scanned.
411    #[serde(rename = "alternateText")]
412    pub alternate_text: Option<String>,
413    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#barcode"`.
414    pub kind: Option<String>,
415    /// The render encoding for the barcode. When specified, barcode is rendered in the given encoding. Otherwise best known encoding is chosen by Google.
416    #[serde(rename = "renderEncoding")]
417    pub render_encoding: Option<String>,
418    /// Optional text that will be shown when the barcode is hidden behind a click action. This happens in cases where a pass has Smart Tap enabled. If not specified, a default is chosen by Google.
419    #[serde(rename = "showCodeText")]
420    pub show_code_text: Option<LocalizedString>,
421    /// The type of barcode.
422    #[serde(rename = "type")]
423    pub type_: Option<String>,
424    /// The value encoded in the barcode.
425    pub value: Option<String>,
426}
427
428impl common::Part for Barcode {}
429
430/// There is no detailed description.
431///
432/// This type is not used in any activity, and only used as *part* of another schema.
433///
434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
435#[serde_with::serde_as]
436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
437pub struct BarcodeSectionDetail {
438    /// A reference to an existing text-based or image field to display.
439    #[serde(rename = "fieldSelector")]
440    pub field_selector: Option<FieldSelector>,
441}
442
443impl common::Part for BarcodeSectionDetail {}
444
445/// Information to read/write to blobstore2.
446///
447/// This type is not used in any activity, and only used as *part* of another schema.
448///
449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
450#[serde_with::serde_as]
451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
452pub struct Blobstore2Info {
453    /// The blob generation id.
454    #[serde(rename = "blobGeneration")]
455    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
456    pub blob_generation: Option<i64>,
457    /// The blob id, e.g., /blobstore/prod/playground/scotty
458    #[serde(rename = "blobId")]
459    pub blob_id: Option<String>,
460    /// A serialized External Read Token passed from Bigstore -> Scotty for a GCS download. This field must never be consumed outside of Bigstore, and is not applicable to non-GCS media uploads.
461    #[serde(rename = "downloadExternalReadToken")]
462    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
463    pub download_external_read_token: Option<Vec<u8>>,
464    /// Read handle passed from Bigstore -> Scotty for a GCS download. This is a signed, serialized blobstore2.ReadHandle proto which must never be set outside of Bigstore, and is not applicable to non-GCS media downloads.
465    #[serde(rename = "downloadReadHandle")]
466    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
467    pub download_read_handle: Option<Vec<u8>>,
468    /// The blob read token. Needed to read blobs that have not been replicated. Might not be available until the final call.
469    #[serde(rename = "readToken")]
470    pub read_token: Option<String>,
471    /// Metadata passed from Blobstore -> Scotty for a new GCS upload. This is a signed, serialized blobstore2.BlobMetadataContainer proto which must never be consumed outside of Bigstore, and is not applicable to non-GCS media uploads.
472    #[serde(rename = "uploadMetadataContainer")]
473    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
474    pub upload_metadata_container: Option<Vec<u8>>,
475}
476
477impl common::Part for Blobstore2Info {}
478
479/// There is no detailed description.
480///
481/// This type is not used in any activity, and only used as *part* of another schema.
482///
483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
484#[serde_with::serde_as]
485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
486pub struct BoardingAndSeatingInfo {
487    /// Set this field only if this flight boards through more than one door or bridge and you want to explicitly print the door location on the boarding pass. Most airlines route their passengers to the right door or bridge by refering to doors/bridges by the `seatClass`. In those cases `boardingDoor` should not be set.
488    #[serde(rename = "boardingDoor")]
489    pub boarding_door: Option<String>,
490    /// The value of boarding group (or zone) this passenger shall board with. eg: "B" The label for this value will be determined by the `boardingPolicy` field in the `flightClass` referenced by this object.
491    #[serde(rename = "boardingGroup")]
492    pub boarding_group: Option<String>,
493    /// The value of boarding position. eg: "76"
494    #[serde(rename = "boardingPosition")]
495    pub boarding_position: Option<String>,
496    /// A small image shown above the boarding barcode. Airlines can use it to communicate any special boarding privileges. In the event the security program logo is also set, this image might be rendered alongside the logo for that security program.
497    #[serde(rename = "boardingPrivilegeImage")]
498    pub boarding_privilege_image: Option<Image>,
499    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#boardingAndSeatingInfo"`.
500    pub kind: Option<String>,
501    /// The passenger's seat assignment. To be used when there is no specific identifier to use in `seatNumber`. eg: "assigned at gate"
502    #[serde(rename = "seatAssignment")]
503    pub seat_assignment: Option<LocalizedString>,
504    /// The value of the seat class. eg: "Economy" or "Economy Plus"
505    #[serde(rename = "seatClass")]
506    pub seat_class: Option<String>,
507    /// The value of passenger seat. If there is no specific identifier, use `seatAssignment` instead. eg: "25A"
508    #[serde(rename = "seatNumber")]
509    pub seat_number: Option<String>,
510    /// The sequence number on the boarding pass. This usually matches the sequence in which the passengers checked in. Airline might use the number for manual boarding and bag tags. eg: "49"
511    #[serde(rename = "sequenceNumber")]
512    pub sequence_number: Option<String>,
513}
514
515impl common::Part for BoardingAndSeatingInfo {}
516
517/// There is no detailed description.
518///
519/// This type is not used in any activity, and only used as *part* of another schema.
520///
521#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
522#[serde_with::serde_as]
523#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
524pub struct BoardingAndSeatingPolicy {
525    /// Indicates the policy the airline uses for boarding. If unset, Google will default to `zoneBased`.
526    #[serde(rename = "boardingPolicy")]
527    pub boarding_policy: Option<String>,
528    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#boardingAndSeatingPolicy"`.
529    pub kind: Option<String>,
530    /// Seating policy which dictates how we display the seat class. If unset, Google will default to `cabinBased`.
531    #[serde(rename = "seatClassPolicy")]
532    pub seat_class_policy: Option<String>,
533}
534
535impl common::Part for BoardingAndSeatingPolicy {}
536
537/// There is no detailed description.
538///
539/// This type is not used in any activity, and only used as *part* of another schema.
540///
541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
542#[serde_with::serde_as]
543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
544pub struct CallbackOptions {
545    /// URL for the merchant endpoint that would be called to request updates. The URL should be hosted on HTTPS and robots.txt should allow the URL path to be accessible by UserAgent:Googlebot. Deprecated.
546    #[serde(rename = "updateRequestUrl")]
547    pub update_request_url: Option<String>,
548    /// The HTTPS url configured by the merchant. The URL should be hosted on HTTPS and robots.txt should allow the URL path to be accessible by UserAgent:Googlebot.
549    pub url: Option<String>,
550}
551
552impl common::Part for CallbackOptions {}
553
554/// There is no detailed description.
555///
556/// This type is not used in any activity, and only used as *part* of another schema.
557///
558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
559#[serde_with::serde_as]
560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
561pub struct CardBarcodeSectionDetails {
562    /// Optional information to display below the barcode.
563    #[serde(rename = "firstBottomDetail")]
564    pub first_bottom_detail: Option<BarcodeSectionDetail>,
565    /// Optional information to display above the barcode. If `secondTopDetail` is defined, this will be displayed to the start side of this detail section.
566    #[serde(rename = "firstTopDetail")]
567    pub first_top_detail: Option<BarcodeSectionDetail>,
568    /// Optional second piece of information to display above the barcode. If `firstTopDetail` is defined, this will be displayed to the end side of this detail section.
569    #[serde(rename = "secondTopDetail")]
570    pub second_top_detail: Option<BarcodeSectionDetail>,
571}
572
573impl common::Part for CardBarcodeSectionDetails {}
574
575/// There is no detailed description.
576///
577/// This type is not used in any activity, and only used as *part* of another schema.
578///
579#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
580#[serde_with::serde_as]
581#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
582pub struct CardRowOneItem {
583    /// The item to be displayed in the row. This item will be automatically centered.
584    pub item: Option<TemplateItem>,
585}
586
587impl common::Part for CardRowOneItem {}
588
589/// There is no detailed description.
590///
591/// This type is not used in any activity, and only used as *part* of another schema.
592///
593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
594#[serde_with::serde_as]
595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
596pub struct CardRowTemplateInfo {
597    /// Template for a row containing one item. Exactly one of "one_item", "two_items", "three_items" must be set.
598    #[serde(rename = "oneItem")]
599    pub one_item: Option<CardRowOneItem>,
600    /// Template for a row containing three items. Exactly one of "one_item", "two_items", "three_items" must be set.
601    #[serde(rename = "threeItems")]
602    pub three_items: Option<CardRowThreeItems>,
603    /// Template for a row containing two items. Exactly one of "one_item", "two_items", "three_items" must be set.
604    #[serde(rename = "twoItems")]
605    pub two_items: Option<CardRowTwoItems>,
606}
607
608impl common::Part for CardRowTemplateInfo {}
609
610/// There is no detailed description.
611///
612/// This type is not used in any activity, and only used as *part* of another schema.
613///
614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
615#[serde_with::serde_as]
616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
617pub struct CardRowThreeItems {
618    /// The item to be displayed at the end of the row. This item will be aligned to the right.
619    #[serde(rename = "endItem")]
620    pub end_item: Option<TemplateItem>,
621    /// The item to be displayed in the middle of the row. This item will be centered between the start and end items.
622    #[serde(rename = "middleItem")]
623    pub middle_item: Option<TemplateItem>,
624    /// The item to be displayed at the start of the row. This item will be aligned to the left.
625    #[serde(rename = "startItem")]
626    pub start_item: Option<TemplateItem>,
627}
628
629impl common::Part for CardRowThreeItems {}
630
631/// There is no detailed description.
632///
633/// This type is not used in any activity, and only used as *part* of another schema.
634///
635#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
636#[serde_with::serde_as]
637#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
638pub struct CardRowTwoItems {
639    /// The item to be displayed at the end of the row. This item will be aligned to the right.
640    #[serde(rename = "endItem")]
641    pub end_item: Option<TemplateItem>,
642    /// The item to be displayed at the start of the row. This item will be aligned to the left.
643    #[serde(rename = "startItem")]
644    pub start_item: Option<TemplateItem>,
645}
646
647impl common::Part for CardRowTwoItems {}
648
649/// There is no detailed description.
650///
651/// This type is not used in any activity, and only used as *part* of another schema.
652///
653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
654#[serde_with::serde_as]
655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
656pub struct CardTemplateOverride {
657    /// Template information for rows in the card view. At most three rows are allowed to be specified.
658    #[serde(rename = "cardRowTemplateInfos")]
659    pub card_row_template_infos: Option<Vec<CardRowTemplateInfo>>,
660}
661
662impl common::Part for CardTemplateOverride {}
663
664/// There is no detailed description.
665///
666/// This type is not used in any activity, and only used as *part* of another schema.
667///
668#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
669#[serde_with::serde_as]
670#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
671pub struct ClassTemplateInfo {
672    /// Specifies extra information to be displayed above and below the barcode.
673    #[serde(rename = "cardBarcodeSectionDetails")]
674    pub card_barcode_section_details: Option<CardBarcodeSectionDetails>,
675    /// Override for the card view.
676    #[serde(rename = "cardTemplateOverride")]
677    pub card_template_override: Option<CardTemplateOverride>,
678    /// Override for the details view (beneath the card view).
679    #[serde(rename = "detailsTemplateOverride")]
680    pub details_template_override: Option<DetailsTemplateOverride>,
681    /// Override for the passes list view.
682    #[serde(rename = "listTemplateOverride")]
683    pub list_template_override: Option<ListTemplateOverride>,
684}
685
686impl common::Part for ClassTemplateInfo {}
687
688/// A sequence of media data references representing composite data. Introduced to support Bigstore composite objects. For details, visit http://go/bigstore-composites.
689///
690/// This type is not used in any activity, and only used as *part* of another schema.
691///
692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
693#[serde_with::serde_as]
694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
695pub struct CompositeMedia {
696    /// Blobstore v1 reference, set if reference_type is BLOBSTORE_REF This should be the byte representation of a blobstore.BlobRef. Since Blobstore is deprecating v1, use blobstore2_info instead. For now, any v2 blob will also be represented in this field as v1 BlobRef.
697    #[serde(rename = "blobRef")]
698    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
699    pub blob_ref: Option<Vec<u8>>,
700    /// Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers to a v2 blob.
701    #[serde(rename = "blobstore2Info")]
702    pub blobstore2_info: Option<Blobstore2Info>,
703    /// A binary data reference for a media download. Serves as a technology-agnostic binary reference in some Google infrastructure. This value is a serialized storage_cosmo.BinaryReference proto. Storing it as bytes is a hack to get around the fact that the cosmo proto (as well as others it includes) doesn't support JavaScript. This prevents us from including the actual type of this field.
704    #[serde(rename = "cosmoBinaryReference")]
705    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
706    pub cosmo_binary_reference: Option<Vec<u8>>,
707    /// crc32.c hash for the payload.
708    #[serde(rename = "crc32cHash")]
709    pub crc32c_hash: Option<u32>,
710    /// Media data, set if reference_type is INLINE
711    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
712    pub inline: Option<Vec<u8>>,
713    /// Size of the data, in bytes
714    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
715    pub length: Option<i64>,
716    /// MD5 hash for the payload.
717    #[serde(rename = "md5Hash")]
718    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
719    pub md5_hash: Option<Vec<u8>>,
720    /// Reference to a TI Blob, set if reference_type is BIGSTORE_REF.
721    #[serde(rename = "objectId")]
722    pub object_id: Option<ObjectId>,
723    /// Path to the data, set if reference_type is PATH
724    pub path: Option<String>,
725    /// Describes what the field reference contains.
726    #[serde(rename = "referenceType")]
727    pub reference_type: Option<String>,
728    /// SHA-1 hash for the payload.
729    #[serde(rename = "sha1Hash")]
730    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
731    pub sha1_hash: Option<Vec<u8>>,
732}
733
734impl common::Part for CompositeMedia {}
735
736/// Detailed Content-Type information from Scotty. The Content-Type of the media will typically be filled in by the header or Scotty's best_guess, but this extended information provides the backend with more information so that it can make a better decision if needed. This is only used on media upload requests from Scotty.
737///
738/// This type is not used in any activity, and only used as *part* of another schema.
739///
740#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
741#[serde_with::serde_as]
742#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
743pub struct ContentTypeInfo {
744    /// Scotty's best guess of what the content type of the file is.
745    #[serde(rename = "bestGuess")]
746    pub best_guess: Option<String>,
747    /// The content type of the file derived by looking at specific bytes (i.e. "magic bytes") of the actual file.
748    #[serde(rename = "fromBytes")]
749    pub from_bytes: Option<String>,
750    /// The content type of the file derived from the file extension of the original file name used by the client.
751    #[serde(rename = "fromFileName")]
752    pub from_file_name: Option<String>,
753    /// The content type of the file as specified in the request headers, multipart headers, or RUPIO start request.
754    #[serde(rename = "fromHeader")]
755    pub from_header: Option<String>,
756    /// The content type of the file derived from the file extension of the URL path. The URL path is assumed to represent a file name (which is typically only true for agents that are providing a REST API).
757    #[serde(rename = "fromUrlPath")]
758    pub from_url_path: Option<String>,
759}
760
761impl common::Part for ContentTypeInfo {}
762
763/// There is no detailed description.
764///
765/// This type is not used in any activity, and only used as *part* of another schema.
766///
767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
768#[serde_with::serde_as]
769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
770pub struct DateTime {
771    /// An ISO 8601 extended format date/time. Offset may or may not be required (refer to the parent field's documentation). Time may be specified up to nanosecond precision. Offsets may be specified with seconds precision (even though offset seconds is not part of ISO 8601). For example: `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time as the above example). If the date/time is intended for a physical location in New York, this would be the equivalent of Eastern Daylight Time (EDT). Remember that offset varies in regions that observe Daylight Saving Time (or Summer Time), depending on the time of the year. `1985-04-12T19:20:50.52` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985 with no offset information. Providing an offset makes this an absolute instant in time around the world. The date/time will be adjusted based on the user's time zone. For example, a time of `2018-06-19T18:30:00-04:00` will be 18:30:00 for a user in New York and 15:30:00 for a user in Los Angeles. Omitting the offset makes this a local date/time, representing several instants in time around the world. The date/time will always be in the user's current time zone. For example, a time of `2018-06-19T18:30:00` will be 18:30:00 for a user in New York and also 18:30:00 for a user in Los Angeles. This is useful when the same local date/time should apply to many physical locations across several time zones.
772    pub date: Option<String>,
773}
774
775impl common::Part for DateTime {}
776
777/// There is no detailed description.
778///
779/// This type is not used in any activity, and only used as *part* of another schema.
780///
781#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
782#[serde_with::serde_as]
783#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
784pub struct DetailsItemInfo {
785    /// The item to be displayed in the details list.
786    pub item: Option<TemplateItem>,
787}
788
789impl common::Part for DetailsItemInfo {}
790
791/// There is no detailed description.
792///
793/// This type is not used in any activity, and only used as *part* of another schema.
794///
795#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
796#[serde_with::serde_as]
797#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
798pub struct DetailsTemplateOverride {
799    /// Information for the "nth" item displayed in the details list.
800    #[serde(rename = "detailsItemInfos")]
801    pub details_item_infos: Option<Vec<DetailsItemInfo>>,
802}
803
804impl common::Part for DetailsTemplateOverride {}
805
806/// Device context associated with the object.
807///
808/// This type is not used in any activity, and only used as *part* of another schema.
809///
810#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
811#[serde_with::serde_as]
812#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
813pub struct DeviceContext {
814    /// If set, redemption information will only be returned to the given device upon activation of the object. This should not be used as a stable identifier to trace a user's device. It can change across different passes for the same device or even across different activations for the same device. When setting this, callers must also set has_linked_device on the object being activated.
815    #[serde(rename = "deviceToken")]
816    pub device_token: Option<String>,
817}
818
819impl common::Part for DeviceContext {}
820
821/// Backend response for a Diff get checksums response. For details on the Scotty Diff protocol, visit http://go/scotty-diff-protocol.
822///
823/// This type is not used in any activity, and only used as *part* of another schema.
824///
825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
826#[serde_with::serde_as]
827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
828pub struct DiffChecksumsResponse {
829    /// Exactly one of these fields must be populated. If checksums_location is filled, the server will return the corresponding contents to the user. If object_location is filled, the server will calculate the checksums based on the content there and return that to the user. For details on the format of the checksums, see http://go/scotty-diff-protocol.
830    #[serde(rename = "checksumsLocation")]
831    pub checksums_location: Option<CompositeMedia>,
832    /// The chunk size of checksums. Must be a multiple of 256KB.
833    #[serde(rename = "chunkSizeBytes")]
834    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
835    pub chunk_size_bytes: Option<i64>,
836    /// If set, calculate the checksums based on the contents and return them to the caller.
837    #[serde(rename = "objectLocation")]
838    pub object_location: Option<CompositeMedia>,
839    /// The total size of the server object.
840    #[serde(rename = "objectSizeBytes")]
841    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
842    pub object_size_bytes: Option<i64>,
843    /// The object version of the object the checksums are being returned for.
844    #[serde(rename = "objectVersion")]
845    pub object_version: Option<String>,
846}
847
848impl common::Part for DiffChecksumsResponse {}
849
850/// Backend response for a Diff download response. For details on the Scotty Diff protocol, visit http://go/scotty-diff-protocol.
851///
852/// This type is not used in any activity, and only used as *part* of another schema.
853///
854#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
855#[serde_with::serde_as]
856#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
857pub struct DiffDownloadResponse {
858    /// The original object location.
859    #[serde(rename = "objectLocation")]
860    pub object_location: Option<CompositeMedia>,
861}
862
863impl common::Part for DiffDownloadResponse {}
864
865/// A Diff upload request. For details on the Scotty Diff protocol, visit http://go/scotty-diff-protocol.
866///
867/// This type is not used in any activity, and only used as *part* of another schema.
868///
869#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
870#[serde_with::serde_as]
871#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
872pub struct DiffUploadRequest {
873    /// The location of the checksums for the new object. Agents must clone the object located here, as the upload server will delete the contents once a response is received. For details on the format of the checksums, see http://go/scotty-diff-protocol.
874    #[serde(rename = "checksumsInfo")]
875    pub checksums_info: Option<CompositeMedia>,
876    /// The location of the new object. Agents must clone the object located here, as the upload server will delete the contents once a response is received.
877    #[serde(rename = "objectInfo")]
878    pub object_info: Option<CompositeMedia>,
879    /// The object version of the object that is the base version the incoming diff script will be applied to. This field will always be filled in.
880    #[serde(rename = "objectVersion")]
881    pub object_version: Option<String>,
882}
883
884impl common::Part for DiffUploadRequest {}
885
886/// Backend response for a Diff upload request. For details on the Scotty Diff protocol, visit http://go/scotty-diff-protocol.
887///
888/// This type is not used in any activity, and only used as *part* of another schema.
889///
890#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
891#[serde_with::serde_as]
892#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
893pub struct DiffUploadResponse {
894    /// The object version of the object at the server. Must be included in the end notification response. The version in the end notification response must correspond to the new version of the object that is now stored at the server, after the upload.
895    #[serde(rename = "objectVersion")]
896    pub object_version: Option<String>,
897    /// The location of the original file for a diff upload request. Must be filled in if responding to an upload start notification.
898    #[serde(rename = "originalObject")]
899    pub original_object: Option<CompositeMedia>,
900}
901
902impl common::Part for DiffUploadResponse {}
903
904/// Backend response for a Diff get version response. For details on the Scotty Diff protocol, visit http://go/scotty-diff-protocol.
905///
906/// This type is not used in any activity, and only used as *part* of another schema.
907///
908#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
909#[serde_with::serde_as]
910#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
911pub struct DiffVersionResponse {
912    /// The total size of the server object.
913    #[serde(rename = "objectSizeBytes")]
914    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
915    pub object_size_bytes: Option<i64>,
916    /// The version of the object stored at the server.
917    #[serde(rename = "objectVersion")]
918    pub object_version: Option<String>,
919}
920
921impl common::Part for DiffVersionResponse {}
922
923/// Information about how a class may be discovered and instantiated from within the Google Wallet app. This is done by searching for a loyalty or gift card program and scanning or manually entering.
924///
925/// This type is not used in any activity, and only used as *part* of another schema.
926///
927#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
928#[serde_with::serde_as]
929#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
930pub struct DiscoverableProgram {
931    /// Information about the ability to signin and add a valuable for this program through a merchant site. Used when MERCHANT_HOSTED_SIGNIN is enabled.
932    #[serde(rename = "merchantSigninInfo")]
933    pub merchant_signin_info: Option<DiscoverableProgramMerchantSigninInfo>,
934    /// Information about the ability to signup and add a valuable for this program through a merchant site. Used when MERCHANT_HOSTED_SIGNUP is enabled.
935    #[serde(rename = "merchantSignupInfo")]
936    pub merchant_signup_info: Option<DiscoverableProgramMerchantSignupInfo>,
937    /// Visibility state of the discoverable program.
938    pub state: Option<String>,
939}
940
941impl common::Part for DiscoverableProgram {}
942
943/// Information about the merchant hosted signin flow for a program.
944///
945/// This type is not used in any activity, and only used as *part* of another schema.
946///
947#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
948#[serde_with::serde_as]
949#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
950pub struct DiscoverableProgramMerchantSigninInfo {
951    /// The URL to direct the user to for the merchant's signin site.
952    #[serde(rename = "signinWebsite")]
953    pub signin_website: Option<Uri>,
954}
955
956impl common::Part for DiscoverableProgramMerchantSigninInfo {}
957
958/// Information about the merchant hosted signup flow for a program.
959///
960/// This type is not used in any activity, and only used as *part* of another schema.
961///
962#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
963#[serde_with::serde_as]
964#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
965pub struct DiscoverableProgramMerchantSignupInfo {
966    /// User data that is sent in a POST request to the signup website URL. This information is encoded and then shared so that the merchant's website can prefill fields used to enroll the user for the discoverable program.
967    #[serde(rename = "signupSharedDatas")]
968    pub signup_shared_datas: Option<Vec<String>>,
969    /// The URL to direct the user to for the merchant's signup site.
970    #[serde(rename = "signupWebsite")]
971    pub signup_website: Option<Uri>,
972}
973
974impl common::Part for DiscoverableProgramMerchantSignupInfo {}
975
976/// Parameters specific to media downloads.
977///
978/// This type is not used in any activity, and only used as *part* of another schema.
979///
980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
981#[serde_with::serde_as]
982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
983pub struct DownloadParameters {
984    /// A boolean to be returned in the response to Scotty. Allows/disallows gzip encoding of the payload content when the server thinks it's advantageous (hence, does not guarantee compression) which allows Scotty to GZip the response to the client.
985    #[serde(rename = "allowGzipCompression")]
986    pub allow_gzip_compression: Option<bool>,
987    /// Determining whether or not Apiary should skip the inclusion of any Content-Range header on its response to Scotty.
988    #[serde(rename = "ignoreRange")]
989    pub ignore_range: Option<bool>,
990}
991
992impl common::Part for DownloadParameters {}
993
994/// There is no detailed description.
995///
996/// This type is not used in any activity, and only used as *part* of another schema.
997///
998#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
999#[serde_with::serde_as]
1000#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1001pub struct EventDateTime {
1002    /// A custom label to use for the doors open value (`doorsOpen`) on the card detail view. This should only be used if the default "Doors Open" label or one of the `doorsOpenLabel` options is not sufficient. Both `doorsOpenLabel` and `customDoorsOpenLabel` may not be set. If neither is set, the label will default to "Doors Open", localized. If the doors open field is unset, this label will not be used.
1003    #[serde(rename = "customDoorsOpenLabel")]
1004    pub custom_doors_open_label: Option<LocalizedString>,
1005    /// The date/time when the doors open at the venue. This is an ISO 8601 extended format date/time, with or without an offset. Time may be specified up to nanosecond precision. Offsets may be specified with seconds precision (even though offset seconds is not part of ISO 8601). For example: `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time as the above example). If the event were in New York, this would be the equivalent of Eastern Daylight Time (EDT). Remember that offset varies in regions that observe Daylight Saving Time (or Summer Time), depending on the time of the year. `1985-04-12T19:20:50.52` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985 with no offset information. The portion of the date/time without the offset is considered the "local date/time". This should be the local date/time at the venue. For example, if the event occurs at the 20th hour of June 5th, 2018 at the venue, the local date/time portion should be `2018-06-05T20:00:00`. If the local date/time at the venue is 4 hours before UTC, an offset of `-04:00` may be appended. Without offset information, some rich features may not be available.
1006    #[serde(rename = "doorsOpen")]
1007    pub doors_open: Option<String>,
1008    /// The label to use for the doors open value (`doorsOpen`) on the card detail view. Each available option maps to a set of localized strings, so that translations are shown to the user based on their locale. Both `doorsOpenLabel` and `customDoorsOpenLabel` may not be set. If neither is set, the label will default to "Doors Open", localized. If the doors open field is unset, this label will not be used.
1009    #[serde(rename = "doorsOpenLabel")]
1010    pub doors_open_label: Option<String>,
1011    /// The date/time when the event ends. If the event spans multiple days, it should be the end date/time on the last day. This is an ISO 8601 extended format date/time, with or without an offset. Time may be specified up to nanosecond precision. Offsets may be specified with seconds precision (even though offset seconds is not part of ISO 8601). For example: `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time as the above example). If the event were in New York, this would be the equivalent of Eastern Daylight Time (EDT). Remember that offset varies in regions that observe Daylight Saving Time (or Summer Time), depending on the time of the year. `1985-04-12T19:20:50.52` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985 with no offset information. The portion of the date/time without the offset is considered the "local date/time". This should be the local date/time at the venue. For example, if the event occurs at the 20th hour of June 5th, 2018 at the venue, the local date/time portion should be `2018-06-05T20:00:00`. If the local date/time at the venue is 4 hours before UTC, an offset of `-04:00` may be appended. Without offset information, some rich features may not be available.
1012    pub end: Option<String>,
1013    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventDateTime"`.
1014    pub kind: Option<String>,
1015    /// The date/time when the event starts. If the event spans multiple days, it should be the start date/time on the first day. This is an ISO 8601 extended format date/time, with or without an offset. Time may be specified up to nanosecond precision. Offsets may be specified with seconds precision (even though offset seconds is not part of ISO 8601). For example: `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time as the above example). If the event were in New York, this would be the equivalent of Eastern Daylight Time (EDT). Remember that offset varies in regions that observe Daylight Saving Time (or Summer Time), depending on the time of the year. `1985-04-12T19:20:50.52` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985 with no offset information. The portion of the date/time without the offset is considered the "local date/time". This should be the local date/time at the venue. For example, if the event occurs at the 20th hour of June 5th, 2018 at the venue, the local date/time portion should be `2018-06-05T20:00:00`. If the local date/time at the venue is 4 hours before UTC, an offset of `-04:00` may be appended. Without offset information, some rich features may not be available.
1016    pub start: Option<String>,
1017}
1018
1019impl common::Part for EventDateTime {}
1020
1021/// There is no detailed description.
1022///
1023/// This type is not used in any activity, and only used as *part* of another schema.
1024///
1025#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1026#[serde_with::serde_as]
1027#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1028pub struct EventReservationInfo {
1029    /// The confirmation code of the event reservation. This may also take the form of an "order number", "confirmation number", "reservation number", or other equivalent.
1030    #[serde(rename = "confirmationCode")]
1031    pub confirmation_code: Option<String>,
1032    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventReservationInfo"`.
1033    pub kind: Option<String>,
1034}
1035
1036impl common::Part for EventReservationInfo {}
1037
1038/// There is no detailed description.
1039///
1040/// This type is not used in any activity, and only used as *part* of another schema.
1041///
1042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1043#[serde_with::serde_as]
1044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1045pub struct EventSeat {
1046    /// The gate the ticket holder should enter to get to their seat, such as "A" or "West". This field is localizable so you may translate words or use different alphabets for the characters in an identifier.
1047    pub gate: Option<LocalizedString>,
1048    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventSeat"`.
1049    pub kind: Option<String>,
1050    /// The row of the seat, such as "1", E", "BB", or "A5". This field is localizable so you may translate words or use different alphabets for the characters in an identifier.
1051    pub row: Option<LocalizedString>,
1052    /// The seat number, such as "1", "2", "3", or any other seat identifier. This field is localizable so you may translate words or use different alphabets for the characters in an identifier.
1053    pub seat: Option<LocalizedString>,
1054    /// The section of the seat, such as "121". This field is localizable so you may translate words or use different alphabets for the characters in an identifier.
1055    pub section: Option<LocalizedString>,
1056}
1057
1058impl common::Part for EventSeat {}
1059
1060/// There is no detailed description.
1061///
1062/// # Activities
1063///
1064/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1065/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1066///
1067/// * [get eventticketclass](EventticketclasGetCall) (response)
1068/// * [insert eventticketclass](EventticketclasInsertCall) (request|response)
1069/// * [patch eventticketclass](EventticketclasPatchCall) (request|response)
1070/// * [update eventticketclass](EventticketclasUpdateCall) (request|response)
1071#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1072#[serde_with::serde_as]
1073#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1074pub struct EventTicketClass {
1075    /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
1076    #[serde(rename = "allowMultipleUsersPerObject")]
1077    pub allow_multiple_users_per_object: Option<bool>,
1078    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding object that will be used instead.
1079    #[serde(rename = "appLinkData")]
1080    pub app_link_data: Option<AppLinkData>,
1081    /// Callback options to be used to call the issuer back for every save/delete of an object for this class by the end-user. All objects of this class are eligible for the callback.
1082    #[serde(rename = "callbackOptions")]
1083    pub callback_options: Option<CallbackOptions>,
1084    /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
1085    #[serde(rename = "classTemplateInfo")]
1086    pub class_template_info: Option<ClassTemplateInfo>,
1087    /// The label to use for the confirmation code value (`eventTicketObject.reservationInfo.confirmationCode`) on the card detail view. Each available option maps to a set of localized strings, so that translations are shown to the user based on their locale. Both `confirmationCodeLabel` and `customConfirmationCodeLabel` may not be set. If neither is set, the label will default to "Confirmation Code", localized. If the confirmation code field is unset, this label will not be used.
1088    #[serde(rename = "confirmationCodeLabel")]
1089    pub confirmation_code_label: Option<String>,
1090    /// Country code used to display the card's country (when the user is not in that country), as well as to display localized content when content is not available in the user's locale.
1091    #[serde(rename = "countryCode")]
1092    pub country_code: Option<String>,
1093    /// A custom label to use for the confirmation code value (`eventTicketObject.reservationInfo.confirmationCode`) on the card detail view. This should only be used if the default "Confirmation Code" label or one of the `confirmationCodeLabel` options is not sufficient. Both `confirmationCodeLabel` and `customConfirmationCodeLabel` may not be set. If neither is set, the label will default to "Confirmation Code", localized. If the confirmation code field is unset, this label will not be used.
1094    #[serde(rename = "customConfirmationCodeLabel")]
1095    pub custom_confirmation_code_label: Option<LocalizedString>,
1096    /// A custom label to use for the gate value (`eventTicketObject.seatInfo.gate`) on the card detail view. This should only be used if the default "Gate" label or one of the `gateLabel` options is not sufficient. Both `gateLabel` and `customGateLabel` may not be set. If neither is set, the label will default to "Gate", localized. If the gate field is unset, this label will not be used.
1097    #[serde(rename = "customGateLabel")]
1098    pub custom_gate_label: Option<LocalizedString>,
1099    /// A custom label to use for the row value (`eventTicketObject.seatInfo.row`) on the card detail view. This should only be used if the default "Row" label or one of the `rowLabel` options is not sufficient. Both `rowLabel` and `customRowLabel` may not be set. If neither is set, the label will default to "Row", localized. If the row field is unset, this label will not be used.
1100    #[serde(rename = "customRowLabel")]
1101    pub custom_row_label: Option<LocalizedString>,
1102    /// A custom label to use for the seat value (`eventTicketObject.seatInfo.seat`) on the card detail view. This should only be used if the default "Seat" label or one of the `seatLabel` options is not sufficient. Both `seatLabel` and `customSeatLabel` may not be set. If neither is set, the label will default to "Seat", localized. If the seat field is unset, this label will not be used.
1103    #[serde(rename = "customSeatLabel")]
1104    pub custom_seat_label: Option<LocalizedString>,
1105    /// A custom label to use for the section value (`eventTicketObject.seatInfo.section`) on the card detail view. This should only be used if the default "Section" label or one of the `sectionLabel` options is not sufficient. Both `sectionLabel` and `customSectionLabel` may not be set. If neither is set, the label will default to "Section", localized. If the section field is unset, this label will not be used.
1106    #[serde(rename = "customSectionLabel")]
1107    pub custom_section_label: Option<LocalizedString>,
1108    /// The date & time information of the event.
1109    #[serde(rename = "dateTime")]
1110    pub date_time: Option<EventDateTime>,
1111    /// Identifies whether this class supports Smart Tap. The `redemptionIssuers` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
1112    #[serde(rename = "enableSmartTap")]
1113    pub enable_smart_tap: Option<bool>,
1114    /// The ID of the event. This ID should be unique for every event in an account. It is used to group tickets together if the user has saved multiple tickets for the same event. It can be at most 64 characters. If provided, the grouping will be stable. Be wary of unintentional collision to avoid grouping tickets that should not be grouped. If you use only one class per event, you can simply set this to the `classId` (with or without the issuer ID portion). If not provided, the platform will attempt to use other data to group tickets (potentially unstable).
1115    #[serde(rename = "eventId")]
1116    pub event_id: Option<String>,
1117    /// Required. The name of the event, such as "LA Dodgers at SF Giants".
1118    #[serde(rename = "eventName")]
1119    pub event_name: Option<LocalizedString>,
1120    /// The fine print, terms, or conditions of the ticket.
1121    #[serde(rename = "finePrint")]
1122    pub fine_print: Option<LocalizedString>,
1123    /// The label to use for the gate value (`eventTicketObject.seatInfo.gate`) on the card detail view. Each available option maps to a set of localized strings, so that translations are shown to the user based on their locale. Both `gateLabel` and `customGateLabel` may not be set. If neither is set, the label will default to "Gate", localized. If the gate field is unset, this label will not be used.
1124    #[serde(rename = "gateLabel")]
1125    pub gate_label: Option<String>,
1126    /// Optional banner image displayed on the front of the card. If none is present, nothing will be displayed. The image will display at 100% width.
1127    #[serde(rename = "heroImage")]
1128    pub hero_image: Option<Image>,
1129    /// The background color for the card. If not set the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used. The format is #rrggbb where rrggbb is a hex RGB triplet, such as `#ffcc00`. You can also use the shorthand version of the RGB triplet which is #rgb, such as `#fc0`.
1130    #[serde(rename = "hexBackgroundColor")]
1131    pub hex_background_color: Option<String>,
1132    /// The URI of your application's home page. Populating the URI in this field results in the exact same behavior as populating an URI in linksModuleData (when an object is rendered, a link to the homepage is shown in what would usually be thought of as the linksModuleData section of the object).
1133    #[serde(rename = "homepageUri")]
1134    pub homepage_uri: Option<Uri>,
1135    /// Required. The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
1136    pub id: Option<String>,
1137    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
1138    #[serde(rename = "imageModulesData")]
1139    pub image_modules_data: Option<Vec<ImageModuleData>>,
1140    /// Deprecated. Use textModulesData instead.
1141    #[serde(rename = "infoModuleData")]
1142    pub info_module_data: Option<InfoModuleData>,
1143    /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
1144    #[serde(rename = "issuerName")]
1145    pub issuer_name: Option<String>,
1146    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventTicketClass"`.
1147    pub kind: Option<String>,
1148    /// Links module data. If links module data is also defined on the object, both will be displayed.
1149    #[serde(rename = "linksModuleData")]
1150    pub links_module_data: Option<LinksModuleData>,
1151    /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
1152    #[serde(rename = "localizedIssuerName")]
1153    pub localized_issuer_name: Option<LocalizedString>,
1154    /// Note: This field is currently not supported to trigger geo notifications.
1155    pub locations: Option<Vec<LatLongPoint>>,
1156    /// The logo image of the ticket. This image is displayed in the card detail view of the app.
1157    pub logo: Option<Image>,
1158    /// Merchant locations. There is a maximum of ten on the class. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
1159    #[serde(rename = "merchantLocations")]
1160    pub merchant_locations: Option<Vec<MerchantLocation>>,
1161    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
1162    pub messages: Option<Vec<Message>>,
1163    /// Identifies whether multiple users and devices will save the same object referencing this class.
1164    #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
1165    pub multiple_devices_and_holders_allowed_status: Option<String>,
1166    /// Whether or not field updates to this class should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If not specified, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
1167    #[serde(rename = "notifyPreference")]
1168    pub notify_preference: Option<String>,
1169    /// Identifies which redemption issuers can redeem the pass over Smart Tap. Redemption issuers are identified by their issuer ID. Redemption issuers must have at least one Smart Tap key configured. The `enableSmartTap` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
1170    #[serde(rename = "redemptionIssuers")]
1171    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1172    pub redemption_issuers: Option<Vec<i64>>,
1173    /// The review comments set by the platform when a class is marked `approved` or `rejected`.
1174    pub review: Option<Review>,
1175    /// Required. The status of the class. This field can be set to `draft` or `underReview` using the insert, patch, or update API calls. Once the review state is changed from `draft` it may not be changed back to `draft`. You should keep this field to `draft` when the class is under development. A `draft` class cannot be used to create any object. You should set this field to `underReview` when you believe the class is ready for use. The platform will automatically set this field to `approved` and it can be immediately used to create or migrate objects. When updating an already `approved` class you should keep setting this field to `underReview`.
1176    #[serde(rename = "reviewStatus")]
1177    pub review_status: Option<String>,
1178    /// The label to use for the row value (`eventTicketObject.seatInfo.row`) on the card detail view. Each available option maps to a set of localized strings, so that translations are shown to the user based on their locale. Both `rowLabel` and `customRowLabel` may not be set. If neither is set, the label will default to "Row", localized. If the row field is unset, this label will not be used.
1179    #[serde(rename = "rowLabel")]
1180    pub row_label: Option<String>,
1181    /// The label to use for the seat value (`eventTicketObject.seatInfo.seat`) on the card detail view. Each available option maps to a set of localized strings, so that translations are shown to the user based on their locale. Both `seatLabel` and `customSeatLabel` may not be set. If neither is set, the label will default to "Seat", localized. If the seat field is unset, this label will not be used.
1182    #[serde(rename = "seatLabel")]
1183    pub seat_label: Option<String>,
1184    /// The label to use for the section value (`eventTicketObject.seatInfo.section`) on the card detail view. Each available option maps to a set of localized strings, so that translations are shown to the user based on their locale. Both `sectionLabel` and `customSectionLabel` may not be set. If neither is set, the label will default to "Section", localized. If the section field is unset, this label will not be used.
1185    #[serde(rename = "sectionLabel")]
1186    pub section_label: Option<String>,
1187    /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
1188    #[serde(rename = "securityAnimation")]
1189    pub security_animation: Option<SecurityAnimation>,
1190    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
1191    #[serde(rename = "textModulesData")]
1192    pub text_modules_data: Option<Vec<TextModuleData>>,
1193    /// Optional value added module data. Maximum of ten on the class. For a pass only ten will be displayed, prioritizing those from the object.
1194    #[serde(rename = "valueAddedModuleData")]
1195    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
1196    /// Event venue details.
1197    pub venue: Option<EventVenue>,
1198    /// Deprecated
1199    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1200    pub version: Option<i64>,
1201    /// View Unlock Requirement options for the event ticket.
1202    #[serde(rename = "viewUnlockRequirement")]
1203    pub view_unlock_requirement: Option<String>,
1204    /// The wide logo of the ticket. When provided, this will be used in place of the logo in the top left of the card view.
1205    #[serde(rename = "wideLogo")]
1206    pub wide_logo: Option<Image>,
1207    /// Deprecated.
1208    #[serde(rename = "wordMark")]
1209    pub word_mark: Option<Image>,
1210}
1211
1212impl common::RequestValue for EventTicketClass {}
1213impl common::ResponseResult for EventTicketClass {}
1214
1215/// There is no detailed description.
1216///
1217/// # Activities
1218///
1219/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1220/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1221///
1222/// * [addmessage eventticketclass](EventticketclasAddmessageCall) (response)
1223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1224#[serde_with::serde_as]
1225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1226pub struct EventTicketClassAddMessageResponse {
1227    /// The updated EventTicketClass resource.
1228    pub resource: Option<EventTicketClass>,
1229}
1230
1231impl common::ResponseResult for EventTicketClassAddMessageResponse {}
1232
1233/// There is no detailed description.
1234///
1235/// # Activities
1236///
1237/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1238/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1239///
1240/// * [list eventticketclass](EventticketclasListCall) (response)
1241#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1242#[serde_with::serde_as]
1243#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1244pub struct EventTicketClassListResponse {
1245    /// Pagination of the response.
1246    pub pagination: Option<Pagination>,
1247    /// Resources corresponding to the list request.
1248    pub resources: Option<Vec<EventTicketClass>>,
1249}
1250
1251impl common::ResponseResult for EventTicketClassListResponse {}
1252
1253/// There is no detailed description.
1254///
1255/// # Activities
1256///
1257/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1258/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1259///
1260/// * [get eventticketobject](EventticketobjectGetCall) (response)
1261/// * [insert eventticketobject](EventticketobjectInsertCall) (request|response)
1262/// * [modifylinkedofferobjects eventticketobject](EventticketobjectModifylinkedofferobjectCall) (response)
1263/// * [patch eventticketobject](EventticketobjectPatchCall) (request|response)
1264/// * [update eventticketobject](EventticketobjectUpdateCall) (request|response)
1265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1266#[serde_with::serde_as]
1267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1268pub struct EventTicketObject {
1269    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding class only object AppLinkData will be displayed.
1270    #[serde(rename = "appLinkData")]
1271    pub app_link_data: Option<AppLinkData>,
1272    /// The barcode type and value.
1273    pub barcode: Option<Barcode>,
1274    /// Required. The class associated with this object. The class must be of the same type as this object, must already exist, and must be approved. Class IDs should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you.
1275    #[serde(rename = "classId")]
1276    pub class_id: Option<String>,
1277    /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
1278    #[serde(rename = "classReference")]
1279    pub class_reference: Option<EventTicketClass>,
1280    /// Indicates if notifications should explicitly be suppressed. If this field is set to true, regardless of the `messages` field, expiration notifications to the user will be suppressed. By default, this field is set to false. Currently, this can only be set for offers.
1281    #[serde(rename = "disableExpirationNotification")]
1282    pub disable_expiration_notification: Option<bool>,
1283    /// The face value of the ticket, matching what would be printed on a physical version of the ticket.
1284    #[serde(rename = "faceValue")]
1285    pub face_value: Option<Money>,
1286    /// Information that controls how passes are grouped together.
1287    #[serde(rename = "groupingInfo")]
1288    pub grouping_info: Option<GroupingInfo>,
1289    /// Whether this object is currently linked to a single device. This field is set by the platform when a user saves the object, linking it to their device. Intended for use by select partners. Contact support for additional information.
1290    #[serde(rename = "hasLinkedDevice")]
1291    pub has_linked_device: Option<bool>,
1292    /// Indicates if the object has users. This field is set by the platform.
1293    #[serde(rename = "hasUsers")]
1294    pub has_users: Option<bool>,
1295    /// Optional banner image displayed on the front of the card. If none is present, hero image of the class, if present, will be displayed. If hero image of the class is also not present, nothing will be displayed.
1296    #[serde(rename = "heroImage")]
1297    pub hero_image: Option<Image>,
1298    /// The background color for the card. If not set the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used. The format is #rrggbb where rrggbb is a hex RGB triplet, such as `#ffcc00`. You can also use the shorthand version of the RGB triplet which is #rgb, such as `#fc0`.
1299    #[serde(rename = "hexBackgroundColor")]
1300    pub hex_background_color: Option<String>,
1301    /// Required. The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you. The unique identifier should only include alphanumeric characters, '.', '_', or '-'.
1302    pub id: Option<String>,
1303    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
1304    #[serde(rename = "imageModulesData")]
1305    pub image_modules_data: Option<Vec<ImageModuleData>>,
1306    /// Deprecated. Use textModulesData instead.
1307    #[serde(rename = "infoModuleData")]
1308    pub info_module_data: Option<InfoModuleData>,
1309    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventTicketObject"`.
1310    pub kind: Option<String>,
1311    /// linked_object_ids are a list of other objects such as event ticket, loyalty, offer, generic, giftcard, transit and boarding pass that should be automatically attached to this event ticket object. If a user had saved this event ticket, then these linked_object_ids would be automatically pushed to the user's wallet (unless they turned off the setting to receive such linked passes). Make sure that objects present in linked_object_ids are already inserted - if not, calls would fail. Once linked, the linked objects cannot be unlinked. You cannot link objects belonging to another issuer. There is a limit to the number of objects that can be linked to a single object. After the limit is reached, new linked objects in the call will be ignored silently. Object IDs should follow the format issuer ID. identifier where the former is issued by Google and the latter is chosen by you.
1312    #[serde(rename = "linkedObjectIds")]
1313    pub linked_object_ids: Option<Vec<String>>,
1314    /// A list of offer objects linked to this event ticket. The offer objects must already exist. Offer object IDs should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you.
1315    #[serde(rename = "linkedOfferIds")]
1316    pub linked_offer_ids: Option<Vec<String>>,
1317    /// Links module data. If links module data is also defined on the class, both will be displayed.
1318    #[serde(rename = "linksModuleData")]
1319    pub links_module_data: Option<LinksModuleData>,
1320    /// Note: This field is currently not supported to trigger geo notifications.
1321    pub locations: Option<Vec<LatLongPoint>>,
1322    /// Merchant locations. There is a maximum of ten on the object. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
1323    #[serde(rename = "merchantLocations")]
1324    pub merchant_locations: Option<Vec<MerchantLocation>>,
1325    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
1326    pub messages: Option<Vec<Message>>,
1327    /// Whether or not field updates to this object should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If set to DO_NOT_NOTIFY or NOTIFICATION_SETTINGS_UNSPECIFIED, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
1328    #[serde(rename = "notifyPreference")]
1329    pub notify_preference: Option<String>,
1330    /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
1331    #[serde(rename = "passConstraints")]
1332    pub pass_constraints: Option<PassConstraints>,
1333    /// Reservation details for this ticket. This is expected to be shared amongst all tickets that were purchased in the same order.
1334    #[serde(rename = "reservationInfo")]
1335    pub reservation_info: Option<EventReservationInfo>,
1336    /// The rotating barcode type and value.
1337    #[serde(rename = "rotatingBarcode")]
1338    pub rotating_barcode: Option<RotatingBarcode>,
1339    /// Restrictions on the object that needs to be verified before the user tries to save the pass. Note that this restrictions will only be applied during save time. If the restrictions changed after a user saves the pass, the new restrictions will not be applied to an already saved pass.
1340    #[serde(rename = "saveRestrictions")]
1341    pub save_restrictions: Option<SaveRestrictions>,
1342    /// Seating details for this ticket.
1343    #[serde(rename = "seatInfo")]
1344    pub seat_info: Option<EventSeat>,
1345    /// The value that will be transmitted to a Smart Tap certified terminal over NFC for this object. The class level fields `enableSmartTap` and `redemptionIssuers` must also be set up correctly in order for the pass to support Smart Tap. Only ASCII characters are supported.
1346    #[serde(rename = "smartTapRedemptionValue")]
1347    pub smart_tap_redemption_value: Option<String>,
1348    /// Required. The state of the object. This field is used to determine how an object is displayed in the app. For example, an `inactive` object is moved to the "Expired passes" section.
1349    pub state: Option<String>,
1350    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
1351    #[serde(rename = "textModulesData")]
1352    pub text_modules_data: Option<Vec<TextModuleData>>,
1353    /// Name of the ticket holder, if the ticket is assigned to a person. E.g. "John Doe" or "Jane Doe".
1354    #[serde(rename = "ticketHolderName")]
1355    pub ticket_holder_name: Option<String>,
1356    /// The number of the ticket. This can be a unique identifier across all tickets in an issuer's system, all tickets for the event (e.g. XYZ1234512345), or all tickets in the order (1, 2, 3, etc.).
1357    #[serde(rename = "ticketNumber")]
1358    pub ticket_number: Option<String>,
1359    /// The type of the ticket, such as "Adult" or "Child", or "VIP" or "Standard".
1360    #[serde(rename = "ticketType")]
1361    pub ticket_type: Option<LocalizedString>,
1362    /// The time period this object will be `active` and object can be used. An object's state will be changed to `expired` when this time period has passed.
1363    #[serde(rename = "validTimeInterval")]
1364    pub valid_time_interval: Option<TimeInterval>,
1365    /// Optional value added module data. Maximum of ten on the object.
1366    #[serde(rename = "valueAddedModuleData")]
1367    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
1368    /// Deprecated
1369    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1370    pub version: Option<i64>,
1371}
1372
1373impl common::RequestValue for EventTicketObject {}
1374impl common::ResponseResult for EventTicketObject {}
1375
1376/// There is no detailed description.
1377///
1378/// # Activities
1379///
1380/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1381/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1382///
1383/// * [addmessage eventticketobject](EventticketobjectAddmessageCall) (response)
1384#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1385#[serde_with::serde_as]
1386#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1387pub struct EventTicketObjectAddMessageResponse {
1388    /// The updated EventTicketObject resource.
1389    pub resource: Option<EventTicketObject>,
1390}
1391
1392impl common::ResponseResult for EventTicketObjectAddMessageResponse {}
1393
1394/// There is no detailed description.
1395///
1396/// # Activities
1397///
1398/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1399/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1400///
1401/// * [list eventticketobject](EventticketobjectListCall) (response)
1402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1403#[serde_with::serde_as]
1404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1405pub struct EventTicketObjectListResponse {
1406    /// Pagination of the response.
1407    pub pagination: Option<Pagination>,
1408    /// Resources corresponding to the list request.
1409    pub resources: Option<Vec<EventTicketObject>>,
1410}
1411
1412impl common::ResponseResult for EventTicketObjectListResponse {}
1413
1414/// There is no detailed description.
1415///
1416/// This type is not used in any activity, and only used as *part* of another schema.
1417///
1418#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1419#[serde_with::serde_as]
1420#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1421pub struct EventVenue {
1422    /// The address of the venue, such as "24 Willie Mays Plaza\nSan Francisco, CA 94107". Address lines are separated by line feed (`\n`) characters. This is required.
1423    pub address: Option<LocalizedString>,
1424    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventVenue"`.
1425    pub kind: Option<String>,
1426    /// The name of the venue, such as "AT&T Park". This is required.
1427    pub name: Option<LocalizedString>,
1428}
1429
1430impl common::Part for EventVenue {}
1431
1432/// Indicates that the issuer would like Google Wallet to send expiry notifications 2 days prior to the card expiration.
1433///
1434/// This type is not used in any activity, and only used as *part* of another schema.
1435///
1436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1437#[serde_with::serde_as]
1438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1439pub struct ExpiryNotification {
1440    /// Indicates if the object needs to have expiry notification enabled.
1441    #[serde(rename = "enableNotification")]
1442    pub enable_notification: Option<bool>,
1443}
1444
1445impl common::Part for ExpiryNotification {}
1446
1447/// Reference definition to use with field overrides.
1448///
1449/// This type is not used in any activity, and only used as *part* of another schema.
1450///
1451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1452#[serde_with::serde_as]
1453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1454pub struct FieldReference {
1455    /// Only valid if the `fieldPath` references a date field. Chooses how the date field will be formatted and displayed in the UI.
1456    #[serde(rename = "dateFormat")]
1457    pub date_format: Option<String>,
1458    /// Path to the field being referenced, prefixed with "object" or "class" and separated with dots. For example, it may be the string "object.purchaseDetails.purchasePrice".
1459    #[serde(rename = "fieldPath")]
1460    pub field_path: Option<String>,
1461}
1462
1463impl common::Part for FieldReference {}
1464
1465/// Custom field selector to use with field overrides.
1466///
1467/// This type is not used in any activity, and only used as *part* of another schema.
1468///
1469#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1470#[serde_with::serde_as]
1471#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1472pub struct FieldSelector {
1473    /// If more than one reference is supplied, then the first one that references a non-empty field will be displayed.
1474    pub fields: Option<Vec<FieldReference>>,
1475}
1476
1477impl common::Part for FieldSelector {}
1478
1479/// There is no detailed description.
1480///
1481/// This type is not used in any activity, and only used as *part* of another schema.
1482///
1483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1484#[serde_with::serde_as]
1485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1486pub struct FirstRowOption {
1487    /// A reference to the field to be displayed in the first row.
1488    #[serde(rename = "fieldOption")]
1489    pub field_option: Option<FieldSelector>,
1490    /// no description provided
1491    #[serde(rename = "transitOption")]
1492    pub transit_option: Option<String>,
1493}
1494
1495impl common::Part for FirstRowOption {}
1496
1497/// There is no detailed description.
1498///
1499/// This type is not used in any activity, and only used as *part* of another schema.
1500///
1501#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1502#[serde_with::serde_as]
1503#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1504pub struct FlightCarrier {
1505    /// A logo for the airline alliance, displayed below the QR code that the passenger scans to board.
1506    #[serde(rename = "airlineAllianceLogo")]
1507    pub airline_alliance_logo: Option<Image>,
1508    /// A logo for the airline described by carrierIataCode and localizedAirlineName. This logo will be rendered at the top of the detailed card view.
1509    #[serde(rename = "airlineLogo")]
1510    pub airline_logo: Option<Image>,
1511    /// A localized name of the airline specified by carrierIataCode. If unset, `issuer_name` or `localized_issuer_name` from `FlightClass` will be used for display purposes. eg: "Swiss Air" for "LX"
1512    #[serde(rename = "airlineName")]
1513    pub airline_name: Option<LocalizedString>,
1514    /// Two character IATA airline code of the marketing carrier (as opposed to operating carrier). Exactly one of this or `carrierIcaoCode` needs to be provided for `carrier` and `operatingCarrier`. eg: "LX" for Swiss Air
1515    #[serde(rename = "carrierIataCode")]
1516    pub carrier_iata_code: Option<String>,
1517    /// Three character ICAO airline code of the marketing carrier (as opposed to operating carrier). Exactly one of this or `carrierIataCode` needs to be provided for `carrier` and `operatingCarrier`. eg: "EZY" for Easy Jet
1518    #[serde(rename = "carrierIcaoCode")]
1519    pub carrier_icao_code: Option<String>,
1520    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#flightCarrier"`.
1521    pub kind: Option<String>,
1522    /// The wide logo of the airline. When provided, this will be used in place of the airline logo in the top left of the card view.
1523    #[serde(rename = "wideAirlineLogo")]
1524    pub wide_airline_logo: Option<Image>,
1525}
1526
1527impl common::Part for FlightCarrier {}
1528
1529/// There is no detailed description.
1530///
1531/// # Activities
1532///
1533/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1534/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1535///
1536/// * [get flightclass](FlightclasGetCall) (response)
1537/// * [insert flightclass](FlightclasInsertCall) (request|response)
1538/// * [patch flightclass](FlightclasPatchCall) (request|response)
1539/// * [update flightclass](FlightclasUpdateCall) (request|response)
1540#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1541#[serde_with::serde_as]
1542#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1543pub struct FlightClass {
1544    /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
1545    #[serde(rename = "allowMultipleUsersPerObject")]
1546    pub allow_multiple_users_per_object: Option<bool>,
1547    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding object that will be used instead.
1548    #[serde(rename = "appLinkData")]
1549    pub app_link_data: Option<AppLinkData>,
1550    /// Policies for boarding and seating. These will inform which labels will be shown to users.
1551    #[serde(rename = "boardingAndSeatingPolicy")]
1552    pub boarding_and_seating_policy: Option<BoardingAndSeatingPolicy>,
1553    /// Callback options to be used to call the issuer back for every save/delete of an object for this class by the end-user. All objects of this class are eligible for the callback.
1554    #[serde(rename = "callbackOptions")]
1555    pub callback_options: Option<CallbackOptions>,
1556    /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
1557    #[serde(rename = "classTemplateInfo")]
1558    pub class_template_info: Option<ClassTemplateInfo>,
1559    /// Country code used to display the card's country (when the user is not in that country), as well as to display localized content when content is not available in the user's locale.
1560    #[serde(rename = "countryCode")]
1561    pub country_code: Option<String>,
1562    /// Required. Destination airport.
1563    pub destination: Option<AirportInfo>,
1564    /// Identifies whether this class supports Smart Tap. The `redemptionIssuers` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
1565    #[serde(rename = "enableSmartTap")]
1566    pub enable_smart_tap: Option<bool>,
1567    /// Required. Information about the flight carrier and number.
1568    #[serde(rename = "flightHeader")]
1569    pub flight_header: Option<FlightHeader>,
1570    /// Status of this flight. If unset, Google will compute status based on data from other sources, such as FlightStats, etc. Note: Google-computed status will not be returned in API responses.
1571    #[serde(rename = "flightStatus")]
1572    pub flight_status: Option<String>,
1573    /// Optional banner image displayed on the front of the card. If none is present, nothing will be displayed. The image will display at 100% width.
1574    #[serde(rename = "heroImage")]
1575    pub hero_image: Option<Image>,
1576    /// The background color for the card. If not set the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used. The format is #rrggbb where rrggbb is a hex RGB triplet, such as `#ffcc00`. You can also use the shorthand version of the RGB triplet which is #rgb, such as `#fc0`.
1577    #[serde(rename = "hexBackgroundColor")]
1578    pub hex_background_color: Option<String>,
1579    /// The URI of your application's home page. Populating the URI in this field results in the exact same behavior as populating an URI in linksModuleData (when an object is rendered, a link to the homepage is shown in what would usually be thought of as the linksModuleData section of the object).
1580    #[serde(rename = "homepageUri")]
1581    pub homepage_uri: Option<Uri>,
1582    /// Required. The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
1583    pub id: Option<String>,
1584    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
1585    #[serde(rename = "imageModulesData")]
1586    pub image_modules_data: Option<Vec<ImageModuleData>>,
1587    /// Deprecated. Use textModulesData instead.
1588    #[serde(rename = "infoModuleData")]
1589    pub info_module_data: Option<InfoModuleData>,
1590    /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
1591    #[serde(rename = "issuerName")]
1592    pub issuer_name: Option<String>,
1593    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#flightClass"`.
1594    pub kind: Option<String>,
1595    /// If this field is present, boarding passes served to a user's device will always be in this language. Represents the BCP 47 language tag. Example values are "en-US", "en-GB", "de", or "de-AT".
1596    #[serde(rename = "languageOverride")]
1597    pub language_override: Option<String>,
1598    /// Links module data. If links module data is also defined on the object, both will be displayed.
1599    #[serde(rename = "linksModuleData")]
1600    pub links_module_data: Option<LinksModuleData>,
1601    /// The boarding time as it would be printed on the boarding pass. This is an ISO 8601 extended format date/time without an offset. Time may be specified up to millisecond precision. eg: `2027-03-05T06:30:00` This should be the local date/time at the airport (not a UTC time). Google will reject the request if UTC offset is provided. Time zones will be calculated by Google based on departure airport.
1602    #[serde(rename = "localBoardingDateTime")]
1603    pub local_boarding_date_time: Option<String>,
1604    /// The estimated time the aircraft plans to reach the destination gate (not the runway) or the actual time it reached the gate. This field should be set if at least one of the below is true: - It differs from the scheduled time. Google will use it to calculate the delay. - The aircraft already arrived at the gate. Google will use it to inform the user that the flight has arrived at the gate. This is an ISO 8601 extended format date/time without an offset. Time may be specified up to millisecond precision. eg: `2027-03-05T06:30:00` This should be the local date/time at the airport (not a UTC time). Google will reject the request if UTC offset is provided. Time zones will be calculated by Google based on arrival airport.
1605    #[serde(rename = "localEstimatedOrActualArrivalDateTime")]
1606    pub local_estimated_or_actual_arrival_date_time: Option<String>,
1607    /// The estimated time the aircraft plans to pull from the gate or the actual time the aircraft already pulled from the gate. Note: This is not the runway time. This field should be set if at least one of the below is true: - It differs from the scheduled time. Google will use it to calculate the delay. - The aircraft already pulled from the gate. Google will use it to inform the user when the flight actually departed. This is an ISO 8601 extended format date/time without an offset. Time may be specified up to millisecond precision. eg: `2027-03-05T06:30:00` This should be the local date/time at the airport (not a UTC time). Google will reject the request if UTC offset is provided. Time zones will be calculated by Google based on departure airport.
1608    #[serde(rename = "localEstimatedOrActualDepartureDateTime")]
1609    pub local_estimated_or_actual_departure_date_time: Option<String>,
1610    /// The gate closing time as it would be printed on the boarding pass. Do not set this field if you do not want to print it in the boarding pass. This is an ISO 8601 extended format date/time without an offset. Time may be specified up to millisecond precision. eg: `2027-03-05T06:30:00` This should be the local date/time at the airport (not a UTC time). Google will reject the request if UTC offset is provided. Time zones will be calculated by Google based on departure airport.
1611    #[serde(rename = "localGateClosingDateTime")]
1612    pub local_gate_closing_date_time: Option<String>,
1613    /// The scheduled time the aircraft plans to reach the destination gate (not the runway). Note: This field should not change too close to the flight time. For updates to departure times (delays, etc), please set `localEstimatedOrActualArrivalDateTime`. This is an ISO 8601 extended format date/time without an offset. Time may be specified up to millisecond precision. eg: `2027-03-05T06:30:00` This should be the local date/time at the airport (not a UTC time). Google will reject the request if UTC offset is provided. Time zones will be calculated by Google based on arrival airport.
1614    #[serde(rename = "localScheduledArrivalDateTime")]
1615    pub local_scheduled_arrival_date_time: Option<String>,
1616    /// Required. The scheduled date and time when the aircraft is expected to depart the gate (not the runway) Note: This field should not change too close to the departure time. For updates to departure times (delays, etc), please set `localEstimatedOrActualDepartureDateTime`. This is an ISO 8601 extended format date/time without an offset. Time may be specified up to millisecond precision. eg: `2027-03-05T06:30:00` This should be the local date/time at the airport (not a UTC time). Google will reject the request if UTC offset is provided. Time zones will be calculated by Google based on departure airport.
1617    #[serde(rename = "localScheduledDepartureDateTime")]
1618    pub local_scheduled_departure_date_time: Option<String>,
1619    /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
1620    #[serde(rename = "localizedIssuerName")]
1621    pub localized_issuer_name: Option<LocalizedString>,
1622    /// Note: This field is currently not supported to trigger geo notifications.
1623    pub locations: Option<Vec<LatLongPoint>>,
1624    /// Merchant locations. There is a maximum of ten on the class. Any additional MerchantLocations added beyond the 10 will be rejected by the validator. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
1625    #[serde(rename = "merchantLocations")]
1626    pub merchant_locations: Option<Vec<MerchantLocation>>,
1627    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
1628    pub messages: Option<Vec<Message>>,
1629    /// Identifies whether multiple users and devices will save the same object referencing this class.
1630    #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
1631    pub multiple_devices_and_holders_allowed_status: Option<String>,
1632    /// Whether or not field updates to this class should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If not specified, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
1633    #[serde(rename = "notifyPreference")]
1634    pub notify_preference: Option<String>,
1635    /// Required. Origin airport.
1636    pub origin: Option<AirportInfo>,
1637    /// Identifies which redemption issuers can redeem the pass over Smart Tap. Redemption issuers are identified by their issuer ID. Redemption issuers must have at least one Smart Tap key configured. The `enableSmartTap` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
1638    #[serde(rename = "redemptionIssuers")]
1639    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1640    pub redemption_issuers: Option<Vec<i64>>,
1641    /// The review comments set by the platform when a class is marked `approved` or `rejected`.
1642    pub review: Option<Review>,
1643    /// Required. The status of the class. This field can be set to `draft` or `underReview` using the insert, patch, or update API calls. Once the review state is changed from `draft` it may not be changed back to `draft`. You should keep this field to `draft` when the class is under development. A `draft` class cannot be used to create any object. You should set this field to `underReview` when you believe the class is ready for use. The platform will automatically set this field to `approved` and it can be immediately used to create or migrate objects. When updating an already `approved` class you should keep setting this field to `underReview`.
1644    #[serde(rename = "reviewStatus")]
1645    pub review_status: Option<String>,
1646    /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
1647    #[serde(rename = "securityAnimation")]
1648    pub security_animation: Option<SecurityAnimation>,
1649    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
1650    #[serde(rename = "textModulesData")]
1651    pub text_modules_data: Option<Vec<TextModuleData>>,
1652    /// Optional value added module data. Maximum of ten on the class. For a pass only ten will be displayed, prioritizing those from the object.
1653    #[serde(rename = "valueAddedModuleData")]
1654    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
1655    /// Deprecated
1656    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1657    pub version: Option<i64>,
1658    /// View Unlock Requirement options for the boarding pass.
1659    #[serde(rename = "viewUnlockRequirement")]
1660    pub view_unlock_requirement: Option<String>,
1661    /// Deprecated.
1662    #[serde(rename = "wordMark")]
1663    pub word_mark: Option<Image>,
1664}
1665
1666impl common::RequestValue for FlightClass {}
1667impl common::ResponseResult for FlightClass {}
1668
1669/// There is no detailed description.
1670///
1671/// # Activities
1672///
1673/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1674/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1675///
1676/// * [addmessage flightclass](FlightclasAddmessageCall) (response)
1677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1678#[serde_with::serde_as]
1679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1680pub struct FlightClassAddMessageResponse {
1681    /// The updated FlightClass resource.
1682    pub resource: Option<FlightClass>,
1683}
1684
1685impl common::ResponseResult for FlightClassAddMessageResponse {}
1686
1687/// There is no detailed description.
1688///
1689/// # Activities
1690///
1691/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1692/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1693///
1694/// * [list flightclass](FlightclasListCall) (response)
1695#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1696#[serde_with::serde_as]
1697#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1698pub struct FlightClassListResponse {
1699    /// Pagination of the response.
1700    pub pagination: Option<Pagination>,
1701    /// Resources corresponding to the list request.
1702    pub resources: Option<Vec<FlightClass>>,
1703}
1704
1705impl common::ResponseResult for FlightClassListResponse {}
1706
1707/// There is no detailed description.
1708///
1709/// This type is not used in any activity, and only used as *part* of another schema.
1710///
1711#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1712#[serde_with::serde_as]
1713#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1714pub struct FlightHeader {
1715    /// Information about airline carrier. This is a required property of `flightHeader`.
1716    pub carrier: Option<FlightCarrier>,
1717    /// The flight number without IATA carrier code. This field should contain only digits. This is a required property of `flightHeader`. eg: "123"
1718    #[serde(rename = "flightNumber")]
1719    pub flight_number: Option<String>,
1720    /// Override value to use for flight number. The default value used for display purposes is carrier + flight_number. If a different value needs to be shown to passengers, use this field to override the default behavior. eg: "XX1234 / YY576"
1721    #[serde(rename = "flightNumberDisplayOverride")]
1722    pub flight_number_display_override: Option<String>,
1723    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#flightHeader"`.
1724    pub kind: Option<String>,
1725    /// Information about operating airline carrier.
1726    #[serde(rename = "operatingCarrier")]
1727    pub operating_carrier: Option<FlightCarrier>,
1728    /// The flight number used by the operating carrier without IATA carrier code. This field should contain only digits. eg: "234"
1729    #[serde(rename = "operatingFlightNumber")]
1730    pub operating_flight_number: Option<String>,
1731}
1732
1733impl common::Part for FlightHeader {}
1734
1735/// There is no detailed description.
1736///
1737/// # Activities
1738///
1739/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1740/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1741///
1742/// * [get flightobject](FlightobjectGetCall) (response)
1743/// * [insert flightobject](FlightobjectInsertCall) (request|response)
1744/// * [patch flightobject](FlightobjectPatchCall) (request|response)
1745/// * [update flightobject](FlightobjectUpdateCall) (request|response)
1746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1747#[serde_with::serde_as]
1748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1749pub struct FlightObject {
1750    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding class only object AppLinkData will be displayed.
1751    #[serde(rename = "appLinkData")]
1752    pub app_link_data: Option<AppLinkData>,
1753    /// The barcode type and value.
1754    pub barcode: Option<Barcode>,
1755    /// Passenger specific information about boarding and seating.
1756    #[serde(rename = "boardingAndSeatingInfo")]
1757    pub boarding_and_seating_info: Option<BoardingAndSeatingInfo>,
1758    /// Required. The class associated with this object. The class must be of the same type as this object, must already exist, and must be approved. Class IDs should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you.
1759    #[serde(rename = "classId")]
1760    pub class_id: Option<String>,
1761    /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
1762    #[serde(rename = "classReference")]
1763    pub class_reference: Option<FlightClass>,
1764    /// Indicates if notifications should explicitly be suppressed. If this field is set to true, regardless of the `messages` field, expiration notifications to the user will be suppressed. By default, this field is set to false. Currently, this can only be set for Flights.
1765    #[serde(rename = "disableExpirationNotification")]
1766    pub disable_expiration_notification: Option<bool>,
1767    /// Information that controls how passes are grouped together.
1768    #[serde(rename = "groupingInfo")]
1769    pub grouping_info: Option<GroupingInfo>,
1770    /// Whether this object is currently linked to a single device. This field is set by the platform when a user saves the object, linking it to their device. Intended for use by select partners. Contact support for additional information.
1771    #[serde(rename = "hasLinkedDevice")]
1772    pub has_linked_device: Option<bool>,
1773    /// Indicates if the object has users. This field is set by the platform.
1774    #[serde(rename = "hasUsers")]
1775    pub has_users: Option<bool>,
1776    /// Optional banner image displayed on the front of the card. If none is present, hero image of the class, if present, will be displayed. If hero image of the class is also not present, nothing will be displayed.
1777    #[serde(rename = "heroImage")]
1778    pub hero_image: Option<Image>,
1779    /// The background color for the card. If not set the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used. The format is #rrggbb where rrggbb is a hex RGB triplet, such as `#ffcc00`. You can also use the shorthand version of the RGB triplet which is #rgb, such as `#fc0`.
1780    #[serde(rename = "hexBackgroundColor")]
1781    pub hex_background_color: Option<String>,
1782    /// Required. The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you. The unique identifier should only include alphanumeric characters, '.', '_', or '-'.
1783    pub id: Option<String>,
1784    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
1785    #[serde(rename = "imageModulesData")]
1786    pub image_modules_data: Option<Vec<ImageModuleData>>,
1787    /// Deprecated. Use textModulesData instead.
1788    #[serde(rename = "infoModuleData")]
1789    pub info_module_data: Option<InfoModuleData>,
1790    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#flightObject"`.
1791    pub kind: Option<String>,
1792    /// linked_object_ids are a list of other objects such as event ticket, loyalty, offer, generic, giftcard, transit and boarding pass that should be automatically attached to this flight object. If a user had saved this boarding pass, then these linked_object_ids would be automatically pushed to the user's wallet (unless they turned off the setting to receive such linked passes). Make sure that objects present in linked_object_ids are already inserted - if not, calls would fail. Once linked, the linked objects cannot be unlinked. You cannot link objects belonging to another issuer. There is a limit to the number of objects that can be linked to a single object. After the limit is reached, new linked objects in the call will be ignored silently. Object IDs should follow the format issuer ID. identifier where the former is issued by Google and the latter is chosen by you.
1793    #[serde(rename = "linkedObjectIds")]
1794    pub linked_object_ids: Option<Vec<String>>,
1795    /// Links module data. If links module data is also defined on the class, both will be displayed.
1796    #[serde(rename = "linksModuleData")]
1797    pub links_module_data: Option<LinksModuleData>,
1798    /// Note: This field is currently not supported to trigger geo notifications.
1799    pub locations: Option<Vec<LatLongPoint>>,
1800    /// Merchant locations. There is a maximum of ten on the object. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
1801    #[serde(rename = "merchantLocations")]
1802    pub merchant_locations: Option<Vec<MerchantLocation>>,
1803    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
1804    pub messages: Option<Vec<Message>>,
1805    /// Whether or not field updates to this object should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If set to DO_NOT_NOTIFY or NOTIFICATION_SETTINGS_UNSPECIFIED, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
1806    #[serde(rename = "notifyPreference")]
1807    pub notify_preference: Option<String>,
1808    /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
1809    #[serde(rename = "passConstraints")]
1810    pub pass_constraints: Option<PassConstraints>,
1811    /// Required. Passenger name as it would appear on the boarding pass. eg: "Dave M Gahan" or "Gahan/Dave" or "GAHAN/DAVEM"
1812    #[serde(rename = "passengerName")]
1813    pub passenger_name: Option<String>,
1814    /// Required. Information about flight reservation.
1815    #[serde(rename = "reservationInfo")]
1816    pub reservation_info: Option<ReservationInfo>,
1817    /// The rotating barcode type and value.
1818    #[serde(rename = "rotatingBarcode")]
1819    pub rotating_barcode: Option<RotatingBarcode>,
1820    /// Restrictions on the object that needs to be verified before the user tries to save the pass. Note that this restrictions will only be applied during save time. If the restrictions changed after a user saves the pass, the new restrictions will not be applied to an already saved pass.
1821    #[serde(rename = "saveRestrictions")]
1822    pub save_restrictions: Option<SaveRestrictions>,
1823    /// An image for the security program that applies to the passenger.
1824    #[serde(rename = "securityProgramLogo")]
1825    pub security_program_logo: Option<Image>,
1826    /// The value that will be transmitted to a Smart Tap certified terminal over NFC for this object. The class level fields `enableSmartTap` and `redemptionIssuers` must also be set up correctly in order for the pass to support Smart Tap. Only ASCII characters are supported.
1827    #[serde(rename = "smartTapRedemptionValue")]
1828    pub smart_tap_redemption_value: Option<String>,
1829    /// Required. The state of the object. This field is used to determine how an object is displayed in the app. For example, an `inactive` object is moved to the "Expired passes" section.
1830    pub state: Option<String>,
1831    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
1832    #[serde(rename = "textModulesData")]
1833    pub text_modules_data: Option<Vec<TextModuleData>>,
1834    /// The time period this object will be `active` and object can be used. An object's state will be changed to `expired` when this time period has passed.
1835    #[serde(rename = "validTimeInterval")]
1836    pub valid_time_interval: Option<TimeInterval>,
1837    /// Optional value added module data. Maximum of ten on the object.
1838    #[serde(rename = "valueAddedModuleData")]
1839    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
1840    /// Deprecated
1841    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1842    pub version: Option<i64>,
1843}
1844
1845impl common::RequestValue for FlightObject {}
1846impl common::ResponseResult for FlightObject {}
1847
1848/// There is no detailed description.
1849///
1850/// # Activities
1851///
1852/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1853/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1854///
1855/// * [addmessage flightobject](FlightobjectAddmessageCall) (response)
1856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1857#[serde_with::serde_as]
1858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1859pub struct FlightObjectAddMessageResponse {
1860    /// The updated FlightObject resource.
1861    pub resource: Option<FlightObject>,
1862}
1863
1864impl common::ResponseResult for FlightObjectAddMessageResponse {}
1865
1866/// There is no detailed description.
1867///
1868/// # Activities
1869///
1870/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1871/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1872///
1873/// * [list flightobject](FlightobjectListCall) (response)
1874#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1875#[serde_with::serde_as]
1876#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1877pub struct FlightObjectListResponse {
1878    /// Pagination of the response.
1879    pub pagination: Option<Pagination>,
1880    /// Resources corresponding to the list request.
1881    pub resources: Option<Vec<FlightObject>>,
1882}
1883
1884impl common::ResponseResult for FlightObjectListResponse {}
1885
1886/// There is no detailed description.
1887///
1888/// This type is not used in any activity, and only used as *part* of another schema.
1889///
1890#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1891#[serde_with::serde_as]
1892#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1893pub struct FrequentFlyerInfo {
1894    /// Frequent flyer number. Required for each nested object of kind `walletobjects#frequentFlyerInfo`.
1895    #[serde(rename = "frequentFlyerNumber")]
1896    pub frequent_flyer_number: Option<String>,
1897    /// Frequent flyer program name. eg: "Lufthansa Miles & More"
1898    #[serde(rename = "frequentFlyerProgramName")]
1899    pub frequent_flyer_program_name: Option<LocalizedString>,
1900    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#frequentFlyerInfo"`.
1901    pub kind: Option<String>,
1902}
1903
1904impl common::Part for FrequentFlyerInfo {}
1905
1906/// Generic Class
1907///
1908/// # Activities
1909///
1910/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1911/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1912///
1913/// * [get genericclass](GenericclasGetCall) (response)
1914/// * [insert genericclass](GenericclasInsertCall) (request|response)
1915/// * [patch genericclass](GenericclasPatchCall) (request|response)
1916/// * [update genericclass](GenericclasUpdateCall) (request|response)
1917#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1918#[serde_with::serde_as]
1919#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1920pub struct GenericClass {
1921    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding object that will be used instead.
1922    #[serde(rename = "appLinkData")]
1923    pub app_link_data: Option<AppLinkData>,
1924    /// Callback options to be used to call the issuer back for every save/delete of an object for this class by the end-user. All objects of this class are eligible for the callback.
1925    #[serde(rename = "callbackOptions")]
1926    pub callback_options: Option<CallbackOptions>,
1927    /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
1928    #[serde(rename = "classTemplateInfo")]
1929    pub class_template_info: Option<ClassTemplateInfo>,
1930    /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
1931    #[serde(rename = "enableSmartTap")]
1932    pub enable_smart_tap: Option<bool>,
1933    /// Required. The unique identifier for the class. This ID must be unique across all from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
1934    pub id: Option<String>,
1935    /// Image module data. If `imageModulesData` is also defined on the object, both will be displayed. Only one of the image from class and one from object level will be rendered when both set.
1936    #[serde(rename = "imageModulesData")]
1937    pub image_modules_data: Option<Vec<ImageModuleData>>,
1938    /// Links module data. If `linksModuleData` is also defined on the object, both will be displayed. The maximum number of these fields displayed is 10 from class and 10 from object.
1939    #[serde(rename = "linksModuleData")]
1940    pub links_module_data: Option<LinksModuleData>,
1941    /// Merchant locations. There is a maximum of ten on the class. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
1942    #[serde(rename = "merchantLocations")]
1943    pub merchant_locations: Option<Vec<MerchantLocation>>,
1944    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
1945    pub messages: Option<Vec<Message>>,
1946    /// Identifies whether multiple users and devices will save the same object referencing this class.
1947    #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
1948    pub multiple_devices_and_holders_allowed_status: Option<String>,
1949    /// Identifies which redemption issuers can redeem the pass over Smart Tap. Redemption issuers are identified by their issuer ID. Redemption issuers must have at least one Smart Tap key configured. The `enableSmartTap` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
1950    #[serde(rename = "redemptionIssuers")]
1951    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1952    pub redemption_issuers: Option<Vec<i64>>,
1953    /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
1954    #[serde(rename = "securityAnimation")]
1955    pub security_animation: Option<SecurityAnimation>,
1956    /// Text module data. If `textModulesData` is also defined on the object, both will be displayed. The maximum number of these fields displayed is 10 from class and 10 from object.
1957    #[serde(rename = "textModulesData")]
1958    pub text_modules_data: Option<Vec<TextModuleData>>,
1959    /// Optional value added module data. Maximum of ten on the class. For a pass only ten will be displayed, prioritizing those from the object.
1960    #[serde(rename = "valueAddedModuleData")]
1961    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
1962    /// View Unlock Requirement options for the generic pass.
1963    #[serde(rename = "viewUnlockRequirement")]
1964    pub view_unlock_requirement: Option<String>,
1965}
1966
1967impl common::RequestValue for GenericClass {}
1968impl common::ResponseResult for GenericClass {}
1969
1970/// Response to adding a new issuer message to the class. This contains the entire updated GenericClass.
1971///
1972/// # Activities
1973///
1974/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1975/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1976///
1977/// * [addmessage genericclass](GenericclasAddmessageCall) (response)
1978#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1979#[serde_with::serde_as]
1980#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1981pub struct GenericClassAddMessageResponse {
1982    /// The updated EventTicketClass resource.
1983    pub resource: Option<GenericClass>,
1984}
1985
1986impl common::ResponseResult for GenericClassAddMessageResponse {}
1987
1988/// List response which contains the list of all generic classes for a given issuer ID.
1989///
1990/// # Activities
1991///
1992/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1993/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1994///
1995/// * [list genericclass](GenericclasListCall) (response)
1996#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1997#[serde_with::serde_as]
1998#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1999pub struct GenericClassListResponse {
2000    /// Pagination of the response.
2001    pub pagination: Option<Pagination>,
2002    /// Resources corresponding to the list request.
2003    pub resources: Option<Vec<GenericClass>>,
2004}
2005
2006impl common::ResponseResult for GenericClassListResponse {}
2007
2008/// Generic Object
2009///
2010/// # Activities
2011///
2012/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2013/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2014///
2015/// * [get genericobject](GenericobjectGetCall) (response)
2016/// * [insert genericobject](GenericobjectInsertCall) (request|response)
2017/// * [patch genericobject](GenericobjectPatchCall) (request|response)
2018/// * [update genericobject](GenericobjectUpdateCall) (request|response)
2019#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2020#[serde_with::serde_as]
2021#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2022pub struct GenericObject {
2023    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding class only object AppLinkData will be displayed.
2024    #[serde(rename = "appLinkData")]
2025    pub app_link_data: Option<AppLinkData>,
2026    /// The barcode type and value. If pass does not have a barcode, we can allow the issuer to set Barcode.alternate_text and display just that.
2027    pub barcode: Option<Barcode>,
2028    /// Required. The header of the pass. This is usually the Business name such as "XXX Gym", "AAA Insurance". This field is required and appears in the header row at the very top of the pass.
2029    #[serde(rename = "cardTitle")]
2030    pub card_title: Option<LocalizedString>,
2031    /// Required. The class associated with this object. The class must be of the same type as this object, must already exist, and must be approved. Class IDs should follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you.
2032    #[serde(rename = "classId")]
2033    pub class_id: Option<String>,
2034    /// Specify which `GenericType` the card belongs to.
2035    #[serde(rename = "genericType")]
2036    pub generic_type: Option<String>,
2037    /// Information that controls how passes are grouped together.
2038    #[serde(rename = "groupingInfo")]
2039    pub grouping_info: Option<GroupingInfo>,
2040    /// Indicates if the object has users. This field is set by the platform.
2041    #[serde(rename = "hasUsers")]
2042    pub has_users: Option<bool>,
2043    /// Required. The title of the pass, such as "50% off coupon" or "Library card" or "Voucher". This field is required and appears in the title row of the pass detail view.
2044    pub header: Option<LocalizedString>,
2045    /// Banner image displayed on the front of the card if present. The image will be displayed at 100% width.
2046    #[serde(rename = "heroImage")]
2047    pub hero_image: Option<Image>,
2048    /// The background color for the card. If not set, the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used and if logo is not set, a color would be chosen by Google.
2049    #[serde(rename = "hexBackgroundColor")]
2050    pub hex_background_color: Option<String>,
2051    /// Required. The unique identifier for an object. This ID must be unique across all objects from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
2052    pub id: Option<String>,
2053    /// Image module data. Only one of the image from class and one from object level will be rendered when both set.
2054    #[serde(rename = "imageModulesData")]
2055    pub image_modules_data: Option<Vec<ImageModuleData>>,
2056    /// linked_object_ids are a list of other objects such as event ticket, loyalty, offer, generic, giftcard, transit and boarding pass that should be automatically attached to this generic object. If a user had saved this generic card, then these linked_object_ids would be automatically pushed to the user's wallet (unless they turned off the setting to receive such linked passes). Make sure that objects present in linked_object_ids are already inserted - if not, calls would fail. Once linked, the linked objects cannot be unlinked. You cannot link objects belonging to another issuer. There is a limit to the number of objects that can be linked to a single object. After the limit is reached, new linked objects in the call will be ignored silently. Object IDs should follow the format issuer ID. identifier where the former is issued by Google and the latter is chosen by you.
2057    #[serde(rename = "linkedObjectIds")]
2058    pub linked_object_ids: Option<Vec<String>>,
2059    /// Links module data. If `linksModuleData` is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from class and 10 from object.
2060    #[serde(rename = "linksModuleData")]
2061    pub links_module_data: Option<LinksModuleData>,
2062    /// The logo image of the pass. This image is displayed in the card detail view in upper left, and also on the list/thumbnail view. If the logo is not present, the first letter of `cardTitle` would be shown as logo.
2063    pub logo: Option<Image>,
2064    /// Merchant locations. There is a maximum of ten on the object. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
2065    #[serde(rename = "merchantLocations")]
2066    pub merchant_locations: Option<Vec<MerchantLocation>>,
2067    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
2068    pub messages: Option<Vec<Message>>,
2069    /// The notification settings that are enabled for this object.
2070    pub notifications: Option<Notifications>,
2071    /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
2072    #[serde(rename = "passConstraints")]
2073    pub pass_constraints: Option<PassConstraints>,
2074    /// The rotating barcode settings/details.
2075    #[serde(rename = "rotatingBarcode")]
2076    pub rotating_barcode: Option<RotatingBarcode>,
2077    /// Restrictions on the object that needs to be verified before the user tries to save the pass. Note that this restrictions will only be applied during save time. If the restrictions changed after a user saves the pass, the new restrictions will not be applied to an already saved pass.
2078    #[serde(rename = "saveRestrictions")]
2079    pub save_restrictions: Option<SaveRestrictions>,
2080    /// The value that will be transmitted to a Smart Tap certified terminal over NFC for this object. The class level fields `enableSmartTap` and `redemptionIssuers` must also be set up correctly in order for the pass to support Smart Tap. Only ASCII characters are supported.
2081    #[serde(rename = "smartTapRedemptionValue")]
2082    pub smart_tap_redemption_value: Option<String>,
2083    /// The state of the object. This field is used to determine how an object is displayed in the app. For example, an `inactive` object is moved to the "Expired passes" section. If this is not provided, the object would be considered `ACTIVE`.
2084    pub state: Option<String>,
2085    /// The title label of the pass, such as location where this pass can be used. Appears right above the title in the title row in the pass detail view.
2086    pub subheader: Option<LocalizedString>,
2087    /// Text module data. If `textModulesData` is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from class and 10 from object.
2088    #[serde(rename = "textModulesData")]
2089    pub text_modules_data: Option<Vec<TextModuleData>>,
2090    /// The time period this object will be considered valid or usable. When the time period is passed, the object will be considered expired, which will affect the rendering on user's devices.
2091    #[serde(rename = "validTimeInterval")]
2092    pub valid_time_interval: Option<TimeInterval>,
2093    /// Optional value added module data. Maximum of ten on the object.
2094    #[serde(rename = "valueAddedModuleData")]
2095    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
2096    /// The wide logo of the pass. When provided, this will be used in place of the logo in the top left of the card view.
2097    #[serde(rename = "wideLogo")]
2098    pub wide_logo: Option<Image>,
2099}
2100
2101impl common::RequestValue for GenericObject {}
2102impl common::ResponseResult for GenericObject {}
2103
2104/// Response to adding a new issuer message to the object. This contains the entire updated GenericObject.
2105///
2106/// # Activities
2107///
2108/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2109/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2110///
2111/// * [addmessage genericobject](GenericobjectAddmessageCall) (response)
2112#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2113#[serde_with::serde_as]
2114#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2115pub struct GenericObjectAddMessageResponse {
2116    /// The updated GenericObject resource.
2117    pub resource: Option<GenericObject>,
2118}
2119
2120impl common::ResponseResult for GenericObjectAddMessageResponse {}
2121
2122/// List response which contains the list of all generic objects for a given issuer ID.
2123///
2124/// # Activities
2125///
2126/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2127/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2128///
2129/// * [list genericobject](GenericobjectListCall) (response)
2130#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2131#[serde_with::serde_as]
2132#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2133pub struct GenericObjectListResponse {
2134    /// Pagination of the response.
2135    pub pagination: Option<Pagination>,
2136    /// Resources corresponding to the list request.
2137    pub resources: Option<Vec<GenericObject>>,
2138}
2139
2140impl common::ResponseResult for GenericObjectListResponse {}
2141
2142/// There is no detailed description.
2143///
2144/// # Activities
2145///
2146/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2147/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2148///
2149/// * [get giftcardclass](GiftcardclasGetCall) (response)
2150/// * [insert giftcardclass](GiftcardclasInsertCall) (request|response)
2151/// * [patch giftcardclass](GiftcardclasPatchCall) (request|response)
2152/// * [update giftcardclass](GiftcardclasUpdateCall) (request|response)
2153#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2154#[serde_with::serde_as]
2155#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2156pub struct GiftCardClass {
2157    /// Determines whether the merchant supports gift card redemption using barcode. If true, app displays a barcode for the gift card on the Gift card details screen. If false, a barcode is not displayed.
2158    #[serde(rename = "allowBarcodeRedemption")]
2159    pub allow_barcode_redemption: Option<bool>,
2160    /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
2161    #[serde(rename = "allowMultipleUsersPerObject")]
2162    pub allow_multiple_users_per_object: Option<bool>,
2163    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding object that will be used instead.
2164    #[serde(rename = "appLinkData")]
2165    pub app_link_data: Option<AppLinkData>,
2166    /// Callback options to be used to call the issuer back for every save/delete of an object for this class by the end-user. All objects of this class are eligible for the callback.
2167    #[serde(rename = "callbackOptions")]
2168    pub callback_options: Option<CallbackOptions>,
2169    /// The label to display for the card number, such as "Card Number".
2170    #[serde(rename = "cardNumberLabel")]
2171    pub card_number_label: Option<String>,
2172    /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
2173    #[serde(rename = "classTemplateInfo")]
2174    pub class_template_info: Option<ClassTemplateInfo>,
2175    /// Country code used to display the card's country (when the user is not in that country), as well as to display localized content when content is not available in the user's locale.
2176    #[serde(rename = "countryCode")]
2177    pub country_code: Option<String>,
2178    /// Identifies whether this class supports Smart Tap. The `redemptionIssuers` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
2179    #[serde(rename = "enableSmartTap")]
2180    pub enable_smart_tap: Option<bool>,
2181    /// The label to display for event number, such as "Target Event #".
2182    #[serde(rename = "eventNumberLabel")]
2183    pub event_number_label: Option<String>,
2184    /// Optional banner image displayed on the front of the card. If none is present, nothing will be displayed. The image will display at 100% width.
2185    #[serde(rename = "heroImage")]
2186    pub hero_image: Option<Image>,
2187    /// The background color for the card. If not set the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used. The format is #rrggbb where rrggbb is a hex RGB triplet, such as `#ffcc00`. You can also use the shorthand version of the RGB triplet which is #rgb, such as `#fc0`.
2188    #[serde(rename = "hexBackgroundColor")]
2189    pub hex_background_color: Option<String>,
2190    /// The URI of your application's home page. Populating the URI in this field results in the exact same behavior as populating an URI in linksModuleData (when an object is rendered, a link to the homepage is shown in what would usually be thought of as the linksModuleData section of the object).
2191    #[serde(rename = "homepageUri")]
2192    pub homepage_uri: Option<Uri>,
2193    /// Required. The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
2194    pub id: Option<String>,
2195    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
2196    #[serde(rename = "imageModulesData")]
2197    pub image_modules_data: Option<Vec<ImageModuleData>>,
2198    /// Deprecated. Use textModulesData instead.
2199    #[serde(rename = "infoModuleData")]
2200    pub info_module_data: Option<InfoModuleData>,
2201    /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
2202    #[serde(rename = "issuerName")]
2203    pub issuer_name: Option<String>,
2204    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#giftCardClass"`.
2205    pub kind: Option<String>,
2206    /// Links module data. If links module data is also defined on the object, both will be displayed.
2207    #[serde(rename = "linksModuleData")]
2208    pub links_module_data: Option<LinksModuleData>,
2209    /// Translated strings for the card_number_label.
2210    #[serde(rename = "localizedCardNumberLabel")]
2211    pub localized_card_number_label: Option<LocalizedString>,
2212    /// Translated strings for the event_number_label.
2213    #[serde(rename = "localizedEventNumberLabel")]
2214    pub localized_event_number_label: Option<LocalizedString>,
2215    /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
2216    #[serde(rename = "localizedIssuerName")]
2217    pub localized_issuer_name: Option<LocalizedString>,
2218    /// Translated strings for the merchant_name. The app may display an ellipsis after the first 20 characters to ensure full string is displayed on smaller screens.
2219    #[serde(rename = "localizedMerchantName")]
2220    pub localized_merchant_name: Option<LocalizedString>,
2221    /// Translated strings for the pin_label.
2222    #[serde(rename = "localizedPinLabel")]
2223    pub localized_pin_label: Option<LocalizedString>,
2224    /// Note: This field is currently not supported to trigger geo notifications.
2225    pub locations: Option<Vec<LatLongPoint>>,
2226    /// Merchant locations. There is a maximum of ten on the class. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
2227    #[serde(rename = "merchantLocations")]
2228    pub merchant_locations: Option<Vec<MerchantLocation>>,
2229    /// Merchant name, such as "Adam's Apparel". The app may display an ellipsis after the first 20 characters to ensure full string is displayed on smaller screens.
2230    #[serde(rename = "merchantName")]
2231    pub merchant_name: Option<String>,
2232    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
2233    pub messages: Option<Vec<Message>>,
2234    /// Identifies whether multiple users and devices will save the same object referencing this class.
2235    #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
2236    pub multiple_devices_and_holders_allowed_status: Option<String>,
2237    /// Whether or not field updates to this class should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If not specified, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
2238    #[serde(rename = "notifyPreference")]
2239    pub notify_preference: Option<String>,
2240    /// The label to display for the PIN, such as "4-digit PIN".
2241    #[serde(rename = "pinLabel")]
2242    pub pin_label: Option<String>,
2243    /// The logo of the gift card program or company. This logo is displayed in both the details and list views of the app.
2244    #[serde(rename = "programLogo")]
2245    pub program_logo: Option<Image>,
2246    /// Identifies which redemption issuers can redeem the pass over Smart Tap. Redemption issuers are identified by their issuer ID. Redemption issuers must have at least one Smart Tap key configured. The `enableSmartTap` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
2247    #[serde(rename = "redemptionIssuers")]
2248    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2249    pub redemption_issuers: Option<Vec<i64>>,
2250    /// The review comments set by the platform when a class is marked `approved` or `rejected`.
2251    pub review: Option<Review>,
2252    /// Required. The status of the class. This field can be set to `draft` or `underReview` using the insert, patch, or update API calls. Once the review state is changed from `draft` it may not be changed back to `draft`. You should keep this field to `draft` when the class is under development. A `draft` class cannot be used to create any object. You should set this field to `underReview` when you believe the class is ready for use. The platform will automatically set this field to `approved` and it can be immediately used to create or migrate objects. When updating an already `approved` class you should keep setting this field to `underReview`.
2253    #[serde(rename = "reviewStatus")]
2254    pub review_status: Option<String>,
2255    /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
2256    #[serde(rename = "securityAnimation")]
2257    pub security_animation: Option<SecurityAnimation>,
2258    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
2259    #[serde(rename = "textModulesData")]
2260    pub text_modules_data: Option<Vec<TextModuleData>>,
2261    /// Optional value added module data. Maximum of ten on the class. For a pass only ten will be displayed, prioritizing those from the object.
2262    #[serde(rename = "valueAddedModuleData")]
2263    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
2264    /// Deprecated
2265    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2266    pub version: Option<i64>,
2267    /// View Unlock Requirement options for the gift card.
2268    #[serde(rename = "viewUnlockRequirement")]
2269    pub view_unlock_requirement: Option<String>,
2270    /// The wide logo of the gift card program or company. When provided, this will be used in place of the program logo in the top left of the card view.
2271    #[serde(rename = "wideProgramLogo")]
2272    pub wide_program_logo: Option<Image>,
2273    /// Deprecated.
2274    #[serde(rename = "wordMark")]
2275    pub word_mark: Option<Image>,
2276}
2277
2278impl common::RequestValue for GiftCardClass {}
2279impl common::ResponseResult for GiftCardClass {}
2280
2281/// There is no detailed description.
2282///
2283/// # Activities
2284///
2285/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2286/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2287///
2288/// * [addmessage giftcardclass](GiftcardclasAddmessageCall) (response)
2289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2290#[serde_with::serde_as]
2291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2292pub struct GiftCardClassAddMessageResponse {
2293    /// The updated GiftCardClass resource.
2294    pub resource: Option<GiftCardClass>,
2295}
2296
2297impl common::ResponseResult for GiftCardClassAddMessageResponse {}
2298
2299/// There is no detailed description.
2300///
2301/// # Activities
2302///
2303/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2304/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2305///
2306/// * [list giftcardclass](GiftcardclasListCall) (response)
2307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2308#[serde_with::serde_as]
2309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2310pub struct GiftCardClassListResponse {
2311    /// Pagination of the response.
2312    pub pagination: Option<Pagination>,
2313    /// Resources corresponding to the list request.
2314    pub resources: Option<Vec<GiftCardClass>>,
2315}
2316
2317impl common::ResponseResult for GiftCardClassListResponse {}
2318
2319/// There is no detailed description.
2320///
2321/// # Activities
2322///
2323/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2324/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2325///
2326/// * [get giftcardobject](GiftcardobjectGetCall) (response)
2327/// * [insert giftcardobject](GiftcardobjectInsertCall) (request|response)
2328/// * [patch giftcardobject](GiftcardobjectPatchCall) (request|response)
2329/// * [update giftcardobject](GiftcardobjectUpdateCall) (request|response)
2330#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2331#[serde_with::serde_as]
2332#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2333pub struct GiftCardObject {
2334    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding class only object AppLinkData will be displayed.
2335    #[serde(rename = "appLinkData")]
2336    pub app_link_data: Option<AppLinkData>,
2337    /// The card's monetary balance.
2338    pub balance: Option<Money>,
2339    /// The date and time when the balance was last updated. Offset is required. If balance is updated and this property is not provided, system will default to the current time.
2340    #[serde(rename = "balanceUpdateTime")]
2341    pub balance_update_time: Option<DateTime>,
2342    /// The barcode type and value.
2343    pub barcode: Option<Barcode>,
2344    /// Required. The card's number.
2345    #[serde(rename = "cardNumber")]
2346    pub card_number: Option<String>,
2347    /// Required. The class associated with this object. The class must be of the same type as this object, must already exist, and must be approved. Class IDs should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you.
2348    #[serde(rename = "classId")]
2349    pub class_id: Option<String>,
2350    /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
2351    #[serde(rename = "classReference")]
2352    pub class_reference: Option<GiftCardClass>,
2353    /// Indicates if notifications should explicitly be suppressed. If this field is set to true, regardless of the `messages` field, expiration notifications to the user will be suppressed. By default, this field is set to false. Currently, this can only be set for offers.
2354    #[serde(rename = "disableExpirationNotification")]
2355    pub disable_expiration_notification: Option<bool>,
2356    /// The card's event number, an optional field used by some gift cards.
2357    #[serde(rename = "eventNumber")]
2358    pub event_number: Option<String>,
2359    /// Information that controls how passes are grouped together.
2360    #[serde(rename = "groupingInfo")]
2361    pub grouping_info: Option<GroupingInfo>,
2362    /// Whether this object is currently linked to a single device. This field is set by the platform when a user saves the object, linking it to their device. Intended for use by select partners. Contact support for additional information.
2363    #[serde(rename = "hasLinkedDevice")]
2364    pub has_linked_device: Option<bool>,
2365    /// Indicates if the object has users. This field is set by the platform.
2366    #[serde(rename = "hasUsers")]
2367    pub has_users: Option<bool>,
2368    /// Optional banner image displayed on the front of the card. If none is present, hero image of the class, if present, will be displayed. If hero image of the class is also not present, nothing will be displayed.
2369    #[serde(rename = "heroImage")]
2370    pub hero_image: Option<Image>,
2371    /// Required. The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you. The unique identifier should only include alphanumeric characters, '.', '_', or '-'.
2372    pub id: Option<String>,
2373    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
2374    #[serde(rename = "imageModulesData")]
2375    pub image_modules_data: Option<Vec<ImageModuleData>>,
2376    /// Deprecated. Use textModulesData instead.
2377    #[serde(rename = "infoModuleData")]
2378    pub info_module_data: Option<InfoModuleData>,
2379    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#giftCardObject"`.
2380    pub kind: Option<String>,
2381    /// linked_object_ids are a list of other objects such as event ticket, loyalty, offer, generic, giftcard, transit and boarding pass that should be automatically attached to this giftcard object. If a user had saved this gift card, then these linked_object_ids would be automatically pushed to the user's wallet (unless they turned off the setting to receive such linked passes). Make sure that objects present in linked_object_ids are already inserted - if not, calls would fail. Once linked, the linked objects cannot be unlinked. You cannot link objects belonging to another issuer. There is a limit to the number of objects that can be linked to a single object. After the limit is reached, new linked objects in the call will be ignored silently. Object IDs should follow the format issuer ID. identifier where the former is issued by Google and the latter is chosen by you.
2382    #[serde(rename = "linkedObjectIds")]
2383    pub linked_object_ids: Option<Vec<String>>,
2384    /// Links module data. If links module data is also defined on the class, both will be displayed.
2385    #[serde(rename = "linksModuleData")]
2386    pub links_module_data: Option<LinksModuleData>,
2387    /// Note: This field is currently not supported to trigger geo notifications.
2388    pub locations: Option<Vec<LatLongPoint>>,
2389    /// Merchant locations. There is a maximum of ten on the object. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
2390    #[serde(rename = "merchantLocations")]
2391    pub merchant_locations: Option<Vec<MerchantLocation>>,
2392    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
2393    pub messages: Option<Vec<Message>>,
2394    /// Whether or not field updates to this object should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If set to DO_NOT_NOTIFY or NOTIFICATION_SETTINGS_UNSPECIFIED, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
2395    #[serde(rename = "notifyPreference")]
2396    pub notify_preference: Option<String>,
2397    /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
2398    #[serde(rename = "passConstraints")]
2399    pub pass_constraints: Option<PassConstraints>,
2400    /// The card's PIN.
2401    pub pin: Option<String>,
2402    /// The rotating barcode type and value.
2403    #[serde(rename = "rotatingBarcode")]
2404    pub rotating_barcode: Option<RotatingBarcode>,
2405    /// Restrictions on the object that needs to be verified before the user tries to save the pass. Note that this restrictions will only be applied during save time. If the restrictions changed after a user saves the pass, the new restrictions will not be applied to an already saved pass.
2406    #[serde(rename = "saveRestrictions")]
2407    pub save_restrictions: Option<SaveRestrictions>,
2408    /// The value that will be transmitted to a Smart Tap certified terminal over NFC for this object. The class level fields `enableSmartTap` and `redemptionIssuers` must also be set up correctly in order for the pass to support Smart Tap. Only ASCII characters are supported.
2409    #[serde(rename = "smartTapRedemptionValue")]
2410    pub smart_tap_redemption_value: Option<String>,
2411    /// Required. The state of the object. This field is used to determine how an object is displayed in the app. For example, an `inactive` object is moved to the "Expired passes" section.
2412    pub state: Option<String>,
2413    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
2414    #[serde(rename = "textModulesData")]
2415    pub text_modules_data: Option<Vec<TextModuleData>>,
2416    /// The time period this object will be `active` and object can be used. An object's state will be changed to `expired` when this time period has passed.
2417    #[serde(rename = "validTimeInterval")]
2418    pub valid_time_interval: Option<TimeInterval>,
2419    /// Optional value added module data. Maximum of ten on the object.
2420    #[serde(rename = "valueAddedModuleData")]
2421    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
2422    /// Deprecated
2423    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2424    pub version: Option<i64>,
2425}
2426
2427impl common::RequestValue for GiftCardObject {}
2428impl common::ResponseResult for GiftCardObject {}
2429
2430/// There is no detailed description.
2431///
2432/// # Activities
2433///
2434/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2435/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2436///
2437/// * [addmessage giftcardobject](GiftcardobjectAddmessageCall) (response)
2438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2439#[serde_with::serde_as]
2440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2441pub struct GiftCardObjectAddMessageResponse {
2442    /// The updated GiftCardObject resource.
2443    pub resource: Option<GiftCardObject>,
2444}
2445
2446impl common::ResponseResult for GiftCardObjectAddMessageResponse {}
2447
2448/// There is no detailed description.
2449///
2450/// # Activities
2451///
2452/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2453/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2454///
2455/// * [list giftcardobject](GiftcardobjectListCall) (response)
2456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2457#[serde_with::serde_as]
2458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2459pub struct GiftCardObjectListResponse {
2460    /// Pagination of the response.
2461    pub pagination: Option<Pagination>,
2462    /// Resources corresponding to the list request.
2463    pub resources: Option<Vec<GiftCardObject>>,
2464}
2465
2466impl common::ResponseResult for GiftCardObjectListResponse {}
2467
2468/// There is no detailed description.
2469///
2470/// This type is not used in any activity, and only used as *part* of another schema.
2471///
2472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2473#[serde_with::serde_as]
2474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2475pub struct GroupingInfo {
2476    /// Optional grouping ID for grouping the passes with the same ID visually together. Grouping with different types of passes is allowed.
2477    #[serde(rename = "groupingId")]
2478    pub grouping_id: Option<String>,
2479    /// Optional index for sorting the passes when they are grouped with other passes. Passes with lower sort index are shown before passes with higher sort index. If unspecified, the value is assumed to be INT_MAX. For two passes with the same sort index, the sorting behavior is undefined.
2480    #[serde(rename = "sortIndex")]
2481    pub sort_index: Option<i32>,
2482}
2483
2484impl common::Part for GroupingInfo {}
2485
2486/// Wrapping type for Google hosted images.
2487///
2488/// This type is not used in any activity, and only used as *part* of another schema.
2489///
2490#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2491#[serde_with::serde_as]
2492#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2493pub struct Image {
2494    /// Description of the image used for accessibility.
2495    #[serde(rename = "contentDescription")]
2496    pub content_description: Option<LocalizedString>,
2497    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#image"`.
2498    pub kind: Option<String>,
2499    /// An ID for an already uploaded private image. Either this or source_uri should be set. Requests setting both or neither will be rejected. Please contact support to use private images.
2500    #[serde(rename = "privateImageId")]
2501    pub private_image_id: Option<String>,
2502    /// A URI for the image. Either this or private_image_id should be set. Requests setting both or neither will be rejected.
2503    #[serde(rename = "sourceUri")]
2504    pub source_uri: Option<ImageUri>,
2505}
2506
2507impl common::Part for Image {}
2508
2509/// There is no detailed description.
2510///
2511/// This type is not used in any activity, and only used as *part* of another schema.
2512///
2513#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2514#[serde_with::serde_as]
2515#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2516pub struct ImageModuleData {
2517    /// The ID associated with an image module. This field is here to enable ease of management of image modules.
2518    pub id: Option<String>,
2519    /// A 100% width image.
2520    #[serde(rename = "mainImage")]
2521    pub main_image: Option<Image>,
2522}
2523
2524impl common::Part for ImageModuleData {}
2525
2526/// There is no detailed description.
2527///
2528/// This type is not used in any activity, and only used as *part* of another schema.
2529///
2530#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2531#[serde_with::serde_as]
2532#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2533pub struct ImageUri {
2534    /// Additional information about the image, which is unused and retained only for backward compatibility.
2535    pub description: Option<String>,
2536    /// Translated strings for the description, which are unused and retained only for backward compatibility.
2537    #[serde(rename = "localizedDescription")]
2538    pub localized_description: Option<LocalizedString>,
2539    /// The location of the image. URIs must have a scheme.
2540    pub uri: Option<String>,
2541}
2542
2543impl common::Part for ImageUri {}
2544
2545/// There is no detailed description.
2546///
2547/// This type is not used in any activity, and only used as *part* of another schema.
2548///
2549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2550#[serde_with::serde_as]
2551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2552pub struct InfoModuleData {
2553    /// A list of collections of labels and values. These will be displayed one after the other in a singular column.
2554    #[serde(rename = "labelValueRows")]
2555    pub label_value_rows: Option<Vec<LabelValueRow>>,
2556    /// no description provided
2557    #[serde(rename = "showLastUpdateTime")]
2558    pub show_last_update_time: Option<bool>,
2559}
2560
2561impl common::Part for InfoModuleData {}
2562
2563/// There is no detailed description.
2564///
2565/// # Activities
2566///
2567/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2568/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2569///
2570/// * [get issuer](IssuerGetCall) (response)
2571/// * [insert issuer](IssuerInsertCall) (request|response)
2572/// * [patch issuer](IssuerPatchCall) (request|response)
2573/// * [update issuer](IssuerUpdateCall) (request|response)
2574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2575#[serde_with::serde_as]
2576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2577pub struct Issuer {
2578    /// Allows the issuer to provide their callback settings.
2579    #[serde(rename = "callbackOptions")]
2580    pub callback_options: Option<CallbackOptions>,
2581    /// Issuer contact information.
2582    #[serde(rename = "contactInfo")]
2583    pub contact_info: Option<IssuerContactInfo>,
2584    /// URL for the issuer's home page.
2585    #[serde(rename = "homepageUrl")]
2586    pub homepage_url: Option<String>,
2587    /// The unique identifier for an issuer account. This is automatically generated when the issuer is inserted.
2588    #[serde(rename = "issuerId")]
2589    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2590    pub issuer_id: Option<i64>,
2591    /// The account name of the issuer.
2592    pub name: Option<String>,
2593    /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
2594    #[serde(rename = "smartTapMerchantData")]
2595    pub smart_tap_merchant_data: Option<SmartTapMerchantData>,
2596}
2597
2598impl common::RequestValue for Issuer {}
2599impl common::ResponseResult for Issuer {}
2600
2601/// There is no detailed description.
2602///
2603/// This type is not used in any activity, and only used as *part* of another schema.
2604///
2605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2606#[serde_with::serde_as]
2607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2608pub struct IssuerContactInfo {
2609    /// Email addresses which will receive alerts.
2610    #[serde(rename = "alertsEmails")]
2611    pub alerts_emails: Option<Vec<String>>,
2612    /// The primary contact email address.
2613    pub email: Option<String>,
2614    /// The primary contact name.
2615    pub name: Option<String>,
2616    /// The primary contact phone number.
2617    pub phone: Option<String>,
2618}
2619
2620impl common::Part for IssuerContactInfo {}
2621
2622/// There is no detailed description.
2623///
2624/// # Activities
2625///
2626/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2627/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2628///
2629/// * [list issuer](IssuerListCall) (response)
2630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2631#[serde_with::serde_as]
2632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2633pub struct IssuerListResponse {
2634    /// Resources corresponding to the list request.
2635    pub resources: Option<Vec<Issuer>>,
2636}
2637
2638impl common::ResponseResult for IssuerListResponse {}
2639
2640/// There is no detailed description.
2641///
2642/// This type is not used in any activity, and only used as *part* of another schema.
2643///
2644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2645#[serde_with::serde_as]
2646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2647pub struct IssuerToUserInfo {
2648    /// no description provided
2649    pub action: Option<String>,
2650    /// no description provided
2651    #[serde(rename = "signUpInfo")]
2652    pub sign_up_info: Option<SignUpInfo>,
2653    /// Currently not used, consider deprecating.
2654    pub url: Option<String>,
2655    /// JSON web token for action S2AP.
2656    pub value: Option<String>,
2657}
2658
2659impl common::Part for IssuerToUserInfo {}
2660
2661/// There is no detailed description.
2662///
2663/// # Activities
2664///
2665/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2666/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2667///
2668/// * [insert jwt](JwtInsertCall) (response)
2669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2670#[serde_with::serde_as]
2671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2672pub struct JwtInsertResponse {
2673    /// Data that corresponds to the ids of the provided classes and objects in the JWT. resources will only include the non-empty arrays (i.e. if the JWT only includes eventTicketObjects, then that is the only field that will be present in resources).
2674    pub resources: Option<Resources>,
2675    /// A URI that, when opened, will allow the end user to save the object(s) identified in the JWT to their Google account.
2676    #[serde(rename = "saveUri")]
2677    pub save_uri: Option<String>,
2678}
2679
2680impl common::ResponseResult for JwtInsertResponse {}
2681
2682/// There is no detailed description.
2683///
2684/// # Activities
2685///
2686/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2687/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2688///
2689/// * [insert jwt](JwtInsertCall) (request)
2690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2691#[serde_with::serde_as]
2692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2693pub struct JwtResource {
2694    /// A string representing a JWT of the format described at https://developers.google.com/wallet/reference/rest/v1/Jwt
2695    pub jwt: Option<String>,
2696}
2697
2698impl common::RequestValue for JwtResource {}
2699
2700/// A pair of text strings to be displayed in the details view. Note we no longer display LabelValue/LabelValueRow as a table, instead a list of items.
2701///
2702/// This type is not used in any activity, and only used as *part* of another schema.
2703///
2704#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2705#[serde_with::serde_as]
2706#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2707pub struct LabelValue {
2708    /// The label for a specific row and column. Recommended maximum is 15 characters for a two-column layout and 30 characters for a one-column layout.
2709    pub label: Option<String>,
2710    /// Translated strings for the label. Recommended maximum is 15 characters for a two-column layout and 30 characters for a one-column layout.
2711    #[serde(rename = "localizedLabel")]
2712    pub localized_label: Option<LocalizedString>,
2713    /// Translated strings for the value. Recommended maximum is 15 characters for a two-column layout and 30 characters for a one-column layout.
2714    #[serde(rename = "localizedValue")]
2715    pub localized_value: Option<LocalizedString>,
2716    /// The value for a specific row and column. Recommended maximum is 15 characters for a two-column layout and 30 characters for a one-column layout.
2717    pub value: Option<String>,
2718}
2719
2720impl common::Part for LabelValue {}
2721
2722/// There is no detailed description.
2723///
2724/// This type is not used in any activity, and only used as *part* of another schema.
2725///
2726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2727#[serde_with::serde_as]
2728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2729pub struct LabelValueRow {
2730    /// A list of labels and values. These will be displayed in a singular column, one after the other, not in multiple columns, despite the field name.
2731    pub columns: Option<Vec<LabelValue>>,
2732}
2733
2734impl common::Part for LabelValueRow {}
2735
2736/// There is no detailed description.
2737///
2738/// This type is not used in any activity, and only used as *part* of another schema.
2739///
2740#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2741#[serde_with::serde_as]
2742#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2743pub struct LatLongPoint {
2744    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#latLongPoint"`.
2745    pub kind: Option<String>,
2746    /// The latitude specified as any value in the range of -90.0 through +90.0, both inclusive. Values outside these bounds will be rejected.
2747    pub latitude: Option<f64>,
2748    /// The longitude specified in the range -180.0 through +180.0, both inclusive. Values outside these bounds will be rejected.
2749    pub longitude: Option<f64>,
2750}
2751
2752impl common::Part for LatLongPoint {}
2753
2754/// There is no detailed description.
2755///
2756/// This type is not used in any activity, and only used as *part* of another schema.
2757///
2758#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2759#[serde_with::serde_as]
2760#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2761pub struct LinksModuleData {
2762    /// The list of URIs.
2763    pub uris: Option<Vec<Uri>>,
2764}
2765
2766impl common::Part for LinksModuleData {}
2767
2768/// There is no detailed description.
2769///
2770/// This type is not used in any activity, and only used as *part* of another schema.
2771///
2772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2773#[serde_with::serde_as]
2774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2775pub struct ListTemplateOverride {
2776    /// Specifies from a predefined set of options or from a reference to the field what will be displayed in the first row. To set this override, set the FirstRowOption.fieldOption to the FieldSelector of your choice.
2777    #[serde(rename = "firstRowOption")]
2778    pub first_row_option: Option<FirstRowOption>,
2779    /// A reference to the field to be displayed in the second row. This option is only displayed if there are not multiple user objects in a group. If there is a group, the second row will always display a field shared by all objects. To set this override, please set secondRowOption to the FieldSelector of you choice.
2780    #[serde(rename = "secondRowOption")]
2781    pub second_row_option: Option<FieldSelector>,
2782    /// An unused/deprecated field. Setting it will have no effect on what the user sees.
2783    #[serde(rename = "thirdRowOption")]
2784    pub third_row_option: Option<FieldSelector>,
2785}
2786
2787impl common::Part for ListTemplateOverride {}
2788
2789/// There is no detailed description.
2790///
2791/// This type is not used in any activity, and only used as *part* of another schema.
2792///
2793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2794#[serde_with::serde_as]
2795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2796pub struct LocalizedString {
2797    /// Contains the string to be displayed if no appropriate translation is available.
2798    #[serde(rename = "defaultValue")]
2799    pub default_value: Option<TranslatedString>,
2800    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#localizedString"`.
2801    pub kind: Option<String>,
2802    /// Contains the translations for the string.
2803    #[serde(rename = "translatedValues")]
2804    pub translated_values: Option<Vec<TranslatedString>>,
2805}
2806
2807impl common::Part for LocalizedString {}
2808
2809/// There is no detailed description.
2810///
2811/// # Activities
2812///
2813/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2814/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2815///
2816/// * [get loyaltyclass](LoyaltyclasGetCall) (response)
2817/// * [insert loyaltyclass](LoyaltyclasInsertCall) (request|response)
2818/// * [patch loyaltyclass](LoyaltyclasPatchCall) (request|response)
2819/// * [update loyaltyclass](LoyaltyclasUpdateCall) (request|response)
2820#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2821#[serde_with::serde_as]
2822#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2823pub struct LoyaltyClass {
2824    /// The account ID label, such as "Member ID." Recommended maximum length is 15 characters to ensure full string is displayed on smaller screens.
2825    #[serde(rename = "accountIdLabel")]
2826    pub account_id_label: Option<String>,
2827    /// The account name label, such as "Member Name." Recommended maximum length is 15 characters to ensure full string is displayed on smaller screens.
2828    #[serde(rename = "accountNameLabel")]
2829    pub account_name_label: Option<String>,
2830    /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
2831    #[serde(rename = "allowMultipleUsersPerObject")]
2832    pub allow_multiple_users_per_object: Option<bool>,
2833    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding object that will be used instead.
2834    #[serde(rename = "appLinkData")]
2835    pub app_link_data: Option<AppLinkData>,
2836    /// Callback options to be used to call the issuer back for every save/delete of an object for this class by the end-user. All objects of this class are eligible for the callback.
2837    #[serde(rename = "callbackOptions")]
2838    pub callback_options: Option<CallbackOptions>,
2839    /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
2840    #[serde(rename = "classTemplateInfo")]
2841    pub class_template_info: Option<ClassTemplateInfo>,
2842    /// Country code used to display the card's country (when the user is not in that country), as well as to display localized content when content is not available in the user's locale.
2843    #[serde(rename = "countryCode")]
2844    pub country_code: Option<String>,
2845    /// Information about how the class may be discovered and instantiated from within the Google Pay app.
2846    #[serde(rename = "discoverableProgram")]
2847    pub discoverable_program: Option<DiscoverableProgram>,
2848    /// Identifies whether this class supports Smart Tap. The `redemptionIssuers` and one of object level `smartTapRedemptionLevel`, barcode.value`, or `accountId` fields must also be set up correctly in order for a pass to support Smart Tap.
2849    #[serde(rename = "enableSmartTap")]
2850    pub enable_smart_tap: Option<bool>,
2851    /// Optional banner image displayed on the front of the card. If none is present, nothing will be displayed. The image will display at 100% width.
2852    #[serde(rename = "heroImage")]
2853    pub hero_image: Option<Image>,
2854    /// The background color for the card. If not set the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used. The format is #rrggbb where rrggbb is a hex RGB triplet, such as `#ffcc00`. You can also use the shorthand version of the RGB triplet which is #rgb, such as `#fc0`.
2855    #[serde(rename = "hexBackgroundColor")]
2856    pub hex_background_color: Option<String>,
2857    /// The URI of your application's home page. Populating the URI in this field results in the exact same behavior as populating an URI in linksModuleData (when an object is rendered, a link to the homepage is shown in what would usually be thought of as the linksModuleData section of the object).
2858    #[serde(rename = "homepageUri")]
2859    pub homepage_uri: Option<Uri>,
2860    /// Required. The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
2861    pub id: Option<String>,
2862    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
2863    #[serde(rename = "imageModulesData")]
2864    pub image_modules_data: Option<Vec<ImageModuleData>>,
2865    /// Deprecated. Use textModulesData instead.
2866    #[serde(rename = "infoModuleData")]
2867    pub info_module_data: Option<InfoModuleData>,
2868    /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
2869    #[serde(rename = "issuerName")]
2870    pub issuer_name: Option<String>,
2871    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#loyaltyClass"`.
2872    pub kind: Option<String>,
2873    /// Links module data. If links module data is also defined on the object, both will be displayed.
2874    #[serde(rename = "linksModuleData")]
2875    pub links_module_data: Option<LinksModuleData>,
2876    /// Translated strings for the account_id_label. Recommended maximum length is 15 characters to ensure full string is displayed on smaller screens.
2877    #[serde(rename = "localizedAccountIdLabel")]
2878    pub localized_account_id_label: Option<LocalizedString>,
2879    /// Translated strings for the account_name_label. Recommended maximum length is 15 characters to ensure full string is displayed on smaller screens.
2880    #[serde(rename = "localizedAccountNameLabel")]
2881    pub localized_account_name_label: Option<LocalizedString>,
2882    /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
2883    #[serde(rename = "localizedIssuerName")]
2884    pub localized_issuer_name: Option<LocalizedString>,
2885    /// Translated strings for the program_name. The app may display an ellipsis after the first 20 characters to ensure full string is displayed on smaller screens.
2886    #[serde(rename = "localizedProgramName")]
2887    pub localized_program_name: Option<LocalizedString>,
2888    /// Translated strings for the rewards_tier. Recommended maximum length is 7 characters to ensure full string is displayed on smaller screens.
2889    #[serde(rename = "localizedRewardsTier")]
2890    pub localized_rewards_tier: Option<LocalizedString>,
2891    /// Translated strings for the rewards_tier_label. Recommended maximum length is 9 characters to ensure full string is displayed on smaller screens.
2892    #[serde(rename = "localizedRewardsTierLabel")]
2893    pub localized_rewards_tier_label: Option<LocalizedString>,
2894    /// Translated strings for the secondary_rewards_tier.
2895    #[serde(rename = "localizedSecondaryRewardsTier")]
2896    pub localized_secondary_rewards_tier: Option<LocalizedString>,
2897    /// Translated strings for the secondary_rewards_tier_label.
2898    #[serde(rename = "localizedSecondaryRewardsTierLabel")]
2899    pub localized_secondary_rewards_tier_label: Option<LocalizedString>,
2900    /// Note: This field is currently not supported to trigger geo notifications.
2901    pub locations: Option<Vec<LatLongPoint>>,
2902    /// Merchant locations. There is a maximum of ten on the class. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
2903    #[serde(rename = "merchantLocations")]
2904    pub merchant_locations: Option<Vec<MerchantLocation>>,
2905    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
2906    pub messages: Option<Vec<Message>>,
2907    /// Identifies whether multiple users and devices will save the same object referencing this class.
2908    #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
2909    pub multiple_devices_and_holders_allowed_status: Option<String>,
2910    /// Whether or not field updates to this class should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If not specified, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
2911    #[serde(rename = "notifyPreference")]
2912    pub notify_preference: Option<String>,
2913    /// Required. The logo of the loyalty program or company. This logo is displayed in both the details and list views of the app.
2914    #[serde(rename = "programLogo")]
2915    pub program_logo: Option<Image>,
2916    /// Required. The program name, such as "Adam's Apparel". The app may display an ellipsis after the first 20 characters to ensure full string is displayed on smaller screens.
2917    #[serde(rename = "programName")]
2918    pub program_name: Option<String>,
2919    /// Identifies which redemption issuers can redeem the pass over Smart Tap. Redemption issuers are identified by their issuer ID. Redemption issuers must have at least one Smart Tap key configured. The `enableSmartTap` and one of object level `smartTapRedemptionValue`, barcode.value`, or `accountId` fields must also be set up correctly in order for a pass to support Smart Tap.
2920    #[serde(rename = "redemptionIssuers")]
2921    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2922    pub redemption_issuers: Option<Vec<i64>>,
2923    /// The review comments set by the platform when a class is marked `approved` or `rejected`.
2924    pub review: Option<Review>,
2925    /// Required. The status of the class. This field can be set to `draft` or `underReview` using the insert, patch, or update API calls. Once the review state is changed from `draft` it may not be changed back to `draft`. You should keep this field to `draft` when the class is under development. A `draft` class cannot be used to create any object. You should set this field to `underReview` when you believe the class is ready for use. The platform will automatically set this field to `approved` and it can be immediately used to create or migrate objects. When updating an already `approved` class you should keep setting this field to `underReview`.
2926    #[serde(rename = "reviewStatus")]
2927    pub review_status: Option<String>,
2928    /// The rewards tier, such as "Gold" or "Platinum." Recommended maximum length is 7 characters to ensure full string is displayed on smaller screens.
2929    #[serde(rename = "rewardsTier")]
2930    pub rewards_tier: Option<String>,
2931    /// The rewards tier label, such as "Rewards Tier." Recommended maximum length is 9 characters to ensure full string is displayed on smaller screens.
2932    #[serde(rename = "rewardsTierLabel")]
2933    pub rewards_tier_label: Option<String>,
2934    /// The secondary rewards tier, such as "Gold" or "Platinum."
2935    #[serde(rename = "secondaryRewardsTier")]
2936    pub secondary_rewards_tier: Option<String>,
2937    /// The secondary rewards tier label, such as "Rewards Tier."
2938    #[serde(rename = "secondaryRewardsTierLabel")]
2939    pub secondary_rewards_tier_label: Option<String>,
2940    /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
2941    #[serde(rename = "securityAnimation")]
2942    pub security_animation: Option<SecurityAnimation>,
2943    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
2944    #[serde(rename = "textModulesData")]
2945    pub text_modules_data: Option<Vec<TextModuleData>>,
2946    /// Optional value added module data. Maximum of ten on the class. For a pass only ten will be displayed, prioritizing those from the object.
2947    #[serde(rename = "valueAddedModuleData")]
2948    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
2949    /// Deprecated
2950    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2951    pub version: Option<i64>,
2952    /// View Unlock Requirement options for the loyalty card.
2953    #[serde(rename = "viewUnlockRequirement")]
2954    pub view_unlock_requirement: Option<String>,
2955    /// The wide logo of the loyalty program or company. When provided, this will be used in place of the program logo in the top left of the card view.
2956    #[serde(rename = "wideProgramLogo")]
2957    pub wide_program_logo: Option<Image>,
2958    /// Deprecated.
2959    #[serde(rename = "wordMark")]
2960    pub word_mark: Option<Image>,
2961}
2962
2963impl common::RequestValue for LoyaltyClass {}
2964impl common::ResponseResult for LoyaltyClass {}
2965
2966/// There is no detailed description.
2967///
2968/// # Activities
2969///
2970/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2971/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2972///
2973/// * [addmessage loyaltyclass](LoyaltyclasAddmessageCall) (response)
2974#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2975#[serde_with::serde_as]
2976#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2977pub struct LoyaltyClassAddMessageResponse {
2978    /// The updated LoyaltyClass resource.
2979    pub resource: Option<LoyaltyClass>,
2980}
2981
2982impl common::ResponseResult for LoyaltyClassAddMessageResponse {}
2983
2984/// There is no detailed description.
2985///
2986/// # Activities
2987///
2988/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2989/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2990///
2991/// * [list loyaltyclass](LoyaltyclasListCall) (response)
2992#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2993#[serde_with::serde_as]
2994#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2995pub struct LoyaltyClassListResponse {
2996    /// Pagination of the response.
2997    pub pagination: Option<Pagination>,
2998    /// Resources corresponding to the list request.
2999    pub resources: Option<Vec<LoyaltyClass>>,
3000}
3001
3002impl common::ResponseResult for LoyaltyClassListResponse {}
3003
3004/// There is no detailed description.
3005///
3006/// # Activities
3007///
3008/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3009/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3010///
3011/// * [get loyaltyobject](LoyaltyobjectGetCall) (response)
3012/// * [insert loyaltyobject](LoyaltyobjectInsertCall) (request|response)
3013/// * [modifylinkedofferobjects loyaltyobject](LoyaltyobjectModifylinkedofferobjectCall) (response)
3014/// * [patch loyaltyobject](LoyaltyobjectPatchCall) (request|response)
3015/// * [update loyaltyobject](LoyaltyobjectUpdateCall) (request|response)
3016#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3017#[serde_with::serde_as]
3018#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3019pub struct LoyaltyObject {
3020    /// The loyalty account identifier. Recommended maximum length is 20 characters.
3021    #[serde(rename = "accountId")]
3022    pub account_id: Option<String>,
3023    /// The loyalty account holder name, such as "John Smith." Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
3024    #[serde(rename = "accountName")]
3025    pub account_name: Option<String>,
3026    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding class only object AppLinkData will be displayed.
3027    #[serde(rename = "appLinkData")]
3028    pub app_link_data: Option<AppLinkData>,
3029    /// The barcode type and value.
3030    pub barcode: Option<Barcode>,
3031    /// Required. The class associated with this object. The class must be of the same type as this object, must already exist, and must be approved. Class IDs should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you.
3032    #[serde(rename = "classId")]
3033    pub class_id: Option<String>,
3034    /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
3035    #[serde(rename = "classReference")]
3036    pub class_reference: Option<LoyaltyClass>,
3037    /// Indicates if notifications should explicitly be suppressed. If this field is set to true, regardless of the `messages` field, expiration notifications to the user will be suppressed. By default, this field is set to false. Currently, this can only be set for offers.
3038    #[serde(rename = "disableExpirationNotification")]
3039    pub disable_expiration_notification: Option<bool>,
3040    /// Information that controls how passes are grouped together.
3041    #[serde(rename = "groupingInfo")]
3042    pub grouping_info: Option<GroupingInfo>,
3043    /// Whether this object is currently linked to a single device. This field is set by the platform when a user saves the object, linking it to their device. Intended for use by select partners. Contact support for additional information.
3044    #[serde(rename = "hasLinkedDevice")]
3045    pub has_linked_device: Option<bool>,
3046    /// Indicates if the object has users. This field is set by the platform.
3047    #[serde(rename = "hasUsers")]
3048    pub has_users: Option<bool>,
3049    /// Optional banner image displayed on the front of the card. If none is present, hero image of the class, if present, will be displayed. If hero image of the class is also not present, nothing will be displayed.
3050    #[serde(rename = "heroImage")]
3051    pub hero_image: Option<Image>,
3052    /// Required. The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you. The unique identifier should only include alphanumeric characters, '.', '_', or '-'.
3053    pub id: Option<String>,
3054    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
3055    #[serde(rename = "imageModulesData")]
3056    pub image_modules_data: Option<Vec<ImageModuleData>>,
3057    /// Deprecated. Use textModulesData instead.
3058    #[serde(rename = "infoModuleData")]
3059    pub info_module_data: Option<InfoModuleData>,
3060    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#loyaltyObject"`.
3061    pub kind: Option<String>,
3062    /// linked_object_ids are a list of other objects such as event ticket, loyalty, offer, generic, giftcard, transit and boarding pass that should be automatically attached to this loyalty object. If a user had saved this loyalty card, then these linked_object_ids would be automatically pushed to the user's wallet (unless they turned off the setting to receive such linked passes). Make sure that objects present in linked_object_ids are already inserted - if not, calls would fail. Once linked, the linked objects cannot be unlinked. You cannot link objects belonging to another issuer. There is a limit to the number of objects that can be linked to a single object. After the limit is reached, new linked objects in the call will be ignored silently. Object IDs should follow the format issuer ID. identifier where the former is issued by Google and the latter is chosen by you.
3063    #[serde(rename = "linkedObjectIds")]
3064    pub linked_object_ids: Option<Vec<String>>,
3065    /// A list of offer objects linked to this loyalty card. The offer objects must already exist. Offer object IDs should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you.
3066    #[serde(rename = "linkedOfferIds")]
3067    pub linked_offer_ids: Option<Vec<String>>,
3068    /// Links module data. If links module data is also defined on the class, both will be displayed.
3069    #[serde(rename = "linksModuleData")]
3070    pub links_module_data: Option<LinksModuleData>,
3071    /// Note: This field is currently not supported to trigger geo notifications.
3072    pub locations: Option<Vec<LatLongPoint>>,
3073    /// The loyalty reward points label, balance, and type.
3074    #[serde(rename = "loyaltyPoints")]
3075    pub loyalty_points: Option<LoyaltyPoints>,
3076    /// Merchant locations. There is a maximum of ten on the object. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
3077    #[serde(rename = "merchantLocations")]
3078    pub merchant_locations: Option<Vec<MerchantLocation>>,
3079    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
3080    pub messages: Option<Vec<Message>>,
3081    /// Whether or not field updates to this object should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If set to DO_NOT_NOTIFY or NOTIFICATION_SETTINGS_UNSPECIFIED, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
3082    #[serde(rename = "notifyPreference")]
3083    pub notify_preference: Option<String>,
3084    /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
3085    #[serde(rename = "passConstraints")]
3086    pub pass_constraints: Option<PassConstraints>,
3087    /// The rotating barcode type and value.
3088    #[serde(rename = "rotatingBarcode")]
3089    pub rotating_barcode: Option<RotatingBarcode>,
3090    /// Restrictions on the object that needs to be verified before the user tries to save the pass. Note that this restrictions will only be applied during save time. If the restrictions changed after a user saves the pass, the new restrictions will not be applied to an already saved pass.
3091    #[serde(rename = "saveRestrictions")]
3092    pub save_restrictions: Option<SaveRestrictions>,
3093    /// The secondary loyalty reward points label, balance, and type. Shown in addition to the primary loyalty points.
3094    #[serde(rename = "secondaryLoyaltyPoints")]
3095    pub secondary_loyalty_points: Option<LoyaltyPoints>,
3096    /// The value that will be transmitted to a Smart Tap certified terminal over NFC for this object. The class level fields `enableSmartTap` and `redemptionIssuers` must also be set up correctly in order for the pass to support Smart Tap. Only ASCII characters are supported. If this value is not set but the class level fields `enableSmartTap` and `redemptionIssuers` are set up correctly, the `barcode.value` or the `accountId` fields are used as fallback if present.
3097    #[serde(rename = "smartTapRedemptionValue")]
3098    pub smart_tap_redemption_value: Option<String>,
3099    /// Required. The state of the object. This field is used to determine how an object is displayed in the app. For example, an `inactive` object is moved to the "Expired passes" section.
3100    pub state: Option<String>,
3101    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
3102    #[serde(rename = "textModulesData")]
3103    pub text_modules_data: Option<Vec<TextModuleData>>,
3104    /// The time period this object will be `active` and object can be used. An object's state will be changed to `expired` when this time period has passed.
3105    #[serde(rename = "validTimeInterval")]
3106    pub valid_time_interval: Option<TimeInterval>,
3107    /// Optional value added module data. Maximum of ten on the object.
3108    #[serde(rename = "valueAddedModuleData")]
3109    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
3110    /// Deprecated
3111    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3112    pub version: Option<i64>,
3113}
3114
3115impl common::RequestValue for LoyaltyObject {}
3116impl common::ResponseResult for LoyaltyObject {}
3117
3118/// There is no detailed description.
3119///
3120/// # Activities
3121///
3122/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3123/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3124///
3125/// * [addmessage loyaltyobject](LoyaltyobjectAddmessageCall) (response)
3126#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3127#[serde_with::serde_as]
3128#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3129pub struct LoyaltyObjectAddMessageResponse {
3130    /// The updated LoyaltyObject resource.
3131    pub resource: Option<LoyaltyObject>,
3132}
3133
3134impl common::ResponseResult for LoyaltyObjectAddMessageResponse {}
3135
3136/// There is no detailed description.
3137///
3138/// # Activities
3139///
3140/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3141/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3142///
3143/// * [list loyaltyobject](LoyaltyobjectListCall) (response)
3144#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3145#[serde_with::serde_as]
3146#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3147pub struct LoyaltyObjectListResponse {
3148    /// Pagination of the response.
3149    pub pagination: Option<Pagination>,
3150    /// Resources corresponding to the list request.
3151    pub resources: Option<Vec<LoyaltyObject>>,
3152}
3153
3154impl common::ResponseResult for LoyaltyObjectListResponse {}
3155
3156/// There is no detailed description.
3157///
3158/// This type is not used in any activity, and only used as *part* of another schema.
3159///
3160#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3161#[serde_with::serde_as]
3162#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3163pub struct LoyaltyPoints {
3164    /// The account holder's loyalty point balance, such as "500" or "$10.00". Recommended maximum length is 7 characters. This is a required field of `loyaltyPoints` and `secondaryLoyaltyPoints`.
3165    pub balance: Option<LoyaltyPointsBalance>,
3166    /// The loyalty points label, such as "Points". Recommended maximum length is 9 characters.
3167    pub label: Option<String>,
3168    /// Translated strings for the label. Recommended maximum length is 9 characters.
3169    #[serde(rename = "localizedLabel")]
3170    pub localized_label: Option<LocalizedString>,
3171}
3172
3173impl common::Part for LoyaltyPoints {}
3174
3175/// There is no detailed description.
3176///
3177/// This type is not used in any activity, and only used as *part* of another schema.
3178///
3179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3180#[serde_with::serde_as]
3181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3182pub struct LoyaltyPointsBalance {
3183    /// The double form of a balance. Only one of these subtypes (string, int, double, money) should be populated.
3184    pub double: Option<f64>,
3185    /// The integer form of a balance. Only one of these subtypes (string, int, double, money) should be populated.
3186    pub int: Option<i32>,
3187    /// The money form of a balance. Only one of these subtypes (string, int, double, money) should be populated.
3188    pub money: Option<Money>,
3189    /// The string form of a balance. Only one of these subtypes (string, int, double, money) should be populated.
3190    pub string: Option<String>,
3191}
3192
3193impl common::Part for LoyaltyPointsBalance {}
3194
3195/// A reference to data stored on the filesystem, on GFS or in blobstore.
3196///
3197/// # Activities
3198///
3199/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3200/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3201///
3202/// * [download media](MediaDownloadCall) (response)
3203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3204#[serde_with::serde_as]
3205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3206pub struct Media {
3207    /// Deprecated, use one of explicit hash type fields instead. Algorithm used for calculating the hash. As of 2011/01/21, "MD5" is the only possible value for this field. New values may be added at any time.
3208    pub algorithm: Option<String>,
3209    /// Use object_id instead.
3210    #[serde(rename = "bigstoreObjectRef")]
3211    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3212    pub bigstore_object_ref: Option<Vec<u8>>,
3213    /// Blobstore v1 reference, set if reference_type is BLOBSTORE_REF This should be the byte representation of a blobstore.BlobRef. Since Blobstore is deprecating v1, use blobstore2_info instead. For now, any v2 blob will also be represented in this field as v1 BlobRef.
3214    #[serde(rename = "blobRef")]
3215    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3216    pub blob_ref: Option<Vec<u8>>,
3217    /// Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers to a v2 blob.
3218    #[serde(rename = "blobstore2Info")]
3219    pub blobstore2_info: Option<Blobstore2Info>,
3220    /// A composite media composed of one or more media objects, set if reference_type is COMPOSITE_MEDIA. The media length field must be set to the sum of the lengths of all composite media objects. Note: All composite media must have length specified.
3221    #[serde(rename = "compositeMedia")]
3222    pub composite_media: Option<Vec<CompositeMedia>>,
3223    /// MIME type of the data
3224    #[serde(rename = "contentType")]
3225    pub content_type: Option<String>,
3226    /// Extended content type information provided for Scotty uploads.
3227    #[serde(rename = "contentTypeInfo")]
3228    pub content_type_info: Option<ContentTypeInfo>,
3229    /// A binary data reference for a media download. Serves as a technology-agnostic binary reference in some Google infrastructure. This value is a serialized storage_cosmo.BinaryReference proto. Storing it as bytes is a hack to get around the fact that the cosmo proto (as well as others it includes) doesn't support JavaScript. This prevents us from including the actual type of this field.
3230    #[serde(rename = "cosmoBinaryReference")]
3231    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3232    pub cosmo_binary_reference: Option<Vec<u8>>,
3233    /// For Scotty Uploads: Scotty-provided hashes for uploads For Scotty Downloads: (WARNING: DO NOT USE WITHOUT PERMISSION FROM THE SCOTTY TEAM.) A Hash provided by the agent to be used to verify the data being downloaded. Currently only supported for inline payloads. Further, only crc32c_hash is currently supported.
3234    #[serde(rename = "crc32cHash")]
3235    pub crc32c_hash: Option<u32>,
3236    /// Set if reference_type is DIFF_CHECKSUMS_RESPONSE.
3237    #[serde(rename = "diffChecksumsResponse")]
3238    pub diff_checksums_response: Option<DiffChecksumsResponse>,
3239    /// Set if reference_type is DIFF_DOWNLOAD_RESPONSE.
3240    #[serde(rename = "diffDownloadResponse")]
3241    pub diff_download_response: Option<DiffDownloadResponse>,
3242    /// Set if reference_type is DIFF_UPLOAD_REQUEST.
3243    #[serde(rename = "diffUploadRequest")]
3244    pub diff_upload_request: Option<DiffUploadRequest>,
3245    /// Set if reference_type is DIFF_UPLOAD_RESPONSE.
3246    #[serde(rename = "diffUploadResponse")]
3247    pub diff_upload_response: Option<DiffUploadResponse>,
3248    /// Set if reference_type is DIFF_VERSION_RESPONSE.
3249    #[serde(rename = "diffVersionResponse")]
3250    pub diff_version_response: Option<DiffVersionResponse>,
3251    /// Parameters for a media download.
3252    #[serde(rename = "downloadParameters")]
3253    pub download_parameters: Option<DownloadParameters>,
3254    /// Original file name
3255    pub filename: Option<String>,
3256    /// Deprecated, use one of explicit hash type fields instead. These two hash related fields will only be populated on Scotty based media uploads and will contain the content of the hash group in the NotificationRequest: http://cs/#google3/blobstore2/api/scotty/service/proto/upload_listener.proto&q=class:Hash Hex encoded hash value of the uploaded media.
3257    pub hash: Option<String>,
3258    /// For Scotty uploads only. If a user sends a hash code and the backend has requested that Scotty verify the upload against the client hash, Scotty will perform the check on behalf of the backend and will reject it if the hashes don't match. This is set to true if Scotty performed this verification.
3259    #[serde(rename = "hashVerified")]
3260    pub hash_verified: Option<bool>,
3261    /// Media data, set if reference_type is INLINE
3262    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3263    pub inline: Option<Vec<u8>>,
3264    /// |is_potential_retry| is set false only when Scotty is certain that it has not sent the request before. When a client resumes an upload, this field must be set true in agent calls, because Scotty cannot be certain that it has never sent the request before due to potential failure in the session state persistence.
3265    #[serde(rename = "isPotentialRetry")]
3266    pub is_potential_retry: Option<bool>,
3267    /// Size of the data, in bytes
3268    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3269    pub length: Option<i64>,
3270    /// Scotty-provided MD5 hash for an upload.
3271    #[serde(rename = "md5Hash")]
3272    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3273    pub md5_hash: Option<Vec<u8>>,
3274    /// Media id to forward to the operation GetMedia. Can be set if reference_type is GET_MEDIA.
3275    #[serde(rename = "mediaId")]
3276    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3277    pub media_id: Option<Vec<u8>>,
3278    /// Reference to a TI Blob, set if reference_type is BIGSTORE_REF.
3279    #[serde(rename = "objectId")]
3280    pub object_id: Option<ObjectId>,
3281    /// Path to the data, set if reference_type is PATH
3282    pub path: Option<String>,
3283    /// Describes what the field reference contains.
3284    #[serde(rename = "referenceType")]
3285    pub reference_type: Option<String>,
3286    /// Scotty-provided SHA1 hash for an upload.
3287    #[serde(rename = "sha1Hash")]
3288    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3289    pub sha1_hash: Option<Vec<u8>>,
3290    /// Scotty-provided SHA256 hash for an upload.
3291    #[serde(rename = "sha256Hash")]
3292    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3293    pub sha256_hash: Option<Vec<u8>>,
3294    /// Time at which the media data was last updated, in milliseconds since UNIX epoch
3295    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3296    pub timestamp: Option<u64>,
3297    /// A unique fingerprint/version id for the media data
3298    pub token: Option<String>,
3299}
3300
3301impl common::ResponseResult for Media {}
3302
3303/// Extra information added to operations that support Scotty media requests.
3304///
3305/// This type is not used in any activity, and only used as *part* of another schema.
3306///
3307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3308#[serde_with::serde_as]
3309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3310pub struct MediaRequestInfo {
3311    /// The number of current bytes uploaded or downloaded.
3312    #[serde(rename = "currentBytes")]
3313    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3314    pub current_bytes: Option<i64>,
3315    /// Data to be copied to backend requests. Custom data is returned to Scotty in the agent_state field, which Scotty will then provide in subsequent upload notifications.
3316    #[serde(rename = "customData")]
3317    pub custom_data: Option<String>,
3318    /// Set if the http request info is diff encoded. The value of this field is the version number of the base revision. This is corresponding to Apiary's mediaDiffObjectVersion (//depot/google3/java/com/google/api/server/media/variable/DiffObjectVersionVariable.java). See go/esf-scotty-diff-upload for more information.
3319    #[serde(rename = "diffObjectVersion")]
3320    pub diff_object_version: Option<String>,
3321    /// The existence of the final_status field indicates that this is the last call to the agent for this request_id. http://google3/uploader/agent/scotty_agent.proto?l=737&rcl=347601929
3322    #[serde(rename = "finalStatus")]
3323    pub final_status: Option<i32>,
3324    /// The type of notification received from Scotty.
3325    #[serde(rename = "notificationType")]
3326    pub notification_type: Option<String>,
3327    /// The physical headers provided by RequestReceivedParameters in Scotty request. type is uploader_service.KeyValuePairs.
3328    #[serde(rename = "physicalHeaders")]
3329    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3330    pub physical_headers: Option<Vec<u8>>,
3331    /// The Scotty request ID.
3332    #[serde(rename = "requestId")]
3333    pub request_id: Option<String>,
3334    /// The partition of the Scotty server handling this request. type is uploader_service.RequestReceivedParamsServingInfo LINT.IfChange(request_received_params_serving_info_annotations) LINT.ThenChange()
3335    #[serde(rename = "requestReceivedParamsServingInfo")]
3336    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3337    pub request_received_params_serving_info: Option<Vec<u8>>,
3338    /// The total size of the file.
3339    #[serde(rename = "totalBytes")]
3340    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3341    pub total_bytes: Option<i64>,
3342    /// Whether the total bytes field contains an estimated data.
3343    #[serde(rename = "totalBytesIsEstimated")]
3344    pub total_bytes_is_estimated: Option<bool>,
3345}
3346
3347impl common::Part for MediaRequestInfo {}
3348
3349/// Locations of interest for this class or object. Currently, this location is used for geofenced notifications. When a user is within a set radius of this lat/long, and dwells there, Google will trigger a notification. When a user exits this radius, the notification will be hidden.
3350///
3351/// This type is not used in any activity, and only used as *part* of another schema.
3352///
3353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3354#[serde_with::serde_as]
3355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3356pub struct MerchantLocation {
3357    /// The latitude specified as any value in the range of -90.0 through +90.0, both inclusive. Values outside these bounds will be rejected.
3358    pub latitude: Option<f64>,
3359    /// The longitude specified in the range -180.0 through +180.0, both inclusive. Values outside these bounds will be rejected.
3360    pub longitude: Option<f64>,
3361}
3362
3363impl common::Part for MerchantLocation {}
3364
3365/// A message that will be displayed with a Valuable
3366///
3367/// This type is not used in any activity, and only used as *part* of another schema.
3368///
3369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3370#[serde_with::serde_as]
3371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3372pub struct Message {
3373    /// The message body.
3374    pub body: Option<String>,
3375    /// The period of time that the message will be displayed to users. You can define both a `startTime` and `endTime` for each message. A message is displayed immediately after a Wallet Object is inserted unless a `startTime` is set. The message will appear in a list of messages indefinitely if `endTime` is not provided.
3376    #[serde(rename = "displayInterval")]
3377    pub display_interval: Option<TimeInterval>,
3378    /// The message header.
3379    pub header: Option<String>,
3380    /// The ID associated with a message. This field is here to enable ease of management of messages. Notice ID values could possibly duplicate across multiple messages in the same class/instance, and care must be taken to select a reasonable ID for each message.
3381    pub id: Option<String>,
3382    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#walletObjectMessage"`.
3383    pub kind: Option<String>,
3384    /// Translated strings for the message body.
3385    #[serde(rename = "localizedBody")]
3386    pub localized_body: Option<LocalizedString>,
3387    /// Translated strings for the message header.
3388    #[serde(rename = "localizedHeader")]
3389    pub localized_header: Option<LocalizedString>,
3390    /// The message type.
3391    #[serde(rename = "messageType")]
3392    pub message_type: Option<String>,
3393}
3394
3395impl common::Part for Message {}
3396
3397/// There is no detailed description.
3398///
3399/// This type is not used in any activity, and only used as *part* of another schema.
3400///
3401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3402#[serde_with::serde_as]
3403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3404pub struct ModifyLinkedOfferObjects {
3405    /// The linked offer object ids to add to the object.
3406    #[serde(rename = "addLinkedOfferObjectIds")]
3407    pub add_linked_offer_object_ids: Option<Vec<String>>,
3408    /// The linked offer object ids to remove from the object.
3409    #[serde(rename = "removeLinkedOfferObjectIds")]
3410    pub remove_linked_offer_object_ids: Option<Vec<String>>,
3411}
3412
3413impl common::Part for ModifyLinkedOfferObjects {}
3414
3415/// There is no detailed description.
3416///
3417/// # Activities
3418///
3419/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3420/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3421///
3422/// * [modifylinkedofferobjects eventticketobject](EventticketobjectModifylinkedofferobjectCall) (request)
3423/// * [modifylinkedofferobjects loyaltyobject](LoyaltyobjectModifylinkedofferobjectCall) (request)
3424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3425#[serde_with::serde_as]
3426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3427pub struct ModifyLinkedOfferObjectsRequest {
3428    /// The linked offer object ids to add or remove from the object.
3429    #[serde(rename = "linkedOfferObjectIds")]
3430    pub linked_offer_object_ids: Option<ModifyLinkedOfferObjects>,
3431}
3432
3433impl common::RequestValue for ModifyLinkedOfferObjectsRequest {}
3434
3435/// Constraints that all must be met for the module to be shown.
3436///
3437/// This type is not used in any activity, and only used as *part* of another schema.
3438///
3439#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3440#[serde_with::serde_as]
3441#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3442pub struct ModuleViewConstraints {
3443    /// The period of time that the module will be displayed to users. Can define both a `startTime` and `endTime`. The module is displayed immediately after insertion unless a `startTime` is set. The module is displayed indefinitely if `endTime` is not set.
3444    #[serde(rename = "displayInterval")]
3445    pub display_interval: Option<TimeInterval>,
3446}
3447
3448impl common::Part for ModuleViewConstraints {}
3449
3450/// There is no detailed description.
3451///
3452/// This type is not used in any activity, and only used as *part* of another schema.
3453///
3454#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3455#[serde_with::serde_as]
3456#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3457pub struct Money {
3458    /// The currency code, such as "USD" or "EUR."
3459    #[serde(rename = "currencyCode")]
3460    pub currency_code: Option<String>,
3461    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#money"`.
3462    pub kind: Option<String>,
3463    /// The unit of money amount in micros. For example, $1 USD would be represented as 1000000 micros.
3464    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3465    pub micros: Option<i64>,
3466}
3467
3468impl common::Part for Money {}
3469
3470/// Indicates if the object needs to have notification enabled. We support only one of ExpiryNotification/UpcomingNotification. `expiryNotification` takes precedence over `upcomingNotification`. In other words if `expiryNotification` is set, we ignore the `upcomingNotification` field.
3471///
3472/// This type is not used in any activity, and only used as *part* of another schema.
3473///
3474#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3475#[serde_with::serde_as]
3476#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3477pub struct Notifications {
3478    /// A notification would be triggered at a specific time before the card expires.
3479    #[serde(rename = "expiryNotification")]
3480    pub expiry_notification: Option<ExpiryNotification>,
3481    /// A notification would be triggered at a specific time before the card becomes usable.
3482    #[serde(rename = "upcomingNotification")]
3483    pub upcoming_notification: Option<UpcomingNotification>,
3484}
3485
3486impl common::Part for Notifications {}
3487
3488/// This is a copy of the tech.blob.ObjectId proto, which could not be used directly here due to transitive closure issues with JavaScript support; see http://b/8801763.
3489///
3490/// This type is not used in any activity, and only used as *part* of another schema.
3491///
3492#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3493#[serde_with::serde_as]
3494#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3495pub struct ObjectId {
3496    /// The name of the bucket to which this object belongs.
3497    #[serde(rename = "bucketName")]
3498    pub bucket_name: Option<String>,
3499    /// Generation of the object. Generations are monotonically increasing across writes, allowing them to be be compared to determine which generation is newer. If this is omitted in a request, then you are requesting the live object. See http://go/bigstore-versions
3500    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3501    pub generation: Option<i64>,
3502    /// The name of the object.
3503    #[serde(rename = "objectName")]
3504    pub object_name: Option<String>,
3505}
3506
3507impl common::Part for ObjectId {}
3508
3509/// There is no detailed description.
3510///
3511/// # Activities
3512///
3513/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3514/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3515///
3516/// * [get offerclass](OfferclasGetCall) (response)
3517/// * [insert offerclass](OfferclasInsertCall) (request|response)
3518/// * [patch offerclass](OfferclasPatchCall) (request|response)
3519/// * [update offerclass](OfferclasUpdateCall) (request|response)
3520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3521#[serde_with::serde_as]
3522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3523pub struct OfferClass {
3524    /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
3525    #[serde(rename = "allowMultipleUsersPerObject")]
3526    pub allow_multiple_users_per_object: Option<bool>,
3527    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding object that will be used instead.
3528    #[serde(rename = "appLinkData")]
3529    pub app_link_data: Option<AppLinkData>,
3530    /// Callback options to be used to call the issuer back for every save/delete of an object for this class by the end-user. All objects of this class are eligible for the callback.
3531    #[serde(rename = "callbackOptions")]
3532    pub callback_options: Option<CallbackOptions>,
3533    /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
3534    #[serde(rename = "classTemplateInfo")]
3535    pub class_template_info: Option<ClassTemplateInfo>,
3536    /// Country code used to display the card's country (when the user is not in that country), as well as to display localized content when content is not available in the user's locale.
3537    #[serde(rename = "countryCode")]
3538    pub country_code: Option<String>,
3539    /// The details of the offer.
3540    pub details: Option<String>,
3541    /// Identifies whether this class supports Smart Tap. The `redemptionIssuers` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
3542    #[serde(rename = "enableSmartTap")]
3543    pub enable_smart_tap: Option<bool>,
3544    /// The fine print or terms of the offer, such as "20% off any t-shirt at Adam's Apparel."
3545    #[serde(rename = "finePrint")]
3546    pub fine_print: Option<String>,
3547    /// The help link for the offer, such as `http://myownpersonaldomain.com/help`
3548    #[serde(rename = "helpUri")]
3549    pub help_uri: Option<Uri>,
3550    /// Optional banner image displayed on the front of the card. If none is present, nothing will be displayed. The image will display at 100% width.
3551    #[serde(rename = "heroImage")]
3552    pub hero_image: Option<Image>,
3553    /// The background color for the card. If not set the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used. The format is #rrggbb where rrggbb is a hex RGB triplet, such as `#ffcc00`. You can also use the shorthand version of the RGB triplet which is #rgb, such as `#fc0`.
3554    #[serde(rename = "hexBackgroundColor")]
3555    pub hex_background_color: Option<String>,
3556    /// The URI of your application's home page. Populating the URI in this field results in the exact same behavior as populating an URI in linksModuleData (when an object is rendered, a link to the homepage is shown in what would usually be thought of as the linksModuleData section of the object).
3557    #[serde(rename = "homepageUri")]
3558    pub homepage_uri: Option<Uri>,
3559    /// Required. The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
3560    pub id: Option<String>,
3561    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
3562    #[serde(rename = "imageModulesData")]
3563    pub image_modules_data: Option<Vec<ImageModuleData>>,
3564    /// Deprecated. Use textModulesData instead.
3565    #[serde(rename = "infoModuleData")]
3566    pub info_module_data: Option<InfoModuleData>,
3567    /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
3568    #[serde(rename = "issuerName")]
3569    pub issuer_name: Option<String>,
3570    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#offerClass"`.
3571    pub kind: Option<String>,
3572    /// Links module data. If links module data is also defined on the object, both will be displayed.
3573    #[serde(rename = "linksModuleData")]
3574    pub links_module_data: Option<LinksModuleData>,
3575    /// Translated strings for the details.
3576    #[serde(rename = "localizedDetails")]
3577    pub localized_details: Option<LocalizedString>,
3578    /// Translated strings for the fine_print.
3579    #[serde(rename = "localizedFinePrint")]
3580    pub localized_fine_print: Option<LocalizedString>,
3581    /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
3582    #[serde(rename = "localizedIssuerName")]
3583    pub localized_issuer_name: Option<LocalizedString>,
3584    /// Translated strings for the provider. Recommended maximum length is 12 characters to ensure full string is displayed on smaller screens.
3585    #[serde(rename = "localizedProvider")]
3586    pub localized_provider: Option<LocalizedString>,
3587    /// Translated strings for the short title. Recommended maximum length is 20 characters.
3588    #[serde(rename = "localizedShortTitle")]
3589    pub localized_short_title: Option<LocalizedString>,
3590    /// Translated strings for the title. Recommended maximum length is 60 characters to ensure full string is displayed on smaller screens.
3591    #[serde(rename = "localizedTitle")]
3592    pub localized_title: Option<LocalizedString>,
3593    /// Note: This field is currently not supported to trigger geo notifications.
3594    pub locations: Option<Vec<LatLongPoint>>,
3595    /// Merchant locations. There is a maximum of ten on the class. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
3596    #[serde(rename = "merchantLocations")]
3597    pub merchant_locations: Option<Vec<MerchantLocation>>,
3598    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
3599    pub messages: Option<Vec<Message>>,
3600    /// Identifies whether multiple users and devices will save the same object referencing this class.
3601    #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
3602    pub multiple_devices_and_holders_allowed_status: Option<String>,
3603    /// Whether or not field updates to this class should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If not specified, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
3604    #[serde(rename = "notifyPreference")]
3605    pub notify_preference: Option<String>,
3606    /// Required. The offer provider (either the aggregator name or merchant name). Recommended maximum length is 12 characters to ensure full string is displayed on smaller screens.
3607    pub provider: Option<String>,
3608    /// Required. The redemption channels applicable to this offer.
3609    #[serde(rename = "redemptionChannel")]
3610    pub redemption_channel: Option<String>,
3611    /// Identifies which redemption issuers can redeem the pass over Smart Tap. Redemption issuers are identified by their issuer ID. Redemption issuers must have at least one Smart Tap key configured. The `enableSmartTap` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
3612    #[serde(rename = "redemptionIssuers")]
3613    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3614    pub redemption_issuers: Option<Vec<i64>>,
3615    /// The review comments set by the platform when a class is marked `approved` or `rejected`.
3616    pub review: Option<Review>,
3617    /// Required. The status of the class. This field can be set to `draft` or The status of the class. This field can be set to `draft` or `underReview` using the insert, patch, or update API calls. Once the review state is changed from `draft` it may not be changed back to `draft`. You should keep this field to `draft` when the class is under development. A `draft` class cannot be used to create any object. You should set this field to `underReview` when you believe the class is ready for use. The platform will automatically set this field to `approved` and it can be immediately used to create or migrate objects. When updating an already `approved` class you should keep setting this field to `underReview`.
3618    #[serde(rename = "reviewStatus")]
3619    pub review_status: Option<String>,
3620    /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
3621    #[serde(rename = "securityAnimation")]
3622    pub security_animation: Option<SecurityAnimation>,
3623    /// A shortened version of the title of the offer, such as "20% off," shown to users as a quick reference to the offer contents. Recommended maximum length is 20 characters.
3624    #[serde(rename = "shortTitle")]
3625    pub short_title: Option<String>,
3626    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
3627    #[serde(rename = "textModulesData")]
3628    pub text_modules_data: Option<Vec<TextModuleData>>,
3629    /// Required. The title of the offer, such as "20% off any t-shirt." Recommended maximum length is 60 characters to ensure full string is displayed on smaller screens.
3630    pub title: Option<String>,
3631    /// The title image of the offer. This image is displayed in both the details and list views of the app.
3632    #[serde(rename = "titleImage")]
3633    pub title_image: Option<Image>,
3634    /// Optional value added module data. Maximum of ten on the class. For a pass only ten will be displayed, prioritizing those from the object.
3635    #[serde(rename = "valueAddedModuleData")]
3636    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
3637    /// Deprecated
3638    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3639    pub version: Option<i64>,
3640    /// View Unlock Requirement options for the offer.
3641    #[serde(rename = "viewUnlockRequirement")]
3642    pub view_unlock_requirement: Option<String>,
3643    /// The wide title image of the offer. When provided, this will be used in place of the title image in the top left of the card view.
3644    #[serde(rename = "wideTitleImage")]
3645    pub wide_title_image: Option<Image>,
3646    /// Deprecated.
3647    #[serde(rename = "wordMark")]
3648    pub word_mark: Option<Image>,
3649}
3650
3651impl common::RequestValue for OfferClass {}
3652impl common::ResponseResult for OfferClass {}
3653
3654/// There is no detailed description.
3655///
3656/// # Activities
3657///
3658/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3659/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3660///
3661/// * [addmessage offerclass](OfferclasAddmessageCall) (response)
3662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3663#[serde_with::serde_as]
3664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3665pub struct OfferClassAddMessageResponse {
3666    /// The updated OfferClass resource.
3667    pub resource: Option<OfferClass>,
3668}
3669
3670impl common::ResponseResult for OfferClassAddMessageResponse {}
3671
3672/// There is no detailed description.
3673///
3674/// # Activities
3675///
3676/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3677/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3678///
3679/// * [list offerclass](OfferclasListCall) (response)
3680#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3681#[serde_with::serde_as]
3682#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3683pub struct OfferClassListResponse {
3684    /// Pagination of the response.
3685    pub pagination: Option<Pagination>,
3686    /// Resources corresponding to the list request.
3687    pub resources: Option<Vec<OfferClass>>,
3688}
3689
3690impl common::ResponseResult for OfferClassListResponse {}
3691
3692/// There is no detailed description.
3693///
3694/// # Activities
3695///
3696/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3697/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3698///
3699/// * [get offerobject](OfferobjectGetCall) (response)
3700/// * [insert offerobject](OfferobjectInsertCall) (request|response)
3701/// * [patch offerobject](OfferobjectPatchCall) (request|response)
3702/// * [update offerobject](OfferobjectUpdateCall) (request|response)
3703#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3704#[serde_with::serde_as]
3705#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3706pub struct OfferObject {
3707    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding class only object AppLinkData will be displayed.
3708    #[serde(rename = "appLinkData")]
3709    pub app_link_data: Option<AppLinkData>,
3710    /// The barcode type and value.
3711    pub barcode: Option<Barcode>,
3712    /// Required. The class associated with this object. The class must be of the same type as this object, must already exist, and must be approved. Class IDs should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you.
3713    #[serde(rename = "classId")]
3714    pub class_id: Option<String>,
3715    /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
3716    #[serde(rename = "classReference")]
3717    pub class_reference: Option<OfferClass>,
3718    /// Indicates if notifications should explicitly be suppressed. If this field is set to true, regardless of the `messages` field, expiration notifications to the user will be suppressed. By default, this field is set to false. Currently, this can only be set for offers.
3719    #[serde(rename = "disableExpirationNotification")]
3720    pub disable_expiration_notification: Option<bool>,
3721    /// Information that controls how passes are grouped together.
3722    #[serde(rename = "groupingInfo")]
3723    pub grouping_info: Option<GroupingInfo>,
3724    /// Whether this object is currently linked to a single device. This field is set by the platform when a user saves the object, linking it to their device. Intended for use by select partners. Contact support for additional information.
3725    #[serde(rename = "hasLinkedDevice")]
3726    pub has_linked_device: Option<bool>,
3727    /// Indicates if the object has users. This field is set by the platform.
3728    #[serde(rename = "hasUsers")]
3729    pub has_users: Option<bool>,
3730    /// Optional banner image displayed on the front of the card. If none is present, hero image of the class, if present, will be displayed. If hero image of the class is also not present, nothing will be displayed.
3731    #[serde(rename = "heroImage")]
3732    pub hero_image: Option<Image>,
3733    /// Required. The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you. The unique identifier should only include alphanumeric characters, '.', '_', or '-'.
3734    pub id: Option<String>,
3735    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
3736    #[serde(rename = "imageModulesData")]
3737    pub image_modules_data: Option<Vec<ImageModuleData>>,
3738    /// Deprecated. Use textModulesData instead.
3739    #[serde(rename = "infoModuleData")]
3740    pub info_module_data: Option<InfoModuleData>,
3741    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#offerObject"`.
3742    pub kind: Option<String>,
3743    /// linked_object_ids are a list of other objects such as event ticket, loyalty, offer, generic, giftcard, transit and boarding pass that should be automatically attached to this offer object. If a user had saved this offer, then these linked_object_ids would be automatically pushed to the user's wallet (unless they turned off the setting to receive such linked passes). Make sure that objects present in linked_object_ids are already inserted - if not, calls would fail. Once linked, the linked objects cannot be unlinked. You cannot link objects belonging to another issuer. There is a limit to the number of objects that can be linked to a single object. After the limit is reached, new linked objects in the call will be ignored silently. Object IDs should follow the format issuer ID.identifier where the former is issued by Google and the latter is chosen by you.
3744    #[serde(rename = "linkedObjectIds")]
3745    pub linked_object_ids: Option<Vec<String>>,
3746    /// Links module data. If links module data is also defined on the class, both will be displayed.
3747    #[serde(rename = "linksModuleData")]
3748    pub links_module_data: Option<LinksModuleData>,
3749    /// Note: This field is currently not supported to trigger geo notifications.
3750    pub locations: Option<Vec<LatLongPoint>>,
3751    /// Merchant locations. There is a maximum of ten on the object. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
3752    #[serde(rename = "merchantLocations")]
3753    pub merchant_locations: Option<Vec<MerchantLocation>>,
3754    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
3755    pub messages: Option<Vec<Message>>,
3756    /// Whether or not field updates to this object should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If set to DO_NOT_NOTIFY or NOTIFICATION_SETTINGS_UNSPECIFIED, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
3757    #[serde(rename = "notifyPreference")]
3758    pub notify_preference: Option<String>,
3759    /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
3760    #[serde(rename = "passConstraints")]
3761    pub pass_constraints: Option<PassConstraints>,
3762    /// The rotating barcode type and value.
3763    #[serde(rename = "rotatingBarcode")]
3764    pub rotating_barcode: Option<RotatingBarcode>,
3765    /// Restrictions on the object that needs to be verified before the user tries to save the pass. Note that this restrictions will only be applied during save time. If the restrictions changed after a user saves the pass, the new restrictions will not be applied to an already saved pass.
3766    #[serde(rename = "saveRestrictions")]
3767    pub save_restrictions: Option<SaveRestrictions>,
3768    /// The value that will be transmitted to a Smart Tap certified terminal over NFC for this object. The class level fields `enableSmartTap` and `redemptionIssuers` must also be set up correctly in order for the pass to support Smart Tap. Only ASCII characters are supported.
3769    #[serde(rename = "smartTapRedemptionValue")]
3770    pub smart_tap_redemption_value: Option<String>,
3771    /// Required. The state of the object. This field is used to determine how an object is displayed in the app. For example, an `inactive` object is moved to the "Expired passes" section.
3772    pub state: Option<String>,
3773    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
3774    #[serde(rename = "textModulesData")]
3775    pub text_modules_data: Option<Vec<TextModuleData>>,
3776    /// The time period this object will be `active` and object can be used. An object's state will be changed to `expired` when this time period has passed.
3777    #[serde(rename = "validTimeInterval")]
3778    pub valid_time_interval: Option<TimeInterval>,
3779    /// Optional value added module data. Maximum of ten on the object.
3780    #[serde(rename = "valueAddedModuleData")]
3781    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
3782    /// Deprecated
3783    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3784    pub version: Option<i64>,
3785}
3786
3787impl common::RequestValue for OfferObject {}
3788impl common::ResponseResult for OfferObject {}
3789
3790/// There is no detailed description.
3791///
3792/// # Activities
3793///
3794/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3795/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3796///
3797/// * [addmessage offerobject](OfferobjectAddmessageCall) (response)
3798#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3799#[serde_with::serde_as]
3800#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3801pub struct OfferObjectAddMessageResponse {
3802    /// The updated OfferObject resource.
3803    pub resource: Option<OfferObject>,
3804}
3805
3806impl common::ResponseResult for OfferObjectAddMessageResponse {}
3807
3808/// There is no detailed description.
3809///
3810/// # Activities
3811///
3812/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3813/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3814///
3815/// * [list offerobject](OfferobjectListCall) (response)
3816#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3817#[serde_with::serde_as]
3818#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3819pub struct OfferObjectListResponse {
3820    /// Pagination of the response.
3821    pub pagination: Option<Pagination>,
3822    /// Resources corresponding to the list request.
3823    pub resources: Option<Vec<OfferObject>>,
3824}
3825
3826impl common::ResponseResult for OfferObjectListResponse {}
3827
3828/// There is no detailed description.
3829///
3830/// This type is not used in any activity, and only used as *part* of another schema.
3831///
3832#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3833#[serde_with::serde_as]
3834#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3835pub struct Pagination {
3836    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#pagination"`.
3837    pub kind: Option<String>,
3838    /// Page token to send to fetch the next page.
3839    #[serde(rename = "nextPageToken")]
3840    pub next_page_token: Option<String>,
3841    /// Number of results returned in this page.
3842    #[serde(rename = "resultsPerPage")]
3843    pub results_per_page: Option<i32>,
3844}
3845
3846impl common::Part for Pagination {}
3847
3848/// Container for any constraints that may be placed on passes.
3849///
3850/// This type is not used in any activity, and only used as *part* of another schema.
3851///
3852#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3853#[serde_with::serde_as]
3854#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3855pub struct PassConstraints {
3856    /// The NFC constraints for the pass.
3857    #[serde(rename = "nfcConstraint")]
3858    pub nfc_constraint: Option<Vec<String>>,
3859    /// The screenshot eligibility for the pass.
3860    #[serde(rename = "screenshotEligibility")]
3861    pub screenshot_eligibility: Option<String>,
3862}
3863
3864impl common::Part for PassConstraints {}
3865
3866/// There is no detailed description.
3867///
3868/// # Activities
3869///
3870/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3871/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3872///
3873/// * [get permissions](PermissionGetCall) (none)
3874/// * [update permissions](PermissionUpdateCall) (none)
3875#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3876#[serde_with::serde_as]
3877#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3878pub struct Permission {
3879    /// The email address of the user, group, or service account to which this permission refers to.
3880    #[serde(rename = "emailAddress")]
3881    pub email_address: Option<String>,
3882    /// The role granted by this permission.
3883    pub role: Option<String>,
3884}
3885
3886impl common::Resource for Permission {}
3887
3888/// There is no detailed description.
3889///
3890/// # Activities
3891///
3892/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3893/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3894///
3895/// * [get permissions](PermissionGetCall) (response)
3896/// * [update permissions](PermissionUpdateCall) (request|response)
3897#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3898#[serde_with::serde_as]
3899#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3900pub struct Permissions {
3901    /// ID of the issuer the list of permissions refer to.
3902    #[serde(rename = "issuerId")]
3903    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3904    pub issuer_id: Option<i64>,
3905    /// The complete list of permissions for the issuer account.
3906    pub permissions: Option<Vec<Permission>>,
3907}
3908
3909impl common::RequestValue for Permissions {}
3910impl common::ResponseResult for Permissions {}
3911
3912/// There is no detailed description.
3913///
3914/// This type is not used in any activity, and only used as *part* of another schema.
3915///
3916#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3917#[serde_with::serde_as]
3918#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3919pub struct PurchaseDetails {
3920    /// ID of the account used to purchase the ticket.
3921    #[serde(rename = "accountId")]
3922    pub account_id: Option<String>,
3923    /// The confirmation code for the purchase. This may be the same for multiple different tickets and is used to group tickets together.
3924    #[serde(rename = "confirmationCode")]
3925    pub confirmation_code: Option<String>,
3926    /// The purchase date/time of the ticket. This is an ISO 8601 extended format date/time, with or without an offset. Time may be specified up to nanosecond precision. Offsets may be specified with seconds precision (even though offset seconds is not part of ISO 8601). For example: `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time as the above example). If the event were in New York, this would be the equivalent of Eastern Daylight Time (EDT). Remember that offset varies in regions that observe Daylight Saving Time (or Summer Time), depending on the time of the year. `1985-04-12T19:20:50.52` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985 with no offset information. Without offset information, some rich features may not be available.
3927    #[serde(rename = "purchaseDateTime")]
3928    pub purchase_date_time: Option<String>,
3929    /// Receipt number/identifier for tracking the ticket purchase via the body that sold the ticket.
3930    #[serde(rename = "purchaseReceiptNumber")]
3931    pub purchase_receipt_number: Option<String>,
3932    /// The cost of the ticket.
3933    #[serde(rename = "ticketCost")]
3934    pub ticket_cost: Option<TicketCost>,
3935}
3936
3937impl common::Part for PurchaseDetails {}
3938
3939/// There is no detailed description.
3940///
3941/// This type is not used in any activity, and only used as *part* of another schema.
3942///
3943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3944#[serde_with::serde_as]
3945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3946pub struct ReservationInfo {
3947    /// Confirmation code needed to check into this flight. This is the number that the passenger would enter into a kiosk at the airport to look up the flight and print a boarding pass.
3948    #[serde(rename = "confirmationCode")]
3949    pub confirmation_code: Option<String>,
3950    /// E-ticket number.
3951    #[serde(rename = "eticketNumber")]
3952    pub eticket_number: Option<String>,
3953    /// Frequent flyer membership information.
3954    #[serde(rename = "frequentFlyerInfo")]
3955    pub frequent_flyer_info: Option<FrequentFlyerInfo>,
3956    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#reservationInfo"`.
3957    pub kind: Option<String>,
3958}
3959
3960impl common::Part for ReservationInfo {}
3961
3962/// There is no detailed description.
3963///
3964/// This type is not used in any activity, and only used as *part* of another schema.
3965///
3966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3967#[serde_with::serde_as]
3968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3969pub struct Resources {
3970    /// A list of event ticket classes.
3971    #[serde(rename = "eventTicketClasses")]
3972    pub event_ticket_classes: Option<Vec<EventTicketClass>>,
3973    /// A list of event ticket objects.
3974    #[serde(rename = "eventTicketObjects")]
3975    pub event_ticket_objects: Option<Vec<EventTicketObject>>,
3976    /// A list of flight classes.
3977    #[serde(rename = "flightClasses")]
3978    pub flight_classes: Option<Vec<FlightClass>>,
3979    /// A list of flight objects.
3980    #[serde(rename = "flightObjects")]
3981    pub flight_objects: Option<Vec<FlightObject>>,
3982    /// A list of generic classes.
3983    #[serde(rename = "genericClasses")]
3984    pub generic_classes: Option<Vec<GenericClass>>,
3985    /// A list of generic objects.
3986    #[serde(rename = "genericObjects")]
3987    pub generic_objects: Option<Vec<GenericObject>>,
3988    /// A list of gift card classes.
3989    #[serde(rename = "giftCardClasses")]
3990    pub gift_card_classes: Option<Vec<GiftCardClass>>,
3991    /// A list of gift card objects.
3992    #[serde(rename = "giftCardObjects")]
3993    pub gift_card_objects: Option<Vec<GiftCardObject>>,
3994    /// A list of loyalty classes.
3995    #[serde(rename = "loyaltyClasses")]
3996    pub loyalty_classes: Option<Vec<LoyaltyClass>>,
3997    /// A list of loyalty objects.
3998    #[serde(rename = "loyaltyObjects")]
3999    pub loyalty_objects: Option<Vec<LoyaltyObject>>,
4000    /// A list of offer classes.
4001    #[serde(rename = "offerClasses")]
4002    pub offer_classes: Option<Vec<OfferClass>>,
4003    /// A list of offer objects.
4004    #[serde(rename = "offerObjects")]
4005    pub offer_objects: Option<Vec<OfferObject>>,
4006    /// A list of transit classes.
4007    #[serde(rename = "transitClasses")]
4008    pub transit_classes: Option<Vec<TransitClass>>,
4009    /// A list of transit objects.
4010    #[serde(rename = "transitObjects")]
4011    pub transit_objects: Option<Vec<TransitObject>>,
4012}
4013
4014impl common::Part for Resources {}
4015
4016/// There is no detailed description.
4017///
4018/// This type is not used in any activity, and only used as *part* of another schema.
4019///
4020#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4021#[serde_with::serde_as]
4022#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4023pub struct Review {
4024    /// no description provided
4025    pub comments: Option<String>,
4026}
4027
4028impl common::Part for Review {}
4029
4030/// There is no detailed description.
4031///
4032/// This type is not used in any activity, and only used as *part* of another schema.
4033///
4034#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4035#[serde_with::serde_as]
4036#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4037pub struct RotatingBarcode {
4038    /// An optional text that will override the default text that shows under the barcode. This field is intended for a human readable equivalent of the barcode value, used when the barcode cannot be scanned.
4039    #[serde(rename = "alternateText")]
4040    pub alternate_text: Option<String>,
4041    /// Input only. NOTE: This feature is only available for the transit vertical. Optional set of initial rotating barcode values. This allows a small subset of barcodes to be included with the object. Further rotating barcode values must be uploaded with the UploadRotatingBarcodeValues endpoint.
4042    #[serde(rename = "initialRotatingBarcodeValues")]
4043    pub initial_rotating_barcode_values: Option<RotatingBarcodeValues>,
4044    /// The render encoding for the barcode. When specified, barcode is rendered in the given encoding. Otherwise best known encoding is chosen by Google.
4045    #[serde(rename = "renderEncoding")]
4046    pub render_encoding: Option<String>,
4047    /// Optional text that will be shown when the barcode is hidden behind a click action. This happens in cases where a pass has Smart Tap enabled. If not specified, a default is chosen by Google.
4048    #[serde(rename = "showCodeText")]
4049    pub show_code_text: Option<LocalizedString>,
4050    /// Details used to evaluate the {totp_value_n} substitutions.
4051    #[serde(rename = "totpDetails")]
4052    pub totp_details: Option<RotatingBarcodeTotpDetails>,
4053    /// The type of this barcode.
4054    #[serde(rename = "type")]
4055    pub type_: Option<String>,
4056    /// String encoded barcode value. This string supports the following substitutions: * {totp_value_n}: Replaced with the TOTP value (see TotpDetails.parameters). * {totp_timestamp_millis}: Replaced with the timestamp (millis since epoch) at which the barcode was generated. * {totp_timestamp_seconds}: Replaced with the timestamp (seconds since epoch) at which the barcode was generated.
4057    #[serde(rename = "valuePattern")]
4058    pub value_pattern: Option<String>,
4059}
4060
4061impl common::Part for RotatingBarcode {}
4062
4063/// Configuration for the time-based OTP substitutions. See https://tools.ietf.org/html/rfc6238
4064///
4065/// This type is not used in any activity, and only used as *part* of another schema.
4066///
4067#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4068#[serde_with::serde_as]
4069#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4070pub struct RotatingBarcodeTotpDetails {
4071    /// The TOTP algorithm used to generate the OTP.
4072    pub algorithm: Option<String>,
4073    /// The TOTP parameters for each of the {totp_value_*} substitutions. The TotpParameters at index n is used for the {totp_value_n} substitution.
4074    pub parameters: Option<Vec<RotatingBarcodeTotpDetailsTotpParameters>>,
4075    /// The time interval used for the TOTP value generation, in milliseconds.
4076    #[serde(rename = "periodMillis")]
4077    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4078    pub period_millis: Option<i64>,
4079}
4080
4081impl common::Part for RotatingBarcodeTotpDetails {}
4082
4083/// Configuration for the key and value length. See https://www.rfc-editor.org/rfc/rfc4226#section-5.3
4084///
4085/// This type is not used in any activity, and only used as *part* of another schema.
4086///
4087#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4088#[serde_with::serde_as]
4089#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4090pub struct RotatingBarcodeTotpDetailsTotpParameters {
4091    /// The secret key used for the TOTP value generation, encoded as a Base16 string.
4092    pub key: Option<String>,
4093    /// The length of the TOTP value in decimal digits.
4094    #[serde(rename = "valueLength")]
4095    pub value_length: Option<i32>,
4096}
4097
4098impl common::Part for RotatingBarcodeTotpDetailsTotpParameters {}
4099
4100/// A payload containing many barcode values and start date/time.
4101///
4102/// This type is not used in any activity, and only used as *part* of another schema.
4103///
4104#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4105#[serde_with::serde_as]
4106#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4107pub struct RotatingBarcodeValues {
4108    /// Required. The amount of time each barcode is valid for.
4109    #[serde(rename = "periodMillis")]
4110    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4111    pub period_millis: Option<i64>,
4112    /// Required. The date/time the first barcode is valid from. Barcodes will be rotated through using period_millis defined on the object's RotatingBarcodeValueInfo. This is an ISO 8601 extended format date/time, with an offset. Time may be specified up to nanosecond precision. Offsets may be specified with seconds precision (even though offset seconds is not part of ISO 8601). For example: `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time as the above example). If the event were in New York, this would be the equivalent of Eastern Daylight Time (EDT). Remember that offset varies in regions that observe Daylight Saving Time (or Summer Time), depending on the time of the year.
4113    #[serde(rename = "startDateTime")]
4114    pub start_date_time: Option<String>,
4115    /// Required. The values to encode in the barcode. At least one value is required.
4116    pub values: Option<Vec<String>>,
4117}
4118
4119impl common::Part for RotatingBarcodeValues {}
4120
4121/// Defines restrictions on the object that will be verified during save. Note: this is an advanced feature, please contact Google for implementation support.
4122///
4123/// This type is not used in any activity, and only used as *part* of another schema.
4124///
4125#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4126#[serde_with::serde_as]
4127#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4128pub struct SaveRestrictions {
4129    /// Restrict the save of the referencing object to the given email address only. This is the hex output of SHA256 sum of the email address, all lowercase and without any notations like "." or "+", except "@". For example, for example@example.com, this value will be 31c5543c1734d25c7206f5fd591525d0295bec6fe84ff82f946a34fe970a1e66 and for Example@example.com, this value will be bc34f262c93ad7122763684ccea6f07fb7f5d8a2d11e60ce15a6f43fe70ce632 If email address of the logged-in user who tries to save this pass does not match with the defined value here, users won't be allowed to save this pass. They will instead be prompted with an error to contact the issuer. This information should be gathered from the user with an explicit consent via Sign in with Google integration https://developers.google.com/identity/authentication. Please contact with support before using Save Restrictions.
4130    #[serde(rename = "restrictToEmailSha256")]
4131    pub restrict_to_email_sha256: Option<String>,
4132}
4133
4134impl common::Part for SaveRestrictions {}
4135
4136/// There is no detailed description.
4137///
4138/// This type is not used in any activity, and only used as *part* of another schema.
4139///
4140#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4141#[serde_with::serde_as]
4142#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4143pub struct SecurityAnimation {
4144    /// Type of animation.
4145    #[serde(rename = "animationType")]
4146    pub animation_type: Option<String>,
4147}
4148
4149impl common::Part for SecurityAnimation {}
4150
4151/// Request to send a private pass update notice information to Google, so that devices can then fetch the notice prompting the user to update a pass.
4152///
4153/// # Activities
4154///
4155/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4156/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4157///
4158/// * [v1 private content set pass update notice walletobjects](WalletobjectV1PrivateContentSetPassUpdateNoticeCall) (request)
4159#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4160#[serde_with::serde_as]
4161#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4162pub struct SetPassUpdateNoticeRequest {
4163    /// Required. A fully qualified identifier of the pass that the issuer wants to notify the pass holder(s) about. Formatted as .
4164    #[serde(rename = "externalPassId")]
4165    pub external_pass_id: Option<String>,
4166    /// Required. The issuer endpoint URI the pass holder needs to follow in order to receive an updated pass JWT. It can not contain any sensitive information. The endpoint needs to authenticate the user before giving the user the updated JWT. Example update URI https://someissuer.com/update/passId=someExternalPassId
4167    #[serde(rename = "updateUri")]
4168    pub update_uri: Option<String>,
4169    /// Required. The JWT signature of the updated pass that the issuer wants to notify Google about. Only devices that report a different JWT signature than this JWT signature will receive the update notification.
4170    #[serde(rename = "updatedPassJwtSignature")]
4171    pub updated_pass_jwt_signature: Option<String>,
4172}
4173
4174impl common::RequestValue for SetPassUpdateNoticeRequest {}
4175
4176/// A response to a request to notify Google of an awaiting update to a private pass.
4177///
4178/// # Activities
4179///
4180/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4181/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4182///
4183/// * [v1 private content set pass update notice walletobjects](WalletobjectV1PrivateContentSetPassUpdateNoticeCall) (response)
4184#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4185#[serde_with::serde_as]
4186#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4187pub struct SetPassUpdateNoticeResponse {
4188    _never_set: Option<bool>,
4189}
4190
4191impl common::ResponseResult for SetPassUpdateNoticeResponse {}
4192
4193/// There is no detailed description.
4194///
4195/// This type is not used in any activity, and only used as *part* of another schema.
4196///
4197#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4198#[serde_with::serde_as]
4199#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4200pub struct SignUpInfo {
4201    /// ID of the class the user can sign up for.
4202    #[serde(rename = "classId")]
4203    pub class_id: Option<String>,
4204}
4205
4206impl common::Part for SignUpInfo {}
4207
4208/// There is no detailed description.
4209///
4210/// # Activities
4211///
4212/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4213/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4214///
4215/// * [insert smarttap](SmarttapInsertCall) (request|response)
4216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4217#[serde_with::serde_as]
4218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4219pub struct SmartTap {
4220    /// The unique identifier for a smart tap. This value should follow the format issuer ID.identifier where the former is issued by Google and latter is the Smart Tap id. The Smart Tap id is a Base64 encoded string which represents the id which was generated by the Google Pay app.
4221    pub id: Option<String>,
4222    /// Communication from merchant to user.
4223    pub infos: Option<Vec<IssuerToUserInfo>>,
4224    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#smartTap"`.
4225    pub kind: Option<String>,
4226    /// Smart Tap merchant ID of who engaged in the Smart Tap interaction.
4227    #[serde(rename = "merchantId")]
4228    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4229    pub merchant_id: Option<i64>,
4230}
4231
4232impl common::RequestValue for SmartTap {}
4233impl common::ResponseResult for SmartTap {}
4234
4235/// There is no detailed description.
4236///
4237/// This type is not used in any activity, and only used as *part* of another schema.
4238///
4239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4240#[serde_with::serde_as]
4241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4242pub struct SmartTapMerchantData {
4243    /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
4244    #[serde(rename = "authenticationKeys")]
4245    pub authentication_keys: Option<Vec<AuthenticationKey>>,
4246    /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
4247    #[serde(rename = "smartTapMerchantId")]
4248    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4249    pub smart_tap_merchant_id: Option<i64>,
4250}
4251
4252impl common::Part for SmartTapMerchantData {}
4253
4254/// There is no detailed description.
4255///
4256/// This type is not used in any activity, and only used as *part* of another schema.
4257///
4258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4259#[serde_with::serde_as]
4260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4261pub struct TemplateItem {
4262    /// A reference to a field to display. If both `firstValue` and `secondValue` are populated, they will both appear as one item with a slash between them. For example, values A and B would be shown as "A / B".
4263    #[serde(rename = "firstValue")]
4264    pub first_value: Option<FieldSelector>,
4265    /// A predefined item to display. Only one of `firstValue` or `predefinedItem` may be set.
4266    #[serde(rename = "predefinedItem")]
4267    pub predefined_item: Option<String>,
4268    /// A reference to a field to display. This may only be populated if the `firstValue` field is populated.
4269    #[serde(rename = "secondValue")]
4270    pub second_value: Option<FieldSelector>,
4271}
4272
4273impl common::Part for TemplateItem {}
4274
4275/// Data for Text module. All fields are optional. Header will be displayed if available, different types of bodies will be concatenated if they are defined.
4276///
4277/// This type is not used in any activity, and only used as *part* of another schema.
4278///
4279#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4280#[serde_with::serde_as]
4281#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4282pub struct TextModuleData {
4283    /// The body of the Text Module, which is defined as an uninterrupted string. Recommended maximum length is 500 characters to ensure full string is displayed on smaller screens.
4284    pub body: Option<String>,
4285    /// The header of the Text Module. Recommended maximum length is 35 characters to ensure full string is displayed on smaller screens.
4286    pub header: Option<String>,
4287    /// The ID associated with a text module. This field is here to enable ease of management of text modules and referencing them in template overrides. The ID should only include alphanumeric characters, '_', or '-'. It can not include dots, as dots are used to separate fields within FieldReference.fieldPaths in template overrides.
4288    pub id: Option<String>,
4289    /// Translated strings for the body. Recommended maximum length is 500 characters to ensure full string is displayed on smaller screens.
4290    #[serde(rename = "localizedBody")]
4291    pub localized_body: Option<LocalizedString>,
4292    /// Translated strings for the header. Recommended maximum length is 35 characters to ensure full string is displayed on smaller screens.
4293    #[serde(rename = "localizedHeader")]
4294    pub localized_header: Option<LocalizedString>,
4295}
4296
4297impl common::Part for TextModuleData {}
4298
4299/// There is no detailed description.
4300///
4301/// This type is not used in any activity, and only used as *part* of another schema.
4302///
4303#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4304#[serde_with::serde_as]
4305#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4306pub struct TicketCost {
4307    /// A message describing any kind of discount that was applied.
4308    #[serde(rename = "discountMessage")]
4309    pub discount_message: Option<LocalizedString>,
4310    /// The face value of the ticket.
4311    #[serde(rename = "faceValue")]
4312    pub face_value: Option<Money>,
4313    /// The actual purchase price of the ticket, after tax and/or discounts.
4314    #[serde(rename = "purchasePrice")]
4315    pub purchase_price: Option<Money>,
4316}
4317
4318impl common::Part for TicketCost {}
4319
4320/// There is no detailed description.
4321///
4322/// This type is not used in any activity, and only used as *part* of another schema.
4323///
4324#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4325#[serde_with::serde_as]
4326#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4327pub struct TicketLeg {
4328    /// The date/time of arrival. This is an ISO 8601 extended format date/time, with or without an offset. Time may be specified up to nanosecond precision. Offsets may be specified with seconds precision (even though offset seconds is not part of ISO 8601). For example: `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time as the above example). If the event were in New York, this would be the equivalent of Eastern Daylight Time (EDT). Remember that offset varies in regions that observe Daylight Saving Time (or Summer Time), depending on the time of the year. `1985-04-12T19:20:50.52` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985 with no offset information. The portion of the date/time without the offset is considered the "local date/time". This should be the local date/time at the destination station. For example, if the event occurs at the 20th hour of June 5th, 2018 at the destination station, the local date/time portion should be `2018-06-05T20:00:00`. If the local date/time at the destination station is 4 hours before UTC, an offset of `-04:00` may be appended. Without offset information, some rich features may not be available.
4329    #[serde(rename = "arrivalDateTime")]
4330    pub arrival_date_time: Option<String>,
4331    /// The train or ship name/number that the passsenger needs to board.
4332    pub carriage: Option<String>,
4333    /// The date/time of departure. This is required if there is no validity time interval set on the transit object. This is an ISO 8601 extended format date/time, with or without an offset. Time may be specified up to nanosecond precision. Offsets may be specified with seconds precision (even though offset seconds is not part of ISO 8601). For example: `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time as the above example). If the event were in New York, this would be the equivalent of Eastern Daylight Time (EDT). Remember that offset varies in regions that observe Daylight Saving Time (or Summer Time), depending on the time of the year. `1985-04-12T19:20:50.52` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985 with no offset information. The portion of the date/time without the offset is considered the "local date/time". This should be the local date/time at the origin station. For example, if the departure occurs at the 20th hour of June 5th, 2018 at the origin station, the local date/time portion should be `2018-06-05T20:00:00`. If the local date/time at the origin station is 4 hours before UTC, an offset of `-04:00` may be appended. Without offset information, some rich features may not be available.
4334    #[serde(rename = "departureDateTime")]
4335    pub departure_date_time: Option<String>,
4336    /// The destination name.
4337    #[serde(rename = "destinationName")]
4338    pub destination_name: Option<LocalizedString>,
4339    /// The destination station code.
4340    #[serde(rename = "destinationStationCode")]
4341    pub destination_station_code: Option<String>,
4342    /// Short description/name of the fare for this leg of travel. Eg "Anytime Single Use".
4343    #[serde(rename = "fareName")]
4344    pub fare_name: Option<LocalizedString>,
4345    /// The name of the origin station. This is required if `desinationName` is present or if `originStationCode` is not present.
4346    #[serde(rename = "originName")]
4347    pub origin_name: Option<LocalizedString>,
4348    /// The origin station code. This is required if `destinationStationCode` is present or if `originName` is not present.
4349    #[serde(rename = "originStationCode")]
4350    pub origin_station_code: Option<String>,
4351    /// The platform or gate where the passenger can board the carriage.
4352    pub platform: Option<String>,
4353    /// The reserved seat for the passenger(s). If more than one seat is to be specified then use the `ticketSeats` field instead. Both `ticketSeat` and `ticketSeats` may not be set.
4354    #[serde(rename = "ticketSeat")]
4355    pub ticket_seat: Option<TicketSeat>,
4356    /// The reserved seat for the passenger(s). If only one seat is to be specified then use the `ticketSeat` field instead. Both `ticketSeat` and `ticketSeats` may not be set.
4357    #[serde(rename = "ticketSeats")]
4358    pub ticket_seats: Option<Vec<TicketSeat>>,
4359    /// The name of the transit operator that is operating this leg of a trip.
4360    #[serde(rename = "transitOperatorName")]
4361    pub transit_operator_name: Option<LocalizedString>,
4362    /// Terminus station or destination of the train/bus/etc.
4363    #[serde(rename = "transitTerminusName")]
4364    pub transit_terminus_name: Option<LocalizedString>,
4365    /// The zone of boarding within the platform.
4366    pub zone: Option<String>,
4367}
4368
4369impl common::Part for TicketLeg {}
4370
4371/// There is no detailed description.
4372///
4373/// This type is not used in any activity, and only used as *part* of another schema.
4374///
4375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4376#[serde_with::serde_as]
4377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4378pub struct TicketRestrictions {
4379    /// Extra restrictions that don't fall under the "route" or "time" categories.
4380    #[serde(rename = "otherRestrictions")]
4381    pub other_restrictions: Option<LocalizedString>,
4382    /// Restrictions about routes that may be taken. For example, this may be the string "Reserved CrossCountry trains only".
4383    #[serde(rename = "routeRestrictions")]
4384    pub route_restrictions: Option<LocalizedString>,
4385    /// More details about the above `routeRestrictions`.
4386    #[serde(rename = "routeRestrictionsDetails")]
4387    pub route_restrictions_details: Option<LocalizedString>,
4388    /// Restrictions about times this ticket may be used.
4389    #[serde(rename = "timeRestrictions")]
4390    pub time_restrictions: Option<LocalizedString>,
4391}
4392
4393impl common::Part for TicketRestrictions {}
4394
4395/// There is no detailed description.
4396///
4397/// This type is not used in any activity, and only used as *part* of another schema.
4398///
4399#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4400#[serde_with::serde_as]
4401#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4402pub struct TicketSeat {
4403    /// The identifier of the train car or coach in which the ticketed seat is located. Eg. "10"
4404    pub coach: Option<String>,
4405    /// A custome fare class to be used if no `fareClass` applies. Both `fareClass` and `customFareClass` may not be set.
4406    #[serde(rename = "customFareClass")]
4407    pub custom_fare_class: Option<LocalizedString>,
4408    /// The fare class of the ticketed seat.
4409    #[serde(rename = "fareClass")]
4410    pub fare_class: Option<String>,
4411    /// The identifier of where the ticketed seat is located. Eg. "42". If there is no specific identifier, use `seatAssigment` instead.
4412    pub seat: Option<String>,
4413    /// The passenger's seat assignment. Eg. "no specific seat". To be used when there is no specific identifier to use in `seat`.
4414    #[serde(rename = "seatAssignment")]
4415    pub seat_assignment: Option<LocalizedString>,
4416}
4417
4418impl common::Part for TicketSeat {}
4419
4420/// There is no detailed description.
4421///
4422/// This type is not used in any activity, and only used as *part* of another schema.
4423///
4424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4425#[serde_with::serde_as]
4426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4427pub struct TimeInterval {
4428    /// End time of the interval. Offset is not required. If an offset is provided and `start` time is set, `start` must also include an offset.
4429    pub end: Option<DateTime>,
4430    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#timeInterval"`.
4431    pub kind: Option<String>,
4432    /// Start time of the interval. Offset is not required. If an offset is provided and `end` time is set, `end` must also include an offset.
4433    pub start: Option<DateTime>,
4434}
4435
4436impl common::Part for TimeInterval {}
4437
4438/// There is no detailed description.
4439///
4440/// # Activities
4441///
4442/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4443/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4444///
4445/// * [get transitclass](TransitclasGetCall) (response)
4446/// * [insert transitclass](TransitclasInsertCall) (request|response)
4447/// * [patch transitclass](TransitclasPatchCall) (request|response)
4448/// * [update transitclass](TransitclasUpdateCall) (request|response)
4449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4450#[serde_with::serde_as]
4451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4452pub struct TransitClass {
4453    /// Activation options for an activatable ticket.
4454    #[serde(rename = "activationOptions")]
4455    pub activation_options: Option<ActivationOptions>,
4456    /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
4457    #[serde(rename = "allowMultipleUsersPerObject")]
4458    pub allow_multiple_users_per_object: Option<bool>,
4459    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding object that will be used instead.
4460    #[serde(rename = "appLinkData")]
4461    pub app_link_data: Option<AppLinkData>,
4462    /// Callback options to be used to call the issuer back for every save/delete of an object for this class by the end-user. All objects of this class are eligible for the callback.
4463    #[serde(rename = "callbackOptions")]
4464    pub callback_options: Option<CallbackOptions>,
4465    /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
4466    #[serde(rename = "classTemplateInfo")]
4467    pub class_template_info: Option<ClassTemplateInfo>,
4468    /// Country code used to display the card's country (when the user is not in that country), as well as to display localized content when content is not available in the user's locale.
4469    #[serde(rename = "countryCode")]
4470    pub country_code: Option<String>,
4471    /// A custom label to use for the carriage value (`transitObject.ticketLeg.carriage`).
4472    #[serde(rename = "customCarriageLabel")]
4473    pub custom_carriage_label: Option<LocalizedString>,
4474    /// A custom label to use for the coach value (`transitObject.ticketLeg.ticketSeat.coach`).
4475    #[serde(rename = "customCoachLabel")]
4476    pub custom_coach_label: Option<LocalizedString>,
4477    /// A custom label to use for the transit concession category value (`transitObject.concessionCategory`).
4478    #[serde(rename = "customConcessionCategoryLabel")]
4479    pub custom_concession_category_label: Option<LocalizedString>,
4480    /// A custom label to use for the confirmation code value (`transitObject.purchaseDetails.confirmationCode`).
4481    #[serde(rename = "customConfirmationCodeLabel")]
4482    pub custom_confirmation_code_label: Option<LocalizedString>,
4483    /// A custom label to use for the transit discount message value (`transitObject.purchaseDetails.ticketCost.discountMessage`).
4484    #[serde(rename = "customDiscountMessageLabel")]
4485    pub custom_discount_message_label: Option<LocalizedString>,
4486    /// A custom label to use for the fare class value (`transitObject.ticketLeg.ticketSeat.fareClass`).
4487    #[serde(rename = "customFareClassLabel")]
4488    pub custom_fare_class_label: Option<LocalizedString>,
4489    /// A custom label to use for the transit fare name value (`transitObject.ticketLeg.fareName`).
4490    #[serde(rename = "customFareNameLabel")]
4491    pub custom_fare_name_label: Option<LocalizedString>,
4492    /// A custom label to use for the other restrictions value (`transitObject.ticketRestrictions.otherRestrictions`).
4493    #[serde(rename = "customOtherRestrictionsLabel")]
4494    pub custom_other_restrictions_label: Option<LocalizedString>,
4495    /// A custom label to use for the boarding platform value (`transitObject.ticketLeg.platform`).
4496    #[serde(rename = "customPlatformLabel")]
4497    pub custom_platform_label: Option<LocalizedString>,
4498    /// A custom label to use for the purchase face value (`transitObject.purchaseDetails.ticketCost.faceValue`).
4499    #[serde(rename = "customPurchaseFaceValueLabel")]
4500    pub custom_purchase_face_value_label: Option<LocalizedString>,
4501    /// A custom label to use for the purchase price value (`transitObject.purchaseDetails.ticketCost.purchasePrice`).
4502    #[serde(rename = "customPurchasePriceLabel")]
4503    pub custom_purchase_price_label: Option<LocalizedString>,
4504    /// A custom label to use for the purchase receipt number value (`transitObject.purchaseDetails.purchaseReceiptNumber`).
4505    #[serde(rename = "customPurchaseReceiptNumberLabel")]
4506    pub custom_purchase_receipt_number_label: Option<LocalizedString>,
4507    /// A custom label to use for the route restrictions details value (`transitObject.ticketRestrictions.routeRestrictionsDetails`).
4508    #[serde(rename = "customRouteRestrictionsDetailsLabel")]
4509    pub custom_route_restrictions_details_label: Option<LocalizedString>,
4510    /// A custom label to use for the route restrictions value (`transitObject.ticketRestrictions.routeRestrictions`).
4511    #[serde(rename = "customRouteRestrictionsLabel")]
4512    pub custom_route_restrictions_label: Option<LocalizedString>,
4513    /// A custom label to use for the seat location value (`transitObject.ticketLeg.ticketSeat.seat`).
4514    #[serde(rename = "customSeatLabel")]
4515    pub custom_seat_label: Option<LocalizedString>,
4516    /// A custom label to use for the ticket number value (`transitObject.ticketNumber`).
4517    #[serde(rename = "customTicketNumberLabel")]
4518    pub custom_ticket_number_label: Option<LocalizedString>,
4519    /// A custom label to use for the time restrictions details value (`transitObject.ticketRestrictions.timeRestrictions`).
4520    #[serde(rename = "customTimeRestrictionsLabel")]
4521    pub custom_time_restrictions_label: Option<LocalizedString>,
4522    /// A custom label to use for the transit terminus name value (`transitObject.ticketLeg.transitTerminusName`).
4523    #[serde(rename = "customTransitTerminusNameLabel")]
4524    pub custom_transit_terminus_name_label: Option<LocalizedString>,
4525    /// A custom label to use for the boarding zone value (`transitObject.ticketLeg.zone`).
4526    #[serde(rename = "customZoneLabel")]
4527    pub custom_zone_label: Option<LocalizedString>,
4528    /// Controls the display of the single-leg itinerary for this class. By default, an itinerary will only display for multi-leg trips.
4529    #[serde(rename = "enableSingleLegItinerary")]
4530    pub enable_single_leg_itinerary: Option<bool>,
4531    /// Identifies whether this class supports Smart Tap. The `redemptionIssuers` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
4532    #[serde(rename = "enableSmartTap")]
4533    pub enable_smart_tap: Option<bool>,
4534    /// Optional banner image displayed on the front of the card. If none is present, nothing will be displayed. The image will display at 100% width.
4535    #[serde(rename = "heroImage")]
4536    pub hero_image: Option<Image>,
4537    /// The background color for the card. If not set the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used. The format is #rrggbb where rrggbb is a hex RGB triplet, such as `#ffcc00`. You can also use the shorthand version of the RGB triplet which is #rgb, such as `#fc0`.
4538    #[serde(rename = "hexBackgroundColor")]
4539    pub hex_background_color: Option<String>,
4540    /// The URI of your application's home page. Populating the URI in this field results in the exact same behavior as populating an URI in linksModuleData (when an object is rendered, a link to the homepage is shown in what would usually be thought of as the linksModuleData section of the object).
4541    #[serde(rename = "homepageUri")]
4542    pub homepage_uri: Option<Uri>,
4543    /// Required. The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
4544    pub id: Option<String>,
4545    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
4546    #[serde(rename = "imageModulesData")]
4547    pub image_modules_data: Option<Vec<ImageModuleData>>,
4548    /// Deprecated. Use textModulesData instead.
4549    #[serde(rename = "infoModuleData")]
4550    pub info_module_data: Option<InfoModuleData>,
4551    /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
4552    #[serde(rename = "issuerName")]
4553    pub issuer_name: Option<String>,
4554    /// If this field is present, transit tickets served to a user's device will always be in this language. Represents the BCP 47 language tag. Example values are "en-US", "en-GB", "de", or "de-AT".
4555    #[serde(rename = "languageOverride")]
4556    pub language_override: Option<String>,
4557    /// Links module data. If links module data is also defined on the object, both will be displayed.
4558    #[serde(rename = "linksModuleData")]
4559    pub links_module_data: Option<LinksModuleData>,
4560    /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
4561    #[serde(rename = "localizedIssuerName")]
4562    pub localized_issuer_name: Option<LocalizedString>,
4563    /// Note: This field is currently not supported to trigger geo notifications.
4564    pub locations: Option<Vec<LatLongPoint>>,
4565    /// Required. The logo image of the ticket. This image is displayed in the card detail view of the app.
4566    pub logo: Option<Image>,
4567    /// Merchant locations. There is a maximum of ten on the class. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
4568    #[serde(rename = "merchantLocations")]
4569    pub merchant_locations: Option<Vec<MerchantLocation>>,
4570    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
4571    pub messages: Option<Vec<Message>>,
4572    /// Identifies whether multiple users and devices will save the same object referencing this class.
4573    #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
4574    pub multiple_devices_and_holders_allowed_status: Option<String>,
4575    /// Whether or not field updates to this class should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If set to DO_NOT_NOTIFY or NOTIFICATION_SETTINGS_UNSPECIFIED, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
4576    #[serde(rename = "notifyPreference")]
4577    pub notify_preference: Option<String>,
4578    /// Identifies which redemption issuers can redeem the pass over Smart Tap. Redemption issuers are identified by their issuer ID. Redemption issuers must have at least one Smart Tap key configured. The `enableSmartTap` and object level `smartTapRedemptionLevel` fields must also be set up correctly in order for a pass to support Smart Tap.
4579    #[serde(rename = "redemptionIssuers")]
4580    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4581    pub redemption_issuers: Option<Vec<i64>>,
4582    /// The review comments set by the platform when a class is marked `approved` or `rejected`.
4583    pub review: Option<Review>,
4584    /// Required. The status of the class. This field can be set to `draft` or `underReview` using the insert, patch, or update API calls. Once the review state is changed from `draft` it may not be changed back to `draft`. You should keep this field to `draft` when the class is under development. A `draft` class cannot be used to create any object. You should set this field to `underReview` when you believe the class is ready for use. The platform will automatically set this field to `approved` and it can be immediately used to create or migrate objects. When updating an already `approved` class you should keep setting this field to `underReview`.
4585    #[serde(rename = "reviewStatus")]
4586    pub review_status: Option<String>,
4587    /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
4588    #[serde(rename = "securityAnimation")]
4589    pub security_animation: Option<SecurityAnimation>,
4590    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
4591    #[serde(rename = "textModulesData")]
4592    pub text_modules_data: Option<Vec<TextModuleData>>,
4593    /// The name of the transit operator.
4594    #[serde(rename = "transitOperatorName")]
4595    pub transit_operator_name: Option<LocalizedString>,
4596    /// Required. The type of transit this class represents, such as "bus".
4597    #[serde(rename = "transitType")]
4598    pub transit_type: Option<String>,
4599    /// Optional value added module data. Maximum of ten on the class. For a pass only ten will be displayed, prioritizing those from the object.
4600    #[serde(rename = "valueAddedModuleData")]
4601    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
4602    /// Deprecated
4603    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4604    pub version: Option<i64>,
4605    /// View Unlock Requirement options for the transit ticket.
4606    #[serde(rename = "viewUnlockRequirement")]
4607    pub view_unlock_requirement: Option<String>,
4608    /// Watermark image to display on the user's device.
4609    pub watermark: Option<Image>,
4610    /// The wide logo of the ticket. When provided, this will be used in place of the logo in the top left of the card view.
4611    #[serde(rename = "wideLogo")]
4612    pub wide_logo: Option<Image>,
4613    /// Deprecated.
4614    #[serde(rename = "wordMark")]
4615    pub word_mark: Option<Image>,
4616}
4617
4618impl common::RequestValue for TransitClass {}
4619impl common::ResponseResult for TransitClass {}
4620
4621/// There is no detailed description.
4622///
4623/// # Activities
4624///
4625/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4626/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4627///
4628/// * [addmessage transitclass](TransitclasAddmessageCall) (response)
4629#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4630#[serde_with::serde_as]
4631#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4632pub struct TransitClassAddMessageResponse {
4633    /// The updated TransitClass resource.
4634    pub resource: Option<TransitClass>,
4635}
4636
4637impl common::ResponseResult for TransitClassAddMessageResponse {}
4638
4639/// There is no detailed description.
4640///
4641/// # Activities
4642///
4643/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4644/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4645///
4646/// * [list transitclass](TransitclasListCall) (response)
4647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4648#[serde_with::serde_as]
4649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4650pub struct TransitClassListResponse {
4651    /// Pagination of the response.
4652    pub pagination: Option<Pagination>,
4653    /// Resources corresponding to the list request.
4654    pub resources: Option<Vec<TransitClass>>,
4655}
4656
4657impl common::ResponseResult for TransitClassListResponse {}
4658
4659/// There is no detailed description.
4660///
4661/// # Activities
4662///
4663/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4664/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4665///
4666/// * [get transitobject](TransitobjectGetCall) (response)
4667/// * [insert transitobject](TransitobjectInsertCall) (request|response)
4668/// * [patch transitobject](TransitobjectPatchCall) (request|response)
4669/// * [update transitobject](TransitobjectUpdateCall) (request|response)
4670#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4671#[serde_with::serde_as]
4672#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4673pub struct TransitObject {
4674    /// The activation status for the object. Required if the class has `activationOptions` set.
4675    #[serde(rename = "activationStatus")]
4676    pub activation_status: Option<ActivationStatus>,
4677    /// Optional app or website link that will be displayed as a button on the front of the pass. If AppLinkData is provided for the corresponding class only object AppLinkData will be displayed.
4678    #[serde(rename = "appLinkData")]
4679    pub app_link_data: Option<AppLinkData>,
4680    /// The barcode type and value.
4681    pub barcode: Option<Barcode>,
4682    /// Required. The class associated with this object. The class must be of the same type as this object, must already exist, and must be approved. Class IDs should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you.
4683    #[serde(rename = "classId")]
4684    pub class_id: Option<String>,
4685    /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
4686    #[serde(rename = "classReference")]
4687    pub class_reference: Option<TransitClass>,
4688    /// The concession category for the ticket.
4689    #[serde(rename = "concessionCategory")]
4690    pub concession_category: Option<String>,
4691    /// A custom concession category to use when `concessionCategory` does not provide the right option. Both `concessionCategory` and `customConcessionCategory` may not be set.
4692    #[serde(rename = "customConcessionCategory")]
4693    pub custom_concession_category: Option<LocalizedString>,
4694    /// A custom status to use for the ticket status value when `ticketStatus` does not provide the right option. Both `ticketStatus` and `customTicketStatus` may not be set.
4695    #[serde(rename = "customTicketStatus")]
4696    pub custom_ticket_status: Option<LocalizedString>,
4697    /// Device context associated with the object.
4698    #[serde(rename = "deviceContext")]
4699    pub device_context: Option<DeviceContext>,
4700    /// Indicates if notifications should explicitly be suppressed. If this field is set to true, regardless of the `messages` field, expiration notifications to the user will be suppressed. By default, this field is set to false. Currently, this can only be set for offers.
4701    #[serde(rename = "disableExpirationNotification")]
4702    pub disable_expiration_notification: Option<bool>,
4703    /// Information that controls how passes are grouped together.
4704    #[serde(rename = "groupingInfo")]
4705    pub grouping_info: Option<GroupingInfo>,
4706    /// Whether this object is currently linked to a single device. This field is set by the platform when a user saves the object, linking it to their device. Intended for use by select partners. Contact support for additional information.
4707    #[serde(rename = "hasLinkedDevice")]
4708    pub has_linked_device: Option<bool>,
4709    /// Indicates if the object has users. This field is set by the platform.
4710    #[serde(rename = "hasUsers")]
4711    pub has_users: Option<bool>,
4712    /// Optional banner image displayed on the front of the card. If none is present, hero image of the class, if present, will be displayed. If hero image of the class is also not present, nothing will be displayed.
4713    #[serde(rename = "heroImage")]
4714    pub hero_image: Option<Image>,
4715    /// The background color for the card. If not set the dominant color of the hero image is used, and if no hero image is set, the dominant color of the logo is used. The format is #rrggbb where rrggbb is a hex RGB triplet, such as `#ffcc00`. You can also use the shorthand version of the RGB triplet which is #rgb, such as `#fc0`.
4716    #[serde(rename = "hexBackgroundColor")]
4717    pub hex_background_color: Option<String>,
4718    /// Required. The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID.identifier where the former is issued by Google and latter is chosen by you. The unique identifier should only include alphanumeric characters, '.', '_', or '-'.
4719    pub id: Option<String>,
4720    /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
4721    #[serde(rename = "imageModulesData")]
4722    pub image_modules_data: Option<Vec<ImageModuleData>>,
4723    /// Deprecated. Use textModulesData instead.
4724    #[serde(rename = "infoModuleData")]
4725    pub info_module_data: Option<InfoModuleData>,
4726    /// linked_object_ids are a list of other objects such as event ticket, loyalty, offer, generic, giftcard, transit and boarding pass that should be automatically attached to this transit object. If a user had saved this transit card, then these linked_object_ids would be automatically pushed to the user's wallet (unless they turned off the setting to receive such linked passes). Make sure that objects present in linked_object_ids are already inserted - if not, calls would fail. Once linked, the linked objects cannot be unlinked. You cannot link objects belonging to another issuer. There is a limit to the number of objects that can be linked to a single object. After the limit is reached, new linked objects in the call will be ignored silently. Object IDs should follow the format issuer ID. identifier where the former is issued by Google and the latter is chosen by you.
4727    #[serde(rename = "linkedObjectIds")]
4728    pub linked_object_ids: Option<Vec<String>>,
4729    /// Links module data. If links module data is also defined on the class, both will be displayed.
4730    #[serde(rename = "linksModuleData")]
4731    pub links_module_data: Option<LinksModuleData>,
4732    /// Note: This field is currently not supported to trigger geo notifications.
4733    pub locations: Option<Vec<LatLongPoint>>,
4734    /// Merchant locations. There is a maximum of ten on the object. Any additional MerchantLocations added beyond the 10 will be rejected. These locations will trigger a notification when a user enters within a Google-set radius of the point. This field replaces the deprecated LatLongPoints.
4735    #[serde(rename = "merchantLocations")]
4736    pub merchant_locations: Option<Vec<MerchantLocation>>,
4737    /// An array of messages displayed in the app. All users of this object will receive its associated messages. The maximum number of these fields is 10.
4738    pub messages: Option<Vec<Message>>,
4739    /// Whether or not field updates to this object should trigger notifications. When set to NOTIFY, we will attempt to trigger a field update notification to users. These notifications will only be sent to users if the field is part of an allowlist. If set to DO_NOT_NOTIFY or NOTIFICATION_SETTINGS_UNSPECIFIED, no notification will be triggered. This setting is ephemeral and needs to be set with each PATCH or UPDATE request, otherwise a notification will not be triggered.
4740    #[serde(rename = "notifyPreference")]
4741    pub notify_preference: Option<String>,
4742    /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
4743    #[serde(rename = "passConstraints")]
4744    pub pass_constraints: Option<PassConstraints>,
4745    /// The name(s) of the passengers the ticket is assigned to. The above `passengerType` field is meant to give Google context on this field.
4746    #[serde(rename = "passengerNames")]
4747    pub passenger_names: Option<String>,
4748    /// The number of passengers.
4749    #[serde(rename = "passengerType")]
4750    pub passenger_type: Option<String>,
4751    /// Purchase details for this ticket.
4752    #[serde(rename = "purchaseDetails")]
4753    pub purchase_details: Option<PurchaseDetails>,
4754    /// The rotating barcode type and value.
4755    #[serde(rename = "rotatingBarcode")]
4756    pub rotating_barcode: Option<RotatingBarcode>,
4757    /// Restrictions on the object that needs to be verified before the user tries to save the pass. Note that this restrictions will only be applied during save time. If the restrictions changed after a user saves the pass, the new restrictions will not be applied to an already saved pass.
4758    #[serde(rename = "saveRestrictions")]
4759    pub save_restrictions: Option<SaveRestrictions>,
4760    /// The value that will be transmitted to a Smart Tap certified terminal over NFC for this object. The class level fields `enableSmartTap` and `redemptionIssuers` must also be set up correctly in order for the pass to support Smart Tap. Only ASCII characters are supported.
4761    #[serde(rename = "smartTapRedemptionValue")]
4762    pub smart_tap_redemption_value: Option<String>,
4763    /// Required. The state of the object. This field is used to determine how an object is displayed in the app. For example, an `inactive` object is moved to the "Expired passes" section.
4764    pub state: Option<String>,
4765    /// Text module data. If text module data is also defined on the class, both will be displayed. The maximum number of these fields displayed is 10 from the object and 10 from the class.
4766    #[serde(rename = "textModulesData")]
4767    pub text_modules_data: Option<Vec<TextModuleData>>,
4768    /// A single ticket leg contains departure and arrival information along with boarding and seating information. If more than one leg is to be specified then use the `ticketLegs` field instead. Both `ticketLeg` and `ticketLegs` may not be set.
4769    #[serde(rename = "ticketLeg")]
4770    pub ticket_leg: Option<TicketLeg>,
4771    /// Each ticket may contain one or more legs. Each leg contains departure and arrival information along with boarding and seating information. If only one leg is to be specified then use the `ticketLeg` field instead. Both `ticketLeg` and `ticketLegs` may not be set.
4772    #[serde(rename = "ticketLegs")]
4773    pub ticket_legs: Option<Vec<TicketLeg>>,
4774    /// The number of the ticket. This is a unique identifier for the ticket in the transit operator's system.
4775    #[serde(rename = "ticketNumber")]
4776    pub ticket_number: Option<String>,
4777    /// Information about what kind of restrictions there are on using this ticket. For example, which days of the week it must be used, or which routes are allowed to be taken.
4778    #[serde(rename = "ticketRestrictions")]
4779    pub ticket_restrictions: Option<TicketRestrictions>,
4780    /// The status of the ticket. For states which affect display, use the `state` field instead.
4781    #[serde(rename = "ticketStatus")]
4782    pub ticket_status: Option<String>,
4783    /// This id is used to group tickets together if the user has saved multiple tickets for the same trip.
4784    #[serde(rename = "tripId")]
4785    pub trip_id: Option<String>,
4786    /// Required. The type of trip this transit object represents. Used to determine the pass title and/or which symbol to use between the origin and destination.
4787    #[serde(rename = "tripType")]
4788    pub trip_type: Option<String>,
4789    /// The time period this object will be `active` and object can be used. An object's state will be changed to `expired` when this time period has passed.
4790    #[serde(rename = "validTimeInterval")]
4791    pub valid_time_interval: Option<TimeInterval>,
4792    /// Optional value added module data. Maximum of ten on the object.
4793    #[serde(rename = "valueAddedModuleData")]
4794    pub value_added_module_data: Option<Vec<ValueAddedModuleData>>,
4795    /// Deprecated
4796    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4797    pub version: Option<i64>,
4798}
4799
4800impl common::RequestValue for TransitObject {}
4801impl common::ResponseResult for TransitObject {}
4802
4803/// There is no detailed description.
4804///
4805/// # Activities
4806///
4807/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4808/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4809///
4810/// * [addmessage transitobject](TransitobjectAddmessageCall) (response)
4811#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4812#[serde_with::serde_as]
4813#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4814pub struct TransitObjectAddMessageResponse {
4815    /// The updated TransitObject resource.
4816    pub resource: Option<TransitObject>,
4817}
4818
4819impl common::ResponseResult for TransitObjectAddMessageResponse {}
4820
4821/// There is no detailed description.
4822///
4823/// # Activities
4824///
4825/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4826/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4827///
4828/// * [list transitobject](TransitobjectListCall) (response)
4829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4830#[serde_with::serde_as]
4831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4832pub struct TransitObjectListResponse {
4833    /// Pagination of the response.
4834    pub pagination: Option<Pagination>,
4835    /// Resources corresponding to the list request.
4836    pub resources: Option<Vec<TransitObject>>,
4837}
4838
4839impl common::ResponseResult for TransitObjectListResponse {}
4840
4841/// Request to upload rotating barcode values.
4842///
4843/// # Activities
4844///
4845/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4846/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4847///
4848/// * [upload media](MediaUploadCall) (request)
4849#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4850#[serde_with::serde_as]
4851#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4852pub struct TransitObjectUploadRotatingBarcodeValuesRequest {
4853    /// A reference to the rotating barcode values payload that was uploaded.
4854    pub blob: Option<Media>,
4855    /// Extra information about the uploaded media.
4856    #[serde(rename = "mediaRequestInfo")]
4857    pub media_request_info: Option<MediaRequestInfo>,
4858}
4859
4860impl common::RequestValue for TransitObjectUploadRotatingBarcodeValuesRequest {}
4861
4862/// Response for uploading rotating barcode values.
4863///
4864/// # Activities
4865///
4866/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4867/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4868///
4869/// * [upload media](MediaUploadCall) (response)
4870#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4871#[serde_with::serde_as]
4872#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4873pub struct TransitObjectUploadRotatingBarcodeValuesResponse {
4874    _never_set: Option<bool>,
4875}
4876
4877impl common::ResponseResult for TransitObjectUploadRotatingBarcodeValuesResponse {}
4878
4879/// There is no detailed description.
4880///
4881/// This type is not used in any activity, and only used as *part* of another schema.
4882///
4883#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4884#[serde_with::serde_as]
4885#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4886pub struct TranslatedString {
4887    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#translatedString"`.
4888    pub kind: Option<String>,
4889    /// Represents the BCP 47 language tag. Example values are "en-US", "en-GB", "de", or "de-AT".
4890    pub language: Option<String>,
4891    /// The UTF-8 encoded translated string.
4892    pub value: Option<String>,
4893}
4894
4895impl common::Part for TranslatedString {}
4896
4897/// Indicates that the issuer would like Google Wallet to send an upcoming card validity notification 1 day before card becomes valid/usable.
4898///
4899/// This type is not used in any activity, and only used as *part* of another schema.
4900///
4901#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4902#[serde_with::serde_as]
4903#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4904pub struct UpcomingNotification {
4905    /// Indicates if the object needs to have upcoming notification enabled.
4906    #[serde(rename = "enableNotification")]
4907    pub enable_notification: Option<bool>,
4908}
4909
4910impl common::Part for UpcomingNotification {}
4911
4912/// There is no detailed description.
4913///
4914/// This type is not used in any activity, and only used as *part* of another schema.
4915///
4916#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4917#[serde_with::serde_as]
4918#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4919pub struct Uri {
4920    /// The URI's title appearing in the app as text. Recommended maximum is 20 characters to ensure full string is displayed on smaller screens. Note that in some contexts this text is not used, such as when `description` is part of an image.
4921    pub description: Option<String>,
4922    /// The ID associated with a uri. This field is here to enable ease of management of uris.
4923    pub id: Option<String>,
4924    /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#uri"`.
4925    pub kind: Option<String>,
4926    /// Translated strings for the description. Recommended maximum is 20 characters to ensure full string is displayed on smaller screens.
4927    #[serde(rename = "localizedDescription")]
4928    pub localized_description: Option<LocalizedString>,
4929    /// The location of a web page, image, or other resource. URIs in the `LinksModuleData` module can have different prefixes indicating the type of URI (a link to a web page, a link to a map, a telephone number, or an email address). URIs must have a scheme.
4930    pub uri: Option<String>,
4931}
4932
4933impl common::Part for Uri {}
4934
4935/// Data for Value Added module. Required fields are header and uri.
4936///
4937/// This type is not used in any activity, and only used as *part* of another schema.
4938///
4939#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4940#[serde_with::serde_as]
4941#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4942pub struct ValueAddedModuleData {
4943    /// Body to be displayed on the module. Character limit is 50 and longer strings will be truncated.
4944    pub body: Option<LocalizedString>,
4945    /// Header to be displayed on the module. Character limit is 60 and longer strings will be truncated.
4946    pub header: Option<LocalizedString>,
4947    /// Image to be displayed on the module. Recommended image ratio is 1:1. Images will be resized to fit this ratio.
4948    pub image: Option<Image>,
4949    /// The index for sorting the modules. Modules with a lower sort index are shown before modules with a higher sort index. If unspecified, the sort index is assumed to be INT_MAX. For two modules with the same index, the sorting behavior is undefined.
4950    #[serde(rename = "sortIndex")]
4951    pub sort_index: Option<i32>,
4952    /// URI that the module leads to on click. This can be a web link or a deep link as mentioned in https://developer.android.com/training/app-links/deep-linking.
4953    pub uri: Option<String>,
4954    /// Constraints that all must be met for the module to be shown.
4955    #[serde(rename = "viewConstraints")]
4956    pub view_constraints: Option<ModuleViewConstraints>,
4957}
4958
4959impl common::Part for ValueAddedModuleData {}
4960
4961// ###################
4962// MethodBuilders ###
4963// #################
4964
4965/// A builder providing access to all methods supported on *eventticketclas* resources.
4966/// It is not used directly, but through the [`Walletobjects`] hub.
4967///
4968/// # Example
4969///
4970/// Instantiate a resource builder
4971///
4972/// ```test_harness,no_run
4973/// extern crate hyper;
4974/// extern crate hyper_rustls;
4975/// extern crate google_walletobjects1 as walletobjects1;
4976///
4977/// # async fn dox() {
4978/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4979///
4980/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4981/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4982///     .with_native_roots()
4983///     .unwrap()
4984///     .https_only()
4985///     .enable_http2()
4986///     .build();
4987///
4988/// let executor = hyper_util::rt::TokioExecutor::new();
4989/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4990///     secret,
4991///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4992///     yup_oauth2::client::CustomHyperClientBuilder::from(
4993///         hyper_util::client::legacy::Client::builder(executor).build(connector),
4994///     ),
4995/// ).build().await.unwrap();
4996///
4997/// let client = hyper_util::client::legacy::Client::builder(
4998///     hyper_util::rt::TokioExecutor::new()
4999/// )
5000/// .build(
5001///     hyper_rustls::HttpsConnectorBuilder::new()
5002///         .with_native_roots()
5003///         .unwrap()
5004///         .https_or_http()
5005///         .enable_http2()
5006///         .build()
5007/// );
5008/// let mut hub = Walletobjects::new(client, auth);
5009/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5010/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5011/// // to build up your call.
5012/// let rb = hub.eventticketclass();
5013/// # }
5014/// ```
5015pub struct EventticketclasMethods<'a, C>
5016where
5017    C: 'a,
5018{
5019    hub: &'a Walletobjects<C>,
5020}
5021
5022impl<'a, C> common::MethodsBuilder for EventticketclasMethods<'a, C> {}
5023
5024impl<'a, C> EventticketclasMethods<'a, C> {
5025    /// Create a builder to help you perform the following task:
5026    ///
5027    /// Adds a message to the event ticket class referenced by the given class ID.
5028    ///
5029    /// # Arguments
5030    ///
5031    /// * `request` - No description provided.
5032    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5033    pub fn addmessage(
5034        &self,
5035        request: AddMessageRequest,
5036        resource_id: &str,
5037    ) -> EventticketclasAddmessageCall<'a, C> {
5038        EventticketclasAddmessageCall {
5039            hub: self.hub,
5040            _request: request,
5041            _resource_id: resource_id.to_string(),
5042            _delegate: Default::default(),
5043            _additional_params: Default::default(),
5044            _scopes: Default::default(),
5045        }
5046    }
5047
5048    /// Create a builder to help you perform the following task:
5049    ///
5050    /// Returns the event ticket class with the given class ID.
5051    ///
5052    /// # Arguments
5053    ///
5054    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5055    pub fn get(&self, resource_id: &str) -> EventticketclasGetCall<'a, C> {
5056        EventticketclasGetCall {
5057            hub: self.hub,
5058            _resource_id: resource_id.to_string(),
5059            _delegate: Default::default(),
5060            _additional_params: Default::default(),
5061            _scopes: Default::default(),
5062        }
5063    }
5064
5065    /// Create a builder to help you perform the following task:
5066    ///
5067    /// Inserts an event ticket class with the given ID and properties.
5068    ///
5069    /// # Arguments
5070    ///
5071    /// * `request` - No description provided.
5072    pub fn insert(&self, request: EventTicketClass) -> EventticketclasInsertCall<'a, C> {
5073        EventticketclasInsertCall {
5074            hub: self.hub,
5075            _request: request,
5076            _delegate: Default::default(),
5077            _additional_params: Default::default(),
5078            _scopes: Default::default(),
5079        }
5080    }
5081
5082    /// Create a builder to help you perform the following task:
5083    ///
5084    /// Returns a list of all event ticket classes for a given issuer ID.
5085    pub fn list(&self) -> EventticketclasListCall<'a, C> {
5086        EventticketclasListCall {
5087            hub: self.hub,
5088            _token: Default::default(),
5089            _max_results: Default::default(),
5090            _issuer_id: Default::default(),
5091            _delegate: Default::default(),
5092            _additional_params: Default::default(),
5093            _scopes: Default::default(),
5094        }
5095    }
5096
5097    /// Create a builder to help you perform the following task:
5098    ///
5099    /// Updates the event ticket class referenced by the given class ID. This method supports patch semantics.
5100    ///
5101    /// # Arguments
5102    ///
5103    /// * `request` - No description provided.
5104    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5105    pub fn patch(
5106        &self,
5107        request: EventTicketClass,
5108        resource_id: &str,
5109    ) -> EventticketclasPatchCall<'a, C> {
5110        EventticketclasPatchCall {
5111            hub: self.hub,
5112            _request: request,
5113            _resource_id: resource_id.to_string(),
5114            _delegate: Default::default(),
5115            _additional_params: Default::default(),
5116            _scopes: Default::default(),
5117        }
5118    }
5119
5120    /// Create a builder to help you perform the following task:
5121    ///
5122    /// Updates the event ticket class referenced by the given class ID.
5123    ///
5124    /// # Arguments
5125    ///
5126    /// * `request` - No description provided.
5127    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5128    pub fn update(
5129        &self,
5130        request: EventTicketClass,
5131        resource_id: &str,
5132    ) -> EventticketclasUpdateCall<'a, C> {
5133        EventticketclasUpdateCall {
5134            hub: self.hub,
5135            _request: request,
5136            _resource_id: resource_id.to_string(),
5137            _delegate: Default::default(),
5138            _additional_params: Default::default(),
5139            _scopes: Default::default(),
5140        }
5141    }
5142}
5143
5144/// A builder providing access to all methods supported on *eventticketobject* resources.
5145/// It is not used directly, but through the [`Walletobjects`] hub.
5146///
5147/// # Example
5148///
5149/// Instantiate a resource builder
5150///
5151/// ```test_harness,no_run
5152/// extern crate hyper;
5153/// extern crate hyper_rustls;
5154/// extern crate google_walletobjects1 as walletobjects1;
5155///
5156/// # async fn dox() {
5157/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5158///
5159/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5160/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
5161///     .with_native_roots()
5162///     .unwrap()
5163///     .https_only()
5164///     .enable_http2()
5165///     .build();
5166///
5167/// let executor = hyper_util::rt::TokioExecutor::new();
5168/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5169///     secret,
5170///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5171///     yup_oauth2::client::CustomHyperClientBuilder::from(
5172///         hyper_util::client::legacy::Client::builder(executor).build(connector),
5173///     ),
5174/// ).build().await.unwrap();
5175///
5176/// let client = hyper_util::client::legacy::Client::builder(
5177///     hyper_util::rt::TokioExecutor::new()
5178/// )
5179/// .build(
5180///     hyper_rustls::HttpsConnectorBuilder::new()
5181///         .with_native_roots()
5182///         .unwrap()
5183///         .https_or_http()
5184///         .enable_http2()
5185///         .build()
5186/// );
5187/// let mut hub = Walletobjects::new(client, auth);
5188/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5189/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `modifylinkedofferobjects(...)`, `patch(...)` and `update(...)`
5190/// // to build up your call.
5191/// let rb = hub.eventticketobject();
5192/// # }
5193/// ```
5194pub struct EventticketobjectMethods<'a, C>
5195where
5196    C: 'a,
5197{
5198    hub: &'a Walletobjects<C>,
5199}
5200
5201impl<'a, C> common::MethodsBuilder for EventticketobjectMethods<'a, C> {}
5202
5203impl<'a, C> EventticketobjectMethods<'a, C> {
5204    /// Create a builder to help you perform the following task:
5205    ///
5206    /// Adds a message to the event ticket object referenced by the given object ID.
5207    ///
5208    /// # Arguments
5209    ///
5210    /// * `request` - No description provided.
5211    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5212    pub fn addmessage(
5213        &self,
5214        request: AddMessageRequest,
5215        resource_id: &str,
5216    ) -> EventticketobjectAddmessageCall<'a, C> {
5217        EventticketobjectAddmessageCall {
5218            hub: self.hub,
5219            _request: request,
5220            _resource_id: resource_id.to_string(),
5221            _delegate: Default::default(),
5222            _additional_params: Default::default(),
5223            _scopes: Default::default(),
5224        }
5225    }
5226
5227    /// Create a builder to help you perform the following task:
5228    ///
5229    /// Returns the event ticket object with the given object ID.
5230    ///
5231    /// # Arguments
5232    ///
5233    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5234    pub fn get(&self, resource_id: &str) -> EventticketobjectGetCall<'a, C> {
5235        EventticketobjectGetCall {
5236            hub: self.hub,
5237            _resource_id: resource_id.to_string(),
5238            _delegate: Default::default(),
5239            _additional_params: Default::default(),
5240            _scopes: Default::default(),
5241        }
5242    }
5243
5244    /// Create a builder to help you perform the following task:
5245    ///
5246    /// Inserts an event ticket object with the given ID and properties.
5247    ///
5248    /// # Arguments
5249    ///
5250    /// * `request` - No description provided.
5251    pub fn insert(&self, request: EventTicketObject) -> EventticketobjectInsertCall<'a, C> {
5252        EventticketobjectInsertCall {
5253            hub: self.hub,
5254            _request: request,
5255            _delegate: Default::default(),
5256            _additional_params: Default::default(),
5257            _scopes: Default::default(),
5258        }
5259    }
5260
5261    /// Create a builder to help you perform the following task:
5262    ///
5263    /// Returns a list of all event ticket objects for a given issuer ID.
5264    pub fn list(&self) -> EventticketobjectListCall<'a, C> {
5265        EventticketobjectListCall {
5266            hub: self.hub,
5267            _token: Default::default(),
5268            _max_results: Default::default(),
5269            _class_id: Default::default(),
5270            _delegate: Default::default(),
5271            _additional_params: Default::default(),
5272            _scopes: Default::default(),
5273        }
5274    }
5275
5276    /// Create a builder to help you perform the following task:
5277    ///
5278    /// Modifies linked offer objects for the event ticket object with the given ID.
5279    ///
5280    /// # Arguments
5281    ///
5282    /// * `request` - No description provided.
5283    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5284    pub fn modifylinkedofferobjects(
5285        &self,
5286        request: ModifyLinkedOfferObjectsRequest,
5287        resource_id: &str,
5288    ) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
5289        EventticketobjectModifylinkedofferobjectCall {
5290            hub: self.hub,
5291            _request: request,
5292            _resource_id: resource_id.to_string(),
5293            _delegate: Default::default(),
5294            _additional_params: Default::default(),
5295            _scopes: Default::default(),
5296        }
5297    }
5298
5299    /// Create a builder to help you perform the following task:
5300    ///
5301    /// Updates the event ticket object referenced by the given object ID. This method supports patch semantics.
5302    ///
5303    /// # Arguments
5304    ///
5305    /// * `request` - No description provided.
5306    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5307    pub fn patch(
5308        &self,
5309        request: EventTicketObject,
5310        resource_id: &str,
5311    ) -> EventticketobjectPatchCall<'a, C> {
5312        EventticketobjectPatchCall {
5313            hub: self.hub,
5314            _request: request,
5315            _resource_id: resource_id.to_string(),
5316            _delegate: Default::default(),
5317            _additional_params: Default::default(),
5318            _scopes: Default::default(),
5319        }
5320    }
5321
5322    /// Create a builder to help you perform the following task:
5323    ///
5324    /// Updates the event ticket object referenced by the given object ID.
5325    ///
5326    /// # Arguments
5327    ///
5328    /// * `request` - No description provided.
5329    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5330    pub fn update(
5331        &self,
5332        request: EventTicketObject,
5333        resource_id: &str,
5334    ) -> EventticketobjectUpdateCall<'a, C> {
5335        EventticketobjectUpdateCall {
5336            hub: self.hub,
5337            _request: request,
5338            _resource_id: resource_id.to_string(),
5339            _delegate: Default::default(),
5340            _additional_params: Default::default(),
5341            _scopes: Default::default(),
5342        }
5343    }
5344}
5345
5346/// A builder providing access to all methods supported on *flightclas* resources.
5347/// It is not used directly, but through the [`Walletobjects`] hub.
5348///
5349/// # Example
5350///
5351/// Instantiate a resource builder
5352///
5353/// ```test_harness,no_run
5354/// extern crate hyper;
5355/// extern crate hyper_rustls;
5356/// extern crate google_walletobjects1 as walletobjects1;
5357///
5358/// # async fn dox() {
5359/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5360///
5361/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5362/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
5363///     .with_native_roots()
5364///     .unwrap()
5365///     .https_only()
5366///     .enable_http2()
5367///     .build();
5368///
5369/// let executor = hyper_util::rt::TokioExecutor::new();
5370/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5371///     secret,
5372///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5373///     yup_oauth2::client::CustomHyperClientBuilder::from(
5374///         hyper_util::client::legacy::Client::builder(executor).build(connector),
5375///     ),
5376/// ).build().await.unwrap();
5377///
5378/// let client = hyper_util::client::legacy::Client::builder(
5379///     hyper_util::rt::TokioExecutor::new()
5380/// )
5381/// .build(
5382///     hyper_rustls::HttpsConnectorBuilder::new()
5383///         .with_native_roots()
5384///         .unwrap()
5385///         .https_or_http()
5386///         .enable_http2()
5387///         .build()
5388/// );
5389/// let mut hub = Walletobjects::new(client, auth);
5390/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5391/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5392/// // to build up your call.
5393/// let rb = hub.flightclass();
5394/// # }
5395/// ```
5396pub struct FlightclasMethods<'a, C>
5397where
5398    C: 'a,
5399{
5400    hub: &'a Walletobjects<C>,
5401}
5402
5403impl<'a, C> common::MethodsBuilder for FlightclasMethods<'a, C> {}
5404
5405impl<'a, C> FlightclasMethods<'a, C> {
5406    /// Create a builder to help you perform the following task:
5407    ///
5408    /// Adds a message to the flight class referenced by the given class ID.
5409    ///
5410    /// # Arguments
5411    ///
5412    /// * `request` - No description provided.
5413    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5414    pub fn addmessage(
5415        &self,
5416        request: AddMessageRequest,
5417        resource_id: &str,
5418    ) -> FlightclasAddmessageCall<'a, C> {
5419        FlightclasAddmessageCall {
5420            hub: self.hub,
5421            _request: request,
5422            _resource_id: resource_id.to_string(),
5423            _delegate: Default::default(),
5424            _additional_params: Default::default(),
5425            _scopes: Default::default(),
5426        }
5427    }
5428
5429    /// Create a builder to help you perform the following task:
5430    ///
5431    /// Returns the flight class with the given class ID.
5432    ///
5433    /// # Arguments
5434    ///
5435    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5436    pub fn get(&self, resource_id: &str) -> FlightclasGetCall<'a, C> {
5437        FlightclasGetCall {
5438            hub: self.hub,
5439            _resource_id: resource_id.to_string(),
5440            _delegate: Default::default(),
5441            _additional_params: Default::default(),
5442            _scopes: Default::default(),
5443        }
5444    }
5445
5446    /// Create a builder to help you perform the following task:
5447    ///
5448    /// Inserts an flight class with the given ID and properties.
5449    ///
5450    /// # Arguments
5451    ///
5452    /// * `request` - No description provided.
5453    pub fn insert(&self, request: FlightClass) -> FlightclasInsertCall<'a, C> {
5454        FlightclasInsertCall {
5455            hub: self.hub,
5456            _request: request,
5457            _delegate: Default::default(),
5458            _additional_params: Default::default(),
5459            _scopes: Default::default(),
5460        }
5461    }
5462
5463    /// Create a builder to help you perform the following task:
5464    ///
5465    /// Returns a list of all flight classes for a given issuer ID.
5466    pub fn list(&self) -> FlightclasListCall<'a, C> {
5467        FlightclasListCall {
5468            hub: self.hub,
5469            _token: Default::default(),
5470            _max_results: Default::default(),
5471            _issuer_id: Default::default(),
5472            _delegate: Default::default(),
5473            _additional_params: Default::default(),
5474            _scopes: Default::default(),
5475        }
5476    }
5477
5478    /// Create a builder to help you perform the following task:
5479    ///
5480    /// Updates the flight class referenced by the given class ID. This method supports patch semantics.
5481    ///
5482    /// # Arguments
5483    ///
5484    /// * `request` - No description provided.
5485    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5486    pub fn patch(&self, request: FlightClass, resource_id: &str) -> FlightclasPatchCall<'a, C> {
5487        FlightclasPatchCall {
5488            hub: self.hub,
5489            _request: request,
5490            _resource_id: resource_id.to_string(),
5491            _delegate: Default::default(),
5492            _additional_params: Default::default(),
5493            _scopes: Default::default(),
5494        }
5495    }
5496
5497    /// Create a builder to help you perform the following task:
5498    ///
5499    /// Updates the flight class referenced by the given class ID.
5500    ///
5501    /// # Arguments
5502    ///
5503    /// * `request` - No description provided.
5504    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5505    pub fn update(&self, request: FlightClass, resource_id: &str) -> FlightclasUpdateCall<'a, C> {
5506        FlightclasUpdateCall {
5507            hub: self.hub,
5508            _request: request,
5509            _resource_id: resource_id.to_string(),
5510            _delegate: Default::default(),
5511            _additional_params: Default::default(),
5512            _scopes: Default::default(),
5513        }
5514    }
5515}
5516
5517/// A builder providing access to all methods supported on *flightobject* resources.
5518/// It is not used directly, but through the [`Walletobjects`] hub.
5519///
5520/// # Example
5521///
5522/// Instantiate a resource builder
5523///
5524/// ```test_harness,no_run
5525/// extern crate hyper;
5526/// extern crate hyper_rustls;
5527/// extern crate google_walletobjects1 as walletobjects1;
5528///
5529/// # async fn dox() {
5530/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5531///
5532/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5533/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
5534///     .with_native_roots()
5535///     .unwrap()
5536///     .https_only()
5537///     .enable_http2()
5538///     .build();
5539///
5540/// let executor = hyper_util::rt::TokioExecutor::new();
5541/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5542///     secret,
5543///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5544///     yup_oauth2::client::CustomHyperClientBuilder::from(
5545///         hyper_util::client::legacy::Client::builder(executor).build(connector),
5546///     ),
5547/// ).build().await.unwrap();
5548///
5549/// let client = hyper_util::client::legacy::Client::builder(
5550///     hyper_util::rt::TokioExecutor::new()
5551/// )
5552/// .build(
5553///     hyper_rustls::HttpsConnectorBuilder::new()
5554///         .with_native_roots()
5555///         .unwrap()
5556///         .https_or_http()
5557///         .enable_http2()
5558///         .build()
5559/// );
5560/// let mut hub = Walletobjects::new(client, auth);
5561/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5562/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5563/// // to build up your call.
5564/// let rb = hub.flightobject();
5565/// # }
5566/// ```
5567pub struct FlightobjectMethods<'a, C>
5568where
5569    C: 'a,
5570{
5571    hub: &'a Walletobjects<C>,
5572}
5573
5574impl<'a, C> common::MethodsBuilder for FlightobjectMethods<'a, C> {}
5575
5576impl<'a, C> FlightobjectMethods<'a, C> {
5577    /// Create a builder to help you perform the following task:
5578    ///
5579    /// Adds a message to the flight object referenced by the given object ID.
5580    ///
5581    /// # Arguments
5582    ///
5583    /// * `request` - No description provided.
5584    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5585    pub fn addmessage(
5586        &self,
5587        request: AddMessageRequest,
5588        resource_id: &str,
5589    ) -> FlightobjectAddmessageCall<'a, C> {
5590        FlightobjectAddmessageCall {
5591            hub: self.hub,
5592            _request: request,
5593            _resource_id: resource_id.to_string(),
5594            _delegate: Default::default(),
5595            _additional_params: Default::default(),
5596            _scopes: Default::default(),
5597        }
5598    }
5599
5600    /// Create a builder to help you perform the following task:
5601    ///
5602    /// Returns the flight object with the given object ID.
5603    ///
5604    /// # Arguments
5605    ///
5606    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5607    pub fn get(&self, resource_id: &str) -> FlightobjectGetCall<'a, C> {
5608        FlightobjectGetCall {
5609            hub: self.hub,
5610            _resource_id: resource_id.to_string(),
5611            _delegate: Default::default(),
5612            _additional_params: Default::default(),
5613            _scopes: Default::default(),
5614        }
5615    }
5616
5617    /// Create a builder to help you perform the following task:
5618    ///
5619    /// Inserts an flight object with the given ID and properties.
5620    ///
5621    /// # Arguments
5622    ///
5623    /// * `request` - No description provided.
5624    pub fn insert(&self, request: FlightObject) -> FlightobjectInsertCall<'a, C> {
5625        FlightobjectInsertCall {
5626            hub: self.hub,
5627            _request: request,
5628            _delegate: Default::default(),
5629            _additional_params: Default::default(),
5630            _scopes: Default::default(),
5631        }
5632    }
5633
5634    /// Create a builder to help you perform the following task:
5635    ///
5636    /// Returns a list of all flight objects for a given issuer ID.
5637    pub fn list(&self) -> FlightobjectListCall<'a, C> {
5638        FlightobjectListCall {
5639            hub: self.hub,
5640            _token: Default::default(),
5641            _max_results: Default::default(),
5642            _class_id: Default::default(),
5643            _delegate: Default::default(),
5644            _additional_params: Default::default(),
5645            _scopes: Default::default(),
5646        }
5647    }
5648
5649    /// Create a builder to help you perform the following task:
5650    ///
5651    /// Updates the flight object referenced by the given object ID. This method supports patch semantics.
5652    ///
5653    /// # Arguments
5654    ///
5655    /// * `request` - No description provided.
5656    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5657    pub fn patch(&self, request: FlightObject, resource_id: &str) -> FlightobjectPatchCall<'a, C> {
5658        FlightobjectPatchCall {
5659            hub: self.hub,
5660            _request: request,
5661            _resource_id: resource_id.to_string(),
5662            _delegate: Default::default(),
5663            _additional_params: Default::default(),
5664            _scopes: Default::default(),
5665        }
5666    }
5667
5668    /// Create a builder to help you perform the following task:
5669    ///
5670    /// Updates the flight object referenced by the given object ID.
5671    ///
5672    /// # Arguments
5673    ///
5674    /// * `request` - No description provided.
5675    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5676    pub fn update(
5677        &self,
5678        request: FlightObject,
5679        resource_id: &str,
5680    ) -> FlightobjectUpdateCall<'a, C> {
5681        FlightobjectUpdateCall {
5682            hub: self.hub,
5683            _request: request,
5684            _resource_id: resource_id.to_string(),
5685            _delegate: Default::default(),
5686            _additional_params: Default::default(),
5687            _scopes: Default::default(),
5688        }
5689    }
5690}
5691
5692/// A builder providing access to all methods supported on *genericclas* resources.
5693/// It is not used directly, but through the [`Walletobjects`] hub.
5694///
5695/// # Example
5696///
5697/// Instantiate a resource builder
5698///
5699/// ```test_harness,no_run
5700/// extern crate hyper;
5701/// extern crate hyper_rustls;
5702/// extern crate google_walletobjects1 as walletobjects1;
5703///
5704/// # async fn dox() {
5705/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5706///
5707/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5708/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
5709///     .with_native_roots()
5710///     .unwrap()
5711///     .https_only()
5712///     .enable_http2()
5713///     .build();
5714///
5715/// let executor = hyper_util::rt::TokioExecutor::new();
5716/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5717///     secret,
5718///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5719///     yup_oauth2::client::CustomHyperClientBuilder::from(
5720///         hyper_util::client::legacy::Client::builder(executor).build(connector),
5721///     ),
5722/// ).build().await.unwrap();
5723///
5724/// let client = hyper_util::client::legacy::Client::builder(
5725///     hyper_util::rt::TokioExecutor::new()
5726/// )
5727/// .build(
5728///     hyper_rustls::HttpsConnectorBuilder::new()
5729///         .with_native_roots()
5730///         .unwrap()
5731///         .https_or_http()
5732///         .enable_http2()
5733///         .build()
5734/// );
5735/// let mut hub = Walletobjects::new(client, auth);
5736/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5737/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5738/// // to build up your call.
5739/// let rb = hub.genericclass();
5740/// # }
5741/// ```
5742pub struct GenericclasMethods<'a, C>
5743where
5744    C: 'a,
5745{
5746    hub: &'a Walletobjects<C>,
5747}
5748
5749impl<'a, C> common::MethodsBuilder for GenericclasMethods<'a, C> {}
5750
5751impl<'a, C> GenericclasMethods<'a, C> {
5752    /// Create a builder to help you perform the following task:
5753    ///
5754    /// Adds a message to the generic class referenced by the given class ID.
5755    ///
5756    /// # Arguments
5757    ///
5758    /// * `request` - No description provided.
5759    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5760    pub fn addmessage(
5761        &self,
5762        request: AddMessageRequest,
5763        resource_id: &str,
5764    ) -> GenericclasAddmessageCall<'a, C> {
5765        GenericclasAddmessageCall {
5766            hub: self.hub,
5767            _request: request,
5768            _resource_id: resource_id.to_string(),
5769            _delegate: Default::default(),
5770            _additional_params: Default::default(),
5771            _scopes: Default::default(),
5772        }
5773    }
5774
5775    /// Create a builder to help you perform the following task:
5776    ///
5777    /// Returns the generic class with the given class ID.
5778    ///
5779    /// # Arguments
5780    ///
5781    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
5782    pub fn get(&self, resource_id: &str) -> GenericclasGetCall<'a, C> {
5783        GenericclasGetCall {
5784            hub: self.hub,
5785            _resource_id: resource_id.to_string(),
5786            _delegate: Default::default(),
5787            _additional_params: Default::default(),
5788            _scopes: Default::default(),
5789        }
5790    }
5791
5792    /// Create a builder to help you perform the following task:
5793    ///
5794    /// Inserts a generic class with the given ID and properties.
5795    ///
5796    /// # Arguments
5797    ///
5798    /// * `request` - No description provided.
5799    pub fn insert(&self, request: GenericClass) -> GenericclasInsertCall<'a, C> {
5800        GenericclasInsertCall {
5801            hub: self.hub,
5802            _request: request,
5803            _delegate: Default::default(),
5804            _additional_params: Default::default(),
5805            _scopes: Default::default(),
5806        }
5807    }
5808
5809    /// Create a builder to help you perform the following task:
5810    ///
5811    /// Returns a list of all generic classes for a given issuer ID.
5812    pub fn list(&self) -> GenericclasListCall<'a, C> {
5813        GenericclasListCall {
5814            hub: self.hub,
5815            _token: Default::default(),
5816            _max_results: Default::default(),
5817            _issuer_id: Default::default(),
5818            _delegate: Default::default(),
5819            _additional_params: Default::default(),
5820            _scopes: Default::default(),
5821        }
5822    }
5823
5824    /// Create a builder to help you perform the following task:
5825    ///
5826    /// Updates the generic class referenced by the given class ID. This method supports patch semantics.
5827    ///
5828    /// # Arguments
5829    ///
5830    /// * `request` - No description provided.
5831    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
5832    pub fn patch(&self, request: GenericClass, resource_id: &str) -> GenericclasPatchCall<'a, C> {
5833        GenericclasPatchCall {
5834            hub: self.hub,
5835            _request: request,
5836            _resource_id: resource_id.to_string(),
5837            _delegate: Default::default(),
5838            _additional_params: Default::default(),
5839            _scopes: Default::default(),
5840        }
5841    }
5842
5843    /// Create a builder to help you perform the following task:
5844    ///
5845    /// Updates the Generic class referenced by the given class ID.
5846    ///
5847    /// # Arguments
5848    ///
5849    /// * `request` - No description provided.
5850    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
5851    pub fn update(&self, request: GenericClass, resource_id: &str) -> GenericclasUpdateCall<'a, C> {
5852        GenericclasUpdateCall {
5853            hub: self.hub,
5854            _request: request,
5855            _resource_id: resource_id.to_string(),
5856            _delegate: Default::default(),
5857            _additional_params: Default::default(),
5858            _scopes: Default::default(),
5859        }
5860    }
5861}
5862
5863/// A builder providing access to all methods supported on *genericobject* resources.
5864/// It is not used directly, but through the [`Walletobjects`] hub.
5865///
5866/// # Example
5867///
5868/// Instantiate a resource builder
5869///
5870/// ```test_harness,no_run
5871/// extern crate hyper;
5872/// extern crate hyper_rustls;
5873/// extern crate google_walletobjects1 as walletobjects1;
5874///
5875/// # async fn dox() {
5876/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5877///
5878/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5879/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
5880///     .with_native_roots()
5881///     .unwrap()
5882///     .https_only()
5883///     .enable_http2()
5884///     .build();
5885///
5886/// let executor = hyper_util::rt::TokioExecutor::new();
5887/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5888///     secret,
5889///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5890///     yup_oauth2::client::CustomHyperClientBuilder::from(
5891///         hyper_util::client::legacy::Client::builder(executor).build(connector),
5892///     ),
5893/// ).build().await.unwrap();
5894///
5895/// let client = hyper_util::client::legacy::Client::builder(
5896///     hyper_util::rt::TokioExecutor::new()
5897/// )
5898/// .build(
5899///     hyper_rustls::HttpsConnectorBuilder::new()
5900///         .with_native_roots()
5901///         .unwrap()
5902///         .https_or_http()
5903///         .enable_http2()
5904///         .build()
5905/// );
5906/// let mut hub = Walletobjects::new(client, auth);
5907/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5908/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5909/// // to build up your call.
5910/// let rb = hub.genericobject();
5911/// # }
5912/// ```
5913pub struct GenericobjectMethods<'a, C>
5914where
5915    C: 'a,
5916{
5917    hub: &'a Walletobjects<C>,
5918}
5919
5920impl<'a, C> common::MethodsBuilder for GenericobjectMethods<'a, C> {}
5921
5922impl<'a, C> GenericobjectMethods<'a, C> {
5923    /// Create a builder to help you perform the following task:
5924    ///
5925    /// Adds a message to the generic object referenced by the given object ID.
5926    ///
5927    /// # Arguments
5928    ///
5929    /// * `request` - No description provided.
5930    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
5931    pub fn addmessage(
5932        &self,
5933        request: AddMessageRequest,
5934        resource_id: &str,
5935    ) -> GenericobjectAddmessageCall<'a, C> {
5936        GenericobjectAddmessageCall {
5937            hub: self.hub,
5938            _request: request,
5939            _resource_id: resource_id.to_string(),
5940            _delegate: Default::default(),
5941            _additional_params: Default::default(),
5942            _scopes: Default::default(),
5943        }
5944    }
5945
5946    /// Create a builder to help you perform the following task:
5947    ///
5948    /// Returns the generic object with the given object ID.
5949    ///
5950    /// # Arguments
5951    ///
5952    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
5953    pub fn get(&self, resource_id: &str) -> GenericobjectGetCall<'a, C> {
5954        GenericobjectGetCall {
5955            hub: self.hub,
5956            _resource_id: resource_id.to_string(),
5957            _delegate: Default::default(),
5958            _additional_params: Default::default(),
5959            _scopes: Default::default(),
5960        }
5961    }
5962
5963    /// Create a builder to help you perform the following task:
5964    ///
5965    /// Inserts a generic object with the given ID and properties.
5966    ///
5967    /// # Arguments
5968    ///
5969    /// * `request` - No description provided.
5970    pub fn insert(&self, request: GenericObject) -> GenericobjectInsertCall<'a, C> {
5971        GenericobjectInsertCall {
5972            hub: self.hub,
5973            _request: request,
5974            _delegate: Default::default(),
5975            _additional_params: Default::default(),
5976            _scopes: Default::default(),
5977        }
5978    }
5979
5980    /// Create a builder to help you perform the following task:
5981    ///
5982    /// Returns a list of all generic objects for a given issuer ID.
5983    pub fn list(&self) -> GenericobjectListCall<'a, C> {
5984        GenericobjectListCall {
5985            hub: self.hub,
5986            _token: Default::default(),
5987            _max_results: Default::default(),
5988            _class_id: Default::default(),
5989            _delegate: Default::default(),
5990            _additional_params: Default::default(),
5991            _scopes: Default::default(),
5992        }
5993    }
5994
5995    /// Create a builder to help you perform the following task:
5996    ///
5997    /// Updates the generic object referenced by the given object ID. This method supports patch semantics.
5998    ///
5999    /// # Arguments
6000    ///
6001    /// * `request` - No description provided.
6002    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
6003    pub fn patch(
6004        &self,
6005        request: GenericObject,
6006        resource_id: &str,
6007    ) -> GenericobjectPatchCall<'a, C> {
6008        GenericobjectPatchCall {
6009            hub: self.hub,
6010            _request: request,
6011            _resource_id: resource_id.to_string(),
6012            _delegate: Default::default(),
6013            _additional_params: Default::default(),
6014            _scopes: Default::default(),
6015        }
6016    }
6017
6018    /// Create a builder to help you perform the following task:
6019    ///
6020    /// Updates the generic object referenced by the given object ID.
6021    ///
6022    /// # Arguments
6023    ///
6024    /// * `request` - No description provided.
6025    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
6026    pub fn update(
6027        &self,
6028        request: GenericObject,
6029        resource_id: &str,
6030    ) -> GenericobjectUpdateCall<'a, C> {
6031        GenericobjectUpdateCall {
6032            hub: self.hub,
6033            _request: request,
6034            _resource_id: resource_id.to_string(),
6035            _delegate: Default::default(),
6036            _additional_params: Default::default(),
6037            _scopes: Default::default(),
6038        }
6039    }
6040}
6041
6042/// A builder providing access to all methods supported on *giftcardclas* resources.
6043/// It is not used directly, but through the [`Walletobjects`] hub.
6044///
6045/// # Example
6046///
6047/// Instantiate a resource builder
6048///
6049/// ```test_harness,no_run
6050/// extern crate hyper;
6051/// extern crate hyper_rustls;
6052/// extern crate google_walletobjects1 as walletobjects1;
6053///
6054/// # async fn dox() {
6055/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6056///
6057/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6058/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
6059///     .with_native_roots()
6060///     .unwrap()
6061///     .https_only()
6062///     .enable_http2()
6063///     .build();
6064///
6065/// let executor = hyper_util::rt::TokioExecutor::new();
6066/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6067///     secret,
6068///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6069///     yup_oauth2::client::CustomHyperClientBuilder::from(
6070///         hyper_util::client::legacy::Client::builder(executor).build(connector),
6071///     ),
6072/// ).build().await.unwrap();
6073///
6074/// let client = hyper_util::client::legacy::Client::builder(
6075///     hyper_util::rt::TokioExecutor::new()
6076/// )
6077/// .build(
6078///     hyper_rustls::HttpsConnectorBuilder::new()
6079///         .with_native_roots()
6080///         .unwrap()
6081///         .https_or_http()
6082///         .enable_http2()
6083///         .build()
6084/// );
6085/// let mut hub = Walletobjects::new(client, auth);
6086/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6087/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
6088/// // to build up your call.
6089/// let rb = hub.giftcardclass();
6090/// # }
6091/// ```
6092pub struct GiftcardclasMethods<'a, C>
6093where
6094    C: 'a,
6095{
6096    hub: &'a Walletobjects<C>,
6097}
6098
6099impl<'a, C> common::MethodsBuilder for GiftcardclasMethods<'a, C> {}
6100
6101impl<'a, C> GiftcardclasMethods<'a, C> {
6102    /// Create a builder to help you perform the following task:
6103    ///
6104    /// Adds a message to the gift card class referenced by the given class ID.
6105    ///
6106    /// # Arguments
6107    ///
6108    /// * `request` - No description provided.
6109    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6110    pub fn addmessage(
6111        &self,
6112        request: AddMessageRequest,
6113        resource_id: &str,
6114    ) -> GiftcardclasAddmessageCall<'a, C> {
6115        GiftcardclasAddmessageCall {
6116            hub: self.hub,
6117            _request: request,
6118            _resource_id: resource_id.to_string(),
6119            _delegate: Default::default(),
6120            _additional_params: Default::default(),
6121            _scopes: Default::default(),
6122        }
6123    }
6124
6125    /// Create a builder to help you perform the following task:
6126    ///
6127    /// Returns the gift card class with the given class ID.
6128    ///
6129    /// # Arguments
6130    ///
6131    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6132    pub fn get(&self, resource_id: &str) -> GiftcardclasGetCall<'a, C> {
6133        GiftcardclasGetCall {
6134            hub: self.hub,
6135            _resource_id: resource_id.to_string(),
6136            _delegate: Default::default(),
6137            _additional_params: Default::default(),
6138            _scopes: Default::default(),
6139        }
6140    }
6141
6142    /// Create a builder to help you perform the following task:
6143    ///
6144    /// Inserts an gift card class with the given ID and properties.
6145    ///
6146    /// # Arguments
6147    ///
6148    /// * `request` - No description provided.
6149    pub fn insert(&self, request: GiftCardClass) -> GiftcardclasInsertCall<'a, C> {
6150        GiftcardclasInsertCall {
6151            hub: self.hub,
6152            _request: request,
6153            _delegate: Default::default(),
6154            _additional_params: Default::default(),
6155            _scopes: Default::default(),
6156        }
6157    }
6158
6159    /// Create a builder to help you perform the following task:
6160    ///
6161    /// Returns a list of all gift card classes for a given issuer ID.
6162    pub fn list(&self) -> GiftcardclasListCall<'a, C> {
6163        GiftcardclasListCall {
6164            hub: self.hub,
6165            _token: Default::default(),
6166            _max_results: Default::default(),
6167            _issuer_id: Default::default(),
6168            _delegate: Default::default(),
6169            _additional_params: Default::default(),
6170            _scopes: Default::default(),
6171        }
6172    }
6173
6174    /// Create a builder to help you perform the following task:
6175    ///
6176    /// Updates the gift card class referenced by the given class ID. This method supports patch semantics.
6177    ///
6178    /// # Arguments
6179    ///
6180    /// * `request` - No description provided.
6181    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6182    pub fn patch(&self, request: GiftCardClass, resource_id: &str) -> GiftcardclasPatchCall<'a, C> {
6183        GiftcardclasPatchCall {
6184            hub: self.hub,
6185            _request: request,
6186            _resource_id: resource_id.to_string(),
6187            _delegate: Default::default(),
6188            _additional_params: Default::default(),
6189            _scopes: Default::default(),
6190        }
6191    }
6192
6193    /// Create a builder to help you perform the following task:
6194    ///
6195    /// Updates the gift card class referenced by the given class ID.
6196    ///
6197    /// # Arguments
6198    ///
6199    /// * `request` - No description provided.
6200    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6201    pub fn update(
6202        &self,
6203        request: GiftCardClass,
6204        resource_id: &str,
6205    ) -> GiftcardclasUpdateCall<'a, C> {
6206        GiftcardclasUpdateCall {
6207            hub: self.hub,
6208            _request: request,
6209            _resource_id: resource_id.to_string(),
6210            _delegate: Default::default(),
6211            _additional_params: Default::default(),
6212            _scopes: Default::default(),
6213        }
6214    }
6215}
6216
6217/// A builder providing access to all methods supported on *giftcardobject* resources.
6218/// It is not used directly, but through the [`Walletobjects`] hub.
6219///
6220/// # Example
6221///
6222/// Instantiate a resource builder
6223///
6224/// ```test_harness,no_run
6225/// extern crate hyper;
6226/// extern crate hyper_rustls;
6227/// extern crate google_walletobjects1 as walletobjects1;
6228///
6229/// # async fn dox() {
6230/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6231///
6232/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6233/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
6234///     .with_native_roots()
6235///     .unwrap()
6236///     .https_only()
6237///     .enable_http2()
6238///     .build();
6239///
6240/// let executor = hyper_util::rt::TokioExecutor::new();
6241/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6242///     secret,
6243///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6244///     yup_oauth2::client::CustomHyperClientBuilder::from(
6245///         hyper_util::client::legacy::Client::builder(executor).build(connector),
6246///     ),
6247/// ).build().await.unwrap();
6248///
6249/// let client = hyper_util::client::legacy::Client::builder(
6250///     hyper_util::rt::TokioExecutor::new()
6251/// )
6252/// .build(
6253///     hyper_rustls::HttpsConnectorBuilder::new()
6254///         .with_native_roots()
6255///         .unwrap()
6256///         .https_or_http()
6257///         .enable_http2()
6258///         .build()
6259/// );
6260/// let mut hub = Walletobjects::new(client, auth);
6261/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6262/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
6263/// // to build up your call.
6264/// let rb = hub.giftcardobject();
6265/// # }
6266/// ```
6267pub struct GiftcardobjectMethods<'a, C>
6268where
6269    C: 'a,
6270{
6271    hub: &'a Walletobjects<C>,
6272}
6273
6274impl<'a, C> common::MethodsBuilder for GiftcardobjectMethods<'a, C> {}
6275
6276impl<'a, C> GiftcardobjectMethods<'a, C> {
6277    /// Create a builder to help you perform the following task:
6278    ///
6279    /// Adds a message to the gift card object referenced by the given object ID.
6280    ///
6281    /// # Arguments
6282    ///
6283    /// * `request` - No description provided.
6284    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6285    pub fn addmessage(
6286        &self,
6287        request: AddMessageRequest,
6288        resource_id: &str,
6289    ) -> GiftcardobjectAddmessageCall<'a, C> {
6290        GiftcardobjectAddmessageCall {
6291            hub: self.hub,
6292            _request: request,
6293            _resource_id: resource_id.to_string(),
6294            _delegate: Default::default(),
6295            _additional_params: Default::default(),
6296            _scopes: Default::default(),
6297        }
6298    }
6299
6300    /// Create a builder to help you perform the following task:
6301    ///
6302    /// Returns the gift card object with the given object ID.
6303    ///
6304    /// # Arguments
6305    ///
6306    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6307    pub fn get(&self, resource_id: &str) -> GiftcardobjectGetCall<'a, C> {
6308        GiftcardobjectGetCall {
6309            hub: self.hub,
6310            _resource_id: resource_id.to_string(),
6311            _delegate: Default::default(),
6312            _additional_params: Default::default(),
6313            _scopes: Default::default(),
6314        }
6315    }
6316
6317    /// Create a builder to help you perform the following task:
6318    ///
6319    /// Inserts an gift card object with the given ID and properties.
6320    ///
6321    /// # Arguments
6322    ///
6323    /// * `request` - No description provided.
6324    pub fn insert(&self, request: GiftCardObject) -> GiftcardobjectInsertCall<'a, C> {
6325        GiftcardobjectInsertCall {
6326            hub: self.hub,
6327            _request: request,
6328            _delegate: Default::default(),
6329            _additional_params: Default::default(),
6330            _scopes: Default::default(),
6331        }
6332    }
6333
6334    /// Create a builder to help you perform the following task:
6335    ///
6336    /// Returns a list of all gift card objects for a given issuer ID.
6337    pub fn list(&self) -> GiftcardobjectListCall<'a, C> {
6338        GiftcardobjectListCall {
6339            hub: self.hub,
6340            _token: Default::default(),
6341            _max_results: Default::default(),
6342            _class_id: Default::default(),
6343            _delegate: Default::default(),
6344            _additional_params: Default::default(),
6345            _scopes: Default::default(),
6346        }
6347    }
6348
6349    /// Create a builder to help you perform the following task:
6350    ///
6351    /// Updates the gift card object referenced by the given object ID. This method supports patch semantics.
6352    ///
6353    /// # Arguments
6354    ///
6355    /// * `request` - No description provided.
6356    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6357    pub fn patch(
6358        &self,
6359        request: GiftCardObject,
6360        resource_id: &str,
6361    ) -> GiftcardobjectPatchCall<'a, C> {
6362        GiftcardobjectPatchCall {
6363            hub: self.hub,
6364            _request: request,
6365            _resource_id: resource_id.to_string(),
6366            _delegate: Default::default(),
6367            _additional_params: Default::default(),
6368            _scopes: Default::default(),
6369        }
6370    }
6371
6372    /// Create a builder to help you perform the following task:
6373    ///
6374    /// Updates the gift card object referenced by the given object ID.
6375    ///
6376    /// # Arguments
6377    ///
6378    /// * `request` - No description provided.
6379    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6380    pub fn update(
6381        &self,
6382        request: GiftCardObject,
6383        resource_id: &str,
6384    ) -> GiftcardobjectUpdateCall<'a, C> {
6385        GiftcardobjectUpdateCall {
6386            hub: self.hub,
6387            _request: request,
6388            _resource_id: resource_id.to_string(),
6389            _delegate: Default::default(),
6390            _additional_params: Default::default(),
6391            _scopes: Default::default(),
6392        }
6393    }
6394}
6395
6396/// A builder providing access to all methods supported on *issuer* resources.
6397/// It is not used directly, but through the [`Walletobjects`] hub.
6398///
6399/// # Example
6400///
6401/// Instantiate a resource builder
6402///
6403/// ```test_harness,no_run
6404/// extern crate hyper;
6405/// extern crate hyper_rustls;
6406/// extern crate google_walletobjects1 as walletobjects1;
6407///
6408/// # async fn dox() {
6409/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6410///
6411/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6412/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
6413///     .with_native_roots()
6414///     .unwrap()
6415///     .https_only()
6416///     .enable_http2()
6417///     .build();
6418///
6419/// let executor = hyper_util::rt::TokioExecutor::new();
6420/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6421///     secret,
6422///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6423///     yup_oauth2::client::CustomHyperClientBuilder::from(
6424///         hyper_util::client::legacy::Client::builder(executor).build(connector),
6425///     ),
6426/// ).build().await.unwrap();
6427///
6428/// let client = hyper_util::client::legacy::Client::builder(
6429///     hyper_util::rt::TokioExecutor::new()
6430/// )
6431/// .build(
6432///     hyper_rustls::HttpsConnectorBuilder::new()
6433///         .with_native_roots()
6434///         .unwrap()
6435///         .https_or_http()
6436///         .enable_http2()
6437///         .build()
6438/// );
6439/// let mut hub = Walletobjects::new(client, auth);
6440/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6441/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
6442/// // to build up your call.
6443/// let rb = hub.issuer();
6444/// # }
6445/// ```
6446pub struct IssuerMethods<'a, C>
6447where
6448    C: 'a,
6449{
6450    hub: &'a Walletobjects<C>,
6451}
6452
6453impl<'a, C> common::MethodsBuilder for IssuerMethods<'a, C> {}
6454
6455impl<'a, C> IssuerMethods<'a, C> {
6456    /// Create a builder to help you perform the following task:
6457    ///
6458    /// Returns the issuer with the given issuer ID.
6459    ///
6460    /// # Arguments
6461    ///
6462    /// * `resourceId` - The unique identifier for an issuer.
6463    pub fn get(&self, resource_id: i64) -> IssuerGetCall<'a, C> {
6464        IssuerGetCall {
6465            hub: self.hub,
6466            _resource_id: resource_id,
6467            _delegate: Default::default(),
6468            _additional_params: Default::default(),
6469            _scopes: Default::default(),
6470        }
6471    }
6472
6473    /// Create a builder to help you perform the following task:
6474    ///
6475    /// Inserts an issuer with the given ID and properties.
6476    ///
6477    /// # Arguments
6478    ///
6479    /// * `request` - No description provided.
6480    pub fn insert(&self, request: Issuer) -> IssuerInsertCall<'a, C> {
6481        IssuerInsertCall {
6482            hub: self.hub,
6483            _request: request,
6484            _delegate: Default::default(),
6485            _additional_params: Default::default(),
6486            _scopes: Default::default(),
6487        }
6488    }
6489
6490    /// Create a builder to help you perform the following task:
6491    ///
6492    /// Returns a list of all issuers shared to the caller.
6493    pub fn list(&self) -> IssuerListCall<'a, C> {
6494        IssuerListCall {
6495            hub: self.hub,
6496            _delegate: Default::default(),
6497            _additional_params: Default::default(),
6498            _scopes: Default::default(),
6499        }
6500    }
6501
6502    /// Create a builder to help you perform the following task:
6503    ///
6504    /// Updates the issuer referenced by the given issuer ID. This method supports patch semantics.
6505    ///
6506    /// # Arguments
6507    ///
6508    /// * `request` - No description provided.
6509    /// * `resourceId` - The unique identifier for an issuer.
6510    pub fn patch(&self, request: Issuer, resource_id: i64) -> IssuerPatchCall<'a, C> {
6511        IssuerPatchCall {
6512            hub: self.hub,
6513            _request: request,
6514            _resource_id: resource_id,
6515            _delegate: Default::default(),
6516            _additional_params: Default::default(),
6517            _scopes: Default::default(),
6518        }
6519    }
6520
6521    /// Create a builder to help you perform the following task:
6522    ///
6523    /// Updates the issuer referenced by the given issuer ID.
6524    ///
6525    /// # Arguments
6526    ///
6527    /// * `request` - No description provided.
6528    /// * `resourceId` - The unique identifier for an issuer.
6529    pub fn update(&self, request: Issuer, resource_id: i64) -> IssuerUpdateCall<'a, C> {
6530        IssuerUpdateCall {
6531            hub: self.hub,
6532            _request: request,
6533            _resource_id: resource_id,
6534            _delegate: Default::default(),
6535            _additional_params: Default::default(),
6536            _scopes: Default::default(),
6537        }
6538    }
6539}
6540
6541/// A builder providing access to all methods supported on *jwt* resources.
6542/// It is not used directly, but through the [`Walletobjects`] hub.
6543///
6544/// # Example
6545///
6546/// Instantiate a resource builder
6547///
6548/// ```test_harness,no_run
6549/// extern crate hyper;
6550/// extern crate hyper_rustls;
6551/// extern crate google_walletobjects1 as walletobjects1;
6552///
6553/// # async fn dox() {
6554/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6555///
6556/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6557/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
6558///     .with_native_roots()
6559///     .unwrap()
6560///     .https_only()
6561///     .enable_http2()
6562///     .build();
6563///
6564/// let executor = hyper_util::rt::TokioExecutor::new();
6565/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6566///     secret,
6567///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6568///     yup_oauth2::client::CustomHyperClientBuilder::from(
6569///         hyper_util::client::legacy::Client::builder(executor).build(connector),
6570///     ),
6571/// ).build().await.unwrap();
6572///
6573/// let client = hyper_util::client::legacy::Client::builder(
6574///     hyper_util::rt::TokioExecutor::new()
6575/// )
6576/// .build(
6577///     hyper_rustls::HttpsConnectorBuilder::new()
6578///         .with_native_roots()
6579///         .unwrap()
6580///         .https_or_http()
6581///         .enable_http2()
6582///         .build()
6583/// );
6584/// let mut hub = Walletobjects::new(client, auth);
6585/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6586/// // like `insert(...)`
6587/// // to build up your call.
6588/// let rb = hub.jwt();
6589/// # }
6590/// ```
6591pub struct JwtMethods<'a, C>
6592where
6593    C: 'a,
6594{
6595    hub: &'a Walletobjects<C>,
6596}
6597
6598impl<'a, C> common::MethodsBuilder for JwtMethods<'a, C> {}
6599
6600impl<'a, C> JwtMethods<'a, C> {
6601    /// Create a builder to help you perform the following task:
6602    ///
6603    /// Inserts the resources in the JWT.
6604    ///
6605    /// # Arguments
6606    ///
6607    /// * `request` - No description provided.
6608    pub fn insert(&self, request: JwtResource) -> JwtInsertCall<'a, C> {
6609        JwtInsertCall {
6610            hub: self.hub,
6611            _request: request,
6612            _delegate: Default::default(),
6613            _additional_params: Default::default(),
6614            _scopes: Default::default(),
6615        }
6616    }
6617}
6618
6619/// A builder providing access to all methods supported on *loyaltyclas* resources.
6620/// It is not used directly, but through the [`Walletobjects`] hub.
6621///
6622/// # Example
6623///
6624/// Instantiate a resource builder
6625///
6626/// ```test_harness,no_run
6627/// extern crate hyper;
6628/// extern crate hyper_rustls;
6629/// extern crate google_walletobjects1 as walletobjects1;
6630///
6631/// # async fn dox() {
6632/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6633///
6634/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6635/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
6636///     .with_native_roots()
6637///     .unwrap()
6638///     .https_only()
6639///     .enable_http2()
6640///     .build();
6641///
6642/// let executor = hyper_util::rt::TokioExecutor::new();
6643/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6644///     secret,
6645///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6646///     yup_oauth2::client::CustomHyperClientBuilder::from(
6647///         hyper_util::client::legacy::Client::builder(executor).build(connector),
6648///     ),
6649/// ).build().await.unwrap();
6650///
6651/// let client = hyper_util::client::legacy::Client::builder(
6652///     hyper_util::rt::TokioExecutor::new()
6653/// )
6654/// .build(
6655///     hyper_rustls::HttpsConnectorBuilder::new()
6656///         .with_native_roots()
6657///         .unwrap()
6658///         .https_or_http()
6659///         .enable_http2()
6660///         .build()
6661/// );
6662/// let mut hub = Walletobjects::new(client, auth);
6663/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6664/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
6665/// // to build up your call.
6666/// let rb = hub.loyaltyclass();
6667/// # }
6668/// ```
6669pub struct LoyaltyclasMethods<'a, C>
6670where
6671    C: 'a,
6672{
6673    hub: &'a Walletobjects<C>,
6674}
6675
6676impl<'a, C> common::MethodsBuilder for LoyaltyclasMethods<'a, C> {}
6677
6678impl<'a, C> LoyaltyclasMethods<'a, C> {
6679    /// Create a builder to help you perform the following task:
6680    ///
6681    /// Adds a message to the loyalty class referenced by the given class ID.
6682    ///
6683    /// # Arguments
6684    ///
6685    /// * `request` - No description provided.
6686    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6687    pub fn addmessage(
6688        &self,
6689        request: AddMessageRequest,
6690        resource_id: &str,
6691    ) -> LoyaltyclasAddmessageCall<'a, C> {
6692        LoyaltyclasAddmessageCall {
6693            hub: self.hub,
6694            _request: request,
6695            _resource_id: resource_id.to_string(),
6696            _delegate: Default::default(),
6697            _additional_params: Default::default(),
6698            _scopes: Default::default(),
6699        }
6700    }
6701
6702    /// Create a builder to help you perform the following task:
6703    ///
6704    /// Returns the loyalty class with the given class ID.
6705    ///
6706    /// # Arguments
6707    ///
6708    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6709    pub fn get(&self, resource_id: &str) -> LoyaltyclasGetCall<'a, C> {
6710        LoyaltyclasGetCall {
6711            hub: self.hub,
6712            _resource_id: resource_id.to_string(),
6713            _delegate: Default::default(),
6714            _additional_params: Default::default(),
6715            _scopes: Default::default(),
6716        }
6717    }
6718
6719    /// Create a builder to help you perform the following task:
6720    ///
6721    /// Inserts an loyalty class with the given ID and properties.
6722    ///
6723    /// # Arguments
6724    ///
6725    /// * `request` - No description provided.
6726    pub fn insert(&self, request: LoyaltyClass) -> LoyaltyclasInsertCall<'a, C> {
6727        LoyaltyclasInsertCall {
6728            hub: self.hub,
6729            _request: request,
6730            _delegate: Default::default(),
6731            _additional_params: Default::default(),
6732            _scopes: Default::default(),
6733        }
6734    }
6735
6736    /// Create a builder to help you perform the following task:
6737    ///
6738    /// Returns a list of all loyalty classes for a given issuer ID.
6739    pub fn list(&self) -> LoyaltyclasListCall<'a, C> {
6740        LoyaltyclasListCall {
6741            hub: self.hub,
6742            _token: Default::default(),
6743            _max_results: Default::default(),
6744            _issuer_id: Default::default(),
6745            _delegate: Default::default(),
6746            _additional_params: Default::default(),
6747            _scopes: Default::default(),
6748        }
6749    }
6750
6751    /// Create a builder to help you perform the following task:
6752    ///
6753    /// Updates the loyalty class referenced by the given class ID. This method supports patch semantics.
6754    ///
6755    /// # Arguments
6756    ///
6757    /// * `request` - No description provided.
6758    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6759    pub fn patch(&self, request: LoyaltyClass, resource_id: &str) -> LoyaltyclasPatchCall<'a, C> {
6760        LoyaltyclasPatchCall {
6761            hub: self.hub,
6762            _request: request,
6763            _resource_id: resource_id.to_string(),
6764            _delegate: Default::default(),
6765            _additional_params: Default::default(),
6766            _scopes: Default::default(),
6767        }
6768    }
6769
6770    /// Create a builder to help you perform the following task:
6771    ///
6772    /// Updates the loyalty class referenced by the given class ID.
6773    ///
6774    /// # Arguments
6775    ///
6776    /// * `request` - No description provided.
6777    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6778    pub fn update(&self, request: LoyaltyClass, resource_id: &str) -> LoyaltyclasUpdateCall<'a, C> {
6779        LoyaltyclasUpdateCall {
6780            hub: self.hub,
6781            _request: request,
6782            _resource_id: resource_id.to_string(),
6783            _delegate: Default::default(),
6784            _additional_params: Default::default(),
6785            _scopes: Default::default(),
6786        }
6787    }
6788}
6789
6790/// A builder providing access to all methods supported on *loyaltyobject* resources.
6791/// It is not used directly, but through the [`Walletobjects`] hub.
6792///
6793/// # Example
6794///
6795/// Instantiate a resource builder
6796///
6797/// ```test_harness,no_run
6798/// extern crate hyper;
6799/// extern crate hyper_rustls;
6800/// extern crate google_walletobjects1 as walletobjects1;
6801///
6802/// # async fn dox() {
6803/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6804///
6805/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6806/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
6807///     .with_native_roots()
6808///     .unwrap()
6809///     .https_only()
6810///     .enable_http2()
6811///     .build();
6812///
6813/// let executor = hyper_util::rt::TokioExecutor::new();
6814/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6815///     secret,
6816///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6817///     yup_oauth2::client::CustomHyperClientBuilder::from(
6818///         hyper_util::client::legacy::Client::builder(executor).build(connector),
6819///     ),
6820/// ).build().await.unwrap();
6821///
6822/// let client = hyper_util::client::legacy::Client::builder(
6823///     hyper_util::rt::TokioExecutor::new()
6824/// )
6825/// .build(
6826///     hyper_rustls::HttpsConnectorBuilder::new()
6827///         .with_native_roots()
6828///         .unwrap()
6829///         .https_or_http()
6830///         .enable_http2()
6831///         .build()
6832/// );
6833/// let mut hub = Walletobjects::new(client, auth);
6834/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6835/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `modifylinkedofferobjects(...)`, `patch(...)` and `update(...)`
6836/// // to build up your call.
6837/// let rb = hub.loyaltyobject();
6838/// # }
6839/// ```
6840pub struct LoyaltyobjectMethods<'a, C>
6841where
6842    C: 'a,
6843{
6844    hub: &'a Walletobjects<C>,
6845}
6846
6847impl<'a, C> common::MethodsBuilder for LoyaltyobjectMethods<'a, C> {}
6848
6849impl<'a, C> LoyaltyobjectMethods<'a, C> {
6850    /// Create a builder to help you perform the following task:
6851    ///
6852    /// Adds a message to the loyalty object referenced by the given object ID.
6853    ///
6854    /// # Arguments
6855    ///
6856    /// * `request` - No description provided.
6857    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6858    pub fn addmessage(
6859        &self,
6860        request: AddMessageRequest,
6861        resource_id: &str,
6862    ) -> LoyaltyobjectAddmessageCall<'a, C> {
6863        LoyaltyobjectAddmessageCall {
6864            hub: self.hub,
6865            _request: request,
6866            _resource_id: resource_id.to_string(),
6867            _delegate: Default::default(),
6868            _additional_params: Default::default(),
6869            _scopes: Default::default(),
6870        }
6871    }
6872
6873    /// Create a builder to help you perform the following task:
6874    ///
6875    /// Returns the loyalty object with the given object ID.
6876    ///
6877    /// # Arguments
6878    ///
6879    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6880    pub fn get(&self, resource_id: &str) -> LoyaltyobjectGetCall<'a, C> {
6881        LoyaltyobjectGetCall {
6882            hub: self.hub,
6883            _resource_id: resource_id.to_string(),
6884            _delegate: Default::default(),
6885            _additional_params: Default::default(),
6886            _scopes: Default::default(),
6887        }
6888    }
6889
6890    /// Create a builder to help you perform the following task:
6891    ///
6892    /// Inserts an loyalty object with the given ID and properties.
6893    ///
6894    /// # Arguments
6895    ///
6896    /// * `request` - No description provided.
6897    pub fn insert(&self, request: LoyaltyObject) -> LoyaltyobjectInsertCall<'a, C> {
6898        LoyaltyobjectInsertCall {
6899            hub: self.hub,
6900            _request: request,
6901            _delegate: Default::default(),
6902            _additional_params: Default::default(),
6903            _scopes: Default::default(),
6904        }
6905    }
6906
6907    /// Create a builder to help you perform the following task:
6908    ///
6909    /// Returns a list of all loyalty objects for a given issuer ID.
6910    pub fn list(&self) -> LoyaltyobjectListCall<'a, C> {
6911        LoyaltyobjectListCall {
6912            hub: self.hub,
6913            _token: Default::default(),
6914            _max_results: Default::default(),
6915            _class_id: Default::default(),
6916            _delegate: Default::default(),
6917            _additional_params: Default::default(),
6918            _scopes: Default::default(),
6919        }
6920    }
6921
6922    /// Create a builder to help you perform the following task:
6923    ///
6924    /// Modifies linked offer objects for the loyalty object with the given ID.
6925    ///
6926    /// # Arguments
6927    ///
6928    /// * `request` - No description provided.
6929    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6930    pub fn modifylinkedofferobjects(
6931        &self,
6932        request: ModifyLinkedOfferObjectsRequest,
6933        resource_id: &str,
6934    ) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
6935        LoyaltyobjectModifylinkedofferobjectCall {
6936            hub: self.hub,
6937            _request: request,
6938            _resource_id: resource_id.to_string(),
6939            _delegate: Default::default(),
6940            _additional_params: Default::default(),
6941            _scopes: Default::default(),
6942        }
6943    }
6944
6945    /// Create a builder to help you perform the following task:
6946    ///
6947    /// Updates the loyalty object referenced by the given object ID. This method supports patch semantics.
6948    ///
6949    /// # Arguments
6950    ///
6951    /// * `request` - No description provided.
6952    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6953    pub fn patch(
6954        &self,
6955        request: LoyaltyObject,
6956        resource_id: &str,
6957    ) -> LoyaltyobjectPatchCall<'a, C> {
6958        LoyaltyobjectPatchCall {
6959            hub: self.hub,
6960            _request: request,
6961            _resource_id: resource_id.to_string(),
6962            _delegate: Default::default(),
6963            _additional_params: Default::default(),
6964            _scopes: Default::default(),
6965        }
6966    }
6967
6968    /// Create a builder to help you perform the following task:
6969    ///
6970    /// Updates the loyalty object referenced by the given object ID.
6971    ///
6972    /// # Arguments
6973    ///
6974    /// * `request` - No description provided.
6975    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
6976    pub fn update(
6977        &self,
6978        request: LoyaltyObject,
6979        resource_id: &str,
6980    ) -> LoyaltyobjectUpdateCall<'a, C> {
6981        LoyaltyobjectUpdateCall {
6982            hub: self.hub,
6983            _request: request,
6984            _resource_id: resource_id.to_string(),
6985            _delegate: Default::default(),
6986            _additional_params: Default::default(),
6987            _scopes: Default::default(),
6988        }
6989    }
6990}
6991
6992/// A builder providing access to all methods supported on *media* resources.
6993/// It is not used directly, but through the [`Walletobjects`] hub.
6994///
6995/// # Example
6996///
6997/// Instantiate a resource builder
6998///
6999/// ```test_harness,no_run
7000/// extern crate hyper;
7001/// extern crate hyper_rustls;
7002/// extern crate google_walletobjects1 as walletobjects1;
7003///
7004/// # async fn dox() {
7005/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7006///
7007/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7008/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7009///     .with_native_roots()
7010///     .unwrap()
7011///     .https_only()
7012///     .enable_http2()
7013///     .build();
7014///
7015/// let executor = hyper_util::rt::TokioExecutor::new();
7016/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7017///     secret,
7018///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7019///     yup_oauth2::client::CustomHyperClientBuilder::from(
7020///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7021///     ),
7022/// ).build().await.unwrap();
7023///
7024/// let client = hyper_util::client::legacy::Client::builder(
7025///     hyper_util::rt::TokioExecutor::new()
7026/// )
7027/// .build(
7028///     hyper_rustls::HttpsConnectorBuilder::new()
7029///         .with_native_roots()
7030///         .unwrap()
7031///         .https_or_http()
7032///         .enable_http2()
7033///         .build()
7034/// );
7035/// let mut hub = Walletobjects::new(client, auth);
7036/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7037/// // like `download(...)` and `upload(...)`
7038/// // to build up your call.
7039/// let rb = hub.media();
7040/// # }
7041/// ```
7042pub struct MediaMethods<'a, C>
7043where
7044    C: 'a,
7045{
7046    hub: &'a Walletobjects<C>,
7047}
7048
7049impl<'a, C> common::MethodsBuilder for MediaMethods<'a, C> {}
7050
7051impl<'a, C> MediaMethods<'a, C> {
7052    /// Create a builder to help you perform the following task:
7053    ///
7054    /// Downloads rotating barcode values for the transit object referenced by the given object ID.
7055    ///
7056    /// # Arguments
7057    ///
7058    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7059    pub fn download(&self, resource_id: &str) -> MediaDownloadCall<'a, C> {
7060        MediaDownloadCall {
7061            hub: self.hub,
7062            _resource_id: resource_id.to_string(),
7063            _delegate: Default::default(),
7064            _additional_params: Default::default(),
7065            _scopes: Default::default(),
7066        }
7067    }
7068
7069    /// Create a builder to help you perform the following task:
7070    ///
7071    /// Uploads rotating barcode values for the transit object referenced by the given object ID. Note the max upload size is specified in google3/production/config/cdd/apps-upload/customers/payments-consumer-passes/config.gcl and enforced by Scotty.
7072    ///
7073    /// # Arguments
7074    ///
7075    /// * `request` - No description provided.
7076    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7077    pub fn upload(
7078        &self,
7079        request: TransitObjectUploadRotatingBarcodeValuesRequest,
7080        resource_id: &str,
7081    ) -> MediaUploadCall<'a, C> {
7082        MediaUploadCall {
7083            hub: self.hub,
7084            _request: request,
7085            _resource_id: resource_id.to_string(),
7086            _delegate: Default::default(),
7087            _additional_params: Default::default(),
7088            _scopes: Default::default(),
7089        }
7090    }
7091}
7092
7093/// A builder providing access to all methods supported on *offerclas* resources.
7094/// It is not used directly, but through the [`Walletobjects`] hub.
7095///
7096/// # Example
7097///
7098/// Instantiate a resource builder
7099///
7100/// ```test_harness,no_run
7101/// extern crate hyper;
7102/// extern crate hyper_rustls;
7103/// extern crate google_walletobjects1 as walletobjects1;
7104///
7105/// # async fn dox() {
7106/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7107///
7108/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7109/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7110///     .with_native_roots()
7111///     .unwrap()
7112///     .https_only()
7113///     .enable_http2()
7114///     .build();
7115///
7116/// let executor = hyper_util::rt::TokioExecutor::new();
7117/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7118///     secret,
7119///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7120///     yup_oauth2::client::CustomHyperClientBuilder::from(
7121///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7122///     ),
7123/// ).build().await.unwrap();
7124///
7125/// let client = hyper_util::client::legacy::Client::builder(
7126///     hyper_util::rt::TokioExecutor::new()
7127/// )
7128/// .build(
7129///     hyper_rustls::HttpsConnectorBuilder::new()
7130///         .with_native_roots()
7131///         .unwrap()
7132///         .https_or_http()
7133///         .enable_http2()
7134///         .build()
7135/// );
7136/// let mut hub = Walletobjects::new(client, auth);
7137/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7138/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
7139/// // to build up your call.
7140/// let rb = hub.offerclass();
7141/// # }
7142/// ```
7143pub struct OfferclasMethods<'a, C>
7144where
7145    C: 'a,
7146{
7147    hub: &'a Walletobjects<C>,
7148}
7149
7150impl<'a, C> common::MethodsBuilder for OfferclasMethods<'a, C> {}
7151
7152impl<'a, C> OfferclasMethods<'a, C> {
7153    /// Create a builder to help you perform the following task:
7154    ///
7155    /// Adds a message to the offer class referenced by the given class ID.
7156    ///
7157    /// # Arguments
7158    ///
7159    /// * `request` - No description provided.
7160    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7161    pub fn addmessage(
7162        &self,
7163        request: AddMessageRequest,
7164        resource_id: &str,
7165    ) -> OfferclasAddmessageCall<'a, C> {
7166        OfferclasAddmessageCall {
7167            hub: self.hub,
7168            _request: request,
7169            _resource_id: resource_id.to_string(),
7170            _delegate: Default::default(),
7171            _additional_params: Default::default(),
7172            _scopes: Default::default(),
7173        }
7174    }
7175
7176    /// Create a builder to help you perform the following task:
7177    ///
7178    /// Returns the offer class with the given class ID.
7179    ///
7180    /// # Arguments
7181    ///
7182    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7183    pub fn get(&self, resource_id: &str) -> OfferclasGetCall<'a, C> {
7184        OfferclasGetCall {
7185            hub: self.hub,
7186            _resource_id: resource_id.to_string(),
7187            _delegate: Default::default(),
7188            _additional_params: Default::default(),
7189            _scopes: Default::default(),
7190        }
7191    }
7192
7193    /// Create a builder to help you perform the following task:
7194    ///
7195    /// Inserts an offer class with the given ID and properties.
7196    ///
7197    /// # Arguments
7198    ///
7199    /// * `request` - No description provided.
7200    pub fn insert(&self, request: OfferClass) -> OfferclasInsertCall<'a, C> {
7201        OfferclasInsertCall {
7202            hub: self.hub,
7203            _request: request,
7204            _delegate: Default::default(),
7205            _additional_params: Default::default(),
7206            _scopes: Default::default(),
7207        }
7208    }
7209
7210    /// Create a builder to help you perform the following task:
7211    ///
7212    /// Returns a list of all offer classes for a given issuer ID.
7213    pub fn list(&self) -> OfferclasListCall<'a, C> {
7214        OfferclasListCall {
7215            hub: self.hub,
7216            _token: Default::default(),
7217            _max_results: Default::default(),
7218            _issuer_id: Default::default(),
7219            _delegate: Default::default(),
7220            _additional_params: Default::default(),
7221            _scopes: Default::default(),
7222        }
7223    }
7224
7225    /// Create a builder to help you perform the following task:
7226    ///
7227    /// Updates the offer class referenced by the given class ID. This method supports patch semantics.
7228    ///
7229    /// # Arguments
7230    ///
7231    /// * `request` - No description provided.
7232    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7233    pub fn patch(&self, request: OfferClass, resource_id: &str) -> OfferclasPatchCall<'a, C> {
7234        OfferclasPatchCall {
7235            hub: self.hub,
7236            _request: request,
7237            _resource_id: resource_id.to_string(),
7238            _delegate: Default::default(),
7239            _additional_params: Default::default(),
7240            _scopes: Default::default(),
7241        }
7242    }
7243
7244    /// Create a builder to help you perform the following task:
7245    ///
7246    /// Updates the offer class referenced by the given class ID.
7247    ///
7248    /// # Arguments
7249    ///
7250    /// * `request` - No description provided.
7251    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7252    pub fn update(&self, request: OfferClass, resource_id: &str) -> OfferclasUpdateCall<'a, C> {
7253        OfferclasUpdateCall {
7254            hub: self.hub,
7255            _request: request,
7256            _resource_id: resource_id.to_string(),
7257            _delegate: Default::default(),
7258            _additional_params: Default::default(),
7259            _scopes: Default::default(),
7260        }
7261    }
7262}
7263
7264/// A builder providing access to all methods supported on *offerobject* resources.
7265/// It is not used directly, but through the [`Walletobjects`] hub.
7266///
7267/// # Example
7268///
7269/// Instantiate a resource builder
7270///
7271/// ```test_harness,no_run
7272/// extern crate hyper;
7273/// extern crate hyper_rustls;
7274/// extern crate google_walletobjects1 as walletobjects1;
7275///
7276/// # async fn dox() {
7277/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7278///
7279/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7280/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7281///     .with_native_roots()
7282///     .unwrap()
7283///     .https_only()
7284///     .enable_http2()
7285///     .build();
7286///
7287/// let executor = hyper_util::rt::TokioExecutor::new();
7288/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7289///     secret,
7290///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7291///     yup_oauth2::client::CustomHyperClientBuilder::from(
7292///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7293///     ),
7294/// ).build().await.unwrap();
7295///
7296/// let client = hyper_util::client::legacy::Client::builder(
7297///     hyper_util::rt::TokioExecutor::new()
7298/// )
7299/// .build(
7300///     hyper_rustls::HttpsConnectorBuilder::new()
7301///         .with_native_roots()
7302///         .unwrap()
7303///         .https_or_http()
7304///         .enable_http2()
7305///         .build()
7306/// );
7307/// let mut hub = Walletobjects::new(client, auth);
7308/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7309/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
7310/// // to build up your call.
7311/// let rb = hub.offerobject();
7312/// # }
7313/// ```
7314pub struct OfferobjectMethods<'a, C>
7315where
7316    C: 'a,
7317{
7318    hub: &'a Walletobjects<C>,
7319}
7320
7321impl<'a, C> common::MethodsBuilder for OfferobjectMethods<'a, C> {}
7322
7323impl<'a, C> OfferobjectMethods<'a, C> {
7324    /// Create a builder to help you perform the following task:
7325    ///
7326    /// Adds a message to the offer object referenced by the given object ID.
7327    ///
7328    /// # Arguments
7329    ///
7330    /// * `request` - No description provided.
7331    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7332    pub fn addmessage(
7333        &self,
7334        request: AddMessageRequest,
7335        resource_id: &str,
7336    ) -> OfferobjectAddmessageCall<'a, C> {
7337        OfferobjectAddmessageCall {
7338            hub: self.hub,
7339            _request: request,
7340            _resource_id: resource_id.to_string(),
7341            _delegate: Default::default(),
7342            _additional_params: Default::default(),
7343            _scopes: Default::default(),
7344        }
7345    }
7346
7347    /// Create a builder to help you perform the following task:
7348    ///
7349    /// Returns the offer object with the given object ID.
7350    ///
7351    /// # Arguments
7352    ///
7353    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7354    pub fn get(&self, resource_id: &str) -> OfferobjectGetCall<'a, C> {
7355        OfferobjectGetCall {
7356            hub: self.hub,
7357            _resource_id: resource_id.to_string(),
7358            _delegate: Default::default(),
7359            _additional_params: Default::default(),
7360            _scopes: Default::default(),
7361        }
7362    }
7363
7364    /// Create a builder to help you perform the following task:
7365    ///
7366    /// Inserts an offer object with the given ID and properties.
7367    ///
7368    /// # Arguments
7369    ///
7370    /// * `request` - No description provided.
7371    pub fn insert(&self, request: OfferObject) -> OfferobjectInsertCall<'a, C> {
7372        OfferobjectInsertCall {
7373            hub: self.hub,
7374            _request: request,
7375            _delegate: Default::default(),
7376            _additional_params: Default::default(),
7377            _scopes: Default::default(),
7378        }
7379    }
7380
7381    /// Create a builder to help you perform the following task:
7382    ///
7383    /// Returns a list of all offer objects for a given issuer ID.
7384    pub fn list(&self) -> OfferobjectListCall<'a, C> {
7385        OfferobjectListCall {
7386            hub: self.hub,
7387            _token: Default::default(),
7388            _max_results: Default::default(),
7389            _class_id: Default::default(),
7390            _delegate: Default::default(),
7391            _additional_params: Default::default(),
7392            _scopes: Default::default(),
7393        }
7394    }
7395
7396    /// Create a builder to help you perform the following task:
7397    ///
7398    /// Updates the offer object referenced by the given object ID. This method supports patch semantics.
7399    ///
7400    /// # Arguments
7401    ///
7402    /// * `request` - No description provided.
7403    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7404    pub fn patch(&self, request: OfferObject, resource_id: &str) -> OfferobjectPatchCall<'a, C> {
7405        OfferobjectPatchCall {
7406            hub: self.hub,
7407            _request: request,
7408            _resource_id: resource_id.to_string(),
7409            _delegate: Default::default(),
7410            _additional_params: Default::default(),
7411            _scopes: Default::default(),
7412        }
7413    }
7414
7415    /// Create a builder to help you perform the following task:
7416    ///
7417    /// Updates the offer object referenced by the given object ID.
7418    ///
7419    /// # Arguments
7420    ///
7421    /// * `request` - No description provided.
7422    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7423    pub fn update(&self, request: OfferObject, resource_id: &str) -> OfferobjectUpdateCall<'a, C> {
7424        OfferobjectUpdateCall {
7425            hub: self.hub,
7426            _request: request,
7427            _resource_id: resource_id.to_string(),
7428            _delegate: Default::default(),
7429            _additional_params: Default::default(),
7430            _scopes: Default::default(),
7431        }
7432    }
7433}
7434
7435/// A builder providing access to all methods supported on *permission* resources.
7436/// It is not used directly, but through the [`Walletobjects`] hub.
7437///
7438/// # Example
7439///
7440/// Instantiate a resource builder
7441///
7442/// ```test_harness,no_run
7443/// extern crate hyper;
7444/// extern crate hyper_rustls;
7445/// extern crate google_walletobjects1 as walletobjects1;
7446///
7447/// # async fn dox() {
7448/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7449///
7450/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7451/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7452///     .with_native_roots()
7453///     .unwrap()
7454///     .https_only()
7455///     .enable_http2()
7456///     .build();
7457///
7458/// let executor = hyper_util::rt::TokioExecutor::new();
7459/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7460///     secret,
7461///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7462///     yup_oauth2::client::CustomHyperClientBuilder::from(
7463///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7464///     ),
7465/// ).build().await.unwrap();
7466///
7467/// let client = hyper_util::client::legacy::Client::builder(
7468///     hyper_util::rt::TokioExecutor::new()
7469/// )
7470/// .build(
7471///     hyper_rustls::HttpsConnectorBuilder::new()
7472///         .with_native_roots()
7473///         .unwrap()
7474///         .https_or_http()
7475///         .enable_http2()
7476///         .build()
7477/// );
7478/// let mut hub = Walletobjects::new(client, auth);
7479/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7480/// // like `get(...)` and `update(...)`
7481/// // to build up your call.
7482/// let rb = hub.permissions();
7483/// # }
7484/// ```
7485pub struct PermissionMethods<'a, C>
7486where
7487    C: 'a,
7488{
7489    hub: &'a Walletobjects<C>,
7490}
7491
7492impl<'a, C> common::MethodsBuilder for PermissionMethods<'a, C> {}
7493
7494impl<'a, C> PermissionMethods<'a, C> {
7495    /// Create a builder to help you perform the following task:
7496    ///
7497    /// Returns the permissions for the given issuer id.
7498    ///
7499    /// # Arguments
7500    ///
7501    /// * `resourceId` - The unique identifier for an issuer. This ID must be unique across all issuers.
7502    pub fn get(&self, resource_id: i64) -> PermissionGetCall<'a, C> {
7503        PermissionGetCall {
7504            hub: self.hub,
7505            _resource_id: resource_id,
7506            _delegate: Default::default(),
7507            _additional_params: Default::default(),
7508            _scopes: Default::default(),
7509        }
7510    }
7511
7512    /// Create a builder to help you perform the following task:
7513    ///
7514    /// Updates the permissions for the given issuer.
7515    ///
7516    /// # Arguments
7517    ///
7518    /// * `request` - No description provided.
7519    /// * `resourceId` - The unique identifier for an issuer. This ID must be unique across all issuers.
7520    pub fn update(&self, request: Permissions, resource_id: i64) -> PermissionUpdateCall<'a, C> {
7521        PermissionUpdateCall {
7522            hub: self.hub,
7523            _request: request,
7524            _resource_id: resource_id,
7525            _delegate: Default::default(),
7526            _additional_params: Default::default(),
7527            _scopes: Default::default(),
7528        }
7529    }
7530}
7531
7532/// A builder providing access to all methods supported on *smarttap* resources.
7533/// It is not used directly, but through the [`Walletobjects`] hub.
7534///
7535/// # Example
7536///
7537/// Instantiate a resource builder
7538///
7539/// ```test_harness,no_run
7540/// extern crate hyper;
7541/// extern crate hyper_rustls;
7542/// extern crate google_walletobjects1 as walletobjects1;
7543///
7544/// # async fn dox() {
7545/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7546///
7547/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7548/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7549///     .with_native_roots()
7550///     .unwrap()
7551///     .https_only()
7552///     .enable_http2()
7553///     .build();
7554///
7555/// let executor = hyper_util::rt::TokioExecutor::new();
7556/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7557///     secret,
7558///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7559///     yup_oauth2::client::CustomHyperClientBuilder::from(
7560///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7561///     ),
7562/// ).build().await.unwrap();
7563///
7564/// let client = hyper_util::client::legacy::Client::builder(
7565///     hyper_util::rt::TokioExecutor::new()
7566/// )
7567/// .build(
7568///     hyper_rustls::HttpsConnectorBuilder::new()
7569///         .with_native_roots()
7570///         .unwrap()
7571///         .https_or_http()
7572///         .enable_http2()
7573///         .build()
7574/// );
7575/// let mut hub = Walletobjects::new(client, auth);
7576/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7577/// // like `insert(...)`
7578/// // to build up your call.
7579/// let rb = hub.smarttap();
7580/// # }
7581/// ```
7582pub struct SmarttapMethods<'a, C>
7583where
7584    C: 'a,
7585{
7586    hub: &'a Walletobjects<C>,
7587}
7588
7589impl<'a, C> common::MethodsBuilder for SmarttapMethods<'a, C> {}
7590
7591impl<'a, C> SmarttapMethods<'a, C> {
7592    /// Create a builder to help you perform the following task:
7593    ///
7594    /// Inserts the smart tap.
7595    ///
7596    /// # Arguments
7597    ///
7598    /// * `request` - No description provided.
7599    pub fn insert(&self, request: SmartTap) -> SmarttapInsertCall<'a, C> {
7600        SmarttapInsertCall {
7601            hub: self.hub,
7602            _request: request,
7603            _delegate: Default::default(),
7604            _additional_params: Default::default(),
7605            _scopes: Default::default(),
7606        }
7607    }
7608}
7609
7610/// A builder providing access to all methods supported on *transitclas* resources.
7611/// It is not used directly, but through the [`Walletobjects`] hub.
7612///
7613/// # Example
7614///
7615/// Instantiate a resource builder
7616///
7617/// ```test_harness,no_run
7618/// extern crate hyper;
7619/// extern crate hyper_rustls;
7620/// extern crate google_walletobjects1 as walletobjects1;
7621///
7622/// # async fn dox() {
7623/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7624///
7625/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7626/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7627///     .with_native_roots()
7628///     .unwrap()
7629///     .https_only()
7630///     .enable_http2()
7631///     .build();
7632///
7633/// let executor = hyper_util::rt::TokioExecutor::new();
7634/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7635///     secret,
7636///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7637///     yup_oauth2::client::CustomHyperClientBuilder::from(
7638///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7639///     ),
7640/// ).build().await.unwrap();
7641///
7642/// let client = hyper_util::client::legacy::Client::builder(
7643///     hyper_util::rt::TokioExecutor::new()
7644/// )
7645/// .build(
7646///     hyper_rustls::HttpsConnectorBuilder::new()
7647///         .with_native_roots()
7648///         .unwrap()
7649///         .https_or_http()
7650///         .enable_http2()
7651///         .build()
7652/// );
7653/// let mut hub = Walletobjects::new(client, auth);
7654/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7655/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
7656/// // to build up your call.
7657/// let rb = hub.transitclass();
7658/// # }
7659/// ```
7660pub struct TransitclasMethods<'a, C>
7661where
7662    C: 'a,
7663{
7664    hub: &'a Walletobjects<C>,
7665}
7666
7667impl<'a, C> common::MethodsBuilder for TransitclasMethods<'a, C> {}
7668
7669impl<'a, C> TransitclasMethods<'a, C> {
7670    /// Create a builder to help you perform the following task:
7671    ///
7672    /// Adds a message to the transit class referenced by the given class ID.
7673    ///
7674    /// # Arguments
7675    ///
7676    /// * `request` - No description provided.
7677    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7678    pub fn addmessage(
7679        &self,
7680        request: AddMessageRequest,
7681        resource_id: &str,
7682    ) -> TransitclasAddmessageCall<'a, C> {
7683        TransitclasAddmessageCall {
7684            hub: self.hub,
7685            _request: request,
7686            _resource_id: resource_id.to_string(),
7687            _delegate: Default::default(),
7688            _additional_params: Default::default(),
7689            _scopes: Default::default(),
7690        }
7691    }
7692
7693    /// Create a builder to help you perform the following task:
7694    ///
7695    /// Returns the transit class with the given class ID.
7696    ///
7697    /// # Arguments
7698    ///
7699    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7700    pub fn get(&self, resource_id: &str) -> TransitclasGetCall<'a, C> {
7701        TransitclasGetCall {
7702            hub: self.hub,
7703            _resource_id: resource_id.to_string(),
7704            _delegate: Default::default(),
7705            _additional_params: Default::default(),
7706            _scopes: Default::default(),
7707        }
7708    }
7709
7710    /// Create a builder to help you perform the following task:
7711    ///
7712    /// Inserts a transit class with the given ID and properties.
7713    ///
7714    /// # Arguments
7715    ///
7716    /// * `request` - No description provided.
7717    pub fn insert(&self, request: TransitClass) -> TransitclasInsertCall<'a, C> {
7718        TransitclasInsertCall {
7719            hub: self.hub,
7720            _request: request,
7721            _delegate: Default::default(),
7722            _additional_params: Default::default(),
7723            _scopes: Default::default(),
7724        }
7725    }
7726
7727    /// Create a builder to help you perform the following task:
7728    ///
7729    /// Returns a list of all transit classes for a given issuer ID.
7730    pub fn list(&self) -> TransitclasListCall<'a, C> {
7731        TransitclasListCall {
7732            hub: self.hub,
7733            _token: Default::default(),
7734            _max_results: Default::default(),
7735            _issuer_id: Default::default(),
7736            _delegate: Default::default(),
7737            _additional_params: Default::default(),
7738            _scopes: Default::default(),
7739        }
7740    }
7741
7742    /// Create a builder to help you perform the following task:
7743    ///
7744    /// Updates the transit class referenced by the given class ID. This method supports patch semantics.
7745    ///
7746    /// # Arguments
7747    ///
7748    /// * `request` - No description provided.
7749    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7750    pub fn patch(&self, request: TransitClass, resource_id: &str) -> TransitclasPatchCall<'a, C> {
7751        TransitclasPatchCall {
7752            hub: self.hub,
7753            _request: request,
7754            _resource_id: resource_id.to_string(),
7755            _delegate: Default::default(),
7756            _additional_params: Default::default(),
7757            _scopes: Default::default(),
7758        }
7759    }
7760
7761    /// Create a builder to help you perform the following task:
7762    ///
7763    /// Updates the transit class referenced by the given class ID.
7764    ///
7765    /// # Arguments
7766    ///
7767    /// * `request` - No description provided.
7768    /// * `resourceId` - The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7769    pub fn update(&self, request: TransitClass, resource_id: &str) -> TransitclasUpdateCall<'a, C> {
7770        TransitclasUpdateCall {
7771            hub: self.hub,
7772            _request: request,
7773            _resource_id: resource_id.to_string(),
7774            _delegate: Default::default(),
7775            _additional_params: Default::default(),
7776            _scopes: Default::default(),
7777        }
7778    }
7779}
7780
7781/// A builder providing access to all methods supported on *transitobject* resources.
7782/// It is not used directly, but through the [`Walletobjects`] hub.
7783///
7784/// # Example
7785///
7786/// Instantiate a resource builder
7787///
7788/// ```test_harness,no_run
7789/// extern crate hyper;
7790/// extern crate hyper_rustls;
7791/// extern crate google_walletobjects1 as walletobjects1;
7792///
7793/// # async fn dox() {
7794/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7795///
7796/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7797/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7798///     .with_native_roots()
7799///     .unwrap()
7800///     .https_only()
7801///     .enable_http2()
7802///     .build();
7803///
7804/// let executor = hyper_util::rt::TokioExecutor::new();
7805/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7806///     secret,
7807///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7808///     yup_oauth2::client::CustomHyperClientBuilder::from(
7809///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7810///     ),
7811/// ).build().await.unwrap();
7812///
7813/// let client = hyper_util::client::legacy::Client::builder(
7814///     hyper_util::rt::TokioExecutor::new()
7815/// )
7816/// .build(
7817///     hyper_rustls::HttpsConnectorBuilder::new()
7818///         .with_native_roots()
7819///         .unwrap()
7820///         .https_or_http()
7821///         .enable_http2()
7822///         .build()
7823/// );
7824/// let mut hub = Walletobjects::new(client, auth);
7825/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7826/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
7827/// // to build up your call.
7828/// let rb = hub.transitobject();
7829/// # }
7830/// ```
7831pub struct TransitobjectMethods<'a, C>
7832where
7833    C: 'a,
7834{
7835    hub: &'a Walletobjects<C>,
7836}
7837
7838impl<'a, C> common::MethodsBuilder for TransitobjectMethods<'a, C> {}
7839
7840impl<'a, C> TransitobjectMethods<'a, C> {
7841    /// Create a builder to help you perform the following task:
7842    ///
7843    /// Adds a message to the transit object referenced by the given object ID.
7844    ///
7845    /// # Arguments
7846    ///
7847    /// * `request` - No description provided.
7848    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7849    pub fn addmessage(
7850        &self,
7851        request: AddMessageRequest,
7852        resource_id: &str,
7853    ) -> TransitobjectAddmessageCall<'a, C> {
7854        TransitobjectAddmessageCall {
7855            hub: self.hub,
7856            _request: request,
7857            _resource_id: resource_id.to_string(),
7858            _delegate: Default::default(),
7859            _additional_params: Default::default(),
7860            _scopes: Default::default(),
7861        }
7862    }
7863
7864    /// Create a builder to help you perform the following task:
7865    ///
7866    /// Returns the transit object with the given object ID.
7867    ///
7868    /// # Arguments
7869    ///
7870    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7871    pub fn get(&self, resource_id: &str) -> TransitobjectGetCall<'a, C> {
7872        TransitobjectGetCall {
7873            hub: self.hub,
7874            _resource_id: resource_id.to_string(),
7875            _delegate: Default::default(),
7876            _additional_params: Default::default(),
7877            _scopes: Default::default(),
7878        }
7879    }
7880
7881    /// Create a builder to help you perform the following task:
7882    ///
7883    /// Inserts an transit object with the given ID and properties.
7884    ///
7885    /// # Arguments
7886    ///
7887    /// * `request` - No description provided.
7888    pub fn insert(&self, request: TransitObject) -> TransitobjectInsertCall<'a, C> {
7889        TransitobjectInsertCall {
7890            hub: self.hub,
7891            _request: request,
7892            _delegate: Default::default(),
7893            _additional_params: Default::default(),
7894            _scopes: Default::default(),
7895        }
7896    }
7897
7898    /// Create a builder to help you perform the following task:
7899    ///
7900    /// Returns a list of all transit objects for a given issuer ID.
7901    pub fn list(&self) -> TransitobjectListCall<'a, C> {
7902        TransitobjectListCall {
7903            hub: self.hub,
7904            _token: Default::default(),
7905            _max_results: Default::default(),
7906            _class_id: Default::default(),
7907            _delegate: Default::default(),
7908            _additional_params: Default::default(),
7909            _scopes: Default::default(),
7910        }
7911    }
7912
7913    /// Create a builder to help you perform the following task:
7914    ///
7915    /// Updates the transit object referenced by the given object ID. This method supports patch semantics.
7916    ///
7917    /// # Arguments
7918    ///
7919    /// * `request` - No description provided.
7920    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7921    pub fn patch(
7922        &self,
7923        request: TransitObject,
7924        resource_id: &str,
7925    ) -> TransitobjectPatchCall<'a, C> {
7926        TransitobjectPatchCall {
7927            hub: self.hub,
7928            _request: request,
7929            _resource_id: resource_id.to_string(),
7930            _delegate: Default::default(),
7931            _additional_params: Default::default(),
7932            _scopes: Default::default(),
7933        }
7934    }
7935
7936    /// Create a builder to help you perform the following task:
7937    ///
7938    /// Updates the transit object referenced by the given object ID.
7939    ///
7940    /// # Arguments
7941    ///
7942    /// * `request` - No description provided.
7943    /// * `resourceId` - The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
7944    pub fn update(
7945        &self,
7946        request: TransitObject,
7947        resource_id: &str,
7948    ) -> TransitobjectUpdateCall<'a, C> {
7949        TransitobjectUpdateCall {
7950            hub: self.hub,
7951            _request: request,
7952            _resource_id: resource_id.to_string(),
7953            _delegate: Default::default(),
7954            _additional_params: Default::default(),
7955            _scopes: Default::default(),
7956        }
7957    }
7958}
7959
7960/// A builder providing access to all methods supported on *walletobject* resources.
7961/// It is not used directly, but through the [`Walletobjects`] hub.
7962///
7963/// # Example
7964///
7965/// Instantiate a resource builder
7966///
7967/// ```test_harness,no_run
7968/// extern crate hyper;
7969/// extern crate hyper_rustls;
7970/// extern crate google_walletobjects1 as walletobjects1;
7971///
7972/// # async fn dox() {
7973/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7974///
7975/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7976/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7977///     .with_native_roots()
7978///     .unwrap()
7979///     .https_only()
7980///     .enable_http2()
7981///     .build();
7982///
7983/// let executor = hyper_util::rt::TokioExecutor::new();
7984/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7985///     secret,
7986///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7987///     yup_oauth2::client::CustomHyperClientBuilder::from(
7988///         hyper_util::client::legacy::Client::builder(executor).build(connector),
7989///     ),
7990/// ).build().await.unwrap();
7991///
7992/// let client = hyper_util::client::legacy::Client::builder(
7993///     hyper_util::rt::TokioExecutor::new()
7994/// )
7995/// .build(
7996///     hyper_rustls::HttpsConnectorBuilder::new()
7997///         .with_native_roots()
7998///         .unwrap()
7999///         .https_or_http()
8000///         .enable_http2()
8001///         .build()
8002/// );
8003/// let mut hub = Walletobjects::new(client, auth);
8004/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8005/// // like `v1_private_content_set_pass_update_notice(...)`
8006/// // to build up your call.
8007/// let rb = hub.walletobjects();
8008/// # }
8009/// ```
8010pub struct WalletobjectMethods<'a, C>
8011where
8012    C: 'a,
8013{
8014    hub: &'a Walletobjects<C>,
8015}
8016
8017impl<'a, C> common::MethodsBuilder for WalletobjectMethods<'a, C> {}
8018
8019impl<'a, C> WalletobjectMethods<'a, C> {
8020    /// Create a builder to help you perform the following task:
8021    ///
8022    /// Provide Google with information about awaiting private pass update. This will allow Google to provide the update notification to the device that currently holds this pass.
8023    ///
8024    /// # Arguments
8025    ///
8026    /// * `request` - No description provided.
8027    pub fn v1_private_content_set_pass_update_notice(
8028        &self,
8029        request: SetPassUpdateNoticeRequest,
8030    ) -> WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C> {
8031        WalletobjectV1PrivateContentSetPassUpdateNoticeCall {
8032            hub: self.hub,
8033            _request: request,
8034            _delegate: Default::default(),
8035            _additional_params: Default::default(),
8036            _scopes: Default::default(),
8037        }
8038    }
8039}
8040
8041// ###################
8042// CallBuilders   ###
8043// #################
8044
8045/// Adds a message to the event ticket class referenced by the given class ID.
8046///
8047/// A builder for the *addmessage* method supported by a *eventticketclas* resource.
8048/// It is not used directly, but through a [`EventticketclasMethods`] instance.
8049///
8050/// # Example
8051///
8052/// Instantiate a resource method builder
8053///
8054/// ```test_harness,no_run
8055/// # extern crate hyper;
8056/// # extern crate hyper_rustls;
8057/// # extern crate google_walletobjects1 as walletobjects1;
8058/// use walletobjects1::api::AddMessageRequest;
8059/// # async fn dox() {
8060/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8061///
8062/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8063/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8064/// #     .with_native_roots()
8065/// #     .unwrap()
8066/// #     .https_only()
8067/// #     .enable_http2()
8068/// #     .build();
8069///
8070/// # let executor = hyper_util::rt::TokioExecutor::new();
8071/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8072/// #     secret,
8073/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8074/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8075/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8076/// #     ),
8077/// # ).build().await.unwrap();
8078///
8079/// # let client = hyper_util::client::legacy::Client::builder(
8080/// #     hyper_util::rt::TokioExecutor::new()
8081/// # )
8082/// # .build(
8083/// #     hyper_rustls::HttpsConnectorBuilder::new()
8084/// #         .with_native_roots()
8085/// #         .unwrap()
8086/// #         .https_or_http()
8087/// #         .enable_http2()
8088/// #         .build()
8089/// # );
8090/// # let mut hub = Walletobjects::new(client, auth);
8091/// // As the method needs a request, you would usually fill it with the desired information
8092/// // into the respective structure. Some of the parts shown here might not be applicable !
8093/// // Values shown here are possibly random and not representative !
8094/// let mut req = AddMessageRequest::default();
8095///
8096/// // You can configure optional parameters by calling the respective setters at will, and
8097/// // execute the final call using `doit()`.
8098/// // Values shown here are possibly random and not representative !
8099/// let result = hub.eventticketclass().addmessage(req, "resourceId")
8100///              .doit().await;
8101/// # }
8102/// ```
8103pub struct EventticketclasAddmessageCall<'a, C>
8104where
8105    C: 'a,
8106{
8107    hub: &'a Walletobjects<C>,
8108    _request: AddMessageRequest,
8109    _resource_id: String,
8110    _delegate: Option<&'a mut dyn common::Delegate>,
8111    _additional_params: HashMap<String, String>,
8112    _scopes: BTreeSet<String>,
8113}
8114
8115impl<'a, C> common::CallBuilder for EventticketclasAddmessageCall<'a, C> {}
8116
8117impl<'a, C> EventticketclasAddmessageCall<'a, C>
8118where
8119    C: common::Connector,
8120{
8121    /// Perform the operation you have build so far.
8122    pub async fn doit(
8123        mut self,
8124    ) -> common::Result<(common::Response, EventTicketClassAddMessageResponse)> {
8125        use std::borrow::Cow;
8126        use std::io::{Read, Seek};
8127
8128        use common::{url::Params, ToParts};
8129        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8130
8131        let mut dd = common::DefaultDelegate;
8132        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8133        dlg.begin(common::MethodInfo {
8134            id: "walletobjects.eventticketclass.addmessage",
8135            http_method: hyper::Method::POST,
8136        });
8137
8138        for &field in ["alt", "resourceId"].iter() {
8139            if self._additional_params.contains_key(field) {
8140                dlg.finished(false);
8141                return Err(common::Error::FieldClash(field));
8142            }
8143        }
8144
8145        let mut params = Params::with_capacity(4 + self._additional_params.len());
8146        params.push("resourceId", self._resource_id);
8147
8148        params.extend(self._additional_params.iter());
8149
8150        params.push("alt", "json");
8151        let mut url = self.hub._base_url.clone()
8152            + "walletobjects/v1/eventTicketClass/{resourceId}/addMessage";
8153        if self._scopes.is_empty() {
8154            self._scopes
8155                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
8156        }
8157
8158        #[allow(clippy::single_element_loop)]
8159        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
8160            url = params.uri_replacement(url, param_name, find_this, false);
8161        }
8162        {
8163            let to_remove = ["resourceId"];
8164            params.remove_params(&to_remove);
8165        }
8166
8167        let url = params.parse_with_url(&url);
8168
8169        let mut json_mime_type = mime::APPLICATION_JSON;
8170        let mut request_value_reader = {
8171            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8172            common::remove_json_null_values(&mut value);
8173            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8174            serde_json::to_writer(&mut dst, &value).unwrap();
8175            dst
8176        };
8177        let request_size = request_value_reader
8178            .seek(std::io::SeekFrom::End(0))
8179            .unwrap();
8180        request_value_reader
8181            .seek(std::io::SeekFrom::Start(0))
8182            .unwrap();
8183
8184        loop {
8185            let token = match self
8186                .hub
8187                .auth
8188                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8189                .await
8190            {
8191                Ok(token) => token,
8192                Err(e) => match dlg.token(e) {
8193                    Ok(token) => token,
8194                    Err(e) => {
8195                        dlg.finished(false);
8196                        return Err(common::Error::MissingToken(e));
8197                    }
8198                },
8199            };
8200            request_value_reader
8201                .seek(std::io::SeekFrom::Start(0))
8202                .unwrap();
8203            let mut req_result = {
8204                let client = &self.hub.client;
8205                dlg.pre_request();
8206                let mut req_builder = hyper::Request::builder()
8207                    .method(hyper::Method::POST)
8208                    .uri(url.as_str())
8209                    .header(USER_AGENT, self.hub._user_agent.clone());
8210
8211                if let Some(token) = token.as_ref() {
8212                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8213                }
8214
8215                let request = req_builder
8216                    .header(CONTENT_TYPE, json_mime_type.to_string())
8217                    .header(CONTENT_LENGTH, request_size as u64)
8218                    .body(common::to_body(
8219                        request_value_reader.get_ref().clone().into(),
8220                    ));
8221
8222                client.request(request.unwrap()).await
8223            };
8224
8225            match req_result {
8226                Err(err) => {
8227                    if let common::Retry::After(d) = dlg.http_error(&err) {
8228                        sleep(d).await;
8229                        continue;
8230                    }
8231                    dlg.finished(false);
8232                    return Err(common::Error::HttpError(err));
8233                }
8234                Ok(res) => {
8235                    let (mut parts, body) = res.into_parts();
8236                    let mut body = common::Body::new(body);
8237                    if !parts.status.is_success() {
8238                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8239                        let error = serde_json::from_str(&common::to_string(&bytes));
8240                        let response = common::to_response(parts, bytes.into());
8241
8242                        if let common::Retry::After(d) =
8243                            dlg.http_failure(&response, error.as_ref().ok())
8244                        {
8245                            sleep(d).await;
8246                            continue;
8247                        }
8248
8249                        dlg.finished(false);
8250
8251                        return Err(match error {
8252                            Ok(value) => common::Error::BadRequest(value),
8253                            _ => common::Error::Failure(response),
8254                        });
8255                    }
8256                    let response = {
8257                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8258                        let encoded = common::to_string(&bytes);
8259                        match serde_json::from_str(&encoded) {
8260                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8261                            Err(error) => {
8262                                dlg.response_json_decode_error(&encoded, &error);
8263                                return Err(common::Error::JsonDecodeError(
8264                                    encoded.to_string(),
8265                                    error,
8266                                ));
8267                            }
8268                        }
8269                    };
8270
8271                    dlg.finished(true);
8272                    return Ok(response);
8273                }
8274            }
8275        }
8276    }
8277
8278    ///
8279    /// Sets the *request* property to the given value.
8280    ///
8281    /// Even though the property as already been set when instantiating this call,
8282    /// we provide this method for API completeness.
8283    pub fn request(mut self, new_value: AddMessageRequest) -> EventticketclasAddmessageCall<'a, C> {
8284        self._request = new_value;
8285        self
8286    }
8287    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
8288    ///
8289    /// Sets the *resource id* path property to the given value.
8290    ///
8291    /// Even though the property as already been set when instantiating this call,
8292    /// we provide this method for API completeness.
8293    pub fn resource_id(mut self, new_value: &str) -> EventticketclasAddmessageCall<'a, C> {
8294        self._resource_id = new_value.to_string();
8295        self
8296    }
8297    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8298    /// while executing the actual API request.
8299    ///
8300    /// ````text
8301    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8302    /// ````
8303    ///
8304    /// Sets the *delegate* property to the given value.
8305    pub fn delegate(
8306        mut self,
8307        new_value: &'a mut dyn common::Delegate,
8308    ) -> EventticketclasAddmessageCall<'a, C> {
8309        self._delegate = Some(new_value);
8310        self
8311    }
8312
8313    /// Set any additional parameter of the query string used in the request.
8314    /// It should be used to set parameters which are not yet available through their own
8315    /// setters.
8316    ///
8317    /// Please note that this method must not be used to set any of the known parameters
8318    /// which have their own setter method. If done anyway, the request will fail.
8319    ///
8320    /// # Additional Parameters
8321    ///
8322    /// * *$.xgafv* (query-string) - V1 error format.
8323    /// * *access_token* (query-string) - OAuth access token.
8324    /// * *alt* (query-string) - Data format for response.
8325    /// * *callback* (query-string) - JSONP
8326    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8327    /// * *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.
8328    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8329    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8330    /// * *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.
8331    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8332    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8333    pub fn param<T>(mut self, name: T, value: T) -> EventticketclasAddmessageCall<'a, C>
8334    where
8335        T: AsRef<str>,
8336    {
8337        self._additional_params
8338            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8339        self
8340    }
8341
8342    /// Identifies the authorization scope for the method you are building.
8343    ///
8344    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8345    /// [`Scope::WalletObjectIssuer`].
8346    ///
8347    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8348    /// tokens for more than one scope.
8349    ///
8350    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8351    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8352    /// sufficient, a read-write scope will do as well.
8353    pub fn add_scope<St>(mut self, scope: St) -> EventticketclasAddmessageCall<'a, C>
8354    where
8355        St: AsRef<str>,
8356    {
8357        self._scopes.insert(String::from(scope.as_ref()));
8358        self
8359    }
8360    /// Identifies the authorization scope(s) for the method you are building.
8361    ///
8362    /// See [`Self::add_scope()`] for details.
8363    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasAddmessageCall<'a, C>
8364    where
8365        I: IntoIterator<Item = St>,
8366        St: AsRef<str>,
8367    {
8368        self._scopes
8369            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8370        self
8371    }
8372
8373    /// Removes all scopes, and no default scope will be used either.
8374    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8375    /// for details).
8376    pub fn clear_scopes(mut self) -> EventticketclasAddmessageCall<'a, C> {
8377        self._scopes.clear();
8378        self
8379    }
8380}
8381
8382/// Returns the event ticket class with the given class ID.
8383///
8384/// A builder for the *get* method supported by a *eventticketclas* resource.
8385/// It is not used directly, but through a [`EventticketclasMethods`] instance.
8386///
8387/// # Example
8388///
8389/// Instantiate a resource method builder
8390///
8391/// ```test_harness,no_run
8392/// # extern crate hyper;
8393/// # extern crate hyper_rustls;
8394/// # extern crate google_walletobjects1 as walletobjects1;
8395/// # async fn dox() {
8396/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8397///
8398/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8399/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8400/// #     .with_native_roots()
8401/// #     .unwrap()
8402/// #     .https_only()
8403/// #     .enable_http2()
8404/// #     .build();
8405///
8406/// # let executor = hyper_util::rt::TokioExecutor::new();
8407/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8408/// #     secret,
8409/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8410/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8411/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8412/// #     ),
8413/// # ).build().await.unwrap();
8414///
8415/// # let client = hyper_util::client::legacy::Client::builder(
8416/// #     hyper_util::rt::TokioExecutor::new()
8417/// # )
8418/// # .build(
8419/// #     hyper_rustls::HttpsConnectorBuilder::new()
8420/// #         .with_native_roots()
8421/// #         .unwrap()
8422/// #         .https_or_http()
8423/// #         .enable_http2()
8424/// #         .build()
8425/// # );
8426/// # let mut hub = Walletobjects::new(client, auth);
8427/// // You can configure optional parameters by calling the respective setters at will, and
8428/// // execute the final call using `doit()`.
8429/// // Values shown here are possibly random and not representative !
8430/// let result = hub.eventticketclass().get("resourceId")
8431///              .doit().await;
8432/// # }
8433/// ```
8434pub struct EventticketclasGetCall<'a, C>
8435where
8436    C: 'a,
8437{
8438    hub: &'a Walletobjects<C>,
8439    _resource_id: String,
8440    _delegate: Option<&'a mut dyn common::Delegate>,
8441    _additional_params: HashMap<String, String>,
8442    _scopes: BTreeSet<String>,
8443}
8444
8445impl<'a, C> common::CallBuilder for EventticketclasGetCall<'a, C> {}
8446
8447impl<'a, C> EventticketclasGetCall<'a, C>
8448where
8449    C: common::Connector,
8450{
8451    /// Perform the operation you have build so far.
8452    pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketClass)> {
8453        use std::borrow::Cow;
8454        use std::io::{Read, Seek};
8455
8456        use common::{url::Params, ToParts};
8457        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8458
8459        let mut dd = common::DefaultDelegate;
8460        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8461        dlg.begin(common::MethodInfo {
8462            id: "walletobjects.eventticketclass.get",
8463            http_method: hyper::Method::GET,
8464        });
8465
8466        for &field in ["alt", "resourceId"].iter() {
8467            if self._additional_params.contains_key(field) {
8468                dlg.finished(false);
8469                return Err(common::Error::FieldClash(field));
8470            }
8471        }
8472
8473        let mut params = Params::with_capacity(3 + self._additional_params.len());
8474        params.push("resourceId", self._resource_id);
8475
8476        params.extend(self._additional_params.iter());
8477
8478        params.push("alt", "json");
8479        let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass/{resourceId}";
8480        if self._scopes.is_empty() {
8481            self._scopes
8482                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
8483        }
8484
8485        #[allow(clippy::single_element_loop)]
8486        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
8487            url = params.uri_replacement(url, param_name, find_this, false);
8488        }
8489        {
8490            let to_remove = ["resourceId"];
8491            params.remove_params(&to_remove);
8492        }
8493
8494        let url = params.parse_with_url(&url);
8495
8496        loop {
8497            let token = match self
8498                .hub
8499                .auth
8500                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8501                .await
8502            {
8503                Ok(token) => token,
8504                Err(e) => match dlg.token(e) {
8505                    Ok(token) => token,
8506                    Err(e) => {
8507                        dlg.finished(false);
8508                        return Err(common::Error::MissingToken(e));
8509                    }
8510                },
8511            };
8512            let mut req_result = {
8513                let client = &self.hub.client;
8514                dlg.pre_request();
8515                let mut req_builder = hyper::Request::builder()
8516                    .method(hyper::Method::GET)
8517                    .uri(url.as_str())
8518                    .header(USER_AGENT, self.hub._user_agent.clone());
8519
8520                if let Some(token) = token.as_ref() {
8521                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8522                }
8523
8524                let request = req_builder
8525                    .header(CONTENT_LENGTH, 0_u64)
8526                    .body(common::to_body::<String>(None));
8527
8528                client.request(request.unwrap()).await
8529            };
8530
8531            match req_result {
8532                Err(err) => {
8533                    if let common::Retry::After(d) = dlg.http_error(&err) {
8534                        sleep(d).await;
8535                        continue;
8536                    }
8537                    dlg.finished(false);
8538                    return Err(common::Error::HttpError(err));
8539                }
8540                Ok(res) => {
8541                    let (mut parts, body) = res.into_parts();
8542                    let mut body = common::Body::new(body);
8543                    if !parts.status.is_success() {
8544                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8545                        let error = serde_json::from_str(&common::to_string(&bytes));
8546                        let response = common::to_response(parts, bytes.into());
8547
8548                        if let common::Retry::After(d) =
8549                            dlg.http_failure(&response, error.as_ref().ok())
8550                        {
8551                            sleep(d).await;
8552                            continue;
8553                        }
8554
8555                        dlg.finished(false);
8556
8557                        return Err(match error {
8558                            Ok(value) => common::Error::BadRequest(value),
8559                            _ => common::Error::Failure(response),
8560                        });
8561                    }
8562                    let response = {
8563                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8564                        let encoded = common::to_string(&bytes);
8565                        match serde_json::from_str(&encoded) {
8566                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8567                            Err(error) => {
8568                                dlg.response_json_decode_error(&encoded, &error);
8569                                return Err(common::Error::JsonDecodeError(
8570                                    encoded.to_string(),
8571                                    error,
8572                                ));
8573                            }
8574                        }
8575                    };
8576
8577                    dlg.finished(true);
8578                    return Ok(response);
8579                }
8580            }
8581        }
8582    }
8583
8584    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
8585    ///
8586    /// Sets the *resource id* path property to the given value.
8587    ///
8588    /// Even though the property as already been set when instantiating this call,
8589    /// we provide this method for API completeness.
8590    pub fn resource_id(mut self, new_value: &str) -> EventticketclasGetCall<'a, C> {
8591        self._resource_id = new_value.to_string();
8592        self
8593    }
8594    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8595    /// while executing the actual API request.
8596    ///
8597    /// ````text
8598    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8599    /// ````
8600    ///
8601    /// Sets the *delegate* property to the given value.
8602    pub fn delegate(
8603        mut self,
8604        new_value: &'a mut dyn common::Delegate,
8605    ) -> EventticketclasGetCall<'a, C> {
8606        self._delegate = Some(new_value);
8607        self
8608    }
8609
8610    /// Set any additional parameter of the query string used in the request.
8611    /// It should be used to set parameters which are not yet available through their own
8612    /// setters.
8613    ///
8614    /// Please note that this method must not be used to set any of the known parameters
8615    /// which have their own setter method. If done anyway, the request will fail.
8616    ///
8617    /// # Additional Parameters
8618    ///
8619    /// * *$.xgafv* (query-string) - V1 error format.
8620    /// * *access_token* (query-string) - OAuth access token.
8621    /// * *alt* (query-string) - Data format for response.
8622    /// * *callback* (query-string) - JSONP
8623    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8624    /// * *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.
8625    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8626    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8627    /// * *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.
8628    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8629    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8630    pub fn param<T>(mut self, name: T, value: T) -> EventticketclasGetCall<'a, C>
8631    where
8632        T: AsRef<str>,
8633    {
8634        self._additional_params
8635            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8636        self
8637    }
8638
8639    /// Identifies the authorization scope for the method you are building.
8640    ///
8641    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8642    /// [`Scope::WalletObjectIssuer`].
8643    ///
8644    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8645    /// tokens for more than one scope.
8646    ///
8647    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8648    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8649    /// sufficient, a read-write scope will do as well.
8650    pub fn add_scope<St>(mut self, scope: St) -> EventticketclasGetCall<'a, C>
8651    where
8652        St: AsRef<str>,
8653    {
8654        self._scopes.insert(String::from(scope.as_ref()));
8655        self
8656    }
8657    /// Identifies the authorization scope(s) for the method you are building.
8658    ///
8659    /// See [`Self::add_scope()`] for details.
8660    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasGetCall<'a, C>
8661    where
8662        I: IntoIterator<Item = St>,
8663        St: AsRef<str>,
8664    {
8665        self._scopes
8666            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8667        self
8668    }
8669
8670    /// Removes all scopes, and no default scope will be used either.
8671    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8672    /// for details).
8673    pub fn clear_scopes(mut self) -> EventticketclasGetCall<'a, C> {
8674        self._scopes.clear();
8675        self
8676    }
8677}
8678
8679/// Inserts an event ticket class with the given ID and properties.
8680///
8681/// A builder for the *insert* method supported by a *eventticketclas* resource.
8682/// It is not used directly, but through a [`EventticketclasMethods`] instance.
8683///
8684/// # Example
8685///
8686/// Instantiate a resource method builder
8687///
8688/// ```test_harness,no_run
8689/// # extern crate hyper;
8690/// # extern crate hyper_rustls;
8691/// # extern crate google_walletobjects1 as walletobjects1;
8692/// use walletobjects1::api::EventTicketClass;
8693/// # async fn dox() {
8694/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8695///
8696/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8697/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8698/// #     .with_native_roots()
8699/// #     .unwrap()
8700/// #     .https_only()
8701/// #     .enable_http2()
8702/// #     .build();
8703///
8704/// # let executor = hyper_util::rt::TokioExecutor::new();
8705/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8706/// #     secret,
8707/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8708/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8709/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8710/// #     ),
8711/// # ).build().await.unwrap();
8712///
8713/// # let client = hyper_util::client::legacy::Client::builder(
8714/// #     hyper_util::rt::TokioExecutor::new()
8715/// # )
8716/// # .build(
8717/// #     hyper_rustls::HttpsConnectorBuilder::new()
8718/// #         .with_native_roots()
8719/// #         .unwrap()
8720/// #         .https_or_http()
8721/// #         .enable_http2()
8722/// #         .build()
8723/// # );
8724/// # let mut hub = Walletobjects::new(client, auth);
8725/// // As the method needs a request, you would usually fill it with the desired information
8726/// // into the respective structure. Some of the parts shown here might not be applicable !
8727/// // Values shown here are possibly random and not representative !
8728/// let mut req = EventTicketClass::default();
8729///
8730/// // You can configure optional parameters by calling the respective setters at will, and
8731/// // execute the final call using `doit()`.
8732/// // Values shown here are possibly random and not representative !
8733/// let result = hub.eventticketclass().insert(req)
8734///              .doit().await;
8735/// # }
8736/// ```
8737pub struct EventticketclasInsertCall<'a, C>
8738where
8739    C: 'a,
8740{
8741    hub: &'a Walletobjects<C>,
8742    _request: EventTicketClass,
8743    _delegate: Option<&'a mut dyn common::Delegate>,
8744    _additional_params: HashMap<String, String>,
8745    _scopes: BTreeSet<String>,
8746}
8747
8748impl<'a, C> common::CallBuilder for EventticketclasInsertCall<'a, C> {}
8749
8750impl<'a, C> EventticketclasInsertCall<'a, C>
8751where
8752    C: common::Connector,
8753{
8754    /// Perform the operation you have build so far.
8755    pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketClass)> {
8756        use std::borrow::Cow;
8757        use std::io::{Read, Seek};
8758
8759        use common::{url::Params, ToParts};
8760        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8761
8762        let mut dd = common::DefaultDelegate;
8763        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8764        dlg.begin(common::MethodInfo {
8765            id: "walletobjects.eventticketclass.insert",
8766            http_method: hyper::Method::POST,
8767        });
8768
8769        for &field in ["alt"].iter() {
8770            if self._additional_params.contains_key(field) {
8771                dlg.finished(false);
8772                return Err(common::Error::FieldClash(field));
8773            }
8774        }
8775
8776        let mut params = Params::with_capacity(3 + self._additional_params.len());
8777
8778        params.extend(self._additional_params.iter());
8779
8780        params.push("alt", "json");
8781        let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass";
8782        if self._scopes.is_empty() {
8783            self._scopes
8784                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
8785        }
8786
8787        let url = params.parse_with_url(&url);
8788
8789        let mut json_mime_type = mime::APPLICATION_JSON;
8790        let mut request_value_reader = {
8791            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8792            common::remove_json_null_values(&mut value);
8793            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8794            serde_json::to_writer(&mut dst, &value).unwrap();
8795            dst
8796        };
8797        let request_size = request_value_reader
8798            .seek(std::io::SeekFrom::End(0))
8799            .unwrap();
8800        request_value_reader
8801            .seek(std::io::SeekFrom::Start(0))
8802            .unwrap();
8803
8804        loop {
8805            let token = match self
8806                .hub
8807                .auth
8808                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8809                .await
8810            {
8811                Ok(token) => token,
8812                Err(e) => match dlg.token(e) {
8813                    Ok(token) => token,
8814                    Err(e) => {
8815                        dlg.finished(false);
8816                        return Err(common::Error::MissingToken(e));
8817                    }
8818                },
8819            };
8820            request_value_reader
8821                .seek(std::io::SeekFrom::Start(0))
8822                .unwrap();
8823            let mut req_result = {
8824                let client = &self.hub.client;
8825                dlg.pre_request();
8826                let mut req_builder = hyper::Request::builder()
8827                    .method(hyper::Method::POST)
8828                    .uri(url.as_str())
8829                    .header(USER_AGENT, self.hub._user_agent.clone());
8830
8831                if let Some(token) = token.as_ref() {
8832                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8833                }
8834
8835                let request = req_builder
8836                    .header(CONTENT_TYPE, json_mime_type.to_string())
8837                    .header(CONTENT_LENGTH, request_size as u64)
8838                    .body(common::to_body(
8839                        request_value_reader.get_ref().clone().into(),
8840                    ));
8841
8842                client.request(request.unwrap()).await
8843            };
8844
8845            match req_result {
8846                Err(err) => {
8847                    if let common::Retry::After(d) = dlg.http_error(&err) {
8848                        sleep(d).await;
8849                        continue;
8850                    }
8851                    dlg.finished(false);
8852                    return Err(common::Error::HttpError(err));
8853                }
8854                Ok(res) => {
8855                    let (mut parts, body) = res.into_parts();
8856                    let mut body = common::Body::new(body);
8857                    if !parts.status.is_success() {
8858                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8859                        let error = serde_json::from_str(&common::to_string(&bytes));
8860                        let response = common::to_response(parts, bytes.into());
8861
8862                        if let common::Retry::After(d) =
8863                            dlg.http_failure(&response, error.as_ref().ok())
8864                        {
8865                            sleep(d).await;
8866                            continue;
8867                        }
8868
8869                        dlg.finished(false);
8870
8871                        return Err(match error {
8872                            Ok(value) => common::Error::BadRequest(value),
8873                            _ => common::Error::Failure(response),
8874                        });
8875                    }
8876                    let response = {
8877                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8878                        let encoded = common::to_string(&bytes);
8879                        match serde_json::from_str(&encoded) {
8880                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8881                            Err(error) => {
8882                                dlg.response_json_decode_error(&encoded, &error);
8883                                return Err(common::Error::JsonDecodeError(
8884                                    encoded.to_string(),
8885                                    error,
8886                                ));
8887                            }
8888                        }
8889                    };
8890
8891                    dlg.finished(true);
8892                    return Ok(response);
8893                }
8894            }
8895        }
8896    }
8897
8898    ///
8899    /// Sets the *request* property to the given value.
8900    ///
8901    /// Even though the property as already been set when instantiating this call,
8902    /// we provide this method for API completeness.
8903    pub fn request(mut self, new_value: EventTicketClass) -> EventticketclasInsertCall<'a, C> {
8904        self._request = new_value;
8905        self
8906    }
8907    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8908    /// while executing the actual API request.
8909    ///
8910    /// ````text
8911    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8912    /// ````
8913    ///
8914    /// Sets the *delegate* property to the given value.
8915    pub fn delegate(
8916        mut self,
8917        new_value: &'a mut dyn common::Delegate,
8918    ) -> EventticketclasInsertCall<'a, C> {
8919        self._delegate = Some(new_value);
8920        self
8921    }
8922
8923    /// Set any additional parameter of the query string used in the request.
8924    /// It should be used to set parameters which are not yet available through their own
8925    /// setters.
8926    ///
8927    /// Please note that this method must not be used to set any of the known parameters
8928    /// which have their own setter method. If done anyway, the request will fail.
8929    ///
8930    /// # Additional Parameters
8931    ///
8932    /// * *$.xgafv* (query-string) - V1 error format.
8933    /// * *access_token* (query-string) - OAuth access token.
8934    /// * *alt* (query-string) - Data format for response.
8935    /// * *callback* (query-string) - JSONP
8936    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8937    /// * *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.
8938    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8939    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8940    /// * *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.
8941    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8942    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8943    pub fn param<T>(mut self, name: T, value: T) -> EventticketclasInsertCall<'a, C>
8944    where
8945        T: AsRef<str>,
8946    {
8947        self._additional_params
8948            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8949        self
8950    }
8951
8952    /// Identifies the authorization scope for the method you are building.
8953    ///
8954    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8955    /// [`Scope::WalletObjectIssuer`].
8956    ///
8957    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8958    /// tokens for more than one scope.
8959    ///
8960    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8961    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8962    /// sufficient, a read-write scope will do as well.
8963    pub fn add_scope<St>(mut self, scope: St) -> EventticketclasInsertCall<'a, C>
8964    where
8965        St: AsRef<str>,
8966    {
8967        self._scopes.insert(String::from(scope.as_ref()));
8968        self
8969    }
8970    /// Identifies the authorization scope(s) for the method you are building.
8971    ///
8972    /// See [`Self::add_scope()`] for details.
8973    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasInsertCall<'a, C>
8974    where
8975        I: IntoIterator<Item = St>,
8976        St: AsRef<str>,
8977    {
8978        self._scopes
8979            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8980        self
8981    }
8982
8983    /// Removes all scopes, and no default scope will be used either.
8984    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8985    /// for details).
8986    pub fn clear_scopes(mut self) -> EventticketclasInsertCall<'a, C> {
8987        self._scopes.clear();
8988        self
8989    }
8990}
8991
8992/// Returns a list of all event ticket classes for a given issuer ID.
8993///
8994/// A builder for the *list* method supported by a *eventticketclas* resource.
8995/// It is not used directly, but through a [`EventticketclasMethods`] instance.
8996///
8997/// # Example
8998///
8999/// Instantiate a resource method builder
9000///
9001/// ```test_harness,no_run
9002/// # extern crate hyper;
9003/// # extern crate hyper_rustls;
9004/// # extern crate google_walletobjects1 as walletobjects1;
9005/// # async fn dox() {
9006/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9007///
9008/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9009/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9010/// #     .with_native_roots()
9011/// #     .unwrap()
9012/// #     .https_only()
9013/// #     .enable_http2()
9014/// #     .build();
9015///
9016/// # let executor = hyper_util::rt::TokioExecutor::new();
9017/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9018/// #     secret,
9019/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9020/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9021/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9022/// #     ),
9023/// # ).build().await.unwrap();
9024///
9025/// # let client = hyper_util::client::legacy::Client::builder(
9026/// #     hyper_util::rt::TokioExecutor::new()
9027/// # )
9028/// # .build(
9029/// #     hyper_rustls::HttpsConnectorBuilder::new()
9030/// #         .with_native_roots()
9031/// #         .unwrap()
9032/// #         .https_or_http()
9033/// #         .enable_http2()
9034/// #         .build()
9035/// # );
9036/// # let mut hub = Walletobjects::new(client, auth);
9037/// // You can configure optional parameters by calling the respective setters at will, and
9038/// // execute the final call using `doit()`.
9039/// // Values shown here are possibly random and not representative !
9040/// let result = hub.eventticketclass().list()
9041///              .token("At")
9042///              .max_results(-8)
9043///              .issuer_id(-80)
9044///              .doit().await;
9045/// # }
9046/// ```
9047pub struct EventticketclasListCall<'a, C>
9048where
9049    C: 'a,
9050{
9051    hub: &'a Walletobjects<C>,
9052    _token: Option<String>,
9053    _max_results: Option<i32>,
9054    _issuer_id: Option<i64>,
9055    _delegate: Option<&'a mut dyn common::Delegate>,
9056    _additional_params: HashMap<String, String>,
9057    _scopes: BTreeSet<String>,
9058}
9059
9060impl<'a, C> common::CallBuilder for EventticketclasListCall<'a, C> {}
9061
9062impl<'a, C> EventticketclasListCall<'a, C>
9063where
9064    C: common::Connector,
9065{
9066    /// Perform the operation you have build so far.
9067    pub async fn doit(
9068        mut self,
9069    ) -> common::Result<(common::Response, EventTicketClassListResponse)> {
9070        use std::borrow::Cow;
9071        use std::io::{Read, Seek};
9072
9073        use common::{url::Params, ToParts};
9074        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9075
9076        let mut dd = common::DefaultDelegate;
9077        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9078        dlg.begin(common::MethodInfo {
9079            id: "walletobjects.eventticketclass.list",
9080            http_method: hyper::Method::GET,
9081        });
9082
9083        for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
9084            if self._additional_params.contains_key(field) {
9085                dlg.finished(false);
9086                return Err(common::Error::FieldClash(field));
9087            }
9088        }
9089
9090        let mut params = Params::with_capacity(5 + self._additional_params.len());
9091        if let Some(value) = self._token.as_ref() {
9092            params.push("token", value);
9093        }
9094        if let Some(value) = self._max_results.as_ref() {
9095            params.push("maxResults", value.to_string());
9096        }
9097        if let Some(value) = self._issuer_id.as_ref() {
9098            params.push("issuerId", value.to_string());
9099        }
9100
9101        params.extend(self._additional_params.iter());
9102
9103        params.push("alt", "json");
9104        let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass";
9105        if self._scopes.is_empty() {
9106            self._scopes
9107                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
9108        }
9109
9110        let url = params.parse_with_url(&url);
9111
9112        loop {
9113            let token = match self
9114                .hub
9115                .auth
9116                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9117                .await
9118            {
9119                Ok(token) => token,
9120                Err(e) => match dlg.token(e) {
9121                    Ok(token) => token,
9122                    Err(e) => {
9123                        dlg.finished(false);
9124                        return Err(common::Error::MissingToken(e));
9125                    }
9126                },
9127            };
9128            let mut req_result = {
9129                let client = &self.hub.client;
9130                dlg.pre_request();
9131                let mut req_builder = hyper::Request::builder()
9132                    .method(hyper::Method::GET)
9133                    .uri(url.as_str())
9134                    .header(USER_AGENT, self.hub._user_agent.clone());
9135
9136                if let Some(token) = token.as_ref() {
9137                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9138                }
9139
9140                let request = req_builder
9141                    .header(CONTENT_LENGTH, 0_u64)
9142                    .body(common::to_body::<String>(None));
9143
9144                client.request(request.unwrap()).await
9145            };
9146
9147            match req_result {
9148                Err(err) => {
9149                    if let common::Retry::After(d) = dlg.http_error(&err) {
9150                        sleep(d).await;
9151                        continue;
9152                    }
9153                    dlg.finished(false);
9154                    return Err(common::Error::HttpError(err));
9155                }
9156                Ok(res) => {
9157                    let (mut parts, body) = res.into_parts();
9158                    let mut body = common::Body::new(body);
9159                    if !parts.status.is_success() {
9160                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9161                        let error = serde_json::from_str(&common::to_string(&bytes));
9162                        let response = common::to_response(parts, bytes.into());
9163
9164                        if let common::Retry::After(d) =
9165                            dlg.http_failure(&response, error.as_ref().ok())
9166                        {
9167                            sleep(d).await;
9168                            continue;
9169                        }
9170
9171                        dlg.finished(false);
9172
9173                        return Err(match error {
9174                            Ok(value) => common::Error::BadRequest(value),
9175                            _ => common::Error::Failure(response),
9176                        });
9177                    }
9178                    let response = {
9179                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9180                        let encoded = common::to_string(&bytes);
9181                        match serde_json::from_str(&encoded) {
9182                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9183                            Err(error) => {
9184                                dlg.response_json_decode_error(&encoded, &error);
9185                                return Err(common::Error::JsonDecodeError(
9186                                    encoded.to_string(),
9187                                    error,
9188                                ));
9189                            }
9190                        }
9191                    };
9192
9193                    dlg.finished(true);
9194                    return Ok(response);
9195                }
9196            }
9197        }
9198    }
9199
9200    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` classes are available in a list. For example, if you have a list of 200 classes and you call list with `maxResults` set to 20, list will return the first 20 classes and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 classes.
9201    ///
9202    /// Sets the *token* query property to the given value.
9203    pub fn token(mut self, new_value: &str) -> EventticketclasListCall<'a, C> {
9204        self._token = Some(new_value.to_string());
9205        self
9206    }
9207    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
9208    ///
9209    /// Sets the *max results* query property to the given value.
9210    pub fn max_results(mut self, new_value: i32) -> EventticketclasListCall<'a, C> {
9211        self._max_results = Some(new_value);
9212        self
9213    }
9214    /// The ID of the issuer authorized to list classes.
9215    ///
9216    /// Sets the *issuer id* query property to the given value.
9217    pub fn issuer_id(mut self, new_value: i64) -> EventticketclasListCall<'a, C> {
9218        self._issuer_id = Some(new_value);
9219        self
9220    }
9221    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9222    /// while executing the actual API request.
9223    ///
9224    /// ````text
9225    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9226    /// ````
9227    ///
9228    /// Sets the *delegate* property to the given value.
9229    pub fn delegate(
9230        mut self,
9231        new_value: &'a mut dyn common::Delegate,
9232    ) -> EventticketclasListCall<'a, C> {
9233        self._delegate = Some(new_value);
9234        self
9235    }
9236
9237    /// Set any additional parameter of the query string used in the request.
9238    /// It should be used to set parameters which are not yet available through their own
9239    /// setters.
9240    ///
9241    /// Please note that this method must not be used to set any of the known parameters
9242    /// which have their own setter method. If done anyway, the request will fail.
9243    ///
9244    /// # Additional Parameters
9245    ///
9246    /// * *$.xgafv* (query-string) - V1 error format.
9247    /// * *access_token* (query-string) - OAuth access token.
9248    /// * *alt* (query-string) - Data format for response.
9249    /// * *callback* (query-string) - JSONP
9250    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9251    /// * *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.
9252    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9253    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9254    /// * *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.
9255    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9256    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9257    pub fn param<T>(mut self, name: T, value: T) -> EventticketclasListCall<'a, C>
9258    where
9259        T: AsRef<str>,
9260    {
9261        self._additional_params
9262            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9263        self
9264    }
9265
9266    /// Identifies the authorization scope for the method you are building.
9267    ///
9268    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9269    /// [`Scope::WalletObjectIssuer`].
9270    ///
9271    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9272    /// tokens for more than one scope.
9273    ///
9274    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9275    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9276    /// sufficient, a read-write scope will do as well.
9277    pub fn add_scope<St>(mut self, scope: St) -> EventticketclasListCall<'a, C>
9278    where
9279        St: AsRef<str>,
9280    {
9281        self._scopes.insert(String::from(scope.as_ref()));
9282        self
9283    }
9284    /// Identifies the authorization scope(s) for the method you are building.
9285    ///
9286    /// See [`Self::add_scope()`] for details.
9287    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasListCall<'a, C>
9288    where
9289        I: IntoIterator<Item = St>,
9290        St: AsRef<str>,
9291    {
9292        self._scopes
9293            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9294        self
9295    }
9296
9297    /// Removes all scopes, and no default scope will be used either.
9298    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9299    /// for details).
9300    pub fn clear_scopes(mut self) -> EventticketclasListCall<'a, C> {
9301        self._scopes.clear();
9302        self
9303    }
9304}
9305
9306/// Updates the event ticket class referenced by the given class ID. This method supports patch semantics.
9307///
9308/// A builder for the *patch* method supported by a *eventticketclas* resource.
9309/// It is not used directly, but through a [`EventticketclasMethods`] instance.
9310///
9311/// # Example
9312///
9313/// Instantiate a resource method builder
9314///
9315/// ```test_harness,no_run
9316/// # extern crate hyper;
9317/// # extern crate hyper_rustls;
9318/// # extern crate google_walletobjects1 as walletobjects1;
9319/// use walletobjects1::api::EventTicketClass;
9320/// # async fn dox() {
9321/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9322///
9323/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9324/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9325/// #     .with_native_roots()
9326/// #     .unwrap()
9327/// #     .https_only()
9328/// #     .enable_http2()
9329/// #     .build();
9330///
9331/// # let executor = hyper_util::rt::TokioExecutor::new();
9332/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9333/// #     secret,
9334/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9335/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9336/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9337/// #     ),
9338/// # ).build().await.unwrap();
9339///
9340/// # let client = hyper_util::client::legacy::Client::builder(
9341/// #     hyper_util::rt::TokioExecutor::new()
9342/// # )
9343/// # .build(
9344/// #     hyper_rustls::HttpsConnectorBuilder::new()
9345/// #         .with_native_roots()
9346/// #         .unwrap()
9347/// #         .https_or_http()
9348/// #         .enable_http2()
9349/// #         .build()
9350/// # );
9351/// # let mut hub = Walletobjects::new(client, auth);
9352/// // As the method needs a request, you would usually fill it with the desired information
9353/// // into the respective structure. Some of the parts shown here might not be applicable !
9354/// // Values shown here are possibly random and not representative !
9355/// let mut req = EventTicketClass::default();
9356///
9357/// // You can configure optional parameters by calling the respective setters at will, and
9358/// // execute the final call using `doit()`.
9359/// // Values shown here are possibly random and not representative !
9360/// let result = hub.eventticketclass().patch(req, "resourceId")
9361///              .doit().await;
9362/// # }
9363/// ```
9364pub struct EventticketclasPatchCall<'a, C>
9365where
9366    C: 'a,
9367{
9368    hub: &'a Walletobjects<C>,
9369    _request: EventTicketClass,
9370    _resource_id: String,
9371    _delegate: Option<&'a mut dyn common::Delegate>,
9372    _additional_params: HashMap<String, String>,
9373    _scopes: BTreeSet<String>,
9374}
9375
9376impl<'a, C> common::CallBuilder for EventticketclasPatchCall<'a, C> {}
9377
9378impl<'a, C> EventticketclasPatchCall<'a, C>
9379where
9380    C: common::Connector,
9381{
9382    /// Perform the operation you have build so far.
9383    pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketClass)> {
9384        use std::borrow::Cow;
9385        use std::io::{Read, Seek};
9386
9387        use common::{url::Params, ToParts};
9388        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9389
9390        let mut dd = common::DefaultDelegate;
9391        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9392        dlg.begin(common::MethodInfo {
9393            id: "walletobjects.eventticketclass.patch",
9394            http_method: hyper::Method::PATCH,
9395        });
9396
9397        for &field in ["alt", "resourceId"].iter() {
9398            if self._additional_params.contains_key(field) {
9399                dlg.finished(false);
9400                return Err(common::Error::FieldClash(field));
9401            }
9402        }
9403
9404        let mut params = Params::with_capacity(4 + self._additional_params.len());
9405        params.push("resourceId", self._resource_id);
9406
9407        params.extend(self._additional_params.iter());
9408
9409        params.push("alt", "json");
9410        let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass/{resourceId}";
9411        if self._scopes.is_empty() {
9412            self._scopes
9413                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
9414        }
9415
9416        #[allow(clippy::single_element_loop)]
9417        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
9418            url = params.uri_replacement(url, param_name, find_this, false);
9419        }
9420        {
9421            let to_remove = ["resourceId"];
9422            params.remove_params(&to_remove);
9423        }
9424
9425        let url = params.parse_with_url(&url);
9426
9427        let mut json_mime_type = mime::APPLICATION_JSON;
9428        let mut request_value_reader = {
9429            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9430            common::remove_json_null_values(&mut value);
9431            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9432            serde_json::to_writer(&mut dst, &value).unwrap();
9433            dst
9434        };
9435        let request_size = request_value_reader
9436            .seek(std::io::SeekFrom::End(0))
9437            .unwrap();
9438        request_value_reader
9439            .seek(std::io::SeekFrom::Start(0))
9440            .unwrap();
9441
9442        loop {
9443            let token = match self
9444                .hub
9445                .auth
9446                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9447                .await
9448            {
9449                Ok(token) => token,
9450                Err(e) => match dlg.token(e) {
9451                    Ok(token) => token,
9452                    Err(e) => {
9453                        dlg.finished(false);
9454                        return Err(common::Error::MissingToken(e));
9455                    }
9456                },
9457            };
9458            request_value_reader
9459                .seek(std::io::SeekFrom::Start(0))
9460                .unwrap();
9461            let mut req_result = {
9462                let client = &self.hub.client;
9463                dlg.pre_request();
9464                let mut req_builder = hyper::Request::builder()
9465                    .method(hyper::Method::PATCH)
9466                    .uri(url.as_str())
9467                    .header(USER_AGENT, self.hub._user_agent.clone());
9468
9469                if let Some(token) = token.as_ref() {
9470                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9471                }
9472
9473                let request = req_builder
9474                    .header(CONTENT_TYPE, json_mime_type.to_string())
9475                    .header(CONTENT_LENGTH, request_size as u64)
9476                    .body(common::to_body(
9477                        request_value_reader.get_ref().clone().into(),
9478                    ));
9479
9480                client.request(request.unwrap()).await
9481            };
9482
9483            match req_result {
9484                Err(err) => {
9485                    if let common::Retry::After(d) = dlg.http_error(&err) {
9486                        sleep(d).await;
9487                        continue;
9488                    }
9489                    dlg.finished(false);
9490                    return Err(common::Error::HttpError(err));
9491                }
9492                Ok(res) => {
9493                    let (mut parts, body) = res.into_parts();
9494                    let mut body = common::Body::new(body);
9495                    if !parts.status.is_success() {
9496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9497                        let error = serde_json::from_str(&common::to_string(&bytes));
9498                        let response = common::to_response(parts, bytes.into());
9499
9500                        if let common::Retry::After(d) =
9501                            dlg.http_failure(&response, error.as_ref().ok())
9502                        {
9503                            sleep(d).await;
9504                            continue;
9505                        }
9506
9507                        dlg.finished(false);
9508
9509                        return Err(match error {
9510                            Ok(value) => common::Error::BadRequest(value),
9511                            _ => common::Error::Failure(response),
9512                        });
9513                    }
9514                    let response = {
9515                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9516                        let encoded = common::to_string(&bytes);
9517                        match serde_json::from_str(&encoded) {
9518                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9519                            Err(error) => {
9520                                dlg.response_json_decode_error(&encoded, &error);
9521                                return Err(common::Error::JsonDecodeError(
9522                                    encoded.to_string(),
9523                                    error,
9524                                ));
9525                            }
9526                        }
9527                    };
9528
9529                    dlg.finished(true);
9530                    return Ok(response);
9531                }
9532            }
9533        }
9534    }
9535
9536    ///
9537    /// Sets the *request* property to the given value.
9538    ///
9539    /// Even though the property as already been set when instantiating this call,
9540    /// we provide this method for API completeness.
9541    pub fn request(mut self, new_value: EventTicketClass) -> EventticketclasPatchCall<'a, C> {
9542        self._request = new_value;
9543        self
9544    }
9545    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
9546    ///
9547    /// Sets the *resource id* path property to the given value.
9548    ///
9549    /// Even though the property as already been set when instantiating this call,
9550    /// we provide this method for API completeness.
9551    pub fn resource_id(mut self, new_value: &str) -> EventticketclasPatchCall<'a, C> {
9552        self._resource_id = new_value.to_string();
9553        self
9554    }
9555    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9556    /// while executing the actual API request.
9557    ///
9558    /// ````text
9559    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9560    /// ````
9561    ///
9562    /// Sets the *delegate* property to the given value.
9563    pub fn delegate(
9564        mut self,
9565        new_value: &'a mut dyn common::Delegate,
9566    ) -> EventticketclasPatchCall<'a, C> {
9567        self._delegate = Some(new_value);
9568        self
9569    }
9570
9571    /// Set any additional parameter of the query string used in the request.
9572    /// It should be used to set parameters which are not yet available through their own
9573    /// setters.
9574    ///
9575    /// Please note that this method must not be used to set any of the known parameters
9576    /// which have their own setter method. If done anyway, the request will fail.
9577    ///
9578    /// # Additional Parameters
9579    ///
9580    /// * *$.xgafv* (query-string) - V1 error format.
9581    /// * *access_token* (query-string) - OAuth access token.
9582    /// * *alt* (query-string) - Data format for response.
9583    /// * *callback* (query-string) - JSONP
9584    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9585    /// * *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.
9586    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9587    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9588    /// * *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.
9589    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9590    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9591    pub fn param<T>(mut self, name: T, value: T) -> EventticketclasPatchCall<'a, C>
9592    where
9593        T: AsRef<str>,
9594    {
9595        self._additional_params
9596            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9597        self
9598    }
9599
9600    /// Identifies the authorization scope for the method you are building.
9601    ///
9602    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9603    /// [`Scope::WalletObjectIssuer`].
9604    ///
9605    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9606    /// tokens for more than one scope.
9607    ///
9608    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9609    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9610    /// sufficient, a read-write scope will do as well.
9611    pub fn add_scope<St>(mut self, scope: St) -> EventticketclasPatchCall<'a, C>
9612    where
9613        St: AsRef<str>,
9614    {
9615        self._scopes.insert(String::from(scope.as_ref()));
9616        self
9617    }
9618    /// Identifies the authorization scope(s) for the method you are building.
9619    ///
9620    /// See [`Self::add_scope()`] for details.
9621    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasPatchCall<'a, C>
9622    where
9623        I: IntoIterator<Item = St>,
9624        St: AsRef<str>,
9625    {
9626        self._scopes
9627            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9628        self
9629    }
9630
9631    /// Removes all scopes, and no default scope will be used either.
9632    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9633    /// for details).
9634    pub fn clear_scopes(mut self) -> EventticketclasPatchCall<'a, C> {
9635        self._scopes.clear();
9636        self
9637    }
9638}
9639
9640/// Updates the event ticket class referenced by the given class ID.
9641///
9642/// A builder for the *update* method supported by a *eventticketclas* resource.
9643/// It is not used directly, but through a [`EventticketclasMethods`] instance.
9644///
9645/// # Example
9646///
9647/// Instantiate a resource method builder
9648///
9649/// ```test_harness,no_run
9650/// # extern crate hyper;
9651/// # extern crate hyper_rustls;
9652/// # extern crate google_walletobjects1 as walletobjects1;
9653/// use walletobjects1::api::EventTicketClass;
9654/// # async fn dox() {
9655/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9656///
9657/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9658/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9659/// #     .with_native_roots()
9660/// #     .unwrap()
9661/// #     .https_only()
9662/// #     .enable_http2()
9663/// #     .build();
9664///
9665/// # let executor = hyper_util::rt::TokioExecutor::new();
9666/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9667/// #     secret,
9668/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9669/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9670/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9671/// #     ),
9672/// # ).build().await.unwrap();
9673///
9674/// # let client = hyper_util::client::legacy::Client::builder(
9675/// #     hyper_util::rt::TokioExecutor::new()
9676/// # )
9677/// # .build(
9678/// #     hyper_rustls::HttpsConnectorBuilder::new()
9679/// #         .with_native_roots()
9680/// #         .unwrap()
9681/// #         .https_or_http()
9682/// #         .enable_http2()
9683/// #         .build()
9684/// # );
9685/// # let mut hub = Walletobjects::new(client, auth);
9686/// // As the method needs a request, you would usually fill it with the desired information
9687/// // into the respective structure. Some of the parts shown here might not be applicable !
9688/// // Values shown here are possibly random and not representative !
9689/// let mut req = EventTicketClass::default();
9690///
9691/// // You can configure optional parameters by calling the respective setters at will, and
9692/// // execute the final call using `doit()`.
9693/// // Values shown here are possibly random and not representative !
9694/// let result = hub.eventticketclass().update(req, "resourceId")
9695///              .doit().await;
9696/// # }
9697/// ```
9698pub struct EventticketclasUpdateCall<'a, C>
9699where
9700    C: 'a,
9701{
9702    hub: &'a Walletobjects<C>,
9703    _request: EventTicketClass,
9704    _resource_id: String,
9705    _delegate: Option<&'a mut dyn common::Delegate>,
9706    _additional_params: HashMap<String, String>,
9707    _scopes: BTreeSet<String>,
9708}
9709
9710impl<'a, C> common::CallBuilder for EventticketclasUpdateCall<'a, C> {}
9711
9712impl<'a, C> EventticketclasUpdateCall<'a, C>
9713where
9714    C: common::Connector,
9715{
9716    /// Perform the operation you have build so far.
9717    pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketClass)> {
9718        use std::borrow::Cow;
9719        use std::io::{Read, Seek};
9720
9721        use common::{url::Params, ToParts};
9722        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9723
9724        let mut dd = common::DefaultDelegate;
9725        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9726        dlg.begin(common::MethodInfo {
9727            id: "walletobjects.eventticketclass.update",
9728            http_method: hyper::Method::PUT,
9729        });
9730
9731        for &field in ["alt", "resourceId"].iter() {
9732            if self._additional_params.contains_key(field) {
9733                dlg.finished(false);
9734                return Err(common::Error::FieldClash(field));
9735            }
9736        }
9737
9738        let mut params = Params::with_capacity(4 + self._additional_params.len());
9739        params.push("resourceId", self._resource_id);
9740
9741        params.extend(self._additional_params.iter());
9742
9743        params.push("alt", "json");
9744        let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass/{resourceId}";
9745        if self._scopes.is_empty() {
9746            self._scopes
9747                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
9748        }
9749
9750        #[allow(clippy::single_element_loop)]
9751        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
9752            url = params.uri_replacement(url, param_name, find_this, false);
9753        }
9754        {
9755            let to_remove = ["resourceId"];
9756            params.remove_params(&to_remove);
9757        }
9758
9759        let url = params.parse_with_url(&url);
9760
9761        let mut json_mime_type = mime::APPLICATION_JSON;
9762        let mut request_value_reader = {
9763            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9764            common::remove_json_null_values(&mut value);
9765            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9766            serde_json::to_writer(&mut dst, &value).unwrap();
9767            dst
9768        };
9769        let request_size = request_value_reader
9770            .seek(std::io::SeekFrom::End(0))
9771            .unwrap();
9772        request_value_reader
9773            .seek(std::io::SeekFrom::Start(0))
9774            .unwrap();
9775
9776        loop {
9777            let token = match self
9778                .hub
9779                .auth
9780                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9781                .await
9782            {
9783                Ok(token) => token,
9784                Err(e) => match dlg.token(e) {
9785                    Ok(token) => token,
9786                    Err(e) => {
9787                        dlg.finished(false);
9788                        return Err(common::Error::MissingToken(e));
9789                    }
9790                },
9791            };
9792            request_value_reader
9793                .seek(std::io::SeekFrom::Start(0))
9794                .unwrap();
9795            let mut req_result = {
9796                let client = &self.hub.client;
9797                dlg.pre_request();
9798                let mut req_builder = hyper::Request::builder()
9799                    .method(hyper::Method::PUT)
9800                    .uri(url.as_str())
9801                    .header(USER_AGENT, self.hub._user_agent.clone());
9802
9803                if let Some(token) = token.as_ref() {
9804                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9805                }
9806
9807                let request = req_builder
9808                    .header(CONTENT_TYPE, json_mime_type.to_string())
9809                    .header(CONTENT_LENGTH, request_size as u64)
9810                    .body(common::to_body(
9811                        request_value_reader.get_ref().clone().into(),
9812                    ));
9813
9814                client.request(request.unwrap()).await
9815            };
9816
9817            match req_result {
9818                Err(err) => {
9819                    if let common::Retry::After(d) = dlg.http_error(&err) {
9820                        sleep(d).await;
9821                        continue;
9822                    }
9823                    dlg.finished(false);
9824                    return Err(common::Error::HttpError(err));
9825                }
9826                Ok(res) => {
9827                    let (mut parts, body) = res.into_parts();
9828                    let mut body = common::Body::new(body);
9829                    if !parts.status.is_success() {
9830                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9831                        let error = serde_json::from_str(&common::to_string(&bytes));
9832                        let response = common::to_response(parts, bytes.into());
9833
9834                        if let common::Retry::After(d) =
9835                            dlg.http_failure(&response, error.as_ref().ok())
9836                        {
9837                            sleep(d).await;
9838                            continue;
9839                        }
9840
9841                        dlg.finished(false);
9842
9843                        return Err(match error {
9844                            Ok(value) => common::Error::BadRequest(value),
9845                            _ => common::Error::Failure(response),
9846                        });
9847                    }
9848                    let response = {
9849                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9850                        let encoded = common::to_string(&bytes);
9851                        match serde_json::from_str(&encoded) {
9852                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9853                            Err(error) => {
9854                                dlg.response_json_decode_error(&encoded, &error);
9855                                return Err(common::Error::JsonDecodeError(
9856                                    encoded.to_string(),
9857                                    error,
9858                                ));
9859                            }
9860                        }
9861                    };
9862
9863                    dlg.finished(true);
9864                    return Ok(response);
9865                }
9866            }
9867        }
9868    }
9869
9870    ///
9871    /// Sets the *request* property to the given value.
9872    ///
9873    /// Even though the property as already been set when instantiating this call,
9874    /// we provide this method for API completeness.
9875    pub fn request(mut self, new_value: EventTicketClass) -> EventticketclasUpdateCall<'a, C> {
9876        self._request = new_value;
9877        self
9878    }
9879    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
9880    ///
9881    /// Sets the *resource id* path property to the given value.
9882    ///
9883    /// Even though the property as already been set when instantiating this call,
9884    /// we provide this method for API completeness.
9885    pub fn resource_id(mut self, new_value: &str) -> EventticketclasUpdateCall<'a, C> {
9886        self._resource_id = new_value.to_string();
9887        self
9888    }
9889    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9890    /// while executing the actual API request.
9891    ///
9892    /// ````text
9893    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9894    /// ````
9895    ///
9896    /// Sets the *delegate* property to the given value.
9897    pub fn delegate(
9898        mut self,
9899        new_value: &'a mut dyn common::Delegate,
9900    ) -> EventticketclasUpdateCall<'a, C> {
9901        self._delegate = Some(new_value);
9902        self
9903    }
9904
9905    /// Set any additional parameter of the query string used in the request.
9906    /// It should be used to set parameters which are not yet available through their own
9907    /// setters.
9908    ///
9909    /// Please note that this method must not be used to set any of the known parameters
9910    /// which have their own setter method. If done anyway, the request will fail.
9911    ///
9912    /// # Additional Parameters
9913    ///
9914    /// * *$.xgafv* (query-string) - V1 error format.
9915    /// * *access_token* (query-string) - OAuth access token.
9916    /// * *alt* (query-string) - Data format for response.
9917    /// * *callback* (query-string) - JSONP
9918    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9919    /// * *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.
9920    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9921    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9922    /// * *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.
9923    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9924    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9925    pub fn param<T>(mut self, name: T, value: T) -> EventticketclasUpdateCall<'a, C>
9926    where
9927        T: AsRef<str>,
9928    {
9929        self._additional_params
9930            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9931        self
9932    }
9933
9934    /// Identifies the authorization scope for the method you are building.
9935    ///
9936    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9937    /// [`Scope::WalletObjectIssuer`].
9938    ///
9939    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9940    /// tokens for more than one scope.
9941    ///
9942    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9943    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9944    /// sufficient, a read-write scope will do as well.
9945    pub fn add_scope<St>(mut self, scope: St) -> EventticketclasUpdateCall<'a, C>
9946    where
9947        St: AsRef<str>,
9948    {
9949        self._scopes.insert(String::from(scope.as_ref()));
9950        self
9951    }
9952    /// Identifies the authorization scope(s) for the method you are building.
9953    ///
9954    /// See [`Self::add_scope()`] for details.
9955    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasUpdateCall<'a, C>
9956    where
9957        I: IntoIterator<Item = St>,
9958        St: AsRef<str>,
9959    {
9960        self._scopes
9961            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9962        self
9963    }
9964
9965    /// Removes all scopes, and no default scope will be used either.
9966    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9967    /// for details).
9968    pub fn clear_scopes(mut self) -> EventticketclasUpdateCall<'a, C> {
9969        self._scopes.clear();
9970        self
9971    }
9972}
9973
9974/// Adds a message to the event ticket object referenced by the given object ID.
9975///
9976/// A builder for the *addmessage* method supported by a *eventticketobject* resource.
9977/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
9978///
9979/// # Example
9980///
9981/// Instantiate a resource method builder
9982///
9983/// ```test_harness,no_run
9984/// # extern crate hyper;
9985/// # extern crate hyper_rustls;
9986/// # extern crate google_walletobjects1 as walletobjects1;
9987/// use walletobjects1::api::AddMessageRequest;
9988/// # async fn dox() {
9989/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9990///
9991/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9992/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9993/// #     .with_native_roots()
9994/// #     .unwrap()
9995/// #     .https_only()
9996/// #     .enable_http2()
9997/// #     .build();
9998///
9999/// # let executor = hyper_util::rt::TokioExecutor::new();
10000/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10001/// #     secret,
10002/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10003/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10004/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10005/// #     ),
10006/// # ).build().await.unwrap();
10007///
10008/// # let client = hyper_util::client::legacy::Client::builder(
10009/// #     hyper_util::rt::TokioExecutor::new()
10010/// # )
10011/// # .build(
10012/// #     hyper_rustls::HttpsConnectorBuilder::new()
10013/// #         .with_native_roots()
10014/// #         .unwrap()
10015/// #         .https_or_http()
10016/// #         .enable_http2()
10017/// #         .build()
10018/// # );
10019/// # let mut hub = Walletobjects::new(client, auth);
10020/// // As the method needs a request, you would usually fill it with the desired information
10021/// // into the respective structure. Some of the parts shown here might not be applicable !
10022/// // Values shown here are possibly random and not representative !
10023/// let mut req = AddMessageRequest::default();
10024///
10025/// // You can configure optional parameters by calling the respective setters at will, and
10026/// // execute the final call using `doit()`.
10027/// // Values shown here are possibly random and not representative !
10028/// let result = hub.eventticketobject().addmessage(req, "resourceId")
10029///              .doit().await;
10030/// # }
10031/// ```
10032pub struct EventticketobjectAddmessageCall<'a, C>
10033where
10034    C: 'a,
10035{
10036    hub: &'a Walletobjects<C>,
10037    _request: AddMessageRequest,
10038    _resource_id: String,
10039    _delegate: Option<&'a mut dyn common::Delegate>,
10040    _additional_params: HashMap<String, String>,
10041    _scopes: BTreeSet<String>,
10042}
10043
10044impl<'a, C> common::CallBuilder for EventticketobjectAddmessageCall<'a, C> {}
10045
10046impl<'a, C> EventticketobjectAddmessageCall<'a, C>
10047where
10048    C: common::Connector,
10049{
10050    /// Perform the operation you have build so far.
10051    pub async fn doit(
10052        mut self,
10053    ) -> common::Result<(common::Response, EventTicketObjectAddMessageResponse)> {
10054        use std::borrow::Cow;
10055        use std::io::{Read, Seek};
10056
10057        use common::{url::Params, ToParts};
10058        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10059
10060        let mut dd = common::DefaultDelegate;
10061        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10062        dlg.begin(common::MethodInfo {
10063            id: "walletobjects.eventticketobject.addmessage",
10064            http_method: hyper::Method::POST,
10065        });
10066
10067        for &field in ["alt", "resourceId"].iter() {
10068            if self._additional_params.contains_key(field) {
10069                dlg.finished(false);
10070                return Err(common::Error::FieldClash(field));
10071            }
10072        }
10073
10074        let mut params = Params::with_capacity(4 + self._additional_params.len());
10075        params.push("resourceId", self._resource_id);
10076
10077        params.extend(self._additional_params.iter());
10078
10079        params.push("alt", "json");
10080        let mut url = self.hub._base_url.clone()
10081            + "walletobjects/v1/eventTicketObject/{resourceId}/addMessage";
10082        if self._scopes.is_empty() {
10083            self._scopes
10084                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
10085        }
10086
10087        #[allow(clippy::single_element_loop)]
10088        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
10089            url = params.uri_replacement(url, param_name, find_this, false);
10090        }
10091        {
10092            let to_remove = ["resourceId"];
10093            params.remove_params(&to_remove);
10094        }
10095
10096        let url = params.parse_with_url(&url);
10097
10098        let mut json_mime_type = mime::APPLICATION_JSON;
10099        let mut request_value_reader = {
10100            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10101            common::remove_json_null_values(&mut value);
10102            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10103            serde_json::to_writer(&mut dst, &value).unwrap();
10104            dst
10105        };
10106        let request_size = request_value_reader
10107            .seek(std::io::SeekFrom::End(0))
10108            .unwrap();
10109        request_value_reader
10110            .seek(std::io::SeekFrom::Start(0))
10111            .unwrap();
10112
10113        loop {
10114            let token = match self
10115                .hub
10116                .auth
10117                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10118                .await
10119            {
10120                Ok(token) => token,
10121                Err(e) => match dlg.token(e) {
10122                    Ok(token) => token,
10123                    Err(e) => {
10124                        dlg.finished(false);
10125                        return Err(common::Error::MissingToken(e));
10126                    }
10127                },
10128            };
10129            request_value_reader
10130                .seek(std::io::SeekFrom::Start(0))
10131                .unwrap();
10132            let mut req_result = {
10133                let client = &self.hub.client;
10134                dlg.pre_request();
10135                let mut req_builder = hyper::Request::builder()
10136                    .method(hyper::Method::POST)
10137                    .uri(url.as_str())
10138                    .header(USER_AGENT, self.hub._user_agent.clone());
10139
10140                if let Some(token) = token.as_ref() {
10141                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10142                }
10143
10144                let request = req_builder
10145                    .header(CONTENT_TYPE, json_mime_type.to_string())
10146                    .header(CONTENT_LENGTH, request_size as u64)
10147                    .body(common::to_body(
10148                        request_value_reader.get_ref().clone().into(),
10149                    ));
10150
10151                client.request(request.unwrap()).await
10152            };
10153
10154            match req_result {
10155                Err(err) => {
10156                    if let common::Retry::After(d) = dlg.http_error(&err) {
10157                        sleep(d).await;
10158                        continue;
10159                    }
10160                    dlg.finished(false);
10161                    return Err(common::Error::HttpError(err));
10162                }
10163                Ok(res) => {
10164                    let (mut parts, body) = res.into_parts();
10165                    let mut body = common::Body::new(body);
10166                    if !parts.status.is_success() {
10167                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10168                        let error = serde_json::from_str(&common::to_string(&bytes));
10169                        let response = common::to_response(parts, bytes.into());
10170
10171                        if let common::Retry::After(d) =
10172                            dlg.http_failure(&response, error.as_ref().ok())
10173                        {
10174                            sleep(d).await;
10175                            continue;
10176                        }
10177
10178                        dlg.finished(false);
10179
10180                        return Err(match error {
10181                            Ok(value) => common::Error::BadRequest(value),
10182                            _ => common::Error::Failure(response),
10183                        });
10184                    }
10185                    let response = {
10186                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10187                        let encoded = common::to_string(&bytes);
10188                        match serde_json::from_str(&encoded) {
10189                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10190                            Err(error) => {
10191                                dlg.response_json_decode_error(&encoded, &error);
10192                                return Err(common::Error::JsonDecodeError(
10193                                    encoded.to_string(),
10194                                    error,
10195                                ));
10196                            }
10197                        }
10198                    };
10199
10200                    dlg.finished(true);
10201                    return Ok(response);
10202                }
10203            }
10204        }
10205    }
10206
10207    ///
10208    /// Sets the *request* property to the given value.
10209    ///
10210    /// Even though the property as already been set when instantiating this call,
10211    /// we provide this method for API completeness.
10212    pub fn request(
10213        mut self,
10214        new_value: AddMessageRequest,
10215    ) -> EventticketobjectAddmessageCall<'a, C> {
10216        self._request = new_value;
10217        self
10218    }
10219    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
10220    ///
10221    /// Sets the *resource id* path property to the given value.
10222    ///
10223    /// Even though the property as already been set when instantiating this call,
10224    /// we provide this method for API completeness.
10225    pub fn resource_id(mut self, new_value: &str) -> EventticketobjectAddmessageCall<'a, C> {
10226        self._resource_id = new_value.to_string();
10227        self
10228    }
10229    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10230    /// while executing the actual API request.
10231    ///
10232    /// ````text
10233    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10234    /// ````
10235    ///
10236    /// Sets the *delegate* property to the given value.
10237    pub fn delegate(
10238        mut self,
10239        new_value: &'a mut dyn common::Delegate,
10240    ) -> EventticketobjectAddmessageCall<'a, C> {
10241        self._delegate = Some(new_value);
10242        self
10243    }
10244
10245    /// Set any additional parameter of the query string used in the request.
10246    /// It should be used to set parameters which are not yet available through their own
10247    /// setters.
10248    ///
10249    /// Please note that this method must not be used to set any of the known parameters
10250    /// which have their own setter method. If done anyway, the request will fail.
10251    ///
10252    /// # Additional Parameters
10253    ///
10254    /// * *$.xgafv* (query-string) - V1 error format.
10255    /// * *access_token* (query-string) - OAuth access token.
10256    /// * *alt* (query-string) - Data format for response.
10257    /// * *callback* (query-string) - JSONP
10258    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10259    /// * *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.
10260    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10261    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10262    /// * *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.
10263    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10264    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10265    pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectAddmessageCall<'a, C>
10266    where
10267        T: AsRef<str>,
10268    {
10269        self._additional_params
10270            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10271        self
10272    }
10273
10274    /// Identifies the authorization scope for the method you are building.
10275    ///
10276    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10277    /// [`Scope::WalletObjectIssuer`].
10278    ///
10279    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10280    /// tokens for more than one scope.
10281    ///
10282    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10283    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10284    /// sufficient, a read-write scope will do as well.
10285    pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectAddmessageCall<'a, C>
10286    where
10287        St: AsRef<str>,
10288    {
10289        self._scopes.insert(String::from(scope.as_ref()));
10290        self
10291    }
10292    /// Identifies the authorization scope(s) for the method you are building.
10293    ///
10294    /// See [`Self::add_scope()`] for details.
10295    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectAddmessageCall<'a, C>
10296    where
10297        I: IntoIterator<Item = St>,
10298        St: AsRef<str>,
10299    {
10300        self._scopes
10301            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10302        self
10303    }
10304
10305    /// Removes all scopes, and no default scope will be used either.
10306    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10307    /// for details).
10308    pub fn clear_scopes(mut self) -> EventticketobjectAddmessageCall<'a, C> {
10309        self._scopes.clear();
10310        self
10311    }
10312}
10313
10314/// Returns the event ticket object with the given object ID.
10315///
10316/// A builder for the *get* method supported by a *eventticketobject* resource.
10317/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
10318///
10319/// # Example
10320///
10321/// Instantiate a resource method builder
10322///
10323/// ```test_harness,no_run
10324/// # extern crate hyper;
10325/// # extern crate hyper_rustls;
10326/// # extern crate google_walletobjects1 as walletobjects1;
10327/// # async fn dox() {
10328/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10329///
10330/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10331/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10332/// #     .with_native_roots()
10333/// #     .unwrap()
10334/// #     .https_only()
10335/// #     .enable_http2()
10336/// #     .build();
10337///
10338/// # let executor = hyper_util::rt::TokioExecutor::new();
10339/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10340/// #     secret,
10341/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10342/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10343/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10344/// #     ),
10345/// # ).build().await.unwrap();
10346///
10347/// # let client = hyper_util::client::legacy::Client::builder(
10348/// #     hyper_util::rt::TokioExecutor::new()
10349/// # )
10350/// # .build(
10351/// #     hyper_rustls::HttpsConnectorBuilder::new()
10352/// #         .with_native_roots()
10353/// #         .unwrap()
10354/// #         .https_or_http()
10355/// #         .enable_http2()
10356/// #         .build()
10357/// # );
10358/// # let mut hub = Walletobjects::new(client, auth);
10359/// // You can configure optional parameters by calling the respective setters at will, and
10360/// // execute the final call using `doit()`.
10361/// // Values shown here are possibly random and not representative !
10362/// let result = hub.eventticketobject().get("resourceId")
10363///              .doit().await;
10364/// # }
10365/// ```
10366pub struct EventticketobjectGetCall<'a, C>
10367where
10368    C: 'a,
10369{
10370    hub: &'a Walletobjects<C>,
10371    _resource_id: String,
10372    _delegate: Option<&'a mut dyn common::Delegate>,
10373    _additional_params: HashMap<String, String>,
10374    _scopes: BTreeSet<String>,
10375}
10376
10377impl<'a, C> common::CallBuilder for EventticketobjectGetCall<'a, C> {}
10378
10379impl<'a, C> EventticketobjectGetCall<'a, C>
10380where
10381    C: common::Connector,
10382{
10383    /// Perform the operation you have build so far.
10384    pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
10385        use std::borrow::Cow;
10386        use std::io::{Read, Seek};
10387
10388        use common::{url::Params, ToParts};
10389        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10390
10391        let mut dd = common::DefaultDelegate;
10392        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10393        dlg.begin(common::MethodInfo {
10394            id: "walletobjects.eventticketobject.get",
10395            http_method: hyper::Method::GET,
10396        });
10397
10398        for &field in ["alt", "resourceId"].iter() {
10399            if self._additional_params.contains_key(field) {
10400                dlg.finished(false);
10401                return Err(common::Error::FieldClash(field));
10402            }
10403        }
10404
10405        let mut params = Params::with_capacity(3 + self._additional_params.len());
10406        params.push("resourceId", self._resource_id);
10407
10408        params.extend(self._additional_params.iter());
10409
10410        params.push("alt", "json");
10411        let mut url =
10412            self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject/{resourceId}";
10413        if self._scopes.is_empty() {
10414            self._scopes
10415                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
10416        }
10417
10418        #[allow(clippy::single_element_loop)]
10419        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
10420            url = params.uri_replacement(url, param_name, find_this, false);
10421        }
10422        {
10423            let to_remove = ["resourceId"];
10424            params.remove_params(&to_remove);
10425        }
10426
10427        let url = params.parse_with_url(&url);
10428
10429        loop {
10430            let token = match self
10431                .hub
10432                .auth
10433                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10434                .await
10435            {
10436                Ok(token) => token,
10437                Err(e) => match dlg.token(e) {
10438                    Ok(token) => token,
10439                    Err(e) => {
10440                        dlg.finished(false);
10441                        return Err(common::Error::MissingToken(e));
10442                    }
10443                },
10444            };
10445            let mut req_result = {
10446                let client = &self.hub.client;
10447                dlg.pre_request();
10448                let mut req_builder = hyper::Request::builder()
10449                    .method(hyper::Method::GET)
10450                    .uri(url.as_str())
10451                    .header(USER_AGENT, self.hub._user_agent.clone());
10452
10453                if let Some(token) = token.as_ref() {
10454                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10455                }
10456
10457                let request = req_builder
10458                    .header(CONTENT_LENGTH, 0_u64)
10459                    .body(common::to_body::<String>(None));
10460
10461                client.request(request.unwrap()).await
10462            };
10463
10464            match req_result {
10465                Err(err) => {
10466                    if let common::Retry::After(d) = dlg.http_error(&err) {
10467                        sleep(d).await;
10468                        continue;
10469                    }
10470                    dlg.finished(false);
10471                    return Err(common::Error::HttpError(err));
10472                }
10473                Ok(res) => {
10474                    let (mut parts, body) = res.into_parts();
10475                    let mut body = common::Body::new(body);
10476                    if !parts.status.is_success() {
10477                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10478                        let error = serde_json::from_str(&common::to_string(&bytes));
10479                        let response = common::to_response(parts, bytes.into());
10480
10481                        if let common::Retry::After(d) =
10482                            dlg.http_failure(&response, error.as_ref().ok())
10483                        {
10484                            sleep(d).await;
10485                            continue;
10486                        }
10487
10488                        dlg.finished(false);
10489
10490                        return Err(match error {
10491                            Ok(value) => common::Error::BadRequest(value),
10492                            _ => common::Error::Failure(response),
10493                        });
10494                    }
10495                    let response = {
10496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10497                        let encoded = common::to_string(&bytes);
10498                        match serde_json::from_str(&encoded) {
10499                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10500                            Err(error) => {
10501                                dlg.response_json_decode_error(&encoded, &error);
10502                                return Err(common::Error::JsonDecodeError(
10503                                    encoded.to_string(),
10504                                    error,
10505                                ));
10506                            }
10507                        }
10508                    };
10509
10510                    dlg.finished(true);
10511                    return Ok(response);
10512                }
10513            }
10514        }
10515    }
10516
10517    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
10518    ///
10519    /// Sets the *resource id* path property to the given value.
10520    ///
10521    /// Even though the property as already been set when instantiating this call,
10522    /// we provide this method for API completeness.
10523    pub fn resource_id(mut self, new_value: &str) -> EventticketobjectGetCall<'a, C> {
10524        self._resource_id = new_value.to_string();
10525        self
10526    }
10527    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10528    /// while executing the actual API request.
10529    ///
10530    /// ````text
10531    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10532    /// ````
10533    ///
10534    /// Sets the *delegate* property to the given value.
10535    pub fn delegate(
10536        mut self,
10537        new_value: &'a mut dyn common::Delegate,
10538    ) -> EventticketobjectGetCall<'a, C> {
10539        self._delegate = Some(new_value);
10540        self
10541    }
10542
10543    /// Set any additional parameter of the query string used in the request.
10544    /// It should be used to set parameters which are not yet available through their own
10545    /// setters.
10546    ///
10547    /// Please note that this method must not be used to set any of the known parameters
10548    /// which have their own setter method. If done anyway, the request will fail.
10549    ///
10550    /// # Additional Parameters
10551    ///
10552    /// * *$.xgafv* (query-string) - V1 error format.
10553    /// * *access_token* (query-string) - OAuth access token.
10554    /// * *alt* (query-string) - Data format for response.
10555    /// * *callback* (query-string) - JSONP
10556    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10557    /// * *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.
10558    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10559    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10560    /// * *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.
10561    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10562    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10563    pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectGetCall<'a, C>
10564    where
10565        T: AsRef<str>,
10566    {
10567        self._additional_params
10568            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10569        self
10570    }
10571
10572    /// Identifies the authorization scope for the method you are building.
10573    ///
10574    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10575    /// [`Scope::WalletObjectIssuer`].
10576    ///
10577    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10578    /// tokens for more than one scope.
10579    ///
10580    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10581    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10582    /// sufficient, a read-write scope will do as well.
10583    pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectGetCall<'a, C>
10584    where
10585        St: AsRef<str>,
10586    {
10587        self._scopes.insert(String::from(scope.as_ref()));
10588        self
10589    }
10590    /// Identifies the authorization scope(s) for the method you are building.
10591    ///
10592    /// See [`Self::add_scope()`] for details.
10593    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectGetCall<'a, C>
10594    where
10595        I: IntoIterator<Item = St>,
10596        St: AsRef<str>,
10597    {
10598        self._scopes
10599            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10600        self
10601    }
10602
10603    /// Removes all scopes, and no default scope will be used either.
10604    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10605    /// for details).
10606    pub fn clear_scopes(mut self) -> EventticketobjectGetCall<'a, C> {
10607        self._scopes.clear();
10608        self
10609    }
10610}
10611
10612/// Inserts an event ticket object with the given ID and properties.
10613///
10614/// A builder for the *insert* method supported by a *eventticketobject* resource.
10615/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
10616///
10617/// # Example
10618///
10619/// Instantiate a resource method builder
10620///
10621/// ```test_harness,no_run
10622/// # extern crate hyper;
10623/// # extern crate hyper_rustls;
10624/// # extern crate google_walletobjects1 as walletobjects1;
10625/// use walletobjects1::api::EventTicketObject;
10626/// # async fn dox() {
10627/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10628///
10629/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10630/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10631/// #     .with_native_roots()
10632/// #     .unwrap()
10633/// #     .https_only()
10634/// #     .enable_http2()
10635/// #     .build();
10636///
10637/// # let executor = hyper_util::rt::TokioExecutor::new();
10638/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10639/// #     secret,
10640/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10641/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10642/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10643/// #     ),
10644/// # ).build().await.unwrap();
10645///
10646/// # let client = hyper_util::client::legacy::Client::builder(
10647/// #     hyper_util::rt::TokioExecutor::new()
10648/// # )
10649/// # .build(
10650/// #     hyper_rustls::HttpsConnectorBuilder::new()
10651/// #         .with_native_roots()
10652/// #         .unwrap()
10653/// #         .https_or_http()
10654/// #         .enable_http2()
10655/// #         .build()
10656/// # );
10657/// # let mut hub = Walletobjects::new(client, auth);
10658/// // As the method needs a request, you would usually fill it with the desired information
10659/// // into the respective structure. Some of the parts shown here might not be applicable !
10660/// // Values shown here are possibly random and not representative !
10661/// let mut req = EventTicketObject::default();
10662///
10663/// // You can configure optional parameters by calling the respective setters at will, and
10664/// // execute the final call using `doit()`.
10665/// // Values shown here are possibly random and not representative !
10666/// let result = hub.eventticketobject().insert(req)
10667///              .doit().await;
10668/// # }
10669/// ```
10670pub struct EventticketobjectInsertCall<'a, C>
10671where
10672    C: 'a,
10673{
10674    hub: &'a Walletobjects<C>,
10675    _request: EventTicketObject,
10676    _delegate: Option<&'a mut dyn common::Delegate>,
10677    _additional_params: HashMap<String, String>,
10678    _scopes: BTreeSet<String>,
10679}
10680
10681impl<'a, C> common::CallBuilder for EventticketobjectInsertCall<'a, C> {}
10682
10683impl<'a, C> EventticketobjectInsertCall<'a, C>
10684where
10685    C: common::Connector,
10686{
10687    /// Perform the operation you have build so far.
10688    pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
10689        use std::borrow::Cow;
10690        use std::io::{Read, Seek};
10691
10692        use common::{url::Params, ToParts};
10693        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10694
10695        let mut dd = common::DefaultDelegate;
10696        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10697        dlg.begin(common::MethodInfo {
10698            id: "walletobjects.eventticketobject.insert",
10699            http_method: hyper::Method::POST,
10700        });
10701
10702        for &field in ["alt"].iter() {
10703            if self._additional_params.contains_key(field) {
10704                dlg.finished(false);
10705                return Err(common::Error::FieldClash(field));
10706            }
10707        }
10708
10709        let mut params = Params::with_capacity(3 + self._additional_params.len());
10710
10711        params.extend(self._additional_params.iter());
10712
10713        params.push("alt", "json");
10714        let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject";
10715        if self._scopes.is_empty() {
10716            self._scopes
10717                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
10718        }
10719
10720        let url = params.parse_with_url(&url);
10721
10722        let mut json_mime_type = mime::APPLICATION_JSON;
10723        let mut request_value_reader = {
10724            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10725            common::remove_json_null_values(&mut value);
10726            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10727            serde_json::to_writer(&mut dst, &value).unwrap();
10728            dst
10729        };
10730        let request_size = request_value_reader
10731            .seek(std::io::SeekFrom::End(0))
10732            .unwrap();
10733        request_value_reader
10734            .seek(std::io::SeekFrom::Start(0))
10735            .unwrap();
10736
10737        loop {
10738            let token = match self
10739                .hub
10740                .auth
10741                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10742                .await
10743            {
10744                Ok(token) => token,
10745                Err(e) => match dlg.token(e) {
10746                    Ok(token) => token,
10747                    Err(e) => {
10748                        dlg.finished(false);
10749                        return Err(common::Error::MissingToken(e));
10750                    }
10751                },
10752            };
10753            request_value_reader
10754                .seek(std::io::SeekFrom::Start(0))
10755                .unwrap();
10756            let mut req_result = {
10757                let client = &self.hub.client;
10758                dlg.pre_request();
10759                let mut req_builder = hyper::Request::builder()
10760                    .method(hyper::Method::POST)
10761                    .uri(url.as_str())
10762                    .header(USER_AGENT, self.hub._user_agent.clone());
10763
10764                if let Some(token) = token.as_ref() {
10765                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10766                }
10767
10768                let request = req_builder
10769                    .header(CONTENT_TYPE, json_mime_type.to_string())
10770                    .header(CONTENT_LENGTH, request_size as u64)
10771                    .body(common::to_body(
10772                        request_value_reader.get_ref().clone().into(),
10773                    ));
10774
10775                client.request(request.unwrap()).await
10776            };
10777
10778            match req_result {
10779                Err(err) => {
10780                    if let common::Retry::After(d) = dlg.http_error(&err) {
10781                        sleep(d).await;
10782                        continue;
10783                    }
10784                    dlg.finished(false);
10785                    return Err(common::Error::HttpError(err));
10786                }
10787                Ok(res) => {
10788                    let (mut parts, body) = res.into_parts();
10789                    let mut body = common::Body::new(body);
10790                    if !parts.status.is_success() {
10791                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10792                        let error = serde_json::from_str(&common::to_string(&bytes));
10793                        let response = common::to_response(parts, bytes.into());
10794
10795                        if let common::Retry::After(d) =
10796                            dlg.http_failure(&response, error.as_ref().ok())
10797                        {
10798                            sleep(d).await;
10799                            continue;
10800                        }
10801
10802                        dlg.finished(false);
10803
10804                        return Err(match error {
10805                            Ok(value) => common::Error::BadRequest(value),
10806                            _ => common::Error::Failure(response),
10807                        });
10808                    }
10809                    let response = {
10810                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10811                        let encoded = common::to_string(&bytes);
10812                        match serde_json::from_str(&encoded) {
10813                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10814                            Err(error) => {
10815                                dlg.response_json_decode_error(&encoded, &error);
10816                                return Err(common::Error::JsonDecodeError(
10817                                    encoded.to_string(),
10818                                    error,
10819                                ));
10820                            }
10821                        }
10822                    };
10823
10824                    dlg.finished(true);
10825                    return Ok(response);
10826                }
10827            }
10828        }
10829    }
10830
10831    ///
10832    /// Sets the *request* property to the given value.
10833    ///
10834    /// Even though the property as already been set when instantiating this call,
10835    /// we provide this method for API completeness.
10836    pub fn request(mut self, new_value: EventTicketObject) -> EventticketobjectInsertCall<'a, C> {
10837        self._request = new_value;
10838        self
10839    }
10840    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10841    /// while executing the actual API request.
10842    ///
10843    /// ````text
10844    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10845    /// ````
10846    ///
10847    /// Sets the *delegate* property to the given value.
10848    pub fn delegate(
10849        mut self,
10850        new_value: &'a mut dyn common::Delegate,
10851    ) -> EventticketobjectInsertCall<'a, C> {
10852        self._delegate = Some(new_value);
10853        self
10854    }
10855
10856    /// Set any additional parameter of the query string used in the request.
10857    /// It should be used to set parameters which are not yet available through their own
10858    /// setters.
10859    ///
10860    /// Please note that this method must not be used to set any of the known parameters
10861    /// which have their own setter method. If done anyway, the request will fail.
10862    ///
10863    /// # Additional Parameters
10864    ///
10865    /// * *$.xgafv* (query-string) - V1 error format.
10866    /// * *access_token* (query-string) - OAuth access token.
10867    /// * *alt* (query-string) - Data format for response.
10868    /// * *callback* (query-string) - JSONP
10869    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10870    /// * *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.
10871    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10872    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10873    /// * *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.
10874    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10875    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10876    pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectInsertCall<'a, C>
10877    where
10878        T: AsRef<str>,
10879    {
10880        self._additional_params
10881            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10882        self
10883    }
10884
10885    /// Identifies the authorization scope for the method you are building.
10886    ///
10887    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10888    /// [`Scope::WalletObjectIssuer`].
10889    ///
10890    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10891    /// tokens for more than one scope.
10892    ///
10893    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10894    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10895    /// sufficient, a read-write scope will do as well.
10896    pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectInsertCall<'a, C>
10897    where
10898        St: AsRef<str>,
10899    {
10900        self._scopes.insert(String::from(scope.as_ref()));
10901        self
10902    }
10903    /// Identifies the authorization scope(s) for the method you are building.
10904    ///
10905    /// See [`Self::add_scope()`] for details.
10906    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectInsertCall<'a, C>
10907    where
10908        I: IntoIterator<Item = St>,
10909        St: AsRef<str>,
10910    {
10911        self._scopes
10912            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10913        self
10914    }
10915
10916    /// Removes all scopes, and no default scope will be used either.
10917    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10918    /// for details).
10919    pub fn clear_scopes(mut self) -> EventticketobjectInsertCall<'a, C> {
10920        self._scopes.clear();
10921        self
10922    }
10923}
10924
10925/// Returns a list of all event ticket objects for a given issuer ID.
10926///
10927/// A builder for the *list* method supported by a *eventticketobject* resource.
10928/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
10929///
10930/// # Example
10931///
10932/// Instantiate a resource method builder
10933///
10934/// ```test_harness,no_run
10935/// # extern crate hyper;
10936/// # extern crate hyper_rustls;
10937/// # extern crate google_walletobjects1 as walletobjects1;
10938/// # async fn dox() {
10939/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10940///
10941/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10942/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10943/// #     .with_native_roots()
10944/// #     .unwrap()
10945/// #     .https_only()
10946/// #     .enable_http2()
10947/// #     .build();
10948///
10949/// # let executor = hyper_util::rt::TokioExecutor::new();
10950/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10951/// #     secret,
10952/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10953/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10954/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10955/// #     ),
10956/// # ).build().await.unwrap();
10957///
10958/// # let client = hyper_util::client::legacy::Client::builder(
10959/// #     hyper_util::rt::TokioExecutor::new()
10960/// # )
10961/// # .build(
10962/// #     hyper_rustls::HttpsConnectorBuilder::new()
10963/// #         .with_native_roots()
10964/// #         .unwrap()
10965/// #         .https_or_http()
10966/// #         .enable_http2()
10967/// #         .build()
10968/// # );
10969/// # let mut hub = Walletobjects::new(client, auth);
10970/// // You can configure optional parameters by calling the respective setters at will, and
10971/// // execute the final call using `doit()`.
10972/// // Values shown here are possibly random and not representative !
10973/// let result = hub.eventticketobject().list()
10974///              .token("ipsum")
10975///              .max_results(-62)
10976///              .class_id("Lorem")
10977///              .doit().await;
10978/// # }
10979/// ```
10980pub struct EventticketobjectListCall<'a, C>
10981where
10982    C: 'a,
10983{
10984    hub: &'a Walletobjects<C>,
10985    _token: Option<String>,
10986    _max_results: Option<i32>,
10987    _class_id: Option<String>,
10988    _delegate: Option<&'a mut dyn common::Delegate>,
10989    _additional_params: HashMap<String, String>,
10990    _scopes: BTreeSet<String>,
10991}
10992
10993impl<'a, C> common::CallBuilder for EventticketobjectListCall<'a, C> {}
10994
10995impl<'a, C> EventticketobjectListCall<'a, C>
10996where
10997    C: common::Connector,
10998{
10999    /// Perform the operation you have build so far.
11000    pub async fn doit(
11001        mut self,
11002    ) -> common::Result<(common::Response, EventTicketObjectListResponse)> {
11003        use std::borrow::Cow;
11004        use std::io::{Read, Seek};
11005
11006        use common::{url::Params, ToParts};
11007        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11008
11009        let mut dd = common::DefaultDelegate;
11010        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11011        dlg.begin(common::MethodInfo {
11012            id: "walletobjects.eventticketobject.list",
11013            http_method: hyper::Method::GET,
11014        });
11015
11016        for &field in ["alt", "token", "maxResults", "classId"].iter() {
11017            if self._additional_params.contains_key(field) {
11018                dlg.finished(false);
11019                return Err(common::Error::FieldClash(field));
11020            }
11021        }
11022
11023        let mut params = Params::with_capacity(5 + self._additional_params.len());
11024        if let Some(value) = self._token.as_ref() {
11025            params.push("token", value);
11026        }
11027        if let Some(value) = self._max_results.as_ref() {
11028            params.push("maxResults", value.to_string());
11029        }
11030        if let Some(value) = self._class_id.as_ref() {
11031            params.push("classId", value);
11032        }
11033
11034        params.extend(self._additional_params.iter());
11035
11036        params.push("alt", "json");
11037        let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject";
11038        if self._scopes.is_empty() {
11039            self._scopes
11040                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
11041        }
11042
11043        let url = params.parse_with_url(&url);
11044
11045        loop {
11046            let token = match self
11047                .hub
11048                .auth
11049                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11050                .await
11051            {
11052                Ok(token) => token,
11053                Err(e) => match dlg.token(e) {
11054                    Ok(token) => token,
11055                    Err(e) => {
11056                        dlg.finished(false);
11057                        return Err(common::Error::MissingToken(e));
11058                    }
11059                },
11060            };
11061            let mut req_result = {
11062                let client = &self.hub.client;
11063                dlg.pre_request();
11064                let mut req_builder = hyper::Request::builder()
11065                    .method(hyper::Method::GET)
11066                    .uri(url.as_str())
11067                    .header(USER_AGENT, self.hub._user_agent.clone());
11068
11069                if let Some(token) = token.as_ref() {
11070                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11071                }
11072
11073                let request = req_builder
11074                    .header(CONTENT_LENGTH, 0_u64)
11075                    .body(common::to_body::<String>(None));
11076
11077                client.request(request.unwrap()).await
11078            };
11079
11080            match req_result {
11081                Err(err) => {
11082                    if let common::Retry::After(d) = dlg.http_error(&err) {
11083                        sleep(d).await;
11084                        continue;
11085                    }
11086                    dlg.finished(false);
11087                    return Err(common::Error::HttpError(err));
11088                }
11089                Ok(res) => {
11090                    let (mut parts, body) = res.into_parts();
11091                    let mut body = common::Body::new(body);
11092                    if !parts.status.is_success() {
11093                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11094                        let error = serde_json::from_str(&common::to_string(&bytes));
11095                        let response = common::to_response(parts, bytes.into());
11096
11097                        if let common::Retry::After(d) =
11098                            dlg.http_failure(&response, error.as_ref().ok())
11099                        {
11100                            sleep(d).await;
11101                            continue;
11102                        }
11103
11104                        dlg.finished(false);
11105
11106                        return Err(match error {
11107                            Ok(value) => common::Error::BadRequest(value),
11108                            _ => common::Error::Failure(response),
11109                        });
11110                    }
11111                    let response = {
11112                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11113                        let encoded = common::to_string(&bytes);
11114                        match serde_json::from_str(&encoded) {
11115                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11116                            Err(error) => {
11117                                dlg.response_json_decode_error(&encoded, &error);
11118                                return Err(common::Error::JsonDecodeError(
11119                                    encoded.to_string(),
11120                                    error,
11121                                ));
11122                            }
11123                        }
11124                    };
11125
11126                    dlg.finished(true);
11127                    return Ok(response);
11128                }
11129            }
11130        }
11131    }
11132
11133    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` objects are available in a list. For example, if you have a list of 200 objects and you call list with `maxResults` set to 20, list will return the first 20 objects and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 objects.
11134    ///
11135    /// Sets the *token* query property to the given value.
11136    pub fn token(mut self, new_value: &str) -> EventticketobjectListCall<'a, C> {
11137        self._token = Some(new_value.to_string());
11138        self
11139    }
11140    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
11141    ///
11142    /// Sets the *max results* query property to the given value.
11143    pub fn max_results(mut self, new_value: i32) -> EventticketobjectListCall<'a, C> {
11144        self._max_results = Some(new_value);
11145        self
11146    }
11147    /// The ID of the class whose objects will be listed.
11148    ///
11149    /// Sets the *class id* query property to the given value.
11150    pub fn class_id(mut self, new_value: &str) -> EventticketobjectListCall<'a, C> {
11151        self._class_id = Some(new_value.to_string());
11152        self
11153    }
11154    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11155    /// while executing the actual API request.
11156    ///
11157    /// ````text
11158    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11159    /// ````
11160    ///
11161    /// Sets the *delegate* property to the given value.
11162    pub fn delegate(
11163        mut self,
11164        new_value: &'a mut dyn common::Delegate,
11165    ) -> EventticketobjectListCall<'a, C> {
11166        self._delegate = Some(new_value);
11167        self
11168    }
11169
11170    /// Set any additional parameter of the query string used in the request.
11171    /// It should be used to set parameters which are not yet available through their own
11172    /// setters.
11173    ///
11174    /// Please note that this method must not be used to set any of the known parameters
11175    /// which have their own setter method. If done anyway, the request will fail.
11176    ///
11177    /// # Additional Parameters
11178    ///
11179    /// * *$.xgafv* (query-string) - V1 error format.
11180    /// * *access_token* (query-string) - OAuth access token.
11181    /// * *alt* (query-string) - Data format for response.
11182    /// * *callback* (query-string) - JSONP
11183    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11184    /// * *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.
11185    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11186    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11187    /// * *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.
11188    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11189    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11190    pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectListCall<'a, C>
11191    where
11192        T: AsRef<str>,
11193    {
11194        self._additional_params
11195            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11196        self
11197    }
11198
11199    /// Identifies the authorization scope for the method you are building.
11200    ///
11201    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11202    /// [`Scope::WalletObjectIssuer`].
11203    ///
11204    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11205    /// tokens for more than one scope.
11206    ///
11207    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11208    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11209    /// sufficient, a read-write scope will do as well.
11210    pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectListCall<'a, C>
11211    where
11212        St: AsRef<str>,
11213    {
11214        self._scopes.insert(String::from(scope.as_ref()));
11215        self
11216    }
11217    /// Identifies the authorization scope(s) for the method you are building.
11218    ///
11219    /// See [`Self::add_scope()`] for details.
11220    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectListCall<'a, C>
11221    where
11222        I: IntoIterator<Item = St>,
11223        St: AsRef<str>,
11224    {
11225        self._scopes
11226            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11227        self
11228    }
11229
11230    /// Removes all scopes, and no default scope will be used either.
11231    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11232    /// for details).
11233    pub fn clear_scopes(mut self) -> EventticketobjectListCall<'a, C> {
11234        self._scopes.clear();
11235        self
11236    }
11237}
11238
11239/// Modifies linked offer objects for the event ticket object with the given ID.
11240///
11241/// A builder for the *modifylinkedofferobjects* method supported by a *eventticketobject* resource.
11242/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
11243///
11244/// # Example
11245///
11246/// Instantiate a resource method builder
11247///
11248/// ```test_harness,no_run
11249/// # extern crate hyper;
11250/// # extern crate hyper_rustls;
11251/// # extern crate google_walletobjects1 as walletobjects1;
11252/// use walletobjects1::api::ModifyLinkedOfferObjectsRequest;
11253/// # async fn dox() {
11254/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11255///
11256/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11257/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11258/// #     .with_native_roots()
11259/// #     .unwrap()
11260/// #     .https_only()
11261/// #     .enable_http2()
11262/// #     .build();
11263///
11264/// # let executor = hyper_util::rt::TokioExecutor::new();
11265/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11266/// #     secret,
11267/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11268/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11269/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11270/// #     ),
11271/// # ).build().await.unwrap();
11272///
11273/// # let client = hyper_util::client::legacy::Client::builder(
11274/// #     hyper_util::rt::TokioExecutor::new()
11275/// # )
11276/// # .build(
11277/// #     hyper_rustls::HttpsConnectorBuilder::new()
11278/// #         .with_native_roots()
11279/// #         .unwrap()
11280/// #         .https_or_http()
11281/// #         .enable_http2()
11282/// #         .build()
11283/// # );
11284/// # let mut hub = Walletobjects::new(client, auth);
11285/// // As the method needs a request, you would usually fill it with the desired information
11286/// // into the respective structure. Some of the parts shown here might not be applicable !
11287/// // Values shown here are possibly random and not representative !
11288/// let mut req = ModifyLinkedOfferObjectsRequest::default();
11289///
11290/// // You can configure optional parameters by calling the respective setters at will, and
11291/// // execute the final call using `doit()`.
11292/// // Values shown here are possibly random and not representative !
11293/// let result = hub.eventticketobject().modifylinkedofferobjects(req, "resourceId")
11294///              .doit().await;
11295/// # }
11296/// ```
11297pub struct EventticketobjectModifylinkedofferobjectCall<'a, C>
11298where
11299    C: 'a,
11300{
11301    hub: &'a Walletobjects<C>,
11302    _request: ModifyLinkedOfferObjectsRequest,
11303    _resource_id: String,
11304    _delegate: Option<&'a mut dyn common::Delegate>,
11305    _additional_params: HashMap<String, String>,
11306    _scopes: BTreeSet<String>,
11307}
11308
11309impl<'a, C> common::CallBuilder for EventticketobjectModifylinkedofferobjectCall<'a, C> {}
11310
11311impl<'a, C> EventticketobjectModifylinkedofferobjectCall<'a, C>
11312where
11313    C: common::Connector,
11314{
11315    /// Perform the operation you have build so far.
11316    pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
11317        use std::borrow::Cow;
11318        use std::io::{Read, Seek};
11319
11320        use common::{url::Params, ToParts};
11321        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11322
11323        let mut dd = common::DefaultDelegate;
11324        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11325        dlg.begin(common::MethodInfo {
11326            id: "walletobjects.eventticketobject.modifylinkedofferobjects",
11327            http_method: hyper::Method::POST,
11328        });
11329
11330        for &field in ["alt", "resourceId"].iter() {
11331            if self._additional_params.contains_key(field) {
11332                dlg.finished(false);
11333                return Err(common::Error::FieldClash(field));
11334            }
11335        }
11336
11337        let mut params = Params::with_capacity(4 + self._additional_params.len());
11338        params.push("resourceId", self._resource_id);
11339
11340        params.extend(self._additional_params.iter());
11341
11342        params.push("alt", "json");
11343        let mut url = self.hub._base_url.clone()
11344            + "walletobjects/v1/eventTicketObject/{resourceId}/modifyLinkedOfferObjects";
11345        if self._scopes.is_empty() {
11346            self._scopes
11347                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
11348        }
11349
11350        #[allow(clippy::single_element_loop)]
11351        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
11352            url = params.uri_replacement(url, param_name, find_this, false);
11353        }
11354        {
11355            let to_remove = ["resourceId"];
11356            params.remove_params(&to_remove);
11357        }
11358
11359        let url = params.parse_with_url(&url);
11360
11361        let mut json_mime_type = mime::APPLICATION_JSON;
11362        let mut request_value_reader = {
11363            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11364            common::remove_json_null_values(&mut value);
11365            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11366            serde_json::to_writer(&mut dst, &value).unwrap();
11367            dst
11368        };
11369        let request_size = request_value_reader
11370            .seek(std::io::SeekFrom::End(0))
11371            .unwrap();
11372        request_value_reader
11373            .seek(std::io::SeekFrom::Start(0))
11374            .unwrap();
11375
11376        loop {
11377            let token = match self
11378                .hub
11379                .auth
11380                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11381                .await
11382            {
11383                Ok(token) => token,
11384                Err(e) => match dlg.token(e) {
11385                    Ok(token) => token,
11386                    Err(e) => {
11387                        dlg.finished(false);
11388                        return Err(common::Error::MissingToken(e));
11389                    }
11390                },
11391            };
11392            request_value_reader
11393                .seek(std::io::SeekFrom::Start(0))
11394                .unwrap();
11395            let mut req_result = {
11396                let client = &self.hub.client;
11397                dlg.pre_request();
11398                let mut req_builder = hyper::Request::builder()
11399                    .method(hyper::Method::POST)
11400                    .uri(url.as_str())
11401                    .header(USER_AGENT, self.hub._user_agent.clone());
11402
11403                if let Some(token) = token.as_ref() {
11404                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11405                }
11406
11407                let request = req_builder
11408                    .header(CONTENT_TYPE, json_mime_type.to_string())
11409                    .header(CONTENT_LENGTH, request_size as u64)
11410                    .body(common::to_body(
11411                        request_value_reader.get_ref().clone().into(),
11412                    ));
11413
11414                client.request(request.unwrap()).await
11415            };
11416
11417            match req_result {
11418                Err(err) => {
11419                    if let common::Retry::After(d) = dlg.http_error(&err) {
11420                        sleep(d).await;
11421                        continue;
11422                    }
11423                    dlg.finished(false);
11424                    return Err(common::Error::HttpError(err));
11425                }
11426                Ok(res) => {
11427                    let (mut parts, body) = res.into_parts();
11428                    let mut body = common::Body::new(body);
11429                    if !parts.status.is_success() {
11430                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11431                        let error = serde_json::from_str(&common::to_string(&bytes));
11432                        let response = common::to_response(parts, bytes.into());
11433
11434                        if let common::Retry::After(d) =
11435                            dlg.http_failure(&response, error.as_ref().ok())
11436                        {
11437                            sleep(d).await;
11438                            continue;
11439                        }
11440
11441                        dlg.finished(false);
11442
11443                        return Err(match error {
11444                            Ok(value) => common::Error::BadRequest(value),
11445                            _ => common::Error::Failure(response),
11446                        });
11447                    }
11448                    let response = {
11449                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11450                        let encoded = common::to_string(&bytes);
11451                        match serde_json::from_str(&encoded) {
11452                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11453                            Err(error) => {
11454                                dlg.response_json_decode_error(&encoded, &error);
11455                                return Err(common::Error::JsonDecodeError(
11456                                    encoded.to_string(),
11457                                    error,
11458                                ));
11459                            }
11460                        }
11461                    };
11462
11463                    dlg.finished(true);
11464                    return Ok(response);
11465                }
11466            }
11467        }
11468    }
11469
11470    ///
11471    /// Sets the *request* property to the given value.
11472    ///
11473    /// Even though the property as already been set when instantiating this call,
11474    /// we provide this method for API completeness.
11475    pub fn request(
11476        mut self,
11477        new_value: ModifyLinkedOfferObjectsRequest,
11478    ) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
11479        self._request = new_value;
11480        self
11481    }
11482    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
11483    ///
11484    /// Sets the *resource id* path property to the given value.
11485    ///
11486    /// Even though the property as already been set when instantiating this call,
11487    /// we provide this method for API completeness.
11488    pub fn resource_id(
11489        mut self,
11490        new_value: &str,
11491    ) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
11492        self._resource_id = new_value.to_string();
11493        self
11494    }
11495    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11496    /// while executing the actual API request.
11497    ///
11498    /// ````text
11499    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11500    /// ````
11501    ///
11502    /// Sets the *delegate* property to the given value.
11503    pub fn delegate(
11504        mut self,
11505        new_value: &'a mut dyn common::Delegate,
11506    ) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
11507        self._delegate = Some(new_value);
11508        self
11509    }
11510
11511    /// Set any additional parameter of the query string used in the request.
11512    /// It should be used to set parameters which are not yet available through their own
11513    /// setters.
11514    ///
11515    /// Please note that this method must not be used to set any of the known parameters
11516    /// which have their own setter method. If done anyway, the request will fail.
11517    ///
11518    /// # Additional Parameters
11519    ///
11520    /// * *$.xgafv* (query-string) - V1 error format.
11521    /// * *access_token* (query-string) - OAuth access token.
11522    /// * *alt* (query-string) - Data format for response.
11523    /// * *callback* (query-string) - JSONP
11524    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11525    /// * *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.
11526    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11527    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11528    /// * *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.
11529    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11530    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11531    pub fn param<T>(
11532        mut self,
11533        name: T,
11534        value: T,
11535    ) -> EventticketobjectModifylinkedofferobjectCall<'a, C>
11536    where
11537        T: AsRef<str>,
11538    {
11539        self._additional_params
11540            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11541        self
11542    }
11543
11544    /// Identifies the authorization scope for the method you are building.
11545    ///
11546    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11547    /// [`Scope::WalletObjectIssuer`].
11548    ///
11549    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11550    /// tokens for more than one scope.
11551    ///
11552    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11553    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11554    /// sufficient, a read-write scope will do as well.
11555    pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectModifylinkedofferobjectCall<'a, C>
11556    where
11557        St: AsRef<str>,
11558    {
11559        self._scopes.insert(String::from(scope.as_ref()));
11560        self
11561    }
11562    /// Identifies the authorization scope(s) for the method you are building.
11563    ///
11564    /// See [`Self::add_scope()`] for details.
11565    pub fn add_scopes<I, St>(
11566        mut self,
11567        scopes: I,
11568    ) -> EventticketobjectModifylinkedofferobjectCall<'a, C>
11569    where
11570        I: IntoIterator<Item = St>,
11571        St: AsRef<str>,
11572    {
11573        self._scopes
11574            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11575        self
11576    }
11577
11578    /// Removes all scopes, and no default scope will be used either.
11579    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11580    /// for details).
11581    pub fn clear_scopes(mut self) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
11582        self._scopes.clear();
11583        self
11584    }
11585}
11586
11587/// Updates the event ticket object referenced by the given object ID. This method supports patch semantics.
11588///
11589/// A builder for the *patch* method supported by a *eventticketobject* resource.
11590/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
11591///
11592/// # Example
11593///
11594/// Instantiate a resource method builder
11595///
11596/// ```test_harness,no_run
11597/// # extern crate hyper;
11598/// # extern crate hyper_rustls;
11599/// # extern crate google_walletobjects1 as walletobjects1;
11600/// use walletobjects1::api::EventTicketObject;
11601/// # async fn dox() {
11602/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11603///
11604/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11605/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11606/// #     .with_native_roots()
11607/// #     .unwrap()
11608/// #     .https_only()
11609/// #     .enable_http2()
11610/// #     .build();
11611///
11612/// # let executor = hyper_util::rt::TokioExecutor::new();
11613/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11614/// #     secret,
11615/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11616/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11617/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11618/// #     ),
11619/// # ).build().await.unwrap();
11620///
11621/// # let client = hyper_util::client::legacy::Client::builder(
11622/// #     hyper_util::rt::TokioExecutor::new()
11623/// # )
11624/// # .build(
11625/// #     hyper_rustls::HttpsConnectorBuilder::new()
11626/// #         .with_native_roots()
11627/// #         .unwrap()
11628/// #         .https_or_http()
11629/// #         .enable_http2()
11630/// #         .build()
11631/// # );
11632/// # let mut hub = Walletobjects::new(client, auth);
11633/// // As the method needs a request, you would usually fill it with the desired information
11634/// // into the respective structure. Some of the parts shown here might not be applicable !
11635/// // Values shown here are possibly random and not representative !
11636/// let mut req = EventTicketObject::default();
11637///
11638/// // You can configure optional parameters by calling the respective setters at will, and
11639/// // execute the final call using `doit()`.
11640/// // Values shown here are possibly random and not representative !
11641/// let result = hub.eventticketobject().patch(req, "resourceId")
11642///              .doit().await;
11643/// # }
11644/// ```
11645pub struct EventticketobjectPatchCall<'a, C>
11646where
11647    C: 'a,
11648{
11649    hub: &'a Walletobjects<C>,
11650    _request: EventTicketObject,
11651    _resource_id: String,
11652    _delegate: Option<&'a mut dyn common::Delegate>,
11653    _additional_params: HashMap<String, String>,
11654    _scopes: BTreeSet<String>,
11655}
11656
11657impl<'a, C> common::CallBuilder for EventticketobjectPatchCall<'a, C> {}
11658
11659impl<'a, C> EventticketobjectPatchCall<'a, C>
11660where
11661    C: common::Connector,
11662{
11663    /// Perform the operation you have build so far.
11664    pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
11665        use std::borrow::Cow;
11666        use std::io::{Read, Seek};
11667
11668        use common::{url::Params, ToParts};
11669        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11670
11671        let mut dd = common::DefaultDelegate;
11672        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11673        dlg.begin(common::MethodInfo {
11674            id: "walletobjects.eventticketobject.patch",
11675            http_method: hyper::Method::PATCH,
11676        });
11677
11678        for &field in ["alt", "resourceId"].iter() {
11679            if self._additional_params.contains_key(field) {
11680                dlg.finished(false);
11681                return Err(common::Error::FieldClash(field));
11682            }
11683        }
11684
11685        let mut params = Params::with_capacity(4 + self._additional_params.len());
11686        params.push("resourceId", self._resource_id);
11687
11688        params.extend(self._additional_params.iter());
11689
11690        params.push("alt", "json");
11691        let mut url =
11692            self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject/{resourceId}";
11693        if self._scopes.is_empty() {
11694            self._scopes
11695                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
11696        }
11697
11698        #[allow(clippy::single_element_loop)]
11699        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
11700            url = params.uri_replacement(url, param_name, find_this, false);
11701        }
11702        {
11703            let to_remove = ["resourceId"];
11704            params.remove_params(&to_remove);
11705        }
11706
11707        let url = params.parse_with_url(&url);
11708
11709        let mut json_mime_type = mime::APPLICATION_JSON;
11710        let mut request_value_reader = {
11711            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11712            common::remove_json_null_values(&mut value);
11713            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11714            serde_json::to_writer(&mut dst, &value).unwrap();
11715            dst
11716        };
11717        let request_size = request_value_reader
11718            .seek(std::io::SeekFrom::End(0))
11719            .unwrap();
11720        request_value_reader
11721            .seek(std::io::SeekFrom::Start(0))
11722            .unwrap();
11723
11724        loop {
11725            let token = match self
11726                .hub
11727                .auth
11728                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11729                .await
11730            {
11731                Ok(token) => token,
11732                Err(e) => match dlg.token(e) {
11733                    Ok(token) => token,
11734                    Err(e) => {
11735                        dlg.finished(false);
11736                        return Err(common::Error::MissingToken(e));
11737                    }
11738                },
11739            };
11740            request_value_reader
11741                .seek(std::io::SeekFrom::Start(0))
11742                .unwrap();
11743            let mut req_result = {
11744                let client = &self.hub.client;
11745                dlg.pre_request();
11746                let mut req_builder = hyper::Request::builder()
11747                    .method(hyper::Method::PATCH)
11748                    .uri(url.as_str())
11749                    .header(USER_AGENT, self.hub._user_agent.clone());
11750
11751                if let Some(token) = token.as_ref() {
11752                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11753                }
11754
11755                let request = req_builder
11756                    .header(CONTENT_TYPE, json_mime_type.to_string())
11757                    .header(CONTENT_LENGTH, request_size as u64)
11758                    .body(common::to_body(
11759                        request_value_reader.get_ref().clone().into(),
11760                    ));
11761
11762                client.request(request.unwrap()).await
11763            };
11764
11765            match req_result {
11766                Err(err) => {
11767                    if let common::Retry::After(d) = dlg.http_error(&err) {
11768                        sleep(d).await;
11769                        continue;
11770                    }
11771                    dlg.finished(false);
11772                    return Err(common::Error::HttpError(err));
11773                }
11774                Ok(res) => {
11775                    let (mut parts, body) = res.into_parts();
11776                    let mut body = common::Body::new(body);
11777                    if !parts.status.is_success() {
11778                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11779                        let error = serde_json::from_str(&common::to_string(&bytes));
11780                        let response = common::to_response(parts, bytes.into());
11781
11782                        if let common::Retry::After(d) =
11783                            dlg.http_failure(&response, error.as_ref().ok())
11784                        {
11785                            sleep(d).await;
11786                            continue;
11787                        }
11788
11789                        dlg.finished(false);
11790
11791                        return Err(match error {
11792                            Ok(value) => common::Error::BadRequest(value),
11793                            _ => common::Error::Failure(response),
11794                        });
11795                    }
11796                    let response = {
11797                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11798                        let encoded = common::to_string(&bytes);
11799                        match serde_json::from_str(&encoded) {
11800                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11801                            Err(error) => {
11802                                dlg.response_json_decode_error(&encoded, &error);
11803                                return Err(common::Error::JsonDecodeError(
11804                                    encoded.to_string(),
11805                                    error,
11806                                ));
11807                            }
11808                        }
11809                    };
11810
11811                    dlg.finished(true);
11812                    return Ok(response);
11813                }
11814            }
11815        }
11816    }
11817
11818    ///
11819    /// Sets the *request* property to the given value.
11820    ///
11821    /// Even though the property as already been set when instantiating this call,
11822    /// we provide this method for API completeness.
11823    pub fn request(mut self, new_value: EventTicketObject) -> EventticketobjectPatchCall<'a, C> {
11824        self._request = new_value;
11825        self
11826    }
11827    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
11828    ///
11829    /// Sets the *resource id* path property to the given value.
11830    ///
11831    /// Even though the property as already been set when instantiating this call,
11832    /// we provide this method for API completeness.
11833    pub fn resource_id(mut self, new_value: &str) -> EventticketobjectPatchCall<'a, C> {
11834        self._resource_id = new_value.to_string();
11835        self
11836    }
11837    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11838    /// while executing the actual API request.
11839    ///
11840    /// ````text
11841    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11842    /// ````
11843    ///
11844    /// Sets the *delegate* property to the given value.
11845    pub fn delegate(
11846        mut self,
11847        new_value: &'a mut dyn common::Delegate,
11848    ) -> EventticketobjectPatchCall<'a, C> {
11849        self._delegate = Some(new_value);
11850        self
11851    }
11852
11853    /// Set any additional parameter of the query string used in the request.
11854    /// It should be used to set parameters which are not yet available through their own
11855    /// setters.
11856    ///
11857    /// Please note that this method must not be used to set any of the known parameters
11858    /// which have their own setter method. If done anyway, the request will fail.
11859    ///
11860    /// # Additional Parameters
11861    ///
11862    /// * *$.xgafv* (query-string) - V1 error format.
11863    /// * *access_token* (query-string) - OAuth access token.
11864    /// * *alt* (query-string) - Data format for response.
11865    /// * *callback* (query-string) - JSONP
11866    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11867    /// * *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.
11868    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11869    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11870    /// * *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.
11871    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11872    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11873    pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectPatchCall<'a, C>
11874    where
11875        T: AsRef<str>,
11876    {
11877        self._additional_params
11878            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11879        self
11880    }
11881
11882    /// Identifies the authorization scope for the method you are building.
11883    ///
11884    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11885    /// [`Scope::WalletObjectIssuer`].
11886    ///
11887    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11888    /// tokens for more than one scope.
11889    ///
11890    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11891    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11892    /// sufficient, a read-write scope will do as well.
11893    pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectPatchCall<'a, C>
11894    where
11895        St: AsRef<str>,
11896    {
11897        self._scopes.insert(String::from(scope.as_ref()));
11898        self
11899    }
11900    /// Identifies the authorization scope(s) for the method you are building.
11901    ///
11902    /// See [`Self::add_scope()`] for details.
11903    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectPatchCall<'a, C>
11904    where
11905        I: IntoIterator<Item = St>,
11906        St: AsRef<str>,
11907    {
11908        self._scopes
11909            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11910        self
11911    }
11912
11913    /// Removes all scopes, and no default scope will be used either.
11914    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11915    /// for details).
11916    pub fn clear_scopes(mut self) -> EventticketobjectPatchCall<'a, C> {
11917        self._scopes.clear();
11918        self
11919    }
11920}
11921
11922/// Updates the event ticket object referenced by the given object ID.
11923///
11924/// A builder for the *update* method supported by a *eventticketobject* resource.
11925/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
11926///
11927/// # Example
11928///
11929/// Instantiate a resource method builder
11930///
11931/// ```test_harness,no_run
11932/// # extern crate hyper;
11933/// # extern crate hyper_rustls;
11934/// # extern crate google_walletobjects1 as walletobjects1;
11935/// use walletobjects1::api::EventTicketObject;
11936/// # async fn dox() {
11937/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11938///
11939/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11940/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11941/// #     .with_native_roots()
11942/// #     .unwrap()
11943/// #     .https_only()
11944/// #     .enable_http2()
11945/// #     .build();
11946///
11947/// # let executor = hyper_util::rt::TokioExecutor::new();
11948/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11949/// #     secret,
11950/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11951/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11952/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11953/// #     ),
11954/// # ).build().await.unwrap();
11955///
11956/// # let client = hyper_util::client::legacy::Client::builder(
11957/// #     hyper_util::rt::TokioExecutor::new()
11958/// # )
11959/// # .build(
11960/// #     hyper_rustls::HttpsConnectorBuilder::new()
11961/// #         .with_native_roots()
11962/// #         .unwrap()
11963/// #         .https_or_http()
11964/// #         .enable_http2()
11965/// #         .build()
11966/// # );
11967/// # let mut hub = Walletobjects::new(client, auth);
11968/// // As the method needs a request, you would usually fill it with the desired information
11969/// // into the respective structure. Some of the parts shown here might not be applicable !
11970/// // Values shown here are possibly random and not representative !
11971/// let mut req = EventTicketObject::default();
11972///
11973/// // You can configure optional parameters by calling the respective setters at will, and
11974/// // execute the final call using `doit()`.
11975/// // Values shown here are possibly random and not representative !
11976/// let result = hub.eventticketobject().update(req, "resourceId")
11977///              .doit().await;
11978/// # }
11979/// ```
11980pub struct EventticketobjectUpdateCall<'a, C>
11981where
11982    C: 'a,
11983{
11984    hub: &'a Walletobjects<C>,
11985    _request: EventTicketObject,
11986    _resource_id: String,
11987    _delegate: Option<&'a mut dyn common::Delegate>,
11988    _additional_params: HashMap<String, String>,
11989    _scopes: BTreeSet<String>,
11990}
11991
11992impl<'a, C> common::CallBuilder for EventticketobjectUpdateCall<'a, C> {}
11993
11994impl<'a, C> EventticketobjectUpdateCall<'a, C>
11995where
11996    C: common::Connector,
11997{
11998    /// Perform the operation you have build so far.
11999    pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
12000        use std::borrow::Cow;
12001        use std::io::{Read, Seek};
12002
12003        use common::{url::Params, ToParts};
12004        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12005
12006        let mut dd = common::DefaultDelegate;
12007        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12008        dlg.begin(common::MethodInfo {
12009            id: "walletobjects.eventticketobject.update",
12010            http_method: hyper::Method::PUT,
12011        });
12012
12013        for &field in ["alt", "resourceId"].iter() {
12014            if self._additional_params.contains_key(field) {
12015                dlg.finished(false);
12016                return Err(common::Error::FieldClash(field));
12017            }
12018        }
12019
12020        let mut params = Params::with_capacity(4 + self._additional_params.len());
12021        params.push("resourceId", self._resource_id);
12022
12023        params.extend(self._additional_params.iter());
12024
12025        params.push("alt", "json");
12026        let mut url =
12027            self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject/{resourceId}";
12028        if self._scopes.is_empty() {
12029            self._scopes
12030                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
12031        }
12032
12033        #[allow(clippy::single_element_loop)]
12034        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
12035            url = params.uri_replacement(url, param_name, find_this, false);
12036        }
12037        {
12038            let to_remove = ["resourceId"];
12039            params.remove_params(&to_remove);
12040        }
12041
12042        let url = params.parse_with_url(&url);
12043
12044        let mut json_mime_type = mime::APPLICATION_JSON;
12045        let mut request_value_reader = {
12046            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12047            common::remove_json_null_values(&mut value);
12048            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12049            serde_json::to_writer(&mut dst, &value).unwrap();
12050            dst
12051        };
12052        let request_size = request_value_reader
12053            .seek(std::io::SeekFrom::End(0))
12054            .unwrap();
12055        request_value_reader
12056            .seek(std::io::SeekFrom::Start(0))
12057            .unwrap();
12058
12059        loop {
12060            let token = match self
12061                .hub
12062                .auth
12063                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12064                .await
12065            {
12066                Ok(token) => token,
12067                Err(e) => match dlg.token(e) {
12068                    Ok(token) => token,
12069                    Err(e) => {
12070                        dlg.finished(false);
12071                        return Err(common::Error::MissingToken(e));
12072                    }
12073                },
12074            };
12075            request_value_reader
12076                .seek(std::io::SeekFrom::Start(0))
12077                .unwrap();
12078            let mut req_result = {
12079                let client = &self.hub.client;
12080                dlg.pre_request();
12081                let mut req_builder = hyper::Request::builder()
12082                    .method(hyper::Method::PUT)
12083                    .uri(url.as_str())
12084                    .header(USER_AGENT, self.hub._user_agent.clone());
12085
12086                if let Some(token) = token.as_ref() {
12087                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12088                }
12089
12090                let request = req_builder
12091                    .header(CONTENT_TYPE, json_mime_type.to_string())
12092                    .header(CONTENT_LENGTH, request_size as u64)
12093                    .body(common::to_body(
12094                        request_value_reader.get_ref().clone().into(),
12095                    ));
12096
12097                client.request(request.unwrap()).await
12098            };
12099
12100            match req_result {
12101                Err(err) => {
12102                    if let common::Retry::After(d) = dlg.http_error(&err) {
12103                        sleep(d).await;
12104                        continue;
12105                    }
12106                    dlg.finished(false);
12107                    return Err(common::Error::HttpError(err));
12108                }
12109                Ok(res) => {
12110                    let (mut parts, body) = res.into_parts();
12111                    let mut body = common::Body::new(body);
12112                    if !parts.status.is_success() {
12113                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12114                        let error = serde_json::from_str(&common::to_string(&bytes));
12115                        let response = common::to_response(parts, bytes.into());
12116
12117                        if let common::Retry::After(d) =
12118                            dlg.http_failure(&response, error.as_ref().ok())
12119                        {
12120                            sleep(d).await;
12121                            continue;
12122                        }
12123
12124                        dlg.finished(false);
12125
12126                        return Err(match error {
12127                            Ok(value) => common::Error::BadRequest(value),
12128                            _ => common::Error::Failure(response),
12129                        });
12130                    }
12131                    let response = {
12132                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12133                        let encoded = common::to_string(&bytes);
12134                        match serde_json::from_str(&encoded) {
12135                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12136                            Err(error) => {
12137                                dlg.response_json_decode_error(&encoded, &error);
12138                                return Err(common::Error::JsonDecodeError(
12139                                    encoded.to_string(),
12140                                    error,
12141                                ));
12142                            }
12143                        }
12144                    };
12145
12146                    dlg.finished(true);
12147                    return Ok(response);
12148                }
12149            }
12150        }
12151    }
12152
12153    ///
12154    /// Sets the *request* property to the given value.
12155    ///
12156    /// Even though the property as already been set when instantiating this call,
12157    /// we provide this method for API completeness.
12158    pub fn request(mut self, new_value: EventTicketObject) -> EventticketobjectUpdateCall<'a, C> {
12159        self._request = new_value;
12160        self
12161    }
12162    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
12163    ///
12164    /// Sets the *resource id* path property to the given value.
12165    ///
12166    /// Even though the property as already been set when instantiating this call,
12167    /// we provide this method for API completeness.
12168    pub fn resource_id(mut self, new_value: &str) -> EventticketobjectUpdateCall<'a, C> {
12169        self._resource_id = new_value.to_string();
12170        self
12171    }
12172    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12173    /// while executing the actual API request.
12174    ///
12175    /// ````text
12176    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12177    /// ````
12178    ///
12179    /// Sets the *delegate* property to the given value.
12180    pub fn delegate(
12181        mut self,
12182        new_value: &'a mut dyn common::Delegate,
12183    ) -> EventticketobjectUpdateCall<'a, C> {
12184        self._delegate = Some(new_value);
12185        self
12186    }
12187
12188    /// Set any additional parameter of the query string used in the request.
12189    /// It should be used to set parameters which are not yet available through their own
12190    /// setters.
12191    ///
12192    /// Please note that this method must not be used to set any of the known parameters
12193    /// which have their own setter method. If done anyway, the request will fail.
12194    ///
12195    /// # Additional Parameters
12196    ///
12197    /// * *$.xgafv* (query-string) - V1 error format.
12198    /// * *access_token* (query-string) - OAuth access token.
12199    /// * *alt* (query-string) - Data format for response.
12200    /// * *callback* (query-string) - JSONP
12201    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12202    /// * *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.
12203    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12204    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12205    /// * *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.
12206    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12207    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12208    pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectUpdateCall<'a, C>
12209    where
12210        T: AsRef<str>,
12211    {
12212        self._additional_params
12213            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12214        self
12215    }
12216
12217    /// Identifies the authorization scope for the method you are building.
12218    ///
12219    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12220    /// [`Scope::WalletObjectIssuer`].
12221    ///
12222    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12223    /// tokens for more than one scope.
12224    ///
12225    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12226    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12227    /// sufficient, a read-write scope will do as well.
12228    pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectUpdateCall<'a, C>
12229    where
12230        St: AsRef<str>,
12231    {
12232        self._scopes.insert(String::from(scope.as_ref()));
12233        self
12234    }
12235    /// Identifies the authorization scope(s) for the method you are building.
12236    ///
12237    /// See [`Self::add_scope()`] for details.
12238    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectUpdateCall<'a, C>
12239    where
12240        I: IntoIterator<Item = St>,
12241        St: AsRef<str>,
12242    {
12243        self._scopes
12244            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12245        self
12246    }
12247
12248    /// Removes all scopes, and no default scope will be used either.
12249    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12250    /// for details).
12251    pub fn clear_scopes(mut self) -> EventticketobjectUpdateCall<'a, C> {
12252        self._scopes.clear();
12253        self
12254    }
12255}
12256
12257/// Adds a message to the flight class referenced by the given class ID.
12258///
12259/// A builder for the *addmessage* method supported by a *flightclas* resource.
12260/// It is not used directly, but through a [`FlightclasMethods`] instance.
12261///
12262/// # Example
12263///
12264/// Instantiate a resource method builder
12265///
12266/// ```test_harness,no_run
12267/// # extern crate hyper;
12268/// # extern crate hyper_rustls;
12269/// # extern crate google_walletobjects1 as walletobjects1;
12270/// use walletobjects1::api::AddMessageRequest;
12271/// # async fn dox() {
12272/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12273///
12274/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12275/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12276/// #     .with_native_roots()
12277/// #     .unwrap()
12278/// #     .https_only()
12279/// #     .enable_http2()
12280/// #     .build();
12281///
12282/// # let executor = hyper_util::rt::TokioExecutor::new();
12283/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12284/// #     secret,
12285/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12286/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12287/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12288/// #     ),
12289/// # ).build().await.unwrap();
12290///
12291/// # let client = hyper_util::client::legacy::Client::builder(
12292/// #     hyper_util::rt::TokioExecutor::new()
12293/// # )
12294/// # .build(
12295/// #     hyper_rustls::HttpsConnectorBuilder::new()
12296/// #         .with_native_roots()
12297/// #         .unwrap()
12298/// #         .https_or_http()
12299/// #         .enable_http2()
12300/// #         .build()
12301/// # );
12302/// # let mut hub = Walletobjects::new(client, auth);
12303/// // As the method needs a request, you would usually fill it with the desired information
12304/// // into the respective structure. Some of the parts shown here might not be applicable !
12305/// // Values shown here are possibly random and not representative !
12306/// let mut req = AddMessageRequest::default();
12307///
12308/// // You can configure optional parameters by calling the respective setters at will, and
12309/// // execute the final call using `doit()`.
12310/// // Values shown here are possibly random and not representative !
12311/// let result = hub.flightclass().addmessage(req, "resourceId")
12312///              .doit().await;
12313/// # }
12314/// ```
12315pub struct FlightclasAddmessageCall<'a, C>
12316where
12317    C: 'a,
12318{
12319    hub: &'a Walletobjects<C>,
12320    _request: AddMessageRequest,
12321    _resource_id: String,
12322    _delegate: Option<&'a mut dyn common::Delegate>,
12323    _additional_params: HashMap<String, String>,
12324    _scopes: BTreeSet<String>,
12325}
12326
12327impl<'a, C> common::CallBuilder for FlightclasAddmessageCall<'a, C> {}
12328
12329impl<'a, C> FlightclasAddmessageCall<'a, C>
12330where
12331    C: common::Connector,
12332{
12333    /// Perform the operation you have build so far.
12334    pub async fn doit(
12335        mut self,
12336    ) -> common::Result<(common::Response, FlightClassAddMessageResponse)> {
12337        use std::borrow::Cow;
12338        use std::io::{Read, Seek};
12339
12340        use common::{url::Params, ToParts};
12341        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12342
12343        let mut dd = common::DefaultDelegate;
12344        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12345        dlg.begin(common::MethodInfo {
12346            id: "walletobjects.flightclass.addmessage",
12347            http_method: hyper::Method::POST,
12348        });
12349
12350        for &field in ["alt", "resourceId"].iter() {
12351            if self._additional_params.contains_key(field) {
12352                dlg.finished(false);
12353                return Err(common::Error::FieldClash(field));
12354            }
12355        }
12356
12357        let mut params = Params::with_capacity(4 + self._additional_params.len());
12358        params.push("resourceId", self._resource_id);
12359
12360        params.extend(self._additional_params.iter());
12361
12362        params.push("alt", "json");
12363        let mut url =
12364            self.hub._base_url.clone() + "walletobjects/v1/flightClass/{resourceId}/addMessage";
12365        if self._scopes.is_empty() {
12366            self._scopes
12367                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
12368        }
12369
12370        #[allow(clippy::single_element_loop)]
12371        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
12372            url = params.uri_replacement(url, param_name, find_this, false);
12373        }
12374        {
12375            let to_remove = ["resourceId"];
12376            params.remove_params(&to_remove);
12377        }
12378
12379        let url = params.parse_with_url(&url);
12380
12381        let mut json_mime_type = mime::APPLICATION_JSON;
12382        let mut request_value_reader = {
12383            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12384            common::remove_json_null_values(&mut value);
12385            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12386            serde_json::to_writer(&mut dst, &value).unwrap();
12387            dst
12388        };
12389        let request_size = request_value_reader
12390            .seek(std::io::SeekFrom::End(0))
12391            .unwrap();
12392        request_value_reader
12393            .seek(std::io::SeekFrom::Start(0))
12394            .unwrap();
12395
12396        loop {
12397            let token = match self
12398                .hub
12399                .auth
12400                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12401                .await
12402            {
12403                Ok(token) => token,
12404                Err(e) => match dlg.token(e) {
12405                    Ok(token) => token,
12406                    Err(e) => {
12407                        dlg.finished(false);
12408                        return Err(common::Error::MissingToken(e));
12409                    }
12410                },
12411            };
12412            request_value_reader
12413                .seek(std::io::SeekFrom::Start(0))
12414                .unwrap();
12415            let mut req_result = {
12416                let client = &self.hub.client;
12417                dlg.pre_request();
12418                let mut req_builder = hyper::Request::builder()
12419                    .method(hyper::Method::POST)
12420                    .uri(url.as_str())
12421                    .header(USER_AGENT, self.hub._user_agent.clone());
12422
12423                if let Some(token) = token.as_ref() {
12424                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12425                }
12426
12427                let request = req_builder
12428                    .header(CONTENT_TYPE, json_mime_type.to_string())
12429                    .header(CONTENT_LENGTH, request_size as u64)
12430                    .body(common::to_body(
12431                        request_value_reader.get_ref().clone().into(),
12432                    ));
12433
12434                client.request(request.unwrap()).await
12435            };
12436
12437            match req_result {
12438                Err(err) => {
12439                    if let common::Retry::After(d) = dlg.http_error(&err) {
12440                        sleep(d).await;
12441                        continue;
12442                    }
12443                    dlg.finished(false);
12444                    return Err(common::Error::HttpError(err));
12445                }
12446                Ok(res) => {
12447                    let (mut parts, body) = res.into_parts();
12448                    let mut body = common::Body::new(body);
12449                    if !parts.status.is_success() {
12450                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12451                        let error = serde_json::from_str(&common::to_string(&bytes));
12452                        let response = common::to_response(parts, bytes.into());
12453
12454                        if let common::Retry::After(d) =
12455                            dlg.http_failure(&response, error.as_ref().ok())
12456                        {
12457                            sleep(d).await;
12458                            continue;
12459                        }
12460
12461                        dlg.finished(false);
12462
12463                        return Err(match error {
12464                            Ok(value) => common::Error::BadRequest(value),
12465                            _ => common::Error::Failure(response),
12466                        });
12467                    }
12468                    let response = {
12469                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12470                        let encoded = common::to_string(&bytes);
12471                        match serde_json::from_str(&encoded) {
12472                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12473                            Err(error) => {
12474                                dlg.response_json_decode_error(&encoded, &error);
12475                                return Err(common::Error::JsonDecodeError(
12476                                    encoded.to_string(),
12477                                    error,
12478                                ));
12479                            }
12480                        }
12481                    };
12482
12483                    dlg.finished(true);
12484                    return Ok(response);
12485                }
12486            }
12487        }
12488    }
12489
12490    ///
12491    /// Sets the *request* property to the given value.
12492    ///
12493    /// Even though the property as already been set when instantiating this call,
12494    /// we provide this method for API completeness.
12495    pub fn request(mut self, new_value: AddMessageRequest) -> FlightclasAddmessageCall<'a, C> {
12496        self._request = new_value;
12497        self
12498    }
12499    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
12500    ///
12501    /// Sets the *resource id* path property to the given value.
12502    ///
12503    /// Even though the property as already been set when instantiating this call,
12504    /// we provide this method for API completeness.
12505    pub fn resource_id(mut self, new_value: &str) -> FlightclasAddmessageCall<'a, C> {
12506        self._resource_id = new_value.to_string();
12507        self
12508    }
12509    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12510    /// while executing the actual API request.
12511    ///
12512    /// ````text
12513    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12514    /// ````
12515    ///
12516    /// Sets the *delegate* property to the given value.
12517    pub fn delegate(
12518        mut self,
12519        new_value: &'a mut dyn common::Delegate,
12520    ) -> FlightclasAddmessageCall<'a, C> {
12521        self._delegate = Some(new_value);
12522        self
12523    }
12524
12525    /// Set any additional parameter of the query string used in the request.
12526    /// It should be used to set parameters which are not yet available through their own
12527    /// setters.
12528    ///
12529    /// Please note that this method must not be used to set any of the known parameters
12530    /// which have their own setter method. If done anyway, the request will fail.
12531    ///
12532    /// # Additional Parameters
12533    ///
12534    /// * *$.xgafv* (query-string) - V1 error format.
12535    /// * *access_token* (query-string) - OAuth access token.
12536    /// * *alt* (query-string) - Data format for response.
12537    /// * *callback* (query-string) - JSONP
12538    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12539    /// * *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.
12540    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12541    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12542    /// * *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.
12543    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12544    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12545    pub fn param<T>(mut self, name: T, value: T) -> FlightclasAddmessageCall<'a, C>
12546    where
12547        T: AsRef<str>,
12548    {
12549        self._additional_params
12550            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12551        self
12552    }
12553
12554    /// Identifies the authorization scope for the method you are building.
12555    ///
12556    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12557    /// [`Scope::WalletObjectIssuer`].
12558    ///
12559    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12560    /// tokens for more than one scope.
12561    ///
12562    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12563    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12564    /// sufficient, a read-write scope will do as well.
12565    pub fn add_scope<St>(mut self, scope: St) -> FlightclasAddmessageCall<'a, C>
12566    where
12567        St: AsRef<str>,
12568    {
12569        self._scopes.insert(String::from(scope.as_ref()));
12570        self
12571    }
12572    /// Identifies the authorization scope(s) for the method you are building.
12573    ///
12574    /// See [`Self::add_scope()`] for details.
12575    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasAddmessageCall<'a, C>
12576    where
12577        I: IntoIterator<Item = St>,
12578        St: AsRef<str>,
12579    {
12580        self._scopes
12581            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12582        self
12583    }
12584
12585    /// Removes all scopes, and no default scope will be used either.
12586    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12587    /// for details).
12588    pub fn clear_scopes(mut self) -> FlightclasAddmessageCall<'a, C> {
12589        self._scopes.clear();
12590        self
12591    }
12592}
12593
12594/// Returns the flight class with the given class ID.
12595///
12596/// A builder for the *get* method supported by a *flightclas* resource.
12597/// It is not used directly, but through a [`FlightclasMethods`] instance.
12598///
12599/// # Example
12600///
12601/// Instantiate a resource method builder
12602///
12603/// ```test_harness,no_run
12604/// # extern crate hyper;
12605/// # extern crate hyper_rustls;
12606/// # extern crate google_walletobjects1 as walletobjects1;
12607/// # async fn dox() {
12608/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12609///
12610/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12611/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12612/// #     .with_native_roots()
12613/// #     .unwrap()
12614/// #     .https_only()
12615/// #     .enable_http2()
12616/// #     .build();
12617///
12618/// # let executor = hyper_util::rt::TokioExecutor::new();
12619/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12620/// #     secret,
12621/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12622/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12623/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12624/// #     ),
12625/// # ).build().await.unwrap();
12626///
12627/// # let client = hyper_util::client::legacy::Client::builder(
12628/// #     hyper_util::rt::TokioExecutor::new()
12629/// # )
12630/// # .build(
12631/// #     hyper_rustls::HttpsConnectorBuilder::new()
12632/// #         .with_native_roots()
12633/// #         .unwrap()
12634/// #         .https_or_http()
12635/// #         .enable_http2()
12636/// #         .build()
12637/// # );
12638/// # let mut hub = Walletobjects::new(client, auth);
12639/// // You can configure optional parameters by calling the respective setters at will, and
12640/// // execute the final call using `doit()`.
12641/// // Values shown here are possibly random and not representative !
12642/// let result = hub.flightclass().get("resourceId")
12643///              .doit().await;
12644/// # }
12645/// ```
12646pub struct FlightclasGetCall<'a, C>
12647where
12648    C: 'a,
12649{
12650    hub: &'a Walletobjects<C>,
12651    _resource_id: String,
12652    _delegate: Option<&'a mut dyn common::Delegate>,
12653    _additional_params: HashMap<String, String>,
12654    _scopes: BTreeSet<String>,
12655}
12656
12657impl<'a, C> common::CallBuilder for FlightclasGetCall<'a, C> {}
12658
12659impl<'a, C> FlightclasGetCall<'a, C>
12660where
12661    C: common::Connector,
12662{
12663    /// Perform the operation you have build so far.
12664    pub async fn doit(mut self) -> common::Result<(common::Response, FlightClass)> {
12665        use std::borrow::Cow;
12666        use std::io::{Read, Seek};
12667
12668        use common::{url::Params, ToParts};
12669        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12670
12671        let mut dd = common::DefaultDelegate;
12672        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12673        dlg.begin(common::MethodInfo {
12674            id: "walletobjects.flightclass.get",
12675            http_method: hyper::Method::GET,
12676        });
12677
12678        for &field in ["alt", "resourceId"].iter() {
12679            if self._additional_params.contains_key(field) {
12680                dlg.finished(false);
12681                return Err(common::Error::FieldClash(field));
12682            }
12683        }
12684
12685        let mut params = Params::with_capacity(3 + self._additional_params.len());
12686        params.push("resourceId", self._resource_id);
12687
12688        params.extend(self._additional_params.iter());
12689
12690        params.push("alt", "json");
12691        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass/{resourceId}";
12692        if self._scopes.is_empty() {
12693            self._scopes
12694                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
12695        }
12696
12697        #[allow(clippy::single_element_loop)]
12698        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
12699            url = params.uri_replacement(url, param_name, find_this, false);
12700        }
12701        {
12702            let to_remove = ["resourceId"];
12703            params.remove_params(&to_remove);
12704        }
12705
12706        let url = params.parse_with_url(&url);
12707
12708        loop {
12709            let token = match self
12710                .hub
12711                .auth
12712                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12713                .await
12714            {
12715                Ok(token) => token,
12716                Err(e) => match dlg.token(e) {
12717                    Ok(token) => token,
12718                    Err(e) => {
12719                        dlg.finished(false);
12720                        return Err(common::Error::MissingToken(e));
12721                    }
12722                },
12723            };
12724            let mut req_result = {
12725                let client = &self.hub.client;
12726                dlg.pre_request();
12727                let mut req_builder = hyper::Request::builder()
12728                    .method(hyper::Method::GET)
12729                    .uri(url.as_str())
12730                    .header(USER_AGENT, self.hub._user_agent.clone());
12731
12732                if let Some(token) = token.as_ref() {
12733                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12734                }
12735
12736                let request = req_builder
12737                    .header(CONTENT_LENGTH, 0_u64)
12738                    .body(common::to_body::<String>(None));
12739
12740                client.request(request.unwrap()).await
12741            };
12742
12743            match req_result {
12744                Err(err) => {
12745                    if let common::Retry::After(d) = dlg.http_error(&err) {
12746                        sleep(d).await;
12747                        continue;
12748                    }
12749                    dlg.finished(false);
12750                    return Err(common::Error::HttpError(err));
12751                }
12752                Ok(res) => {
12753                    let (mut parts, body) = res.into_parts();
12754                    let mut body = common::Body::new(body);
12755                    if !parts.status.is_success() {
12756                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12757                        let error = serde_json::from_str(&common::to_string(&bytes));
12758                        let response = common::to_response(parts, bytes.into());
12759
12760                        if let common::Retry::After(d) =
12761                            dlg.http_failure(&response, error.as_ref().ok())
12762                        {
12763                            sleep(d).await;
12764                            continue;
12765                        }
12766
12767                        dlg.finished(false);
12768
12769                        return Err(match error {
12770                            Ok(value) => common::Error::BadRequest(value),
12771                            _ => common::Error::Failure(response),
12772                        });
12773                    }
12774                    let response = {
12775                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12776                        let encoded = common::to_string(&bytes);
12777                        match serde_json::from_str(&encoded) {
12778                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12779                            Err(error) => {
12780                                dlg.response_json_decode_error(&encoded, &error);
12781                                return Err(common::Error::JsonDecodeError(
12782                                    encoded.to_string(),
12783                                    error,
12784                                ));
12785                            }
12786                        }
12787                    };
12788
12789                    dlg.finished(true);
12790                    return Ok(response);
12791                }
12792            }
12793        }
12794    }
12795
12796    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
12797    ///
12798    /// Sets the *resource id* path property to the given value.
12799    ///
12800    /// Even though the property as already been set when instantiating this call,
12801    /// we provide this method for API completeness.
12802    pub fn resource_id(mut self, new_value: &str) -> FlightclasGetCall<'a, C> {
12803        self._resource_id = new_value.to_string();
12804        self
12805    }
12806    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12807    /// while executing the actual API request.
12808    ///
12809    /// ````text
12810    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12811    /// ````
12812    ///
12813    /// Sets the *delegate* property to the given value.
12814    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FlightclasGetCall<'a, C> {
12815        self._delegate = Some(new_value);
12816        self
12817    }
12818
12819    /// Set any additional parameter of the query string used in the request.
12820    /// It should be used to set parameters which are not yet available through their own
12821    /// setters.
12822    ///
12823    /// Please note that this method must not be used to set any of the known parameters
12824    /// which have their own setter method. If done anyway, the request will fail.
12825    ///
12826    /// # Additional Parameters
12827    ///
12828    /// * *$.xgafv* (query-string) - V1 error format.
12829    /// * *access_token* (query-string) - OAuth access token.
12830    /// * *alt* (query-string) - Data format for response.
12831    /// * *callback* (query-string) - JSONP
12832    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12833    /// * *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.
12834    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12835    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12836    /// * *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.
12837    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12838    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12839    pub fn param<T>(mut self, name: T, value: T) -> FlightclasGetCall<'a, C>
12840    where
12841        T: AsRef<str>,
12842    {
12843        self._additional_params
12844            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12845        self
12846    }
12847
12848    /// Identifies the authorization scope for the method you are building.
12849    ///
12850    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12851    /// [`Scope::WalletObjectIssuer`].
12852    ///
12853    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12854    /// tokens for more than one scope.
12855    ///
12856    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12857    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12858    /// sufficient, a read-write scope will do as well.
12859    pub fn add_scope<St>(mut self, scope: St) -> FlightclasGetCall<'a, C>
12860    where
12861        St: AsRef<str>,
12862    {
12863        self._scopes.insert(String::from(scope.as_ref()));
12864        self
12865    }
12866    /// Identifies the authorization scope(s) for the method you are building.
12867    ///
12868    /// See [`Self::add_scope()`] for details.
12869    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasGetCall<'a, C>
12870    where
12871        I: IntoIterator<Item = St>,
12872        St: AsRef<str>,
12873    {
12874        self._scopes
12875            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12876        self
12877    }
12878
12879    /// Removes all scopes, and no default scope will be used either.
12880    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12881    /// for details).
12882    pub fn clear_scopes(mut self) -> FlightclasGetCall<'a, C> {
12883        self._scopes.clear();
12884        self
12885    }
12886}
12887
12888/// Inserts an flight class with the given ID and properties.
12889///
12890/// A builder for the *insert* method supported by a *flightclas* resource.
12891/// It is not used directly, but through a [`FlightclasMethods`] instance.
12892///
12893/// # Example
12894///
12895/// Instantiate a resource method builder
12896///
12897/// ```test_harness,no_run
12898/// # extern crate hyper;
12899/// # extern crate hyper_rustls;
12900/// # extern crate google_walletobjects1 as walletobjects1;
12901/// use walletobjects1::api::FlightClass;
12902/// # async fn dox() {
12903/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12904///
12905/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12906/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12907/// #     .with_native_roots()
12908/// #     .unwrap()
12909/// #     .https_only()
12910/// #     .enable_http2()
12911/// #     .build();
12912///
12913/// # let executor = hyper_util::rt::TokioExecutor::new();
12914/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12915/// #     secret,
12916/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12917/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12918/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12919/// #     ),
12920/// # ).build().await.unwrap();
12921///
12922/// # let client = hyper_util::client::legacy::Client::builder(
12923/// #     hyper_util::rt::TokioExecutor::new()
12924/// # )
12925/// # .build(
12926/// #     hyper_rustls::HttpsConnectorBuilder::new()
12927/// #         .with_native_roots()
12928/// #         .unwrap()
12929/// #         .https_or_http()
12930/// #         .enable_http2()
12931/// #         .build()
12932/// # );
12933/// # let mut hub = Walletobjects::new(client, auth);
12934/// // As the method needs a request, you would usually fill it with the desired information
12935/// // into the respective structure. Some of the parts shown here might not be applicable !
12936/// // Values shown here are possibly random and not representative !
12937/// let mut req = FlightClass::default();
12938///
12939/// // You can configure optional parameters by calling the respective setters at will, and
12940/// // execute the final call using `doit()`.
12941/// // Values shown here are possibly random and not representative !
12942/// let result = hub.flightclass().insert(req)
12943///              .doit().await;
12944/// # }
12945/// ```
12946pub struct FlightclasInsertCall<'a, C>
12947where
12948    C: 'a,
12949{
12950    hub: &'a Walletobjects<C>,
12951    _request: FlightClass,
12952    _delegate: Option<&'a mut dyn common::Delegate>,
12953    _additional_params: HashMap<String, String>,
12954    _scopes: BTreeSet<String>,
12955}
12956
12957impl<'a, C> common::CallBuilder for FlightclasInsertCall<'a, C> {}
12958
12959impl<'a, C> FlightclasInsertCall<'a, C>
12960where
12961    C: common::Connector,
12962{
12963    /// Perform the operation you have build so far.
12964    pub async fn doit(mut self) -> common::Result<(common::Response, FlightClass)> {
12965        use std::borrow::Cow;
12966        use std::io::{Read, Seek};
12967
12968        use common::{url::Params, ToParts};
12969        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12970
12971        let mut dd = common::DefaultDelegate;
12972        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12973        dlg.begin(common::MethodInfo {
12974            id: "walletobjects.flightclass.insert",
12975            http_method: hyper::Method::POST,
12976        });
12977
12978        for &field in ["alt"].iter() {
12979            if self._additional_params.contains_key(field) {
12980                dlg.finished(false);
12981                return Err(common::Error::FieldClash(field));
12982            }
12983        }
12984
12985        let mut params = Params::with_capacity(3 + self._additional_params.len());
12986
12987        params.extend(self._additional_params.iter());
12988
12989        params.push("alt", "json");
12990        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass";
12991        if self._scopes.is_empty() {
12992            self._scopes
12993                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
12994        }
12995
12996        let url = params.parse_with_url(&url);
12997
12998        let mut json_mime_type = mime::APPLICATION_JSON;
12999        let mut request_value_reader = {
13000            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13001            common::remove_json_null_values(&mut value);
13002            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13003            serde_json::to_writer(&mut dst, &value).unwrap();
13004            dst
13005        };
13006        let request_size = request_value_reader
13007            .seek(std::io::SeekFrom::End(0))
13008            .unwrap();
13009        request_value_reader
13010            .seek(std::io::SeekFrom::Start(0))
13011            .unwrap();
13012
13013        loop {
13014            let token = match self
13015                .hub
13016                .auth
13017                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13018                .await
13019            {
13020                Ok(token) => token,
13021                Err(e) => match dlg.token(e) {
13022                    Ok(token) => token,
13023                    Err(e) => {
13024                        dlg.finished(false);
13025                        return Err(common::Error::MissingToken(e));
13026                    }
13027                },
13028            };
13029            request_value_reader
13030                .seek(std::io::SeekFrom::Start(0))
13031                .unwrap();
13032            let mut req_result = {
13033                let client = &self.hub.client;
13034                dlg.pre_request();
13035                let mut req_builder = hyper::Request::builder()
13036                    .method(hyper::Method::POST)
13037                    .uri(url.as_str())
13038                    .header(USER_AGENT, self.hub._user_agent.clone());
13039
13040                if let Some(token) = token.as_ref() {
13041                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13042                }
13043
13044                let request = req_builder
13045                    .header(CONTENT_TYPE, json_mime_type.to_string())
13046                    .header(CONTENT_LENGTH, request_size as u64)
13047                    .body(common::to_body(
13048                        request_value_reader.get_ref().clone().into(),
13049                    ));
13050
13051                client.request(request.unwrap()).await
13052            };
13053
13054            match req_result {
13055                Err(err) => {
13056                    if let common::Retry::After(d) = dlg.http_error(&err) {
13057                        sleep(d).await;
13058                        continue;
13059                    }
13060                    dlg.finished(false);
13061                    return Err(common::Error::HttpError(err));
13062                }
13063                Ok(res) => {
13064                    let (mut parts, body) = res.into_parts();
13065                    let mut body = common::Body::new(body);
13066                    if !parts.status.is_success() {
13067                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13068                        let error = serde_json::from_str(&common::to_string(&bytes));
13069                        let response = common::to_response(parts, bytes.into());
13070
13071                        if let common::Retry::After(d) =
13072                            dlg.http_failure(&response, error.as_ref().ok())
13073                        {
13074                            sleep(d).await;
13075                            continue;
13076                        }
13077
13078                        dlg.finished(false);
13079
13080                        return Err(match error {
13081                            Ok(value) => common::Error::BadRequest(value),
13082                            _ => common::Error::Failure(response),
13083                        });
13084                    }
13085                    let response = {
13086                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13087                        let encoded = common::to_string(&bytes);
13088                        match serde_json::from_str(&encoded) {
13089                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13090                            Err(error) => {
13091                                dlg.response_json_decode_error(&encoded, &error);
13092                                return Err(common::Error::JsonDecodeError(
13093                                    encoded.to_string(),
13094                                    error,
13095                                ));
13096                            }
13097                        }
13098                    };
13099
13100                    dlg.finished(true);
13101                    return Ok(response);
13102                }
13103            }
13104        }
13105    }
13106
13107    ///
13108    /// Sets the *request* property to the given value.
13109    ///
13110    /// Even though the property as already been set when instantiating this call,
13111    /// we provide this method for API completeness.
13112    pub fn request(mut self, new_value: FlightClass) -> FlightclasInsertCall<'a, C> {
13113        self._request = new_value;
13114        self
13115    }
13116    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13117    /// while executing the actual API request.
13118    ///
13119    /// ````text
13120    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13121    /// ````
13122    ///
13123    /// Sets the *delegate* property to the given value.
13124    pub fn delegate(
13125        mut self,
13126        new_value: &'a mut dyn common::Delegate,
13127    ) -> FlightclasInsertCall<'a, C> {
13128        self._delegate = Some(new_value);
13129        self
13130    }
13131
13132    /// Set any additional parameter of the query string used in the request.
13133    /// It should be used to set parameters which are not yet available through their own
13134    /// setters.
13135    ///
13136    /// Please note that this method must not be used to set any of the known parameters
13137    /// which have their own setter method. If done anyway, the request will fail.
13138    ///
13139    /// # Additional Parameters
13140    ///
13141    /// * *$.xgafv* (query-string) - V1 error format.
13142    /// * *access_token* (query-string) - OAuth access token.
13143    /// * *alt* (query-string) - Data format for response.
13144    /// * *callback* (query-string) - JSONP
13145    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13146    /// * *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.
13147    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13148    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13149    /// * *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.
13150    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13151    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13152    pub fn param<T>(mut self, name: T, value: T) -> FlightclasInsertCall<'a, C>
13153    where
13154        T: AsRef<str>,
13155    {
13156        self._additional_params
13157            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13158        self
13159    }
13160
13161    /// Identifies the authorization scope for the method you are building.
13162    ///
13163    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13164    /// [`Scope::WalletObjectIssuer`].
13165    ///
13166    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13167    /// tokens for more than one scope.
13168    ///
13169    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13170    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13171    /// sufficient, a read-write scope will do as well.
13172    pub fn add_scope<St>(mut self, scope: St) -> FlightclasInsertCall<'a, C>
13173    where
13174        St: AsRef<str>,
13175    {
13176        self._scopes.insert(String::from(scope.as_ref()));
13177        self
13178    }
13179    /// Identifies the authorization scope(s) for the method you are building.
13180    ///
13181    /// See [`Self::add_scope()`] for details.
13182    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasInsertCall<'a, C>
13183    where
13184        I: IntoIterator<Item = St>,
13185        St: AsRef<str>,
13186    {
13187        self._scopes
13188            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13189        self
13190    }
13191
13192    /// Removes all scopes, and no default scope will be used either.
13193    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13194    /// for details).
13195    pub fn clear_scopes(mut self) -> FlightclasInsertCall<'a, C> {
13196        self._scopes.clear();
13197        self
13198    }
13199}
13200
13201/// Returns a list of all flight classes for a given issuer ID.
13202///
13203/// A builder for the *list* method supported by a *flightclas* resource.
13204/// It is not used directly, but through a [`FlightclasMethods`] instance.
13205///
13206/// # Example
13207///
13208/// Instantiate a resource method builder
13209///
13210/// ```test_harness,no_run
13211/// # extern crate hyper;
13212/// # extern crate hyper_rustls;
13213/// # extern crate google_walletobjects1 as walletobjects1;
13214/// # async fn dox() {
13215/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13216///
13217/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13218/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13219/// #     .with_native_roots()
13220/// #     .unwrap()
13221/// #     .https_only()
13222/// #     .enable_http2()
13223/// #     .build();
13224///
13225/// # let executor = hyper_util::rt::TokioExecutor::new();
13226/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13227/// #     secret,
13228/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13229/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13230/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13231/// #     ),
13232/// # ).build().await.unwrap();
13233///
13234/// # let client = hyper_util::client::legacy::Client::builder(
13235/// #     hyper_util::rt::TokioExecutor::new()
13236/// # )
13237/// # .build(
13238/// #     hyper_rustls::HttpsConnectorBuilder::new()
13239/// #         .with_native_roots()
13240/// #         .unwrap()
13241/// #         .https_or_http()
13242/// #         .enable_http2()
13243/// #         .build()
13244/// # );
13245/// # let mut hub = Walletobjects::new(client, auth);
13246/// // You can configure optional parameters by calling the respective setters at will, and
13247/// // execute the final call using `doit()`.
13248/// // Values shown here are possibly random and not representative !
13249/// let result = hub.flightclass().list()
13250///              .token("invidunt")
13251///              .max_results(-47)
13252///              .issuer_id(-20)
13253///              .doit().await;
13254/// # }
13255/// ```
13256pub struct FlightclasListCall<'a, C>
13257where
13258    C: 'a,
13259{
13260    hub: &'a Walletobjects<C>,
13261    _token: Option<String>,
13262    _max_results: Option<i32>,
13263    _issuer_id: Option<i64>,
13264    _delegate: Option<&'a mut dyn common::Delegate>,
13265    _additional_params: HashMap<String, String>,
13266    _scopes: BTreeSet<String>,
13267}
13268
13269impl<'a, C> common::CallBuilder for FlightclasListCall<'a, C> {}
13270
13271impl<'a, C> FlightclasListCall<'a, C>
13272where
13273    C: common::Connector,
13274{
13275    /// Perform the operation you have build so far.
13276    pub async fn doit(mut self) -> common::Result<(common::Response, FlightClassListResponse)> {
13277        use std::borrow::Cow;
13278        use std::io::{Read, Seek};
13279
13280        use common::{url::Params, ToParts};
13281        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13282
13283        let mut dd = common::DefaultDelegate;
13284        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13285        dlg.begin(common::MethodInfo {
13286            id: "walletobjects.flightclass.list",
13287            http_method: hyper::Method::GET,
13288        });
13289
13290        for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
13291            if self._additional_params.contains_key(field) {
13292                dlg.finished(false);
13293                return Err(common::Error::FieldClash(field));
13294            }
13295        }
13296
13297        let mut params = Params::with_capacity(5 + self._additional_params.len());
13298        if let Some(value) = self._token.as_ref() {
13299            params.push("token", value);
13300        }
13301        if let Some(value) = self._max_results.as_ref() {
13302            params.push("maxResults", value.to_string());
13303        }
13304        if let Some(value) = self._issuer_id.as_ref() {
13305            params.push("issuerId", value.to_string());
13306        }
13307
13308        params.extend(self._additional_params.iter());
13309
13310        params.push("alt", "json");
13311        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass";
13312        if self._scopes.is_empty() {
13313            self._scopes
13314                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
13315        }
13316
13317        let url = params.parse_with_url(&url);
13318
13319        loop {
13320            let token = match self
13321                .hub
13322                .auth
13323                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13324                .await
13325            {
13326                Ok(token) => token,
13327                Err(e) => match dlg.token(e) {
13328                    Ok(token) => token,
13329                    Err(e) => {
13330                        dlg.finished(false);
13331                        return Err(common::Error::MissingToken(e));
13332                    }
13333                },
13334            };
13335            let mut req_result = {
13336                let client = &self.hub.client;
13337                dlg.pre_request();
13338                let mut req_builder = hyper::Request::builder()
13339                    .method(hyper::Method::GET)
13340                    .uri(url.as_str())
13341                    .header(USER_AGENT, self.hub._user_agent.clone());
13342
13343                if let Some(token) = token.as_ref() {
13344                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13345                }
13346
13347                let request = req_builder
13348                    .header(CONTENT_LENGTH, 0_u64)
13349                    .body(common::to_body::<String>(None));
13350
13351                client.request(request.unwrap()).await
13352            };
13353
13354            match req_result {
13355                Err(err) => {
13356                    if let common::Retry::After(d) = dlg.http_error(&err) {
13357                        sleep(d).await;
13358                        continue;
13359                    }
13360                    dlg.finished(false);
13361                    return Err(common::Error::HttpError(err));
13362                }
13363                Ok(res) => {
13364                    let (mut parts, body) = res.into_parts();
13365                    let mut body = common::Body::new(body);
13366                    if !parts.status.is_success() {
13367                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13368                        let error = serde_json::from_str(&common::to_string(&bytes));
13369                        let response = common::to_response(parts, bytes.into());
13370
13371                        if let common::Retry::After(d) =
13372                            dlg.http_failure(&response, error.as_ref().ok())
13373                        {
13374                            sleep(d).await;
13375                            continue;
13376                        }
13377
13378                        dlg.finished(false);
13379
13380                        return Err(match error {
13381                            Ok(value) => common::Error::BadRequest(value),
13382                            _ => common::Error::Failure(response),
13383                        });
13384                    }
13385                    let response = {
13386                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13387                        let encoded = common::to_string(&bytes);
13388                        match serde_json::from_str(&encoded) {
13389                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13390                            Err(error) => {
13391                                dlg.response_json_decode_error(&encoded, &error);
13392                                return Err(common::Error::JsonDecodeError(
13393                                    encoded.to_string(),
13394                                    error,
13395                                ));
13396                            }
13397                        }
13398                    };
13399
13400                    dlg.finished(true);
13401                    return Ok(response);
13402                }
13403            }
13404        }
13405    }
13406
13407    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` classes are available in a list. For example, if you have a list of 200 classes and you call list with `maxResults` set to 20, list will return the first 20 classes and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 classes.
13408    ///
13409    /// Sets the *token* query property to the given value.
13410    pub fn token(mut self, new_value: &str) -> FlightclasListCall<'a, C> {
13411        self._token = Some(new_value.to_string());
13412        self
13413    }
13414    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
13415    ///
13416    /// Sets the *max results* query property to the given value.
13417    pub fn max_results(mut self, new_value: i32) -> FlightclasListCall<'a, C> {
13418        self._max_results = Some(new_value);
13419        self
13420    }
13421    /// The ID of the issuer authorized to list classes.
13422    ///
13423    /// Sets the *issuer id* query property to the given value.
13424    pub fn issuer_id(mut self, new_value: i64) -> FlightclasListCall<'a, C> {
13425        self._issuer_id = Some(new_value);
13426        self
13427    }
13428    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13429    /// while executing the actual API request.
13430    ///
13431    /// ````text
13432    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13433    /// ````
13434    ///
13435    /// Sets the *delegate* property to the given value.
13436    pub fn delegate(
13437        mut self,
13438        new_value: &'a mut dyn common::Delegate,
13439    ) -> FlightclasListCall<'a, C> {
13440        self._delegate = Some(new_value);
13441        self
13442    }
13443
13444    /// Set any additional parameter of the query string used in the request.
13445    /// It should be used to set parameters which are not yet available through their own
13446    /// setters.
13447    ///
13448    /// Please note that this method must not be used to set any of the known parameters
13449    /// which have their own setter method. If done anyway, the request will fail.
13450    ///
13451    /// # Additional Parameters
13452    ///
13453    /// * *$.xgafv* (query-string) - V1 error format.
13454    /// * *access_token* (query-string) - OAuth access token.
13455    /// * *alt* (query-string) - Data format for response.
13456    /// * *callback* (query-string) - JSONP
13457    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13458    /// * *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.
13459    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13460    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13461    /// * *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.
13462    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13463    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13464    pub fn param<T>(mut self, name: T, value: T) -> FlightclasListCall<'a, C>
13465    where
13466        T: AsRef<str>,
13467    {
13468        self._additional_params
13469            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13470        self
13471    }
13472
13473    /// Identifies the authorization scope for the method you are building.
13474    ///
13475    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13476    /// [`Scope::WalletObjectIssuer`].
13477    ///
13478    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13479    /// tokens for more than one scope.
13480    ///
13481    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13482    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13483    /// sufficient, a read-write scope will do as well.
13484    pub fn add_scope<St>(mut self, scope: St) -> FlightclasListCall<'a, C>
13485    where
13486        St: AsRef<str>,
13487    {
13488        self._scopes.insert(String::from(scope.as_ref()));
13489        self
13490    }
13491    /// Identifies the authorization scope(s) for the method you are building.
13492    ///
13493    /// See [`Self::add_scope()`] for details.
13494    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasListCall<'a, C>
13495    where
13496        I: IntoIterator<Item = St>,
13497        St: AsRef<str>,
13498    {
13499        self._scopes
13500            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13501        self
13502    }
13503
13504    /// Removes all scopes, and no default scope will be used either.
13505    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13506    /// for details).
13507    pub fn clear_scopes(mut self) -> FlightclasListCall<'a, C> {
13508        self._scopes.clear();
13509        self
13510    }
13511}
13512
13513/// Updates the flight class referenced by the given class ID. This method supports patch semantics.
13514///
13515/// A builder for the *patch* method supported by a *flightclas* resource.
13516/// It is not used directly, but through a [`FlightclasMethods`] instance.
13517///
13518/// # Example
13519///
13520/// Instantiate a resource method builder
13521///
13522/// ```test_harness,no_run
13523/// # extern crate hyper;
13524/// # extern crate hyper_rustls;
13525/// # extern crate google_walletobjects1 as walletobjects1;
13526/// use walletobjects1::api::FlightClass;
13527/// # async fn dox() {
13528/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13529///
13530/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13531/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13532/// #     .with_native_roots()
13533/// #     .unwrap()
13534/// #     .https_only()
13535/// #     .enable_http2()
13536/// #     .build();
13537///
13538/// # let executor = hyper_util::rt::TokioExecutor::new();
13539/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13540/// #     secret,
13541/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13542/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13543/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13544/// #     ),
13545/// # ).build().await.unwrap();
13546///
13547/// # let client = hyper_util::client::legacy::Client::builder(
13548/// #     hyper_util::rt::TokioExecutor::new()
13549/// # )
13550/// # .build(
13551/// #     hyper_rustls::HttpsConnectorBuilder::new()
13552/// #         .with_native_roots()
13553/// #         .unwrap()
13554/// #         .https_or_http()
13555/// #         .enable_http2()
13556/// #         .build()
13557/// # );
13558/// # let mut hub = Walletobjects::new(client, auth);
13559/// // As the method needs a request, you would usually fill it with the desired information
13560/// // into the respective structure. Some of the parts shown here might not be applicable !
13561/// // Values shown here are possibly random and not representative !
13562/// let mut req = FlightClass::default();
13563///
13564/// // You can configure optional parameters by calling the respective setters at will, and
13565/// // execute the final call using `doit()`.
13566/// // Values shown here are possibly random and not representative !
13567/// let result = hub.flightclass().patch(req, "resourceId")
13568///              .doit().await;
13569/// # }
13570/// ```
13571pub struct FlightclasPatchCall<'a, C>
13572where
13573    C: 'a,
13574{
13575    hub: &'a Walletobjects<C>,
13576    _request: FlightClass,
13577    _resource_id: String,
13578    _delegate: Option<&'a mut dyn common::Delegate>,
13579    _additional_params: HashMap<String, String>,
13580    _scopes: BTreeSet<String>,
13581}
13582
13583impl<'a, C> common::CallBuilder for FlightclasPatchCall<'a, C> {}
13584
13585impl<'a, C> FlightclasPatchCall<'a, C>
13586where
13587    C: common::Connector,
13588{
13589    /// Perform the operation you have build so far.
13590    pub async fn doit(mut self) -> common::Result<(common::Response, FlightClass)> {
13591        use std::borrow::Cow;
13592        use std::io::{Read, Seek};
13593
13594        use common::{url::Params, ToParts};
13595        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13596
13597        let mut dd = common::DefaultDelegate;
13598        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13599        dlg.begin(common::MethodInfo {
13600            id: "walletobjects.flightclass.patch",
13601            http_method: hyper::Method::PATCH,
13602        });
13603
13604        for &field in ["alt", "resourceId"].iter() {
13605            if self._additional_params.contains_key(field) {
13606                dlg.finished(false);
13607                return Err(common::Error::FieldClash(field));
13608            }
13609        }
13610
13611        let mut params = Params::with_capacity(4 + self._additional_params.len());
13612        params.push("resourceId", self._resource_id);
13613
13614        params.extend(self._additional_params.iter());
13615
13616        params.push("alt", "json");
13617        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass/{resourceId}";
13618        if self._scopes.is_empty() {
13619            self._scopes
13620                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
13621        }
13622
13623        #[allow(clippy::single_element_loop)]
13624        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
13625            url = params.uri_replacement(url, param_name, find_this, false);
13626        }
13627        {
13628            let to_remove = ["resourceId"];
13629            params.remove_params(&to_remove);
13630        }
13631
13632        let url = params.parse_with_url(&url);
13633
13634        let mut json_mime_type = mime::APPLICATION_JSON;
13635        let mut request_value_reader = {
13636            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13637            common::remove_json_null_values(&mut value);
13638            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13639            serde_json::to_writer(&mut dst, &value).unwrap();
13640            dst
13641        };
13642        let request_size = request_value_reader
13643            .seek(std::io::SeekFrom::End(0))
13644            .unwrap();
13645        request_value_reader
13646            .seek(std::io::SeekFrom::Start(0))
13647            .unwrap();
13648
13649        loop {
13650            let token = match self
13651                .hub
13652                .auth
13653                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13654                .await
13655            {
13656                Ok(token) => token,
13657                Err(e) => match dlg.token(e) {
13658                    Ok(token) => token,
13659                    Err(e) => {
13660                        dlg.finished(false);
13661                        return Err(common::Error::MissingToken(e));
13662                    }
13663                },
13664            };
13665            request_value_reader
13666                .seek(std::io::SeekFrom::Start(0))
13667                .unwrap();
13668            let mut req_result = {
13669                let client = &self.hub.client;
13670                dlg.pre_request();
13671                let mut req_builder = hyper::Request::builder()
13672                    .method(hyper::Method::PATCH)
13673                    .uri(url.as_str())
13674                    .header(USER_AGENT, self.hub._user_agent.clone());
13675
13676                if let Some(token) = token.as_ref() {
13677                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13678                }
13679
13680                let request = req_builder
13681                    .header(CONTENT_TYPE, json_mime_type.to_string())
13682                    .header(CONTENT_LENGTH, request_size as u64)
13683                    .body(common::to_body(
13684                        request_value_reader.get_ref().clone().into(),
13685                    ));
13686
13687                client.request(request.unwrap()).await
13688            };
13689
13690            match req_result {
13691                Err(err) => {
13692                    if let common::Retry::After(d) = dlg.http_error(&err) {
13693                        sleep(d).await;
13694                        continue;
13695                    }
13696                    dlg.finished(false);
13697                    return Err(common::Error::HttpError(err));
13698                }
13699                Ok(res) => {
13700                    let (mut parts, body) = res.into_parts();
13701                    let mut body = common::Body::new(body);
13702                    if !parts.status.is_success() {
13703                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13704                        let error = serde_json::from_str(&common::to_string(&bytes));
13705                        let response = common::to_response(parts, bytes.into());
13706
13707                        if let common::Retry::After(d) =
13708                            dlg.http_failure(&response, error.as_ref().ok())
13709                        {
13710                            sleep(d).await;
13711                            continue;
13712                        }
13713
13714                        dlg.finished(false);
13715
13716                        return Err(match error {
13717                            Ok(value) => common::Error::BadRequest(value),
13718                            _ => common::Error::Failure(response),
13719                        });
13720                    }
13721                    let response = {
13722                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13723                        let encoded = common::to_string(&bytes);
13724                        match serde_json::from_str(&encoded) {
13725                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13726                            Err(error) => {
13727                                dlg.response_json_decode_error(&encoded, &error);
13728                                return Err(common::Error::JsonDecodeError(
13729                                    encoded.to_string(),
13730                                    error,
13731                                ));
13732                            }
13733                        }
13734                    };
13735
13736                    dlg.finished(true);
13737                    return Ok(response);
13738                }
13739            }
13740        }
13741    }
13742
13743    ///
13744    /// Sets the *request* property to the given value.
13745    ///
13746    /// Even though the property as already been set when instantiating this call,
13747    /// we provide this method for API completeness.
13748    pub fn request(mut self, new_value: FlightClass) -> FlightclasPatchCall<'a, C> {
13749        self._request = new_value;
13750        self
13751    }
13752    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
13753    ///
13754    /// Sets the *resource id* path property to the given value.
13755    ///
13756    /// Even though the property as already been set when instantiating this call,
13757    /// we provide this method for API completeness.
13758    pub fn resource_id(mut self, new_value: &str) -> FlightclasPatchCall<'a, C> {
13759        self._resource_id = new_value.to_string();
13760        self
13761    }
13762    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13763    /// while executing the actual API request.
13764    ///
13765    /// ````text
13766    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13767    /// ````
13768    ///
13769    /// Sets the *delegate* property to the given value.
13770    pub fn delegate(
13771        mut self,
13772        new_value: &'a mut dyn common::Delegate,
13773    ) -> FlightclasPatchCall<'a, C> {
13774        self._delegate = Some(new_value);
13775        self
13776    }
13777
13778    /// Set any additional parameter of the query string used in the request.
13779    /// It should be used to set parameters which are not yet available through their own
13780    /// setters.
13781    ///
13782    /// Please note that this method must not be used to set any of the known parameters
13783    /// which have their own setter method. If done anyway, the request will fail.
13784    ///
13785    /// # Additional Parameters
13786    ///
13787    /// * *$.xgafv* (query-string) - V1 error format.
13788    /// * *access_token* (query-string) - OAuth access token.
13789    /// * *alt* (query-string) - Data format for response.
13790    /// * *callback* (query-string) - JSONP
13791    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13792    /// * *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.
13793    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13794    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13795    /// * *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.
13796    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13797    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13798    pub fn param<T>(mut self, name: T, value: T) -> FlightclasPatchCall<'a, C>
13799    where
13800        T: AsRef<str>,
13801    {
13802        self._additional_params
13803            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13804        self
13805    }
13806
13807    /// Identifies the authorization scope for the method you are building.
13808    ///
13809    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13810    /// [`Scope::WalletObjectIssuer`].
13811    ///
13812    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13813    /// tokens for more than one scope.
13814    ///
13815    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13816    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13817    /// sufficient, a read-write scope will do as well.
13818    pub fn add_scope<St>(mut self, scope: St) -> FlightclasPatchCall<'a, C>
13819    where
13820        St: AsRef<str>,
13821    {
13822        self._scopes.insert(String::from(scope.as_ref()));
13823        self
13824    }
13825    /// Identifies the authorization scope(s) for the method you are building.
13826    ///
13827    /// See [`Self::add_scope()`] for details.
13828    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasPatchCall<'a, C>
13829    where
13830        I: IntoIterator<Item = St>,
13831        St: AsRef<str>,
13832    {
13833        self._scopes
13834            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13835        self
13836    }
13837
13838    /// Removes all scopes, and no default scope will be used either.
13839    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13840    /// for details).
13841    pub fn clear_scopes(mut self) -> FlightclasPatchCall<'a, C> {
13842        self._scopes.clear();
13843        self
13844    }
13845}
13846
13847/// Updates the flight class referenced by the given class ID.
13848///
13849/// A builder for the *update* method supported by a *flightclas* resource.
13850/// It is not used directly, but through a [`FlightclasMethods`] instance.
13851///
13852/// # Example
13853///
13854/// Instantiate a resource method builder
13855///
13856/// ```test_harness,no_run
13857/// # extern crate hyper;
13858/// # extern crate hyper_rustls;
13859/// # extern crate google_walletobjects1 as walletobjects1;
13860/// use walletobjects1::api::FlightClass;
13861/// # async fn dox() {
13862/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13863///
13864/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13865/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13866/// #     .with_native_roots()
13867/// #     .unwrap()
13868/// #     .https_only()
13869/// #     .enable_http2()
13870/// #     .build();
13871///
13872/// # let executor = hyper_util::rt::TokioExecutor::new();
13873/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13874/// #     secret,
13875/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13876/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13877/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13878/// #     ),
13879/// # ).build().await.unwrap();
13880///
13881/// # let client = hyper_util::client::legacy::Client::builder(
13882/// #     hyper_util::rt::TokioExecutor::new()
13883/// # )
13884/// # .build(
13885/// #     hyper_rustls::HttpsConnectorBuilder::new()
13886/// #         .with_native_roots()
13887/// #         .unwrap()
13888/// #         .https_or_http()
13889/// #         .enable_http2()
13890/// #         .build()
13891/// # );
13892/// # let mut hub = Walletobjects::new(client, auth);
13893/// // As the method needs a request, you would usually fill it with the desired information
13894/// // into the respective structure. Some of the parts shown here might not be applicable !
13895/// // Values shown here are possibly random and not representative !
13896/// let mut req = FlightClass::default();
13897///
13898/// // You can configure optional parameters by calling the respective setters at will, and
13899/// // execute the final call using `doit()`.
13900/// // Values shown here are possibly random and not representative !
13901/// let result = hub.flightclass().update(req, "resourceId")
13902///              .doit().await;
13903/// # }
13904/// ```
13905pub struct FlightclasUpdateCall<'a, C>
13906where
13907    C: 'a,
13908{
13909    hub: &'a Walletobjects<C>,
13910    _request: FlightClass,
13911    _resource_id: String,
13912    _delegate: Option<&'a mut dyn common::Delegate>,
13913    _additional_params: HashMap<String, String>,
13914    _scopes: BTreeSet<String>,
13915}
13916
13917impl<'a, C> common::CallBuilder for FlightclasUpdateCall<'a, C> {}
13918
13919impl<'a, C> FlightclasUpdateCall<'a, C>
13920where
13921    C: common::Connector,
13922{
13923    /// Perform the operation you have build so far.
13924    pub async fn doit(mut self) -> common::Result<(common::Response, FlightClass)> {
13925        use std::borrow::Cow;
13926        use std::io::{Read, Seek};
13927
13928        use common::{url::Params, ToParts};
13929        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13930
13931        let mut dd = common::DefaultDelegate;
13932        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13933        dlg.begin(common::MethodInfo {
13934            id: "walletobjects.flightclass.update",
13935            http_method: hyper::Method::PUT,
13936        });
13937
13938        for &field in ["alt", "resourceId"].iter() {
13939            if self._additional_params.contains_key(field) {
13940                dlg.finished(false);
13941                return Err(common::Error::FieldClash(field));
13942            }
13943        }
13944
13945        let mut params = Params::with_capacity(4 + self._additional_params.len());
13946        params.push("resourceId", self._resource_id);
13947
13948        params.extend(self._additional_params.iter());
13949
13950        params.push("alt", "json");
13951        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass/{resourceId}";
13952        if self._scopes.is_empty() {
13953            self._scopes
13954                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
13955        }
13956
13957        #[allow(clippy::single_element_loop)]
13958        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
13959            url = params.uri_replacement(url, param_name, find_this, false);
13960        }
13961        {
13962            let to_remove = ["resourceId"];
13963            params.remove_params(&to_remove);
13964        }
13965
13966        let url = params.parse_with_url(&url);
13967
13968        let mut json_mime_type = mime::APPLICATION_JSON;
13969        let mut request_value_reader = {
13970            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13971            common::remove_json_null_values(&mut value);
13972            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13973            serde_json::to_writer(&mut dst, &value).unwrap();
13974            dst
13975        };
13976        let request_size = request_value_reader
13977            .seek(std::io::SeekFrom::End(0))
13978            .unwrap();
13979        request_value_reader
13980            .seek(std::io::SeekFrom::Start(0))
13981            .unwrap();
13982
13983        loop {
13984            let token = match self
13985                .hub
13986                .auth
13987                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13988                .await
13989            {
13990                Ok(token) => token,
13991                Err(e) => match dlg.token(e) {
13992                    Ok(token) => token,
13993                    Err(e) => {
13994                        dlg.finished(false);
13995                        return Err(common::Error::MissingToken(e));
13996                    }
13997                },
13998            };
13999            request_value_reader
14000                .seek(std::io::SeekFrom::Start(0))
14001                .unwrap();
14002            let mut req_result = {
14003                let client = &self.hub.client;
14004                dlg.pre_request();
14005                let mut req_builder = hyper::Request::builder()
14006                    .method(hyper::Method::PUT)
14007                    .uri(url.as_str())
14008                    .header(USER_AGENT, self.hub._user_agent.clone());
14009
14010                if let Some(token) = token.as_ref() {
14011                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14012                }
14013
14014                let request = req_builder
14015                    .header(CONTENT_TYPE, json_mime_type.to_string())
14016                    .header(CONTENT_LENGTH, request_size as u64)
14017                    .body(common::to_body(
14018                        request_value_reader.get_ref().clone().into(),
14019                    ));
14020
14021                client.request(request.unwrap()).await
14022            };
14023
14024            match req_result {
14025                Err(err) => {
14026                    if let common::Retry::After(d) = dlg.http_error(&err) {
14027                        sleep(d).await;
14028                        continue;
14029                    }
14030                    dlg.finished(false);
14031                    return Err(common::Error::HttpError(err));
14032                }
14033                Ok(res) => {
14034                    let (mut parts, body) = res.into_parts();
14035                    let mut body = common::Body::new(body);
14036                    if !parts.status.is_success() {
14037                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14038                        let error = serde_json::from_str(&common::to_string(&bytes));
14039                        let response = common::to_response(parts, bytes.into());
14040
14041                        if let common::Retry::After(d) =
14042                            dlg.http_failure(&response, error.as_ref().ok())
14043                        {
14044                            sleep(d).await;
14045                            continue;
14046                        }
14047
14048                        dlg.finished(false);
14049
14050                        return Err(match error {
14051                            Ok(value) => common::Error::BadRequest(value),
14052                            _ => common::Error::Failure(response),
14053                        });
14054                    }
14055                    let response = {
14056                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14057                        let encoded = common::to_string(&bytes);
14058                        match serde_json::from_str(&encoded) {
14059                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14060                            Err(error) => {
14061                                dlg.response_json_decode_error(&encoded, &error);
14062                                return Err(common::Error::JsonDecodeError(
14063                                    encoded.to_string(),
14064                                    error,
14065                                ));
14066                            }
14067                        }
14068                    };
14069
14070                    dlg.finished(true);
14071                    return Ok(response);
14072                }
14073            }
14074        }
14075    }
14076
14077    ///
14078    /// Sets the *request* property to the given value.
14079    ///
14080    /// Even though the property as already been set when instantiating this call,
14081    /// we provide this method for API completeness.
14082    pub fn request(mut self, new_value: FlightClass) -> FlightclasUpdateCall<'a, C> {
14083        self._request = new_value;
14084        self
14085    }
14086    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
14087    ///
14088    /// Sets the *resource id* path property to the given value.
14089    ///
14090    /// Even though the property as already been set when instantiating this call,
14091    /// we provide this method for API completeness.
14092    pub fn resource_id(mut self, new_value: &str) -> FlightclasUpdateCall<'a, C> {
14093        self._resource_id = new_value.to_string();
14094        self
14095    }
14096    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14097    /// while executing the actual API request.
14098    ///
14099    /// ````text
14100    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14101    /// ````
14102    ///
14103    /// Sets the *delegate* property to the given value.
14104    pub fn delegate(
14105        mut self,
14106        new_value: &'a mut dyn common::Delegate,
14107    ) -> FlightclasUpdateCall<'a, C> {
14108        self._delegate = Some(new_value);
14109        self
14110    }
14111
14112    /// Set any additional parameter of the query string used in the request.
14113    /// It should be used to set parameters which are not yet available through their own
14114    /// setters.
14115    ///
14116    /// Please note that this method must not be used to set any of the known parameters
14117    /// which have their own setter method. If done anyway, the request will fail.
14118    ///
14119    /// # Additional Parameters
14120    ///
14121    /// * *$.xgafv* (query-string) - V1 error format.
14122    /// * *access_token* (query-string) - OAuth access token.
14123    /// * *alt* (query-string) - Data format for response.
14124    /// * *callback* (query-string) - JSONP
14125    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14126    /// * *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.
14127    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14128    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14129    /// * *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.
14130    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14131    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14132    pub fn param<T>(mut self, name: T, value: T) -> FlightclasUpdateCall<'a, C>
14133    where
14134        T: AsRef<str>,
14135    {
14136        self._additional_params
14137            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14138        self
14139    }
14140
14141    /// Identifies the authorization scope for the method you are building.
14142    ///
14143    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14144    /// [`Scope::WalletObjectIssuer`].
14145    ///
14146    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14147    /// tokens for more than one scope.
14148    ///
14149    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14150    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14151    /// sufficient, a read-write scope will do as well.
14152    pub fn add_scope<St>(mut self, scope: St) -> FlightclasUpdateCall<'a, C>
14153    where
14154        St: AsRef<str>,
14155    {
14156        self._scopes.insert(String::from(scope.as_ref()));
14157        self
14158    }
14159    /// Identifies the authorization scope(s) for the method you are building.
14160    ///
14161    /// See [`Self::add_scope()`] for details.
14162    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasUpdateCall<'a, C>
14163    where
14164        I: IntoIterator<Item = St>,
14165        St: AsRef<str>,
14166    {
14167        self._scopes
14168            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14169        self
14170    }
14171
14172    /// Removes all scopes, and no default scope will be used either.
14173    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14174    /// for details).
14175    pub fn clear_scopes(mut self) -> FlightclasUpdateCall<'a, C> {
14176        self._scopes.clear();
14177        self
14178    }
14179}
14180
14181/// Adds a message to the flight object referenced by the given object ID.
14182///
14183/// A builder for the *addmessage* method supported by a *flightobject* resource.
14184/// It is not used directly, but through a [`FlightobjectMethods`] instance.
14185///
14186/// # Example
14187///
14188/// Instantiate a resource method builder
14189///
14190/// ```test_harness,no_run
14191/// # extern crate hyper;
14192/// # extern crate hyper_rustls;
14193/// # extern crate google_walletobjects1 as walletobjects1;
14194/// use walletobjects1::api::AddMessageRequest;
14195/// # async fn dox() {
14196/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14197///
14198/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14199/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14200/// #     .with_native_roots()
14201/// #     .unwrap()
14202/// #     .https_only()
14203/// #     .enable_http2()
14204/// #     .build();
14205///
14206/// # let executor = hyper_util::rt::TokioExecutor::new();
14207/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14208/// #     secret,
14209/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14210/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14211/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14212/// #     ),
14213/// # ).build().await.unwrap();
14214///
14215/// # let client = hyper_util::client::legacy::Client::builder(
14216/// #     hyper_util::rt::TokioExecutor::new()
14217/// # )
14218/// # .build(
14219/// #     hyper_rustls::HttpsConnectorBuilder::new()
14220/// #         .with_native_roots()
14221/// #         .unwrap()
14222/// #         .https_or_http()
14223/// #         .enable_http2()
14224/// #         .build()
14225/// # );
14226/// # let mut hub = Walletobjects::new(client, auth);
14227/// // As the method needs a request, you would usually fill it with the desired information
14228/// // into the respective structure. Some of the parts shown here might not be applicable !
14229/// // Values shown here are possibly random and not representative !
14230/// let mut req = AddMessageRequest::default();
14231///
14232/// // You can configure optional parameters by calling the respective setters at will, and
14233/// // execute the final call using `doit()`.
14234/// // Values shown here are possibly random and not representative !
14235/// let result = hub.flightobject().addmessage(req, "resourceId")
14236///              .doit().await;
14237/// # }
14238/// ```
14239pub struct FlightobjectAddmessageCall<'a, C>
14240where
14241    C: 'a,
14242{
14243    hub: &'a Walletobjects<C>,
14244    _request: AddMessageRequest,
14245    _resource_id: String,
14246    _delegate: Option<&'a mut dyn common::Delegate>,
14247    _additional_params: HashMap<String, String>,
14248    _scopes: BTreeSet<String>,
14249}
14250
14251impl<'a, C> common::CallBuilder for FlightobjectAddmessageCall<'a, C> {}
14252
14253impl<'a, C> FlightobjectAddmessageCall<'a, C>
14254where
14255    C: common::Connector,
14256{
14257    /// Perform the operation you have build so far.
14258    pub async fn doit(
14259        mut self,
14260    ) -> common::Result<(common::Response, FlightObjectAddMessageResponse)> {
14261        use std::borrow::Cow;
14262        use std::io::{Read, Seek};
14263
14264        use common::{url::Params, ToParts};
14265        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14266
14267        let mut dd = common::DefaultDelegate;
14268        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14269        dlg.begin(common::MethodInfo {
14270            id: "walletobjects.flightobject.addmessage",
14271            http_method: hyper::Method::POST,
14272        });
14273
14274        for &field in ["alt", "resourceId"].iter() {
14275            if self._additional_params.contains_key(field) {
14276                dlg.finished(false);
14277                return Err(common::Error::FieldClash(field));
14278            }
14279        }
14280
14281        let mut params = Params::with_capacity(4 + self._additional_params.len());
14282        params.push("resourceId", self._resource_id);
14283
14284        params.extend(self._additional_params.iter());
14285
14286        params.push("alt", "json");
14287        let mut url =
14288            self.hub._base_url.clone() + "walletobjects/v1/flightObject/{resourceId}/addMessage";
14289        if self._scopes.is_empty() {
14290            self._scopes
14291                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
14292        }
14293
14294        #[allow(clippy::single_element_loop)]
14295        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
14296            url = params.uri_replacement(url, param_name, find_this, false);
14297        }
14298        {
14299            let to_remove = ["resourceId"];
14300            params.remove_params(&to_remove);
14301        }
14302
14303        let url = params.parse_with_url(&url);
14304
14305        let mut json_mime_type = mime::APPLICATION_JSON;
14306        let mut request_value_reader = {
14307            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14308            common::remove_json_null_values(&mut value);
14309            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14310            serde_json::to_writer(&mut dst, &value).unwrap();
14311            dst
14312        };
14313        let request_size = request_value_reader
14314            .seek(std::io::SeekFrom::End(0))
14315            .unwrap();
14316        request_value_reader
14317            .seek(std::io::SeekFrom::Start(0))
14318            .unwrap();
14319
14320        loop {
14321            let token = match self
14322                .hub
14323                .auth
14324                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14325                .await
14326            {
14327                Ok(token) => token,
14328                Err(e) => match dlg.token(e) {
14329                    Ok(token) => token,
14330                    Err(e) => {
14331                        dlg.finished(false);
14332                        return Err(common::Error::MissingToken(e));
14333                    }
14334                },
14335            };
14336            request_value_reader
14337                .seek(std::io::SeekFrom::Start(0))
14338                .unwrap();
14339            let mut req_result = {
14340                let client = &self.hub.client;
14341                dlg.pre_request();
14342                let mut req_builder = hyper::Request::builder()
14343                    .method(hyper::Method::POST)
14344                    .uri(url.as_str())
14345                    .header(USER_AGENT, self.hub._user_agent.clone());
14346
14347                if let Some(token) = token.as_ref() {
14348                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14349                }
14350
14351                let request = req_builder
14352                    .header(CONTENT_TYPE, json_mime_type.to_string())
14353                    .header(CONTENT_LENGTH, request_size as u64)
14354                    .body(common::to_body(
14355                        request_value_reader.get_ref().clone().into(),
14356                    ));
14357
14358                client.request(request.unwrap()).await
14359            };
14360
14361            match req_result {
14362                Err(err) => {
14363                    if let common::Retry::After(d) = dlg.http_error(&err) {
14364                        sleep(d).await;
14365                        continue;
14366                    }
14367                    dlg.finished(false);
14368                    return Err(common::Error::HttpError(err));
14369                }
14370                Ok(res) => {
14371                    let (mut parts, body) = res.into_parts();
14372                    let mut body = common::Body::new(body);
14373                    if !parts.status.is_success() {
14374                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14375                        let error = serde_json::from_str(&common::to_string(&bytes));
14376                        let response = common::to_response(parts, bytes.into());
14377
14378                        if let common::Retry::After(d) =
14379                            dlg.http_failure(&response, error.as_ref().ok())
14380                        {
14381                            sleep(d).await;
14382                            continue;
14383                        }
14384
14385                        dlg.finished(false);
14386
14387                        return Err(match error {
14388                            Ok(value) => common::Error::BadRequest(value),
14389                            _ => common::Error::Failure(response),
14390                        });
14391                    }
14392                    let response = {
14393                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14394                        let encoded = common::to_string(&bytes);
14395                        match serde_json::from_str(&encoded) {
14396                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14397                            Err(error) => {
14398                                dlg.response_json_decode_error(&encoded, &error);
14399                                return Err(common::Error::JsonDecodeError(
14400                                    encoded.to_string(),
14401                                    error,
14402                                ));
14403                            }
14404                        }
14405                    };
14406
14407                    dlg.finished(true);
14408                    return Ok(response);
14409                }
14410            }
14411        }
14412    }
14413
14414    ///
14415    /// Sets the *request* property to the given value.
14416    ///
14417    /// Even though the property as already been set when instantiating this call,
14418    /// we provide this method for API completeness.
14419    pub fn request(mut self, new_value: AddMessageRequest) -> FlightobjectAddmessageCall<'a, C> {
14420        self._request = new_value;
14421        self
14422    }
14423    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
14424    ///
14425    /// Sets the *resource id* path property to the given value.
14426    ///
14427    /// Even though the property as already been set when instantiating this call,
14428    /// we provide this method for API completeness.
14429    pub fn resource_id(mut self, new_value: &str) -> FlightobjectAddmessageCall<'a, C> {
14430        self._resource_id = new_value.to_string();
14431        self
14432    }
14433    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14434    /// while executing the actual API request.
14435    ///
14436    /// ````text
14437    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14438    /// ````
14439    ///
14440    /// Sets the *delegate* property to the given value.
14441    pub fn delegate(
14442        mut self,
14443        new_value: &'a mut dyn common::Delegate,
14444    ) -> FlightobjectAddmessageCall<'a, C> {
14445        self._delegate = Some(new_value);
14446        self
14447    }
14448
14449    /// Set any additional parameter of the query string used in the request.
14450    /// It should be used to set parameters which are not yet available through their own
14451    /// setters.
14452    ///
14453    /// Please note that this method must not be used to set any of the known parameters
14454    /// which have their own setter method. If done anyway, the request will fail.
14455    ///
14456    /// # Additional Parameters
14457    ///
14458    /// * *$.xgafv* (query-string) - V1 error format.
14459    /// * *access_token* (query-string) - OAuth access token.
14460    /// * *alt* (query-string) - Data format for response.
14461    /// * *callback* (query-string) - JSONP
14462    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14463    /// * *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.
14464    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14465    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14466    /// * *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.
14467    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14468    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14469    pub fn param<T>(mut self, name: T, value: T) -> FlightobjectAddmessageCall<'a, C>
14470    where
14471        T: AsRef<str>,
14472    {
14473        self._additional_params
14474            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14475        self
14476    }
14477
14478    /// Identifies the authorization scope for the method you are building.
14479    ///
14480    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14481    /// [`Scope::WalletObjectIssuer`].
14482    ///
14483    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14484    /// tokens for more than one scope.
14485    ///
14486    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14487    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14488    /// sufficient, a read-write scope will do as well.
14489    pub fn add_scope<St>(mut self, scope: St) -> FlightobjectAddmessageCall<'a, C>
14490    where
14491        St: AsRef<str>,
14492    {
14493        self._scopes.insert(String::from(scope.as_ref()));
14494        self
14495    }
14496    /// Identifies the authorization scope(s) for the method you are building.
14497    ///
14498    /// See [`Self::add_scope()`] for details.
14499    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectAddmessageCall<'a, C>
14500    where
14501        I: IntoIterator<Item = St>,
14502        St: AsRef<str>,
14503    {
14504        self._scopes
14505            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14506        self
14507    }
14508
14509    /// Removes all scopes, and no default scope will be used either.
14510    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14511    /// for details).
14512    pub fn clear_scopes(mut self) -> FlightobjectAddmessageCall<'a, C> {
14513        self._scopes.clear();
14514        self
14515    }
14516}
14517
14518/// Returns the flight object with the given object ID.
14519///
14520/// A builder for the *get* method supported by a *flightobject* resource.
14521/// It is not used directly, but through a [`FlightobjectMethods`] instance.
14522///
14523/// # Example
14524///
14525/// Instantiate a resource method builder
14526///
14527/// ```test_harness,no_run
14528/// # extern crate hyper;
14529/// # extern crate hyper_rustls;
14530/// # extern crate google_walletobjects1 as walletobjects1;
14531/// # async fn dox() {
14532/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14533///
14534/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14535/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14536/// #     .with_native_roots()
14537/// #     .unwrap()
14538/// #     .https_only()
14539/// #     .enable_http2()
14540/// #     .build();
14541///
14542/// # let executor = hyper_util::rt::TokioExecutor::new();
14543/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14544/// #     secret,
14545/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14546/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14547/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14548/// #     ),
14549/// # ).build().await.unwrap();
14550///
14551/// # let client = hyper_util::client::legacy::Client::builder(
14552/// #     hyper_util::rt::TokioExecutor::new()
14553/// # )
14554/// # .build(
14555/// #     hyper_rustls::HttpsConnectorBuilder::new()
14556/// #         .with_native_roots()
14557/// #         .unwrap()
14558/// #         .https_or_http()
14559/// #         .enable_http2()
14560/// #         .build()
14561/// # );
14562/// # let mut hub = Walletobjects::new(client, auth);
14563/// // You can configure optional parameters by calling the respective setters at will, and
14564/// // execute the final call using `doit()`.
14565/// // Values shown here are possibly random and not representative !
14566/// let result = hub.flightobject().get("resourceId")
14567///              .doit().await;
14568/// # }
14569/// ```
14570pub struct FlightobjectGetCall<'a, C>
14571where
14572    C: 'a,
14573{
14574    hub: &'a Walletobjects<C>,
14575    _resource_id: String,
14576    _delegate: Option<&'a mut dyn common::Delegate>,
14577    _additional_params: HashMap<String, String>,
14578    _scopes: BTreeSet<String>,
14579}
14580
14581impl<'a, C> common::CallBuilder for FlightobjectGetCall<'a, C> {}
14582
14583impl<'a, C> FlightobjectGetCall<'a, C>
14584where
14585    C: common::Connector,
14586{
14587    /// Perform the operation you have build so far.
14588    pub async fn doit(mut self) -> common::Result<(common::Response, FlightObject)> {
14589        use std::borrow::Cow;
14590        use std::io::{Read, Seek};
14591
14592        use common::{url::Params, ToParts};
14593        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14594
14595        let mut dd = common::DefaultDelegate;
14596        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14597        dlg.begin(common::MethodInfo {
14598            id: "walletobjects.flightobject.get",
14599            http_method: hyper::Method::GET,
14600        });
14601
14602        for &field in ["alt", "resourceId"].iter() {
14603            if self._additional_params.contains_key(field) {
14604                dlg.finished(false);
14605                return Err(common::Error::FieldClash(field));
14606            }
14607        }
14608
14609        let mut params = Params::with_capacity(3 + self._additional_params.len());
14610        params.push("resourceId", self._resource_id);
14611
14612        params.extend(self._additional_params.iter());
14613
14614        params.push("alt", "json");
14615        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject/{resourceId}";
14616        if self._scopes.is_empty() {
14617            self._scopes
14618                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
14619        }
14620
14621        #[allow(clippy::single_element_loop)]
14622        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
14623            url = params.uri_replacement(url, param_name, find_this, false);
14624        }
14625        {
14626            let to_remove = ["resourceId"];
14627            params.remove_params(&to_remove);
14628        }
14629
14630        let url = params.parse_with_url(&url);
14631
14632        loop {
14633            let token = match self
14634                .hub
14635                .auth
14636                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14637                .await
14638            {
14639                Ok(token) => token,
14640                Err(e) => match dlg.token(e) {
14641                    Ok(token) => token,
14642                    Err(e) => {
14643                        dlg.finished(false);
14644                        return Err(common::Error::MissingToken(e));
14645                    }
14646                },
14647            };
14648            let mut req_result = {
14649                let client = &self.hub.client;
14650                dlg.pre_request();
14651                let mut req_builder = hyper::Request::builder()
14652                    .method(hyper::Method::GET)
14653                    .uri(url.as_str())
14654                    .header(USER_AGENT, self.hub._user_agent.clone());
14655
14656                if let Some(token) = token.as_ref() {
14657                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14658                }
14659
14660                let request = req_builder
14661                    .header(CONTENT_LENGTH, 0_u64)
14662                    .body(common::to_body::<String>(None));
14663
14664                client.request(request.unwrap()).await
14665            };
14666
14667            match req_result {
14668                Err(err) => {
14669                    if let common::Retry::After(d) = dlg.http_error(&err) {
14670                        sleep(d).await;
14671                        continue;
14672                    }
14673                    dlg.finished(false);
14674                    return Err(common::Error::HttpError(err));
14675                }
14676                Ok(res) => {
14677                    let (mut parts, body) = res.into_parts();
14678                    let mut body = common::Body::new(body);
14679                    if !parts.status.is_success() {
14680                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14681                        let error = serde_json::from_str(&common::to_string(&bytes));
14682                        let response = common::to_response(parts, bytes.into());
14683
14684                        if let common::Retry::After(d) =
14685                            dlg.http_failure(&response, error.as_ref().ok())
14686                        {
14687                            sleep(d).await;
14688                            continue;
14689                        }
14690
14691                        dlg.finished(false);
14692
14693                        return Err(match error {
14694                            Ok(value) => common::Error::BadRequest(value),
14695                            _ => common::Error::Failure(response),
14696                        });
14697                    }
14698                    let response = {
14699                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14700                        let encoded = common::to_string(&bytes);
14701                        match serde_json::from_str(&encoded) {
14702                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14703                            Err(error) => {
14704                                dlg.response_json_decode_error(&encoded, &error);
14705                                return Err(common::Error::JsonDecodeError(
14706                                    encoded.to_string(),
14707                                    error,
14708                                ));
14709                            }
14710                        }
14711                    };
14712
14713                    dlg.finished(true);
14714                    return Ok(response);
14715                }
14716            }
14717        }
14718    }
14719
14720    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
14721    ///
14722    /// Sets the *resource id* path property to the given value.
14723    ///
14724    /// Even though the property as already been set when instantiating this call,
14725    /// we provide this method for API completeness.
14726    pub fn resource_id(mut self, new_value: &str) -> FlightobjectGetCall<'a, C> {
14727        self._resource_id = new_value.to_string();
14728        self
14729    }
14730    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14731    /// while executing the actual API request.
14732    ///
14733    /// ````text
14734    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14735    /// ````
14736    ///
14737    /// Sets the *delegate* property to the given value.
14738    pub fn delegate(
14739        mut self,
14740        new_value: &'a mut dyn common::Delegate,
14741    ) -> FlightobjectGetCall<'a, C> {
14742        self._delegate = Some(new_value);
14743        self
14744    }
14745
14746    /// Set any additional parameter of the query string used in the request.
14747    /// It should be used to set parameters which are not yet available through their own
14748    /// setters.
14749    ///
14750    /// Please note that this method must not be used to set any of the known parameters
14751    /// which have their own setter method. If done anyway, the request will fail.
14752    ///
14753    /// # Additional Parameters
14754    ///
14755    /// * *$.xgafv* (query-string) - V1 error format.
14756    /// * *access_token* (query-string) - OAuth access token.
14757    /// * *alt* (query-string) - Data format for response.
14758    /// * *callback* (query-string) - JSONP
14759    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14760    /// * *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.
14761    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14762    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14763    /// * *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.
14764    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14765    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14766    pub fn param<T>(mut self, name: T, value: T) -> FlightobjectGetCall<'a, C>
14767    where
14768        T: AsRef<str>,
14769    {
14770        self._additional_params
14771            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14772        self
14773    }
14774
14775    /// Identifies the authorization scope for the method you are building.
14776    ///
14777    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14778    /// [`Scope::WalletObjectIssuer`].
14779    ///
14780    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14781    /// tokens for more than one scope.
14782    ///
14783    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14784    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14785    /// sufficient, a read-write scope will do as well.
14786    pub fn add_scope<St>(mut self, scope: St) -> FlightobjectGetCall<'a, C>
14787    where
14788        St: AsRef<str>,
14789    {
14790        self._scopes.insert(String::from(scope.as_ref()));
14791        self
14792    }
14793    /// Identifies the authorization scope(s) for the method you are building.
14794    ///
14795    /// See [`Self::add_scope()`] for details.
14796    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectGetCall<'a, C>
14797    where
14798        I: IntoIterator<Item = St>,
14799        St: AsRef<str>,
14800    {
14801        self._scopes
14802            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14803        self
14804    }
14805
14806    /// Removes all scopes, and no default scope will be used either.
14807    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14808    /// for details).
14809    pub fn clear_scopes(mut self) -> FlightobjectGetCall<'a, C> {
14810        self._scopes.clear();
14811        self
14812    }
14813}
14814
14815/// Inserts an flight object with the given ID and properties.
14816///
14817/// A builder for the *insert* method supported by a *flightobject* resource.
14818/// It is not used directly, but through a [`FlightobjectMethods`] instance.
14819///
14820/// # Example
14821///
14822/// Instantiate a resource method builder
14823///
14824/// ```test_harness,no_run
14825/// # extern crate hyper;
14826/// # extern crate hyper_rustls;
14827/// # extern crate google_walletobjects1 as walletobjects1;
14828/// use walletobjects1::api::FlightObject;
14829/// # async fn dox() {
14830/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14831///
14832/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14833/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14834/// #     .with_native_roots()
14835/// #     .unwrap()
14836/// #     .https_only()
14837/// #     .enable_http2()
14838/// #     .build();
14839///
14840/// # let executor = hyper_util::rt::TokioExecutor::new();
14841/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14842/// #     secret,
14843/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14844/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14845/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14846/// #     ),
14847/// # ).build().await.unwrap();
14848///
14849/// # let client = hyper_util::client::legacy::Client::builder(
14850/// #     hyper_util::rt::TokioExecutor::new()
14851/// # )
14852/// # .build(
14853/// #     hyper_rustls::HttpsConnectorBuilder::new()
14854/// #         .with_native_roots()
14855/// #         .unwrap()
14856/// #         .https_or_http()
14857/// #         .enable_http2()
14858/// #         .build()
14859/// # );
14860/// # let mut hub = Walletobjects::new(client, auth);
14861/// // As the method needs a request, you would usually fill it with the desired information
14862/// // into the respective structure. Some of the parts shown here might not be applicable !
14863/// // Values shown here are possibly random and not representative !
14864/// let mut req = FlightObject::default();
14865///
14866/// // You can configure optional parameters by calling the respective setters at will, and
14867/// // execute the final call using `doit()`.
14868/// // Values shown here are possibly random and not representative !
14869/// let result = hub.flightobject().insert(req)
14870///              .doit().await;
14871/// # }
14872/// ```
14873pub struct FlightobjectInsertCall<'a, C>
14874where
14875    C: 'a,
14876{
14877    hub: &'a Walletobjects<C>,
14878    _request: FlightObject,
14879    _delegate: Option<&'a mut dyn common::Delegate>,
14880    _additional_params: HashMap<String, String>,
14881    _scopes: BTreeSet<String>,
14882}
14883
14884impl<'a, C> common::CallBuilder for FlightobjectInsertCall<'a, C> {}
14885
14886impl<'a, C> FlightobjectInsertCall<'a, C>
14887where
14888    C: common::Connector,
14889{
14890    /// Perform the operation you have build so far.
14891    pub async fn doit(mut self) -> common::Result<(common::Response, FlightObject)> {
14892        use std::borrow::Cow;
14893        use std::io::{Read, Seek};
14894
14895        use common::{url::Params, ToParts};
14896        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14897
14898        let mut dd = common::DefaultDelegate;
14899        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14900        dlg.begin(common::MethodInfo {
14901            id: "walletobjects.flightobject.insert",
14902            http_method: hyper::Method::POST,
14903        });
14904
14905        for &field in ["alt"].iter() {
14906            if self._additional_params.contains_key(field) {
14907                dlg.finished(false);
14908                return Err(common::Error::FieldClash(field));
14909            }
14910        }
14911
14912        let mut params = Params::with_capacity(3 + self._additional_params.len());
14913
14914        params.extend(self._additional_params.iter());
14915
14916        params.push("alt", "json");
14917        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject";
14918        if self._scopes.is_empty() {
14919            self._scopes
14920                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
14921        }
14922
14923        let url = params.parse_with_url(&url);
14924
14925        let mut json_mime_type = mime::APPLICATION_JSON;
14926        let mut request_value_reader = {
14927            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14928            common::remove_json_null_values(&mut value);
14929            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14930            serde_json::to_writer(&mut dst, &value).unwrap();
14931            dst
14932        };
14933        let request_size = request_value_reader
14934            .seek(std::io::SeekFrom::End(0))
14935            .unwrap();
14936        request_value_reader
14937            .seek(std::io::SeekFrom::Start(0))
14938            .unwrap();
14939
14940        loop {
14941            let token = match self
14942                .hub
14943                .auth
14944                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14945                .await
14946            {
14947                Ok(token) => token,
14948                Err(e) => match dlg.token(e) {
14949                    Ok(token) => token,
14950                    Err(e) => {
14951                        dlg.finished(false);
14952                        return Err(common::Error::MissingToken(e));
14953                    }
14954                },
14955            };
14956            request_value_reader
14957                .seek(std::io::SeekFrom::Start(0))
14958                .unwrap();
14959            let mut req_result = {
14960                let client = &self.hub.client;
14961                dlg.pre_request();
14962                let mut req_builder = hyper::Request::builder()
14963                    .method(hyper::Method::POST)
14964                    .uri(url.as_str())
14965                    .header(USER_AGENT, self.hub._user_agent.clone());
14966
14967                if let Some(token) = token.as_ref() {
14968                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14969                }
14970
14971                let request = req_builder
14972                    .header(CONTENT_TYPE, json_mime_type.to_string())
14973                    .header(CONTENT_LENGTH, request_size as u64)
14974                    .body(common::to_body(
14975                        request_value_reader.get_ref().clone().into(),
14976                    ));
14977
14978                client.request(request.unwrap()).await
14979            };
14980
14981            match req_result {
14982                Err(err) => {
14983                    if let common::Retry::After(d) = dlg.http_error(&err) {
14984                        sleep(d).await;
14985                        continue;
14986                    }
14987                    dlg.finished(false);
14988                    return Err(common::Error::HttpError(err));
14989                }
14990                Ok(res) => {
14991                    let (mut parts, body) = res.into_parts();
14992                    let mut body = common::Body::new(body);
14993                    if !parts.status.is_success() {
14994                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14995                        let error = serde_json::from_str(&common::to_string(&bytes));
14996                        let response = common::to_response(parts, bytes.into());
14997
14998                        if let common::Retry::After(d) =
14999                            dlg.http_failure(&response, error.as_ref().ok())
15000                        {
15001                            sleep(d).await;
15002                            continue;
15003                        }
15004
15005                        dlg.finished(false);
15006
15007                        return Err(match error {
15008                            Ok(value) => common::Error::BadRequest(value),
15009                            _ => common::Error::Failure(response),
15010                        });
15011                    }
15012                    let response = {
15013                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15014                        let encoded = common::to_string(&bytes);
15015                        match serde_json::from_str(&encoded) {
15016                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15017                            Err(error) => {
15018                                dlg.response_json_decode_error(&encoded, &error);
15019                                return Err(common::Error::JsonDecodeError(
15020                                    encoded.to_string(),
15021                                    error,
15022                                ));
15023                            }
15024                        }
15025                    };
15026
15027                    dlg.finished(true);
15028                    return Ok(response);
15029                }
15030            }
15031        }
15032    }
15033
15034    ///
15035    /// Sets the *request* property to the given value.
15036    ///
15037    /// Even though the property as already been set when instantiating this call,
15038    /// we provide this method for API completeness.
15039    pub fn request(mut self, new_value: FlightObject) -> FlightobjectInsertCall<'a, C> {
15040        self._request = new_value;
15041        self
15042    }
15043    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15044    /// while executing the actual API request.
15045    ///
15046    /// ````text
15047    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15048    /// ````
15049    ///
15050    /// Sets the *delegate* property to the given value.
15051    pub fn delegate(
15052        mut self,
15053        new_value: &'a mut dyn common::Delegate,
15054    ) -> FlightobjectInsertCall<'a, C> {
15055        self._delegate = Some(new_value);
15056        self
15057    }
15058
15059    /// Set any additional parameter of the query string used in the request.
15060    /// It should be used to set parameters which are not yet available through their own
15061    /// setters.
15062    ///
15063    /// Please note that this method must not be used to set any of the known parameters
15064    /// which have their own setter method. If done anyway, the request will fail.
15065    ///
15066    /// # Additional Parameters
15067    ///
15068    /// * *$.xgafv* (query-string) - V1 error format.
15069    /// * *access_token* (query-string) - OAuth access token.
15070    /// * *alt* (query-string) - Data format for response.
15071    /// * *callback* (query-string) - JSONP
15072    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15073    /// * *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.
15074    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15075    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15076    /// * *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.
15077    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15078    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15079    pub fn param<T>(mut self, name: T, value: T) -> FlightobjectInsertCall<'a, C>
15080    where
15081        T: AsRef<str>,
15082    {
15083        self._additional_params
15084            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15085        self
15086    }
15087
15088    /// Identifies the authorization scope for the method you are building.
15089    ///
15090    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15091    /// [`Scope::WalletObjectIssuer`].
15092    ///
15093    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15094    /// tokens for more than one scope.
15095    ///
15096    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15097    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15098    /// sufficient, a read-write scope will do as well.
15099    pub fn add_scope<St>(mut self, scope: St) -> FlightobjectInsertCall<'a, C>
15100    where
15101        St: AsRef<str>,
15102    {
15103        self._scopes.insert(String::from(scope.as_ref()));
15104        self
15105    }
15106    /// Identifies the authorization scope(s) for the method you are building.
15107    ///
15108    /// See [`Self::add_scope()`] for details.
15109    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectInsertCall<'a, C>
15110    where
15111        I: IntoIterator<Item = St>,
15112        St: AsRef<str>,
15113    {
15114        self._scopes
15115            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15116        self
15117    }
15118
15119    /// Removes all scopes, and no default scope will be used either.
15120    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15121    /// for details).
15122    pub fn clear_scopes(mut self) -> FlightobjectInsertCall<'a, C> {
15123        self._scopes.clear();
15124        self
15125    }
15126}
15127
15128/// Returns a list of all flight objects for a given issuer ID.
15129///
15130/// A builder for the *list* method supported by a *flightobject* resource.
15131/// It is not used directly, but through a [`FlightobjectMethods`] instance.
15132///
15133/// # Example
15134///
15135/// Instantiate a resource method builder
15136///
15137/// ```test_harness,no_run
15138/// # extern crate hyper;
15139/// # extern crate hyper_rustls;
15140/// # extern crate google_walletobjects1 as walletobjects1;
15141/// # async fn dox() {
15142/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15143///
15144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15145/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15146/// #     .with_native_roots()
15147/// #     .unwrap()
15148/// #     .https_only()
15149/// #     .enable_http2()
15150/// #     .build();
15151///
15152/// # let executor = hyper_util::rt::TokioExecutor::new();
15153/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15154/// #     secret,
15155/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15156/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15157/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15158/// #     ),
15159/// # ).build().await.unwrap();
15160///
15161/// # let client = hyper_util::client::legacy::Client::builder(
15162/// #     hyper_util::rt::TokioExecutor::new()
15163/// # )
15164/// # .build(
15165/// #     hyper_rustls::HttpsConnectorBuilder::new()
15166/// #         .with_native_roots()
15167/// #         .unwrap()
15168/// #         .https_or_http()
15169/// #         .enable_http2()
15170/// #         .build()
15171/// # );
15172/// # let mut hub = Walletobjects::new(client, auth);
15173/// // You can configure optional parameters by calling the respective setters at will, and
15174/// // execute the final call using `doit()`.
15175/// // Values shown here are possibly random and not representative !
15176/// let result = hub.flightobject().list()
15177///              .token("rebum.")
15178///              .max_results(-57)
15179///              .class_id("ipsum")
15180///              .doit().await;
15181/// # }
15182/// ```
15183pub struct FlightobjectListCall<'a, C>
15184where
15185    C: 'a,
15186{
15187    hub: &'a Walletobjects<C>,
15188    _token: Option<String>,
15189    _max_results: Option<i32>,
15190    _class_id: Option<String>,
15191    _delegate: Option<&'a mut dyn common::Delegate>,
15192    _additional_params: HashMap<String, String>,
15193    _scopes: BTreeSet<String>,
15194}
15195
15196impl<'a, C> common::CallBuilder for FlightobjectListCall<'a, C> {}
15197
15198impl<'a, C> FlightobjectListCall<'a, C>
15199where
15200    C: common::Connector,
15201{
15202    /// Perform the operation you have build so far.
15203    pub async fn doit(mut self) -> common::Result<(common::Response, FlightObjectListResponse)> {
15204        use std::borrow::Cow;
15205        use std::io::{Read, Seek};
15206
15207        use common::{url::Params, ToParts};
15208        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15209
15210        let mut dd = common::DefaultDelegate;
15211        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15212        dlg.begin(common::MethodInfo {
15213            id: "walletobjects.flightobject.list",
15214            http_method: hyper::Method::GET,
15215        });
15216
15217        for &field in ["alt", "token", "maxResults", "classId"].iter() {
15218            if self._additional_params.contains_key(field) {
15219                dlg.finished(false);
15220                return Err(common::Error::FieldClash(field));
15221            }
15222        }
15223
15224        let mut params = Params::with_capacity(5 + self._additional_params.len());
15225        if let Some(value) = self._token.as_ref() {
15226            params.push("token", value);
15227        }
15228        if let Some(value) = self._max_results.as_ref() {
15229            params.push("maxResults", value.to_string());
15230        }
15231        if let Some(value) = self._class_id.as_ref() {
15232            params.push("classId", value);
15233        }
15234
15235        params.extend(self._additional_params.iter());
15236
15237        params.push("alt", "json");
15238        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject";
15239        if self._scopes.is_empty() {
15240            self._scopes
15241                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
15242        }
15243
15244        let url = params.parse_with_url(&url);
15245
15246        loop {
15247            let token = match self
15248                .hub
15249                .auth
15250                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15251                .await
15252            {
15253                Ok(token) => token,
15254                Err(e) => match dlg.token(e) {
15255                    Ok(token) => token,
15256                    Err(e) => {
15257                        dlg.finished(false);
15258                        return Err(common::Error::MissingToken(e));
15259                    }
15260                },
15261            };
15262            let mut req_result = {
15263                let client = &self.hub.client;
15264                dlg.pre_request();
15265                let mut req_builder = hyper::Request::builder()
15266                    .method(hyper::Method::GET)
15267                    .uri(url.as_str())
15268                    .header(USER_AGENT, self.hub._user_agent.clone());
15269
15270                if let Some(token) = token.as_ref() {
15271                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15272                }
15273
15274                let request = req_builder
15275                    .header(CONTENT_LENGTH, 0_u64)
15276                    .body(common::to_body::<String>(None));
15277
15278                client.request(request.unwrap()).await
15279            };
15280
15281            match req_result {
15282                Err(err) => {
15283                    if let common::Retry::After(d) = dlg.http_error(&err) {
15284                        sleep(d).await;
15285                        continue;
15286                    }
15287                    dlg.finished(false);
15288                    return Err(common::Error::HttpError(err));
15289                }
15290                Ok(res) => {
15291                    let (mut parts, body) = res.into_parts();
15292                    let mut body = common::Body::new(body);
15293                    if !parts.status.is_success() {
15294                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15295                        let error = serde_json::from_str(&common::to_string(&bytes));
15296                        let response = common::to_response(parts, bytes.into());
15297
15298                        if let common::Retry::After(d) =
15299                            dlg.http_failure(&response, error.as_ref().ok())
15300                        {
15301                            sleep(d).await;
15302                            continue;
15303                        }
15304
15305                        dlg.finished(false);
15306
15307                        return Err(match error {
15308                            Ok(value) => common::Error::BadRequest(value),
15309                            _ => common::Error::Failure(response),
15310                        });
15311                    }
15312                    let response = {
15313                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15314                        let encoded = common::to_string(&bytes);
15315                        match serde_json::from_str(&encoded) {
15316                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15317                            Err(error) => {
15318                                dlg.response_json_decode_error(&encoded, &error);
15319                                return Err(common::Error::JsonDecodeError(
15320                                    encoded.to_string(),
15321                                    error,
15322                                ));
15323                            }
15324                        }
15325                    };
15326
15327                    dlg.finished(true);
15328                    return Ok(response);
15329                }
15330            }
15331        }
15332    }
15333
15334    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` objects are available in a list. For example, if you have a list of 200 objects and you call list with `maxResults` set to 20, list will return the first 20 objects and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 objects.
15335    ///
15336    /// Sets the *token* query property to the given value.
15337    pub fn token(mut self, new_value: &str) -> FlightobjectListCall<'a, C> {
15338        self._token = Some(new_value.to_string());
15339        self
15340    }
15341    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
15342    ///
15343    /// Sets the *max results* query property to the given value.
15344    pub fn max_results(mut self, new_value: i32) -> FlightobjectListCall<'a, C> {
15345        self._max_results = Some(new_value);
15346        self
15347    }
15348    /// The ID of the class whose objects will be listed.
15349    ///
15350    /// Sets the *class id* query property to the given value.
15351    pub fn class_id(mut self, new_value: &str) -> FlightobjectListCall<'a, C> {
15352        self._class_id = Some(new_value.to_string());
15353        self
15354    }
15355    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15356    /// while executing the actual API request.
15357    ///
15358    /// ````text
15359    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15360    /// ````
15361    ///
15362    /// Sets the *delegate* property to the given value.
15363    pub fn delegate(
15364        mut self,
15365        new_value: &'a mut dyn common::Delegate,
15366    ) -> FlightobjectListCall<'a, C> {
15367        self._delegate = Some(new_value);
15368        self
15369    }
15370
15371    /// Set any additional parameter of the query string used in the request.
15372    /// It should be used to set parameters which are not yet available through their own
15373    /// setters.
15374    ///
15375    /// Please note that this method must not be used to set any of the known parameters
15376    /// which have their own setter method. If done anyway, the request will fail.
15377    ///
15378    /// # Additional Parameters
15379    ///
15380    /// * *$.xgafv* (query-string) - V1 error format.
15381    /// * *access_token* (query-string) - OAuth access token.
15382    /// * *alt* (query-string) - Data format for response.
15383    /// * *callback* (query-string) - JSONP
15384    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15385    /// * *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.
15386    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15387    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15388    /// * *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.
15389    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15390    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15391    pub fn param<T>(mut self, name: T, value: T) -> FlightobjectListCall<'a, C>
15392    where
15393        T: AsRef<str>,
15394    {
15395        self._additional_params
15396            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15397        self
15398    }
15399
15400    /// Identifies the authorization scope for the method you are building.
15401    ///
15402    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15403    /// [`Scope::WalletObjectIssuer`].
15404    ///
15405    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15406    /// tokens for more than one scope.
15407    ///
15408    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15409    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15410    /// sufficient, a read-write scope will do as well.
15411    pub fn add_scope<St>(mut self, scope: St) -> FlightobjectListCall<'a, C>
15412    where
15413        St: AsRef<str>,
15414    {
15415        self._scopes.insert(String::from(scope.as_ref()));
15416        self
15417    }
15418    /// Identifies the authorization scope(s) for the method you are building.
15419    ///
15420    /// See [`Self::add_scope()`] for details.
15421    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectListCall<'a, C>
15422    where
15423        I: IntoIterator<Item = St>,
15424        St: AsRef<str>,
15425    {
15426        self._scopes
15427            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15428        self
15429    }
15430
15431    /// Removes all scopes, and no default scope will be used either.
15432    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15433    /// for details).
15434    pub fn clear_scopes(mut self) -> FlightobjectListCall<'a, C> {
15435        self._scopes.clear();
15436        self
15437    }
15438}
15439
15440/// Updates the flight object referenced by the given object ID. This method supports patch semantics.
15441///
15442/// A builder for the *patch* method supported by a *flightobject* resource.
15443/// It is not used directly, but through a [`FlightobjectMethods`] instance.
15444///
15445/// # Example
15446///
15447/// Instantiate a resource method builder
15448///
15449/// ```test_harness,no_run
15450/// # extern crate hyper;
15451/// # extern crate hyper_rustls;
15452/// # extern crate google_walletobjects1 as walletobjects1;
15453/// use walletobjects1::api::FlightObject;
15454/// # async fn dox() {
15455/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15456///
15457/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15458/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15459/// #     .with_native_roots()
15460/// #     .unwrap()
15461/// #     .https_only()
15462/// #     .enable_http2()
15463/// #     .build();
15464///
15465/// # let executor = hyper_util::rt::TokioExecutor::new();
15466/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15467/// #     secret,
15468/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15469/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15470/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15471/// #     ),
15472/// # ).build().await.unwrap();
15473///
15474/// # let client = hyper_util::client::legacy::Client::builder(
15475/// #     hyper_util::rt::TokioExecutor::new()
15476/// # )
15477/// # .build(
15478/// #     hyper_rustls::HttpsConnectorBuilder::new()
15479/// #         .with_native_roots()
15480/// #         .unwrap()
15481/// #         .https_or_http()
15482/// #         .enable_http2()
15483/// #         .build()
15484/// # );
15485/// # let mut hub = Walletobjects::new(client, auth);
15486/// // As the method needs a request, you would usually fill it with the desired information
15487/// // into the respective structure. Some of the parts shown here might not be applicable !
15488/// // Values shown here are possibly random and not representative !
15489/// let mut req = FlightObject::default();
15490///
15491/// // You can configure optional parameters by calling the respective setters at will, and
15492/// // execute the final call using `doit()`.
15493/// // Values shown here are possibly random and not representative !
15494/// let result = hub.flightobject().patch(req, "resourceId")
15495///              .doit().await;
15496/// # }
15497/// ```
15498pub struct FlightobjectPatchCall<'a, C>
15499where
15500    C: 'a,
15501{
15502    hub: &'a Walletobjects<C>,
15503    _request: FlightObject,
15504    _resource_id: String,
15505    _delegate: Option<&'a mut dyn common::Delegate>,
15506    _additional_params: HashMap<String, String>,
15507    _scopes: BTreeSet<String>,
15508}
15509
15510impl<'a, C> common::CallBuilder for FlightobjectPatchCall<'a, C> {}
15511
15512impl<'a, C> FlightobjectPatchCall<'a, C>
15513where
15514    C: common::Connector,
15515{
15516    /// Perform the operation you have build so far.
15517    pub async fn doit(mut self) -> common::Result<(common::Response, FlightObject)> {
15518        use std::borrow::Cow;
15519        use std::io::{Read, Seek};
15520
15521        use common::{url::Params, ToParts};
15522        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15523
15524        let mut dd = common::DefaultDelegate;
15525        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15526        dlg.begin(common::MethodInfo {
15527            id: "walletobjects.flightobject.patch",
15528            http_method: hyper::Method::PATCH,
15529        });
15530
15531        for &field in ["alt", "resourceId"].iter() {
15532            if self._additional_params.contains_key(field) {
15533                dlg.finished(false);
15534                return Err(common::Error::FieldClash(field));
15535            }
15536        }
15537
15538        let mut params = Params::with_capacity(4 + self._additional_params.len());
15539        params.push("resourceId", self._resource_id);
15540
15541        params.extend(self._additional_params.iter());
15542
15543        params.push("alt", "json");
15544        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject/{resourceId}";
15545        if self._scopes.is_empty() {
15546            self._scopes
15547                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
15548        }
15549
15550        #[allow(clippy::single_element_loop)]
15551        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
15552            url = params.uri_replacement(url, param_name, find_this, false);
15553        }
15554        {
15555            let to_remove = ["resourceId"];
15556            params.remove_params(&to_remove);
15557        }
15558
15559        let url = params.parse_with_url(&url);
15560
15561        let mut json_mime_type = mime::APPLICATION_JSON;
15562        let mut request_value_reader = {
15563            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15564            common::remove_json_null_values(&mut value);
15565            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15566            serde_json::to_writer(&mut dst, &value).unwrap();
15567            dst
15568        };
15569        let request_size = request_value_reader
15570            .seek(std::io::SeekFrom::End(0))
15571            .unwrap();
15572        request_value_reader
15573            .seek(std::io::SeekFrom::Start(0))
15574            .unwrap();
15575
15576        loop {
15577            let token = match self
15578                .hub
15579                .auth
15580                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15581                .await
15582            {
15583                Ok(token) => token,
15584                Err(e) => match dlg.token(e) {
15585                    Ok(token) => token,
15586                    Err(e) => {
15587                        dlg.finished(false);
15588                        return Err(common::Error::MissingToken(e));
15589                    }
15590                },
15591            };
15592            request_value_reader
15593                .seek(std::io::SeekFrom::Start(0))
15594                .unwrap();
15595            let mut req_result = {
15596                let client = &self.hub.client;
15597                dlg.pre_request();
15598                let mut req_builder = hyper::Request::builder()
15599                    .method(hyper::Method::PATCH)
15600                    .uri(url.as_str())
15601                    .header(USER_AGENT, self.hub._user_agent.clone());
15602
15603                if let Some(token) = token.as_ref() {
15604                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15605                }
15606
15607                let request = req_builder
15608                    .header(CONTENT_TYPE, json_mime_type.to_string())
15609                    .header(CONTENT_LENGTH, request_size as u64)
15610                    .body(common::to_body(
15611                        request_value_reader.get_ref().clone().into(),
15612                    ));
15613
15614                client.request(request.unwrap()).await
15615            };
15616
15617            match req_result {
15618                Err(err) => {
15619                    if let common::Retry::After(d) = dlg.http_error(&err) {
15620                        sleep(d).await;
15621                        continue;
15622                    }
15623                    dlg.finished(false);
15624                    return Err(common::Error::HttpError(err));
15625                }
15626                Ok(res) => {
15627                    let (mut parts, body) = res.into_parts();
15628                    let mut body = common::Body::new(body);
15629                    if !parts.status.is_success() {
15630                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15631                        let error = serde_json::from_str(&common::to_string(&bytes));
15632                        let response = common::to_response(parts, bytes.into());
15633
15634                        if let common::Retry::After(d) =
15635                            dlg.http_failure(&response, error.as_ref().ok())
15636                        {
15637                            sleep(d).await;
15638                            continue;
15639                        }
15640
15641                        dlg.finished(false);
15642
15643                        return Err(match error {
15644                            Ok(value) => common::Error::BadRequest(value),
15645                            _ => common::Error::Failure(response),
15646                        });
15647                    }
15648                    let response = {
15649                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15650                        let encoded = common::to_string(&bytes);
15651                        match serde_json::from_str(&encoded) {
15652                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15653                            Err(error) => {
15654                                dlg.response_json_decode_error(&encoded, &error);
15655                                return Err(common::Error::JsonDecodeError(
15656                                    encoded.to_string(),
15657                                    error,
15658                                ));
15659                            }
15660                        }
15661                    };
15662
15663                    dlg.finished(true);
15664                    return Ok(response);
15665                }
15666            }
15667        }
15668    }
15669
15670    ///
15671    /// Sets the *request* property to the given value.
15672    ///
15673    /// Even though the property as already been set when instantiating this call,
15674    /// we provide this method for API completeness.
15675    pub fn request(mut self, new_value: FlightObject) -> FlightobjectPatchCall<'a, C> {
15676        self._request = new_value;
15677        self
15678    }
15679    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
15680    ///
15681    /// Sets the *resource id* path property to the given value.
15682    ///
15683    /// Even though the property as already been set when instantiating this call,
15684    /// we provide this method for API completeness.
15685    pub fn resource_id(mut self, new_value: &str) -> FlightobjectPatchCall<'a, C> {
15686        self._resource_id = new_value.to_string();
15687        self
15688    }
15689    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15690    /// while executing the actual API request.
15691    ///
15692    /// ````text
15693    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15694    /// ````
15695    ///
15696    /// Sets the *delegate* property to the given value.
15697    pub fn delegate(
15698        mut self,
15699        new_value: &'a mut dyn common::Delegate,
15700    ) -> FlightobjectPatchCall<'a, C> {
15701        self._delegate = Some(new_value);
15702        self
15703    }
15704
15705    /// Set any additional parameter of the query string used in the request.
15706    /// It should be used to set parameters which are not yet available through their own
15707    /// setters.
15708    ///
15709    /// Please note that this method must not be used to set any of the known parameters
15710    /// which have their own setter method. If done anyway, the request will fail.
15711    ///
15712    /// # Additional Parameters
15713    ///
15714    /// * *$.xgafv* (query-string) - V1 error format.
15715    /// * *access_token* (query-string) - OAuth access token.
15716    /// * *alt* (query-string) - Data format for response.
15717    /// * *callback* (query-string) - JSONP
15718    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15719    /// * *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.
15720    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15721    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15722    /// * *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.
15723    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15724    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15725    pub fn param<T>(mut self, name: T, value: T) -> FlightobjectPatchCall<'a, C>
15726    where
15727        T: AsRef<str>,
15728    {
15729        self._additional_params
15730            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15731        self
15732    }
15733
15734    /// Identifies the authorization scope for the method you are building.
15735    ///
15736    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15737    /// [`Scope::WalletObjectIssuer`].
15738    ///
15739    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15740    /// tokens for more than one scope.
15741    ///
15742    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15743    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15744    /// sufficient, a read-write scope will do as well.
15745    pub fn add_scope<St>(mut self, scope: St) -> FlightobjectPatchCall<'a, C>
15746    where
15747        St: AsRef<str>,
15748    {
15749        self._scopes.insert(String::from(scope.as_ref()));
15750        self
15751    }
15752    /// Identifies the authorization scope(s) for the method you are building.
15753    ///
15754    /// See [`Self::add_scope()`] for details.
15755    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectPatchCall<'a, C>
15756    where
15757        I: IntoIterator<Item = St>,
15758        St: AsRef<str>,
15759    {
15760        self._scopes
15761            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15762        self
15763    }
15764
15765    /// Removes all scopes, and no default scope will be used either.
15766    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15767    /// for details).
15768    pub fn clear_scopes(mut self) -> FlightobjectPatchCall<'a, C> {
15769        self._scopes.clear();
15770        self
15771    }
15772}
15773
15774/// Updates the flight object referenced by the given object ID.
15775///
15776/// A builder for the *update* method supported by a *flightobject* resource.
15777/// It is not used directly, but through a [`FlightobjectMethods`] instance.
15778///
15779/// # Example
15780///
15781/// Instantiate a resource method builder
15782///
15783/// ```test_harness,no_run
15784/// # extern crate hyper;
15785/// # extern crate hyper_rustls;
15786/// # extern crate google_walletobjects1 as walletobjects1;
15787/// use walletobjects1::api::FlightObject;
15788/// # async fn dox() {
15789/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15790///
15791/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15792/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15793/// #     .with_native_roots()
15794/// #     .unwrap()
15795/// #     .https_only()
15796/// #     .enable_http2()
15797/// #     .build();
15798///
15799/// # let executor = hyper_util::rt::TokioExecutor::new();
15800/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15801/// #     secret,
15802/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15803/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15804/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15805/// #     ),
15806/// # ).build().await.unwrap();
15807///
15808/// # let client = hyper_util::client::legacy::Client::builder(
15809/// #     hyper_util::rt::TokioExecutor::new()
15810/// # )
15811/// # .build(
15812/// #     hyper_rustls::HttpsConnectorBuilder::new()
15813/// #         .with_native_roots()
15814/// #         .unwrap()
15815/// #         .https_or_http()
15816/// #         .enable_http2()
15817/// #         .build()
15818/// # );
15819/// # let mut hub = Walletobjects::new(client, auth);
15820/// // As the method needs a request, you would usually fill it with the desired information
15821/// // into the respective structure. Some of the parts shown here might not be applicable !
15822/// // Values shown here are possibly random and not representative !
15823/// let mut req = FlightObject::default();
15824///
15825/// // You can configure optional parameters by calling the respective setters at will, and
15826/// // execute the final call using `doit()`.
15827/// // Values shown here are possibly random and not representative !
15828/// let result = hub.flightobject().update(req, "resourceId")
15829///              .doit().await;
15830/// # }
15831/// ```
15832pub struct FlightobjectUpdateCall<'a, C>
15833where
15834    C: 'a,
15835{
15836    hub: &'a Walletobjects<C>,
15837    _request: FlightObject,
15838    _resource_id: String,
15839    _delegate: Option<&'a mut dyn common::Delegate>,
15840    _additional_params: HashMap<String, String>,
15841    _scopes: BTreeSet<String>,
15842}
15843
15844impl<'a, C> common::CallBuilder for FlightobjectUpdateCall<'a, C> {}
15845
15846impl<'a, C> FlightobjectUpdateCall<'a, C>
15847where
15848    C: common::Connector,
15849{
15850    /// Perform the operation you have build so far.
15851    pub async fn doit(mut self) -> common::Result<(common::Response, FlightObject)> {
15852        use std::borrow::Cow;
15853        use std::io::{Read, Seek};
15854
15855        use common::{url::Params, ToParts};
15856        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15857
15858        let mut dd = common::DefaultDelegate;
15859        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15860        dlg.begin(common::MethodInfo {
15861            id: "walletobjects.flightobject.update",
15862            http_method: hyper::Method::PUT,
15863        });
15864
15865        for &field in ["alt", "resourceId"].iter() {
15866            if self._additional_params.contains_key(field) {
15867                dlg.finished(false);
15868                return Err(common::Error::FieldClash(field));
15869            }
15870        }
15871
15872        let mut params = Params::with_capacity(4 + self._additional_params.len());
15873        params.push("resourceId", self._resource_id);
15874
15875        params.extend(self._additional_params.iter());
15876
15877        params.push("alt", "json");
15878        let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject/{resourceId}";
15879        if self._scopes.is_empty() {
15880            self._scopes
15881                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
15882        }
15883
15884        #[allow(clippy::single_element_loop)]
15885        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
15886            url = params.uri_replacement(url, param_name, find_this, false);
15887        }
15888        {
15889            let to_remove = ["resourceId"];
15890            params.remove_params(&to_remove);
15891        }
15892
15893        let url = params.parse_with_url(&url);
15894
15895        let mut json_mime_type = mime::APPLICATION_JSON;
15896        let mut request_value_reader = {
15897            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15898            common::remove_json_null_values(&mut value);
15899            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15900            serde_json::to_writer(&mut dst, &value).unwrap();
15901            dst
15902        };
15903        let request_size = request_value_reader
15904            .seek(std::io::SeekFrom::End(0))
15905            .unwrap();
15906        request_value_reader
15907            .seek(std::io::SeekFrom::Start(0))
15908            .unwrap();
15909
15910        loop {
15911            let token = match self
15912                .hub
15913                .auth
15914                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15915                .await
15916            {
15917                Ok(token) => token,
15918                Err(e) => match dlg.token(e) {
15919                    Ok(token) => token,
15920                    Err(e) => {
15921                        dlg.finished(false);
15922                        return Err(common::Error::MissingToken(e));
15923                    }
15924                },
15925            };
15926            request_value_reader
15927                .seek(std::io::SeekFrom::Start(0))
15928                .unwrap();
15929            let mut req_result = {
15930                let client = &self.hub.client;
15931                dlg.pre_request();
15932                let mut req_builder = hyper::Request::builder()
15933                    .method(hyper::Method::PUT)
15934                    .uri(url.as_str())
15935                    .header(USER_AGENT, self.hub._user_agent.clone());
15936
15937                if let Some(token) = token.as_ref() {
15938                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15939                }
15940
15941                let request = req_builder
15942                    .header(CONTENT_TYPE, json_mime_type.to_string())
15943                    .header(CONTENT_LENGTH, request_size as u64)
15944                    .body(common::to_body(
15945                        request_value_reader.get_ref().clone().into(),
15946                    ));
15947
15948                client.request(request.unwrap()).await
15949            };
15950
15951            match req_result {
15952                Err(err) => {
15953                    if let common::Retry::After(d) = dlg.http_error(&err) {
15954                        sleep(d).await;
15955                        continue;
15956                    }
15957                    dlg.finished(false);
15958                    return Err(common::Error::HttpError(err));
15959                }
15960                Ok(res) => {
15961                    let (mut parts, body) = res.into_parts();
15962                    let mut body = common::Body::new(body);
15963                    if !parts.status.is_success() {
15964                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15965                        let error = serde_json::from_str(&common::to_string(&bytes));
15966                        let response = common::to_response(parts, bytes.into());
15967
15968                        if let common::Retry::After(d) =
15969                            dlg.http_failure(&response, error.as_ref().ok())
15970                        {
15971                            sleep(d).await;
15972                            continue;
15973                        }
15974
15975                        dlg.finished(false);
15976
15977                        return Err(match error {
15978                            Ok(value) => common::Error::BadRequest(value),
15979                            _ => common::Error::Failure(response),
15980                        });
15981                    }
15982                    let response = {
15983                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15984                        let encoded = common::to_string(&bytes);
15985                        match serde_json::from_str(&encoded) {
15986                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15987                            Err(error) => {
15988                                dlg.response_json_decode_error(&encoded, &error);
15989                                return Err(common::Error::JsonDecodeError(
15990                                    encoded.to_string(),
15991                                    error,
15992                                ));
15993                            }
15994                        }
15995                    };
15996
15997                    dlg.finished(true);
15998                    return Ok(response);
15999                }
16000            }
16001        }
16002    }
16003
16004    ///
16005    /// Sets the *request* property to the given value.
16006    ///
16007    /// Even though the property as already been set when instantiating this call,
16008    /// we provide this method for API completeness.
16009    pub fn request(mut self, new_value: FlightObject) -> FlightobjectUpdateCall<'a, C> {
16010        self._request = new_value;
16011        self
16012    }
16013    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
16014    ///
16015    /// Sets the *resource id* path property to the given value.
16016    ///
16017    /// Even though the property as already been set when instantiating this call,
16018    /// we provide this method for API completeness.
16019    pub fn resource_id(mut self, new_value: &str) -> FlightobjectUpdateCall<'a, C> {
16020        self._resource_id = new_value.to_string();
16021        self
16022    }
16023    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16024    /// while executing the actual API request.
16025    ///
16026    /// ````text
16027    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16028    /// ````
16029    ///
16030    /// Sets the *delegate* property to the given value.
16031    pub fn delegate(
16032        mut self,
16033        new_value: &'a mut dyn common::Delegate,
16034    ) -> FlightobjectUpdateCall<'a, C> {
16035        self._delegate = Some(new_value);
16036        self
16037    }
16038
16039    /// Set any additional parameter of the query string used in the request.
16040    /// It should be used to set parameters which are not yet available through their own
16041    /// setters.
16042    ///
16043    /// Please note that this method must not be used to set any of the known parameters
16044    /// which have their own setter method. If done anyway, the request will fail.
16045    ///
16046    /// # Additional Parameters
16047    ///
16048    /// * *$.xgafv* (query-string) - V1 error format.
16049    /// * *access_token* (query-string) - OAuth access token.
16050    /// * *alt* (query-string) - Data format for response.
16051    /// * *callback* (query-string) - JSONP
16052    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16053    /// * *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.
16054    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16055    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16056    /// * *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.
16057    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16058    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16059    pub fn param<T>(mut self, name: T, value: T) -> FlightobjectUpdateCall<'a, C>
16060    where
16061        T: AsRef<str>,
16062    {
16063        self._additional_params
16064            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16065        self
16066    }
16067
16068    /// Identifies the authorization scope for the method you are building.
16069    ///
16070    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16071    /// [`Scope::WalletObjectIssuer`].
16072    ///
16073    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16074    /// tokens for more than one scope.
16075    ///
16076    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16077    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16078    /// sufficient, a read-write scope will do as well.
16079    pub fn add_scope<St>(mut self, scope: St) -> FlightobjectUpdateCall<'a, C>
16080    where
16081        St: AsRef<str>,
16082    {
16083        self._scopes.insert(String::from(scope.as_ref()));
16084        self
16085    }
16086    /// Identifies the authorization scope(s) for the method you are building.
16087    ///
16088    /// See [`Self::add_scope()`] for details.
16089    pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectUpdateCall<'a, C>
16090    where
16091        I: IntoIterator<Item = St>,
16092        St: AsRef<str>,
16093    {
16094        self._scopes
16095            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16096        self
16097    }
16098
16099    /// Removes all scopes, and no default scope will be used either.
16100    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16101    /// for details).
16102    pub fn clear_scopes(mut self) -> FlightobjectUpdateCall<'a, C> {
16103        self._scopes.clear();
16104        self
16105    }
16106}
16107
16108/// Adds a message to the generic class referenced by the given class ID.
16109///
16110/// A builder for the *addmessage* method supported by a *genericclas* resource.
16111/// It is not used directly, but through a [`GenericclasMethods`] instance.
16112///
16113/// # Example
16114///
16115/// Instantiate a resource method builder
16116///
16117/// ```test_harness,no_run
16118/// # extern crate hyper;
16119/// # extern crate hyper_rustls;
16120/// # extern crate google_walletobjects1 as walletobjects1;
16121/// use walletobjects1::api::AddMessageRequest;
16122/// # async fn dox() {
16123/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16124///
16125/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16126/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16127/// #     .with_native_roots()
16128/// #     .unwrap()
16129/// #     .https_only()
16130/// #     .enable_http2()
16131/// #     .build();
16132///
16133/// # let executor = hyper_util::rt::TokioExecutor::new();
16134/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16135/// #     secret,
16136/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16137/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16138/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16139/// #     ),
16140/// # ).build().await.unwrap();
16141///
16142/// # let client = hyper_util::client::legacy::Client::builder(
16143/// #     hyper_util::rt::TokioExecutor::new()
16144/// # )
16145/// # .build(
16146/// #     hyper_rustls::HttpsConnectorBuilder::new()
16147/// #         .with_native_roots()
16148/// #         .unwrap()
16149/// #         .https_or_http()
16150/// #         .enable_http2()
16151/// #         .build()
16152/// # );
16153/// # let mut hub = Walletobjects::new(client, auth);
16154/// // As the method needs a request, you would usually fill it with the desired information
16155/// // into the respective structure. Some of the parts shown here might not be applicable !
16156/// // Values shown here are possibly random and not representative !
16157/// let mut req = AddMessageRequest::default();
16158///
16159/// // You can configure optional parameters by calling the respective setters at will, and
16160/// // execute the final call using `doit()`.
16161/// // Values shown here are possibly random and not representative !
16162/// let result = hub.genericclass().addmessage(req, "resourceId")
16163///              .doit().await;
16164/// # }
16165/// ```
16166pub struct GenericclasAddmessageCall<'a, C>
16167where
16168    C: 'a,
16169{
16170    hub: &'a Walletobjects<C>,
16171    _request: AddMessageRequest,
16172    _resource_id: String,
16173    _delegate: Option<&'a mut dyn common::Delegate>,
16174    _additional_params: HashMap<String, String>,
16175    _scopes: BTreeSet<String>,
16176}
16177
16178impl<'a, C> common::CallBuilder for GenericclasAddmessageCall<'a, C> {}
16179
16180impl<'a, C> GenericclasAddmessageCall<'a, C>
16181where
16182    C: common::Connector,
16183{
16184    /// Perform the operation you have build so far.
16185    pub async fn doit(
16186        mut self,
16187    ) -> common::Result<(common::Response, GenericClassAddMessageResponse)> {
16188        use std::borrow::Cow;
16189        use std::io::{Read, Seek};
16190
16191        use common::{url::Params, ToParts};
16192        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16193
16194        let mut dd = common::DefaultDelegate;
16195        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16196        dlg.begin(common::MethodInfo {
16197            id: "walletobjects.genericclass.addmessage",
16198            http_method: hyper::Method::POST,
16199        });
16200
16201        for &field in ["alt", "resourceId"].iter() {
16202            if self._additional_params.contains_key(field) {
16203                dlg.finished(false);
16204                return Err(common::Error::FieldClash(field));
16205            }
16206        }
16207
16208        let mut params = Params::with_capacity(4 + self._additional_params.len());
16209        params.push("resourceId", self._resource_id);
16210
16211        params.extend(self._additional_params.iter());
16212
16213        params.push("alt", "json");
16214        let mut url =
16215            self.hub._base_url.clone() + "walletobjects/v1/genericClass/{resourceId}/addMessage";
16216        if self._scopes.is_empty() {
16217            self._scopes
16218                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
16219        }
16220
16221        #[allow(clippy::single_element_loop)]
16222        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
16223            url = params.uri_replacement(url, param_name, find_this, false);
16224        }
16225        {
16226            let to_remove = ["resourceId"];
16227            params.remove_params(&to_remove);
16228        }
16229
16230        let url = params.parse_with_url(&url);
16231
16232        let mut json_mime_type = mime::APPLICATION_JSON;
16233        let mut request_value_reader = {
16234            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16235            common::remove_json_null_values(&mut value);
16236            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16237            serde_json::to_writer(&mut dst, &value).unwrap();
16238            dst
16239        };
16240        let request_size = request_value_reader
16241            .seek(std::io::SeekFrom::End(0))
16242            .unwrap();
16243        request_value_reader
16244            .seek(std::io::SeekFrom::Start(0))
16245            .unwrap();
16246
16247        loop {
16248            let token = match self
16249                .hub
16250                .auth
16251                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16252                .await
16253            {
16254                Ok(token) => token,
16255                Err(e) => match dlg.token(e) {
16256                    Ok(token) => token,
16257                    Err(e) => {
16258                        dlg.finished(false);
16259                        return Err(common::Error::MissingToken(e));
16260                    }
16261                },
16262            };
16263            request_value_reader
16264                .seek(std::io::SeekFrom::Start(0))
16265                .unwrap();
16266            let mut req_result = {
16267                let client = &self.hub.client;
16268                dlg.pre_request();
16269                let mut req_builder = hyper::Request::builder()
16270                    .method(hyper::Method::POST)
16271                    .uri(url.as_str())
16272                    .header(USER_AGENT, self.hub._user_agent.clone());
16273
16274                if let Some(token) = token.as_ref() {
16275                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16276                }
16277
16278                let request = req_builder
16279                    .header(CONTENT_TYPE, json_mime_type.to_string())
16280                    .header(CONTENT_LENGTH, request_size as u64)
16281                    .body(common::to_body(
16282                        request_value_reader.get_ref().clone().into(),
16283                    ));
16284
16285                client.request(request.unwrap()).await
16286            };
16287
16288            match req_result {
16289                Err(err) => {
16290                    if let common::Retry::After(d) = dlg.http_error(&err) {
16291                        sleep(d).await;
16292                        continue;
16293                    }
16294                    dlg.finished(false);
16295                    return Err(common::Error::HttpError(err));
16296                }
16297                Ok(res) => {
16298                    let (mut parts, body) = res.into_parts();
16299                    let mut body = common::Body::new(body);
16300                    if !parts.status.is_success() {
16301                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16302                        let error = serde_json::from_str(&common::to_string(&bytes));
16303                        let response = common::to_response(parts, bytes.into());
16304
16305                        if let common::Retry::After(d) =
16306                            dlg.http_failure(&response, error.as_ref().ok())
16307                        {
16308                            sleep(d).await;
16309                            continue;
16310                        }
16311
16312                        dlg.finished(false);
16313
16314                        return Err(match error {
16315                            Ok(value) => common::Error::BadRequest(value),
16316                            _ => common::Error::Failure(response),
16317                        });
16318                    }
16319                    let response = {
16320                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16321                        let encoded = common::to_string(&bytes);
16322                        match serde_json::from_str(&encoded) {
16323                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16324                            Err(error) => {
16325                                dlg.response_json_decode_error(&encoded, &error);
16326                                return Err(common::Error::JsonDecodeError(
16327                                    encoded.to_string(),
16328                                    error,
16329                                ));
16330                            }
16331                        }
16332                    };
16333
16334                    dlg.finished(true);
16335                    return Ok(response);
16336                }
16337            }
16338        }
16339    }
16340
16341    ///
16342    /// Sets the *request* property to the given value.
16343    ///
16344    /// Even though the property as already been set when instantiating this call,
16345    /// we provide this method for API completeness.
16346    pub fn request(mut self, new_value: AddMessageRequest) -> GenericclasAddmessageCall<'a, C> {
16347        self._request = new_value;
16348        self
16349    }
16350    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
16351    ///
16352    /// Sets the *resource id* path property to the given value.
16353    ///
16354    /// Even though the property as already been set when instantiating this call,
16355    /// we provide this method for API completeness.
16356    pub fn resource_id(mut self, new_value: &str) -> GenericclasAddmessageCall<'a, C> {
16357        self._resource_id = new_value.to_string();
16358        self
16359    }
16360    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16361    /// while executing the actual API request.
16362    ///
16363    /// ````text
16364    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16365    /// ````
16366    ///
16367    /// Sets the *delegate* property to the given value.
16368    pub fn delegate(
16369        mut self,
16370        new_value: &'a mut dyn common::Delegate,
16371    ) -> GenericclasAddmessageCall<'a, C> {
16372        self._delegate = Some(new_value);
16373        self
16374    }
16375
16376    /// Set any additional parameter of the query string used in the request.
16377    /// It should be used to set parameters which are not yet available through their own
16378    /// setters.
16379    ///
16380    /// Please note that this method must not be used to set any of the known parameters
16381    /// which have their own setter method. If done anyway, the request will fail.
16382    ///
16383    /// # Additional Parameters
16384    ///
16385    /// * *$.xgafv* (query-string) - V1 error format.
16386    /// * *access_token* (query-string) - OAuth access token.
16387    /// * *alt* (query-string) - Data format for response.
16388    /// * *callback* (query-string) - JSONP
16389    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16390    /// * *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.
16391    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16392    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16393    /// * *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.
16394    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16395    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16396    pub fn param<T>(mut self, name: T, value: T) -> GenericclasAddmessageCall<'a, C>
16397    where
16398        T: AsRef<str>,
16399    {
16400        self._additional_params
16401            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16402        self
16403    }
16404
16405    /// Identifies the authorization scope for the method you are building.
16406    ///
16407    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16408    /// [`Scope::WalletObjectIssuer`].
16409    ///
16410    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16411    /// tokens for more than one scope.
16412    ///
16413    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16414    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16415    /// sufficient, a read-write scope will do as well.
16416    pub fn add_scope<St>(mut self, scope: St) -> GenericclasAddmessageCall<'a, C>
16417    where
16418        St: AsRef<str>,
16419    {
16420        self._scopes.insert(String::from(scope.as_ref()));
16421        self
16422    }
16423    /// Identifies the authorization scope(s) for the method you are building.
16424    ///
16425    /// See [`Self::add_scope()`] for details.
16426    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasAddmessageCall<'a, C>
16427    where
16428        I: IntoIterator<Item = St>,
16429        St: AsRef<str>,
16430    {
16431        self._scopes
16432            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16433        self
16434    }
16435
16436    /// Removes all scopes, and no default scope will be used either.
16437    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16438    /// for details).
16439    pub fn clear_scopes(mut self) -> GenericclasAddmessageCall<'a, C> {
16440        self._scopes.clear();
16441        self
16442    }
16443}
16444
16445/// Returns the generic class with the given class ID.
16446///
16447/// A builder for the *get* method supported by a *genericclas* resource.
16448/// It is not used directly, but through a [`GenericclasMethods`] instance.
16449///
16450/// # Example
16451///
16452/// Instantiate a resource method builder
16453///
16454/// ```test_harness,no_run
16455/// # extern crate hyper;
16456/// # extern crate hyper_rustls;
16457/// # extern crate google_walletobjects1 as walletobjects1;
16458/// # async fn dox() {
16459/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16460///
16461/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16462/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16463/// #     .with_native_roots()
16464/// #     .unwrap()
16465/// #     .https_only()
16466/// #     .enable_http2()
16467/// #     .build();
16468///
16469/// # let executor = hyper_util::rt::TokioExecutor::new();
16470/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16471/// #     secret,
16472/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16473/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16474/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16475/// #     ),
16476/// # ).build().await.unwrap();
16477///
16478/// # let client = hyper_util::client::legacy::Client::builder(
16479/// #     hyper_util::rt::TokioExecutor::new()
16480/// # )
16481/// # .build(
16482/// #     hyper_rustls::HttpsConnectorBuilder::new()
16483/// #         .with_native_roots()
16484/// #         .unwrap()
16485/// #         .https_or_http()
16486/// #         .enable_http2()
16487/// #         .build()
16488/// # );
16489/// # let mut hub = Walletobjects::new(client, auth);
16490/// // You can configure optional parameters by calling the respective setters at will, and
16491/// // execute the final call using `doit()`.
16492/// // Values shown here are possibly random and not representative !
16493/// let result = hub.genericclass().get("resourceId")
16494///              .doit().await;
16495/// # }
16496/// ```
16497pub struct GenericclasGetCall<'a, C>
16498where
16499    C: 'a,
16500{
16501    hub: &'a Walletobjects<C>,
16502    _resource_id: String,
16503    _delegate: Option<&'a mut dyn common::Delegate>,
16504    _additional_params: HashMap<String, String>,
16505    _scopes: BTreeSet<String>,
16506}
16507
16508impl<'a, C> common::CallBuilder for GenericclasGetCall<'a, C> {}
16509
16510impl<'a, C> GenericclasGetCall<'a, C>
16511where
16512    C: common::Connector,
16513{
16514    /// Perform the operation you have build so far.
16515    pub async fn doit(mut self) -> common::Result<(common::Response, GenericClass)> {
16516        use std::borrow::Cow;
16517        use std::io::{Read, Seek};
16518
16519        use common::{url::Params, ToParts};
16520        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16521
16522        let mut dd = common::DefaultDelegate;
16523        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16524        dlg.begin(common::MethodInfo {
16525            id: "walletobjects.genericclass.get",
16526            http_method: hyper::Method::GET,
16527        });
16528
16529        for &field in ["alt", "resourceId"].iter() {
16530            if self._additional_params.contains_key(field) {
16531                dlg.finished(false);
16532                return Err(common::Error::FieldClash(field));
16533            }
16534        }
16535
16536        let mut params = Params::with_capacity(3 + self._additional_params.len());
16537        params.push("resourceId", self._resource_id);
16538
16539        params.extend(self._additional_params.iter());
16540
16541        params.push("alt", "json");
16542        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass/{resourceId}";
16543        if self._scopes.is_empty() {
16544            self._scopes
16545                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
16546        }
16547
16548        #[allow(clippy::single_element_loop)]
16549        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
16550            url = params.uri_replacement(url, param_name, find_this, false);
16551        }
16552        {
16553            let to_remove = ["resourceId"];
16554            params.remove_params(&to_remove);
16555        }
16556
16557        let url = params.parse_with_url(&url);
16558
16559        loop {
16560            let token = match self
16561                .hub
16562                .auth
16563                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16564                .await
16565            {
16566                Ok(token) => token,
16567                Err(e) => match dlg.token(e) {
16568                    Ok(token) => token,
16569                    Err(e) => {
16570                        dlg.finished(false);
16571                        return Err(common::Error::MissingToken(e));
16572                    }
16573                },
16574            };
16575            let mut req_result = {
16576                let client = &self.hub.client;
16577                dlg.pre_request();
16578                let mut req_builder = hyper::Request::builder()
16579                    .method(hyper::Method::GET)
16580                    .uri(url.as_str())
16581                    .header(USER_AGENT, self.hub._user_agent.clone());
16582
16583                if let Some(token) = token.as_ref() {
16584                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16585                }
16586
16587                let request = req_builder
16588                    .header(CONTENT_LENGTH, 0_u64)
16589                    .body(common::to_body::<String>(None));
16590
16591                client.request(request.unwrap()).await
16592            };
16593
16594            match req_result {
16595                Err(err) => {
16596                    if let common::Retry::After(d) = dlg.http_error(&err) {
16597                        sleep(d).await;
16598                        continue;
16599                    }
16600                    dlg.finished(false);
16601                    return Err(common::Error::HttpError(err));
16602                }
16603                Ok(res) => {
16604                    let (mut parts, body) = res.into_parts();
16605                    let mut body = common::Body::new(body);
16606                    if !parts.status.is_success() {
16607                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16608                        let error = serde_json::from_str(&common::to_string(&bytes));
16609                        let response = common::to_response(parts, bytes.into());
16610
16611                        if let common::Retry::After(d) =
16612                            dlg.http_failure(&response, error.as_ref().ok())
16613                        {
16614                            sleep(d).await;
16615                            continue;
16616                        }
16617
16618                        dlg.finished(false);
16619
16620                        return Err(match error {
16621                            Ok(value) => common::Error::BadRequest(value),
16622                            _ => common::Error::Failure(response),
16623                        });
16624                    }
16625                    let response = {
16626                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16627                        let encoded = common::to_string(&bytes);
16628                        match serde_json::from_str(&encoded) {
16629                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16630                            Err(error) => {
16631                                dlg.response_json_decode_error(&encoded, &error);
16632                                return Err(common::Error::JsonDecodeError(
16633                                    encoded.to_string(),
16634                                    error,
16635                                ));
16636                            }
16637                        }
16638                    };
16639
16640                    dlg.finished(true);
16641                    return Ok(response);
16642                }
16643            }
16644        }
16645    }
16646
16647    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
16648    ///
16649    /// Sets the *resource id* path property to the given value.
16650    ///
16651    /// Even though the property as already been set when instantiating this call,
16652    /// we provide this method for API completeness.
16653    pub fn resource_id(mut self, new_value: &str) -> GenericclasGetCall<'a, C> {
16654        self._resource_id = new_value.to_string();
16655        self
16656    }
16657    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16658    /// while executing the actual API request.
16659    ///
16660    /// ````text
16661    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16662    /// ````
16663    ///
16664    /// Sets the *delegate* property to the given value.
16665    pub fn delegate(
16666        mut self,
16667        new_value: &'a mut dyn common::Delegate,
16668    ) -> GenericclasGetCall<'a, C> {
16669        self._delegate = Some(new_value);
16670        self
16671    }
16672
16673    /// Set any additional parameter of the query string used in the request.
16674    /// It should be used to set parameters which are not yet available through their own
16675    /// setters.
16676    ///
16677    /// Please note that this method must not be used to set any of the known parameters
16678    /// which have their own setter method. If done anyway, the request will fail.
16679    ///
16680    /// # Additional Parameters
16681    ///
16682    /// * *$.xgafv* (query-string) - V1 error format.
16683    /// * *access_token* (query-string) - OAuth access token.
16684    /// * *alt* (query-string) - Data format for response.
16685    /// * *callback* (query-string) - JSONP
16686    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16687    /// * *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.
16688    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16689    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16690    /// * *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.
16691    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16692    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16693    pub fn param<T>(mut self, name: T, value: T) -> GenericclasGetCall<'a, C>
16694    where
16695        T: AsRef<str>,
16696    {
16697        self._additional_params
16698            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16699        self
16700    }
16701
16702    /// Identifies the authorization scope for the method you are building.
16703    ///
16704    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16705    /// [`Scope::WalletObjectIssuer`].
16706    ///
16707    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16708    /// tokens for more than one scope.
16709    ///
16710    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16711    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16712    /// sufficient, a read-write scope will do as well.
16713    pub fn add_scope<St>(mut self, scope: St) -> GenericclasGetCall<'a, C>
16714    where
16715        St: AsRef<str>,
16716    {
16717        self._scopes.insert(String::from(scope.as_ref()));
16718        self
16719    }
16720    /// Identifies the authorization scope(s) for the method you are building.
16721    ///
16722    /// See [`Self::add_scope()`] for details.
16723    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasGetCall<'a, C>
16724    where
16725        I: IntoIterator<Item = St>,
16726        St: AsRef<str>,
16727    {
16728        self._scopes
16729            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16730        self
16731    }
16732
16733    /// Removes all scopes, and no default scope will be used either.
16734    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16735    /// for details).
16736    pub fn clear_scopes(mut self) -> GenericclasGetCall<'a, C> {
16737        self._scopes.clear();
16738        self
16739    }
16740}
16741
16742/// Inserts a generic class with the given ID and properties.
16743///
16744/// A builder for the *insert* method supported by a *genericclas* resource.
16745/// It is not used directly, but through a [`GenericclasMethods`] instance.
16746///
16747/// # Example
16748///
16749/// Instantiate a resource method builder
16750///
16751/// ```test_harness,no_run
16752/// # extern crate hyper;
16753/// # extern crate hyper_rustls;
16754/// # extern crate google_walletobjects1 as walletobjects1;
16755/// use walletobjects1::api::GenericClass;
16756/// # async fn dox() {
16757/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16758///
16759/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16760/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16761/// #     .with_native_roots()
16762/// #     .unwrap()
16763/// #     .https_only()
16764/// #     .enable_http2()
16765/// #     .build();
16766///
16767/// # let executor = hyper_util::rt::TokioExecutor::new();
16768/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16769/// #     secret,
16770/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16771/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16772/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16773/// #     ),
16774/// # ).build().await.unwrap();
16775///
16776/// # let client = hyper_util::client::legacy::Client::builder(
16777/// #     hyper_util::rt::TokioExecutor::new()
16778/// # )
16779/// # .build(
16780/// #     hyper_rustls::HttpsConnectorBuilder::new()
16781/// #         .with_native_roots()
16782/// #         .unwrap()
16783/// #         .https_or_http()
16784/// #         .enable_http2()
16785/// #         .build()
16786/// # );
16787/// # let mut hub = Walletobjects::new(client, auth);
16788/// // As the method needs a request, you would usually fill it with the desired information
16789/// // into the respective structure. Some of the parts shown here might not be applicable !
16790/// // Values shown here are possibly random and not representative !
16791/// let mut req = GenericClass::default();
16792///
16793/// // You can configure optional parameters by calling the respective setters at will, and
16794/// // execute the final call using `doit()`.
16795/// // Values shown here are possibly random and not representative !
16796/// let result = hub.genericclass().insert(req)
16797///              .doit().await;
16798/// # }
16799/// ```
16800pub struct GenericclasInsertCall<'a, C>
16801where
16802    C: 'a,
16803{
16804    hub: &'a Walletobjects<C>,
16805    _request: GenericClass,
16806    _delegate: Option<&'a mut dyn common::Delegate>,
16807    _additional_params: HashMap<String, String>,
16808    _scopes: BTreeSet<String>,
16809}
16810
16811impl<'a, C> common::CallBuilder for GenericclasInsertCall<'a, C> {}
16812
16813impl<'a, C> GenericclasInsertCall<'a, C>
16814where
16815    C: common::Connector,
16816{
16817    /// Perform the operation you have build so far.
16818    pub async fn doit(mut self) -> common::Result<(common::Response, GenericClass)> {
16819        use std::borrow::Cow;
16820        use std::io::{Read, Seek};
16821
16822        use common::{url::Params, ToParts};
16823        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16824
16825        let mut dd = common::DefaultDelegate;
16826        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16827        dlg.begin(common::MethodInfo {
16828            id: "walletobjects.genericclass.insert",
16829            http_method: hyper::Method::POST,
16830        });
16831
16832        for &field in ["alt"].iter() {
16833            if self._additional_params.contains_key(field) {
16834                dlg.finished(false);
16835                return Err(common::Error::FieldClash(field));
16836            }
16837        }
16838
16839        let mut params = Params::with_capacity(3 + self._additional_params.len());
16840
16841        params.extend(self._additional_params.iter());
16842
16843        params.push("alt", "json");
16844        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass";
16845        if self._scopes.is_empty() {
16846            self._scopes
16847                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
16848        }
16849
16850        let url = params.parse_with_url(&url);
16851
16852        let mut json_mime_type = mime::APPLICATION_JSON;
16853        let mut request_value_reader = {
16854            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16855            common::remove_json_null_values(&mut value);
16856            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16857            serde_json::to_writer(&mut dst, &value).unwrap();
16858            dst
16859        };
16860        let request_size = request_value_reader
16861            .seek(std::io::SeekFrom::End(0))
16862            .unwrap();
16863        request_value_reader
16864            .seek(std::io::SeekFrom::Start(0))
16865            .unwrap();
16866
16867        loop {
16868            let token = match self
16869                .hub
16870                .auth
16871                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16872                .await
16873            {
16874                Ok(token) => token,
16875                Err(e) => match dlg.token(e) {
16876                    Ok(token) => token,
16877                    Err(e) => {
16878                        dlg.finished(false);
16879                        return Err(common::Error::MissingToken(e));
16880                    }
16881                },
16882            };
16883            request_value_reader
16884                .seek(std::io::SeekFrom::Start(0))
16885                .unwrap();
16886            let mut req_result = {
16887                let client = &self.hub.client;
16888                dlg.pre_request();
16889                let mut req_builder = hyper::Request::builder()
16890                    .method(hyper::Method::POST)
16891                    .uri(url.as_str())
16892                    .header(USER_AGENT, self.hub._user_agent.clone());
16893
16894                if let Some(token) = token.as_ref() {
16895                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16896                }
16897
16898                let request = req_builder
16899                    .header(CONTENT_TYPE, json_mime_type.to_string())
16900                    .header(CONTENT_LENGTH, request_size as u64)
16901                    .body(common::to_body(
16902                        request_value_reader.get_ref().clone().into(),
16903                    ));
16904
16905                client.request(request.unwrap()).await
16906            };
16907
16908            match req_result {
16909                Err(err) => {
16910                    if let common::Retry::After(d) = dlg.http_error(&err) {
16911                        sleep(d).await;
16912                        continue;
16913                    }
16914                    dlg.finished(false);
16915                    return Err(common::Error::HttpError(err));
16916                }
16917                Ok(res) => {
16918                    let (mut parts, body) = res.into_parts();
16919                    let mut body = common::Body::new(body);
16920                    if !parts.status.is_success() {
16921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16922                        let error = serde_json::from_str(&common::to_string(&bytes));
16923                        let response = common::to_response(parts, bytes.into());
16924
16925                        if let common::Retry::After(d) =
16926                            dlg.http_failure(&response, error.as_ref().ok())
16927                        {
16928                            sleep(d).await;
16929                            continue;
16930                        }
16931
16932                        dlg.finished(false);
16933
16934                        return Err(match error {
16935                            Ok(value) => common::Error::BadRequest(value),
16936                            _ => common::Error::Failure(response),
16937                        });
16938                    }
16939                    let response = {
16940                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16941                        let encoded = common::to_string(&bytes);
16942                        match serde_json::from_str(&encoded) {
16943                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16944                            Err(error) => {
16945                                dlg.response_json_decode_error(&encoded, &error);
16946                                return Err(common::Error::JsonDecodeError(
16947                                    encoded.to_string(),
16948                                    error,
16949                                ));
16950                            }
16951                        }
16952                    };
16953
16954                    dlg.finished(true);
16955                    return Ok(response);
16956                }
16957            }
16958        }
16959    }
16960
16961    ///
16962    /// Sets the *request* property to the given value.
16963    ///
16964    /// Even though the property as already been set when instantiating this call,
16965    /// we provide this method for API completeness.
16966    pub fn request(mut self, new_value: GenericClass) -> GenericclasInsertCall<'a, C> {
16967        self._request = new_value;
16968        self
16969    }
16970    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16971    /// while executing the actual API request.
16972    ///
16973    /// ````text
16974    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16975    /// ````
16976    ///
16977    /// Sets the *delegate* property to the given value.
16978    pub fn delegate(
16979        mut self,
16980        new_value: &'a mut dyn common::Delegate,
16981    ) -> GenericclasInsertCall<'a, C> {
16982        self._delegate = Some(new_value);
16983        self
16984    }
16985
16986    /// Set any additional parameter of the query string used in the request.
16987    /// It should be used to set parameters which are not yet available through their own
16988    /// setters.
16989    ///
16990    /// Please note that this method must not be used to set any of the known parameters
16991    /// which have their own setter method. If done anyway, the request will fail.
16992    ///
16993    /// # Additional Parameters
16994    ///
16995    /// * *$.xgafv* (query-string) - V1 error format.
16996    /// * *access_token* (query-string) - OAuth access token.
16997    /// * *alt* (query-string) - Data format for response.
16998    /// * *callback* (query-string) - JSONP
16999    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17000    /// * *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.
17001    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17002    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17003    /// * *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.
17004    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17005    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17006    pub fn param<T>(mut self, name: T, value: T) -> GenericclasInsertCall<'a, C>
17007    where
17008        T: AsRef<str>,
17009    {
17010        self._additional_params
17011            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17012        self
17013    }
17014
17015    /// Identifies the authorization scope for the method you are building.
17016    ///
17017    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17018    /// [`Scope::WalletObjectIssuer`].
17019    ///
17020    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17021    /// tokens for more than one scope.
17022    ///
17023    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17024    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17025    /// sufficient, a read-write scope will do as well.
17026    pub fn add_scope<St>(mut self, scope: St) -> GenericclasInsertCall<'a, C>
17027    where
17028        St: AsRef<str>,
17029    {
17030        self._scopes.insert(String::from(scope.as_ref()));
17031        self
17032    }
17033    /// Identifies the authorization scope(s) for the method you are building.
17034    ///
17035    /// See [`Self::add_scope()`] for details.
17036    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasInsertCall<'a, C>
17037    where
17038        I: IntoIterator<Item = St>,
17039        St: AsRef<str>,
17040    {
17041        self._scopes
17042            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17043        self
17044    }
17045
17046    /// Removes all scopes, and no default scope will be used either.
17047    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17048    /// for details).
17049    pub fn clear_scopes(mut self) -> GenericclasInsertCall<'a, C> {
17050        self._scopes.clear();
17051        self
17052    }
17053}
17054
17055/// Returns a list of all generic classes for a given issuer ID.
17056///
17057/// A builder for the *list* method supported by a *genericclas* resource.
17058/// It is not used directly, but through a [`GenericclasMethods`] instance.
17059///
17060/// # Example
17061///
17062/// Instantiate a resource method builder
17063///
17064/// ```test_harness,no_run
17065/// # extern crate hyper;
17066/// # extern crate hyper_rustls;
17067/// # extern crate google_walletobjects1 as walletobjects1;
17068/// # async fn dox() {
17069/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17070///
17071/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17072/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17073/// #     .with_native_roots()
17074/// #     .unwrap()
17075/// #     .https_only()
17076/// #     .enable_http2()
17077/// #     .build();
17078///
17079/// # let executor = hyper_util::rt::TokioExecutor::new();
17080/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17081/// #     secret,
17082/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17083/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17084/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17085/// #     ),
17086/// # ).build().await.unwrap();
17087///
17088/// # let client = hyper_util::client::legacy::Client::builder(
17089/// #     hyper_util::rt::TokioExecutor::new()
17090/// # )
17091/// # .build(
17092/// #     hyper_rustls::HttpsConnectorBuilder::new()
17093/// #         .with_native_roots()
17094/// #         .unwrap()
17095/// #         .https_or_http()
17096/// #         .enable_http2()
17097/// #         .build()
17098/// # );
17099/// # let mut hub = Walletobjects::new(client, auth);
17100/// // You can configure optional parameters by calling the respective setters at will, and
17101/// // execute the final call using `doit()`.
17102/// // Values shown here are possibly random and not representative !
17103/// let result = hub.genericclass().list()
17104///              .token("dolor")
17105///              .max_results(-56)
17106///              .issuer_id(-25)
17107///              .doit().await;
17108/// # }
17109/// ```
17110pub struct GenericclasListCall<'a, C>
17111where
17112    C: 'a,
17113{
17114    hub: &'a Walletobjects<C>,
17115    _token: Option<String>,
17116    _max_results: Option<i32>,
17117    _issuer_id: Option<i64>,
17118    _delegate: Option<&'a mut dyn common::Delegate>,
17119    _additional_params: HashMap<String, String>,
17120    _scopes: BTreeSet<String>,
17121}
17122
17123impl<'a, C> common::CallBuilder for GenericclasListCall<'a, C> {}
17124
17125impl<'a, C> GenericclasListCall<'a, C>
17126where
17127    C: common::Connector,
17128{
17129    /// Perform the operation you have build so far.
17130    pub async fn doit(mut self) -> common::Result<(common::Response, GenericClassListResponse)> {
17131        use std::borrow::Cow;
17132        use std::io::{Read, Seek};
17133
17134        use common::{url::Params, ToParts};
17135        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17136
17137        let mut dd = common::DefaultDelegate;
17138        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17139        dlg.begin(common::MethodInfo {
17140            id: "walletobjects.genericclass.list",
17141            http_method: hyper::Method::GET,
17142        });
17143
17144        for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
17145            if self._additional_params.contains_key(field) {
17146                dlg.finished(false);
17147                return Err(common::Error::FieldClash(field));
17148            }
17149        }
17150
17151        let mut params = Params::with_capacity(5 + self._additional_params.len());
17152        if let Some(value) = self._token.as_ref() {
17153            params.push("token", value);
17154        }
17155        if let Some(value) = self._max_results.as_ref() {
17156            params.push("maxResults", value.to_string());
17157        }
17158        if let Some(value) = self._issuer_id.as_ref() {
17159            params.push("issuerId", value.to_string());
17160        }
17161
17162        params.extend(self._additional_params.iter());
17163
17164        params.push("alt", "json");
17165        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass";
17166        if self._scopes.is_empty() {
17167            self._scopes
17168                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
17169        }
17170
17171        let url = params.parse_with_url(&url);
17172
17173        loop {
17174            let token = match self
17175                .hub
17176                .auth
17177                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17178                .await
17179            {
17180                Ok(token) => token,
17181                Err(e) => match dlg.token(e) {
17182                    Ok(token) => token,
17183                    Err(e) => {
17184                        dlg.finished(false);
17185                        return Err(common::Error::MissingToken(e));
17186                    }
17187                },
17188            };
17189            let mut req_result = {
17190                let client = &self.hub.client;
17191                dlg.pre_request();
17192                let mut req_builder = hyper::Request::builder()
17193                    .method(hyper::Method::GET)
17194                    .uri(url.as_str())
17195                    .header(USER_AGENT, self.hub._user_agent.clone());
17196
17197                if let Some(token) = token.as_ref() {
17198                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17199                }
17200
17201                let request = req_builder
17202                    .header(CONTENT_LENGTH, 0_u64)
17203                    .body(common::to_body::<String>(None));
17204
17205                client.request(request.unwrap()).await
17206            };
17207
17208            match req_result {
17209                Err(err) => {
17210                    if let common::Retry::After(d) = dlg.http_error(&err) {
17211                        sleep(d).await;
17212                        continue;
17213                    }
17214                    dlg.finished(false);
17215                    return Err(common::Error::HttpError(err));
17216                }
17217                Ok(res) => {
17218                    let (mut parts, body) = res.into_parts();
17219                    let mut body = common::Body::new(body);
17220                    if !parts.status.is_success() {
17221                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17222                        let error = serde_json::from_str(&common::to_string(&bytes));
17223                        let response = common::to_response(parts, bytes.into());
17224
17225                        if let common::Retry::After(d) =
17226                            dlg.http_failure(&response, error.as_ref().ok())
17227                        {
17228                            sleep(d).await;
17229                            continue;
17230                        }
17231
17232                        dlg.finished(false);
17233
17234                        return Err(match error {
17235                            Ok(value) => common::Error::BadRequest(value),
17236                            _ => common::Error::Failure(response),
17237                        });
17238                    }
17239                    let response = {
17240                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17241                        let encoded = common::to_string(&bytes);
17242                        match serde_json::from_str(&encoded) {
17243                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17244                            Err(error) => {
17245                                dlg.response_json_decode_error(&encoded, &error);
17246                                return Err(common::Error::JsonDecodeError(
17247                                    encoded.to_string(),
17248                                    error,
17249                                ));
17250                            }
17251                        }
17252                    };
17253
17254                    dlg.finished(true);
17255                    return Ok(response);
17256                }
17257            }
17258        }
17259    }
17260
17261    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` classes are available in a list. For example, if you have a list of 200 classes and you call list with `maxResults` set to 20, list will return the first 20 classes and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 classes.
17262    ///
17263    /// Sets the *token* query property to the given value.
17264    pub fn token(mut self, new_value: &str) -> GenericclasListCall<'a, C> {
17265        self._token = Some(new_value.to_string());
17266        self
17267    }
17268    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
17269    ///
17270    /// Sets the *max results* query property to the given value.
17271    pub fn max_results(mut self, new_value: i32) -> GenericclasListCall<'a, C> {
17272        self._max_results = Some(new_value);
17273        self
17274    }
17275    /// The ID of the issuer authorized to list classes.
17276    ///
17277    /// Sets the *issuer id* query property to the given value.
17278    pub fn issuer_id(mut self, new_value: i64) -> GenericclasListCall<'a, C> {
17279        self._issuer_id = Some(new_value);
17280        self
17281    }
17282    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17283    /// while executing the actual API request.
17284    ///
17285    /// ````text
17286    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17287    /// ````
17288    ///
17289    /// Sets the *delegate* property to the given value.
17290    pub fn delegate(
17291        mut self,
17292        new_value: &'a mut dyn common::Delegate,
17293    ) -> GenericclasListCall<'a, C> {
17294        self._delegate = Some(new_value);
17295        self
17296    }
17297
17298    /// Set any additional parameter of the query string used in the request.
17299    /// It should be used to set parameters which are not yet available through their own
17300    /// setters.
17301    ///
17302    /// Please note that this method must not be used to set any of the known parameters
17303    /// which have their own setter method. If done anyway, the request will fail.
17304    ///
17305    /// # Additional Parameters
17306    ///
17307    /// * *$.xgafv* (query-string) - V1 error format.
17308    /// * *access_token* (query-string) - OAuth access token.
17309    /// * *alt* (query-string) - Data format for response.
17310    /// * *callback* (query-string) - JSONP
17311    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17312    /// * *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.
17313    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17314    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17315    /// * *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.
17316    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17317    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17318    pub fn param<T>(mut self, name: T, value: T) -> GenericclasListCall<'a, C>
17319    where
17320        T: AsRef<str>,
17321    {
17322        self._additional_params
17323            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17324        self
17325    }
17326
17327    /// Identifies the authorization scope for the method you are building.
17328    ///
17329    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17330    /// [`Scope::WalletObjectIssuer`].
17331    ///
17332    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17333    /// tokens for more than one scope.
17334    ///
17335    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17336    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17337    /// sufficient, a read-write scope will do as well.
17338    pub fn add_scope<St>(mut self, scope: St) -> GenericclasListCall<'a, C>
17339    where
17340        St: AsRef<str>,
17341    {
17342        self._scopes.insert(String::from(scope.as_ref()));
17343        self
17344    }
17345    /// Identifies the authorization scope(s) for the method you are building.
17346    ///
17347    /// See [`Self::add_scope()`] for details.
17348    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasListCall<'a, C>
17349    where
17350        I: IntoIterator<Item = St>,
17351        St: AsRef<str>,
17352    {
17353        self._scopes
17354            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17355        self
17356    }
17357
17358    /// Removes all scopes, and no default scope will be used either.
17359    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17360    /// for details).
17361    pub fn clear_scopes(mut self) -> GenericclasListCall<'a, C> {
17362        self._scopes.clear();
17363        self
17364    }
17365}
17366
17367/// Updates the generic class referenced by the given class ID. This method supports patch semantics.
17368///
17369/// A builder for the *patch* method supported by a *genericclas* resource.
17370/// It is not used directly, but through a [`GenericclasMethods`] instance.
17371///
17372/// # Example
17373///
17374/// Instantiate a resource method builder
17375///
17376/// ```test_harness,no_run
17377/// # extern crate hyper;
17378/// # extern crate hyper_rustls;
17379/// # extern crate google_walletobjects1 as walletobjects1;
17380/// use walletobjects1::api::GenericClass;
17381/// # async fn dox() {
17382/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17383///
17384/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17385/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17386/// #     .with_native_roots()
17387/// #     .unwrap()
17388/// #     .https_only()
17389/// #     .enable_http2()
17390/// #     .build();
17391///
17392/// # let executor = hyper_util::rt::TokioExecutor::new();
17393/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17394/// #     secret,
17395/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17396/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17397/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17398/// #     ),
17399/// # ).build().await.unwrap();
17400///
17401/// # let client = hyper_util::client::legacy::Client::builder(
17402/// #     hyper_util::rt::TokioExecutor::new()
17403/// # )
17404/// # .build(
17405/// #     hyper_rustls::HttpsConnectorBuilder::new()
17406/// #         .with_native_roots()
17407/// #         .unwrap()
17408/// #         .https_or_http()
17409/// #         .enable_http2()
17410/// #         .build()
17411/// # );
17412/// # let mut hub = Walletobjects::new(client, auth);
17413/// // As the method needs a request, you would usually fill it with the desired information
17414/// // into the respective structure. Some of the parts shown here might not be applicable !
17415/// // Values shown here are possibly random and not representative !
17416/// let mut req = GenericClass::default();
17417///
17418/// // You can configure optional parameters by calling the respective setters at will, and
17419/// // execute the final call using `doit()`.
17420/// // Values shown here are possibly random and not representative !
17421/// let result = hub.genericclass().patch(req, "resourceId")
17422///              .doit().await;
17423/// # }
17424/// ```
17425pub struct GenericclasPatchCall<'a, C>
17426where
17427    C: 'a,
17428{
17429    hub: &'a Walletobjects<C>,
17430    _request: GenericClass,
17431    _resource_id: String,
17432    _delegate: Option<&'a mut dyn common::Delegate>,
17433    _additional_params: HashMap<String, String>,
17434    _scopes: BTreeSet<String>,
17435}
17436
17437impl<'a, C> common::CallBuilder for GenericclasPatchCall<'a, C> {}
17438
17439impl<'a, C> GenericclasPatchCall<'a, C>
17440where
17441    C: common::Connector,
17442{
17443    /// Perform the operation you have build so far.
17444    pub async fn doit(mut self) -> common::Result<(common::Response, GenericClass)> {
17445        use std::borrow::Cow;
17446        use std::io::{Read, Seek};
17447
17448        use common::{url::Params, ToParts};
17449        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17450
17451        let mut dd = common::DefaultDelegate;
17452        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17453        dlg.begin(common::MethodInfo {
17454            id: "walletobjects.genericclass.patch",
17455            http_method: hyper::Method::PATCH,
17456        });
17457
17458        for &field in ["alt", "resourceId"].iter() {
17459            if self._additional_params.contains_key(field) {
17460                dlg.finished(false);
17461                return Err(common::Error::FieldClash(field));
17462            }
17463        }
17464
17465        let mut params = Params::with_capacity(4 + self._additional_params.len());
17466        params.push("resourceId", self._resource_id);
17467
17468        params.extend(self._additional_params.iter());
17469
17470        params.push("alt", "json");
17471        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass/{resourceId}";
17472        if self._scopes.is_empty() {
17473            self._scopes
17474                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
17475        }
17476
17477        #[allow(clippy::single_element_loop)]
17478        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
17479            url = params.uri_replacement(url, param_name, find_this, false);
17480        }
17481        {
17482            let to_remove = ["resourceId"];
17483            params.remove_params(&to_remove);
17484        }
17485
17486        let url = params.parse_with_url(&url);
17487
17488        let mut json_mime_type = mime::APPLICATION_JSON;
17489        let mut request_value_reader = {
17490            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17491            common::remove_json_null_values(&mut value);
17492            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17493            serde_json::to_writer(&mut dst, &value).unwrap();
17494            dst
17495        };
17496        let request_size = request_value_reader
17497            .seek(std::io::SeekFrom::End(0))
17498            .unwrap();
17499        request_value_reader
17500            .seek(std::io::SeekFrom::Start(0))
17501            .unwrap();
17502
17503        loop {
17504            let token = match self
17505                .hub
17506                .auth
17507                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17508                .await
17509            {
17510                Ok(token) => token,
17511                Err(e) => match dlg.token(e) {
17512                    Ok(token) => token,
17513                    Err(e) => {
17514                        dlg.finished(false);
17515                        return Err(common::Error::MissingToken(e));
17516                    }
17517                },
17518            };
17519            request_value_reader
17520                .seek(std::io::SeekFrom::Start(0))
17521                .unwrap();
17522            let mut req_result = {
17523                let client = &self.hub.client;
17524                dlg.pre_request();
17525                let mut req_builder = hyper::Request::builder()
17526                    .method(hyper::Method::PATCH)
17527                    .uri(url.as_str())
17528                    .header(USER_AGENT, self.hub._user_agent.clone());
17529
17530                if let Some(token) = token.as_ref() {
17531                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17532                }
17533
17534                let request = req_builder
17535                    .header(CONTENT_TYPE, json_mime_type.to_string())
17536                    .header(CONTENT_LENGTH, request_size as u64)
17537                    .body(common::to_body(
17538                        request_value_reader.get_ref().clone().into(),
17539                    ));
17540
17541                client.request(request.unwrap()).await
17542            };
17543
17544            match req_result {
17545                Err(err) => {
17546                    if let common::Retry::After(d) = dlg.http_error(&err) {
17547                        sleep(d).await;
17548                        continue;
17549                    }
17550                    dlg.finished(false);
17551                    return Err(common::Error::HttpError(err));
17552                }
17553                Ok(res) => {
17554                    let (mut parts, body) = res.into_parts();
17555                    let mut body = common::Body::new(body);
17556                    if !parts.status.is_success() {
17557                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17558                        let error = serde_json::from_str(&common::to_string(&bytes));
17559                        let response = common::to_response(parts, bytes.into());
17560
17561                        if let common::Retry::After(d) =
17562                            dlg.http_failure(&response, error.as_ref().ok())
17563                        {
17564                            sleep(d).await;
17565                            continue;
17566                        }
17567
17568                        dlg.finished(false);
17569
17570                        return Err(match error {
17571                            Ok(value) => common::Error::BadRequest(value),
17572                            _ => common::Error::Failure(response),
17573                        });
17574                    }
17575                    let response = {
17576                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17577                        let encoded = common::to_string(&bytes);
17578                        match serde_json::from_str(&encoded) {
17579                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17580                            Err(error) => {
17581                                dlg.response_json_decode_error(&encoded, &error);
17582                                return Err(common::Error::JsonDecodeError(
17583                                    encoded.to_string(),
17584                                    error,
17585                                ));
17586                            }
17587                        }
17588                    };
17589
17590                    dlg.finished(true);
17591                    return Ok(response);
17592                }
17593            }
17594        }
17595    }
17596
17597    ///
17598    /// Sets the *request* property to the given value.
17599    ///
17600    /// Even though the property as already been set when instantiating this call,
17601    /// we provide this method for API completeness.
17602    pub fn request(mut self, new_value: GenericClass) -> GenericclasPatchCall<'a, C> {
17603        self._request = new_value;
17604        self
17605    }
17606    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
17607    ///
17608    /// Sets the *resource id* path property to the given value.
17609    ///
17610    /// Even though the property as already been set when instantiating this call,
17611    /// we provide this method for API completeness.
17612    pub fn resource_id(mut self, new_value: &str) -> GenericclasPatchCall<'a, C> {
17613        self._resource_id = new_value.to_string();
17614        self
17615    }
17616    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17617    /// while executing the actual API request.
17618    ///
17619    /// ````text
17620    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17621    /// ````
17622    ///
17623    /// Sets the *delegate* property to the given value.
17624    pub fn delegate(
17625        mut self,
17626        new_value: &'a mut dyn common::Delegate,
17627    ) -> GenericclasPatchCall<'a, C> {
17628        self._delegate = Some(new_value);
17629        self
17630    }
17631
17632    /// Set any additional parameter of the query string used in the request.
17633    /// It should be used to set parameters which are not yet available through their own
17634    /// setters.
17635    ///
17636    /// Please note that this method must not be used to set any of the known parameters
17637    /// which have their own setter method. If done anyway, the request will fail.
17638    ///
17639    /// # Additional Parameters
17640    ///
17641    /// * *$.xgafv* (query-string) - V1 error format.
17642    /// * *access_token* (query-string) - OAuth access token.
17643    /// * *alt* (query-string) - Data format for response.
17644    /// * *callback* (query-string) - JSONP
17645    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17646    /// * *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.
17647    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17648    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17649    /// * *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.
17650    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17651    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17652    pub fn param<T>(mut self, name: T, value: T) -> GenericclasPatchCall<'a, C>
17653    where
17654        T: AsRef<str>,
17655    {
17656        self._additional_params
17657            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17658        self
17659    }
17660
17661    /// Identifies the authorization scope for the method you are building.
17662    ///
17663    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17664    /// [`Scope::WalletObjectIssuer`].
17665    ///
17666    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17667    /// tokens for more than one scope.
17668    ///
17669    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17670    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17671    /// sufficient, a read-write scope will do as well.
17672    pub fn add_scope<St>(mut self, scope: St) -> GenericclasPatchCall<'a, C>
17673    where
17674        St: AsRef<str>,
17675    {
17676        self._scopes.insert(String::from(scope.as_ref()));
17677        self
17678    }
17679    /// Identifies the authorization scope(s) for the method you are building.
17680    ///
17681    /// See [`Self::add_scope()`] for details.
17682    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasPatchCall<'a, C>
17683    where
17684        I: IntoIterator<Item = St>,
17685        St: AsRef<str>,
17686    {
17687        self._scopes
17688            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17689        self
17690    }
17691
17692    /// Removes all scopes, and no default scope will be used either.
17693    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17694    /// for details).
17695    pub fn clear_scopes(mut self) -> GenericclasPatchCall<'a, C> {
17696        self._scopes.clear();
17697        self
17698    }
17699}
17700
17701/// Updates the Generic class referenced by the given class ID.
17702///
17703/// A builder for the *update* method supported by a *genericclas* resource.
17704/// It is not used directly, but through a [`GenericclasMethods`] instance.
17705///
17706/// # Example
17707///
17708/// Instantiate a resource method builder
17709///
17710/// ```test_harness,no_run
17711/// # extern crate hyper;
17712/// # extern crate hyper_rustls;
17713/// # extern crate google_walletobjects1 as walletobjects1;
17714/// use walletobjects1::api::GenericClass;
17715/// # async fn dox() {
17716/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17717///
17718/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17719/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17720/// #     .with_native_roots()
17721/// #     .unwrap()
17722/// #     .https_only()
17723/// #     .enable_http2()
17724/// #     .build();
17725///
17726/// # let executor = hyper_util::rt::TokioExecutor::new();
17727/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17728/// #     secret,
17729/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17730/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17731/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17732/// #     ),
17733/// # ).build().await.unwrap();
17734///
17735/// # let client = hyper_util::client::legacy::Client::builder(
17736/// #     hyper_util::rt::TokioExecutor::new()
17737/// # )
17738/// # .build(
17739/// #     hyper_rustls::HttpsConnectorBuilder::new()
17740/// #         .with_native_roots()
17741/// #         .unwrap()
17742/// #         .https_or_http()
17743/// #         .enable_http2()
17744/// #         .build()
17745/// # );
17746/// # let mut hub = Walletobjects::new(client, auth);
17747/// // As the method needs a request, you would usually fill it with the desired information
17748/// // into the respective structure. Some of the parts shown here might not be applicable !
17749/// // Values shown here are possibly random and not representative !
17750/// let mut req = GenericClass::default();
17751///
17752/// // You can configure optional parameters by calling the respective setters at will, and
17753/// // execute the final call using `doit()`.
17754/// // Values shown here are possibly random and not representative !
17755/// let result = hub.genericclass().update(req, "resourceId")
17756///              .doit().await;
17757/// # }
17758/// ```
17759pub struct GenericclasUpdateCall<'a, C>
17760where
17761    C: 'a,
17762{
17763    hub: &'a Walletobjects<C>,
17764    _request: GenericClass,
17765    _resource_id: String,
17766    _delegate: Option<&'a mut dyn common::Delegate>,
17767    _additional_params: HashMap<String, String>,
17768    _scopes: BTreeSet<String>,
17769}
17770
17771impl<'a, C> common::CallBuilder for GenericclasUpdateCall<'a, C> {}
17772
17773impl<'a, C> GenericclasUpdateCall<'a, C>
17774where
17775    C: common::Connector,
17776{
17777    /// Perform the operation you have build so far.
17778    pub async fn doit(mut self) -> common::Result<(common::Response, GenericClass)> {
17779        use std::borrow::Cow;
17780        use std::io::{Read, Seek};
17781
17782        use common::{url::Params, ToParts};
17783        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17784
17785        let mut dd = common::DefaultDelegate;
17786        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17787        dlg.begin(common::MethodInfo {
17788            id: "walletobjects.genericclass.update",
17789            http_method: hyper::Method::PUT,
17790        });
17791
17792        for &field in ["alt", "resourceId"].iter() {
17793            if self._additional_params.contains_key(field) {
17794                dlg.finished(false);
17795                return Err(common::Error::FieldClash(field));
17796            }
17797        }
17798
17799        let mut params = Params::with_capacity(4 + self._additional_params.len());
17800        params.push("resourceId", self._resource_id);
17801
17802        params.extend(self._additional_params.iter());
17803
17804        params.push("alt", "json");
17805        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass/{resourceId}";
17806        if self._scopes.is_empty() {
17807            self._scopes
17808                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
17809        }
17810
17811        #[allow(clippy::single_element_loop)]
17812        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
17813            url = params.uri_replacement(url, param_name, find_this, false);
17814        }
17815        {
17816            let to_remove = ["resourceId"];
17817            params.remove_params(&to_remove);
17818        }
17819
17820        let url = params.parse_with_url(&url);
17821
17822        let mut json_mime_type = mime::APPLICATION_JSON;
17823        let mut request_value_reader = {
17824            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17825            common::remove_json_null_values(&mut value);
17826            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17827            serde_json::to_writer(&mut dst, &value).unwrap();
17828            dst
17829        };
17830        let request_size = request_value_reader
17831            .seek(std::io::SeekFrom::End(0))
17832            .unwrap();
17833        request_value_reader
17834            .seek(std::io::SeekFrom::Start(0))
17835            .unwrap();
17836
17837        loop {
17838            let token = match self
17839                .hub
17840                .auth
17841                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17842                .await
17843            {
17844                Ok(token) => token,
17845                Err(e) => match dlg.token(e) {
17846                    Ok(token) => token,
17847                    Err(e) => {
17848                        dlg.finished(false);
17849                        return Err(common::Error::MissingToken(e));
17850                    }
17851                },
17852            };
17853            request_value_reader
17854                .seek(std::io::SeekFrom::Start(0))
17855                .unwrap();
17856            let mut req_result = {
17857                let client = &self.hub.client;
17858                dlg.pre_request();
17859                let mut req_builder = hyper::Request::builder()
17860                    .method(hyper::Method::PUT)
17861                    .uri(url.as_str())
17862                    .header(USER_AGENT, self.hub._user_agent.clone());
17863
17864                if let Some(token) = token.as_ref() {
17865                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17866                }
17867
17868                let request = req_builder
17869                    .header(CONTENT_TYPE, json_mime_type.to_string())
17870                    .header(CONTENT_LENGTH, request_size as u64)
17871                    .body(common::to_body(
17872                        request_value_reader.get_ref().clone().into(),
17873                    ));
17874
17875                client.request(request.unwrap()).await
17876            };
17877
17878            match req_result {
17879                Err(err) => {
17880                    if let common::Retry::After(d) = dlg.http_error(&err) {
17881                        sleep(d).await;
17882                        continue;
17883                    }
17884                    dlg.finished(false);
17885                    return Err(common::Error::HttpError(err));
17886                }
17887                Ok(res) => {
17888                    let (mut parts, body) = res.into_parts();
17889                    let mut body = common::Body::new(body);
17890                    if !parts.status.is_success() {
17891                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17892                        let error = serde_json::from_str(&common::to_string(&bytes));
17893                        let response = common::to_response(parts, bytes.into());
17894
17895                        if let common::Retry::After(d) =
17896                            dlg.http_failure(&response, error.as_ref().ok())
17897                        {
17898                            sleep(d).await;
17899                            continue;
17900                        }
17901
17902                        dlg.finished(false);
17903
17904                        return Err(match error {
17905                            Ok(value) => common::Error::BadRequest(value),
17906                            _ => common::Error::Failure(response),
17907                        });
17908                    }
17909                    let response = {
17910                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17911                        let encoded = common::to_string(&bytes);
17912                        match serde_json::from_str(&encoded) {
17913                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17914                            Err(error) => {
17915                                dlg.response_json_decode_error(&encoded, &error);
17916                                return Err(common::Error::JsonDecodeError(
17917                                    encoded.to_string(),
17918                                    error,
17919                                ));
17920                            }
17921                        }
17922                    };
17923
17924                    dlg.finished(true);
17925                    return Ok(response);
17926                }
17927            }
17928        }
17929    }
17930
17931    ///
17932    /// Sets the *request* property to the given value.
17933    ///
17934    /// Even though the property as already been set when instantiating this call,
17935    /// we provide this method for API completeness.
17936    pub fn request(mut self, new_value: GenericClass) -> GenericclasUpdateCall<'a, C> {
17937        self._request = new_value;
17938        self
17939    }
17940    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
17941    ///
17942    /// Sets the *resource id* path property to the given value.
17943    ///
17944    /// Even though the property as already been set when instantiating this call,
17945    /// we provide this method for API completeness.
17946    pub fn resource_id(mut self, new_value: &str) -> GenericclasUpdateCall<'a, C> {
17947        self._resource_id = new_value.to_string();
17948        self
17949    }
17950    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17951    /// while executing the actual API request.
17952    ///
17953    /// ````text
17954    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17955    /// ````
17956    ///
17957    /// Sets the *delegate* property to the given value.
17958    pub fn delegate(
17959        mut self,
17960        new_value: &'a mut dyn common::Delegate,
17961    ) -> GenericclasUpdateCall<'a, C> {
17962        self._delegate = Some(new_value);
17963        self
17964    }
17965
17966    /// Set any additional parameter of the query string used in the request.
17967    /// It should be used to set parameters which are not yet available through their own
17968    /// setters.
17969    ///
17970    /// Please note that this method must not be used to set any of the known parameters
17971    /// which have their own setter method. If done anyway, the request will fail.
17972    ///
17973    /// # Additional Parameters
17974    ///
17975    /// * *$.xgafv* (query-string) - V1 error format.
17976    /// * *access_token* (query-string) - OAuth access token.
17977    /// * *alt* (query-string) - Data format for response.
17978    /// * *callback* (query-string) - JSONP
17979    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17980    /// * *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.
17981    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17982    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17983    /// * *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.
17984    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17985    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17986    pub fn param<T>(mut self, name: T, value: T) -> GenericclasUpdateCall<'a, C>
17987    where
17988        T: AsRef<str>,
17989    {
17990        self._additional_params
17991            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17992        self
17993    }
17994
17995    /// Identifies the authorization scope for the method you are building.
17996    ///
17997    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17998    /// [`Scope::WalletObjectIssuer`].
17999    ///
18000    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18001    /// tokens for more than one scope.
18002    ///
18003    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18004    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18005    /// sufficient, a read-write scope will do as well.
18006    pub fn add_scope<St>(mut self, scope: St) -> GenericclasUpdateCall<'a, C>
18007    where
18008        St: AsRef<str>,
18009    {
18010        self._scopes.insert(String::from(scope.as_ref()));
18011        self
18012    }
18013    /// Identifies the authorization scope(s) for the method you are building.
18014    ///
18015    /// See [`Self::add_scope()`] for details.
18016    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasUpdateCall<'a, C>
18017    where
18018        I: IntoIterator<Item = St>,
18019        St: AsRef<str>,
18020    {
18021        self._scopes
18022            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18023        self
18024    }
18025
18026    /// Removes all scopes, and no default scope will be used either.
18027    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18028    /// for details).
18029    pub fn clear_scopes(mut self) -> GenericclasUpdateCall<'a, C> {
18030        self._scopes.clear();
18031        self
18032    }
18033}
18034
18035/// Adds a message to the generic object referenced by the given object ID.
18036///
18037/// A builder for the *addmessage* method supported by a *genericobject* resource.
18038/// It is not used directly, but through a [`GenericobjectMethods`] instance.
18039///
18040/// # Example
18041///
18042/// Instantiate a resource method builder
18043///
18044/// ```test_harness,no_run
18045/// # extern crate hyper;
18046/// # extern crate hyper_rustls;
18047/// # extern crate google_walletobjects1 as walletobjects1;
18048/// use walletobjects1::api::AddMessageRequest;
18049/// # async fn dox() {
18050/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18051///
18052/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18053/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18054/// #     .with_native_roots()
18055/// #     .unwrap()
18056/// #     .https_only()
18057/// #     .enable_http2()
18058/// #     .build();
18059///
18060/// # let executor = hyper_util::rt::TokioExecutor::new();
18061/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18062/// #     secret,
18063/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18064/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18065/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18066/// #     ),
18067/// # ).build().await.unwrap();
18068///
18069/// # let client = hyper_util::client::legacy::Client::builder(
18070/// #     hyper_util::rt::TokioExecutor::new()
18071/// # )
18072/// # .build(
18073/// #     hyper_rustls::HttpsConnectorBuilder::new()
18074/// #         .with_native_roots()
18075/// #         .unwrap()
18076/// #         .https_or_http()
18077/// #         .enable_http2()
18078/// #         .build()
18079/// # );
18080/// # let mut hub = Walletobjects::new(client, auth);
18081/// // As the method needs a request, you would usually fill it with the desired information
18082/// // into the respective structure. Some of the parts shown here might not be applicable !
18083/// // Values shown here are possibly random and not representative !
18084/// let mut req = AddMessageRequest::default();
18085///
18086/// // You can configure optional parameters by calling the respective setters at will, and
18087/// // execute the final call using `doit()`.
18088/// // Values shown here are possibly random and not representative !
18089/// let result = hub.genericobject().addmessage(req, "resourceId")
18090///              .doit().await;
18091/// # }
18092/// ```
18093pub struct GenericobjectAddmessageCall<'a, C>
18094where
18095    C: 'a,
18096{
18097    hub: &'a Walletobjects<C>,
18098    _request: AddMessageRequest,
18099    _resource_id: String,
18100    _delegate: Option<&'a mut dyn common::Delegate>,
18101    _additional_params: HashMap<String, String>,
18102    _scopes: BTreeSet<String>,
18103}
18104
18105impl<'a, C> common::CallBuilder for GenericobjectAddmessageCall<'a, C> {}
18106
18107impl<'a, C> GenericobjectAddmessageCall<'a, C>
18108where
18109    C: common::Connector,
18110{
18111    /// Perform the operation you have build so far.
18112    pub async fn doit(
18113        mut self,
18114    ) -> common::Result<(common::Response, GenericObjectAddMessageResponse)> {
18115        use std::borrow::Cow;
18116        use std::io::{Read, Seek};
18117
18118        use common::{url::Params, ToParts};
18119        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18120
18121        let mut dd = common::DefaultDelegate;
18122        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18123        dlg.begin(common::MethodInfo {
18124            id: "walletobjects.genericobject.addmessage",
18125            http_method: hyper::Method::POST,
18126        });
18127
18128        for &field in ["alt", "resourceId"].iter() {
18129            if self._additional_params.contains_key(field) {
18130                dlg.finished(false);
18131                return Err(common::Error::FieldClash(field));
18132            }
18133        }
18134
18135        let mut params = Params::with_capacity(4 + self._additional_params.len());
18136        params.push("resourceId", self._resource_id);
18137
18138        params.extend(self._additional_params.iter());
18139
18140        params.push("alt", "json");
18141        let mut url =
18142            self.hub._base_url.clone() + "walletobjects/v1/genericObject/{resourceId}/addMessage";
18143        if self._scopes.is_empty() {
18144            self._scopes
18145                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
18146        }
18147
18148        #[allow(clippy::single_element_loop)]
18149        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
18150            url = params.uri_replacement(url, param_name, find_this, false);
18151        }
18152        {
18153            let to_remove = ["resourceId"];
18154            params.remove_params(&to_remove);
18155        }
18156
18157        let url = params.parse_with_url(&url);
18158
18159        let mut json_mime_type = mime::APPLICATION_JSON;
18160        let mut request_value_reader = {
18161            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18162            common::remove_json_null_values(&mut value);
18163            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18164            serde_json::to_writer(&mut dst, &value).unwrap();
18165            dst
18166        };
18167        let request_size = request_value_reader
18168            .seek(std::io::SeekFrom::End(0))
18169            .unwrap();
18170        request_value_reader
18171            .seek(std::io::SeekFrom::Start(0))
18172            .unwrap();
18173
18174        loop {
18175            let token = match self
18176                .hub
18177                .auth
18178                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18179                .await
18180            {
18181                Ok(token) => token,
18182                Err(e) => match dlg.token(e) {
18183                    Ok(token) => token,
18184                    Err(e) => {
18185                        dlg.finished(false);
18186                        return Err(common::Error::MissingToken(e));
18187                    }
18188                },
18189            };
18190            request_value_reader
18191                .seek(std::io::SeekFrom::Start(0))
18192                .unwrap();
18193            let mut req_result = {
18194                let client = &self.hub.client;
18195                dlg.pre_request();
18196                let mut req_builder = hyper::Request::builder()
18197                    .method(hyper::Method::POST)
18198                    .uri(url.as_str())
18199                    .header(USER_AGENT, self.hub._user_agent.clone());
18200
18201                if let Some(token) = token.as_ref() {
18202                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18203                }
18204
18205                let request = req_builder
18206                    .header(CONTENT_TYPE, json_mime_type.to_string())
18207                    .header(CONTENT_LENGTH, request_size as u64)
18208                    .body(common::to_body(
18209                        request_value_reader.get_ref().clone().into(),
18210                    ));
18211
18212                client.request(request.unwrap()).await
18213            };
18214
18215            match req_result {
18216                Err(err) => {
18217                    if let common::Retry::After(d) = dlg.http_error(&err) {
18218                        sleep(d).await;
18219                        continue;
18220                    }
18221                    dlg.finished(false);
18222                    return Err(common::Error::HttpError(err));
18223                }
18224                Ok(res) => {
18225                    let (mut parts, body) = res.into_parts();
18226                    let mut body = common::Body::new(body);
18227                    if !parts.status.is_success() {
18228                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18229                        let error = serde_json::from_str(&common::to_string(&bytes));
18230                        let response = common::to_response(parts, bytes.into());
18231
18232                        if let common::Retry::After(d) =
18233                            dlg.http_failure(&response, error.as_ref().ok())
18234                        {
18235                            sleep(d).await;
18236                            continue;
18237                        }
18238
18239                        dlg.finished(false);
18240
18241                        return Err(match error {
18242                            Ok(value) => common::Error::BadRequest(value),
18243                            _ => common::Error::Failure(response),
18244                        });
18245                    }
18246                    let response = {
18247                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18248                        let encoded = common::to_string(&bytes);
18249                        match serde_json::from_str(&encoded) {
18250                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18251                            Err(error) => {
18252                                dlg.response_json_decode_error(&encoded, &error);
18253                                return Err(common::Error::JsonDecodeError(
18254                                    encoded.to_string(),
18255                                    error,
18256                                ));
18257                            }
18258                        }
18259                    };
18260
18261                    dlg.finished(true);
18262                    return Ok(response);
18263                }
18264            }
18265        }
18266    }
18267
18268    ///
18269    /// Sets the *request* property to the given value.
18270    ///
18271    /// Even though the property as already been set when instantiating this call,
18272    /// we provide this method for API completeness.
18273    pub fn request(mut self, new_value: AddMessageRequest) -> GenericobjectAddmessageCall<'a, C> {
18274        self._request = new_value;
18275        self
18276    }
18277    /// The unique identifier for an object. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
18278    ///
18279    /// Sets the *resource id* path property to the given value.
18280    ///
18281    /// Even though the property as already been set when instantiating this call,
18282    /// we provide this method for API completeness.
18283    pub fn resource_id(mut self, new_value: &str) -> GenericobjectAddmessageCall<'a, C> {
18284        self._resource_id = new_value.to_string();
18285        self
18286    }
18287    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18288    /// while executing the actual API request.
18289    ///
18290    /// ````text
18291    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18292    /// ````
18293    ///
18294    /// Sets the *delegate* property to the given value.
18295    pub fn delegate(
18296        mut self,
18297        new_value: &'a mut dyn common::Delegate,
18298    ) -> GenericobjectAddmessageCall<'a, C> {
18299        self._delegate = Some(new_value);
18300        self
18301    }
18302
18303    /// Set any additional parameter of the query string used in the request.
18304    /// It should be used to set parameters which are not yet available through their own
18305    /// setters.
18306    ///
18307    /// Please note that this method must not be used to set any of the known parameters
18308    /// which have their own setter method. If done anyway, the request will fail.
18309    ///
18310    /// # Additional Parameters
18311    ///
18312    /// * *$.xgafv* (query-string) - V1 error format.
18313    /// * *access_token* (query-string) - OAuth access token.
18314    /// * *alt* (query-string) - Data format for response.
18315    /// * *callback* (query-string) - JSONP
18316    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18317    /// * *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.
18318    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18319    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18320    /// * *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.
18321    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18322    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18323    pub fn param<T>(mut self, name: T, value: T) -> GenericobjectAddmessageCall<'a, C>
18324    where
18325        T: AsRef<str>,
18326    {
18327        self._additional_params
18328            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18329        self
18330    }
18331
18332    /// Identifies the authorization scope for the method you are building.
18333    ///
18334    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18335    /// [`Scope::WalletObjectIssuer`].
18336    ///
18337    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18338    /// tokens for more than one scope.
18339    ///
18340    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18341    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18342    /// sufficient, a read-write scope will do as well.
18343    pub fn add_scope<St>(mut self, scope: St) -> GenericobjectAddmessageCall<'a, C>
18344    where
18345        St: AsRef<str>,
18346    {
18347        self._scopes.insert(String::from(scope.as_ref()));
18348        self
18349    }
18350    /// Identifies the authorization scope(s) for the method you are building.
18351    ///
18352    /// See [`Self::add_scope()`] for details.
18353    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectAddmessageCall<'a, C>
18354    where
18355        I: IntoIterator<Item = St>,
18356        St: AsRef<str>,
18357    {
18358        self._scopes
18359            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18360        self
18361    }
18362
18363    /// Removes all scopes, and no default scope will be used either.
18364    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18365    /// for details).
18366    pub fn clear_scopes(mut self) -> GenericobjectAddmessageCall<'a, C> {
18367        self._scopes.clear();
18368        self
18369    }
18370}
18371
18372/// Returns the generic object with the given object ID.
18373///
18374/// A builder for the *get* method supported by a *genericobject* resource.
18375/// It is not used directly, but through a [`GenericobjectMethods`] instance.
18376///
18377/// # Example
18378///
18379/// Instantiate a resource method builder
18380///
18381/// ```test_harness,no_run
18382/// # extern crate hyper;
18383/// # extern crate hyper_rustls;
18384/// # extern crate google_walletobjects1 as walletobjects1;
18385/// # async fn dox() {
18386/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18387///
18388/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18389/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18390/// #     .with_native_roots()
18391/// #     .unwrap()
18392/// #     .https_only()
18393/// #     .enable_http2()
18394/// #     .build();
18395///
18396/// # let executor = hyper_util::rt::TokioExecutor::new();
18397/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18398/// #     secret,
18399/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18400/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18401/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18402/// #     ),
18403/// # ).build().await.unwrap();
18404///
18405/// # let client = hyper_util::client::legacy::Client::builder(
18406/// #     hyper_util::rt::TokioExecutor::new()
18407/// # )
18408/// # .build(
18409/// #     hyper_rustls::HttpsConnectorBuilder::new()
18410/// #         .with_native_roots()
18411/// #         .unwrap()
18412/// #         .https_or_http()
18413/// #         .enable_http2()
18414/// #         .build()
18415/// # );
18416/// # let mut hub = Walletobjects::new(client, auth);
18417/// // You can configure optional parameters by calling the respective setters at will, and
18418/// // execute the final call using `doit()`.
18419/// // Values shown here are possibly random and not representative !
18420/// let result = hub.genericobject().get("resourceId")
18421///              .doit().await;
18422/// # }
18423/// ```
18424pub struct GenericobjectGetCall<'a, C>
18425where
18426    C: 'a,
18427{
18428    hub: &'a Walletobjects<C>,
18429    _resource_id: String,
18430    _delegate: Option<&'a mut dyn common::Delegate>,
18431    _additional_params: HashMap<String, String>,
18432    _scopes: BTreeSet<String>,
18433}
18434
18435impl<'a, C> common::CallBuilder for GenericobjectGetCall<'a, C> {}
18436
18437impl<'a, C> GenericobjectGetCall<'a, C>
18438where
18439    C: common::Connector,
18440{
18441    /// Perform the operation you have build so far.
18442    pub async fn doit(mut self) -> common::Result<(common::Response, GenericObject)> {
18443        use std::borrow::Cow;
18444        use std::io::{Read, Seek};
18445
18446        use common::{url::Params, ToParts};
18447        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18448
18449        let mut dd = common::DefaultDelegate;
18450        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18451        dlg.begin(common::MethodInfo {
18452            id: "walletobjects.genericobject.get",
18453            http_method: hyper::Method::GET,
18454        });
18455
18456        for &field in ["alt", "resourceId"].iter() {
18457            if self._additional_params.contains_key(field) {
18458                dlg.finished(false);
18459                return Err(common::Error::FieldClash(field));
18460            }
18461        }
18462
18463        let mut params = Params::with_capacity(3 + self._additional_params.len());
18464        params.push("resourceId", self._resource_id);
18465
18466        params.extend(self._additional_params.iter());
18467
18468        params.push("alt", "json");
18469        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject/{resourceId}";
18470        if self._scopes.is_empty() {
18471            self._scopes
18472                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
18473        }
18474
18475        #[allow(clippy::single_element_loop)]
18476        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
18477            url = params.uri_replacement(url, param_name, find_this, false);
18478        }
18479        {
18480            let to_remove = ["resourceId"];
18481            params.remove_params(&to_remove);
18482        }
18483
18484        let url = params.parse_with_url(&url);
18485
18486        loop {
18487            let token = match self
18488                .hub
18489                .auth
18490                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18491                .await
18492            {
18493                Ok(token) => token,
18494                Err(e) => match dlg.token(e) {
18495                    Ok(token) => token,
18496                    Err(e) => {
18497                        dlg.finished(false);
18498                        return Err(common::Error::MissingToken(e));
18499                    }
18500                },
18501            };
18502            let mut req_result = {
18503                let client = &self.hub.client;
18504                dlg.pre_request();
18505                let mut req_builder = hyper::Request::builder()
18506                    .method(hyper::Method::GET)
18507                    .uri(url.as_str())
18508                    .header(USER_AGENT, self.hub._user_agent.clone());
18509
18510                if let Some(token) = token.as_ref() {
18511                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18512                }
18513
18514                let request = req_builder
18515                    .header(CONTENT_LENGTH, 0_u64)
18516                    .body(common::to_body::<String>(None));
18517
18518                client.request(request.unwrap()).await
18519            };
18520
18521            match req_result {
18522                Err(err) => {
18523                    if let common::Retry::After(d) = dlg.http_error(&err) {
18524                        sleep(d).await;
18525                        continue;
18526                    }
18527                    dlg.finished(false);
18528                    return Err(common::Error::HttpError(err));
18529                }
18530                Ok(res) => {
18531                    let (mut parts, body) = res.into_parts();
18532                    let mut body = common::Body::new(body);
18533                    if !parts.status.is_success() {
18534                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18535                        let error = serde_json::from_str(&common::to_string(&bytes));
18536                        let response = common::to_response(parts, bytes.into());
18537
18538                        if let common::Retry::After(d) =
18539                            dlg.http_failure(&response, error.as_ref().ok())
18540                        {
18541                            sleep(d).await;
18542                            continue;
18543                        }
18544
18545                        dlg.finished(false);
18546
18547                        return Err(match error {
18548                            Ok(value) => common::Error::BadRequest(value),
18549                            _ => common::Error::Failure(response),
18550                        });
18551                    }
18552                    let response = {
18553                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18554                        let encoded = common::to_string(&bytes);
18555                        match serde_json::from_str(&encoded) {
18556                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18557                            Err(error) => {
18558                                dlg.response_json_decode_error(&encoded, &error);
18559                                return Err(common::Error::JsonDecodeError(
18560                                    encoded.to_string(),
18561                                    error,
18562                                ));
18563                            }
18564                        }
18565                    };
18566
18567                    dlg.finished(true);
18568                    return Ok(response);
18569                }
18570            }
18571        }
18572    }
18573
18574    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
18575    ///
18576    /// Sets the *resource id* path property to the given value.
18577    ///
18578    /// Even though the property as already been set when instantiating this call,
18579    /// we provide this method for API completeness.
18580    pub fn resource_id(mut self, new_value: &str) -> GenericobjectGetCall<'a, C> {
18581        self._resource_id = new_value.to_string();
18582        self
18583    }
18584    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18585    /// while executing the actual API request.
18586    ///
18587    /// ````text
18588    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18589    /// ````
18590    ///
18591    /// Sets the *delegate* property to the given value.
18592    pub fn delegate(
18593        mut self,
18594        new_value: &'a mut dyn common::Delegate,
18595    ) -> GenericobjectGetCall<'a, C> {
18596        self._delegate = Some(new_value);
18597        self
18598    }
18599
18600    /// Set any additional parameter of the query string used in the request.
18601    /// It should be used to set parameters which are not yet available through their own
18602    /// setters.
18603    ///
18604    /// Please note that this method must not be used to set any of the known parameters
18605    /// which have their own setter method. If done anyway, the request will fail.
18606    ///
18607    /// # Additional Parameters
18608    ///
18609    /// * *$.xgafv* (query-string) - V1 error format.
18610    /// * *access_token* (query-string) - OAuth access token.
18611    /// * *alt* (query-string) - Data format for response.
18612    /// * *callback* (query-string) - JSONP
18613    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18614    /// * *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.
18615    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18616    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18617    /// * *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.
18618    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18619    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18620    pub fn param<T>(mut self, name: T, value: T) -> GenericobjectGetCall<'a, C>
18621    where
18622        T: AsRef<str>,
18623    {
18624        self._additional_params
18625            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18626        self
18627    }
18628
18629    /// Identifies the authorization scope for the method you are building.
18630    ///
18631    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18632    /// [`Scope::WalletObjectIssuer`].
18633    ///
18634    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18635    /// tokens for more than one scope.
18636    ///
18637    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18638    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18639    /// sufficient, a read-write scope will do as well.
18640    pub fn add_scope<St>(mut self, scope: St) -> GenericobjectGetCall<'a, C>
18641    where
18642        St: AsRef<str>,
18643    {
18644        self._scopes.insert(String::from(scope.as_ref()));
18645        self
18646    }
18647    /// Identifies the authorization scope(s) for the method you are building.
18648    ///
18649    /// See [`Self::add_scope()`] for details.
18650    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectGetCall<'a, C>
18651    where
18652        I: IntoIterator<Item = St>,
18653        St: AsRef<str>,
18654    {
18655        self._scopes
18656            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18657        self
18658    }
18659
18660    /// Removes all scopes, and no default scope will be used either.
18661    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18662    /// for details).
18663    pub fn clear_scopes(mut self) -> GenericobjectGetCall<'a, C> {
18664        self._scopes.clear();
18665        self
18666    }
18667}
18668
18669/// Inserts a generic object with the given ID and properties.
18670///
18671/// A builder for the *insert* method supported by a *genericobject* resource.
18672/// It is not used directly, but through a [`GenericobjectMethods`] instance.
18673///
18674/// # Example
18675///
18676/// Instantiate a resource method builder
18677///
18678/// ```test_harness,no_run
18679/// # extern crate hyper;
18680/// # extern crate hyper_rustls;
18681/// # extern crate google_walletobjects1 as walletobjects1;
18682/// use walletobjects1::api::GenericObject;
18683/// # async fn dox() {
18684/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18685///
18686/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18687/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18688/// #     .with_native_roots()
18689/// #     .unwrap()
18690/// #     .https_only()
18691/// #     .enable_http2()
18692/// #     .build();
18693///
18694/// # let executor = hyper_util::rt::TokioExecutor::new();
18695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18696/// #     secret,
18697/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18698/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18699/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18700/// #     ),
18701/// # ).build().await.unwrap();
18702///
18703/// # let client = hyper_util::client::legacy::Client::builder(
18704/// #     hyper_util::rt::TokioExecutor::new()
18705/// # )
18706/// # .build(
18707/// #     hyper_rustls::HttpsConnectorBuilder::new()
18708/// #         .with_native_roots()
18709/// #         .unwrap()
18710/// #         .https_or_http()
18711/// #         .enable_http2()
18712/// #         .build()
18713/// # );
18714/// # let mut hub = Walletobjects::new(client, auth);
18715/// // As the method needs a request, you would usually fill it with the desired information
18716/// // into the respective structure. Some of the parts shown here might not be applicable !
18717/// // Values shown here are possibly random and not representative !
18718/// let mut req = GenericObject::default();
18719///
18720/// // You can configure optional parameters by calling the respective setters at will, and
18721/// // execute the final call using `doit()`.
18722/// // Values shown here are possibly random and not representative !
18723/// let result = hub.genericobject().insert(req)
18724///              .doit().await;
18725/// # }
18726/// ```
18727pub struct GenericobjectInsertCall<'a, C>
18728where
18729    C: 'a,
18730{
18731    hub: &'a Walletobjects<C>,
18732    _request: GenericObject,
18733    _delegate: Option<&'a mut dyn common::Delegate>,
18734    _additional_params: HashMap<String, String>,
18735    _scopes: BTreeSet<String>,
18736}
18737
18738impl<'a, C> common::CallBuilder for GenericobjectInsertCall<'a, C> {}
18739
18740impl<'a, C> GenericobjectInsertCall<'a, C>
18741where
18742    C: common::Connector,
18743{
18744    /// Perform the operation you have build so far.
18745    pub async fn doit(mut self) -> common::Result<(common::Response, GenericObject)> {
18746        use std::borrow::Cow;
18747        use std::io::{Read, Seek};
18748
18749        use common::{url::Params, ToParts};
18750        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18751
18752        let mut dd = common::DefaultDelegate;
18753        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18754        dlg.begin(common::MethodInfo {
18755            id: "walletobjects.genericobject.insert",
18756            http_method: hyper::Method::POST,
18757        });
18758
18759        for &field in ["alt"].iter() {
18760            if self._additional_params.contains_key(field) {
18761                dlg.finished(false);
18762                return Err(common::Error::FieldClash(field));
18763            }
18764        }
18765
18766        let mut params = Params::with_capacity(3 + self._additional_params.len());
18767
18768        params.extend(self._additional_params.iter());
18769
18770        params.push("alt", "json");
18771        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject";
18772        if self._scopes.is_empty() {
18773            self._scopes
18774                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
18775        }
18776
18777        let url = params.parse_with_url(&url);
18778
18779        let mut json_mime_type = mime::APPLICATION_JSON;
18780        let mut request_value_reader = {
18781            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18782            common::remove_json_null_values(&mut value);
18783            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18784            serde_json::to_writer(&mut dst, &value).unwrap();
18785            dst
18786        };
18787        let request_size = request_value_reader
18788            .seek(std::io::SeekFrom::End(0))
18789            .unwrap();
18790        request_value_reader
18791            .seek(std::io::SeekFrom::Start(0))
18792            .unwrap();
18793
18794        loop {
18795            let token = match self
18796                .hub
18797                .auth
18798                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18799                .await
18800            {
18801                Ok(token) => token,
18802                Err(e) => match dlg.token(e) {
18803                    Ok(token) => token,
18804                    Err(e) => {
18805                        dlg.finished(false);
18806                        return Err(common::Error::MissingToken(e));
18807                    }
18808                },
18809            };
18810            request_value_reader
18811                .seek(std::io::SeekFrom::Start(0))
18812                .unwrap();
18813            let mut req_result = {
18814                let client = &self.hub.client;
18815                dlg.pre_request();
18816                let mut req_builder = hyper::Request::builder()
18817                    .method(hyper::Method::POST)
18818                    .uri(url.as_str())
18819                    .header(USER_AGENT, self.hub._user_agent.clone());
18820
18821                if let Some(token) = token.as_ref() {
18822                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18823                }
18824
18825                let request = req_builder
18826                    .header(CONTENT_TYPE, json_mime_type.to_string())
18827                    .header(CONTENT_LENGTH, request_size as u64)
18828                    .body(common::to_body(
18829                        request_value_reader.get_ref().clone().into(),
18830                    ));
18831
18832                client.request(request.unwrap()).await
18833            };
18834
18835            match req_result {
18836                Err(err) => {
18837                    if let common::Retry::After(d) = dlg.http_error(&err) {
18838                        sleep(d).await;
18839                        continue;
18840                    }
18841                    dlg.finished(false);
18842                    return Err(common::Error::HttpError(err));
18843                }
18844                Ok(res) => {
18845                    let (mut parts, body) = res.into_parts();
18846                    let mut body = common::Body::new(body);
18847                    if !parts.status.is_success() {
18848                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18849                        let error = serde_json::from_str(&common::to_string(&bytes));
18850                        let response = common::to_response(parts, bytes.into());
18851
18852                        if let common::Retry::After(d) =
18853                            dlg.http_failure(&response, error.as_ref().ok())
18854                        {
18855                            sleep(d).await;
18856                            continue;
18857                        }
18858
18859                        dlg.finished(false);
18860
18861                        return Err(match error {
18862                            Ok(value) => common::Error::BadRequest(value),
18863                            _ => common::Error::Failure(response),
18864                        });
18865                    }
18866                    let response = {
18867                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18868                        let encoded = common::to_string(&bytes);
18869                        match serde_json::from_str(&encoded) {
18870                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18871                            Err(error) => {
18872                                dlg.response_json_decode_error(&encoded, &error);
18873                                return Err(common::Error::JsonDecodeError(
18874                                    encoded.to_string(),
18875                                    error,
18876                                ));
18877                            }
18878                        }
18879                    };
18880
18881                    dlg.finished(true);
18882                    return Ok(response);
18883                }
18884            }
18885        }
18886    }
18887
18888    ///
18889    /// Sets the *request* property to the given value.
18890    ///
18891    /// Even though the property as already been set when instantiating this call,
18892    /// we provide this method for API completeness.
18893    pub fn request(mut self, new_value: GenericObject) -> GenericobjectInsertCall<'a, C> {
18894        self._request = new_value;
18895        self
18896    }
18897    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18898    /// while executing the actual API request.
18899    ///
18900    /// ````text
18901    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18902    /// ````
18903    ///
18904    /// Sets the *delegate* property to the given value.
18905    pub fn delegate(
18906        mut self,
18907        new_value: &'a mut dyn common::Delegate,
18908    ) -> GenericobjectInsertCall<'a, C> {
18909        self._delegate = Some(new_value);
18910        self
18911    }
18912
18913    /// Set any additional parameter of the query string used in the request.
18914    /// It should be used to set parameters which are not yet available through their own
18915    /// setters.
18916    ///
18917    /// Please note that this method must not be used to set any of the known parameters
18918    /// which have their own setter method. If done anyway, the request will fail.
18919    ///
18920    /// # Additional Parameters
18921    ///
18922    /// * *$.xgafv* (query-string) - V1 error format.
18923    /// * *access_token* (query-string) - OAuth access token.
18924    /// * *alt* (query-string) - Data format for response.
18925    /// * *callback* (query-string) - JSONP
18926    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18927    /// * *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.
18928    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18929    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18930    /// * *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.
18931    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18932    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18933    pub fn param<T>(mut self, name: T, value: T) -> GenericobjectInsertCall<'a, C>
18934    where
18935        T: AsRef<str>,
18936    {
18937        self._additional_params
18938            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18939        self
18940    }
18941
18942    /// Identifies the authorization scope for the method you are building.
18943    ///
18944    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18945    /// [`Scope::WalletObjectIssuer`].
18946    ///
18947    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18948    /// tokens for more than one scope.
18949    ///
18950    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18951    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18952    /// sufficient, a read-write scope will do as well.
18953    pub fn add_scope<St>(mut self, scope: St) -> GenericobjectInsertCall<'a, C>
18954    where
18955        St: AsRef<str>,
18956    {
18957        self._scopes.insert(String::from(scope.as_ref()));
18958        self
18959    }
18960    /// Identifies the authorization scope(s) for the method you are building.
18961    ///
18962    /// See [`Self::add_scope()`] for details.
18963    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectInsertCall<'a, C>
18964    where
18965        I: IntoIterator<Item = St>,
18966        St: AsRef<str>,
18967    {
18968        self._scopes
18969            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18970        self
18971    }
18972
18973    /// Removes all scopes, and no default scope will be used either.
18974    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18975    /// for details).
18976    pub fn clear_scopes(mut self) -> GenericobjectInsertCall<'a, C> {
18977        self._scopes.clear();
18978        self
18979    }
18980}
18981
18982/// Returns a list of all generic objects for a given issuer ID.
18983///
18984/// A builder for the *list* method supported by a *genericobject* resource.
18985/// It is not used directly, but through a [`GenericobjectMethods`] instance.
18986///
18987/// # Example
18988///
18989/// Instantiate a resource method builder
18990///
18991/// ```test_harness,no_run
18992/// # extern crate hyper;
18993/// # extern crate hyper_rustls;
18994/// # extern crate google_walletobjects1 as walletobjects1;
18995/// # async fn dox() {
18996/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18997///
18998/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18999/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19000/// #     .with_native_roots()
19001/// #     .unwrap()
19002/// #     .https_only()
19003/// #     .enable_http2()
19004/// #     .build();
19005///
19006/// # let executor = hyper_util::rt::TokioExecutor::new();
19007/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19008/// #     secret,
19009/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19010/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19011/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19012/// #     ),
19013/// # ).build().await.unwrap();
19014///
19015/// # let client = hyper_util::client::legacy::Client::builder(
19016/// #     hyper_util::rt::TokioExecutor::new()
19017/// # )
19018/// # .build(
19019/// #     hyper_rustls::HttpsConnectorBuilder::new()
19020/// #         .with_native_roots()
19021/// #         .unwrap()
19022/// #         .https_or_http()
19023/// #         .enable_http2()
19024/// #         .build()
19025/// # );
19026/// # let mut hub = Walletobjects::new(client, auth);
19027/// // You can configure optional parameters by calling the respective setters at will, and
19028/// // execute the final call using `doit()`.
19029/// // Values shown here are possibly random and not representative !
19030/// let result = hub.genericobject().list()
19031///              .token("no")
19032///              .max_results(-15)
19033///              .class_id("kasd")
19034///              .doit().await;
19035/// # }
19036/// ```
19037pub struct GenericobjectListCall<'a, C>
19038where
19039    C: 'a,
19040{
19041    hub: &'a Walletobjects<C>,
19042    _token: Option<String>,
19043    _max_results: Option<i32>,
19044    _class_id: Option<String>,
19045    _delegate: Option<&'a mut dyn common::Delegate>,
19046    _additional_params: HashMap<String, String>,
19047    _scopes: BTreeSet<String>,
19048}
19049
19050impl<'a, C> common::CallBuilder for GenericobjectListCall<'a, C> {}
19051
19052impl<'a, C> GenericobjectListCall<'a, C>
19053where
19054    C: common::Connector,
19055{
19056    /// Perform the operation you have build so far.
19057    pub async fn doit(mut self) -> common::Result<(common::Response, GenericObjectListResponse)> {
19058        use std::borrow::Cow;
19059        use std::io::{Read, Seek};
19060
19061        use common::{url::Params, ToParts};
19062        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19063
19064        let mut dd = common::DefaultDelegate;
19065        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19066        dlg.begin(common::MethodInfo {
19067            id: "walletobjects.genericobject.list",
19068            http_method: hyper::Method::GET,
19069        });
19070
19071        for &field in ["alt", "token", "maxResults", "classId"].iter() {
19072            if self._additional_params.contains_key(field) {
19073                dlg.finished(false);
19074                return Err(common::Error::FieldClash(field));
19075            }
19076        }
19077
19078        let mut params = Params::with_capacity(5 + self._additional_params.len());
19079        if let Some(value) = self._token.as_ref() {
19080            params.push("token", value);
19081        }
19082        if let Some(value) = self._max_results.as_ref() {
19083            params.push("maxResults", value.to_string());
19084        }
19085        if let Some(value) = self._class_id.as_ref() {
19086            params.push("classId", value);
19087        }
19088
19089        params.extend(self._additional_params.iter());
19090
19091        params.push("alt", "json");
19092        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject";
19093        if self._scopes.is_empty() {
19094            self._scopes
19095                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
19096        }
19097
19098        let url = params.parse_with_url(&url);
19099
19100        loop {
19101            let token = match self
19102                .hub
19103                .auth
19104                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19105                .await
19106            {
19107                Ok(token) => token,
19108                Err(e) => match dlg.token(e) {
19109                    Ok(token) => token,
19110                    Err(e) => {
19111                        dlg.finished(false);
19112                        return Err(common::Error::MissingToken(e));
19113                    }
19114                },
19115            };
19116            let mut req_result = {
19117                let client = &self.hub.client;
19118                dlg.pre_request();
19119                let mut req_builder = hyper::Request::builder()
19120                    .method(hyper::Method::GET)
19121                    .uri(url.as_str())
19122                    .header(USER_AGENT, self.hub._user_agent.clone());
19123
19124                if let Some(token) = token.as_ref() {
19125                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19126                }
19127
19128                let request = req_builder
19129                    .header(CONTENT_LENGTH, 0_u64)
19130                    .body(common::to_body::<String>(None));
19131
19132                client.request(request.unwrap()).await
19133            };
19134
19135            match req_result {
19136                Err(err) => {
19137                    if let common::Retry::After(d) = dlg.http_error(&err) {
19138                        sleep(d).await;
19139                        continue;
19140                    }
19141                    dlg.finished(false);
19142                    return Err(common::Error::HttpError(err));
19143                }
19144                Ok(res) => {
19145                    let (mut parts, body) = res.into_parts();
19146                    let mut body = common::Body::new(body);
19147                    if !parts.status.is_success() {
19148                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19149                        let error = serde_json::from_str(&common::to_string(&bytes));
19150                        let response = common::to_response(parts, bytes.into());
19151
19152                        if let common::Retry::After(d) =
19153                            dlg.http_failure(&response, error.as_ref().ok())
19154                        {
19155                            sleep(d).await;
19156                            continue;
19157                        }
19158
19159                        dlg.finished(false);
19160
19161                        return Err(match error {
19162                            Ok(value) => common::Error::BadRequest(value),
19163                            _ => common::Error::Failure(response),
19164                        });
19165                    }
19166                    let response = {
19167                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19168                        let encoded = common::to_string(&bytes);
19169                        match serde_json::from_str(&encoded) {
19170                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19171                            Err(error) => {
19172                                dlg.response_json_decode_error(&encoded, &error);
19173                                return Err(common::Error::JsonDecodeError(
19174                                    encoded.to_string(),
19175                                    error,
19176                                ));
19177                            }
19178                        }
19179                    };
19180
19181                    dlg.finished(true);
19182                    return Ok(response);
19183                }
19184            }
19185        }
19186    }
19187
19188    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` objects are available in a list. For example, if you have a list of 200 objects and you call list with `maxResults` set to 20, list will return the first 20 objects and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 objects.
19189    ///
19190    /// Sets the *token* query property to the given value.
19191    pub fn token(mut self, new_value: &str) -> GenericobjectListCall<'a, C> {
19192        self._token = Some(new_value.to_string());
19193        self
19194    }
19195    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
19196    ///
19197    /// Sets the *max results* query property to the given value.
19198    pub fn max_results(mut self, new_value: i32) -> GenericobjectListCall<'a, C> {
19199        self._max_results = Some(new_value);
19200        self
19201    }
19202    /// The ID of the class whose objects will be listed.
19203    ///
19204    /// Sets the *class id* query property to the given value.
19205    pub fn class_id(mut self, new_value: &str) -> GenericobjectListCall<'a, C> {
19206        self._class_id = Some(new_value.to_string());
19207        self
19208    }
19209    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19210    /// while executing the actual API request.
19211    ///
19212    /// ````text
19213    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19214    /// ````
19215    ///
19216    /// Sets the *delegate* property to the given value.
19217    pub fn delegate(
19218        mut self,
19219        new_value: &'a mut dyn common::Delegate,
19220    ) -> GenericobjectListCall<'a, C> {
19221        self._delegate = Some(new_value);
19222        self
19223    }
19224
19225    /// Set any additional parameter of the query string used in the request.
19226    /// It should be used to set parameters which are not yet available through their own
19227    /// setters.
19228    ///
19229    /// Please note that this method must not be used to set any of the known parameters
19230    /// which have their own setter method. If done anyway, the request will fail.
19231    ///
19232    /// # Additional Parameters
19233    ///
19234    /// * *$.xgafv* (query-string) - V1 error format.
19235    /// * *access_token* (query-string) - OAuth access token.
19236    /// * *alt* (query-string) - Data format for response.
19237    /// * *callback* (query-string) - JSONP
19238    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19239    /// * *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.
19240    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19241    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19242    /// * *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.
19243    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19244    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19245    pub fn param<T>(mut self, name: T, value: T) -> GenericobjectListCall<'a, C>
19246    where
19247        T: AsRef<str>,
19248    {
19249        self._additional_params
19250            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19251        self
19252    }
19253
19254    /// Identifies the authorization scope for the method you are building.
19255    ///
19256    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19257    /// [`Scope::WalletObjectIssuer`].
19258    ///
19259    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19260    /// tokens for more than one scope.
19261    ///
19262    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19263    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19264    /// sufficient, a read-write scope will do as well.
19265    pub fn add_scope<St>(mut self, scope: St) -> GenericobjectListCall<'a, C>
19266    where
19267        St: AsRef<str>,
19268    {
19269        self._scopes.insert(String::from(scope.as_ref()));
19270        self
19271    }
19272    /// Identifies the authorization scope(s) for the method you are building.
19273    ///
19274    /// See [`Self::add_scope()`] for details.
19275    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectListCall<'a, C>
19276    where
19277        I: IntoIterator<Item = St>,
19278        St: AsRef<str>,
19279    {
19280        self._scopes
19281            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19282        self
19283    }
19284
19285    /// Removes all scopes, and no default scope will be used either.
19286    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19287    /// for details).
19288    pub fn clear_scopes(mut self) -> GenericobjectListCall<'a, C> {
19289        self._scopes.clear();
19290        self
19291    }
19292}
19293
19294/// Updates the generic object referenced by the given object ID. This method supports patch semantics.
19295///
19296/// A builder for the *patch* method supported by a *genericobject* resource.
19297/// It is not used directly, but through a [`GenericobjectMethods`] instance.
19298///
19299/// # Example
19300///
19301/// Instantiate a resource method builder
19302///
19303/// ```test_harness,no_run
19304/// # extern crate hyper;
19305/// # extern crate hyper_rustls;
19306/// # extern crate google_walletobjects1 as walletobjects1;
19307/// use walletobjects1::api::GenericObject;
19308/// # async fn dox() {
19309/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19310///
19311/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19312/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19313/// #     .with_native_roots()
19314/// #     .unwrap()
19315/// #     .https_only()
19316/// #     .enable_http2()
19317/// #     .build();
19318///
19319/// # let executor = hyper_util::rt::TokioExecutor::new();
19320/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19321/// #     secret,
19322/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19323/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19324/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19325/// #     ),
19326/// # ).build().await.unwrap();
19327///
19328/// # let client = hyper_util::client::legacy::Client::builder(
19329/// #     hyper_util::rt::TokioExecutor::new()
19330/// # )
19331/// # .build(
19332/// #     hyper_rustls::HttpsConnectorBuilder::new()
19333/// #         .with_native_roots()
19334/// #         .unwrap()
19335/// #         .https_or_http()
19336/// #         .enable_http2()
19337/// #         .build()
19338/// # );
19339/// # let mut hub = Walletobjects::new(client, auth);
19340/// // As the method needs a request, you would usually fill it with the desired information
19341/// // into the respective structure. Some of the parts shown here might not be applicable !
19342/// // Values shown here are possibly random and not representative !
19343/// let mut req = GenericObject::default();
19344///
19345/// // You can configure optional parameters by calling the respective setters at will, and
19346/// // execute the final call using `doit()`.
19347/// // Values shown here are possibly random and not representative !
19348/// let result = hub.genericobject().patch(req, "resourceId")
19349///              .doit().await;
19350/// # }
19351/// ```
19352pub struct GenericobjectPatchCall<'a, C>
19353where
19354    C: 'a,
19355{
19356    hub: &'a Walletobjects<C>,
19357    _request: GenericObject,
19358    _resource_id: String,
19359    _delegate: Option<&'a mut dyn common::Delegate>,
19360    _additional_params: HashMap<String, String>,
19361    _scopes: BTreeSet<String>,
19362}
19363
19364impl<'a, C> common::CallBuilder for GenericobjectPatchCall<'a, C> {}
19365
19366impl<'a, C> GenericobjectPatchCall<'a, C>
19367where
19368    C: common::Connector,
19369{
19370    /// Perform the operation you have build so far.
19371    pub async fn doit(mut self) -> common::Result<(common::Response, GenericObject)> {
19372        use std::borrow::Cow;
19373        use std::io::{Read, Seek};
19374
19375        use common::{url::Params, ToParts};
19376        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19377
19378        let mut dd = common::DefaultDelegate;
19379        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19380        dlg.begin(common::MethodInfo {
19381            id: "walletobjects.genericobject.patch",
19382            http_method: hyper::Method::PATCH,
19383        });
19384
19385        for &field in ["alt", "resourceId"].iter() {
19386            if self._additional_params.contains_key(field) {
19387                dlg.finished(false);
19388                return Err(common::Error::FieldClash(field));
19389            }
19390        }
19391
19392        let mut params = Params::with_capacity(4 + self._additional_params.len());
19393        params.push("resourceId", self._resource_id);
19394
19395        params.extend(self._additional_params.iter());
19396
19397        params.push("alt", "json");
19398        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject/{resourceId}";
19399        if self._scopes.is_empty() {
19400            self._scopes
19401                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
19402        }
19403
19404        #[allow(clippy::single_element_loop)]
19405        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
19406            url = params.uri_replacement(url, param_name, find_this, false);
19407        }
19408        {
19409            let to_remove = ["resourceId"];
19410            params.remove_params(&to_remove);
19411        }
19412
19413        let url = params.parse_with_url(&url);
19414
19415        let mut json_mime_type = mime::APPLICATION_JSON;
19416        let mut request_value_reader = {
19417            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19418            common::remove_json_null_values(&mut value);
19419            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19420            serde_json::to_writer(&mut dst, &value).unwrap();
19421            dst
19422        };
19423        let request_size = request_value_reader
19424            .seek(std::io::SeekFrom::End(0))
19425            .unwrap();
19426        request_value_reader
19427            .seek(std::io::SeekFrom::Start(0))
19428            .unwrap();
19429
19430        loop {
19431            let token = match self
19432                .hub
19433                .auth
19434                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19435                .await
19436            {
19437                Ok(token) => token,
19438                Err(e) => match dlg.token(e) {
19439                    Ok(token) => token,
19440                    Err(e) => {
19441                        dlg.finished(false);
19442                        return Err(common::Error::MissingToken(e));
19443                    }
19444                },
19445            };
19446            request_value_reader
19447                .seek(std::io::SeekFrom::Start(0))
19448                .unwrap();
19449            let mut req_result = {
19450                let client = &self.hub.client;
19451                dlg.pre_request();
19452                let mut req_builder = hyper::Request::builder()
19453                    .method(hyper::Method::PATCH)
19454                    .uri(url.as_str())
19455                    .header(USER_AGENT, self.hub._user_agent.clone());
19456
19457                if let Some(token) = token.as_ref() {
19458                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19459                }
19460
19461                let request = req_builder
19462                    .header(CONTENT_TYPE, json_mime_type.to_string())
19463                    .header(CONTENT_LENGTH, request_size as u64)
19464                    .body(common::to_body(
19465                        request_value_reader.get_ref().clone().into(),
19466                    ));
19467
19468                client.request(request.unwrap()).await
19469            };
19470
19471            match req_result {
19472                Err(err) => {
19473                    if let common::Retry::After(d) = dlg.http_error(&err) {
19474                        sleep(d).await;
19475                        continue;
19476                    }
19477                    dlg.finished(false);
19478                    return Err(common::Error::HttpError(err));
19479                }
19480                Ok(res) => {
19481                    let (mut parts, body) = res.into_parts();
19482                    let mut body = common::Body::new(body);
19483                    if !parts.status.is_success() {
19484                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19485                        let error = serde_json::from_str(&common::to_string(&bytes));
19486                        let response = common::to_response(parts, bytes.into());
19487
19488                        if let common::Retry::After(d) =
19489                            dlg.http_failure(&response, error.as_ref().ok())
19490                        {
19491                            sleep(d).await;
19492                            continue;
19493                        }
19494
19495                        dlg.finished(false);
19496
19497                        return Err(match error {
19498                            Ok(value) => common::Error::BadRequest(value),
19499                            _ => common::Error::Failure(response),
19500                        });
19501                    }
19502                    let response = {
19503                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19504                        let encoded = common::to_string(&bytes);
19505                        match serde_json::from_str(&encoded) {
19506                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19507                            Err(error) => {
19508                                dlg.response_json_decode_error(&encoded, &error);
19509                                return Err(common::Error::JsonDecodeError(
19510                                    encoded.to_string(),
19511                                    error,
19512                                ));
19513                            }
19514                        }
19515                    };
19516
19517                    dlg.finished(true);
19518                    return Ok(response);
19519                }
19520            }
19521        }
19522    }
19523
19524    ///
19525    /// Sets the *request* property to the given value.
19526    ///
19527    /// Even though the property as already been set when instantiating this call,
19528    /// we provide this method for API completeness.
19529    pub fn request(mut self, new_value: GenericObject) -> GenericobjectPatchCall<'a, C> {
19530        self._request = new_value;
19531        self
19532    }
19533    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
19534    ///
19535    /// Sets the *resource id* path property to the given value.
19536    ///
19537    /// Even though the property as already been set when instantiating this call,
19538    /// we provide this method for API completeness.
19539    pub fn resource_id(mut self, new_value: &str) -> GenericobjectPatchCall<'a, C> {
19540        self._resource_id = new_value.to_string();
19541        self
19542    }
19543    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19544    /// while executing the actual API request.
19545    ///
19546    /// ````text
19547    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19548    /// ````
19549    ///
19550    /// Sets the *delegate* property to the given value.
19551    pub fn delegate(
19552        mut self,
19553        new_value: &'a mut dyn common::Delegate,
19554    ) -> GenericobjectPatchCall<'a, C> {
19555        self._delegate = Some(new_value);
19556        self
19557    }
19558
19559    /// Set any additional parameter of the query string used in the request.
19560    /// It should be used to set parameters which are not yet available through their own
19561    /// setters.
19562    ///
19563    /// Please note that this method must not be used to set any of the known parameters
19564    /// which have their own setter method. If done anyway, the request will fail.
19565    ///
19566    /// # Additional Parameters
19567    ///
19568    /// * *$.xgafv* (query-string) - V1 error format.
19569    /// * *access_token* (query-string) - OAuth access token.
19570    /// * *alt* (query-string) - Data format for response.
19571    /// * *callback* (query-string) - JSONP
19572    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19573    /// * *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.
19574    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19575    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19576    /// * *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.
19577    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19578    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19579    pub fn param<T>(mut self, name: T, value: T) -> GenericobjectPatchCall<'a, C>
19580    where
19581        T: AsRef<str>,
19582    {
19583        self._additional_params
19584            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19585        self
19586    }
19587
19588    /// Identifies the authorization scope for the method you are building.
19589    ///
19590    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19591    /// [`Scope::WalletObjectIssuer`].
19592    ///
19593    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19594    /// tokens for more than one scope.
19595    ///
19596    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19597    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19598    /// sufficient, a read-write scope will do as well.
19599    pub fn add_scope<St>(mut self, scope: St) -> GenericobjectPatchCall<'a, C>
19600    where
19601        St: AsRef<str>,
19602    {
19603        self._scopes.insert(String::from(scope.as_ref()));
19604        self
19605    }
19606    /// Identifies the authorization scope(s) for the method you are building.
19607    ///
19608    /// See [`Self::add_scope()`] for details.
19609    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectPatchCall<'a, C>
19610    where
19611        I: IntoIterator<Item = St>,
19612        St: AsRef<str>,
19613    {
19614        self._scopes
19615            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19616        self
19617    }
19618
19619    /// Removes all scopes, and no default scope will be used either.
19620    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19621    /// for details).
19622    pub fn clear_scopes(mut self) -> GenericobjectPatchCall<'a, C> {
19623        self._scopes.clear();
19624        self
19625    }
19626}
19627
19628/// Updates the generic object referenced by the given object ID.
19629///
19630/// A builder for the *update* method supported by a *genericobject* resource.
19631/// It is not used directly, but through a [`GenericobjectMethods`] instance.
19632///
19633/// # Example
19634///
19635/// Instantiate a resource method builder
19636///
19637/// ```test_harness,no_run
19638/// # extern crate hyper;
19639/// # extern crate hyper_rustls;
19640/// # extern crate google_walletobjects1 as walletobjects1;
19641/// use walletobjects1::api::GenericObject;
19642/// # async fn dox() {
19643/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19644///
19645/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19646/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19647/// #     .with_native_roots()
19648/// #     .unwrap()
19649/// #     .https_only()
19650/// #     .enable_http2()
19651/// #     .build();
19652///
19653/// # let executor = hyper_util::rt::TokioExecutor::new();
19654/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19655/// #     secret,
19656/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19657/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19658/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19659/// #     ),
19660/// # ).build().await.unwrap();
19661///
19662/// # let client = hyper_util::client::legacy::Client::builder(
19663/// #     hyper_util::rt::TokioExecutor::new()
19664/// # )
19665/// # .build(
19666/// #     hyper_rustls::HttpsConnectorBuilder::new()
19667/// #         .with_native_roots()
19668/// #         .unwrap()
19669/// #         .https_or_http()
19670/// #         .enable_http2()
19671/// #         .build()
19672/// # );
19673/// # let mut hub = Walletobjects::new(client, auth);
19674/// // As the method needs a request, you would usually fill it with the desired information
19675/// // into the respective structure. Some of the parts shown here might not be applicable !
19676/// // Values shown here are possibly random and not representative !
19677/// let mut req = GenericObject::default();
19678///
19679/// // You can configure optional parameters by calling the respective setters at will, and
19680/// // execute the final call using `doit()`.
19681/// // Values shown here are possibly random and not representative !
19682/// let result = hub.genericobject().update(req, "resourceId")
19683///              .doit().await;
19684/// # }
19685/// ```
19686pub struct GenericobjectUpdateCall<'a, C>
19687where
19688    C: 'a,
19689{
19690    hub: &'a Walletobjects<C>,
19691    _request: GenericObject,
19692    _resource_id: String,
19693    _delegate: Option<&'a mut dyn common::Delegate>,
19694    _additional_params: HashMap<String, String>,
19695    _scopes: BTreeSet<String>,
19696}
19697
19698impl<'a, C> common::CallBuilder for GenericobjectUpdateCall<'a, C> {}
19699
19700impl<'a, C> GenericobjectUpdateCall<'a, C>
19701where
19702    C: common::Connector,
19703{
19704    /// Perform the operation you have build so far.
19705    pub async fn doit(mut self) -> common::Result<(common::Response, GenericObject)> {
19706        use std::borrow::Cow;
19707        use std::io::{Read, Seek};
19708
19709        use common::{url::Params, ToParts};
19710        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19711
19712        let mut dd = common::DefaultDelegate;
19713        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19714        dlg.begin(common::MethodInfo {
19715            id: "walletobjects.genericobject.update",
19716            http_method: hyper::Method::PUT,
19717        });
19718
19719        for &field in ["alt", "resourceId"].iter() {
19720            if self._additional_params.contains_key(field) {
19721                dlg.finished(false);
19722                return Err(common::Error::FieldClash(field));
19723            }
19724        }
19725
19726        let mut params = Params::with_capacity(4 + self._additional_params.len());
19727        params.push("resourceId", self._resource_id);
19728
19729        params.extend(self._additional_params.iter());
19730
19731        params.push("alt", "json");
19732        let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject/{resourceId}";
19733        if self._scopes.is_empty() {
19734            self._scopes
19735                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
19736        }
19737
19738        #[allow(clippy::single_element_loop)]
19739        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
19740            url = params.uri_replacement(url, param_name, find_this, false);
19741        }
19742        {
19743            let to_remove = ["resourceId"];
19744            params.remove_params(&to_remove);
19745        }
19746
19747        let url = params.parse_with_url(&url);
19748
19749        let mut json_mime_type = mime::APPLICATION_JSON;
19750        let mut request_value_reader = {
19751            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19752            common::remove_json_null_values(&mut value);
19753            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19754            serde_json::to_writer(&mut dst, &value).unwrap();
19755            dst
19756        };
19757        let request_size = request_value_reader
19758            .seek(std::io::SeekFrom::End(0))
19759            .unwrap();
19760        request_value_reader
19761            .seek(std::io::SeekFrom::Start(0))
19762            .unwrap();
19763
19764        loop {
19765            let token = match self
19766                .hub
19767                .auth
19768                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19769                .await
19770            {
19771                Ok(token) => token,
19772                Err(e) => match dlg.token(e) {
19773                    Ok(token) => token,
19774                    Err(e) => {
19775                        dlg.finished(false);
19776                        return Err(common::Error::MissingToken(e));
19777                    }
19778                },
19779            };
19780            request_value_reader
19781                .seek(std::io::SeekFrom::Start(0))
19782                .unwrap();
19783            let mut req_result = {
19784                let client = &self.hub.client;
19785                dlg.pre_request();
19786                let mut req_builder = hyper::Request::builder()
19787                    .method(hyper::Method::PUT)
19788                    .uri(url.as_str())
19789                    .header(USER_AGENT, self.hub._user_agent.clone());
19790
19791                if let Some(token) = token.as_ref() {
19792                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19793                }
19794
19795                let request = req_builder
19796                    .header(CONTENT_TYPE, json_mime_type.to_string())
19797                    .header(CONTENT_LENGTH, request_size as u64)
19798                    .body(common::to_body(
19799                        request_value_reader.get_ref().clone().into(),
19800                    ));
19801
19802                client.request(request.unwrap()).await
19803            };
19804
19805            match req_result {
19806                Err(err) => {
19807                    if let common::Retry::After(d) = dlg.http_error(&err) {
19808                        sleep(d).await;
19809                        continue;
19810                    }
19811                    dlg.finished(false);
19812                    return Err(common::Error::HttpError(err));
19813                }
19814                Ok(res) => {
19815                    let (mut parts, body) = res.into_parts();
19816                    let mut body = common::Body::new(body);
19817                    if !parts.status.is_success() {
19818                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19819                        let error = serde_json::from_str(&common::to_string(&bytes));
19820                        let response = common::to_response(parts, bytes.into());
19821
19822                        if let common::Retry::After(d) =
19823                            dlg.http_failure(&response, error.as_ref().ok())
19824                        {
19825                            sleep(d).await;
19826                            continue;
19827                        }
19828
19829                        dlg.finished(false);
19830
19831                        return Err(match error {
19832                            Ok(value) => common::Error::BadRequest(value),
19833                            _ => common::Error::Failure(response),
19834                        });
19835                    }
19836                    let response = {
19837                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19838                        let encoded = common::to_string(&bytes);
19839                        match serde_json::from_str(&encoded) {
19840                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19841                            Err(error) => {
19842                                dlg.response_json_decode_error(&encoded, &error);
19843                                return Err(common::Error::JsonDecodeError(
19844                                    encoded.to_string(),
19845                                    error,
19846                                ));
19847                            }
19848                        }
19849                    };
19850
19851                    dlg.finished(true);
19852                    return Ok(response);
19853                }
19854            }
19855        }
19856    }
19857
19858    ///
19859    /// Sets the *request* property to the given value.
19860    ///
19861    /// Even though the property as already been set when instantiating this call,
19862    /// we provide this method for API completeness.
19863    pub fn request(mut self, new_value: GenericObject) -> GenericobjectUpdateCall<'a, C> {
19864        self._request = new_value;
19865        self
19866    }
19867    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value needs to follow the format `issuerID.identifier` where `issuerID` is issued by Google and `identifier` is chosen by you. The unique identifier can only include alphanumeric characters, `.`, `_`, or `-`.
19868    ///
19869    /// Sets the *resource id* path property to the given value.
19870    ///
19871    /// Even though the property as already been set when instantiating this call,
19872    /// we provide this method for API completeness.
19873    pub fn resource_id(mut self, new_value: &str) -> GenericobjectUpdateCall<'a, C> {
19874        self._resource_id = new_value.to_string();
19875        self
19876    }
19877    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19878    /// while executing the actual API request.
19879    ///
19880    /// ````text
19881    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19882    /// ````
19883    ///
19884    /// Sets the *delegate* property to the given value.
19885    pub fn delegate(
19886        mut self,
19887        new_value: &'a mut dyn common::Delegate,
19888    ) -> GenericobjectUpdateCall<'a, C> {
19889        self._delegate = Some(new_value);
19890        self
19891    }
19892
19893    /// Set any additional parameter of the query string used in the request.
19894    /// It should be used to set parameters which are not yet available through their own
19895    /// setters.
19896    ///
19897    /// Please note that this method must not be used to set any of the known parameters
19898    /// which have their own setter method. If done anyway, the request will fail.
19899    ///
19900    /// # Additional Parameters
19901    ///
19902    /// * *$.xgafv* (query-string) - V1 error format.
19903    /// * *access_token* (query-string) - OAuth access token.
19904    /// * *alt* (query-string) - Data format for response.
19905    /// * *callback* (query-string) - JSONP
19906    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19907    /// * *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.
19908    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19909    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19910    /// * *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.
19911    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19912    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19913    pub fn param<T>(mut self, name: T, value: T) -> GenericobjectUpdateCall<'a, C>
19914    where
19915        T: AsRef<str>,
19916    {
19917        self._additional_params
19918            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19919        self
19920    }
19921
19922    /// Identifies the authorization scope for the method you are building.
19923    ///
19924    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19925    /// [`Scope::WalletObjectIssuer`].
19926    ///
19927    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19928    /// tokens for more than one scope.
19929    ///
19930    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19931    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19932    /// sufficient, a read-write scope will do as well.
19933    pub fn add_scope<St>(mut self, scope: St) -> GenericobjectUpdateCall<'a, C>
19934    where
19935        St: AsRef<str>,
19936    {
19937        self._scopes.insert(String::from(scope.as_ref()));
19938        self
19939    }
19940    /// Identifies the authorization scope(s) for the method you are building.
19941    ///
19942    /// See [`Self::add_scope()`] for details.
19943    pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectUpdateCall<'a, C>
19944    where
19945        I: IntoIterator<Item = St>,
19946        St: AsRef<str>,
19947    {
19948        self._scopes
19949            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19950        self
19951    }
19952
19953    /// Removes all scopes, and no default scope will be used either.
19954    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19955    /// for details).
19956    pub fn clear_scopes(mut self) -> GenericobjectUpdateCall<'a, C> {
19957        self._scopes.clear();
19958        self
19959    }
19960}
19961
19962/// Adds a message to the gift card class referenced by the given class ID.
19963///
19964/// A builder for the *addmessage* method supported by a *giftcardclas* resource.
19965/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
19966///
19967/// # Example
19968///
19969/// Instantiate a resource method builder
19970///
19971/// ```test_harness,no_run
19972/// # extern crate hyper;
19973/// # extern crate hyper_rustls;
19974/// # extern crate google_walletobjects1 as walletobjects1;
19975/// use walletobjects1::api::AddMessageRequest;
19976/// # async fn dox() {
19977/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19978///
19979/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19980/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19981/// #     .with_native_roots()
19982/// #     .unwrap()
19983/// #     .https_only()
19984/// #     .enable_http2()
19985/// #     .build();
19986///
19987/// # let executor = hyper_util::rt::TokioExecutor::new();
19988/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19989/// #     secret,
19990/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19991/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19992/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19993/// #     ),
19994/// # ).build().await.unwrap();
19995///
19996/// # let client = hyper_util::client::legacy::Client::builder(
19997/// #     hyper_util::rt::TokioExecutor::new()
19998/// # )
19999/// # .build(
20000/// #     hyper_rustls::HttpsConnectorBuilder::new()
20001/// #         .with_native_roots()
20002/// #         .unwrap()
20003/// #         .https_or_http()
20004/// #         .enable_http2()
20005/// #         .build()
20006/// # );
20007/// # let mut hub = Walletobjects::new(client, auth);
20008/// // As the method needs a request, you would usually fill it with the desired information
20009/// // into the respective structure. Some of the parts shown here might not be applicable !
20010/// // Values shown here are possibly random and not representative !
20011/// let mut req = AddMessageRequest::default();
20012///
20013/// // You can configure optional parameters by calling the respective setters at will, and
20014/// // execute the final call using `doit()`.
20015/// // Values shown here are possibly random and not representative !
20016/// let result = hub.giftcardclass().addmessage(req, "resourceId")
20017///              .doit().await;
20018/// # }
20019/// ```
20020pub struct GiftcardclasAddmessageCall<'a, C>
20021where
20022    C: 'a,
20023{
20024    hub: &'a Walletobjects<C>,
20025    _request: AddMessageRequest,
20026    _resource_id: String,
20027    _delegate: Option<&'a mut dyn common::Delegate>,
20028    _additional_params: HashMap<String, String>,
20029    _scopes: BTreeSet<String>,
20030}
20031
20032impl<'a, C> common::CallBuilder for GiftcardclasAddmessageCall<'a, C> {}
20033
20034impl<'a, C> GiftcardclasAddmessageCall<'a, C>
20035where
20036    C: common::Connector,
20037{
20038    /// Perform the operation you have build so far.
20039    pub async fn doit(
20040        mut self,
20041    ) -> common::Result<(common::Response, GiftCardClassAddMessageResponse)> {
20042        use std::borrow::Cow;
20043        use std::io::{Read, Seek};
20044
20045        use common::{url::Params, ToParts};
20046        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20047
20048        let mut dd = common::DefaultDelegate;
20049        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20050        dlg.begin(common::MethodInfo {
20051            id: "walletobjects.giftcardclass.addmessage",
20052            http_method: hyper::Method::POST,
20053        });
20054
20055        for &field in ["alt", "resourceId"].iter() {
20056            if self._additional_params.contains_key(field) {
20057                dlg.finished(false);
20058                return Err(common::Error::FieldClash(field));
20059            }
20060        }
20061
20062        let mut params = Params::with_capacity(4 + self._additional_params.len());
20063        params.push("resourceId", self._resource_id);
20064
20065        params.extend(self._additional_params.iter());
20066
20067        params.push("alt", "json");
20068        let mut url =
20069            self.hub._base_url.clone() + "walletobjects/v1/giftCardClass/{resourceId}/addMessage";
20070        if self._scopes.is_empty() {
20071            self._scopes
20072                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
20073        }
20074
20075        #[allow(clippy::single_element_loop)]
20076        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
20077            url = params.uri_replacement(url, param_name, find_this, false);
20078        }
20079        {
20080            let to_remove = ["resourceId"];
20081            params.remove_params(&to_remove);
20082        }
20083
20084        let url = params.parse_with_url(&url);
20085
20086        let mut json_mime_type = mime::APPLICATION_JSON;
20087        let mut request_value_reader = {
20088            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20089            common::remove_json_null_values(&mut value);
20090            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20091            serde_json::to_writer(&mut dst, &value).unwrap();
20092            dst
20093        };
20094        let request_size = request_value_reader
20095            .seek(std::io::SeekFrom::End(0))
20096            .unwrap();
20097        request_value_reader
20098            .seek(std::io::SeekFrom::Start(0))
20099            .unwrap();
20100
20101        loop {
20102            let token = match self
20103                .hub
20104                .auth
20105                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20106                .await
20107            {
20108                Ok(token) => token,
20109                Err(e) => match dlg.token(e) {
20110                    Ok(token) => token,
20111                    Err(e) => {
20112                        dlg.finished(false);
20113                        return Err(common::Error::MissingToken(e));
20114                    }
20115                },
20116            };
20117            request_value_reader
20118                .seek(std::io::SeekFrom::Start(0))
20119                .unwrap();
20120            let mut req_result = {
20121                let client = &self.hub.client;
20122                dlg.pre_request();
20123                let mut req_builder = hyper::Request::builder()
20124                    .method(hyper::Method::POST)
20125                    .uri(url.as_str())
20126                    .header(USER_AGENT, self.hub._user_agent.clone());
20127
20128                if let Some(token) = token.as_ref() {
20129                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20130                }
20131
20132                let request = req_builder
20133                    .header(CONTENT_TYPE, json_mime_type.to_string())
20134                    .header(CONTENT_LENGTH, request_size as u64)
20135                    .body(common::to_body(
20136                        request_value_reader.get_ref().clone().into(),
20137                    ));
20138
20139                client.request(request.unwrap()).await
20140            };
20141
20142            match req_result {
20143                Err(err) => {
20144                    if let common::Retry::After(d) = dlg.http_error(&err) {
20145                        sleep(d).await;
20146                        continue;
20147                    }
20148                    dlg.finished(false);
20149                    return Err(common::Error::HttpError(err));
20150                }
20151                Ok(res) => {
20152                    let (mut parts, body) = res.into_parts();
20153                    let mut body = common::Body::new(body);
20154                    if !parts.status.is_success() {
20155                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20156                        let error = serde_json::from_str(&common::to_string(&bytes));
20157                        let response = common::to_response(parts, bytes.into());
20158
20159                        if let common::Retry::After(d) =
20160                            dlg.http_failure(&response, error.as_ref().ok())
20161                        {
20162                            sleep(d).await;
20163                            continue;
20164                        }
20165
20166                        dlg.finished(false);
20167
20168                        return Err(match error {
20169                            Ok(value) => common::Error::BadRequest(value),
20170                            _ => common::Error::Failure(response),
20171                        });
20172                    }
20173                    let response = {
20174                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20175                        let encoded = common::to_string(&bytes);
20176                        match serde_json::from_str(&encoded) {
20177                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20178                            Err(error) => {
20179                                dlg.response_json_decode_error(&encoded, &error);
20180                                return Err(common::Error::JsonDecodeError(
20181                                    encoded.to_string(),
20182                                    error,
20183                                ));
20184                            }
20185                        }
20186                    };
20187
20188                    dlg.finished(true);
20189                    return Ok(response);
20190                }
20191            }
20192        }
20193    }
20194
20195    ///
20196    /// Sets the *request* property to the given value.
20197    ///
20198    /// Even though the property as already been set when instantiating this call,
20199    /// we provide this method for API completeness.
20200    pub fn request(mut self, new_value: AddMessageRequest) -> GiftcardclasAddmessageCall<'a, C> {
20201        self._request = new_value;
20202        self
20203    }
20204    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
20205    ///
20206    /// Sets the *resource id* path property to the given value.
20207    ///
20208    /// Even though the property as already been set when instantiating this call,
20209    /// we provide this method for API completeness.
20210    pub fn resource_id(mut self, new_value: &str) -> GiftcardclasAddmessageCall<'a, C> {
20211        self._resource_id = new_value.to_string();
20212        self
20213    }
20214    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20215    /// while executing the actual API request.
20216    ///
20217    /// ````text
20218    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20219    /// ````
20220    ///
20221    /// Sets the *delegate* property to the given value.
20222    pub fn delegate(
20223        mut self,
20224        new_value: &'a mut dyn common::Delegate,
20225    ) -> GiftcardclasAddmessageCall<'a, C> {
20226        self._delegate = Some(new_value);
20227        self
20228    }
20229
20230    /// Set any additional parameter of the query string used in the request.
20231    /// It should be used to set parameters which are not yet available through their own
20232    /// setters.
20233    ///
20234    /// Please note that this method must not be used to set any of the known parameters
20235    /// which have their own setter method. If done anyway, the request will fail.
20236    ///
20237    /// # Additional Parameters
20238    ///
20239    /// * *$.xgafv* (query-string) - V1 error format.
20240    /// * *access_token* (query-string) - OAuth access token.
20241    /// * *alt* (query-string) - Data format for response.
20242    /// * *callback* (query-string) - JSONP
20243    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20244    /// * *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.
20245    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20246    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20247    /// * *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.
20248    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20249    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20250    pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasAddmessageCall<'a, C>
20251    where
20252        T: AsRef<str>,
20253    {
20254        self._additional_params
20255            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20256        self
20257    }
20258
20259    /// Identifies the authorization scope for the method you are building.
20260    ///
20261    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20262    /// [`Scope::WalletObjectIssuer`].
20263    ///
20264    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20265    /// tokens for more than one scope.
20266    ///
20267    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20268    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20269    /// sufficient, a read-write scope will do as well.
20270    pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasAddmessageCall<'a, C>
20271    where
20272        St: AsRef<str>,
20273    {
20274        self._scopes.insert(String::from(scope.as_ref()));
20275        self
20276    }
20277    /// Identifies the authorization scope(s) for the method you are building.
20278    ///
20279    /// See [`Self::add_scope()`] for details.
20280    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasAddmessageCall<'a, C>
20281    where
20282        I: IntoIterator<Item = St>,
20283        St: AsRef<str>,
20284    {
20285        self._scopes
20286            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20287        self
20288    }
20289
20290    /// Removes all scopes, and no default scope will be used either.
20291    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20292    /// for details).
20293    pub fn clear_scopes(mut self) -> GiftcardclasAddmessageCall<'a, C> {
20294        self._scopes.clear();
20295        self
20296    }
20297}
20298
20299/// Returns the gift card class with the given class ID.
20300///
20301/// A builder for the *get* method supported by a *giftcardclas* resource.
20302/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
20303///
20304/// # Example
20305///
20306/// Instantiate a resource method builder
20307///
20308/// ```test_harness,no_run
20309/// # extern crate hyper;
20310/// # extern crate hyper_rustls;
20311/// # extern crate google_walletobjects1 as walletobjects1;
20312/// # async fn dox() {
20313/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20314///
20315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20316/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20317/// #     .with_native_roots()
20318/// #     .unwrap()
20319/// #     .https_only()
20320/// #     .enable_http2()
20321/// #     .build();
20322///
20323/// # let executor = hyper_util::rt::TokioExecutor::new();
20324/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20325/// #     secret,
20326/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20327/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20328/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20329/// #     ),
20330/// # ).build().await.unwrap();
20331///
20332/// # let client = hyper_util::client::legacy::Client::builder(
20333/// #     hyper_util::rt::TokioExecutor::new()
20334/// # )
20335/// # .build(
20336/// #     hyper_rustls::HttpsConnectorBuilder::new()
20337/// #         .with_native_roots()
20338/// #         .unwrap()
20339/// #         .https_or_http()
20340/// #         .enable_http2()
20341/// #         .build()
20342/// # );
20343/// # let mut hub = Walletobjects::new(client, auth);
20344/// // You can configure optional parameters by calling the respective setters at will, and
20345/// // execute the final call using `doit()`.
20346/// // Values shown here are possibly random and not representative !
20347/// let result = hub.giftcardclass().get("resourceId")
20348///              .doit().await;
20349/// # }
20350/// ```
20351pub struct GiftcardclasGetCall<'a, C>
20352where
20353    C: 'a,
20354{
20355    hub: &'a Walletobjects<C>,
20356    _resource_id: String,
20357    _delegate: Option<&'a mut dyn common::Delegate>,
20358    _additional_params: HashMap<String, String>,
20359    _scopes: BTreeSet<String>,
20360}
20361
20362impl<'a, C> common::CallBuilder for GiftcardclasGetCall<'a, C> {}
20363
20364impl<'a, C> GiftcardclasGetCall<'a, C>
20365where
20366    C: common::Connector,
20367{
20368    /// Perform the operation you have build so far.
20369    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClass)> {
20370        use std::borrow::Cow;
20371        use std::io::{Read, Seek};
20372
20373        use common::{url::Params, ToParts};
20374        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20375
20376        let mut dd = common::DefaultDelegate;
20377        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20378        dlg.begin(common::MethodInfo {
20379            id: "walletobjects.giftcardclass.get",
20380            http_method: hyper::Method::GET,
20381        });
20382
20383        for &field in ["alt", "resourceId"].iter() {
20384            if self._additional_params.contains_key(field) {
20385                dlg.finished(false);
20386                return Err(common::Error::FieldClash(field));
20387            }
20388        }
20389
20390        let mut params = Params::with_capacity(3 + self._additional_params.len());
20391        params.push("resourceId", self._resource_id);
20392
20393        params.extend(self._additional_params.iter());
20394
20395        params.push("alt", "json");
20396        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass/{resourceId}";
20397        if self._scopes.is_empty() {
20398            self._scopes
20399                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
20400        }
20401
20402        #[allow(clippy::single_element_loop)]
20403        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
20404            url = params.uri_replacement(url, param_name, find_this, false);
20405        }
20406        {
20407            let to_remove = ["resourceId"];
20408            params.remove_params(&to_remove);
20409        }
20410
20411        let url = params.parse_with_url(&url);
20412
20413        loop {
20414            let token = match self
20415                .hub
20416                .auth
20417                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20418                .await
20419            {
20420                Ok(token) => token,
20421                Err(e) => match dlg.token(e) {
20422                    Ok(token) => token,
20423                    Err(e) => {
20424                        dlg.finished(false);
20425                        return Err(common::Error::MissingToken(e));
20426                    }
20427                },
20428            };
20429            let mut req_result = {
20430                let client = &self.hub.client;
20431                dlg.pre_request();
20432                let mut req_builder = hyper::Request::builder()
20433                    .method(hyper::Method::GET)
20434                    .uri(url.as_str())
20435                    .header(USER_AGENT, self.hub._user_agent.clone());
20436
20437                if let Some(token) = token.as_ref() {
20438                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20439                }
20440
20441                let request = req_builder
20442                    .header(CONTENT_LENGTH, 0_u64)
20443                    .body(common::to_body::<String>(None));
20444
20445                client.request(request.unwrap()).await
20446            };
20447
20448            match req_result {
20449                Err(err) => {
20450                    if let common::Retry::After(d) = dlg.http_error(&err) {
20451                        sleep(d).await;
20452                        continue;
20453                    }
20454                    dlg.finished(false);
20455                    return Err(common::Error::HttpError(err));
20456                }
20457                Ok(res) => {
20458                    let (mut parts, body) = res.into_parts();
20459                    let mut body = common::Body::new(body);
20460                    if !parts.status.is_success() {
20461                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20462                        let error = serde_json::from_str(&common::to_string(&bytes));
20463                        let response = common::to_response(parts, bytes.into());
20464
20465                        if let common::Retry::After(d) =
20466                            dlg.http_failure(&response, error.as_ref().ok())
20467                        {
20468                            sleep(d).await;
20469                            continue;
20470                        }
20471
20472                        dlg.finished(false);
20473
20474                        return Err(match error {
20475                            Ok(value) => common::Error::BadRequest(value),
20476                            _ => common::Error::Failure(response),
20477                        });
20478                    }
20479                    let response = {
20480                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20481                        let encoded = common::to_string(&bytes);
20482                        match serde_json::from_str(&encoded) {
20483                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20484                            Err(error) => {
20485                                dlg.response_json_decode_error(&encoded, &error);
20486                                return Err(common::Error::JsonDecodeError(
20487                                    encoded.to_string(),
20488                                    error,
20489                                ));
20490                            }
20491                        }
20492                    };
20493
20494                    dlg.finished(true);
20495                    return Ok(response);
20496                }
20497            }
20498        }
20499    }
20500
20501    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
20502    ///
20503    /// Sets the *resource id* path property to the given value.
20504    ///
20505    /// Even though the property as already been set when instantiating this call,
20506    /// we provide this method for API completeness.
20507    pub fn resource_id(mut self, new_value: &str) -> GiftcardclasGetCall<'a, C> {
20508        self._resource_id = new_value.to_string();
20509        self
20510    }
20511    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20512    /// while executing the actual API request.
20513    ///
20514    /// ````text
20515    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20516    /// ````
20517    ///
20518    /// Sets the *delegate* property to the given value.
20519    pub fn delegate(
20520        mut self,
20521        new_value: &'a mut dyn common::Delegate,
20522    ) -> GiftcardclasGetCall<'a, C> {
20523        self._delegate = Some(new_value);
20524        self
20525    }
20526
20527    /// Set any additional parameter of the query string used in the request.
20528    /// It should be used to set parameters which are not yet available through their own
20529    /// setters.
20530    ///
20531    /// Please note that this method must not be used to set any of the known parameters
20532    /// which have their own setter method. If done anyway, the request will fail.
20533    ///
20534    /// # Additional Parameters
20535    ///
20536    /// * *$.xgafv* (query-string) - V1 error format.
20537    /// * *access_token* (query-string) - OAuth access token.
20538    /// * *alt* (query-string) - Data format for response.
20539    /// * *callback* (query-string) - JSONP
20540    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20541    /// * *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.
20542    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20543    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20544    /// * *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.
20545    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20546    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20547    pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasGetCall<'a, C>
20548    where
20549        T: AsRef<str>,
20550    {
20551        self._additional_params
20552            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20553        self
20554    }
20555
20556    /// Identifies the authorization scope for the method you are building.
20557    ///
20558    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20559    /// [`Scope::WalletObjectIssuer`].
20560    ///
20561    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20562    /// tokens for more than one scope.
20563    ///
20564    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20565    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20566    /// sufficient, a read-write scope will do as well.
20567    pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasGetCall<'a, C>
20568    where
20569        St: AsRef<str>,
20570    {
20571        self._scopes.insert(String::from(scope.as_ref()));
20572        self
20573    }
20574    /// Identifies the authorization scope(s) for the method you are building.
20575    ///
20576    /// See [`Self::add_scope()`] for details.
20577    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasGetCall<'a, C>
20578    where
20579        I: IntoIterator<Item = St>,
20580        St: AsRef<str>,
20581    {
20582        self._scopes
20583            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20584        self
20585    }
20586
20587    /// Removes all scopes, and no default scope will be used either.
20588    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20589    /// for details).
20590    pub fn clear_scopes(mut self) -> GiftcardclasGetCall<'a, C> {
20591        self._scopes.clear();
20592        self
20593    }
20594}
20595
20596/// Inserts an gift card class with the given ID and properties.
20597///
20598/// A builder for the *insert* method supported by a *giftcardclas* resource.
20599/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
20600///
20601/// # Example
20602///
20603/// Instantiate a resource method builder
20604///
20605/// ```test_harness,no_run
20606/// # extern crate hyper;
20607/// # extern crate hyper_rustls;
20608/// # extern crate google_walletobjects1 as walletobjects1;
20609/// use walletobjects1::api::GiftCardClass;
20610/// # async fn dox() {
20611/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20612///
20613/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20614/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20615/// #     .with_native_roots()
20616/// #     .unwrap()
20617/// #     .https_only()
20618/// #     .enable_http2()
20619/// #     .build();
20620///
20621/// # let executor = hyper_util::rt::TokioExecutor::new();
20622/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20623/// #     secret,
20624/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20625/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20626/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20627/// #     ),
20628/// # ).build().await.unwrap();
20629///
20630/// # let client = hyper_util::client::legacy::Client::builder(
20631/// #     hyper_util::rt::TokioExecutor::new()
20632/// # )
20633/// # .build(
20634/// #     hyper_rustls::HttpsConnectorBuilder::new()
20635/// #         .with_native_roots()
20636/// #         .unwrap()
20637/// #         .https_or_http()
20638/// #         .enable_http2()
20639/// #         .build()
20640/// # );
20641/// # let mut hub = Walletobjects::new(client, auth);
20642/// // As the method needs a request, you would usually fill it with the desired information
20643/// // into the respective structure. Some of the parts shown here might not be applicable !
20644/// // Values shown here are possibly random and not representative !
20645/// let mut req = GiftCardClass::default();
20646///
20647/// // You can configure optional parameters by calling the respective setters at will, and
20648/// // execute the final call using `doit()`.
20649/// // Values shown here are possibly random and not representative !
20650/// let result = hub.giftcardclass().insert(req)
20651///              .doit().await;
20652/// # }
20653/// ```
20654pub struct GiftcardclasInsertCall<'a, C>
20655where
20656    C: 'a,
20657{
20658    hub: &'a Walletobjects<C>,
20659    _request: GiftCardClass,
20660    _delegate: Option<&'a mut dyn common::Delegate>,
20661    _additional_params: HashMap<String, String>,
20662    _scopes: BTreeSet<String>,
20663}
20664
20665impl<'a, C> common::CallBuilder for GiftcardclasInsertCall<'a, C> {}
20666
20667impl<'a, C> GiftcardclasInsertCall<'a, C>
20668where
20669    C: common::Connector,
20670{
20671    /// Perform the operation you have build so far.
20672    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClass)> {
20673        use std::borrow::Cow;
20674        use std::io::{Read, Seek};
20675
20676        use common::{url::Params, ToParts};
20677        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20678
20679        let mut dd = common::DefaultDelegate;
20680        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20681        dlg.begin(common::MethodInfo {
20682            id: "walletobjects.giftcardclass.insert",
20683            http_method: hyper::Method::POST,
20684        });
20685
20686        for &field in ["alt"].iter() {
20687            if self._additional_params.contains_key(field) {
20688                dlg.finished(false);
20689                return Err(common::Error::FieldClash(field));
20690            }
20691        }
20692
20693        let mut params = Params::with_capacity(3 + self._additional_params.len());
20694
20695        params.extend(self._additional_params.iter());
20696
20697        params.push("alt", "json");
20698        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass";
20699        if self._scopes.is_empty() {
20700            self._scopes
20701                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
20702        }
20703
20704        let url = params.parse_with_url(&url);
20705
20706        let mut json_mime_type = mime::APPLICATION_JSON;
20707        let mut request_value_reader = {
20708            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20709            common::remove_json_null_values(&mut value);
20710            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20711            serde_json::to_writer(&mut dst, &value).unwrap();
20712            dst
20713        };
20714        let request_size = request_value_reader
20715            .seek(std::io::SeekFrom::End(0))
20716            .unwrap();
20717        request_value_reader
20718            .seek(std::io::SeekFrom::Start(0))
20719            .unwrap();
20720
20721        loop {
20722            let token = match self
20723                .hub
20724                .auth
20725                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20726                .await
20727            {
20728                Ok(token) => token,
20729                Err(e) => match dlg.token(e) {
20730                    Ok(token) => token,
20731                    Err(e) => {
20732                        dlg.finished(false);
20733                        return Err(common::Error::MissingToken(e));
20734                    }
20735                },
20736            };
20737            request_value_reader
20738                .seek(std::io::SeekFrom::Start(0))
20739                .unwrap();
20740            let mut req_result = {
20741                let client = &self.hub.client;
20742                dlg.pre_request();
20743                let mut req_builder = hyper::Request::builder()
20744                    .method(hyper::Method::POST)
20745                    .uri(url.as_str())
20746                    .header(USER_AGENT, self.hub._user_agent.clone());
20747
20748                if let Some(token) = token.as_ref() {
20749                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20750                }
20751
20752                let request = req_builder
20753                    .header(CONTENT_TYPE, json_mime_type.to_string())
20754                    .header(CONTENT_LENGTH, request_size as u64)
20755                    .body(common::to_body(
20756                        request_value_reader.get_ref().clone().into(),
20757                    ));
20758
20759                client.request(request.unwrap()).await
20760            };
20761
20762            match req_result {
20763                Err(err) => {
20764                    if let common::Retry::After(d) = dlg.http_error(&err) {
20765                        sleep(d).await;
20766                        continue;
20767                    }
20768                    dlg.finished(false);
20769                    return Err(common::Error::HttpError(err));
20770                }
20771                Ok(res) => {
20772                    let (mut parts, body) = res.into_parts();
20773                    let mut body = common::Body::new(body);
20774                    if !parts.status.is_success() {
20775                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20776                        let error = serde_json::from_str(&common::to_string(&bytes));
20777                        let response = common::to_response(parts, bytes.into());
20778
20779                        if let common::Retry::After(d) =
20780                            dlg.http_failure(&response, error.as_ref().ok())
20781                        {
20782                            sleep(d).await;
20783                            continue;
20784                        }
20785
20786                        dlg.finished(false);
20787
20788                        return Err(match error {
20789                            Ok(value) => common::Error::BadRequest(value),
20790                            _ => common::Error::Failure(response),
20791                        });
20792                    }
20793                    let response = {
20794                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20795                        let encoded = common::to_string(&bytes);
20796                        match serde_json::from_str(&encoded) {
20797                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20798                            Err(error) => {
20799                                dlg.response_json_decode_error(&encoded, &error);
20800                                return Err(common::Error::JsonDecodeError(
20801                                    encoded.to_string(),
20802                                    error,
20803                                ));
20804                            }
20805                        }
20806                    };
20807
20808                    dlg.finished(true);
20809                    return Ok(response);
20810                }
20811            }
20812        }
20813    }
20814
20815    ///
20816    /// Sets the *request* property to the given value.
20817    ///
20818    /// Even though the property as already been set when instantiating this call,
20819    /// we provide this method for API completeness.
20820    pub fn request(mut self, new_value: GiftCardClass) -> GiftcardclasInsertCall<'a, C> {
20821        self._request = new_value;
20822        self
20823    }
20824    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20825    /// while executing the actual API request.
20826    ///
20827    /// ````text
20828    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20829    /// ````
20830    ///
20831    /// Sets the *delegate* property to the given value.
20832    pub fn delegate(
20833        mut self,
20834        new_value: &'a mut dyn common::Delegate,
20835    ) -> GiftcardclasInsertCall<'a, C> {
20836        self._delegate = Some(new_value);
20837        self
20838    }
20839
20840    /// Set any additional parameter of the query string used in the request.
20841    /// It should be used to set parameters which are not yet available through their own
20842    /// setters.
20843    ///
20844    /// Please note that this method must not be used to set any of the known parameters
20845    /// which have their own setter method. If done anyway, the request will fail.
20846    ///
20847    /// # Additional Parameters
20848    ///
20849    /// * *$.xgafv* (query-string) - V1 error format.
20850    /// * *access_token* (query-string) - OAuth access token.
20851    /// * *alt* (query-string) - Data format for response.
20852    /// * *callback* (query-string) - JSONP
20853    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20854    /// * *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.
20855    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20856    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20857    /// * *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.
20858    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20859    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20860    pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasInsertCall<'a, C>
20861    where
20862        T: AsRef<str>,
20863    {
20864        self._additional_params
20865            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20866        self
20867    }
20868
20869    /// Identifies the authorization scope for the method you are building.
20870    ///
20871    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20872    /// [`Scope::WalletObjectIssuer`].
20873    ///
20874    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20875    /// tokens for more than one scope.
20876    ///
20877    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20878    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20879    /// sufficient, a read-write scope will do as well.
20880    pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasInsertCall<'a, C>
20881    where
20882        St: AsRef<str>,
20883    {
20884        self._scopes.insert(String::from(scope.as_ref()));
20885        self
20886    }
20887    /// Identifies the authorization scope(s) for the method you are building.
20888    ///
20889    /// See [`Self::add_scope()`] for details.
20890    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasInsertCall<'a, C>
20891    where
20892        I: IntoIterator<Item = St>,
20893        St: AsRef<str>,
20894    {
20895        self._scopes
20896            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20897        self
20898    }
20899
20900    /// Removes all scopes, and no default scope will be used either.
20901    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20902    /// for details).
20903    pub fn clear_scopes(mut self) -> GiftcardclasInsertCall<'a, C> {
20904        self._scopes.clear();
20905        self
20906    }
20907}
20908
20909/// Returns a list of all gift card classes for a given issuer ID.
20910///
20911/// A builder for the *list* method supported by a *giftcardclas* resource.
20912/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
20913///
20914/// # Example
20915///
20916/// Instantiate a resource method builder
20917///
20918/// ```test_harness,no_run
20919/// # extern crate hyper;
20920/// # extern crate hyper_rustls;
20921/// # extern crate google_walletobjects1 as walletobjects1;
20922/// # async fn dox() {
20923/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20924///
20925/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20926/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20927/// #     .with_native_roots()
20928/// #     .unwrap()
20929/// #     .https_only()
20930/// #     .enable_http2()
20931/// #     .build();
20932///
20933/// # let executor = hyper_util::rt::TokioExecutor::new();
20934/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20935/// #     secret,
20936/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20937/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20938/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20939/// #     ),
20940/// # ).build().await.unwrap();
20941///
20942/// # let client = hyper_util::client::legacy::Client::builder(
20943/// #     hyper_util::rt::TokioExecutor::new()
20944/// # )
20945/// # .build(
20946/// #     hyper_rustls::HttpsConnectorBuilder::new()
20947/// #         .with_native_roots()
20948/// #         .unwrap()
20949/// #         .https_or_http()
20950/// #         .enable_http2()
20951/// #         .build()
20952/// # );
20953/// # let mut hub = Walletobjects::new(client, auth);
20954/// // You can configure optional parameters by calling the respective setters at will, and
20955/// // execute the final call using `doit()`.
20956/// // Values shown here are possibly random and not representative !
20957/// let result = hub.giftcardclass().list()
20958///              .token("vero")
20959///              .max_results(-31)
20960///              .issuer_id(-93)
20961///              .doit().await;
20962/// # }
20963/// ```
20964pub struct GiftcardclasListCall<'a, C>
20965where
20966    C: 'a,
20967{
20968    hub: &'a Walletobjects<C>,
20969    _token: Option<String>,
20970    _max_results: Option<i32>,
20971    _issuer_id: Option<i64>,
20972    _delegate: Option<&'a mut dyn common::Delegate>,
20973    _additional_params: HashMap<String, String>,
20974    _scopes: BTreeSet<String>,
20975}
20976
20977impl<'a, C> common::CallBuilder for GiftcardclasListCall<'a, C> {}
20978
20979impl<'a, C> GiftcardclasListCall<'a, C>
20980where
20981    C: common::Connector,
20982{
20983    /// Perform the operation you have build so far.
20984    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClassListResponse)> {
20985        use std::borrow::Cow;
20986        use std::io::{Read, Seek};
20987
20988        use common::{url::Params, ToParts};
20989        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20990
20991        let mut dd = common::DefaultDelegate;
20992        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20993        dlg.begin(common::MethodInfo {
20994            id: "walletobjects.giftcardclass.list",
20995            http_method: hyper::Method::GET,
20996        });
20997
20998        for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
20999            if self._additional_params.contains_key(field) {
21000                dlg.finished(false);
21001                return Err(common::Error::FieldClash(field));
21002            }
21003        }
21004
21005        let mut params = Params::with_capacity(5 + self._additional_params.len());
21006        if let Some(value) = self._token.as_ref() {
21007            params.push("token", value);
21008        }
21009        if let Some(value) = self._max_results.as_ref() {
21010            params.push("maxResults", value.to_string());
21011        }
21012        if let Some(value) = self._issuer_id.as_ref() {
21013            params.push("issuerId", value.to_string());
21014        }
21015
21016        params.extend(self._additional_params.iter());
21017
21018        params.push("alt", "json");
21019        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass";
21020        if self._scopes.is_empty() {
21021            self._scopes
21022                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
21023        }
21024
21025        let url = params.parse_with_url(&url);
21026
21027        loop {
21028            let token = match self
21029                .hub
21030                .auth
21031                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21032                .await
21033            {
21034                Ok(token) => token,
21035                Err(e) => match dlg.token(e) {
21036                    Ok(token) => token,
21037                    Err(e) => {
21038                        dlg.finished(false);
21039                        return Err(common::Error::MissingToken(e));
21040                    }
21041                },
21042            };
21043            let mut req_result = {
21044                let client = &self.hub.client;
21045                dlg.pre_request();
21046                let mut req_builder = hyper::Request::builder()
21047                    .method(hyper::Method::GET)
21048                    .uri(url.as_str())
21049                    .header(USER_AGENT, self.hub._user_agent.clone());
21050
21051                if let Some(token) = token.as_ref() {
21052                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21053                }
21054
21055                let request = req_builder
21056                    .header(CONTENT_LENGTH, 0_u64)
21057                    .body(common::to_body::<String>(None));
21058
21059                client.request(request.unwrap()).await
21060            };
21061
21062            match req_result {
21063                Err(err) => {
21064                    if let common::Retry::After(d) = dlg.http_error(&err) {
21065                        sleep(d).await;
21066                        continue;
21067                    }
21068                    dlg.finished(false);
21069                    return Err(common::Error::HttpError(err));
21070                }
21071                Ok(res) => {
21072                    let (mut parts, body) = res.into_parts();
21073                    let mut body = common::Body::new(body);
21074                    if !parts.status.is_success() {
21075                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21076                        let error = serde_json::from_str(&common::to_string(&bytes));
21077                        let response = common::to_response(parts, bytes.into());
21078
21079                        if let common::Retry::After(d) =
21080                            dlg.http_failure(&response, error.as_ref().ok())
21081                        {
21082                            sleep(d).await;
21083                            continue;
21084                        }
21085
21086                        dlg.finished(false);
21087
21088                        return Err(match error {
21089                            Ok(value) => common::Error::BadRequest(value),
21090                            _ => common::Error::Failure(response),
21091                        });
21092                    }
21093                    let response = {
21094                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21095                        let encoded = common::to_string(&bytes);
21096                        match serde_json::from_str(&encoded) {
21097                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21098                            Err(error) => {
21099                                dlg.response_json_decode_error(&encoded, &error);
21100                                return Err(common::Error::JsonDecodeError(
21101                                    encoded.to_string(),
21102                                    error,
21103                                ));
21104                            }
21105                        }
21106                    };
21107
21108                    dlg.finished(true);
21109                    return Ok(response);
21110                }
21111            }
21112        }
21113    }
21114
21115    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` classes are available in a list. For example, if you have a list of 200 classes and you call list with `maxResults` set to 20, list will return the first 20 classes and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 classes.
21116    ///
21117    /// Sets the *token* query property to the given value.
21118    pub fn token(mut self, new_value: &str) -> GiftcardclasListCall<'a, C> {
21119        self._token = Some(new_value.to_string());
21120        self
21121    }
21122    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
21123    ///
21124    /// Sets the *max results* query property to the given value.
21125    pub fn max_results(mut self, new_value: i32) -> GiftcardclasListCall<'a, C> {
21126        self._max_results = Some(new_value);
21127        self
21128    }
21129    /// The ID of the issuer authorized to list classes.
21130    ///
21131    /// Sets the *issuer id* query property to the given value.
21132    pub fn issuer_id(mut self, new_value: i64) -> GiftcardclasListCall<'a, C> {
21133        self._issuer_id = Some(new_value);
21134        self
21135    }
21136    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21137    /// while executing the actual API request.
21138    ///
21139    /// ````text
21140    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21141    /// ````
21142    ///
21143    /// Sets the *delegate* property to the given value.
21144    pub fn delegate(
21145        mut self,
21146        new_value: &'a mut dyn common::Delegate,
21147    ) -> GiftcardclasListCall<'a, C> {
21148        self._delegate = Some(new_value);
21149        self
21150    }
21151
21152    /// Set any additional parameter of the query string used in the request.
21153    /// It should be used to set parameters which are not yet available through their own
21154    /// setters.
21155    ///
21156    /// Please note that this method must not be used to set any of the known parameters
21157    /// which have their own setter method. If done anyway, the request will fail.
21158    ///
21159    /// # Additional Parameters
21160    ///
21161    /// * *$.xgafv* (query-string) - V1 error format.
21162    /// * *access_token* (query-string) - OAuth access token.
21163    /// * *alt* (query-string) - Data format for response.
21164    /// * *callback* (query-string) - JSONP
21165    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21166    /// * *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.
21167    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21168    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21169    /// * *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.
21170    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21171    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21172    pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasListCall<'a, C>
21173    where
21174        T: AsRef<str>,
21175    {
21176        self._additional_params
21177            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21178        self
21179    }
21180
21181    /// Identifies the authorization scope for the method you are building.
21182    ///
21183    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21184    /// [`Scope::WalletObjectIssuer`].
21185    ///
21186    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21187    /// tokens for more than one scope.
21188    ///
21189    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21190    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21191    /// sufficient, a read-write scope will do as well.
21192    pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasListCall<'a, C>
21193    where
21194        St: AsRef<str>,
21195    {
21196        self._scopes.insert(String::from(scope.as_ref()));
21197        self
21198    }
21199    /// Identifies the authorization scope(s) for the method you are building.
21200    ///
21201    /// See [`Self::add_scope()`] for details.
21202    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasListCall<'a, C>
21203    where
21204        I: IntoIterator<Item = St>,
21205        St: AsRef<str>,
21206    {
21207        self._scopes
21208            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21209        self
21210    }
21211
21212    /// Removes all scopes, and no default scope will be used either.
21213    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21214    /// for details).
21215    pub fn clear_scopes(mut self) -> GiftcardclasListCall<'a, C> {
21216        self._scopes.clear();
21217        self
21218    }
21219}
21220
21221/// Updates the gift card class referenced by the given class ID. This method supports patch semantics.
21222///
21223/// A builder for the *patch* method supported by a *giftcardclas* resource.
21224/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
21225///
21226/// # Example
21227///
21228/// Instantiate a resource method builder
21229///
21230/// ```test_harness,no_run
21231/// # extern crate hyper;
21232/// # extern crate hyper_rustls;
21233/// # extern crate google_walletobjects1 as walletobjects1;
21234/// use walletobjects1::api::GiftCardClass;
21235/// # async fn dox() {
21236/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21237///
21238/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21239/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21240/// #     .with_native_roots()
21241/// #     .unwrap()
21242/// #     .https_only()
21243/// #     .enable_http2()
21244/// #     .build();
21245///
21246/// # let executor = hyper_util::rt::TokioExecutor::new();
21247/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21248/// #     secret,
21249/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21250/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21251/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21252/// #     ),
21253/// # ).build().await.unwrap();
21254///
21255/// # let client = hyper_util::client::legacy::Client::builder(
21256/// #     hyper_util::rt::TokioExecutor::new()
21257/// # )
21258/// # .build(
21259/// #     hyper_rustls::HttpsConnectorBuilder::new()
21260/// #         .with_native_roots()
21261/// #         .unwrap()
21262/// #         .https_or_http()
21263/// #         .enable_http2()
21264/// #         .build()
21265/// # );
21266/// # let mut hub = Walletobjects::new(client, auth);
21267/// // As the method needs a request, you would usually fill it with the desired information
21268/// // into the respective structure. Some of the parts shown here might not be applicable !
21269/// // Values shown here are possibly random and not representative !
21270/// let mut req = GiftCardClass::default();
21271///
21272/// // You can configure optional parameters by calling the respective setters at will, and
21273/// // execute the final call using `doit()`.
21274/// // Values shown here are possibly random and not representative !
21275/// let result = hub.giftcardclass().patch(req, "resourceId")
21276///              .doit().await;
21277/// # }
21278/// ```
21279pub struct GiftcardclasPatchCall<'a, C>
21280where
21281    C: 'a,
21282{
21283    hub: &'a Walletobjects<C>,
21284    _request: GiftCardClass,
21285    _resource_id: String,
21286    _delegate: Option<&'a mut dyn common::Delegate>,
21287    _additional_params: HashMap<String, String>,
21288    _scopes: BTreeSet<String>,
21289}
21290
21291impl<'a, C> common::CallBuilder for GiftcardclasPatchCall<'a, C> {}
21292
21293impl<'a, C> GiftcardclasPatchCall<'a, C>
21294where
21295    C: common::Connector,
21296{
21297    /// Perform the operation you have build so far.
21298    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClass)> {
21299        use std::borrow::Cow;
21300        use std::io::{Read, Seek};
21301
21302        use common::{url::Params, ToParts};
21303        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21304
21305        let mut dd = common::DefaultDelegate;
21306        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21307        dlg.begin(common::MethodInfo {
21308            id: "walletobjects.giftcardclass.patch",
21309            http_method: hyper::Method::PATCH,
21310        });
21311
21312        for &field in ["alt", "resourceId"].iter() {
21313            if self._additional_params.contains_key(field) {
21314                dlg.finished(false);
21315                return Err(common::Error::FieldClash(field));
21316            }
21317        }
21318
21319        let mut params = Params::with_capacity(4 + self._additional_params.len());
21320        params.push("resourceId", self._resource_id);
21321
21322        params.extend(self._additional_params.iter());
21323
21324        params.push("alt", "json");
21325        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass/{resourceId}";
21326        if self._scopes.is_empty() {
21327            self._scopes
21328                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
21329        }
21330
21331        #[allow(clippy::single_element_loop)]
21332        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
21333            url = params.uri_replacement(url, param_name, find_this, false);
21334        }
21335        {
21336            let to_remove = ["resourceId"];
21337            params.remove_params(&to_remove);
21338        }
21339
21340        let url = params.parse_with_url(&url);
21341
21342        let mut json_mime_type = mime::APPLICATION_JSON;
21343        let mut request_value_reader = {
21344            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21345            common::remove_json_null_values(&mut value);
21346            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21347            serde_json::to_writer(&mut dst, &value).unwrap();
21348            dst
21349        };
21350        let request_size = request_value_reader
21351            .seek(std::io::SeekFrom::End(0))
21352            .unwrap();
21353        request_value_reader
21354            .seek(std::io::SeekFrom::Start(0))
21355            .unwrap();
21356
21357        loop {
21358            let token = match self
21359                .hub
21360                .auth
21361                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21362                .await
21363            {
21364                Ok(token) => token,
21365                Err(e) => match dlg.token(e) {
21366                    Ok(token) => token,
21367                    Err(e) => {
21368                        dlg.finished(false);
21369                        return Err(common::Error::MissingToken(e));
21370                    }
21371                },
21372            };
21373            request_value_reader
21374                .seek(std::io::SeekFrom::Start(0))
21375                .unwrap();
21376            let mut req_result = {
21377                let client = &self.hub.client;
21378                dlg.pre_request();
21379                let mut req_builder = hyper::Request::builder()
21380                    .method(hyper::Method::PATCH)
21381                    .uri(url.as_str())
21382                    .header(USER_AGENT, self.hub._user_agent.clone());
21383
21384                if let Some(token) = token.as_ref() {
21385                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21386                }
21387
21388                let request = req_builder
21389                    .header(CONTENT_TYPE, json_mime_type.to_string())
21390                    .header(CONTENT_LENGTH, request_size as u64)
21391                    .body(common::to_body(
21392                        request_value_reader.get_ref().clone().into(),
21393                    ));
21394
21395                client.request(request.unwrap()).await
21396            };
21397
21398            match req_result {
21399                Err(err) => {
21400                    if let common::Retry::After(d) = dlg.http_error(&err) {
21401                        sleep(d).await;
21402                        continue;
21403                    }
21404                    dlg.finished(false);
21405                    return Err(common::Error::HttpError(err));
21406                }
21407                Ok(res) => {
21408                    let (mut parts, body) = res.into_parts();
21409                    let mut body = common::Body::new(body);
21410                    if !parts.status.is_success() {
21411                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21412                        let error = serde_json::from_str(&common::to_string(&bytes));
21413                        let response = common::to_response(parts, bytes.into());
21414
21415                        if let common::Retry::After(d) =
21416                            dlg.http_failure(&response, error.as_ref().ok())
21417                        {
21418                            sleep(d).await;
21419                            continue;
21420                        }
21421
21422                        dlg.finished(false);
21423
21424                        return Err(match error {
21425                            Ok(value) => common::Error::BadRequest(value),
21426                            _ => common::Error::Failure(response),
21427                        });
21428                    }
21429                    let response = {
21430                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21431                        let encoded = common::to_string(&bytes);
21432                        match serde_json::from_str(&encoded) {
21433                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21434                            Err(error) => {
21435                                dlg.response_json_decode_error(&encoded, &error);
21436                                return Err(common::Error::JsonDecodeError(
21437                                    encoded.to_string(),
21438                                    error,
21439                                ));
21440                            }
21441                        }
21442                    };
21443
21444                    dlg.finished(true);
21445                    return Ok(response);
21446                }
21447            }
21448        }
21449    }
21450
21451    ///
21452    /// Sets the *request* property to the given value.
21453    ///
21454    /// Even though the property as already been set when instantiating this call,
21455    /// we provide this method for API completeness.
21456    pub fn request(mut self, new_value: GiftCardClass) -> GiftcardclasPatchCall<'a, C> {
21457        self._request = new_value;
21458        self
21459    }
21460    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
21461    ///
21462    /// Sets the *resource id* path property to the given value.
21463    ///
21464    /// Even though the property as already been set when instantiating this call,
21465    /// we provide this method for API completeness.
21466    pub fn resource_id(mut self, new_value: &str) -> GiftcardclasPatchCall<'a, C> {
21467        self._resource_id = new_value.to_string();
21468        self
21469    }
21470    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21471    /// while executing the actual API request.
21472    ///
21473    /// ````text
21474    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21475    /// ````
21476    ///
21477    /// Sets the *delegate* property to the given value.
21478    pub fn delegate(
21479        mut self,
21480        new_value: &'a mut dyn common::Delegate,
21481    ) -> GiftcardclasPatchCall<'a, C> {
21482        self._delegate = Some(new_value);
21483        self
21484    }
21485
21486    /// Set any additional parameter of the query string used in the request.
21487    /// It should be used to set parameters which are not yet available through their own
21488    /// setters.
21489    ///
21490    /// Please note that this method must not be used to set any of the known parameters
21491    /// which have their own setter method. If done anyway, the request will fail.
21492    ///
21493    /// # Additional Parameters
21494    ///
21495    /// * *$.xgafv* (query-string) - V1 error format.
21496    /// * *access_token* (query-string) - OAuth access token.
21497    /// * *alt* (query-string) - Data format for response.
21498    /// * *callback* (query-string) - JSONP
21499    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21500    /// * *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.
21501    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21502    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21503    /// * *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.
21504    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21505    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21506    pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasPatchCall<'a, C>
21507    where
21508        T: AsRef<str>,
21509    {
21510        self._additional_params
21511            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21512        self
21513    }
21514
21515    /// Identifies the authorization scope for the method you are building.
21516    ///
21517    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21518    /// [`Scope::WalletObjectIssuer`].
21519    ///
21520    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21521    /// tokens for more than one scope.
21522    ///
21523    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21524    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21525    /// sufficient, a read-write scope will do as well.
21526    pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasPatchCall<'a, C>
21527    where
21528        St: AsRef<str>,
21529    {
21530        self._scopes.insert(String::from(scope.as_ref()));
21531        self
21532    }
21533    /// Identifies the authorization scope(s) for the method you are building.
21534    ///
21535    /// See [`Self::add_scope()`] for details.
21536    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasPatchCall<'a, C>
21537    where
21538        I: IntoIterator<Item = St>,
21539        St: AsRef<str>,
21540    {
21541        self._scopes
21542            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21543        self
21544    }
21545
21546    /// Removes all scopes, and no default scope will be used either.
21547    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21548    /// for details).
21549    pub fn clear_scopes(mut self) -> GiftcardclasPatchCall<'a, C> {
21550        self._scopes.clear();
21551        self
21552    }
21553}
21554
21555/// Updates the gift card class referenced by the given class ID.
21556///
21557/// A builder for the *update* method supported by a *giftcardclas* resource.
21558/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
21559///
21560/// # Example
21561///
21562/// Instantiate a resource method builder
21563///
21564/// ```test_harness,no_run
21565/// # extern crate hyper;
21566/// # extern crate hyper_rustls;
21567/// # extern crate google_walletobjects1 as walletobjects1;
21568/// use walletobjects1::api::GiftCardClass;
21569/// # async fn dox() {
21570/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21571///
21572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21573/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21574/// #     .with_native_roots()
21575/// #     .unwrap()
21576/// #     .https_only()
21577/// #     .enable_http2()
21578/// #     .build();
21579///
21580/// # let executor = hyper_util::rt::TokioExecutor::new();
21581/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21582/// #     secret,
21583/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21584/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21585/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21586/// #     ),
21587/// # ).build().await.unwrap();
21588///
21589/// # let client = hyper_util::client::legacy::Client::builder(
21590/// #     hyper_util::rt::TokioExecutor::new()
21591/// # )
21592/// # .build(
21593/// #     hyper_rustls::HttpsConnectorBuilder::new()
21594/// #         .with_native_roots()
21595/// #         .unwrap()
21596/// #         .https_or_http()
21597/// #         .enable_http2()
21598/// #         .build()
21599/// # );
21600/// # let mut hub = Walletobjects::new(client, auth);
21601/// // As the method needs a request, you would usually fill it with the desired information
21602/// // into the respective structure. Some of the parts shown here might not be applicable !
21603/// // Values shown here are possibly random and not representative !
21604/// let mut req = GiftCardClass::default();
21605///
21606/// // You can configure optional parameters by calling the respective setters at will, and
21607/// // execute the final call using `doit()`.
21608/// // Values shown here are possibly random and not representative !
21609/// let result = hub.giftcardclass().update(req, "resourceId")
21610///              .doit().await;
21611/// # }
21612/// ```
21613pub struct GiftcardclasUpdateCall<'a, C>
21614where
21615    C: 'a,
21616{
21617    hub: &'a Walletobjects<C>,
21618    _request: GiftCardClass,
21619    _resource_id: String,
21620    _delegate: Option<&'a mut dyn common::Delegate>,
21621    _additional_params: HashMap<String, String>,
21622    _scopes: BTreeSet<String>,
21623}
21624
21625impl<'a, C> common::CallBuilder for GiftcardclasUpdateCall<'a, C> {}
21626
21627impl<'a, C> GiftcardclasUpdateCall<'a, C>
21628where
21629    C: common::Connector,
21630{
21631    /// Perform the operation you have build so far.
21632    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClass)> {
21633        use std::borrow::Cow;
21634        use std::io::{Read, Seek};
21635
21636        use common::{url::Params, ToParts};
21637        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21638
21639        let mut dd = common::DefaultDelegate;
21640        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21641        dlg.begin(common::MethodInfo {
21642            id: "walletobjects.giftcardclass.update",
21643            http_method: hyper::Method::PUT,
21644        });
21645
21646        for &field in ["alt", "resourceId"].iter() {
21647            if self._additional_params.contains_key(field) {
21648                dlg.finished(false);
21649                return Err(common::Error::FieldClash(field));
21650            }
21651        }
21652
21653        let mut params = Params::with_capacity(4 + self._additional_params.len());
21654        params.push("resourceId", self._resource_id);
21655
21656        params.extend(self._additional_params.iter());
21657
21658        params.push("alt", "json");
21659        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass/{resourceId}";
21660        if self._scopes.is_empty() {
21661            self._scopes
21662                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
21663        }
21664
21665        #[allow(clippy::single_element_loop)]
21666        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
21667            url = params.uri_replacement(url, param_name, find_this, false);
21668        }
21669        {
21670            let to_remove = ["resourceId"];
21671            params.remove_params(&to_remove);
21672        }
21673
21674        let url = params.parse_with_url(&url);
21675
21676        let mut json_mime_type = mime::APPLICATION_JSON;
21677        let mut request_value_reader = {
21678            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21679            common::remove_json_null_values(&mut value);
21680            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21681            serde_json::to_writer(&mut dst, &value).unwrap();
21682            dst
21683        };
21684        let request_size = request_value_reader
21685            .seek(std::io::SeekFrom::End(0))
21686            .unwrap();
21687        request_value_reader
21688            .seek(std::io::SeekFrom::Start(0))
21689            .unwrap();
21690
21691        loop {
21692            let token = match self
21693                .hub
21694                .auth
21695                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21696                .await
21697            {
21698                Ok(token) => token,
21699                Err(e) => match dlg.token(e) {
21700                    Ok(token) => token,
21701                    Err(e) => {
21702                        dlg.finished(false);
21703                        return Err(common::Error::MissingToken(e));
21704                    }
21705                },
21706            };
21707            request_value_reader
21708                .seek(std::io::SeekFrom::Start(0))
21709                .unwrap();
21710            let mut req_result = {
21711                let client = &self.hub.client;
21712                dlg.pre_request();
21713                let mut req_builder = hyper::Request::builder()
21714                    .method(hyper::Method::PUT)
21715                    .uri(url.as_str())
21716                    .header(USER_AGENT, self.hub._user_agent.clone());
21717
21718                if let Some(token) = token.as_ref() {
21719                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21720                }
21721
21722                let request = req_builder
21723                    .header(CONTENT_TYPE, json_mime_type.to_string())
21724                    .header(CONTENT_LENGTH, request_size as u64)
21725                    .body(common::to_body(
21726                        request_value_reader.get_ref().clone().into(),
21727                    ));
21728
21729                client.request(request.unwrap()).await
21730            };
21731
21732            match req_result {
21733                Err(err) => {
21734                    if let common::Retry::After(d) = dlg.http_error(&err) {
21735                        sleep(d).await;
21736                        continue;
21737                    }
21738                    dlg.finished(false);
21739                    return Err(common::Error::HttpError(err));
21740                }
21741                Ok(res) => {
21742                    let (mut parts, body) = res.into_parts();
21743                    let mut body = common::Body::new(body);
21744                    if !parts.status.is_success() {
21745                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21746                        let error = serde_json::from_str(&common::to_string(&bytes));
21747                        let response = common::to_response(parts, bytes.into());
21748
21749                        if let common::Retry::After(d) =
21750                            dlg.http_failure(&response, error.as_ref().ok())
21751                        {
21752                            sleep(d).await;
21753                            continue;
21754                        }
21755
21756                        dlg.finished(false);
21757
21758                        return Err(match error {
21759                            Ok(value) => common::Error::BadRequest(value),
21760                            _ => common::Error::Failure(response),
21761                        });
21762                    }
21763                    let response = {
21764                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21765                        let encoded = common::to_string(&bytes);
21766                        match serde_json::from_str(&encoded) {
21767                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21768                            Err(error) => {
21769                                dlg.response_json_decode_error(&encoded, &error);
21770                                return Err(common::Error::JsonDecodeError(
21771                                    encoded.to_string(),
21772                                    error,
21773                                ));
21774                            }
21775                        }
21776                    };
21777
21778                    dlg.finished(true);
21779                    return Ok(response);
21780                }
21781            }
21782        }
21783    }
21784
21785    ///
21786    /// Sets the *request* property to the given value.
21787    ///
21788    /// Even though the property as already been set when instantiating this call,
21789    /// we provide this method for API completeness.
21790    pub fn request(mut self, new_value: GiftCardClass) -> GiftcardclasUpdateCall<'a, C> {
21791        self._request = new_value;
21792        self
21793    }
21794    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
21795    ///
21796    /// Sets the *resource id* path property to the given value.
21797    ///
21798    /// Even though the property as already been set when instantiating this call,
21799    /// we provide this method for API completeness.
21800    pub fn resource_id(mut self, new_value: &str) -> GiftcardclasUpdateCall<'a, C> {
21801        self._resource_id = new_value.to_string();
21802        self
21803    }
21804    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21805    /// while executing the actual API request.
21806    ///
21807    /// ````text
21808    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21809    /// ````
21810    ///
21811    /// Sets the *delegate* property to the given value.
21812    pub fn delegate(
21813        mut self,
21814        new_value: &'a mut dyn common::Delegate,
21815    ) -> GiftcardclasUpdateCall<'a, C> {
21816        self._delegate = Some(new_value);
21817        self
21818    }
21819
21820    /// Set any additional parameter of the query string used in the request.
21821    /// It should be used to set parameters which are not yet available through their own
21822    /// setters.
21823    ///
21824    /// Please note that this method must not be used to set any of the known parameters
21825    /// which have their own setter method. If done anyway, the request will fail.
21826    ///
21827    /// # Additional Parameters
21828    ///
21829    /// * *$.xgafv* (query-string) - V1 error format.
21830    /// * *access_token* (query-string) - OAuth access token.
21831    /// * *alt* (query-string) - Data format for response.
21832    /// * *callback* (query-string) - JSONP
21833    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21834    /// * *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.
21835    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21836    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21837    /// * *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.
21838    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21839    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21840    pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasUpdateCall<'a, C>
21841    where
21842        T: AsRef<str>,
21843    {
21844        self._additional_params
21845            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21846        self
21847    }
21848
21849    /// Identifies the authorization scope for the method you are building.
21850    ///
21851    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21852    /// [`Scope::WalletObjectIssuer`].
21853    ///
21854    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21855    /// tokens for more than one scope.
21856    ///
21857    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21858    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21859    /// sufficient, a read-write scope will do as well.
21860    pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasUpdateCall<'a, C>
21861    where
21862        St: AsRef<str>,
21863    {
21864        self._scopes.insert(String::from(scope.as_ref()));
21865        self
21866    }
21867    /// Identifies the authorization scope(s) for the method you are building.
21868    ///
21869    /// See [`Self::add_scope()`] for details.
21870    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasUpdateCall<'a, C>
21871    where
21872        I: IntoIterator<Item = St>,
21873        St: AsRef<str>,
21874    {
21875        self._scopes
21876            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21877        self
21878    }
21879
21880    /// Removes all scopes, and no default scope will be used either.
21881    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21882    /// for details).
21883    pub fn clear_scopes(mut self) -> GiftcardclasUpdateCall<'a, C> {
21884        self._scopes.clear();
21885        self
21886    }
21887}
21888
21889/// Adds a message to the gift card object referenced by the given object ID.
21890///
21891/// A builder for the *addmessage* method supported by a *giftcardobject* resource.
21892/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
21893///
21894/// # Example
21895///
21896/// Instantiate a resource method builder
21897///
21898/// ```test_harness,no_run
21899/// # extern crate hyper;
21900/// # extern crate hyper_rustls;
21901/// # extern crate google_walletobjects1 as walletobjects1;
21902/// use walletobjects1::api::AddMessageRequest;
21903/// # async fn dox() {
21904/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21905///
21906/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21907/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21908/// #     .with_native_roots()
21909/// #     .unwrap()
21910/// #     .https_only()
21911/// #     .enable_http2()
21912/// #     .build();
21913///
21914/// # let executor = hyper_util::rt::TokioExecutor::new();
21915/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21916/// #     secret,
21917/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21918/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21919/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21920/// #     ),
21921/// # ).build().await.unwrap();
21922///
21923/// # let client = hyper_util::client::legacy::Client::builder(
21924/// #     hyper_util::rt::TokioExecutor::new()
21925/// # )
21926/// # .build(
21927/// #     hyper_rustls::HttpsConnectorBuilder::new()
21928/// #         .with_native_roots()
21929/// #         .unwrap()
21930/// #         .https_or_http()
21931/// #         .enable_http2()
21932/// #         .build()
21933/// # );
21934/// # let mut hub = Walletobjects::new(client, auth);
21935/// // As the method needs a request, you would usually fill it with the desired information
21936/// // into the respective structure. Some of the parts shown here might not be applicable !
21937/// // Values shown here are possibly random and not representative !
21938/// let mut req = AddMessageRequest::default();
21939///
21940/// // You can configure optional parameters by calling the respective setters at will, and
21941/// // execute the final call using `doit()`.
21942/// // Values shown here are possibly random and not representative !
21943/// let result = hub.giftcardobject().addmessage(req, "resourceId")
21944///              .doit().await;
21945/// # }
21946/// ```
21947pub struct GiftcardobjectAddmessageCall<'a, C>
21948where
21949    C: 'a,
21950{
21951    hub: &'a Walletobjects<C>,
21952    _request: AddMessageRequest,
21953    _resource_id: String,
21954    _delegate: Option<&'a mut dyn common::Delegate>,
21955    _additional_params: HashMap<String, String>,
21956    _scopes: BTreeSet<String>,
21957}
21958
21959impl<'a, C> common::CallBuilder for GiftcardobjectAddmessageCall<'a, C> {}
21960
21961impl<'a, C> GiftcardobjectAddmessageCall<'a, C>
21962where
21963    C: common::Connector,
21964{
21965    /// Perform the operation you have build so far.
21966    pub async fn doit(
21967        mut self,
21968    ) -> common::Result<(common::Response, GiftCardObjectAddMessageResponse)> {
21969        use std::borrow::Cow;
21970        use std::io::{Read, Seek};
21971
21972        use common::{url::Params, ToParts};
21973        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21974
21975        let mut dd = common::DefaultDelegate;
21976        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21977        dlg.begin(common::MethodInfo {
21978            id: "walletobjects.giftcardobject.addmessage",
21979            http_method: hyper::Method::POST,
21980        });
21981
21982        for &field in ["alt", "resourceId"].iter() {
21983            if self._additional_params.contains_key(field) {
21984                dlg.finished(false);
21985                return Err(common::Error::FieldClash(field));
21986            }
21987        }
21988
21989        let mut params = Params::with_capacity(4 + self._additional_params.len());
21990        params.push("resourceId", self._resource_id);
21991
21992        params.extend(self._additional_params.iter());
21993
21994        params.push("alt", "json");
21995        let mut url =
21996            self.hub._base_url.clone() + "walletobjects/v1/giftCardObject/{resourceId}/addMessage";
21997        if self._scopes.is_empty() {
21998            self._scopes
21999                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
22000        }
22001
22002        #[allow(clippy::single_element_loop)]
22003        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
22004            url = params.uri_replacement(url, param_name, find_this, false);
22005        }
22006        {
22007            let to_remove = ["resourceId"];
22008            params.remove_params(&to_remove);
22009        }
22010
22011        let url = params.parse_with_url(&url);
22012
22013        let mut json_mime_type = mime::APPLICATION_JSON;
22014        let mut request_value_reader = {
22015            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22016            common::remove_json_null_values(&mut value);
22017            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22018            serde_json::to_writer(&mut dst, &value).unwrap();
22019            dst
22020        };
22021        let request_size = request_value_reader
22022            .seek(std::io::SeekFrom::End(0))
22023            .unwrap();
22024        request_value_reader
22025            .seek(std::io::SeekFrom::Start(0))
22026            .unwrap();
22027
22028        loop {
22029            let token = match self
22030                .hub
22031                .auth
22032                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22033                .await
22034            {
22035                Ok(token) => token,
22036                Err(e) => match dlg.token(e) {
22037                    Ok(token) => token,
22038                    Err(e) => {
22039                        dlg.finished(false);
22040                        return Err(common::Error::MissingToken(e));
22041                    }
22042                },
22043            };
22044            request_value_reader
22045                .seek(std::io::SeekFrom::Start(0))
22046                .unwrap();
22047            let mut req_result = {
22048                let client = &self.hub.client;
22049                dlg.pre_request();
22050                let mut req_builder = hyper::Request::builder()
22051                    .method(hyper::Method::POST)
22052                    .uri(url.as_str())
22053                    .header(USER_AGENT, self.hub._user_agent.clone());
22054
22055                if let Some(token) = token.as_ref() {
22056                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22057                }
22058
22059                let request = req_builder
22060                    .header(CONTENT_TYPE, json_mime_type.to_string())
22061                    .header(CONTENT_LENGTH, request_size as u64)
22062                    .body(common::to_body(
22063                        request_value_reader.get_ref().clone().into(),
22064                    ));
22065
22066                client.request(request.unwrap()).await
22067            };
22068
22069            match req_result {
22070                Err(err) => {
22071                    if let common::Retry::After(d) = dlg.http_error(&err) {
22072                        sleep(d).await;
22073                        continue;
22074                    }
22075                    dlg.finished(false);
22076                    return Err(common::Error::HttpError(err));
22077                }
22078                Ok(res) => {
22079                    let (mut parts, body) = res.into_parts();
22080                    let mut body = common::Body::new(body);
22081                    if !parts.status.is_success() {
22082                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22083                        let error = serde_json::from_str(&common::to_string(&bytes));
22084                        let response = common::to_response(parts, bytes.into());
22085
22086                        if let common::Retry::After(d) =
22087                            dlg.http_failure(&response, error.as_ref().ok())
22088                        {
22089                            sleep(d).await;
22090                            continue;
22091                        }
22092
22093                        dlg.finished(false);
22094
22095                        return Err(match error {
22096                            Ok(value) => common::Error::BadRequest(value),
22097                            _ => common::Error::Failure(response),
22098                        });
22099                    }
22100                    let response = {
22101                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22102                        let encoded = common::to_string(&bytes);
22103                        match serde_json::from_str(&encoded) {
22104                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22105                            Err(error) => {
22106                                dlg.response_json_decode_error(&encoded, &error);
22107                                return Err(common::Error::JsonDecodeError(
22108                                    encoded.to_string(),
22109                                    error,
22110                                ));
22111                            }
22112                        }
22113                    };
22114
22115                    dlg.finished(true);
22116                    return Ok(response);
22117                }
22118            }
22119        }
22120    }
22121
22122    ///
22123    /// Sets the *request* property to the given value.
22124    ///
22125    /// Even though the property as already been set when instantiating this call,
22126    /// we provide this method for API completeness.
22127    pub fn request(mut self, new_value: AddMessageRequest) -> GiftcardobjectAddmessageCall<'a, C> {
22128        self._request = new_value;
22129        self
22130    }
22131    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
22132    ///
22133    /// Sets the *resource id* path property to the given value.
22134    ///
22135    /// Even though the property as already been set when instantiating this call,
22136    /// we provide this method for API completeness.
22137    pub fn resource_id(mut self, new_value: &str) -> GiftcardobjectAddmessageCall<'a, C> {
22138        self._resource_id = new_value.to_string();
22139        self
22140    }
22141    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22142    /// while executing the actual API request.
22143    ///
22144    /// ````text
22145    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22146    /// ````
22147    ///
22148    /// Sets the *delegate* property to the given value.
22149    pub fn delegate(
22150        mut self,
22151        new_value: &'a mut dyn common::Delegate,
22152    ) -> GiftcardobjectAddmessageCall<'a, C> {
22153        self._delegate = Some(new_value);
22154        self
22155    }
22156
22157    /// Set any additional parameter of the query string used in the request.
22158    /// It should be used to set parameters which are not yet available through their own
22159    /// setters.
22160    ///
22161    /// Please note that this method must not be used to set any of the known parameters
22162    /// which have their own setter method. If done anyway, the request will fail.
22163    ///
22164    /// # Additional Parameters
22165    ///
22166    /// * *$.xgafv* (query-string) - V1 error format.
22167    /// * *access_token* (query-string) - OAuth access token.
22168    /// * *alt* (query-string) - Data format for response.
22169    /// * *callback* (query-string) - JSONP
22170    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22171    /// * *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.
22172    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22173    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22174    /// * *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.
22175    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22176    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22177    pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectAddmessageCall<'a, C>
22178    where
22179        T: AsRef<str>,
22180    {
22181        self._additional_params
22182            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22183        self
22184    }
22185
22186    /// Identifies the authorization scope for the method you are building.
22187    ///
22188    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22189    /// [`Scope::WalletObjectIssuer`].
22190    ///
22191    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22192    /// tokens for more than one scope.
22193    ///
22194    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22195    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22196    /// sufficient, a read-write scope will do as well.
22197    pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectAddmessageCall<'a, C>
22198    where
22199        St: AsRef<str>,
22200    {
22201        self._scopes.insert(String::from(scope.as_ref()));
22202        self
22203    }
22204    /// Identifies the authorization scope(s) for the method you are building.
22205    ///
22206    /// See [`Self::add_scope()`] for details.
22207    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectAddmessageCall<'a, C>
22208    where
22209        I: IntoIterator<Item = St>,
22210        St: AsRef<str>,
22211    {
22212        self._scopes
22213            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22214        self
22215    }
22216
22217    /// Removes all scopes, and no default scope will be used either.
22218    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22219    /// for details).
22220    pub fn clear_scopes(mut self) -> GiftcardobjectAddmessageCall<'a, C> {
22221        self._scopes.clear();
22222        self
22223    }
22224}
22225
22226/// Returns the gift card object with the given object ID.
22227///
22228/// A builder for the *get* method supported by a *giftcardobject* resource.
22229/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
22230///
22231/// # Example
22232///
22233/// Instantiate a resource method builder
22234///
22235/// ```test_harness,no_run
22236/// # extern crate hyper;
22237/// # extern crate hyper_rustls;
22238/// # extern crate google_walletobjects1 as walletobjects1;
22239/// # async fn dox() {
22240/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22241///
22242/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22243/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22244/// #     .with_native_roots()
22245/// #     .unwrap()
22246/// #     .https_only()
22247/// #     .enable_http2()
22248/// #     .build();
22249///
22250/// # let executor = hyper_util::rt::TokioExecutor::new();
22251/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22252/// #     secret,
22253/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22254/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22255/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22256/// #     ),
22257/// # ).build().await.unwrap();
22258///
22259/// # let client = hyper_util::client::legacy::Client::builder(
22260/// #     hyper_util::rt::TokioExecutor::new()
22261/// # )
22262/// # .build(
22263/// #     hyper_rustls::HttpsConnectorBuilder::new()
22264/// #         .with_native_roots()
22265/// #         .unwrap()
22266/// #         .https_or_http()
22267/// #         .enable_http2()
22268/// #         .build()
22269/// # );
22270/// # let mut hub = Walletobjects::new(client, auth);
22271/// // You can configure optional parameters by calling the respective setters at will, and
22272/// // execute the final call using `doit()`.
22273/// // Values shown here are possibly random and not representative !
22274/// let result = hub.giftcardobject().get("resourceId")
22275///              .doit().await;
22276/// # }
22277/// ```
22278pub struct GiftcardobjectGetCall<'a, C>
22279where
22280    C: 'a,
22281{
22282    hub: &'a Walletobjects<C>,
22283    _resource_id: String,
22284    _delegate: Option<&'a mut dyn common::Delegate>,
22285    _additional_params: HashMap<String, String>,
22286    _scopes: BTreeSet<String>,
22287}
22288
22289impl<'a, C> common::CallBuilder for GiftcardobjectGetCall<'a, C> {}
22290
22291impl<'a, C> GiftcardobjectGetCall<'a, C>
22292where
22293    C: common::Connector,
22294{
22295    /// Perform the operation you have build so far.
22296    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObject)> {
22297        use std::borrow::Cow;
22298        use std::io::{Read, Seek};
22299
22300        use common::{url::Params, ToParts};
22301        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22302
22303        let mut dd = common::DefaultDelegate;
22304        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22305        dlg.begin(common::MethodInfo {
22306            id: "walletobjects.giftcardobject.get",
22307            http_method: hyper::Method::GET,
22308        });
22309
22310        for &field in ["alt", "resourceId"].iter() {
22311            if self._additional_params.contains_key(field) {
22312                dlg.finished(false);
22313                return Err(common::Error::FieldClash(field));
22314            }
22315        }
22316
22317        let mut params = Params::with_capacity(3 + self._additional_params.len());
22318        params.push("resourceId", self._resource_id);
22319
22320        params.extend(self._additional_params.iter());
22321
22322        params.push("alt", "json");
22323        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject/{resourceId}";
22324        if self._scopes.is_empty() {
22325            self._scopes
22326                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
22327        }
22328
22329        #[allow(clippy::single_element_loop)]
22330        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
22331            url = params.uri_replacement(url, param_name, find_this, false);
22332        }
22333        {
22334            let to_remove = ["resourceId"];
22335            params.remove_params(&to_remove);
22336        }
22337
22338        let url = params.parse_with_url(&url);
22339
22340        loop {
22341            let token = match self
22342                .hub
22343                .auth
22344                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22345                .await
22346            {
22347                Ok(token) => token,
22348                Err(e) => match dlg.token(e) {
22349                    Ok(token) => token,
22350                    Err(e) => {
22351                        dlg.finished(false);
22352                        return Err(common::Error::MissingToken(e));
22353                    }
22354                },
22355            };
22356            let mut req_result = {
22357                let client = &self.hub.client;
22358                dlg.pre_request();
22359                let mut req_builder = hyper::Request::builder()
22360                    .method(hyper::Method::GET)
22361                    .uri(url.as_str())
22362                    .header(USER_AGENT, self.hub._user_agent.clone());
22363
22364                if let Some(token) = token.as_ref() {
22365                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22366                }
22367
22368                let request = req_builder
22369                    .header(CONTENT_LENGTH, 0_u64)
22370                    .body(common::to_body::<String>(None));
22371
22372                client.request(request.unwrap()).await
22373            };
22374
22375            match req_result {
22376                Err(err) => {
22377                    if let common::Retry::After(d) = dlg.http_error(&err) {
22378                        sleep(d).await;
22379                        continue;
22380                    }
22381                    dlg.finished(false);
22382                    return Err(common::Error::HttpError(err));
22383                }
22384                Ok(res) => {
22385                    let (mut parts, body) = res.into_parts();
22386                    let mut body = common::Body::new(body);
22387                    if !parts.status.is_success() {
22388                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22389                        let error = serde_json::from_str(&common::to_string(&bytes));
22390                        let response = common::to_response(parts, bytes.into());
22391
22392                        if let common::Retry::After(d) =
22393                            dlg.http_failure(&response, error.as_ref().ok())
22394                        {
22395                            sleep(d).await;
22396                            continue;
22397                        }
22398
22399                        dlg.finished(false);
22400
22401                        return Err(match error {
22402                            Ok(value) => common::Error::BadRequest(value),
22403                            _ => common::Error::Failure(response),
22404                        });
22405                    }
22406                    let response = {
22407                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22408                        let encoded = common::to_string(&bytes);
22409                        match serde_json::from_str(&encoded) {
22410                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22411                            Err(error) => {
22412                                dlg.response_json_decode_error(&encoded, &error);
22413                                return Err(common::Error::JsonDecodeError(
22414                                    encoded.to_string(),
22415                                    error,
22416                                ));
22417                            }
22418                        }
22419                    };
22420
22421                    dlg.finished(true);
22422                    return Ok(response);
22423                }
22424            }
22425        }
22426    }
22427
22428    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
22429    ///
22430    /// Sets the *resource id* path property to the given value.
22431    ///
22432    /// Even though the property as already been set when instantiating this call,
22433    /// we provide this method for API completeness.
22434    pub fn resource_id(mut self, new_value: &str) -> GiftcardobjectGetCall<'a, C> {
22435        self._resource_id = new_value.to_string();
22436        self
22437    }
22438    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22439    /// while executing the actual API request.
22440    ///
22441    /// ````text
22442    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22443    /// ````
22444    ///
22445    /// Sets the *delegate* property to the given value.
22446    pub fn delegate(
22447        mut self,
22448        new_value: &'a mut dyn common::Delegate,
22449    ) -> GiftcardobjectGetCall<'a, C> {
22450        self._delegate = Some(new_value);
22451        self
22452    }
22453
22454    /// Set any additional parameter of the query string used in the request.
22455    /// It should be used to set parameters which are not yet available through their own
22456    /// setters.
22457    ///
22458    /// Please note that this method must not be used to set any of the known parameters
22459    /// which have their own setter method. If done anyway, the request will fail.
22460    ///
22461    /// # Additional Parameters
22462    ///
22463    /// * *$.xgafv* (query-string) - V1 error format.
22464    /// * *access_token* (query-string) - OAuth access token.
22465    /// * *alt* (query-string) - Data format for response.
22466    /// * *callback* (query-string) - JSONP
22467    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22468    /// * *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.
22469    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22470    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22471    /// * *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.
22472    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22473    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22474    pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectGetCall<'a, C>
22475    where
22476        T: AsRef<str>,
22477    {
22478        self._additional_params
22479            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22480        self
22481    }
22482
22483    /// Identifies the authorization scope for the method you are building.
22484    ///
22485    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22486    /// [`Scope::WalletObjectIssuer`].
22487    ///
22488    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22489    /// tokens for more than one scope.
22490    ///
22491    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22492    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22493    /// sufficient, a read-write scope will do as well.
22494    pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectGetCall<'a, C>
22495    where
22496        St: AsRef<str>,
22497    {
22498        self._scopes.insert(String::from(scope.as_ref()));
22499        self
22500    }
22501    /// Identifies the authorization scope(s) for the method you are building.
22502    ///
22503    /// See [`Self::add_scope()`] for details.
22504    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectGetCall<'a, C>
22505    where
22506        I: IntoIterator<Item = St>,
22507        St: AsRef<str>,
22508    {
22509        self._scopes
22510            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22511        self
22512    }
22513
22514    /// Removes all scopes, and no default scope will be used either.
22515    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22516    /// for details).
22517    pub fn clear_scopes(mut self) -> GiftcardobjectGetCall<'a, C> {
22518        self._scopes.clear();
22519        self
22520    }
22521}
22522
22523/// Inserts an gift card object with the given ID and properties.
22524///
22525/// A builder for the *insert* method supported by a *giftcardobject* resource.
22526/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
22527///
22528/// # Example
22529///
22530/// Instantiate a resource method builder
22531///
22532/// ```test_harness,no_run
22533/// # extern crate hyper;
22534/// # extern crate hyper_rustls;
22535/// # extern crate google_walletobjects1 as walletobjects1;
22536/// use walletobjects1::api::GiftCardObject;
22537/// # async fn dox() {
22538/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22539///
22540/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22541/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22542/// #     .with_native_roots()
22543/// #     .unwrap()
22544/// #     .https_only()
22545/// #     .enable_http2()
22546/// #     .build();
22547///
22548/// # let executor = hyper_util::rt::TokioExecutor::new();
22549/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22550/// #     secret,
22551/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22552/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22553/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22554/// #     ),
22555/// # ).build().await.unwrap();
22556///
22557/// # let client = hyper_util::client::legacy::Client::builder(
22558/// #     hyper_util::rt::TokioExecutor::new()
22559/// # )
22560/// # .build(
22561/// #     hyper_rustls::HttpsConnectorBuilder::new()
22562/// #         .with_native_roots()
22563/// #         .unwrap()
22564/// #         .https_or_http()
22565/// #         .enable_http2()
22566/// #         .build()
22567/// # );
22568/// # let mut hub = Walletobjects::new(client, auth);
22569/// // As the method needs a request, you would usually fill it with the desired information
22570/// // into the respective structure. Some of the parts shown here might not be applicable !
22571/// // Values shown here are possibly random and not representative !
22572/// let mut req = GiftCardObject::default();
22573///
22574/// // You can configure optional parameters by calling the respective setters at will, and
22575/// // execute the final call using `doit()`.
22576/// // Values shown here are possibly random and not representative !
22577/// let result = hub.giftcardobject().insert(req)
22578///              .doit().await;
22579/// # }
22580/// ```
22581pub struct GiftcardobjectInsertCall<'a, C>
22582where
22583    C: 'a,
22584{
22585    hub: &'a Walletobjects<C>,
22586    _request: GiftCardObject,
22587    _delegate: Option<&'a mut dyn common::Delegate>,
22588    _additional_params: HashMap<String, String>,
22589    _scopes: BTreeSet<String>,
22590}
22591
22592impl<'a, C> common::CallBuilder for GiftcardobjectInsertCall<'a, C> {}
22593
22594impl<'a, C> GiftcardobjectInsertCall<'a, C>
22595where
22596    C: common::Connector,
22597{
22598    /// Perform the operation you have build so far.
22599    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObject)> {
22600        use std::borrow::Cow;
22601        use std::io::{Read, Seek};
22602
22603        use common::{url::Params, ToParts};
22604        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22605
22606        let mut dd = common::DefaultDelegate;
22607        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22608        dlg.begin(common::MethodInfo {
22609            id: "walletobjects.giftcardobject.insert",
22610            http_method: hyper::Method::POST,
22611        });
22612
22613        for &field in ["alt"].iter() {
22614            if self._additional_params.contains_key(field) {
22615                dlg.finished(false);
22616                return Err(common::Error::FieldClash(field));
22617            }
22618        }
22619
22620        let mut params = Params::with_capacity(3 + self._additional_params.len());
22621
22622        params.extend(self._additional_params.iter());
22623
22624        params.push("alt", "json");
22625        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject";
22626        if self._scopes.is_empty() {
22627            self._scopes
22628                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
22629        }
22630
22631        let url = params.parse_with_url(&url);
22632
22633        let mut json_mime_type = mime::APPLICATION_JSON;
22634        let mut request_value_reader = {
22635            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22636            common::remove_json_null_values(&mut value);
22637            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22638            serde_json::to_writer(&mut dst, &value).unwrap();
22639            dst
22640        };
22641        let request_size = request_value_reader
22642            .seek(std::io::SeekFrom::End(0))
22643            .unwrap();
22644        request_value_reader
22645            .seek(std::io::SeekFrom::Start(0))
22646            .unwrap();
22647
22648        loop {
22649            let token = match self
22650                .hub
22651                .auth
22652                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22653                .await
22654            {
22655                Ok(token) => token,
22656                Err(e) => match dlg.token(e) {
22657                    Ok(token) => token,
22658                    Err(e) => {
22659                        dlg.finished(false);
22660                        return Err(common::Error::MissingToken(e));
22661                    }
22662                },
22663            };
22664            request_value_reader
22665                .seek(std::io::SeekFrom::Start(0))
22666                .unwrap();
22667            let mut req_result = {
22668                let client = &self.hub.client;
22669                dlg.pre_request();
22670                let mut req_builder = hyper::Request::builder()
22671                    .method(hyper::Method::POST)
22672                    .uri(url.as_str())
22673                    .header(USER_AGENT, self.hub._user_agent.clone());
22674
22675                if let Some(token) = token.as_ref() {
22676                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22677                }
22678
22679                let request = req_builder
22680                    .header(CONTENT_TYPE, json_mime_type.to_string())
22681                    .header(CONTENT_LENGTH, request_size as u64)
22682                    .body(common::to_body(
22683                        request_value_reader.get_ref().clone().into(),
22684                    ));
22685
22686                client.request(request.unwrap()).await
22687            };
22688
22689            match req_result {
22690                Err(err) => {
22691                    if let common::Retry::After(d) = dlg.http_error(&err) {
22692                        sleep(d).await;
22693                        continue;
22694                    }
22695                    dlg.finished(false);
22696                    return Err(common::Error::HttpError(err));
22697                }
22698                Ok(res) => {
22699                    let (mut parts, body) = res.into_parts();
22700                    let mut body = common::Body::new(body);
22701                    if !parts.status.is_success() {
22702                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22703                        let error = serde_json::from_str(&common::to_string(&bytes));
22704                        let response = common::to_response(parts, bytes.into());
22705
22706                        if let common::Retry::After(d) =
22707                            dlg.http_failure(&response, error.as_ref().ok())
22708                        {
22709                            sleep(d).await;
22710                            continue;
22711                        }
22712
22713                        dlg.finished(false);
22714
22715                        return Err(match error {
22716                            Ok(value) => common::Error::BadRequest(value),
22717                            _ => common::Error::Failure(response),
22718                        });
22719                    }
22720                    let response = {
22721                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22722                        let encoded = common::to_string(&bytes);
22723                        match serde_json::from_str(&encoded) {
22724                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22725                            Err(error) => {
22726                                dlg.response_json_decode_error(&encoded, &error);
22727                                return Err(common::Error::JsonDecodeError(
22728                                    encoded.to_string(),
22729                                    error,
22730                                ));
22731                            }
22732                        }
22733                    };
22734
22735                    dlg.finished(true);
22736                    return Ok(response);
22737                }
22738            }
22739        }
22740    }
22741
22742    ///
22743    /// Sets the *request* property to the given value.
22744    ///
22745    /// Even though the property as already been set when instantiating this call,
22746    /// we provide this method for API completeness.
22747    pub fn request(mut self, new_value: GiftCardObject) -> GiftcardobjectInsertCall<'a, C> {
22748        self._request = new_value;
22749        self
22750    }
22751    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22752    /// while executing the actual API request.
22753    ///
22754    /// ````text
22755    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22756    /// ````
22757    ///
22758    /// Sets the *delegate* property to the given value.
22759    pub fn delegate(
22760        mut self,
22761        new_value: &'a mut dyn common::Delegate,
22762    ) -> GiftcardobjectInsertCall<'a, C> {
22763        self._delegate = Some(new_value);
22764        self
22765    }
22766
22767    /// Set any additional parameter of the query string used in the request.
22768    /// It should be used to set parameters which are not yet available through their own
22769    /// setters.
22770    ///
22771    /// Please note that this method must not be used to set any of the known parameters
22772    /// which have their own setter method. If done anyway, the request will fail.
22773    ///
22774    /// # Additional Parameters
22775    ///
22776    /// * *$.xgafv* (query-string) - V1 error format.
22777    /// * *access_token* (query-string) - OAuth access token.
22778    /// * *alt* (query-string) - Data format for response.
22779    /// * *callback* (query-string) - JSONP
22780    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22781    /// * *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.
22782    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22783    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22784    /// * *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.
22785    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22786    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22787    pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectInsertCall<'a, C>
22788    where
22789        T: AsRef<str>,
22790    {
22791        self._additional_params
22792            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22793        self
22794    }
22795
22796    /// Identifies the authorization scope for the method you are building.
22797    ///
22798    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22799    /// [`Scope::WalletObjectIssuer`].
22800    ///
22801    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22802    /// tokens for more than one scope.
22803    ///
22804    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22805    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22806    /// sufficient, a read-write scope will do as well.
22807    pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectInsertCall<'a, C>
22808    where
22809        St: AsRef<str>,
22810    {
22811        self._scopes.insert(String::from(scope.as_ref()));
22812        self
22813    }
22814    /// Identifies the authorization scope(s) for the method you are building.
22815    ///
22816    /// See [`Self::add_scope()`] for details.
22817    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectInsertCall<'a, C>
22818    where
22819        I: IntoIterator<Item = St>,
22820        St: AsRef<str>,
22821    {
22822        self._scopes
22823            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22824        self
22825    }
22826
22827    /// Removes all scopes, and no default scope will be used either.
22828    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22829    /// for details).
22830    pub fn clear_scopes(mut self) -> GiftcardobjectInsertCall<'a, C> {
22831        self._scopes.clear();
22832        self
22833    }
22834}
22835
22836/// Returns a list of all gift card objects for a given issuer ID.
22837///
22838/// A builder for the *list* method supported by a *giftcardobject* resource.
22839/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
22840///
22841/// # Example
22842///
22843/// Instantiate a resource method builder
22844///
22845/// ```test_harness,no_run
22846/// # extern crate hyper;
22847/// # extern crate hyper_rustls;
22848/// # extern crate google_walletobjects1 as walletobjects1;
22849/// # async fn dox() {
22850/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22851///
22852/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22853/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22854/// #     .with_native_roots()
22855/// #     .unwrap()
22856/// #     .https_only()
22857/// #     .enable_http2()
22858/// #     .build();
22859///
22860/// # let executor = hyper_util::rt::TokioExecutor::new();
22861/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22862/// #     secret,
22863/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22864/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22865/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22866/// #     ),
22867/// # ).build().await.unwrap();
22868///
22869/// # let client = hyper_util::client::legacy::Client::builder(
22870/// #     hyper_util::rt::TokioExecutor::new()
22871/// # )
22872/// # .build(
22873/// #     hyper_rustls::HttpsConnectorBuilder::new()
22874/// #         .with_native_roots()
22875/// #         .unwrap()
22876/// #         .https_or_http()
22877/// #         .enable_http2()
22878/// #         .build()
22879/// # );
22880/// # let mut hub = Walletobjects::new(client, auth);
22881/// // You can configure optional parameters by calling the respective setters at will, and
22882/// // execute the final call using `doit()`.
22883/// // Values shown here are possibly random and not representative !
22884/// let result = hub.giftcardobject().list()
22885///              .token("amet.")
22886///              .max_results(-96)
22887///              .class_id("diam")
22888///              .doit().await;
22889/// # }
22890/// ```
22891pub struct GiftcardobjectListCall<'a, C>
22892where
22893    C: 'a,
22894{
22895    hub: &'a Walletobjects<C>,
22896    _token: Option<String>,
22897    _max_results: Option<i32>,
22898    _class_id: Option<String>,
22899    _delegate: Option<&'a mut dyn common::Delegate>,
22900    _additional_params: HashMap<String, String>,
22901    _scopes: BTreeSet<String>,
22902}
22903
22904impl<'a, C> common::CallBuilder for GiftcardobjectListCall<'a, C> {}
22905
22906impl<'a, C> GiftcardobjectListCall<'a, C>
22907where
22908    C: common::Connector,
22909{
22910    /// Perform the operation you have build so far.
22911    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObjectListResponse)> {
22912        use std::borrow::Cow;
22913        use std::io::{Read, Seek};
22914
22915        use common::{url::Params, ToParts};
22916        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22917
22918        let mut dd = common::DefaultDelegate;
22919        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22920        dlg.begin(common::MethodInfo {
22921            id: "walletobjects.giftcardobject.list",
22922            http_method: hyper::Method::GET,
22923        });
22924
22925        for &field in ["alt", "token", "maxResults", "classId"].iter() {
22926            if self._additional_params.contains_key(field) {
22927                dlg.finished(false);
22928                return Err(common::Error::FieldClash(field));
22929            }
22930        }
22931
22932        let mut params = Params::with_capacity(5 + self._additional_params.len());
22933        if let Some(value) = self._token.as_ref() {
22934            params.push("token", value);
22935        }
22936        if let Some(value) = self._max_results.as_ref() {
22937            params.push("maxResults", value.to_string());
22938        }
22939        if let Some(value) = self._class_id.as_ref() {
22940            params.push("classId", value);
22941        }
22942
22943        params.extend(self._additional_params.iter());
22944
22945        params.push("alt", "json");
22946        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject";
22947        if self._scopes.is_empty() {
22948            self._scopes
22949                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
22950        }
22951
22952        let url = params.parse_with_url(&url);
22953
22954        loop {
22955            let token = match self
22956                .hub
22957                .auth
22958                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22959                .await
22960            {
22961                Ok(token) => token,
22962                Err(e) => match dlg.token(e) {
22963                    Ok(token) => token,
22964                    Err(e) => {
22965                        dlg.finished(false);
22966                        return Err(common::Error::MissingToken(e));
22967                    }
22968                },
22969            };
22970            let mut req_result = {
22971                let client = &self.hub.client;
22972                dlg.pre_request();
22973                let mut req_builder = hyper::Request::builder()
22974                    .method(hyper::Method::GET)
22975                    .uri(url.as_str())
22976                    .header(USER_AGENT, self.hub._user_agent.clone());
22977
22978                if let Some(token) = token.as_ref() {
22979                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22980                }
22981
22982                let request = req_builder
22983                    .header(CONTENT_LENGTH, 0_u64)
22984                    .body(common::to_body::<String>(None));
22985
22986                client.request(request.unwrap()).await
22987            };
22988
22989            match req_result {
22990                Err(err) => {
22991                    if let common::Retry::After(d) = dlg.http_error(&err) {
22992                        sleep(d).await;
22993                        continue;
22994                    }
22995                    dlg.finished(false);
22996                    return Err(common::Error::HttpError(err));
22997                }
22998                Ok(res) => {
22999                    let (mut parts, body) = res.into_parts();
23000                    let mut body = common::Body::new(body);
23001                    if !parts.status.is_success() {
23002                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23003                        let error = serde_json::from_str(&common::to_string(&bytes));
23004                        let response = common::to_response(parts, bytes.into());
23005
23006                        if let common::Retry::After(d) =
23007                            dlg.http_failure(&response, error.as_ref().ok())
23008                        {
23009                            sleep(d).await;
23010                            continue;
23011                        }
23012
23013                        dlg.finished(false);
23014
23015                        return Err(match error {
23016                            Ok(value) => common::Error::BadRequest(value),
23017                            _ => common::Error::Failure(response),
23018                        });
23019                    }
23020                    let response = {
23021                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23022                        let encoded = common::to_string(&bytes);
23023                        match serde_json::from_str(&encoded) {
23024                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23025                            Err(error) => {
23026                                dlg.response_json_decode_error(&encoded, &error);
23027                                return Err(common::Error::JsonDecodeError(
23028                                    encoded.to_string(),
23029                                    error,
23030                                ));
23031                            }
23032                        }
23033                    };
23034
23035                    dlg.finished(true);
23036                    return Ok(response);
23037                }
23038            }
23039        }
23040    }
23041
23042    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` objects are available in a list. For example, if you have a list of 200 objects and you call list with `maxResults` set to 20, list will return the first 20 objects and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 objects.
23043    ///
23044    /// Sets the *token* query property to the given value.
23045    pub fn token(mut self, new_value: &str) -> GiftcardobjectListCall<'a, C> {
23046        self._token = Some(new_value.to_string());
23047        self
23048    }
23049    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
23050    ///
23051    /// Sets the *max results* query property to the given value.
23052    pub fn max_results(mut self, new_value: i32) -> GiftcardobjectListCall<'a, C> {
23053        self._max_results = Some(new_value);
23054        self
23055    }
23056    /// The ID of the class whose objects will be listed.
23057    ///
23058    /// Sets the *class id* query property to the given value.
23059    pub fn class_id(mut self, new_value: &str) -> GiftcardobjectListCall<'a, C> {
23060        self._class_id = Some(new_value.to_string());
23061        self
23062    }
23063    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23064    /// while executing the actual API request.
23065    ///
23066    /// ````text
23067    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23068    /// ````
23069    ///
23070    /// Sets the *delegate* property to the given value.
23071    pub fn delegate(
23072        mut self,
23073        new_value: &'a mut dyn common::Delegate,
23074    ) -> GiftcardobjectListCall<'a, C> {
23075        self._delegate = Some(new_value);
23076        self
23077    }
23078
23079    /// Set any additional parameter of the query string used in the request.
23080    /// It should be used to set parameters which are not yet available through their own
23081    /// setters.
23082    ///
23083    /// Please note that this method must not be used to set any of the known parameters
23084    /// which have their own setter method. If done anyway, the request will fail.
23085    ///
23086    /// # Additional Parameters
23087    ///
23088    /// * *$.xgafv* (query-string) - V1 error format.
23089    /// * *access_token* (query-string) - OAuth access token.
23090    /// * *alt* (query-string) - Data format for response.
23091    /// * *callback* (query-string) - JSONP
23092    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23093    /// * *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.
23094    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23095    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23096    /// * *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.
23097    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23098    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23099    pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectListCall<'a, C>
23100    where
23101        T: AsRef<str>,
23102    {
23103        self._additional_params
23104            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23105        self
23106    }
23107
23108    /// Identifies the authorization scope for the method you are building.
23109    ///
23110    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23111    /// [`Scope::WalletObjectIssuer`].
23112    ///
23113    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23114    /// tokens for more than one scope.
23115    ///
23116    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23117    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23118    /// sufficient, a read-write scope will do as well.
23119    pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectListCall<'a, C>
23120    where
23121        St: AsRef<str>,
23122    {
23123        self._scopes.insert(String::from(scope.as_ref()));
23124        self
23125    }
23126    /// Identifies the authorization scope(s) for the method you are building.
23127    ///
23128    /// See [`Self::add_scope()`] for details.
23129    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectListCall<'a, C>
23130    where
23131        I: IntoIterator<Item = St>,
23132        St: AsRef<str>,
23133    {
23134        self._scopes
23135            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23136        self
23137    }
23138
23139    /// Removes all scopes, and no default scope will be used either.
23140    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23141    /// for details).
23142    pub fn clear_scopes(mut self) -> GiftcardobjectListCall<'a, C> {
23143        self._scopes.clear();
23144        self
23145    }
23146}
23147
23148/// Updates the gift card object referenced by the given object ID. This method supports patch semantics.
23149///
23150/// A builder for the *patch* method supported by a *giftcardobject* resource.
23151/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
23152///
23153/// # Example
23154///
23155/// Instantiate a resource method builder
23156///
23157/// ```test_harness,no_run
23158/// # extern crate hyper;
23159/// # extern crate hyper_rustls;
23160/// # extern crate google_walletobjects1 as walletobjects1;
23161/// use walletobjects1::api::GiftCardObject;
23162/// # async fn dox() {
23163/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23164///
23165/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23166/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23167/// #     .with_native_roots()
23168/// #     .unwrap()
23169/// #     .https_only()
23170/// #     .enable_http2()
23171/// #     .build();
23172///
23173/// # let executor = hyper_util::rt::TokioExecutor::new();
23174/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23175/// #     secret,
23176/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23177/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23178/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23179/// #     ),
23180/// # ).build().await.unwrap();
23181///
23182/// # let client = hyper_util::client::legacy::Client::builder(
23183/// #     hyper_util::rt::TokioExecutor::new()
23184/// # )
23185/// # .build(
23186/// #     hyper_rustls::HttpsConnectorBuilder::new()
23187/// #         .with_native_roots()
23188/// #         .unwrap()
23189/// #         .https_or_http()
23190/// #         .enable_http2()
23191/// #         .build()
23192/// # );
23193/// # let mut hub = Walletobjects::new(client, auth);
23194/// // As the method needs a request, you would usually fill it with the desired information
23195/// // into the respective structure. Some of the parts shown here might not be applicable !
23196/// // Values shown here are possibly random and not representative !
23197/// let mut req = GiftCardObject::default();
23198///
23199/// // You can configure optional parameters by calling the respective setters at will, and
23200/// // execute the final call using `doit()`.
23201/// // Values shown here are possibly random and not representative !
23202/// let result = hub.giftcardobject().patch(req, "resourceId")
23203///              .doit().await;
23204/// # }
23205/// ```
23206pub struct GiftcardobjectPatchCall<'a, C>
23207where
23208    C: 'a,
23209{
23210    hub: &'a Walletobjects<C>,
23211    _request: GiftCardObject,
23212    _resource_id: String,
23213    _delegate: Option<&'a mut dyn common::Delegate>,
23214    _additional_params: HashMap<String, String>,
23215    _scopes: BTreeSet<String>,
23216}
23217
23218impl<'a, C> common::CallBuilder for GiftcardobjectPatchCall<'a, C> {}
23219
23220impl<'a, C> GiftcardobjectPatchCall<'a, C>
23221where
23222    C: common::Connector,
23223{
23224    /// Perform the operation you have build so far.
23225    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObject)> {
23226        use std::borrow::Cow;
23227        use std::io::{Read, Seek};
23228
23229        use common::{url::Params, ToParts};
23230        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23231
23232        let mut dd = common::DefaultDelegate;
23233        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23234        dlg.begin(common::MethodInfo {
23235            id: "walletobjects.giftcardobject.patch",
23236            http_method: hyper::Method::PATCH,
23237        });
23238
23239        for &field in ["alt", "resourceId"].iter() {
23240            if self._additional_params.contains_key(field) {
23241                dlg.finished(false);
23242                return Err(common::Error::FieldClash(field));
23243            }
23244        }
23245
23246        let mut params = Params::with_capacity(4 + self._additional_params.len());
23247        params.push("resourceId", self._resource_id);
23248
23249        params.extend(self._additional_params.iter());
23250
23251        params.push("alt", "json");
23252        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject/{resourceId}";
23253        if self._scopes.is_empty() {
23254            self._scopes
23255                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
23256        }
23257
23258        #[allow(clippy::single_element_loop)]
23259        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
23260            url = params.uri_replacement(url, param_name, find_this, false);
23261        }
23262        {
23263            let to_remove = ["resourceId"];
23264            params.remove_params(&to_remove);
23265        }
23266
23267        let url = params.parse_with_url(&url);
23268
23269        let mut json_mime_type = mime::APPLICATION_JSON;
23270        let mut request_value_reader = {
23271            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23272            common::remove_json_null_values(&mut value);
23273            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23274            serde_json::to_writer(&mut dst, &value).unwrap();
23275            dst
23276        };
23277        let request_size = request_value_reader
23278            .seek(std::io::SeekFrom::End(0))
23279            .unwrap();
23280        request_value_reader
23281            .seek(std::io::SeekFrom::Start(0))
23282            .unwrap();
23283
23284        loop {
23285            let token = match self
23286                .hub
23287                .auth
23288                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23289                .await
23290            {
23291                Ok(token) => token,
23292                Err(e) => match dlg.token(e) {
23293                    Ok(token) => token,
23294                    Err(e) => {
23295                        dlg.finished(false);
23296                        return Err(common::Error::MissingToken(e));
23297                    }
23298                },
23299            };
23300            request_value_reader
23301                .seek(std::io::SeekFrom::Start(0))
23302                .unwrap();
23303            let mut req_result = {
23304                let client = &self.hub.client;
23305                dlg.pre_request();
23306                let mut req_builder = hyper::Request::builder()
23307                    .method(hyper::Method::PATCH)
23308                    .uri(url.as_str())
23309                    .header(USER_AGENT, self.hub._user_agent.clone());
23310
23311                if let Some(token) = token.as_ref() {
23312                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23313                }
23314
23315                let request = req_builder
23316                    .header(CONTENT_TYPE, json_mime_type.to_string())
23317                    .header(CONTENT_LENGTH, request_size as u64)
23318                    .body(common::to_body(
23319                        request_value_reader.get_ref().clone().into(),
23320                    ));
23321
23322                client.request(request.unwrap()).await
23323            };
23324
23325            match req_result {
23326                Err(err) => {
23327                    if let common::Retry::After(d) = dlg.http_error(&err) {
23328                        sleep(d).await;
23329                        continue;
23330                    }
23331                    dlg.finished(false);
23332                    return Err(common::Error::HttpError(err));
23333                }
23334                Ok(res) => {
23335                    let (mut parts, body) = res.into_parts();
23336                    let mut body = common::Body::new(body);
23337                    if !parts.status.is_success() {
23338                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23339                        let error = serde_json::from_str(&common::to_string(&bytes));
23340                        let response = common::to_response(parts, bytes.into());
23341
23342                        if let common::Retry::After(d) =
23343                            dlg.http_failure(&response, error.as_ref().ok())
23344                        {
23345                            sleep(d).await;
23346                            continue;
23347                        }
23348
23349                        dlg.finished(false);
23350
23351                        return Err(match error {
23352                            Ok(value) => common::Error::BadRequest(value),
23353                            _ => common::Error::Failure(response),
23354                        });
23355                    }
23356                    let response = {
23357                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23358                        let encoded = common::to_string(&bytes);
23359                        match serde_json::from_str(&encoded) {
23360                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23361                            Err(error) => {
23362                                dlg.response_json_decode_error(&encoded, &error);
23363                                return Err(common::Error::JsonDecodeError(
23364                                    encoded.to_string(),
23365                                    error,
23366                                ));
23367                            }
23368                        }
23369                    };
23370
23371                    dlg.finished(true);
23372                    return Ok(response);
23373                }
23374            }
23375        }
23376    }
23377
23378    ///
23379    /// Sets the *request* property to the given value.
23380    ///
23381    /// Even though the property as already been set when instantiating this call,
23382    /// we provide this method for API completeness.
23383    pub fn request(mut self, new_value: GiftCardObject) -> GiftcardobjectPatchCall<'a, C> {
23384        self._request = new_value;
23385        self
23386    }
23387    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
23388    ///
23389    /// Sets the *resource id* path property to the given value.
23390    ///
23391    /// Even though the property as already been set when instantiating this call,
23392    /// we provide this method for API completeness.
23393    pub fn resource_id(mut self, new_value: &str) -> GiftcardobjectPatchCall<'a, C> {
23394        self._resource_id = new_value.to_string();
23395        self
23396    }
23397    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23398    /// while executing the actual API request.
23399    ///
23400    /// ````text
23401    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23402    /// ````
23403    ///
23404    /// Sets the *delegate* property to the given value.
23405    pub fn delegate(
23406        mut self,
23407        new_value: &'a mut dyn common::Delegate,
23408    ) -> GiftcardobjectPatchCall<'a, C> {
23409        self._delegate = Some(new_value);
23410        self
23411    }
23412
23413    /// Set any additional parameter of the query string used in the request.
23414    /// It should be used to set parameters which are not yet available through their own
23415    /// setters.
23416    ///
23417    /// Please note that this method must not be used to set any of the known parameters
23418    /// which have their own setter method. If done anyway, the request will fail.
23419    ///
23420    /// # Additional Parameters
23421    ///
23422    /// * *$.xgafv* (query-string) - V1 error format.
23423    /// * *access_token* (query-string) - OAuth access token.
23424    /// * *alt* (query-string) - Data format for response.
23425    /// * *callback* (query-string) - JSONP
23426    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23427    /// * *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.
23428    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23429    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23430    /// * *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.
23431    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23432    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23433    pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectPatchCall<'a, C>
23434    where
23435        T: AsRef<str>,
23436    {
23437        self._additional_params
23438            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23439        self
23440    }
23441
23442    /// Identifies the authorization scope for the method you are building.
23443    ///
23444    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23445    /// [`Scope::WalletObjectIssuer`].
23446    ///
23447    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23448    /// tokens for more than one scope.
23449    ///
23450    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23451    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23452    /// sufficient, a read-write scope will do as well.
23453    pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectPatchCall<'a, C>
23454    where
23455        St: AsRef<str>,
23456    {
23457        self._scopes.insert(String::from(scope.as_ref()));
23458        self
23459    }
23460    /// Identifies the authorization scope(s) for the method you are building.
23461    ///
23462    /// See [`Self::add_scope()`] for details.
23463    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectPatchCall<'a, C>
23464    where
23465        I: IntoIterator<Item = St>,
23466        St: AsRef<str>,
23467    {
23468        self._scopes
23469            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23470        self
23471    }
23472
23473    /// Removes all scopes, and no default scope will be used either.
23474    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23475    /// for details).
23476    pub fn clear_scopes(mut self) -> GiftcardobjectPatchCall<'a, C> {
23477        self._scopes.clear();
23478        self
23479    }
23480}
23481
23482/// Updates the gift card object referenced by the given object ID.
23483///
23484/// A builder for the *update* method supported by a *giftcardobject* resource.
23485/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
23486///
23487/// # Example
23488///
23489/// Instantiate a resource method builder
23490///
23491/// ```test_harness,no_run
23492/// # extern crate hyper;
23493/// # extern crate hyper_rustls;
23494/// # extern crate google_walletobjects1 as walletobjects1;
23495/// use walletobjects1::api::GiftCardObject;
23496/// # async fn dox() {
23497/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23498///
23499/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23500/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23501/// #     .with_native_roots()
23502/// #     .unwrap()
23503/// #     .https_only()
23504/// #     .enable_http2()
23505/// #     .build();
23506///
23507/// # let executor = hyper_util::rt::TokioExecutor::new();
23508/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23509/// #     secret,
23510/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23511/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23512/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23513/// #     ),
23514/// # ).build().await.unwrap();
23515///
23516/// # let client = hyper_util::client::legacy::Client::builder(
23517/// #     hyper_util::rt::TokioExecutor::new()
23518/// # )
23519/// # .build(
23520/// #     hyper_rustls::HttpsConnectorBuilder::new()
23521/// #         .with_native_roots()
23522/// #         .unwrap()
23523/// #         .https_or_http()
23524/// #         .enable_http2()
23525/// #         .build()
23526/// # );
23527/// # let mut hub = Walletobjects::new(client, auth);
23528/// // As the method needs a request, you would usually fill it with the desired information
23529/// // into the respective structure. Some of the parts shown here might not be applicable !
23530/// // Values shown here are possibly random and not representative !
23531/// let mut req = GiftCardObject::default();
23532///
23533/// // You can configure optional parameters by calling the respective setters at will, and
23534/// // execute the final call using `doit()`.
23535/// // Values shown here are possibly random and not representative !
23536/// let result = hub.giftcardobject().update(req, "resourceId")
23537///              .doit().await;
23538/// # }
23539/// ```
23540pub struct GiftcardobjectUpdateCall<'a, C>
23541where
23542    C: 'a,
23543{
23544    hub: &'a Walletobjects<C>,
23545    _request: GiftCardObject,
23546    _resource_id: String,
23547    _delegate: Option<&'a mut dyn common::Delegate>,
23548    _additional_params: HashMap<String, String>,
23549    _scopes: BTreeSet<String>,
23550}
23551
23552impl<'a, C> common::CallBuilder for GiftcardobjectUpdateCall<'a, C> {}
23553
23554impl<'a, C> GiftcardobjectUpdateCall<'a, C>
23555where
23556    C: common::Connector,
23557{
23558    /// Perform the operation you have build so far.
23559    pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObject)> {
23560        use std::borrow::Cow;
23561        use std::io::{Read, Seek};
23562
23563        use common::{url::Params, ToParts};
23564        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23565
23566        let mut dd = common::DefaultDelegate;
23567        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23568        dlg.begin(common::MethodInfo {
23569            id: "walletobjects.giftcardobject.update",
23570            http_method: hyper::Method::PUT,
23571        });
23572
23573        for &field in ["alt", "resourceId"].iter() {
23574            if self._additional_params.contains_key(field) {
23575                dlg.finished(false);
23576                return Err(common::Error::FieldClash(field));
23577            }
23578        }
23579
23580        let mut params = Params::with_capacity(4 + self._additional_params.len());
23581        params.push("resourceId", self._resource_id);
23582
23583        params.extend(self._additional_params.iter());
23584
23585        params.push("alt", "json");
23586        let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject/{resourceId}";
23587        if self._scopes.is_empty() {
23588            self._scopes
23589                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
23590        }
23591
23592        #[allow(clippy::single_element_loop)]
23593        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
23594            url = params.uri_replacement(url, param_name, find_this, false);
23595        }
23596        {
23597            let to_remove = ["resourceId"];
23598            params.remove_params(&to_remove);
23599        }
23600
23601        let url = params.parse_with_url(&url);
23602
23603        let mut json_mime_type = mime::APPLICATION_JSON;
23604        let mut request_value_reader = {
23605            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23606            common::remove_json_null_values(&mut value);
23607            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23608            serde_json::to_writer(&mut dst, &value).unwrap();
23609            dst
23610        };
23611        let request_size = request_value_reader
23612            .seek(std::io::SeekFrom::End(0))
23613            .unwrap();
23614        request_value_reader
23615            .seek(std::io::SeekFrom::Start(0))
23616            .unwrap();
23617
23618        loop {
23619            let token = match self
23620                .hub
23621                .auth
23622                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23623                .await
23624            {
23625                Ok(token) => token,
23626                Err(e) => match dlg.token(e) {
23627                    Ok(token) => token,
23628                    Err(e) => {
23629                        dlg.finished(false);
23630                        return Err(common::Error::MissingToken(e));
23631                    }
23632                },
23633            };
23634            request_value_reader
23635                .seek(std::io::SeekFrom::Start(0))
23636                .unwrap();
23637            let mut req_result = {
23638                let client = &self.hub.client;
23639                dlg.pre_request();
23640                let mut req_builder = hyper::Request::builder()
23641                    .method(hyper::Method::PUT)
23642                    .uri(url.as_str())
23643                    .header(USER_AGENT, self.hub._user_agent.clone());
23644
23645                if let Some(token) = token.as_ref() {
23646                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23647                }
23648
23649                let request = req_builder
23650                    .header(CONTENT_TYPE, json_mime_type.to_string())
23651                    .header(CONTENT_LENGTH, request_size as u64)
23652                    .body(common::to_body(
23653                        request_value_reader.get_ref().clone().into(),
23654                    ));
23655
23656                client.request(request.unwrap()).await
23657            };
23658
23659            match req_result {
23660                Err(err) => {
23661                    if let common::Retry::After(d) = dlg.http_error(&err) {
23662                        sleep(d).await;
23663                        continue;
23664                    }
23665                    dlg.finished(false);
23666                    return Err(common::Error::HttpError(err));
23667                }
23668                Ok(res) => {
23669                    let (mut parts, body) = res.into_parts();
23670                    let mut body = common::Body::new(body);
23671                    if !parts.status.is_success() {
23672                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23673                        let error = serde_json::from_str(&common::to_string(&bytes));
23674                        let response = common::to_response(parts, bytes.into());
23675
23676                        if let common::Retry::After(d) =
23677                            dlg.http_failure(&response, error.as_ref().ok())
23678                        {
23679                            sleep(d).await;
23680                            continue;
23681                        }
23682
23683                        dlg.finished(false);
23684
23685                        return Err(match error {
23686                            Ok(value) => common::Error::BadRequest(value),
23687                            _ => common::Error::Failure(response),
23688                        });
23689                    }
23690                    let response = {
23691                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23692                        let encoded = common::to_string(&bytes);
23693                        match serde_json::from_str(&encoded) {
23694                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23695                            Err(error) => {
23696                                dlg.response_json_decode_error(&encoded, &error);
23697                                return Err(common::Error::JsonDecodeError(
23698                                    encoded.to_string(),
23699                                    error,
23700                                ));
23701                            }
23702                        }
23703                    };
23704
23705                    dlg.finished(true);
23706                    return Ok(response);
23707                }
23708            }
23709        }
23710    }
23711
23712    ///
23713    /// Sets the *request* property to the given value.
23714    ///
23715    /// Even though the property as already been set when instantiating this call,
23716    /// we provide this method for API completeness.
23717    pub fn request(mut self, new_value: GiftCardObject) -> GiftcardobjectUpdateCall<'a, C> {
23718        self._request = new_value;
23719        self
23720    }
23721    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
23722    ///
23723    /// Sets the *resource id* path property to the given value.
23724    ///
23725    /// Even though the property as already been set when instantiating this call,
23726    /// we provide this method for API completeness.
23727    pub fn resource_id(mut self, new_value: &str) -> GiftcardobjectUpdateCall<'a, C> {
23728        self._resource_id = new_value.to_string();
23729        self
23730    }
23731    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23732    /// while executing the actual API request.
23733    ///
23734    /// ````text
23735    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23736    /// ````
23737    ///
23738    /// Sets the *delegate* property to the given value.
23739    pub fn delegate(
23740        mut self,
23741        new_value: &'a mut dyn common::Delegate,
23742    ) -> GiftcardobjectUpdateCall<'a, C> {
23743        self._delegate = Some(new_value);
23744        self
23745    }
23746
23747    /// Set any additional parameter of the query string used in the request.
23748    /// It should be used to set parameters which are not yet available through their own
23749    /// setters.
23750    ///
23751    /// Please note that this method must not be used to set any of the known parameters
23752    /// which have their own setter method. If done anyway, the request will fail.
23753    ///
23754    /// # Additional Parameters
23755    ///
23756    /// * *$.xgafv* (query-string) - V1 error format.
23757    /// * *access_token* (query-string) - OAuth access token.
23758    /// * *alt* (query-string) - Data format for response.
23759    /// * *callback* (query-string) - JSONP
23760    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23761    /// * *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.
23762    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23763    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23764    /// * *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.
23765    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23766    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23767    pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectUpdateCall<'a, C>
23768    where
23769        T: AsRef<str>,
23770    {
23771        self._additional_params
23772            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23773        self
23774    }
23775
23776    /// Identifies the authorization scope for the method you are building.
23777    ///
23778    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23779    /// [`Scope::WalletObjectIssuer`].
23780    ///
23781    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23782    /// tokens for more than one scope.
23783    ///
23784    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23785    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23786    /// sufficient, a read-write scope will do as well.
23787    pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectUpdateCall<'a, C>
23788    where
23789        St: AsRef<str>,
23790    {
23791        self._scopes.insert(String::from(scope.as_ref()));
23792        self
23793    }
23794    /// Identifies the authorization scope(s) for the method you are building.
23795    ///
23796    /// See [`Self::add_scope()`] for details.
23797    pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectUpdateCall<'a, C>
23798    where
23799        I: IntoIterator<Item = St>,
23800        St: AsRef<str>,
23801    {
23802        self._scopes
23803            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23804        self
23805    }
23806
23807    /// Removes all scopes, and no default scope will be used either.
23808    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23809    /// for details).
23810    pub fn clear_scopes(mut self) -> GiftcardobjectUpdateCall<'a, C> {
23811        self._scopes.clear();
23812        self
23813    }
23814}
23815
23816/// Returns the issuer with the given issuer ID.
23817///
23818/// A builder for the *get* method supported by a *issuer* resource.
23819/// It is not used directly, but through a [`IssuerMethods`] instance.
23820///
23821/// # Example
23822///
23823/// Instantiate a resource method builder
23824///
23825/// ```test_harness,no_run
23826/// # extern crate hyper;
23827/// # extern crate hyper_rustls;
23828/// # extern crate google_walletobjects1 as walletobjects1;
23829/// # async fn dox() {
23830/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23831///
23832/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23833/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23834/// #     .with_native_roots()
23835/// #     .unwrap()
23836/// #     .https_only()
23837/// #     .enable_http2()
23838/// #     .build();
23839///
23840/// # let executor = hyper_util::rt::TokioExecutor::new();
23841/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23842/// #     secret,
23843/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23844/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23845/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23846/// #     ),
23847/// # ).build().await.unwrap();
23848///
23849/// # let client = hyper_util::client::legacy::Client::builder(
23850/// #     hyper_util::rt::TokioExecutor::new()
23851/// # )
23852/// # .build(
23853/// #     hyper_rustls::HttpsConnectorBuilder::new()
23854/// #         .with_native_roots()
23855/// #         .unwrap()
23856/// #         .https_or_http()
23857/// #         .enable_http2()
23858/// #         .build()
23859/// # );
23860/// # let mut hub = Walletobjects::new(client, auth);
23861/// // You can configure optional parameters by calling the respective setters at will, and
23862/// // execute the final call using `doit()`.
23863/// // Values shown here are possibly random and not representative !
23864/// let result = hub.issuer().get(-22)
23865///              .doit().await;
23866/// # }
23867/// ```
23868pub struct IssuerGetCall<'a, C>
23869where
23870    C: 'a,
23871{
23872    hub: &'a Walletobjects<C>,
23873    _resource_id: i64,
23874    _delegate: Option<&'a mut dyn common::Delegate>,
23875    _additional_params: HashMap<String, String>,
23876    _scopes: BTreeSet<String>,
23877}
23878
23879impl<'a, C> common::CallBuilder for IssuerGetCall<'a, C> {}
23880
23881impl<'a, C> IssuerGetCall<'a, C>
23882where
23883    C: common::Connector,
23884{
23885    /// Perform the operation you have build so far.
23886    pub async fn doit(mut self) -> common::Result<(common::Response, Issuer)> {
23887        use std::borrow::Cow;
23888        use std::io::{Read, Seek};
23889
23890        use common::{url::Params, ToParts};
23891        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23892
23893        let mut dd = common::DefaultDelegate;
23894        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23895        dlg.begin(common::MethodInfo {
23896            id: "walletobjects.issuer.get",
23897            http_method: hyper::Method::GET,
23898        });
23899
23900        for &field in ["alt", "resourceId"].iter() {
23901            if self._additional_params.contains_key(field) {
23902                dlg.finished(false);
23903                return Err(common::Error::FieldClash(field));
23904            }
23905        }
23906
23907        let mut params = Params::with_capacity(3 + self._additional_params.len());
23908        params.push("resourceId", self._resource_id.to_string());
23909
23910        params.extend(self._additional_params.iter());
23911
23912        params.push("alt", "json");
23913        let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer/{resourceId}";
23914        if self._scopes.is_empty() {
23915            self._scopes
23916                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
23917        }
23918
23919        #[allow(clippy::single_element_loop)]
23920        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
23921            url = params.uri_replacement(url, param_name, find_this, false);
23922        }
23923        {
23924            let to_remove = ["resourceId"];
23925            params.remove_params(&to_remove);
23926        }
23927
23928        let url = params.parse_with_url(&url);
23929
23930        loop {
23931            let token = match self
23932                .hub
23933                .auth
23934                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23935                .await
23936            {
23937                Ok(token) => token,
23938                Err(e) => match dlg.token(e) {
23939                    Ok(token) => token,
23940                    Err(e) => {
23941                        dlg.finished(false);
23942                        return Err(common::Error::MissingToken(e));
23943                    }
23944                },
23945            };
23946            let mut req_result = {
23947                let client = &self.hub.client;
23948                dlg.pre_request();
23949                let mut req_builder = hyper::Request::builder()
23950                    .method(hyper::Method::GET)
23951                    .uri(url.as_str())
23952                    .header(USER_AGENT, self.hub._user_agent.clone());
23953
23954                if let Some(token) = token.as_ref() {
23955                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23956                }
23957
23958                let request = req_builder
23959                    .header(CONTENT_LENGTH, 0_u64)
23960                    .body(common::to_body::<String>(None));
23961
23962                client.request(request.unwrap()).await
23963            };
23964
23965            match req_result {
23966                Err(err) => {
23967                    if let common::Retry::After(d) = dlg.http_error(&err) {
23968                        sleep(d).await;
23969                        continue;
23970                    }
23971                    dlg.finished(false);
23972                    return Err(common::Error::HttpError(err));
23973                }
23974                Ok(res) => {
23975                    let (mut parts, body) = res.into_parts();
23976                    let mut body = common::Body::new(body);
23977                    if !parts.status.is_success() {
23978                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23979                        let error = serde_json::from_str(&common::to_string(&bytes));
23980                        let response = common::to_response(parts, bytes.into());
23981
23982                        if let common::Retry::After(d) =
23983                            dlg.http_failure(&response, error.as_ref().ok())
23984                        {
23985                            sleep(d).await;
23986                            continue;
23987                        }
23988
23989                        dlg.finished(false);
23990
23991                        return Err(match error {
23992                            Ok(value) => common::Error::BadRequest(value),
23993                            _ => common::Error::Failure(response),
23994                        });
23995                    }
23996                    let response = {
23997                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23998                        let encoded = common::to_string(&bytes);
23999                        match serde_json::from_str(&encoded) {
24000                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24001                            Err(error) => {
24002                                dlg.response_json_decode_error(&encoded, &error);
24003                                return Err(common::Error::JsonDecodeError(
24004                                    encoded.to_string(),
24005                                    error,
24006                                ));
24007                            }
24008                        }
24009                    };
24010
24011                    dlg.finished(true);
24012                    return Ok(response);
24013                }
24014            }
24015        }
24016    }
24017
24018    /// The unique identifier for an issuer.
24019    ///
24020    /// Sets the *resource id* path property to the given value.
24021    ///
24022    /// Even though the property as already been set when instantiating this call,
24023    /// we provide this method for API completeness.
24024    pub fn resource_id(mut self, new_value: i64) -> IssuerGetCall<'a, C> {
24025        self._resource_id = 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(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerGetCall<'a, C> {
24037        self._delegate = Some(new_value);
24038        self
24039    }
24040
24041    /// Set any additional parameter of the query string used in the request.
24042    /// It should be used to set parameters which are not yet available through their own
24043    /// setters.
24044    ///
24045    /// Please note that this method must not be used to set any of the known parameters
24046    /// which have their own setter method. If done anyway, the request will fail.
24047    ///
24048    /// # Additional Parameters
24049    ///
24050    /// * *$.xgafv* (query-string) - V1 error format.
24051    /// * *access_token* (query-string) - OAuth access token.
24052    /// * *alt* (query-string) - Data format for response.
24053    /// * *callback* (query-string) - JSONP
24054    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24055    /// * *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.
24056    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24057    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24058    /// * *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.
24059    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24060    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24061    pub fn param<T>(mut self, name: T, value: T) -> IssuerGetCall<'a, C>
24062    where
24063        T: AsRef<str>,
24064    {
24065        self._additional_params
24066            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24067        self
24068    }
24069
24070    /// Identifies the authorization scope for the method you are building.
24071    ///
24072    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24073    /// [`Scope::WalletObjectIssuer`].
24074    ///
24075    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24076    /// tokens for more than one scope.
24077    ///
24078    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24079    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24080    /// sufficient, a read-write scope will do as well.
24081    pub fn add_scope<St>(mut self, scope: St) -> IssuerGetCall<'a, C>
24082    where
24083        St: AsRef<str>,
24084    {
24085        self._scopes.insert(String::from(scope.as_ref()));
24086        self
24087    }
24088    /// Identifies the authorization scope(s) for the method you are building.
24089    ///
24090    /// See [`Self::add_scope()`] for details.
24091    pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerGetCall<'a, C>
24092    where
24093        I: IntoIterator<Item = St>,
24094        St: AsRef<str>,
24095    {
24096        self._scopes
24097            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24098        self
24099    }
24100
24101    /// Removes all scopes, and no default scope will be used either.
24102    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24103    /// for details).
24104    pub fn clear_scopes(mut self) -> IssuerGetCall<'a, C> {
24105        self._scopes.clear();
24106        self
24107    }
24108}
24109
24110/// Inserts an issuer with the given ID and properties.
24111///
24112/// A builder for the *insert* method supported by a *issuer* resource.
24113/// It is not used directly, but through a [`IssuerMethods`] instance.
24114///
24115/// # Example
24116///
24117/// Instantiate a resource method builder
24118///
24119/// ```test_harness,no_run
24120/// # extern crate hyper;
24121/// # extern crate hyper_rustls;
24122/// # extern crate google_walletobjects1 as walletobjects1;
24123/// use walletobjects1::api::Issuer;
24124/// # async fn dox() {
24125/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24126///
24127/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24128/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24129/// #     .with_native_roots()
24130/// #     .unwrap()
24131/// #     .https_only()
24132/// #     .enable_http2()
24133/// #     .build();
24134///
24135/// # let executor = hyper_util::rt::TokioExecutor::new();
24136/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24137/// #     secret,
24138/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24139/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24140/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24141/// #     ),
24142/// # ).build().await.unwrap();
24143///
24144/// # let client = hyper_util::client::legacy::Client::builder(
24145/// #     hyper_util::rt::TokioExecutor::new()
24146/// # )
24147/// # .build(
24148/// #     hyper_rustls::HttpsConnectorBuilder::new()
24149/// #         .with_native_roots()
24150/// #         .unwrap()
24151/// #         .https_or_http()
24152/// #         .enable_http2()
24153/// #         .build()
24154/// # );
24155/// # let mut hub = Walletobjects::new(client, auth);
24156/// // As the method needs a request, you would usually fill it with the desired information
24157/// // into the respective structure. Some of the parts shown here might not be applicable !
24158/// // Values shown here are possibly random and not representative !
24159/// let mut req = Issuer::default();
24160///
24161/// // You can configure optional parameters by calling the respective setters at will, and
24162/// // execute the final call using `doit()`.
24163/// // Values shown here are possibly random and not representative !
24164/// let result = hub.issuer().insert(req)
24165///              .doit().await;
24166/// # }
24167/// ```
24168pub struct IssuerInsertCall<'a, C>
24169where
24170    C: 'a,
24171{
24172    hub: &'a Walletobjects<C>,
24173    _request: Issuer,
24174    _delegate: Option<&'a mut dyn common::Delegate>,
24175    _additional_params: HashMap<String, String>,
24176    _scopes: BTreeSet<String>,
24177}
24178
24179impl<'a, C> common::CallBuilder for IssuerInsertCall<'a, C> {}
24180
24181impl<'a, C> IssuerInsertCall<'a, C>
24182where
24183    C: common::Connector,
24184{
24185    /// Perform the operation you have build so far.
24186    pub async fn doit(mut self) -> common::Result<(common::Response, Issuer)> {
24187        use std::borrow::Cow;
24188        use std::io::{Read, Seek};
24189
24190        use common::{url::Params, ToParts};
24191        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24192
24193        let mut dd = common::DefaultDelegate;
24194        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24195        dlg.begin(common::MethodInfo {
24196            id: "walletobjects.issuer.insert",
24197            http_method: hyper::Method::POST,
24198        });
24199
24200        for &field in ["alt"].iter() {
24201            if self._additional_params.contains_key(field) {
24202                dlg.finished(false);
24203                return Err(common::Error::FieldClash(field));
24204            }
24205        }
24206
24207        let mut params = Params::with_capacity(3 + self._additional_params.len());
24208
24209        params.extend(self._additional_params.iter());
24210
24211        params.push("alt", "json");
24212        let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer";
24213        if self._scopes.is_empty() {
24214            self._scopes
24215                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
24216        }
24217
24218        let url = params.parse_with_url(&url);
24219
24220        let mut json_mime_type = mime::APPLICATION_JSON;
24221        let mut request_value_reader = {
24222            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24223            common::remove_json_null_values(&mut value);
24224            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24225            serde_json::to_writer(&mut dst, &value).unwrap();
24226            dst
24227        };
24228        let request_size = request_value_reader
24229            .seek(std::io::SeekFrom::End(0))
24230            .unwrap();
24231        request_value_reader
24232            .seek(std::io::SeekFrom::Start(0))
24233            .unwrap();
24234
24235        loop {
24236            let token = match self
24237                .hub
24238                .auth
24239                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24240                .await
24241            {
24242                Ok(token) => token,
24243                Err(e) => match dlg.token(e) {
24244                    Ok(token) => token,
24245                    Err(e) => {
24246                        dlg.finished(false);
24247                        return Err(common::Error::MissingToken(e));
24248                    }
24249                },
24250            };
24251            request_value_reader
24252                .seek(std::io::SeekFrom::Start(0))
24253                .unwrap();
24254            let mut req_result = {
24255                let client = &self.hub.client;
24256                dlg.pre_request();
24257                let mut req_builder = hyper::Request::builder()
24258                    .method(hyper::Method::POST)
24259                    .uri(url.as_str())
24260                    .header(USER_AGENT, self.hub._user_agent.clone());
24261
24262                if let Some(token) = token.as_ref() {
24263                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24264                }
24265
24266                let request = req_builder
24267                    .header(CONTENT_TYPE, json_mime_type.to_string())
24268                    .header(CONTENT_LENGTH, request_size as u64)
24269                    .body(common::to_body(
24270                        request_value_reader.get_ref().clone().into(),
24271                    ));
24272
24273                client.request(request.unwrap()).await
24274            };
24275
24276            match req_result {
24277                Err(err) => {
24278                    if let common::Retry::After(d) = dlg.http_error(&err) {
24279                        sleep(d).await;
24280                        continue;
24281                    }
24282                    dlg.finished(false);
24283                    return Err(common::Error::HttpError(err));
24284                }
24285                Ok(res) => {
24286                    let (mut parts, body) = res.into_parts();
24287                    let mut body = common::Body::new(body);
24288                    if !parts.status.is_success() {
24289                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24290                        let error = serde_json::from_str(&common::to_string(&bytes));
24291                        let response = common::to_response(parts, bytes.into());
24292
24293                        if let common::Retry::After(d) =
24294                            dlg.http_failure(&response, error.as_ref().ok())
24295                        {
24296                            sleep(d).await;
24297                            continue;
24298                        }
24299
24300                        dlg.finished(false);
24301
24302                        return Err(match error {
24303                            Ok(value) => common::Error::BadRequest(value),
24304                            _ => common::Error::Failure(response),
24305                        });
24306                    }
24307                    let response = {
24308                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24309                        let encoded = common::to_string(&bytes);
24310                        match serde_json::from_str(&encoded) {
24311                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24312                            Err(error) => {
24313                                dlg.response_json_decode_error(&encoded, &error);
24314                                return Err(common::Error::JsonDecodeError(
24315                                    encoded.to_string(),
24316                                    error,
24317                                ));
24318                            }
24319                        }
24320                    };
24321
24322                    dlg.finished(true);
24323                    return Ok(response);
24324                }
24325            }
24326        }
24327    }
24328
24329    ///
24330    /// Sets the *request* property to the given value.
24331    ///
24332    /// Even though the property as already been set when instantiating this call,
24333    /// we provide this method for API completeness.
24334    pub fn request(mut self, new_value: Issuer) -> IssuerInsertCall<'a, C> {
24335        self._request = new_value;
24336        self
24337    }
24338    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24339    /// while executing the actual API request.
24340    ///
24341    /// ````text
24342    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24343    /// ````
24344    ///
24345    /// Sets the *delegate* property to the given value.
24346    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerInsertCall<'a, C> {
24347        self._delegate = Some(new_value);
24348        self
24349    }
24350
24351    /// Set any additional parameter of the query string used in the request.
24352    /// It should be used to set parameters which are not yet available through their own
24353    /// setters.
24354    ///
24355    /// Please note that this method must not be used to set any of the known parameters
24356    /// which have their own setter method. If done anyway, the request will fail.
24357    ///
24358    /// # Additional Parameters
24359    ///
24360    /// * *$.xgafv* (query-string) - V1 error format.
24361    /// * *access_token* (query-string) - OAuth access token.
24362    /// * *alt* (query-string) - Data format for response.
24363    /// * *callback* (query-string) - JSONP
24364    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24365    /// * *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.
24366    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24367    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24368    /// * *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.
24369    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24370    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24371    pub fn param<T>(mut self, name: T, value: T) -> IssuerInsertCall<'a, C>
24372    where
24373        T: AsRef<str>,
24374    {
24375        self._additional_params
24376            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24377        self
24378    }
24379
24380    /// Identifies the authorization scope for the method you are building.
24381    ///
24382    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24383    /// [`Scope::WalletObjectIssuer`].
24384    ///
24385    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24386    /// tokens for more than one scope.
24387    ///
24388    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24389    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24390    /// sufficient, a read-write scope will do as well.
24391    pub fn add_scope<St>(mut self, scope: St) -> IssuerInsertCall<'a, C>
24392    where
24393        St: AsRef<str>,
24394    {
24395        self._scopes.insert(String::from(scope.as_ref()));
24396        self
24397    }
24398    /// Identifies the authorization scope(s) for the method you are building.
24399    ///
24400    /// See [`Self::add_scope()`] for details.
24401    pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerInsertCall<'a, C>
24402    where
24403        I: IntoIterator<Item = St>,
24404        St: AsRef<str>,
24405    {
24406        self._scopes
24407            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24408        self
24409    }
24410
24411    /// Removes all scopes, and no default scope will be used either.
24412    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24413    /// for details).
24414    pub fn clear_scopes(mut self) -> IssuerInsertCall<'a, C> {
24415        self._scopes.clear();
24416        self
24417    }
24418}
24419
24420/// Returns a list of all issuers shared to the caller.
24421///
24422/// A builder for the *list* method supported by a *issuer* resource.
24423/// It is not used directly, but through a [`IssuerMethods`] instance.
24424///
24425/// # Example
24426///
24427/// Instantiate a resource method builder
24428///
24429/// ```test_harness,no_run
24430/// # extern crate hyper;
24431/// # extern crate hyper_rustls;
24432/// # extern crate google_walletobjects1 as walletobjects1;
24433/// # async fn dox() {
24434/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24435///
24436/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24437/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24438/// #     .with_native_roots()
24439/// #     .unwrap()
24440/// #     .https_only()
24441/// #     .enable_http2()
24442/// #     .build();
24443///
24444/// # let executor = hyper_util::rt::TokioExecutor::new();
24445/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24446/// #     secret,
24447/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24448/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24449/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24450/// #     ),
24451/// # ).build().await.unwrap();
24452///
24453/// # let client = hyper_util::client::legacy::Client::builder(
24454/// #     hyper_util::rt::TokioExecutor::new()
24455/// # )
24456/// # .build(
24457/// #     hyper_rustls::HttpsConnectorBuilder::new()
24458/// #         .with_native_roots()
24459/// #         .unwrap()
24460/// #         .https_or_http()
24461/// #         .enable_http2()
24462/// #         .build()
24463/// # );
24464/// # let mut hub = Walletobjects::new(client, auth);
24465/// // You can configure optional parameters by calling the respective setters at will, and
24466/// // execute the final call using `doit()`.
24467/// // Values shown here are possibly random and not representative !
24468/// let result = hub.issuer().list()
24469///              .doit().await;
24470/// # }
24471/// ```
24472pub struct IssuerListCall<'a, C>
24473where
24474    C: 'a,
24475{
24476    hub: &'a Walletobjects<C>,
24477    _delegate: Option<&'a mut dyn common::Delegate>,
24478    _additional_params: HashMap<String, String>,
24479    _scopes: BTreeSet<String>,
24480}
24481
24482impl<'a, C> common::CallBuilder for IssuerListCall<'a, C> {}
24483
24484impl<'a, C> IssuerListCall<'a, C>
24485where
24486    C: common::Connector,
24487{
24488    /// Perform the operation you have build so far.
24489    pub async fn doit(mut self) -> common::Result<(common::Response, IssuerListResponse)> {
24490        use std::borrow::Cow;
24491        use std::io::{Read, Seek};
24492
24493        use common::{url::Params, ToParts};
24494        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24495
24496        let mut dd = common::DefaultDelegate;
24497        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24498        dlg.begin(common::MethodInfo {
24499            id: "walletobjects.issuer.list",
24500            http_method: hyper::Method::GET,
24501        });
24502
24503        for &field in ["alt"].iter() {
24504            if self._additional_params.contains_key(field) {
24505                dlg.finished(false);
24506                return Err(common::Error::FieldClash(field));
24507            }
24508        }
24509
24510        let mut params = Params::with_capacity(2 + self._additional_params.len());
24511
24512        params.extend(self._additional_params.iter());
24513
24514        params.push("alt", "json");
24515        let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer";
24516        if self._scopes.is_empty() {
24517            self._scopes
24518                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
24519        }
24520
24521        let url = params.parse_with_url(&url);
24522
24523        loop {
24524            let token = match self
24525                .hub
24526                .auth
24527                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24528                .await
24529            {
24530                Ok(token) => token,
24531                Err(e) => match dlg.token(e) {
24532                    Ok(token) => token,
24533                    Err(e) => {
24534                        dlg.finished(false);
24535                        return Err(common::Error::MissingToken(e));
24536                    }
24537                },
24538            };
24539            let mut req_result = {
24540                let client = &self.hub.client;
24541                dlg.pre_request();
24542                let mut req_builder = hyper::Request::builder()
24543                    .method(hyper::Method::GET)
24544                    .uri(url.as_str())
24545                    .header(USER_AGENT, self.hub._user_agent.clone());
24546
24547                if let Some(token) = token.as_ref() {
24548                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24549                }
24550
24551                let request = req_builder
24552                    .header(CONTENT_LENGTH, 0_u64)
24553                    .body(common::to_body::<String>(None));
24554
24555                client.request(request.unwrap()).await
24556            };
24557
24558            match req_result {
24559                Err(err) => {
24560                    if let common::Retry::After(d) = dlg.http_error(&err) {
24561                        sleep(d).await;
24562                        continue;
24563                    }
24564                    dlg.finished(false);
24565                    return Err(common::Error::HttpError(err));
24566                }
24567                Ok(res) => {
24568                    let (mut parts, body) = res.into_parts();
24569                    let mut body = common::Body::new(body);
24570                    if !parts.status.is_success() {
24571                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24572                        let error = serde_json::from_str(&common::to_string(&bytes));
24573                        let response = common::to_response(parts, bytes.into());
24574
24575                        if let common::Retry::After(d) =
24576                            dlg.http_failure(&response, error.as_ref().ok())
24577                        {
24578                            sleep(d).await;
24579                            continue;
24580                        }
24581
24582                        dlg.finished(false);
24583
24584                        return Err(match error {
24585                            Ok(value) => common::Error::BadRequest(value),
24586                            _ => common::Error::Failure(response),
24587                        });
24588                    }
24589                    let response = {
24590                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24591                        let encoded = common::to_string(&bytes);
24592                        match serde_json::from_str(&encoded) {
24593                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24594                            Err(error) => {
24595                                dlg.response_json_decode_error(&encoded, &error);
24596                                return Err(common::Error::JsonDecodeError(
24597                                    encoded.to_string(),
24598                                    error,
24599                                ));
24600                            }
24601                        }
24602                    };
24603
24604                    dlg.finished(true);
24605                    return Ok(response);
24606                }
24607            }
24608        }
24609    }
24610
24611    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24612    /// while executing the actual API request.
24613    ///
24614    /// ````text
24615    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24616    /// ````
24617    ///
24618    /// Sets the *delegate* property to the given value.
24619    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerListCall<'a, C> {
24620        self._delegate = Some(new_value);
24621        self
24622    }
24623
24624    /// Set any additional parameter of the query string used in the request.
24625    /// It should be used to set parameters which are not yet available through their own
24626    /// setters.
24627    ///
24628    /// Please note that this method must not be used to set any of the known parameters
24629    /// which have their own setter method. If done anyway, the request will fail.
24630    ///
24631    /// # Additional Parameters
24632    ///
24633    /// * *$.xgafv* (query-string) - V1 error format.
24634    /// * *access_token* (query-string) - OAuth access token.
24635    /// * *alt* (query-string) - Data format for response.
24636    /// * *callback* (query-string) - JSONP
24637    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24638    /// * *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.
24639    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24640    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24641    /// * *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.
24642    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24643    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24644    pub fn param<T>(mut self, name: T, value: T) -> IssuerListCall<'a, C>
24645    where
24646        T: AsRef<str>,
24647    {
24648        self._additional_params
24649            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24650        self
24651    }
24652
24653    /// Identifies the authorization scope for the method you are building.
24654    ///
24655    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24656    /// [`Scope::WalletObjectIssuer`].
24657    ///
24658    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24659    /// tokens for more than one scope.
24660    ///
24661    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24662    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24663    /// sufficient, a read-write scope will do as well.
24664    pub fn add_scope<St>(mut self, scope: St) -> IssuerListCall<'a, C>
24665    where
24666        St: AsRef<str>,
24667    {
24668        self._scopes.insert(String::from(scope.as_ref()));
24669        self
24670    }
24671    /// Identifies the authorization scope(s) for the method you are building.
24672    ///
24673    /// See [`Self::add_scope()`] for details.
24674    pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerListCall<'a, C>
24675    where
24676        I: IntoIterator<Item = St>,
24677        St: AsRef<str>,
24678    {
24679        self._scopes
24680            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24681        self
24682    }
24683
24684    /// Removes all scopes, and no default scope will be used either.
24685    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24686    /// for details).
24687    pub fn clear_scopes(mut self) -> IssuerListCall<'a, C> {
24688        self._scopes.clear();
24689        self
24690    }
24691}
24692
24693/// Updates the issuer referenced by the given issuer ID. This method supports patch semantics.
24694///
24695/// A builder for the *patch* method supported by a *issuer* resource.
24696/// It is not used directly, but through a [`IssuerMethods`] instance.
24697///
24698/// # Example
24699///
24700/// Instantiate a resource method builder
24701///
24702/// ```test_harness,no_run
24703/// # extern crate hyper;
24704/// # extern crate hyper_rustls;
24705/// # extern crate google_walletobjects1 as walletobjects1;
24706/// use walletobjects1::api::Issuer;
24707/// # async fn dox() {
24708/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24709///
24710/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24711/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24712/// #     .with_native_roots()
24713/// #     .unwrap()
24714/// #     .https_only()
24715/// #     .enable_http2()
24716/// #     .build();
24717///
24718/// # let executor = hyper_util::rt::TokioExecutor::new();
24719/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24720/// #     secret,
24721/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24722/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24723/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24724/// #     ),
24725/// # ).build().await.unwrap();
24726///
24727/// # let client = hyper_util::client::legacy::Client::builder(
24728/// #     hyper_util::rt::TokioExecutor::new()
24729/// # )
24730/// # .build(
24731/// #     hyper_rustls::HttpsConnectorBuilder::new()
24732/// #         .with_native_roots()
24733/// #         .unwrap()
24734/// #         .https_or_http()
24735/// #         .enable_http2()
24736/// #         .build()
24737/// # );
24738/// # let mut hub = Walletobjects::new(client, auth);
24739/// // As the method needs a request, you would usually fill it with the desired information
24740/// // into the respective structure. Some of the parts shown here might not be applicable !
24741/// // Values shown here are possibly random and not representative !
24742/// let mut req = Issuer::default();
24743///
24744/// // You can configure optional parameters by calling the respective setters at will, and
24745/// // execute the final call using `doit()`.
24746/// // Values shown here are possibly random and not representative !
24747/// let result = hub.issuer().patch(req, -95)
24748///              .doit().await;
24749/// # }
24750/// ```
24751pub struct IssuerPatchCall<'a, C>
24752where
24753    C: 'a,
24754{
24755    hub: &'a Walletobjects<C>,
24756    _request: Issuer,
24757    _resource_id: i64,
24758    _delegate: Option<&'a mut dyn common::Delegate>,
24759    _additional_params: HashMap<String, String>,
24760    _scopes: BTreeSet<String>,
24761}
24762
24763impl<'a, C> common::CallBuilder for IssuerPatchCall<'a, C> {}
24764
24765impl<'a, C> IssuerPatchCall<'a, C>
24766where
24767    C: common::Connector,
24768{
24769    /// Perform the operation you have build so far.
24770    pub async fn doit(mut self) -> common::Result<(common::Response, Issuer)> {
24771        use std::borrow::Cow;
24772        use std::io::{Read, Seek};
24773
24774        use common::{url::Params, ToParts};
24775        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24776
24777        let mut dd = common::DefaultDelegate;
24778        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24779        dlg.begin(common::MethodInfo {
24780            id: "walletobjects.issuer.patch",
24781            http_method: hyper::Method::PATCH,
24782        });
24783
24784        for &field in ["alt", "resourceId"].iter() {
24785            if self._additional_params.contains_key(field) {
24786                dlg.finished(false);
24787                return Err(common::Error::FieldClash(field));
24788            }
24789        }
24790
24791        let mut params = Params::with_capacity(4 + self._additional_params.len());
24792        params.push("resourceId", self._resource_id.to_string());
24793
24794        params.extend(self._additional_params.iter());
24795
24796        params.push("alt", "json");
24797        let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer/{resourceId}";
24798        if self._scopes.is_empty() {
24799            self._scopes
24800                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
24801        }
24802
24803        #[allow(clippy::single_element_loop)]
24804        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
24805            url = params.uri_replacement(url, param_name, find_this, false);
24806        }
24807        {
24808            let to_remove = ["resourceId"];
24809            params.remove_params(&to_remove);
24810        }
24811
24812        let url = params.parse_with_url(&url);
24813
24814        let mut json_mime_type = mime::APPLICATION_JSON;
24815        let mut request_value_reader = {
24816            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24817            common::remove_json_null_values(&mut value);
24818            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24819            serde_json::to_writer(&mut dst, &value).unwrap();
24820            dst
24821        };
24822        let request_size = request_value_reader
24823            .seek(std::io::SeekFrom::End(0))
24824            .unwrap();
24825        request_value_reader
24826            .seek(std::io::SeekFrom::Start(0))
24827            .unwrap();
24828
24829        loop {
24830            let token = match self
24831                .hub
24832                .auth
24833                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24834                .await
24835            {
24836                Ok(token) => token,
24837                Err(e) => match dlg.token(e) {
24838                    Ok(token) => token,
24839                    Err(e) => {
24840                        dlg.finished(false);
24841                        return Err(common::Error::MissingToken(e));
24842                    }
24843                },
24844            };
24845            request_value_reader
24846                .seek(std::io::SeekFrom::Start(0))
24847                .unwrap();
24848            let mut req_result = {
24849                let client = &self.hub.client;
24850                dlg.pre_request();
24851                let mut req_builder = hyper::Request::builder()
24852                    .method(hyper::Method::PATCH)
24853                    .uri(url.as_str())
24854                    .header(USER_AGENT, self.hub._user_agent.clone());
24855
24856                if let Some(token) = token.as_ref() {
24857                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24858                }
24859
24860                let request = req_builder
24861                    .header(CONTENT_TYPE, json_mime_type.to_string())
24862                    .header(CONTENT_LENGTH, request_size as u64)
24863                    .body(common::to_body(
24864                        request_value_reader.get_ref().clone().into(),
24865                    ));
24866
24867                client.request(request.unwrap()).await
24868            };
24869
24870            match req_result {
24871                Err(err) => {
24872                    if let common::Retry::After(d) = dlg.http_error(&err) {
24873                        sleep(d).await;
24874                        continue;
24875                    }
24876                    dlg.finished(false);
24877                    return Err(common::Error::HttpError(err));
24878                }
24879                Ok(res) => {
24880                    let (mut parts, body) = res.into_parts();
24881                    let mut body = common::Body::new(body);
24882                    if !parts.status.is_success() {
24883                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24884                        let error = serde_json::from_str(&common::to_string(&bytes));
24885                        let response = common::to_response(parts, bytes.into());
24886
24887                        if let common::Retry::After(d) =
24888                            dlg.http_failure(&response, error.as_ref().ok())
24889                        {
24890                            sleep(d).await;
24891                            continue;
24892                        }
24893
24894                        dlg.finished(false);
24895
24896                        return Err(match error {
24897                            Ok(value) => common::Error::BadRequest(value),
24898                            _ => common::Error::Failure(response),
24899                        });
24900                    }
24901                    let response = {
24902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24903                        let encoded = common::to_string(&bytes);
24904                        match serde_json::from_str(&encoded) {
24905                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24906                            Err(error) => {
24907                                dlg.response_json_decode_error(&encoded, &error);
24908                                return Err(common::Error::JsonDecodeError(
24909                                    encoded.to_string(),
24910                                    error,
24911                                ));
24912                            }
24913                        }
24914                    };
24915
24916                    dlg.finished(true);
24917                    return Ok(response);
24918                }
24919            }
24920        }
24921    }
24922
24923    ///
24924    /// Sets the *request* property to the given value.
24925    ///
24926    /// Even though the property as already been set when instantiating this call,
24927    /// we provide this method for API completeness.
24928    pub fn request(mut self, new_value: Issuer) -> IssuerPatchCall<'a, C> {
24929        self._request = new_value;
24930        self
24931    }
24932    /// The unique identifier for an issuer.
24933    ///
24934    /// Sets the *resource id* path property to the given value.
24935    ///
24936    /// Even though the property as already been set when instantiating this call,
24937    /// we provide this method for API completeness.
24938    pub fn resource_id(mut self, new_value: i64) -> IssuerPatchCall<'a, C> {
24939        self._resource_id = new_value;
24940        self
24941    }
24942    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24943    /// while executing the actual API request.
24944    ///
24945    /// ````text
24946    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24947    /// ````
24948    ///
24949    /// Sets the *delegate* property to the given value.
24950    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerPatchCall<'a, C> {
24951        self._delegate = Some(new_value);
24952        self
24953    }
24954
24955    /// Set any additional parameter of the query string used in the request.
24956    /// It should be used to set parameters which are not yet available through their own
24957    /// setters.
24958    ///
24959    /// Please note that this method must not be used to set any of the known parameters
24960    /// which have their own setter method. If done anyway, the request will fail.
24961    ///
24962    /// # Additional Parameters
24963    ///
24964    /// * *$.xgafv* (query-string) - V1 error format.
24965    /// * *access_token* (query-string) - OAuth access token.
24966    /// * *alt* (query-string) - Data format for response.
24967    /// * *callback* (query-string) - JSONP
24968    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24969    /// * *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.
24970    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24971    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24972    /// * *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.
24973    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24974    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24975    pub fn param<T>(mut self, name: T, value: T) -> IssuerPatchCall<'a, C>
24976    where
24977        T: AsRef<str>,
24978    {
24979        self._additional_params
24980            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24981        self
24982    }
24983
24984    /// Identifies the authorization scope for the method you are building.
24985    ///
24986    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24987    /// [`Scope::WalletObjectIssuer`].
24988    ///
24989    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24990    /// tokens for more than one scope.
24991    ///
24992    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24993    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24994    /// sufficient, a read-write scope will do as well.
24995    pub fn add_scope<St>(mut self, scope: St) -> IssuerPatchCall<'a, C>
24996    where
24997        St: AsRef<str>,
24998    {
24999        self._scopes.insert(String::from(scope.as_ref()));
25000        self
25001    }
25002    /// Identifies the authorization scope(s) for the method you are building.
25003    ///
25004    /// See [`Self::add_scope()`] for details.
25005    pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerPatchCall<'a, C>
25006    where
25007        I: IntoIterator<Item = St>,
25008        St: AsRef<str>,
25009    {
25010        self._scopes
25011            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25012        self
25013    }
25014
25015    /// Removes all scopes, and no default scope will be used either.
25016    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25017    /// for details).
25018    pub fn clear_scopes(mut self) -> IssuerPatchCall<'a, C> {
25019        self._scopes.clear();
25020        self
25021    }
25022}
25023
25024/// Updates the issuer referenced by the given issuer ID.
25025///
25026/// A builder for the *update* method supported by a *issuer* resource.
25027/// It is not used directly, but through a [`IssuerMethods`] instance.
25028///
25029/// # Example
25030///
25031/// Instantiate a resource method builder
25032///
25033/// ```test_harness,no_run
25034/// # extern crate hyper;
25035/// # extern crate hyper_rustls;
25036/// # extern crate google_walletobjects1 as walletobjects1;
25037/// use walletobjects1::api::Issuer;
25038/// # async fn dox() {
25039/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25040///
25041/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25042/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25043/// #     .with_native_roots()
25044/// #     .unwrap()
25045/// #     .https_only()
25046/// #     .enable_http2()
25047/// #     .build();
25048///
25049/// # let executor = hyper_util::rt::TokioExecutor::new();
25050/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25051/// #     secret,
25052/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25053/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25054/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25055/// #     ),
25056/// # ).build().await.unwrap();
25057///
25058/// # let client = hyper_util::client::legacy::Client::builder(
25059/// #     hyper_util::rt::TokioExecutor::new()
25060/// # )
25061/// # .build(
25062/// #     hyper_rustls::HttpsConnectorBuilder::new()
25063/// #         .with_native_roots()
25064/// #         .unwrap()
25065/// #         .https_or_http()
25066/// #         .enable_http2()
25067/// #         .build()
25068/// # );
25069/// # let mut hub = Walletobjects::new(client, auth);
25070/// // As the method needs a request, you would usually fill it with the desired information
25071/// // into the respective structure. Some of the parts shown here might not be applicable !
25072/// // Values shown here are possibly random and not representative !
25073/// let mut req = Issuer::default();
25074///
25075/// // You can configure optional parameters by calling the respective setters at will, and
25076/// // execute the final call using `doit()`.
25077/// // Values shown here are possibly random and not representative !
25078/// let result = hub.issuer().update(req, -15)
25079///              .doit().await;
25080/// # }
25081/// ```
25082pub struct IssuerUpdateCall<'a, C>
25083where
25084    C: 'a,
25085{
25086    hub: &'a Walletobjects<C>,
25087    _request: Issuer,
25088    _resource_id: i64,
25089    _delegate: Option<&'a mut dyn common::Delegate>,
25090    _additional_params: HashMap<String, String>,
25091    _scopes: BTreeSet<String>,
25092}
25093
25094impl<'a, C> common::CallBuilder for IssuerUpdateCall<'a, C> {}
25095
25096impl<'a, C> IssuerUpdateCall<'a, C>
25097where
25098    C: common::Connector,
25099{
25100    /// Perform the operation you have build so far.
25101    pub async fn doit(mut self) -> common::Result<(common::Response, Issuer)> {
25102        use std::borrow::Cow;
25103        use std::io::{Read, Seek};
25104
25105        use common::{url::Params, ToParts};
25106        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25107
25108        let mut dd = common::DefaultDelegate;
25109        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25110        dlg.begin(common::MethodInfo {
25111            id: "walletobjects.issuer.update",
25112            http_method: hyper::Method::PUT,
25113        });
25114
25115        for &field in ["alt", "resourceId"].iter() {
25116            if self._additional_params.contains_key(field) {
25117                dlg.finished(false);
25118                return Err(common::Error::FieldClash(field));
25119            }
25120        }
25121
25122        let mut params = Params::with_capacity(4 + self._additional_params.len());
25123        params.push("resourceId", self._resource_id.to_string());
25124
25125        params.extend(self._additional_params.iter());
25126
25127        params.push("alt", "json");
25128        let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer/{resourceId}";
25129        if self._scopes.is_empty() {
25130            self._scopes
25131                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
25132        }
25133
25134        #[allow(clippy::single_element_loop)]
25135        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
25136            url = params.uri_replacement(url, param_name, find_this, false);
25137        }
25138        {
25139            let to_remove = ["resourceId"];
25140            params.remove_params(&to_remove);
25141        }
25142
25143        let url = params.parse_with_url(&url);
25144
25145        let mut json_mime_type = mime::APPLICATION_JSON;
25146        let mut request_value_reader = {
25147            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25148            common::remove_json_null_values(&mut value);
25149            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25150            serde_json::to_writer(&mut dst, &value).unwrap();
25151            dst
25152        };
25153        let request_size = request_value_reader
25154            .seek(std::io::SeekFrom::End(0))
25155            .unwrap();
25156        request_value_reader
25157            .seek(std::io::SeekFrom::Start(0))
25158            .unwrap();
25159
25160        loop {
25161            let token = match self
25162                .hub
25163                .auth
25164                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25165                .await
25166            {
25167                Ok(token) => token,
25168                Err(e) => match dlg.token(e) {
25169                    Ok(token) => token,
25170                    Err(e) => {
25171                        dlg.finished(false);
25172                        return Err(common::Error::MissingToken(e));
25173                    }
25174                },
25175            };
25176            request_value_reader
25177                .seek(std::io::SeekFrom::Start(0))
25178                .unwrap();
25179            let mut req_result = {
25180                let client = &self.hub.client;
25181                dlg.pre_request();
25182                let mut req_builder = hyper::Request::builder()
25183                    .method(hyper::Method::PUT)
25184                    .uri(url.as_str())
25185                    .header(USER_AGENT, self.hub._user_agent.clone());
25186
25187                if let Some(token) = token.as_ref() {
25188                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25189                }
25190
25191                let request = req_builder
25192                    .header(CONTENT_TYPE, json_mime_type.to_string())
25193                    .header(CONTENT_LENGTH, request_size as u64)
25194                    .body(common::to_body(
25195                        request_value_reader.get_ref().clone().into(),
25196                    ));
25197
25198                client.request(request.unwrap()).await
25199            };
25200
25201            match req_result {
25202                Err(err) => {
25203                    if let common::Retry::After(d) = dlg.http_error(&err) {
25204                        sleep(d).await;
25205                        continue;
25206                    }
25207                    dlg.finished(false);
25208                    return Err(common::Error::HttpError(err));
25209                }
25210                Ok(res) => {
25211                    let (mut parts, body) = res.into_parts();
25212                    let mut body = common::Body::new(body);
25213                    if !parts.status.is_success() {
25214                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25215                        let error = serde_json::from_str(&common::to_string(&bytes));
25216                        let response = common::to_response(parts, bytes.into());
25217
25218                        if let common::Retry::After(d) =
25219                            dlg.http_failure(&response, error.as_ref().ok())
25220                        {
25221                            sleep(d).await;
25222                            continue;
25223                        }
25224
25225                        dlg.finished(false);
25226
25227                        return Err(match error {
25228                            Ok(value) => common::Error::BadRequest(value),
25229                            _ => common::Error::Failure(response),
25230                        });
25231                    }
25232                    let response = {
25233                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25234                        let encoded = common::to_string(&bytes);
25235                        match serde_json::from_str(&encoded) {
25236                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25237                            Err(error) => {
25238                                dlg.response_json_decode_error(&encoded, &error);
25239                                return Err(common::Error::JsonDecodeError(
25240                                    encoded.to_string(),
25241                                    error,
25242                                ));
25243                            }
25244                        }
25245                    };
25246
25247                    dlg.finished(true);
25248                    return Ok(response);
25249                }
25250            }
25251        }
25252    }
25253
25254    ///
25255    /// Sets the *request* property to the given value.
25256    ///
25257    /// Even though the property as already been set when instantiating this call,
25258    /// we provide this method for API completeness.
25259    pub fn request(mut self, new_value: Issuer) -> IssuerUpdateCall<'a, C> {
25260        self._request = new_value;
25261        self
25262    }
25263    /// The unique identifier for an issuer.
25264    ///
25265    /// Sets the *resource id* path property to the given value.
25266    ///
25267    /// Even though the property as already been set when instantiating this call,
25268    /// we provide this method for API completeness.
25269    pub fn resource_id(mut self, new_value: i64) -> IssuerUpdateCall<'a, C> {
25270        self._resource_id = new_value;
25271        self
25272    }
25273    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25274    /// while executing the actual API request.
25275    ///
25276    /// ````text
25277    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25278    /// ````
25279    ///
25280    /// Sets the *delegate* property to the given value.
25281    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerUpdateCall<'a, C> {
25282        self._delegate = Some(new_value);
25283        self
25284    }
25285
25286    /// Set any additional parameter of the query string used in the request.
25287    /// It should be used to set parameters which are not yet available through their own
25288    /// setters.
25289    ///
25290    /// Please note that this method must not be used to set any of the known parameters
25291    /// which have their own setter method. If done anyway, the request will fail.
25292    ///
25293    /// # Additional Parameters
25294    ///
25295    /// * *$.xgafv* (query-string) - V1 error format.
25296    /// * *access_token* (query-string) - OAuth access token.
25297    /// * *alt* (query-string) - Data format for response.
25298    /// * *callback* (query-string) - JSONP
25299    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25300    /// * *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.
25301    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25302    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25303    /// * *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.
25304    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25305    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25306    pub fn param<T>(mut self, name: T, value: T) -> IssuerUpdateCall<'a, C>
25307    where
25308        T: AsRef<str>,
25309    {
25310        self._additional_params
25311            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25312        self
25313    }
25314
25315    /// Identifies the authorization scope for the method you are building.
25316    ///
25317    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25318    /// [`Scope::WalletObjectIssuer`].
25319    ///
25320    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25321    /// tokens for more than one scope.
25322    ///
25323    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25324    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25325    /// sufficient, a read-write scope will do as well.
25326    pub fn add_scope<St>(mut self, scope: St) -> IssuerUpdateCall<'a, C>
25327    where
25328        St: AsRef<str>,
25329    {
25330        self._scopes.insert(String::from(scope.as_ref()));
25331        self
25332    }
25333    /// Identifies the authorization scope(s) for the method you are building.
25334    ///
25335    /// See [`Self::add_scope()`] for details.
25336    pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerUpdateCall<'a, C>
25337    where
25338        I: IntoIterator<Item = St>,
25339        St: AsRef<str>,
25340    {
25341        self._scopes
25342            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25343        self
25344    }
25345
25346    /// Removes all scopes, and no default scope will be used either.
25347    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25348    /// for details).
25349    pub fn clear_scopes(mut self) -> IssuerUpdateCall<'a, C> {
25350        self._scopes.clear();
25351        self
25352    }
25353}
25354
25355/// Inserts the resources in the JWT.
25356///
25357/// A builder for the *insert* method supported by a *jwt* resource.
25358/// It is not used directly, but through a [`JwtMethods`] instance.
25359///
25360/// # Example
25361///
25362/// Instantiate a resource method builder
25363///
25364/// ```test_harness,no_run
25365/// # extern crate hyper;
25366/// # extern crate hyper_rustls;
25367/// # extern crate google_walletobjects1 as walletobjects1;
25368/// use walletobjects1::api::JwtResource;
25369/// # async fn dox() {
25370/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25371///
25372/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25373/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25374/// #     .with_native_roots()
25375/// #     .unwrap()
25376/// #     .https_only()
25377/// #     .enable_http2()
25378/// #     .build();
25379///
25380/// # let executor = hyper_util::rt::TokioExecutor::new();
25381/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25382/// #     secret,
25383/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25384/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25385/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25386/// #     ),
25387/// # ).build().await.unwrap();
25388///
25389/// # let client = hyper_util::client::legacy::Client::builder(
25390/// #     hyper_util::rt::TokioExecutor::new()
25391/// # )
25392/// # .build(
25393/// #     hyper_rustls::HttpsConnectorBuilder::new()
25394/// #         .with_native_roots()
25395/// #         .unwrap()
25396/// #         .https_or_http()
25397/// #         .enable_http2()
25398/// #         .build()
25399/// # );
25400/// # let mut hub = Walletobjects::new(client, auth);
25401/// // As the method needs a request, you would usually fill it with the desired information
25402/// // into the respective structure. Some of the parts shown here might not be applicable !
25403/// // Values shown here are possibly random and not representative !
25404/// let mut req = JwtResource::default();
25405///
25406/// // You can configure optional parameters by calling the respective setters at will, and
25407/// // execute the final call using `doit()`.
25408/// // Values shown here are possibly random and not representative !
25409/// let result = hub.jwt().insert(req)
25410///              .doit().await;
25411/// # }
25412/// ```
25413pub struct JwtInsertCall<'a, C>
25414where
25415    C: 'a,
25416{
25417    hub: &'a Walletobjects<C>,
25418    _request: JwtResource,
25419    _delegate: Option<&'a mut dyn common::Delegate>,
25420    _additional_params: HashMap<String, String>,
25421    _scopes: BTreeSet<String>,
25422}
25423
25424impl<'a, C> common::CallBuilder for JwtInsertCall<'a, C> {}
25425
25426impl<'a, C> JwtInsertCall<'a, C>
25427where
25428    C: common::Connector,
25429{
25430    /// Perform the operation you have build so far.
25431    pub async fn doit(mut self) -> common::Result<(common::Response, JwtInsertResponse)> {
25432        use std::borrow::Cow;
25433        use std::io::{Read, Seek};
25434
25435        use common::{url::Params, ToParts};
25436        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25437
25438        let mut dd = common::DefaultDelegate;
25439        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25440        dlg.begin(common::MethodInfo {
25441            id: "walletobjects.jwt.insert",
25442            http_method: hyper::Method::POST,
25443        });
25444
25445        for &field in ["alt"].iter() {
25446            if self._additional_params.contains_key(field) {
25447                dlg.finished(false);
25448                return Err(common::Error::FieldClash(field));
25449            }
25450        }
25451
25452        let mut params = Params::with_capacity(3 + self._additional_params.len());
25453
25454        params.extend(self._additional_params.iter());
25455
25456        params.push("alt", "json");
25457        let mut url = self.hub._base_url.clone() + "walletobjects/v1/jwt";
25458        if self._scopes.is_empty() {
25459            self._scopes
25460                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
25461        }
25462
25463        let url = params.parse_with_url(&url);
25464
25465        let mut json_mime_type = mime::APPLICATION_JSON;
25466        let mut request_value_reader = {
25467            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25468            common::remove_json_null_values(&mut value);
25469            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25470            serde_json::to_writer(&mut dst, &value).unwrap();
25471            dst
25472        };
25473        let request_size = request_value_reader
25474            .seek(std::io::SeekFrom::End(0))
25475            .unwrap();
25476        request_value_reader
25477            .seek(std::io::SeekFrom::Start(0))
25478            .unwrap();
25479
25480        loop {
25481            let token = match self
25482                .hub
25483                .auth
25484                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25485                .await
25486            {
25487                Ok(token) => token,
25488                Err(e) => match dlg.token(e) {
25489                    Ok(token) => token,
25490                    Err(e) => {
25491                        dlg.finished(false);
25492                        return Err(common::Error::MissingToken(e));
25493                    }
25494                },
25495            };
25496            request_value_reader
25497                .seek(std::io::SeekFrom::Start(0))
25498                .unwrap();
25499            let mut req_result = {
25500                let client = &self.hub.client;
25501                dlg.pre_request();
25502                let mut req_builder = hyper::Request::builder()
25503                    .method(hyper::Method::POST)
25504                    .uri(url.as_str())
25505                    .header(USER_AGENT, self.hub._user_agent.clone());
25506
25507                if let Some(token) = token.as_ref() {
25508                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25509                }
25510
25511                let request = req_builder
25512                    .header(CONTENT_TYPE, json_mime_type.to_string())
25513                    .header(CONTENT_LENGTH, request_size as u64)
25514                    .body(common::to_body(
25515                        request_value_reader.get_ref().clone().into(),
25516                    ));
25517
25518                client.request(request.unwrap()).await
25519            };
25520
25521            match req_result {
25522                Err(err) => {
25523                    if let common::Retry::After(d) = dlg.http_error(&err) {
25524                        sleep(d).await;
25525                        continue;
25526                    }
25527                    dlg.finished(false);
25528                    return Err(common::Error::HttpError(err));
25529                }
25530                Ok(res) => {
25531                    let (mut parts, body) = res.into_parts();
25532                    let mut body = common::Body::new(body);
25533                    if !parts.status.is_success() {
25534                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25535                        let error = serde_json::from_str(&common::to_string(&bytes));
25536                        let response = common::to_response(parts, bytes.into());
25537
25538                        if let common::Retry::After(d) =
25539                            dlg.http_failure(&response, error.as_ref().ok())
25540                        {
25541                            sleep(d).await;
25542                            continue;
25543                        }
25544
25545                        dlg.finished(false);
25546
25547                        return Err(match error {
25548                            Ok(value) => common::Error::BadRequest(value),
25549                            _ => common::Error::Failure(response),
25550                        });
25551                    }
25552                    let response = {
25553                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25554                        let encoded = common::to_string(&bytes);
25555                        match serde_json::from_str(&encoded) {
25556                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25557                            Err(error) => {
25558                                dlg.response_json_decode_error(&encoded, &error);
25559                                return Err(common::Error::JsonDecodeError(
25560                                    encoded.to_string(),
25561                                    error,
25562                                ));
25563                            }
25564                        }
25565                    };
25566
25567                    dlg.finished(true);
25568                    return Ok(response);
25569                }
25570            }
25571        }
25572    }
25573
25574    ///
25575    /// Sets the *request* property to the given value.
25576    ///
25577    /// Even though the property as already been set when instantiating this call,
25578    /// we provide this method for API completeness.
25579    pub fn request(mut self, new_value: JwtResource) -> JwtInsertCall<'a, C> {
25580        self._request = new_value;
25581        self
25582    }
25583    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25584    /// while executing the actual API request.
25585    ///
25586    /// ````text
25587    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25588    /// ````
25589    ///
25590    /// Sets the *delegate* property to the given value.
25591    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JwtInsertCall<'a, C> {
25592        self._delegate = Some(new_value);
25593        self
25594    }
25595
25596    /// Set any additional parameter of the query string used in the request.
25597    /// It should be used to set parameters which are not yet available through their own
25598    /// setters.
25599    ///
25600    /// Please note that this method must not be used to set any of the known parameters
25601    /// which have their own setter method. If done anyway, the request will fail.
25602    ///
25603    /// # Additional Parameters
25604    ///
25605    /// * *$.xgafv* (query-string) - V1 error format.
25606    /// * *access_token* (query-string) - OAuth access token.
25607    /// * *alt* (query-string) - Data format for response.
25608    /// * *callback* (query-string) - JSONP
25609    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25610    /// * *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.
25611    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25612    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25613    /// * *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.
25614    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25615    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25616    pub fn param<T>(mut self, name: T, value: T) -> JwtInsertCall<'a, C>
25617    where
25618        T: AsRef<str>,
25619    {
25620        self._additional_params
25621            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25622        self
25623    }
25624
25625    /// Identifies the authorization scope for the method you are building.
25626    ///
25627    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25628    /// [`Scope::WalletObjectIssuer`].
25629    ///
25630    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25631    /// tokens for more than one scope.
25632    ///
25633    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25634    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25635    /// sufficient, a read-write scope will do as well.
25636    pub fn add_scope<St>(mut self, scope: St) -> JwtInsertCall<'a, C>
25637    where
25638        St: AsRef<str>,
25639    {
25640        self._scopes.insert(String::from(scope.as_ref()));
25641        self
25642    }
25643    /// Identifies the authorization scope(s) for the method you are building.
25644    ///
25645    /// See [`Self::add_scope()`] for details.
25646    pub fn add_scopes<I, St>(mut self, scopes: I) -> JwtInsertCall<'a, C>
25647    where
25648        I: IntoIterator<Item = St>,
25649        St: AsRef<str>,
25650    {
25651        self._scopes
25652            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25653        self
25654    }
25655
25656    /// Removes all scopes, and no default scope will be used either.
25657    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25658    /// for details).
25659    pub fn clear_scopes(mut self) -> JwtInsertCall<'a, C> {
25660        self._scopes.clear();
25661        self
25662    }
25663}
25664
25665/// Adds a message to the loyalty class referenced by the given class ID.
25666///
25667/// A builder for the *addmessage* method supported by a *loyaltyclas* resource.
25668/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
25669///
25670/// # Example
25671///
25672/// Instantiate a resource method builder
25673///
25674/// ```test_harness,no_run
25675/// # extern crate hyper;
25676/// # extern crate hyper_rustls;
25677/// # extern crate google_walletobjects1 as walletobjects1;
25678/// use walletobjects1::api::AddMessageRequest;
25679/// # async fn dox() {
25680/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25681///
25682/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25683/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25684/// #     .with_native_roots()
25685/// #     .unwrap()
25686/// #     .https_only()
25687/// #     .enable_http2()
25688/// #     .build();
25689///
25690/// # let executor = hyper_util::rt::TokioExecutor::new();
25691/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25692/// #     secret,
25693/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25694/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25695/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25696/// #     ),
25697/// # ).build().await.unwrap();
25698///
25699/// # let client = hyper_util::client::legacy::Client::builder(
25700/// #     hyper_util::rt::TokioExecutor::new()
25701/// # )
25702/// # .build(
25703/// #     hyper_rustls::HttpsConnectorBuilder::new()
25704/// #         .with_native_roots()
25705/// #         .unwrap()
25706/// #         .https_or_http()
25707/// #         .enable_http2()
25708/// #         .build()
25709/// # );
25710/// # let mut hub = Walletobjects::new(client, auth);
25711/// // As the method needs a request, you would usually fill it with the desired information
25712/// // into the respective structure. Some of the parts shown here might not be applicable !
25713/// // Values shown here are possibly random and not representative !
25714/// let mut req = AddMessageRequest::default();
25715///
25716/// // You can configure optional parameters by calling the respective setters at will, and
25717/// // execute the final call using `doit()`.
25718/// // Values shown here are possibly random and not representative !
25719/// let result = hub.loyaltyclass().addmessage(req, "resourceId")
25720///              .doit().await;
25721/// # }
25722/// ```
25723pub struct LoyaltyclasAddmessageCall<'a, C>
25724where
25725    C: 'a,
25726{
25727    hub: &'a Walletobjects<C>,
25728    _request: AddMessageRequest,
25729    _resource_id: String,
25730    _delegate: Option<&'a mut dyn common::Delegate>,
25731    _additional_params: HashMap<String, String>,
25732    _scopes: BTreeSet<String>,
25733}
25734
25735impl<'a, C> common::CallBuilder for LoyaltyclasAddmessageCall<'a, C> {}
25736
25737impl<'a, C> LoyaltyclasAddmessageCall<'a, C>
25738where
25739    C: common::Connector,
25740{
25741    /// Perform the operation you have build so far.
25742    pub async fn doit(
25743        mut self,
25744    ) -> common::Result<(common::Response, LoyaltyClassAddMessageResponse)> {
25745        use std::borrow::Cow;
25746        use std::io::{Read, Seek};
25747
25748        use common::{url::Params, ToParts};
25749        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25750
25751        let mut dd = common::DefaultDelegate;
25752        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25753        dlg.begin(common::MethodInfo {
25754            id: "walletobjects.loyaltyclass.addmessage",
25755            http_method: hyper::Method::POST,
25756        });
25757
25758        for &field in ["alt", "resourceId"].iter() {
25759            if self._additional_params.contains_key(field) {
25760                dlg.finished(false);
25761                return Err(common::Error::FieldClash(field));
25762            }
25763        }
25764
25765        let mut params = Params::with_capacity(4 + self._additional_params.len());
25766        params.push("resourceId", self._resource_id);
25767
25768        params.extend(self._additional_params.iter());
25769
25770        params.push("alt", "json");
25771        let mut url =
25772            self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass/{resourceId}/addMessage";
25773        if self._scopes.is_empty() {
25774            self._scopes
25775                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
25776        }
25777
25778        #[allow(clippy::single_element_loop)]
25779        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
25780            url = params.uri_replacement(url, param_name, find_this, false);
25781        }
25782        {
25783            let to_remove = ["resourceId"];
25784            params.remove_params(&to_remove);
25785        }
25786
25787        let url = params.parse_with_url(&url);
25788
25789        let mut json_mime_type = mime::APPLICATION_JSON;
25790        let mut request_value_reader = {
25791            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25792            common::remove_json_null_values(&mut value);
25793            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25794            serde_json::to_writer(&mut dst, &value).unwrap();
25795            dst
25796        };
25797        let request_size = request_value_reader
25798            .seek(std::io::SeekFrom::End(0))
25799            .unwrap();
25800        request_value_reader
25801            .seek(std::io::SeekFrom::Start(0))
25802            .unwrap();
25803
25804        loop {
25805            let token = match self
25806                .hub
25807                .auth
25808                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25809                .await
25810            {
25811                Ok(token) => token,
25812                Err(e) => match dlg.token(e) {
25813                    Ok(token) => token,
25814                    Err(e) => {
25815                        dlg.finished(false);
25816                        return Err(common::Error::MissingToken(e));
25817                    }
25818                },
25819            };
25820            request_value_reader
25821                .seek(std::io::SeekFrom::Start(0))
25822                .unwrap();
25823            let mut req_result = {
25824                let client = &self.hub.client;
25825                dlg.pre_request();
25826                let mut req_builder = hyper::Request::builder()
25827                    .method(hyper::Method::POST)
25828                    .uri(url.as_str())
25829                    .header(USER_AGENT, self.hub._user_agent.clone());
25830
25831                if let Some(token) = token.as_ref() {
25832                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25833                }
25834
25835                let request = req_builder
25836                    .header(CONTENT_TYPE, json_mime_type.to_string())
25837                    .header(CONTENT_LENGTH, request_size as u64)
25838                    .body(common::to_body(
25839                        request_value_reader.get_ref().clone().into(),
25840                    ));
25841
25842                client.request(request.unwrap()).await
25843            };
25844
25845            match req_result {
25846                Err(err) => {
25847                    if let common::Retry::After(d) = dlg.http_error(&err) {
25848                        sleep(d).await;
25849                        continue;
25850                    }
25851                    dlg.finished(false);
25852                    return Err(common::Error::HttpError(err));
25853                }
25854                Ok(res) => {
25855                    let (mut parts, body) = res.into_parts();
25856                    let mut body = common::Body::new(body);
25857                    if !parts.status.is_success() {
25858                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25859                        let error = serde_json::from_str(&common::to_string(&bytes));
25860                        let response = common::to_response(parts, bytes.into());
25861
25862                        if let common::Retry::After(d) =
25863                            dlg.http_failure(&response, error.as_ref().ok())
25864                        {
25865                            sleep(d).await;
25866                            continue;
25867                        }
25868
25869                        dlg.finished(false);
25870
25871                        return Err(match error {
25872                            Ok(value) => common::Error::BadRequest(value),
25873                            _ => common::Error::Failure(response),
25874                        });
25875                    }
25876                    let response = {
25877                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25878                        let encoded = common::to_string(&bytes);
25879                        match serde_json::from_str(&encoded) {
25880                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25881                            Err(error) => {
25882                                dlg.response_json_decode_error(&encoded, &error);
25883                                return Err(common::Error::JsonDecodeError(
25884                                    encoded.to_string(),
25885                                    error,
25886                                ));
25887                            }
25888                        }
25889                    };
25890
25891                    dlg.finished(true);
25892                    return Ok(response);
25893                }
25894            }
25895        }
25896    }
25897
25898    ///
25899    /// Sets the *request* property to the given value.
25900    ///
25901    /// Even though the property as already been set when instantiating this call,
25902    /// we provide this method for API completeness.
25903    pub fn request(mut self, new_value: AddMessageRequest) -> LoyaltyclasAddmessageCall<'a, C> {
25904        self._request = new_value;
25905        self
25906    }
25907    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
25908    ///
25909    /// Sets the *resource id* path property to the given value.
25910    ///
25911    /// Even though the property as already been set when instantiating this call,
25912    /// we provide this method for API completeness.
25913    pub fn resource_id(mut self, new_value: &str) -> LoyaltyclasAddmessageCall<'a, C> {
25914        self._resource_id = new_value.to_string();
25915        self
25916    }
25917    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25918    /// while executing the actual API request.
25919    ///
25920    /// ````text
25921    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25922    /// ````
25923    ///
25924    /// Sets the *delegate* property to the given value.
25925    pub fn delegate(
25926        mut self,
25927        new_value: &'a mut dyn common::Delegate,
25928    ) -> LoyaltyclasAddmessageCall<'a, C> {
25929        self._delegate = Some(new_value);
25930        self
25931    }
25932
25933    /// Set any additional parameter of the query string used in the request.
25934    /// It should be used to set parameters which are not yet available through their own
25935    /// setters.
25936    ///
25937    /// Please note that this method must not be used to set any of the known parameters
25938    /// which have their own setter method. If done anyway, the request will fail.
25939    ///
25940    /// # Additional Parameters
25941    ///
25942    /// * *$.xgafv* (query-string) - V1 error format.
25943    /// * *access_token* (query-string) - OAuth access token.
25944    /// * *alt* (query-string) - Data format for response.
25945    /// * *callback* (query-string) - JSONP
25946    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25947    /// * *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.
25948    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25949    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25950    /// * *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.
25951    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25952    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25953    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasAddmessageCall<'a, C>
25954    where
25955        T: AsRef<str>,
25956    {
25957        self._additional_params
25958            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25959        self
25960    }
25961
25962    /// Identifies the authorization scope for the method you are building.
25963    ///
25964    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25965    /// [`Scope::WalletObjectIssuer`].
25966    ///
25967    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25968    /// tokens for more than one scope.
25969    ///
25970    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25971    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25972    /// sufficient, a read-write scope will do as well.
25973    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasAddmessageCall<'a, C>
25974    where
25975        St: AsRef<str>,
25976    {
25977        self._scopes.insert(String::from(scope.as_ref()));
25978        self
25979    }
25980    /// Identifies the authorization scope(s) for the method you are building.
25981    ///
25982    /// See [`Self::add_scope()`] for details.
25983    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasAddmessageCall<'a, C>
25984    where
25985        I: IntoIterator<Item = St>,
25986        St: AsRef<str>,
25987    {
25988        self._scopes
25989            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25990        self
25991    }
25992
25993    /// Removes all scopes, and no default scope will be used either.
25994    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25995    /// for details).
25996    pub fn clear_scopes(mut self) -> LoyaltyclasAddmessageCall<'a, C> {
25997        self._scopes.clear();
25998        self
25999    }
26000}
26001
26002/// Returns the loyalty class with the given class ID.
26003///
26004/// A builder for the *get* method supported by a *loyaltyclas* resource.
26005/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
26006///
26007/// # Example
26008///
26009/// Instantiate a resource method builder
26010///
26011/// ```test_harness,no_run
26012/// # extern crate hyper;
26013/// # extern crate hyper_rustls;
26014/// # extern crate google_walletobjects1 as walletobjects1;
26015/// # async fn dox() {
26016/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26017///
26018/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26019/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26020/// #     .with_native_roots()
26021/// #     .unwrap()
26022/// #     .https_only()
26023/// #     .enable_http2()
26024/// #     .build();
26025///
26026/// # let executor = hyper_util::rt::TokioExecutor::new();
26027/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26028/// #     secret,
26029/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26030/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26031/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26032/// #     ),
26033/// # ).build().await.unwrap();
26034///
26035/// # let client = hyper_util::client::legacy::Client::builder(
26036/// #     hyper_util::rt::TokioExecutor::new()
26037/// # )
26038/// # .build(
26039/// #     hyper_rustls::HttpsConnectorBuilder::new()
26040/// #         .with_native_roots()
26041/// #         .unwrap()
26042/// #         .https_or_http()
26043/// #         .enable_http2()
26044/// #         .build()
26045/// # );
26046/// # let mut hub = Walletobjects::new(client, auth);
26047/// // You can configure optional parameters by calling the respective setters at will, and
26048/// // execute the final call using `doit()`.
26049/// // Values shown here are possibly random and not representative !
26050/// let result = hub.loyaltyclass().get("resourceId")
26051///              .doit().await;
26052/// # }
26053/// ```
26054pub struct LoyaltyclasGetCall<'a, C>
26055where
26056    C: 'a,
26057{
26058    hub: &'a Walletobjects<C>,
26059    _resource_id: String,
26060    _delegate: Option<&'a mut dyn common::Delegate>,
26061    _additional_params: HashMap<String, String>,
26062    _scopes: BTreeSet<String>,
26063}
26064
26065impl<'a, C> common::CallBuilder for LoyaltyclasGetCall<'a, C> {}
26066
26067impl<'a, C> LoyaltyclasGetCall<'a, C>
26068where
26069    C: common::Connector,
26070{
26071    /// Perform the operation you have build so far.
26072    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClass)> {
26073        use std::borrow::Cow;
26074        use std::io::{Read, Seek};
26075
26076        use common::{url::Params, ToParts};
26077        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26078
26079        let mut dd = common::DefaultDelegate;
26080        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26081        dlg.begin(common::MethodInfo {
26082            id: "walletobjects.loyaltyclass.get",
26083            http_method: hyper::Method::GET,
26084        });
26085
26086        for &field in ["alt", "resourceId"].iter() {
26087            if self._additional_params.contains_key(field) {
26088                dlg.finished(false);
26089                return Err(common::Error::FieldClash(field));
26090            }
26091        }
26092
26093        let mut params = Params::with_capacity(3 + self._additional_params.len());
26094        params.push("resourceId", self._resource_id);
26095
26096        params.extend(self._additional_params.iter());
26097
26098        params.push("alt", "json");
26099        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass/{resourceId}";
26100        if self._scopes.is_empty() {
26101            self._scopes
26102                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
26103        }
26104
26105        #[allow(clippy::single_element_loop)]
26106        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
26107            url = params.uri_replacement(url, param_name, find_this, false);
26108        }
26109        {
26110            let to_remove = ["resourceId"];
26111            params.remove_params(&to_remove);
26112        }
26113
26114        let url = params.parse_with_url(&url);
26115
26116        loop {
26117            let token = match self
26118                .hub
26119                .auth
26120                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26121                .await
26122            {
26123                Ok(token) => token,
26124                Err(e) => match dlg.token(e) {
26125                    Ok(token) => token,
26126                    Err(e) => {
26127                        dlg.finished(false);
26128                        return Err(common::Error::MissingToken(e));
26129                    }
26130                },
26131            };
26132            let mut req_result = {
26133                let client = &self.hub.client;
26134                dlg.pre_request();
26135                let mut req_builder = hyper::Request::builder()
26136                    .method(hyper::Method::GET)
26137                    .uri(url.as_str())
26138                    .header(USER_AGENT, self.hub._user_agent.clone());
26139
26140                if let Some(token) = token.as_ref() {
26141                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26142                }
26143
26144                let request = req_builder
26145                    .header(CONTENT_LENGTH, 0_u64)
26146                    .body(common::to_body::<String>(None));
26147
26148                client.request(request.unwrap()).await
26149            };
26150
26151            match req_result {
26152                Err(err) => {
26153                    if let common::Retry::After(d) = dlg.http_error(&err) {
26154                        sleep(d).await;
26155                        continue;
26156                    }
26157                    dlg.finished(false);
26158                    return Err(common::Error::HttpError(err));
26159                }
26160                Ok(res) => {
26161                    let (mut parts, body) = res.into_parts();
26162                    let mut body = common::Body::new(body);
26163                    if !parts.status.is_success() {
26164                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26165                        let error = serde_json::from_str(&common::to_string(&bytes));
26166                        let response = common::to_response(parts, bytes.into());
26167
26168                        if let common::Retry::After(d) =
26169                            dlg.http_failure(&response, error.as_ref().ok())
26170                        {
26171                            sleep(d).await;
26172                            continue;
26173                        }
26174
26175                        dlg.finished(false);
26176
26177                        return Err(match error {
26178                            Ok(value) => common::Error::BadRequest(value),
26179                            _ => common::Error::Failure(response),
26180                        });
26181                    }
26182                    let response = {
26183                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26184                        let encoded = common::to_string(&bytes);
26185                        match serde_json::from_str(&encoded) {
26186                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26187                            Err(error) => {
26188                                dlg.response_json_decode_error(&encoded, &error);
26189                                return Err(common::Error::JsonDecodeError(
26190                                    encoded.to_string(),
26191                                    error,
26192                                ));
26193                            }
26194                        }
26195                    };
26196
26197                    dlg.finished(true);
26198                    return Ok(response);
26199                }
26200            }
26201        }
26202    }
26203
26204    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
26205    ///
26206    /// Sets the *resource id* path property to the given value.
26207    ///
26208    /// Even though the property as already been set when instantiating this call,
26209    /// we provide this method for API completeness.
26210    pub fn resource_id(mut self, new_value: &str) -> LoyaltyclasGetCall<'a, C> {
26211        self._resource_id = new_value.to_string();
26212        self
26213    }
26214    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26215    /// while executing the actual API request.
26216    ///
26217    /// ````text
26218    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26219    /// ````
26220    ///
26221    /// Sets the *delegate* property to the given value.
26222    pub fn delegate(
26223        mut self,
26224        new_value: &'a mut dyn common::Delegate,
26225    ) -> LoyaltyclasGetCall<'a, C> {
26226        self._delegate = Some(new_value);
26227        self
26228    }
26229
26230    /// Set any additional parameter of the query string used in the request.
26231    /// It should be used to set parameters which are not yet available through their own
26232    /// setters.
26233    ///
26234    /// Please note that this method must not be used to set any of the known parameters
26235    /// which have their own setter method. If done anyway, the request will fail.
26236    ///
26237    /// # Additional Parameters
26238    ///
26239    /// * *$.xgafv* (query-string) - V1 error format.
26240    /// * *access_token* (query-string) - OAuth access token.
26241    /// * *alt* (query-string) - Data format for response.
26242    /// * *callback* (query-string) - JSONP
26243    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26244    /// * *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.
26245    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26246    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26247    /// * *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.
26248    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26249    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26250    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasGetCall<'a, C>
26251    where
26252        T: AsRef<str>,
26253    {
26254        self._additional_params
26255            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26256        self
26257    }
26258
26259    /// Identifies the authorization scope for the method you are building.
26260    ///
26261    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26262    /// [`Scope::WalletObjectIssuer`].
26263    ///
26264    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26265    /// tokens for more than one scope.
26266    ///
26267    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26268    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26269    /// sufficient, a read-write scope will do as well.
26270    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasGetCall<'a, C>
26271    where
26272        St: AsRef<str>,
26273    {
26274        self._scopes.insert(String::from(scope.as_ref()));
26275        self
26276    }
26277    /// Identifies the authorization scope(s) for the method you are building.
26278    ///
26279    /// See [`Self::add_scope()`] for details.
26280    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasGetCall<'a, C>
26281    where
26282        I: IntoIterator<Item = St>,
26283        St: AsRef<str>,
26284    {
26285        self._scopes
26286            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26287        self
26288    }
26289
26290    /// Removes all scopes, and no default scope will be used either.
26291    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26292    /// for details).
26293    pub fn clear_scopes(mut self) -> LoyaltyclasGetCall<'a, C> {
26294        self._scopes.clear();
26295        self
26296    }
26297}
26298
26299/// Inserts an loyalty class with the given ID and properties.
26300///
26301/// A builder for the *insert* method supported by a *loyaltyclas* resource.
26302/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
26303///
26304/// # Example
26305///
26306/// Instantiate a resource method builder
26307///
26308/// ```test_harness,no_run
26309/// # extern crate hyper;
26310/// # extern crate hyper_rustls;
26311/// # extern crate google_walletobjects1 as walletobjects1;
26312/// use walletobjects1::api::LoyaltyClass;
26313/// # async fn dox() {
26314/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26315///
26316/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26317/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26318/// #     .with_native_roots()
26319/// #     .unwrap()
26320/// #     .https_only()
26321/// #     .enable_http2()
26322/// #     .build();
26323///
26324/// # let executor = hyper_util::rt::TokioExecutor::new();
26325/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26326/// #     secret,
26327/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26328/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26329/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26330/// #     ),
26331/// # ).build().await.unwrap();
26332///
26333/// # let client = hyper_util::client::legacy::Client::builder(
26334/// #     hyper_util::rt::TokioExecutor::new()
26335/// # )
26336/// # .build(
26337/// #     hyper_rustls::HttpsConnectorBuilder::new()
26338/// #         .with_native_roots()
26339/// #         .unwrap()
26340/// #         .https_or_http()
26341/// #         .enable_http2()
26342/// #         .build()
26343/// # );
26344/// # let mut hub = Walletobjects::new(client, auth);
26345/// // As the method needs a request, you would usually fill it with the desired information
26346/// // into the respective structure. Some of the parts shown here might not be applicable !
26347/// // Values shown here are possibly random and not representative !
26348/// let mut req = LoyaltyClass::default();
26349///
26350/// // You can configure optional parameters by calling the respective setters at will, and
26351/// // execute the final call using `doit()`.
26352/// // Values shown here are possibly random and not representative !
26353/// let result = hub.loyaltyclass().insert(req)
26354///              .doit().await;
26355/// # }
26356/// ```
26357pub struct LoyaltyclasInsertCall<'a, C>
26358where
26359    C: 'a,
26360{
26361    hub: &'a Walletobjects<C>,
26362    _request: LoyaltyClass,
26363    _delegate: Option<&'a mut dyn common::Delegate>,
26364    _additional_params: HashMap<String, String>,
26365    _scopes: BTreeSet<String>,
26366}
26367
26368impl<'a, C> common::CallBuilder for LoyaltyclasInsertCall<'a, C> {}
26369
26370impl<'a, C> LoyaltyclasInsertCall<'a, C>
26371where
26372    C: common::Connector,
26373{
26374    /// Perform the operation you have build so far.
26375    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClass)> {
26376        use std::borrow::Cow;
26377        use std::io::{Read, Seek};
26378
26379        use common::{url::Params, ToParts};
26380        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26381
26382        let mut dd = common::DefaultDelegate;
26383        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26384        dlg.begin(common::MethodInfo {
26385            id: "walletobjects.loyaltyclass.insert",
26386            http_method: hyper::Method::POST,
26387        });
26388
26389        for &field in ["alt"].iter() {
26390            if self._additional_params.contains_key(field) {
26391                dlg.finished(false);
26392                return Err(common::Error::FieldClash(field));
26393            }
26394        }
26395
26396        let mut params = Params::with_capacity(3 + self._additional_params.len());
26397
26398        params.extend(self._additional_params.iter());
26399
26400        params.push("alt", "json");
26401        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass";
26402        if self._scopes.is_empty() {
26403            self._scopes
26404                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
26405        }
26406
26407        let url = params.parse_with_url(&url);
26408
26409        let mut json_mime_type = mime::APPLICATION_JSON;
26410        let mut request_value_reader = {
26411            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26412            common::remove_json_null_values(&mut value);
26413            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26414            serde_json::to_writer(&mut dst, &value).unwrap();
26415            dst
26416        };
26417        let request_size = request_value_reader
26418            .seek(std::io::SeekFrom::End(0))
26419            .unwrap();
26420        request_value_reader
26421            .seek(std::io::SeekFrom::Start(0))
26422            .unwrap();
26423
26424        loop {
26425            let token = match self
26426                .hub
26427                .auth
26428                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26429                .await
26430            {
26431                Ok(token) => token,
26432                Err(e) => match dlg.token(e) {
26433                    Ok(token) => token,
26434                    Err(e) => {
26435                        dlg.finished(false);
26436                        return Err(common::Error::MissingToken(e));
26437                    }
26438                },
26439            };
26440            request_value_reader
26441                .seek(std::io::SeekFrom::Start(0))
26442                .unwrap();
26443            let mut req_result = {
26444                let client = &self.hub.client;
26445                dlg.pre_request();
26446                let mut req_builder = hyper::Request::builder()
26447                    .method(hyper::Method::POST)
26448                    .uri(url.as_str())
26449                    .header(USER_AGENT, self.hub._user_agent.clone());
26450
26451                if let Some(token) = token.as_ref() {
26452                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26453                }
26454
26455                let request = req_builder
26456                    .header(CONTENT_TYPE, json_mime_type.to_string())
26457                    .header(CONTENT_LENGTH, request_size as u64)
26458                    .body(common::to_body(
26459                        request_value_reader.get_ref().clone().into(),
26460                    ));
26461
26462                client.request(request.unwrap()).await
26463            };
26464
26465            match req_result {
26466                Err(err) => {
26467                    if let common::Retry::After(d) = dlg.http_error(&err) {
26468                        sleep(d).await;
26469                        continue;
26470                    }
26471                    dlg.finished(false);
26472                    return Err(common::Error::HttpError(err));
26473                }
26474                Ok(res) => {
26475                    let (mut parts, body) = res.into_parts();
26476                    let mut body = common::Body::new(body);
26477                    if !parts.status.is_success() {
26478                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26479                        let error = serde_json::from_str(&common::to_string(&bytes));
26480                        let response = common::to_response(parts, bytes.into());
26481
26482                        if let common::Retry::After(d) =
26483                            dlg.http_failure(&response, error.as_ref().ok())
26484                        {
26485                            sleep(d).await;
26486                            continue;
26487                        }
26488
26489                        dlg.finished(false);
26490
26491                        return Err(match error {
26492                            Ok(value) => common::Error::BadRequest(value),
26493                            _ => common::Error::Failure(response),
26494                        });
26495                    }
26496                    let response = {
26497                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26498                        let encoded = common::to_string(&bytes);
26499                        match serde_json::from_str(&encoded) {
26500                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26501                            Err(error) => {
26502                                dlg.response_json_decode_error(&encoded, &error);
26503                                return Err(common::Error::JsonDecodeError(
26504                                    encoded.to_string(),
26505                                    error,
26506                                ));
26507                            }
26508                        }
26509                    };
26510
26511                    dlg.finished(true);
26512                    return Ok(response);
26513                }
26514            }
26515        }
26516    }
26517
26518    ///
26519    /// Sets the *request* property to the given value.
26520    ///
26521    /// Even though the property as already been set when instantiating this call,
26522    /// we provide this method for API completeness.
26523    pub fn request(mut self, new_value: LoyaltyClass) -> LoyaltyclasInsertCall<'a, C> {
26524        self._request = new_value;
26525        self
26526    }
26527    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26528    /// while executing the actual API request.
26529    ///
26530    /// ````text
26531    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26532    /// ````
26533    ///
26534    /// Sets the *delegate* property to the given value.
26535    pub fn delegate(
26536        mut self,
26537        new_value: &'a mut dyn common::Delegate,
26538    ) -> LoyaltyclasInsertCall<'a, C> {
26539        self._delegate = Some(new_value);
26540        self
26541    }
26542
26543    /// Set any additional parameter of the query string used in the request.
26544    /// It should be used to set parameters which are not yet available through their own
26545    /// setters.
26546    ///
26547    /// Please note that this method must not be used to set any of the known parameters
26548    /// which have their own setter method. If done anyway, the request will fail.
26549    ///
26550    /// # Additional Parameters
26551    ///
26552    /// * *$.xgafv* (query-string) - V1 error format.
26553    /// * *access_token* (query-string) - OAuth access token.
26554    /// * *alt* (query-string) - Data format for response.
26555    /// * *callback* (query-string) - JSONP
26556    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26557    /// * *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.
26558    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26559    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26560    /// * *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.
26561    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26562    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26563    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasInsertCall<'a, C>
26564    where
26565        T: AsRef<str>,
26566    {
26567        self._additional_params
26568            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26569        self
26570    }
26571
26572    /// Identifies the authorization scope for the method you are building.
26573    ///
26574    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26575    /// [`Scope::WalletObjectIssuer`].
26576    ///
26577    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26578    /// tokens for more than one scope.
26579    ///
26580    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26581    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26582    /// sufficient, a read-write scope will do as well.
26583    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasInsertCall<'a, C>
26584    where
26585        St: AsRef<str>,
26586    {
26587        self._scopes.insert(String::from(scope.as_ref()));
26588        self
26589    }
26590    /// Identifies the authorization scope(s) for the method you are building.
26591    ///
26592    /// See [`Self::add_scope()`] for details.
26593    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasInsertCall<'a, C>
26594    where
26595        I: IntoIterator<Item = St>,
26596        St: AsRef<str>,
26597    {
26598        self._scopes
26599            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26600        self
26601    }
26602
26603    /// Removes all scopes, and no default scope will be used either.
26604    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26605    /// for details).
26606    pub fn clear_scopes(mut self) -> LoyaltyclasInsertCall<'a, C> {
26607        self._scopes.clear();
26608        self
26609    }
26610}
26611
26612/// Returns a list of all loyalty classes for a given issuer ID.
26613///
26614/// A builder for the *list* method supported by a *loyaltyclas* resource.
26615/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
26616///
26617/// # Example
26618///
26619/// Instantiate a resource method builder
26620///
26621/// ```test_harness,no_run
26622/// # extern crate hyper;
26623/// # extern crate hyper_rustls;
26624/// # extern crate google_walletobjects1 as walletobjects1;
26625/// # async fn dox() {
26626/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26627///
26628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26629/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26630/// #     .with_native_roots()
26631/// #     .unwrap()
26632/// #     .https_only()
26633/// #     .enable_http2()
26634/// #     .build();
26635///
26636/// # let executor = hyper_util::rt::TokioExecutor::new();
26637/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26638/// #     secret,
26639/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26640/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26641/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26642/// #     ),
26643/// # ).build().await.unwrap();
26644///
26645/// # let client = hyper_util::client::legacy::Client::builder(
26646/// #     hyper_util::rt::TokioExecutor::new()
26647/// # )
26648/// # .build(
26649/// #     hyper_rustls::HttpsConnectorBuilder::new()
26650/// #         .with_native_roots()
26651/// #         .unwrap()
26652/// #         .https_or_http()
26653/// #         .enable_http2()
26654/// #         .build()
26655/// # );
26656/// # let mut hub = Walletobjects::new(client, auth);
26657/// // You can configure optional parameters by calling the respective setters at will, and
26658/// // execute the final call using `doit()`.
26659/// // Values shown here are possibly random and not representative !
26660/// let result = hub.loyaltyclass().list()
26661///              .token("vero")
26662///              .max_results(-76)
26663///              .issuer_id(-88)
26664///              .doit().await;
26665/// # }
26666/// ```
26667pub struct LoyaltyclasListCall<'a, C>
26668where
26669    C: 'a,
26670{
26671    hub: &'a Walletobjects<C>,
26672    _token: Option<String>,
26673    _max_results: Option<i32>,
26674    _issuer_id: Option<i64>,
26675    _delegate: Option<&'a mut dyn common::Delegate>,
26676    _additional_params: HashMap<String, String>,
26677    _scopes: BTreeSet<String>,
26678}
26679
26680impl<'a, C> common::CallBuilder for LoyaltyclasListCall<'a, C> {}
26681
26682impl<'a, C> LoyaltyclasListCall<'a, C>
26683where
26684    C: common::Connector,
26685{
26686    /// Perform the operation you have build so far.
26687    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClassListResponse)> {
26688        use std::borrow::Cow;
26689        use std::io::{Read, Seek};
26690
26691        use common::{url::Params, ToParts};
26692        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26693
26694        let mut dd = common::DefaultDelegate;
26695        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26696        dlg.begin(common::MethodInfo {
26697            id: "walletobjects.loyaltyclass.list",
26698            http_method: hyper::Method::GET,
26699        });
26700
26701        for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
26702            if self._additional_params.contains_key(field) {
26703                dlg.finished(false);
26704                return Err(common::Error::FieldClash(field));
26705            }
26706        }
26707
26708        let mut params = Params::with_capacity(5 + self._additional_params.len());
26709        if let Some(value) = self._token.as_ref() {
26710            params.push("token", value);
26711        }
26712        if let Some(value) = self._max_results.as_ref() {
26713            params.push("maxResults", value.to_string());
26714        }
26715        if let Some(value) = self._issuer_id.as_ref() {
26716            params.push("issuerId", value.to_string());
26717        }
26718
26719        params.extend(self._additional_params.iter());
26720
26721        params.push("alt", "json");
26722        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass";
26723        if self._scopes.is_empty() {
26724            self._scopes
26725                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
26726        }
26727
26728        let url = params.parse_with_url(&url);
26729
26730        loop {
26731            let token = match self
26732                .hub
26733                .auth
26734                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26735                .await
26736            {
26737                Ok(token) => token,
26738                Err(e) => match dlg.token(e) {
26739                    Ok(token) => token,
26740                    Err(e) => {
26741                        dlg.finished(false);
26742                        return Err(common::Error::MissingToken(e));
26743                    }
26744                },
26745            };
26746            let mut req_result = {
26747                let client = &self.hub.client;
26748                dlg.pre_request();
26749                let mut req_builder = hyper::Request::builder()
26750                    .method(hyper::Method::GET)
26751                    .uri(url.as_str())
26752                    .header(USER_AGENT, self.hub._user_agent.clone());
26753
26754                if let Some(token) = token.as_ref() {
26755                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26756                }
26757
26758                let request = req_builder
26759                    .header(CONTENT_LENGTH, 0_u64)
26760                    .body(common::to_body::<String>(None));
26761
26762                client.request(request.unwrap()).await
26763            };
26764
26765            match req_result {
26766                Err(err) => {
26767                    if let common::Retry::After(d) = dlg.http_error(&err) {
26768                        sleep(d).await;
26769                        continue;
26770                    }
26771                    dlg.finished(false);
26772                    return Err(common::Error::HttpError(err));
26773                }
26774                Ok(res) => {
26775                    let (mut parts, body) = res.into_parts();
26776                    let mut body = common::Body::new(body);
26777                    if !parts.status.is_success() {
26778                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26779                        let error = serde_json::from_str(&common::to_string(&bytes));
26780                        let response = common::to_response(parts, bytes.into());
26781
26782                        if let common::Retry::After(d) =
26783                            dlg.http_failure(&response, error.as_ref().ok())
26784                        {
26785                            sleep(d).await;
26786                            continue;
26787                        }
26788
26789                        dlg.finished(false);
26790
26791                        return Err(match error {
26792                            Ok(value) => common::Error::BadRequest(value),
26793                            _ => common::Error::Failure(response),
26794                        });
26795                    }
26796                    let response = {
26797                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26798                        let encoded = common::to_string(&bytes);
26799                        match serde_json::from_str(&encoded) {
26800                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26801                            Err(error) => {
26802                                dlg.response_json_decode_error(&encoded, &error);
26803                                return Err(common::Error::JsonDecodeError(
26804                                    encoded.to_string(),
26805                                    error,
26806                                ));
26807                            }
26808                        }
26809                    };
26810
26811                    dlg.finished(true);
26812                    return Ok(response);
26813                }
26814            }
26815        }
26816    }
26817
26818    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` classes are available in a list. For example, if you have a list of 200 classes and you call list with `maxResults` set to 20, list will return the first 20 classes and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 classes.
26819    ///
26820    /// Sets the *token* query property to the given value.
26821    pub fn token(mut self, new_value: &str) -> LoyaltyclasListCall<'a, C> {
26822        self._token = Some(new_value.to_string());
26823        self
26824    }
26825    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
26826    ///
26827    /// Sets the *max results* query property to the given value.
26828    pub fn max_results(mut self, new_value: i32) -> LoyaltyclasListCall<'a, C> {
26829        self._max_results = Some(new_value);
26830        self
26831    }
26832    /// The ID of the issuer authorized to list classes.
26833    ///
26834    /// Sets the *issuer id* query property to the given value.
26835    pub fn issuer_id(mut self, new_value: i64) -> LoyaltyclasListCall<'a, C> {
26836        self._issuer_id = Some(new_value);
26837        self
26838    }
26839    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26840    /// while executing the actual API request.
26841    ///
26842    /// ````text
26843    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26844    /// ````
26845    ///
26846    /// Sets the *delegate* property to the given value.
26847    pub fn delegate(
26848        mut self,
26849        new_value: &'a mut dyn common::Delegate,
26850    ) -> LoyaltyclasListCall<'a, C> {
26851        self._delegate = Some(new_value);
26852        self
26853    }
26854
26855    /// Set any additional parameter of the query string used in the request.
26856    /// It should be used to set parameters which are not yet available through their own
26857    /// setters.
26858    ///
26859    /// Please note that this method must not be used to set any of the known parameters
26860    /// which have their own setter method. If done anyway, the request will fail.
26861    ///
26862    /// # Additional Parameters
26863    ///
26864    /// * *$.xgafv* (query-string) - V1 error format.
26865    /// * *access_token* (query-string) - OAuth access token.
26866    /// * *alt* (query-string) - Data format for response.
26867    /// * *callback* (query-string) - JSONP
26868    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26869    /// * *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.
26870    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26871    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26872    /// * *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.
26873    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26874    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26875    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasListCall<'a, C>
26876    where
26877        T: AsRef<str>,
26878    {
26879        self._additional_params
26880            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26881        self
26882    }
26883
26884    /// Identifies the authorization scope for the method you are building.
26885    ///
26886    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26887    /// [`Scope::WalletObjectIssuer`].
26888    ///
26889    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26890    /// tokens for more than one scope.
26891    ///
26892    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26893    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26894    /// sufficient, a read-write scope will do as well.
26895    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasListCall<'a, C>
26896    where
26897        St: AsRef<str>,
26898    {
26899        self._scopes.insert(String::from(scope.as_ref()));
26900        self
26901    }
26902    /// Identifies the authorization scope(s) for the method you are building.
26903    ///
26904    /// See [`Self::add_scope()`] for details.
26905    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasListCall<'a, C>
26906    where
26907        I: IntoIterator<Item = St>,
26908        St: AsRef<str>,
26909    {
26910        self._scopes
26911            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26912        self
26913    }
26914
26915    /// Removes all scopes, and no default scope will be used either.
26916    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26917    /// for details).
26918    pub fn clear_scopes(mut self) -> LoyaltyclasListCall<'a, C> {
26919        self._scopes.clear();
26920        self
26921    }
26922}
26923
26924/// Updates the loyalty class referenced by the given class ID. This method supports patch semantics.
26925///
26926/// A builder for the *patch* method supported by a *loyaltyclas* resource.
26927/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
26928///
26929/// # Example
26930///
26931/// Instantiate a resource method builder
26932///
26933/// ```test_harness,no_run
26934/// # extern crate hyper;
26935/// # extern crate hyper_rustls;
26936/// # extern crate google_walletobjects1 as walletobjects1;
26937/// use walletobjects1::api::LoyaltyClass;
26938/// # async fn dox() {
26939/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26940///
26941/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26942/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26943/// #     .with_native_roots()
26944/// #     .unwrap()
26945/// #     .https_only()
26946/// #     .enable_http2()
26947/// #     .build();
26948///
26949/// # let executor = hyper_util::rt::TokioExecutor::new();
26950/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26951/// #     secret,
26952/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26953/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26954/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26955/// #     ),
26956/// # ).build().await.unwrap();
26957///
26958/// # let client = hyper_util::client::legacy::Client::builder(
26959/// #     hyper_util::rt::TokioExecutor::new()
26960/// # )
26961/// # .build(
26962/// #     hyper_rustls::HttpsConnectorBuilder::new()
26963/// #         .with_native_roots()
26964/// #         .unwrap()
26965/// #         .https_or_http()
26966/// #         .enable_http2()
26967/// #         .build()
26968/// # );
26969/// # let mut hub = Walletobjects::new(client, auth);
26970/// // As the method needs a request, you would usually fill it with the desired information
26971/// // into the respective structure. Some of the parts shown here might not be applicable !
26972/// // Values shown here are possibly random and not representative !
26973/// let mut req = LoyaltyClass::default();
26974///
26975/// // You can configure optional parameters by calling the respective setters at will, and
26976/// // execute the final call using `doit()`.
26977/// // Values shown here are possibly random and not representative !
26978/// let result = hub.loyaltyclass().patch(req, "resourceId")
26979///              .doit().await;
26980/// # }
26981/// ```
26982pub struct LoyaltyclasPatchCall<'a, C>
26983where
26984    C: 'a,
26985{
26986    hub: &'a Walletobjects<C>,
26987    _request: LoyaltyClass,
26988    _resource_id: String,
26989    _delegate: Option<&'a mut dyn common::Delegate>,
26990    _additional_params: HashMap<String, String>,
26991    _scopes: BTreeSet<String>,
26992}
26993
26994impl<'a, C> common::CallBuilder for LoyaltyclasPatchCall<'a, C> {}
26995
26996impl<'a, C> LoyaltyclasPatchCall<'a, C>
26997where
26998    C: common::Connector,
26999{
27000    /// Perform the operation you have build so far.
27001    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClass)> {
27002        use std::borrow::Cow;
27003        use std::io::{Read, Seek};
27004
27005        use common::{url::Params, ToParts};
27006        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27007
27008        let mut dd = common::DefaultDelegate;
27009        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27010        dlg.begin(common::MethodInfo {
27011            id: "walletobjects.loyaltyclass.patch",
27012            http_method: hyper::Method::PATCH,
27013        });
27014
27015        for &field in ["alt", "resourceId"].iter() {
27016            if self._additional_params.contains_key(field) {
27017                dlg.finished(false);
27018                return Err(common::Error::FieldClash(field));
27019            }
27020        }
27021
27022        let mut params = Params::with_capacity(4 + self._additional_params.len());
27023        params.push("resourceId", self._resource_id);
27024
27025        params.extend(self._additional_params.iter());
27026
27027        params.push("alt", "json");
27028        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass/{resourceId}";
27029        if self._scopes.is_empty() {
27030            self._scopes
27031                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
27032        }
27033
27034        #[allow(clippy::single_element_loop)]
27035        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
27036            url = params.uri_replacement(url, param_name, find_this, false);
27037        }
27038        {
27039            let to_remove = ["resourceId"];
27040            params.remove_params(&to_remove);
27041        }
27042
27043        let url = params.parse_with_url(&url);
27044
27045        let mut json_mime_type = mime::APPLICATION_JSON;
27046        let mut request_value_reader = {
27047            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27048            common::remove_json_null_values(&mut value);
27049            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27050            serde_json::to_writer(&mut dst, &value).unwrap();
27051            dst
27052        };
27053        let request_size = request_value_reader
27054            .seek(std::io::SeekFrom::End(0))
27055            .unwrap();
27056        request_value_reader
27057            .seek(std::io::SeekFrom::Start(0))
27058            .unwrap();
27059
27060        loop {
27061            let token = match self
27062                .hub
27063                .auth
27064                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27065                .await
27066            {
27067                Ok(token) => token,
27068                Err(e) => match dlg.token(e) {
27069                    Ok(token) => token,
27070                    Err(e) => {
27071                        dlg.finished(false);
27072                        return Err(common::Error::MissingToken(e));
27073                    }
27074                },
27075            };
27076            request_value_reader
27077                .seek(std::io::SeekFrom::Start(0))
27078                .unwrap();
27079            let mut req_result = {
27080                let client = &self.hub.client;
27081                dlg.pre_request();
27082                let mut req_builder = hyper::Request::builder()
27083                    .method(hyper::Method::PATCH)
27084                    .uri(url.as_str())
27085                    .header(USER_AGENT, self.hub._user_agent.clone());
27086
27087                if let Some(token) = token.as_ref() {
27088                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27089                }
27090
27091                let request = req_builder
27092                    .header(CONTENT_TYPE, json_mime_type.to_string())
27093                    .header(CONTENT_LENGTH, request_size as u64)
27094                    .body(common::to_body(
27095                        request_value_reader.get_ref().clone().into(),
27096                    ));
27097
27098                client.request(request.unwrap()).await
27099            };
27100
27101            match req_result {
27102                Err(err) => {
27103                    if let common::Retry::After(d) = dlg.http_error(&err) {
27104                        sleep(d).await;
27105                        continue;
27106                    }
27107                    dlg.finished(false);
27108                    return Err(common::Error::HttpError(err));
27109                }
27110                Ok(res) => {
27111                    let (mut parts, body) = res.into_parts();
27112                    let mut body = common::Body::new(body);
27113                    if !parts.status.is_success() {
27114                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27115                        let error = serde_json::from_str(&common::to_string(&bytes));
27116                        let response = common::to_response(parts, bytes.into());
27117
27118                        if let common::Retry::After(d) =
27119                            dlg.http_failure(&response, error.as_ref().ok())
27120                        {
27121                            sleep(d).await;
27122                            continue;
27123                        }
27124
27125                        dlg.finished(false);
27126
27127                        return Err(match error {
27128                            Ok(value) => common::Error::BadRequest(value),
27129                            _ => common::Error::Failure(response),
27130                        });
27131                    }
27132                    let response = {
27133                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27134                        let encoded = common::to_string(&bytes);
27135                        match serde_json::from_str(&encoded) {
27136                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27137                            Err(error) => {
27138                                dlg.response_json_decode_error(&encoded, &error);
27139                                return Err(common::Error::JsonDecodeError(
27140                                    encoded.to_string(),
27141                                    error,
27142                                ));
27143                            }
27144                        }
27145                    };
27146
27147                    dlg.finished(true);
27148                    return Ok(response);
27149                }
27150            }
27151        }
27152    }
27153
27154    ///
27155    /// Sets the *request* property to the given value.
27156    ///
27157    /// Even though the property as already been set when instantiating this call,
27158    /// we provide this method for API completeness.
27159    pub fn request(mut self, new_value: LoyaltyClass) -> LoyaltyclasPatchCall<'a, C> {
27160        self._request = new_value;
27161        self
27162    }
27163    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
27164    ///
27165    /// Sets the *resource id* path property to the given value.
27166    ///
27167    /// Even though the property as already been set when instantiating this call,
27168    /// we provide this method for API completeness.
27169    pub fn resource_id(mut self, new_value: &str) -> LoyaltyclasPatchCall<'a, C> {
27170        self._resource_id = new_value.to_string();
27171        self
27172    }
27173    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27174    /// while executing the actual API request.
27175    ///
27176    /// ````text
27177    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27178    /// ````
27179    ///
27180    /// Sets the *delegate* property to the given value.
27181    pub fn delegate(
27182        mut self,
27183        new_value: &'a mut dyn common::Delegate,
27184    ) -> LoyaltyclasPatchCall<'a, C> {
27185        self._delegate = Some(new_value);
27186        self
27187    }
27188
27189    /// Set any additional parameter of the query string used in the request.
27190    /// It should be used to set parameters which are not yet available through their own
27191    /// setters.
27192    ///
27193    /// Please note that this method must not be used to set any of the known parameters
27194    /// which have their own setter method. If done anyway, the request will fail.
27195    ///
27196    /// # Additional Parameters
27197    ///
27198    /// * *$.xgafv* (query-string) - V1 error format.
27199    /// * *access_token* (query-string) - OAuth access token.
27200    /// * *alt* (query-string) - Data format for response.
27201    /// * *callback* (query-string) - JSONP
27202    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27203    /// * *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.
27204    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27205    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27206    /// * *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.
27207    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27208    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27209    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasPatchCall<'a, C>
27210    where
27211        T: AsRef<str>,
27212    {
27213        self._additional_params
27214            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27215        self
27216    }
27217
27218    /// Identifies the authorization scope for the method you are building.
27219    ///
27220    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27221    /// [`Scope::WalletObjectIssuer`].
27222    ///
27223    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27224    /// tokens for more than one scope.
27225    ///
27226    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27227    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27228    /// sufficient, a read-write scope will do as well.
27229    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasPatchCall<'a, C>
27230    where
27231        St: AsRef<str>,
27232    {
27233        self._scopes.insert(String::from(scope.as_ref()));
27234        self
27235    }
27236    /// Identifies the authorization scope(s) for the method you are building.
27237    ///
27238    /// See [`Self::add_scope()`] for details.
27239    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasPatchCall<'a, C>
27240    where
27241        I: IntoIterator<Item = St>,
27242        St: AsRef<str>,
27243    {
27244        self._scopes
27245            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27246        self
27247    }
27248
27249    /// Removes all scopes, and no default scope will be used either.
27250    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27251    /// for details).
27252    pub fn clear_scopes(mut self) -> LoyaltyclasPatchCall<'a, C> {
27253        self._scopes.clear();
27254        self
27255    }
27256}
27257
27258/// Updates the loyalty class referenced by the given class ID.
27259///
27260/// A builder for the *update* method supported by a *loyaltyclas* resource.
27261/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
27262///
27263/// # Example
27264///
27265/// Instantiate a resource method builder
27266///
27267/// ```test_harness,no_run
27268/// # extern crate hyper;
27269/// # extern crate hyper_rustls;
27270/// # extern crate google_walletobjects1 as walletobjects1;
27271/// use walletobjects1::api::LoyaltyClass;
27272/// # async fn dox() {
27273/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27274///
27275/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27276/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27277/// #     .with_native_roots()
27278/// #     .unwrap()
27279/// #     .https_only()
27280/// #     .enable_http2()
27281/// #     .build();
27282///
27283/// # let executor = hyper_util::rt::TokioExecutor::new();
27284/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27285/// #     secret,
27286/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27287/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27288/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
27289/// #     ),
27290/// # ).build().await.unwrap();
27291///
27292/// # let client = hyper_util::client::legacy::Client::builder(
27293/// #     hyper_util::rt::TokioExecutor::new()
27294/// # )
27295/// # .build(
27296/// #     hyper_rustls::HttpsConnectorBuilder::new()
27297/// #         .with_native_roots()
27298/// #         .unwrap()
27299/// #         .https_or_http()
27300/// #         .enable_http2()
27301/// #         .build()
27302/// # );
27303/// # let mut hub = Walletobjects::new(client, auth);
27304/// // As the method needs a request, you would usually fill it with the desired information
27305/// // into the respective structure. Some of the parts shown here might not be applicable !
27306/// // Values shown here are possibly random and not representative !
27307/// let mut req = LoyaltyClass::default();
27308///
27309/// // You can configure optional parameters by calling the respective setters at will, and
27310/// // execute the final call using `doit()`.
27311/// // Values shown here are possibly random and not representative !
27312/// let result = hub.loyaltyclass().update(req, "resourceId")
27313///              .doit().await;
27314/// # }
27315/// ```
27316pub struct LoyaltyclasUpdateCall<'a, C>
27317where
27318    C: 'a,
27319{
27320    hub: &'a Walletobjects<C>,
27321    _request: LoyaltyClass,
27322    _resource_id: String,
27323    _delegate: Option<&'a mut dyn common::Delegate>,
27324    _additional_params: HashMap<String, String>,
27325    _scopes: BTreeSet<String>,
27326}
27327
27328impl<'a, C> common::CallBuilder for LoyaltyclasUpdateCall<'a, C> {}
27329
27330impl<'a, C> LoyaltyclasUpdateCall<'a, C>
27331where
27332    C: common::Connector,
27333{
27334    /// Perform the operation you have build so far.
27335    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClass)> {
27336        use std::borrow::Cow;
27337        use std::io::{Read, Seek};
27338
27339        use common::{url::Params, ToParts};
27340        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27341
27342        let mut dd = common::DefaultDelegate;
27343        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27344        dlg.begin(common::MethodInfo {
27345            id: "walletobjects.loyaltyclass.update",
27346            http_method: hyper::Method::PUT,
27347        });
27348
27349        for &field in ["alt", "resourceId"].iter() {
27350            if self._additional_params.contains_key(field) {
27351                dlg.finished(false);
27352                return Err(common::Error::FieldClash(field));
27353            }
27354        }
27355
27356        let mut params = Params::with_capacity(4 + self._additional_params.len());
27357        params.push("resourceId", self._resource_id);
27358
27359        params.extend(self._additional_params.iter());
27360
27361        params.push("alt", "json");
27362        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass/{resourceId}";
27363        if self._scopes.is_empty() {
27364            self._scopes
27365                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
27366        }
27367
27368        #[allow(clippy::single_element_loop)]
27369        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
27370            url = params.uri_replacement(url, param_name, find_this, false);
27371        }
27372        {
27373            let to_remove = ["resourceId"];
27374            params.remove_params(&to_remove);
27375        }
27376
27377        let url = params.parse_with_url(&url);
27378
27379        let mut json_mime_type = mime::APPLICATION_JSON;
27380        let mut request_value_reader = {
27381            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27382            common::remove_json_null_values(&mut value);
27383            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27384            serde_json::to_writer(&mut dst, &value).unwrap();
27385            dst
27386        };
27387        let request_size = request_value_reader
27388            .seek(std::io::SeekFrom::End(0))
27389            .unwrap();
27390        request_value_reader
27391            .seek(std::io::SeekFrom::Start(0))
27392            .unwrap();
27393
27394        loop {
27395            let token = match self
27396                .hub
27397                .auth
27398                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27399                .await
27400            {
27401                Ok(token) => token,
27402                Err(e) => match dlg.token(e) {
27403                    Ok(token) => token,
27404                    Err(e) => {
27405                        dlg.finished(false);
27406                        return Err(common::Error::MissingToken(e));
27407                    }
27408                },
27409            };
27410            request_value_reader
27411                .seek(std::io::SeekFrom::Start(0))
27412                .unwrap();
27413            let mut req_result = {
27414                let client = &self.hub.client;
27415                dlg.pre_request();
27416                let mut req_builder = hyper::Request::builder()
27417                    .method(hyper::Method::PUT)
27418                    .uri(url.as_str())
27419                    .header(USER_AGENT, self.hub._user_agent.clone());
27420
27421                if let Some(token) = token.as_ref() {
27422                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27423                }
27424
27425                let request = req_builder
27426                    .header(CONTENT_TYPE, json_mime_type.to_string())
27427                    .header(CONTENT_LENGTH, request_size as u64)
27428                    .body(common::to_body(
27429                        request_value_reader.get_ref().clone().into(),
27430                    ));
27431
27432                client.request(request.unwrap()).await
27433            };
27434
27435            match req_result {
27436                Err(err) => {
27437                    if let common::Retry::After(d) = dlg.http_error(&err) {
27438                        sleep(d).await;
27439                        continue;
27440                    }
27441                    dlg.finished(false);
27442                    return Err(common::Error::HttpError(err));
27443                }
27444                Ok(res) => {
27445                    let (mut parts, body) = res.into_parts();
27446                    let mut body = common::Body::new(body);
27447                    if !parts.status.is_success() {
27448                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27449                        let error = serde_json::from_str(&common::to_string(&bytes));
27450                        let response = common::to_response(parts, bytes.into());
27451
27452                        if let common::Retry::After(d) =
27453                            dlg.http_failure(&response, error.as_ref().ok())
27454                        {
27455                            sleep(d).await;
27456                            continue;
27457                        }
27458
27459                        dlg.finished(false);
27460
27461                        return Err(match error {
27462                            Ok(value) => common::Error::BadRequest(value),
27463                            _ => common::Error::Failure(response),
27464                        });
27465                    }
27466                    let response = {
27467                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27468                        let encoded = common::to_string(&bytes);
27469                        match serde_json::from_str(&encoded) {
27470                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27471                            Err(error) => {
27472                                dlg.response_json_decode_error(&encoded, &error);
27473                                return Err(common::Error::JsonDecodeError(
27474                                    encoded.to_string(),
27475                                    error,
27476                                ));
27477                            }
27478                        }
27479                    };
27480
27481                    dlg.finished(true);
27482                    return Ok(response);
27483                }
27484            }
27485        }
27486    }
27487
27488    ///
27489    /// Sets the *request* property to the given value.
27490    ///
27491    /// Even though the property as already been set when instantiating this call,
27492    /// we provide this method for API completeness.
27493    pub fn request(mut self, new_value: LoyaltyClass) -> LoyaltyclasUpdateCall<'a, C> {
27494        self._request = new_value;
27495        self
27496    }
27497    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
27498    ///
27499    /// Sets the *resource id* path property to the given value.
27500    ///
27501    /// Even though the property as already been set when instantiating this call,
27502    /// we provide this method for API completeness.
27503    pub fn resource_id(mut self, new_value: &str) -> LoyaltyclasUpdateCall<'a, C> {
27504        self._resource_id = new_value.to_string();
27505        self
27506    }
27507    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27508    /// while executing the actual API request.
27509    ///
27510    /// ````text
27511    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27512    /// ````
27513    ///
27514    /// Sets the *delegate* property to the given value.
27515    pub fn delegate(
27516        mut self,
27517        new_value: &'a mut dyn common::Delegate,
27518    ) -> LoyaltyclasUpdateCall<'a, C> {
27519        self._delegate = Some(new_value);
27520        self
27521    }
27522
27523    /// Set any additional parameter of the query string used in the request.
27524    /// It should be used to set parameters which are not yet available through their own
27525    /// setters.
27526    ///
27527    /// Please note that this method must not be used to set any of the known parameters
27528    /// which have their own setter method. If done anyway, the request will fail.
27529    ///
27530    /// # Additional Parameters
27531    ///
27532    /// * *$.xgafv* (query-string) - V1 error format.
27533    /// * *access_token* (query-string) - OAuth access token.
27534    /// * *alt* (query-string) - Data format for response.
27535    /// * *callback* (query-string) - JSONP
27536    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27537    /// * *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.
27538    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27539    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27540    /// * *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.
27541    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27542    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27543    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasUpdateCall<'a, C>
27544    where
27545        T: AsRef<str>,
27546    {
27547        self._additional_params
27548            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27549        self
27550    }
27551
27552    /// Identifies the authorization scope for the method you are building.
27553    ///
27554    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27555    /// [`Scope::WalletObjectIssuer`].
27556    ///
27557    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27558    /// tokens for more than one scope.
27559    ///
27560    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27561    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27562    /// sufficient, a read-write scope will do as well.
27563    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasUpdateCall<'a, C>
27564    where
27565        St: AsRef<str>,
27566    {
27567        self._scopes.insert(String::from(scope.as_ref()));
27568        self
27569    }
27570    /// Identifies the authorization scope(s) for the method you are building.
27571    ///
27572    /// See [`Self::add_scope()`] for details.
27573    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasUpdateCall<'a, C>
27574    where
27575        I: IntoIterator<Item = St>,
27576        St: AsRef<str>,
27577    {
27578        self._scopes
27579            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27580        self
27581    }
27582
27583    /// Removes all scopes, and no default scope will be used either.
27584    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27585    /// for details).
27586    pub fn clear_scopes(mut self) -> LoyaltyclasUpdateCall<'a, C> {
27587        self._scopes.clear();
27588        self
27589    }
27590}
27591
27592/// Adds a message to the loyalty object referenced by the given object ID.
27593///
27594/// A builder for the *addmessage* method supported by a *loyaltyobject* resource.
27595/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
27596///
27597/// # Example
27598///
27599/// Instantiate a resource method builder
27600///
27601/// ```test_harness,no_run
27602/// # extern crate hyper;
27603/// # extern crate hyper_rustls;
27604/// # extern crate google_walletobjects1 as walletobjects1;
27605/// use walletobjects1::api::AddMessageRequest;
27606/// # async fn dox() {
27607/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27608///
27609/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27610/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27611/// #     .with_native_roots()
27612/// #     .unwrap()
27613/// #     .https_only()
27614/// #     .enable_http2()
27615/// #     .build();
27616///
27617/// # let executor = hyper_util::rt::TokioExecutor::new();
27618/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27619/// #     secret,
27620/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27621/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27622/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
27623/// #     ),
27624/// # ).build().await.unwrap();
27625///
27626/// # let client = hyper_util::client::legacy::Client::builder(
27627/// #     hyper_util::rt::TokioExecutor::new()
27628/// # )
27629/// # .build(
27630/// #     hyper_rustls::HttpsConnectorBuilder::new()
27631/// #         .with_native_roots()
27632/// #         .unwrap()
27633/// #         .https_or_http()
27634/// #         .enable_http2()
27635/// #         .build()
27636/// # );
27637/// # let mut hub = Walletobjects::new(client, auth);
27638/// // As the method needs a request, you would usually fill it with the desired information
27639/// // into the respective structure. Some of the parts shown here might not be applicable !
27640/// // Values shown here are possibly random and not representative !
27641/// let mut req = AddMessageRequest::default();
27642///
27643/// // You can configure optional parameters by calling the respective setters at will, and
27644/// // execute the final call using `doit()`.
27645/// // Values shown here are possibly random and not representative !
27646/// let result = hub.loyaltyobject().addmessage(req, "resourceId")
27647///              .doit().await;
27648/// # }
27649/// ```
27650pub struct LoyaltyobjectAddmessageCall<'a, C>
27651where
27652    C: 'a,
27653{
27654    hub: &'a Walletobjects<C>,
27655    _request: AddMessageRequest,
27656    _resource_id: String,
27657    _delegate: Option<&'a mut dyn common::Delegate>,
27658    _additional_params: HashMap<String, String>,
27659    _scopes: BTreeSet<String>,
27660}
27661
27662impl<'a, C> common::CallBuilder for LoyaltyobjectAddmessageCall<'a, C> {}
27663
27664impl<'a, C> LoyaltyobjectAddmessageCall<'a, C>
27665where
27666    C: common::Connector,
27667{
27668    /// Perform the operation you have build so far.
27669    pub async fn doit(
27670        mut self,
27671    ) -> common::Result<(common::Response, LoyaltyObjectAddMessageResponse)> {
27672        use std::borrow::Cow;
27673        use std::io::{Read, Seek};
27674
27675        use common::{url::Params, ToParts};
27676        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27677
27678        let mut dd = common::DefaultDelegate;
27679        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27680        dlg.begin(common::MethodInfo {
27681            id: "walletobjects.loyaltyobject.addmessage",
27682            http_method: hyper::Method::POST,
27683        });
27684
27685        for &field in ["alt", "resourceId"].iter() {
27686            if self._additional_params.contains_key(field) {
27687                dlg.finished(false);
27688                return Err(common::Error::FieldClash(field));
27689            }
27690        }
27691
27692        let mut params = Params::with_capacity(4 + self._additional_params.len());
27693        params.push("resourceId", self._resource_id);
27694
27695        params.extend(self._additional_params.iter());
27696
27697        params.push("alt", "json");
27698        let mut url =
27699            self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject/{resourceId}/addMessage";
27700        if self._scopes.is_empty() {
27701            self._scopes
27702                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
27703        }
27704
27705        #[allow(clippy::single_element_loop)]
27706        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
27707            url = params.uri_replacement(url, param_name, find_this, false);
27708        }
27709        {
27710            let to_remove = ["resourceId"];
27711            params.remove_params(&to_remove);
27712        }
27713
27714        let url = params.parse_with_url(&url);
27715
27716        let mut json_mime_type = mime::APPLICATION_JSON;
27717        let mut request_value_reader = {
27718            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27719            common::remove_json_null_values(&mut value);
27720            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27721            serde_json::to_writer(&mut dst, &value).unwrap();
27722            dst
27723        };
27724        let request_size = request_value_reader
27725            .seek(std::io::SeekFrom::End(0))
27726            .unwrap();
27727        request_value_reader
27728            .seek(std::io::SeekFrom::Start(0))
27729            .unwrap();
27730
27731        loop {
27732            let token = match self
27733                .hub
27734                .auth
27735                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27736                .await
27737            {
27738                Ok(token) => token,
27739                Err(e) => match dlg.token(e) {
27740                    Ok(token) => token,
27741                    Err(e) => {
27742                        dlg.finished(false);
27743                        return Err(common::Error::MissingToken(e));
27744                    }
27745                },
27746            };
27747            request_value_reader
27748                .seek(std::io::SeekFrom::Start(0))
27749                .unwrap();
27750            let mut req_result = {
27751                let client = &self.hub.client;
27752                dlg.pre_request();
27753                let mut req_builder = hyper::Request::builder()
27754                    .method(hyper::Method::POST)
27755                    .uri(url.as_str())
27756                    .header(USER_AGENT, self.hub._user_agent.clone());
27757
27758                if let Some(token) = token.as_ref() {
27759                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27760                }
27761
27762                let request = req_builder
27763                    .header(CONTENT_TYPE, json_mime_type.to_string())
27764                    .header(CONTENT_LENGTH, request_size as u64)
27765                    .body(common::to_body(
27766                        request_value_reader.get_ref().clone().into(),
27767                    ));
27768
27769                client.request(request.unwrap()).await
27770            };
27771
27772            match req_result {
27773                Err(err) => {
27774                    if let common::Retry::After(d) = dlg.http_error(&err) {
27775                        sleep(d).await;
27776                        continue;
27777                    }
27778                    dlg.finished(false);
27779                    return Err(common::Error::HttpError(err));
27780                }
27781                Ok(res) => {
27782                    let (mut parts, body) = res.into_parts();
27783                    let mut body = common::Body::new(body);
27784                    if !parts.status.is_success() {
27785                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27786                        let error = serde_json::from_str(&common::to_string(&bytes));
27787                        let response = common::to_response(parts, bytes.into());
27788
27789                        if let common::Retry::After(d) =
27790                            dlg.http_failure(&response, error.as_ref().ok())
27791                        {
27792                            sleep(d).await;
27793                            continue;
27794                        }
27795
27796                        dlg.finished(false);
27797
27798                        return Err(match error {
27799                            Ok(value) => common::Error::BadRequest(value),
27800                            _ => common::Error::Failure(response),
27801                        });
27802                    }
27803                    let response = {
27804                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27805                        let encoded = common::to_string(&bytes);
27806                        match serde_json::from_str(&encoded) {
27807                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27808                            Err(error) => {
27809                                dlg.response_json_decode_error(&encoded, &error);
27810                                return Err(common::Error::JsonDecodeError(
27811                                    encoded.to_string(),
27812                                    error,
27813                                ));
27814                            }
27815                        }
27816                    };
27817
27818                    dlg.finished(true);
27819                    return Ok(response);
27820                }
27821            }
27822        }
27823    }
27824
27825    ///
27826    /// Sets the *request* property to the given value.
27827    ///
27828    /// Even though the property as already been set when instantiating this call,
27829    /// we provide this method for API completeness.
27830    pub fn request(mut self, new_value: AddMessageRequest) -> LoyaltyobjectAddmessageCall<'a, C> {
27831        self._request = new_value;
27832        self
27833    }
27834    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
27835    ///
27836    /// Sets the *resource id* path property to the given value.
27837    ///
27838    /// Even though the property as already been set when instantiating this call,
27839    /// we provide this method for API completeness.
27840    pub fn resource_id(mut self, new_value: &str) -> LoyaltyobjectAddmessageCall<'a, C> {
27841        self._resource_id = new_value.to_string();
27842        self
27843    }
27844    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27845    /// while executing the actual API request.
27846    ///
27847    /// ````text
27848    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27849    /// ````
27850    ///
27851    /// Sets the *delegate* property to the given value.
27852    pub fn delegate(
27853        mut self,
27854        new_value: &'a mut dyn common::Delegate,
27855    ) -> LoyaltyobjectAddmessageCall<'a, C> {
27856        self._delegate = Some(new_value);
27857        self
27858    }
27859
27860    /// Set any additional parameter of the query string used in the request.
27861    /// It should be used to set parameters which are not yet available through their own
27862    /// setters.
27863    ///
27864    /// Please note that this method must not be used to set any of the known parameters
27865    /// which have their own setter method. If done anyway, the request will fail.
27866    ///
27867    /// # Additional Parameters
27868    ///
27869    /// * *$.xgafv* (query-string) - V1 error format.
27870    /// * *access_token* (query-string) - OAuth access token.
27871    /// * *alt* (query-string) - Data format for response.
27872    /// * *callback* (query-string) - JSONP
27873    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27874    /// * *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.
27875    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27876    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27877    /// * *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.
27878    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27879    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27880    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectAddmessageCall<'a, C>
27881    where
27882        T: AsRef<str>,
27883    {
27884        self._additional_params
27885            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27886        self
27887    }
27888
27889    /// Identifies the authorization scope for the method you are building.
27890    ///
27891    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27892    /// [`Scope::WalletObjectIssuer`].
27893    ///
27894    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27895    /// tokens for more than one scope.
27896    ///
27897    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27898    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27899    /// sufficient, a read-write scope will do as well.
27900    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectAddmessageCall<'a, C>
27901    where
27902        St: AsRef<str>,
27903    {
27904        self._scopes.insert(String::from(scope.as_ref()));
27905        self
27906    }
27907    /// Identifies the authorization scope(s) for the method you are building.
27908    ///
27909    /// See [`Self::add_scope()`] for details.
27910    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectAddmessageCall<'a, C>
27911    where
27912        I: IntoIterator<Item = St>,
27913        St: AsRef<str>,
27914    {
27915        self._scopes
27916            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27917        self
27918    }
27919
27920    /// Removes all scopes, and no default scope will be used either.
27921    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27922    /// for details).
27923    pub fn clear_scopes(mut self) -> LoyaltyobjectAddmessageCall<'a, C> {
27924        self._scopes.clear();
27925        self
27926    }
27927}
27928
27929/// Returns the loyalty object with the given object ID.
27930///
27931/// A builder for the *get* method supported by a *loyaltyobject* resource.
27932/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
27933///
27934/// # Example
27935///
27936/// Instantiate a resource method builder
27937///
27938/// ```test_harness,no_run
27939/// # extern crate hyper;
27940/// # extern crate hyper_rustls;
27941/// # extern crate google_walletobjects1 as walletobjects1;
27942/// # async fn dox() {
27943/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27944///
27945/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27946/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27947/// #     .with_native_roots()
27948/// #     .unwrap()
27949/// #     .https_only()
27950/// #     .enable_http2()
27951/// #     .build();
27952///
27953/// # let executor = hyper_util::rt::TokioExecutor::new();
27954/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27955/// #     secret,
27956/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27957/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27958/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
27959/// #     ),
27960/// # ).build().await.unwrap();
27961///
27962/// # let client = hyper_util::client::legacy::Client::builder(
27963/// #     hyper_util::rt::TokioExecutor::new()
27964/// # )
27965/// # .build(
27966/// #     hyper_rustls::HttpsConnectorBuilder::new()
27967/// #         .with_native_roots()
27968/// #         .unwrap()
27969/// #         .https_or_http()
27970/// #         .enable_http2()
27971/// #         .build()
27972/// # );
27973/// # let mut hub = Walletobjects::new(client, auth);
27974/// // You can configure optional parameters by calling the respective setters at will, and
27975/// // execute the final call using `doit()`.
27976/// // Values shown here are possibly random and not representative !
27977/// let result = hub.loyaltyobject().get("resourceId")
27978///              .doit().await;
27979/// # }
27980/// ```
27981pub struct LoyaltyobjectGetCall<'a, C>
27982where
27983    C: 'a,
27984{
27985    hub: &'a Walletobjects<C>,
27986    _resource_id: String,
27987    _delegate: Option<&'a mut dyn common::Delegate>,
27988    _additional_params: HashMap<String, String>,
27989    _scopes: BTreeSet<String>,
27990}
27991
27992impl<'a, C> common::CallBuilder for LoyaltyobjectGetCall<'a, C> {}
27993
27994impl<'a, C> LoyaltyobjectGetCall<'a, C>
27995where
27996    C: common::Connector,
27997{
27998    /// Perform the operation you have build so far.
27999    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
28000        use std::borrow::Cow;
28001        use std::io::{Read, Seek};
28002
28003        use common::{url::Params, ToParts};
28004        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28005
28006        let mut dd = common::DefaultDelegate;
28007        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28008        dlg.begin(common::MethodInfo {
28009            id: "walletobjects.loyaltyobject.get",
28010            http_method: hyper::Method::GET,
28011        });
28012
28013        for &field in ["alt", "resourceId"].iter() {
28014            if self._additional_params.contains_key(field) {
28015                dlg.finished(false);
28016                return Err(common::Error::FieldClash(field));
28017            }
28018        }
28019
28020        let mut params = Params::with_capacity(3 + self._additional_params.len());
28021        params.push("resourceId", self._resource_id);
28022
28023        params.extend(self._additional_params.iter());
28024
28025        params.push("alt", "json");
28026        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject/{resourceId}";
28027        if self._scopes.is_empty() {
28028            self._scopes
28029                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
28030        }
28031
28032        #[allow(clippy::single_element_loop)]
28033        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
28034            url = params.uri_replacement(url, param_name, find_this, false);
28035        }
28036        {
28037            let to_remove = ["resourceId"];
28038            params.remove_params(&to_remove);
28039        }
28040
28041        let url = params.parse_with_url(&url);
28042
28043        loop {
28044            let token = match self
28045                .hub
28046                .auth
28047                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28048                .await
28049            {
28050                Ok(token) => token,
28051                Err(e) => match dlg.token(e) {
28052                    Ok(token) => token,
28053                    Err(e) => {
28054                        dlg.finished(false);
28055                        return Err(common::Error::MissingToken(e));
28056                    }
28057                },
28058            };
28059            let mut req_result = {
28060                let client = &self.hub.client;
28061                dlg.pre_request();
28062                let mut req_builder = hyper::Request::builder()
28063                    .method(hyper::Method::GET)
28064                    .uri(url.as_str())
28065                    .header(USER_AGENT, self.hub._user_agent.clone());
28066
28067                if let Some(token) = token.as_ref() {
28068                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28069                }
28070
28071                let request = req_builder
28072                    .header(CONTENT_LENGTH, 0_u64)
28073                    .body(common::to_body::<String>(None));
28074
28075                client.request(request.unwrap()).await
28076            };
28077
28078            match req_result {
28079                Err(err) => {
28080                    if let common::Retry::After(d) = dlg.http_error(&err) {
28081                        sleep(d).await;
28082                        continue;
28083                    }
28084                    dlg.finished(false);
28085                    return Err(common::Error::HttpError(err));
28086                }
28087                Ok(res) => {
28088                    let (mut parts, body) = res.into_parts();
28089                    let mut body = common::Body::new(body);
28090                    if !parts.status.is_success() {
28091                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28092                        let error = serde_json::from_str(&common::to_string(&bytes));
28093                        let response = common::to_response(parts, bytes.into());
28094
28095                        if let common::Retry::After(d) =
28096                            dlg.http_failure(&response, error.as_ref().ok())
28097                        {
28098                            sleep(d).await;
28099                            continue;
28100                        }
28101
28102                        dlg.finished(false);
28103
28104                        return Err(match error {
28105                            Ok(value) => common::Error::BadRequest(value),
28106                            _ => common::Error::Failure(response),
28107                        });
28108                    }
28109                    let response = {
28110                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28111                        let encoded = common::to_string(&bytes);
28112                        match serde_json::from_str(&encoded) {
28113                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28114                            Err(error) => {
28115                                dlg.response_json_decode_error(&encoded, &error);
28116                                return Err(common::Error::JsonDecodeError(
28117                                    encoded.to_string(),
28118                                    error,
28119                                ));
28120                            }
28121                        }
28122                    };
28123
28124                    dlg.finished(true);
28125                    return Ok(response);
28126                }
28127            }
28128        }
28129    }
28130
28131    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
28132    ///
28133    /// Sets the *resource id* path property to the given value.
28134    ///
28135    /// Even though the property as already been set when instantiating this call,
28136    /// we provide this method for API completeness.
28137    pub fn resource_id(mut self, new_value: &str) -> LoyaltyobjectGetCall<'a, C> {
28138        self._resource_id = new_value.to_string();
28139        self
28140    }
28141    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28142    /// while executing the actual API request.
28143    ///
28144    /// ````text
28145    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28146    /// ````
28147    ///
28148    /// Sets the *delegate* property to the given value.
28149    pub fn delegate(
28150        mut self,
28151        new_value: &'a mut dyn common::Delegate,
28152    ) -> LoyaltyobjectGetCall<'a, C> {
28153        self._delegate = Some(new_value);
28154        self
28155    }
28156
28157    /// Set any additional parameter of the query string used in the request.
28158    /// It should be used to set parameters which are not yet available through their own
28159    /// setters.
28160    ///
28161    /// Please note that this method must not be used to set any of the known parameters
28162    /// which have their own setter method. If done anyway, the request will fail.
28163    ///
28164    /// # Additional Parameters
28165    ///
28166    /// * *$.xgafv* (query-string) - V1 error format.
28167    /// * *access_token* (query-string) - OAuth access token.
28168    /// * *alt* (query-string) - Data format for response.
28169    /// * *callback* (query-string) - JSONP
28170    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28171    /// * *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.
28172    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28173    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28174    /// * *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.
28175    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28176    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28177    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectGetCall<'a, C>
28178    where
28179        T: AsRef<str>,
28180    {
28181        self._additional_params
28182            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28183        self
28184    }
28185
28186    /// Identifies the authorization scope for the method you are building.
28187    ///
28188    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28189    /// [`Scope::WalletObjectIssuer`].
28190    ///
28191    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28192    /// tokens for more than one scope.
28193    ///
28194    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28195    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28196    /// sufficient, a read-write scope will do as well.
28197    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectGetCall<'a, C>
28198    where
28199        St: AsRef<str>,
28200    {
28201        self._scopes.insert(String::from(scope.as_ref()));
28202        self
28203    }
28204    /// Identifies the authorization scope(s) for the method you are building.
28205    ///
28206    /// See [`Self::add_scope()`] for details.
28207    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectGetCall<'a, C>
28208    where
28209        I: IntoIterator<Item = St>,
28210        St: AsRef<str>,
28211    {
28212        self._scopes
28213            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28214        self
28215    }
28216
28217    /// Removes all scopes, and no default scope will be used either.
28218    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28219    /// for details).
28220    pub fn clear_scopes(mut self) -> LoyaltyobjectGetCall<'a, C> {
28221        self._scopes.clear();
28222        self
28223    }
28224}
28225
28226/// Inserts an loyalty object with the given ID and properties.
28227///
28228/// A builder for the *insert* method supported by a *loyaltyobject* resource.
28229/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
28230///
28231/// # Example
28232///
28233/// Instantiate a resource method builder
28234///
28235/// ```test_harness,no_run
28236/// # extern crate hyper;
28237/// # extern crate hyper_rustls;
28238/// # extern crate google_walletobjects1 as walletobjects1;
28239/// use walletobjects1::api::LoyaltyObject;
28240/// # async fn dox() {
28241/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28242///
28243/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28244/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28245/// #     .with_native_roots()
28246/// #     .unwrap()
28247/// #     .https_only()
28248/// #     .enable_http2()
28249/// #     .build();
28250///
28251/// # let executor = hyper_util::rt::TokioExecutor::new();
28252/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28253/// #     secret,
28254/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28255/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
28256/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28257/// #     ),
28258/// # ).build().await.unwrap();
28259///
28260/// # let client = hyper_util::client::legacy::Client::builder(
28261/// #     hyper_util::rt::TokioExecutor::new()
28262/// # )
28263/// # .build(
28264/// #     hyper_rustls::HttpsConnectorBuilder::new()
28265/// #         .with_native_roots()
28266/// #         .unwrap()
28267/// #         .https_or_http()
28268/// #         .enable_http2()
28269/// #         .build()
28270/// # );
28271/// # let mut hub = Walletobjects::new(client, auth);
28272/// // As the method needs a request, you would usually fill it with the desired information
28273/// // into the respective structure. Some of the parts shown here might not be applicable !
28274/// // Values shown here are possibly random and not representative !
28275/// let mut req = LoyaltyObject::default();
28276///
28277/// // You can configure optional parameters by calling the respective setters at will, and
28278/// // execute the final call using `doit()`.
28279/// // Values shown here are possibly random and not representative !
28280/// let result = hub.loyaltyobject().insert(req)
28281///              .doit().await;
28282/// # }
28283/// ```
28284pub struct LoyaltyobjectInsertCall<'a, C>
28285where
28286    C: 'a,
28287{
28288    hub: &'a Walletobjects<C>,
28289    _request: LoyaltyObject,
28290    _delegate: Option<&'a mut dyn common::Delegate>,
28291    _additional_params: HashMap<String, String>,
28292    _scopes: BTreeSet<String>,
28293}
28294
28295impl<'a, C> common::CallBuilder for LoyaltyobjectInsertCall<'a, C> {}
28296
28297impl<'a, C> LoyaltyobjectInsertCall<'a, C>
28298where
28299    C: common::Connector,
28300{
28301    /// Perform the operation you have build so far.
28302    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
28303        use std::borrow::Cow;
28304        use std::io::{Read, Seek};
28305
28306        use common::{url::Params, ToParts};
28307        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28308
28309        let mut dd = common::DefaultDelegate;
28310        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28311        dlg.begin(common::MethodInfo {
28312            id: "walletobjects.loyaltyobject.insert",
28313            http_method: hyper::Method::POST,
28314        });
28315
28316        for &field in ["alt"].iter() {
28317            if self._additional_params.contains_key(field) {
28318                dlg.finished(false);
28319                return Err(common::Error::FieldClash(field));
28320            }
28321        }
28322
28323        let mut params = Params::with_capacity(3 + self._additional_params.len());
28324
28325        params.extend(self._additional_params.iter());
28326
28327        params.push("alt", "json");
28328        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject";
28329        if self._scopes.is_empty() {
28330            self._scopes
28331                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
28332        }
28333
28334        let url = params.parse_with_url(&url);
28335
28336        let mut json_mime_type = mime::APPLICATION_JSON;
28337        let mut request_value_reader = {
28338            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28339            common::remove_json_null_values(&mut value);
28340            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28341            serde_json::to_writer(&mut dst, &value).unwrap();
28342            dst
28343        };
28344        let request_size = request_value_reader
28345            .seek(std::io::SeekFrom::End(0))
28346            .unwrap();
28347        request_value_reader
28348            .seek(std::io::SeekFrom::Start(0))
28349            .unwrap();
28350
28351        loop {
28352            let token = match self
28353                .hub
28354                .auth
28355                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28356                .await
28357            {
28358                Ok(token) => token,
28359                Err(e) => match dlg.token(e) {
28360                    Ok(token) => token,
28361                    Err(e) => {
28362                        dlg.finished(false);
28363                        return Err(common::Error::MissingToken(e));
28364                    }
28365                },
28366            };
28367            request_value_reader
28368                .seek(std::io::SeekFrom::Start(0))
28369                .unwrap();
28370            let mut req_result = {
28371                let client = &self.hub.client;
28372                dlg.pre_request();
28373                let mut req_builder = hyper::Request::builder()
28374                    .method(hyper::Method::POST)
28375                    .uri(url.as_str())
28376                    .header(USER_AGENT, self.hub._user_agent.clone());
28377
28378                if let Some(token) = token.as_ref() {
28379                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28380                }
28381
28382                let request = req_builder
28383                    .header(CONTENT_TYPE, json_mime_type.to_string())
28384                    .header(CONTENT_LENGTH, request_size as u64)
28385                    .body(common::to_body(
28386                        request_value_reader.get_ref().clone().into(),
28387                    ));
28388
28389                client.request(request.unwrap()).await
28390            };
28391
28392            match req_result {
28393                Err(err) => {
28394                    if let common::Retry::After(d) = dlg.http_error(&err) {
28395                        sleep(d).await;
28396                        continue;
28397                    }
28398                    dlg.finished(false);
28399                    return Err(common::Error::HttpError(err));
28400                }
28401                Ok(res) => {
28402                    let (mut parts, body) = res.into_parts();
28403                    let mut body = common::Body::new(body);
28404                    if !parts.status.is_success() {
28405                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28406                        let error = serde_json::from_str(&common::to_string(&bytes));
28407                        let response = common::to_response(parts, bytes.into());
28408
28409                        if let common::Retry::After(d) =
28410                            dlg.http_failure(&response, error.as_ref().ok())
28411                        {
28412                            sleep(d).await;
28413                            continue;
28414                        }
28415
28416                        dlg.finished(false);
28417
28418                        return Err(match error {
28419                            Ok(value) => common::Error::BadRequest(value),
28420                            _ => common::Error::Failure(response),
28421                        });
28422                    }
28423                    let response = {
28424                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28425                        let encoded = common::to_string(&bytes);
28426                        match serde_json::from_str(&encoded) {
28427                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28428                            Err(error) => {
28429                                dlg.response_json_decode_error(&encoded, &error);
28430                                return Err(common::Error::JsonDecodeError(
28431                                    encoded.to_string(),
28432                                    error,
28433                                ));
28434                            }
28435                        }
28436                    };
28437
28438                    dlg.finished(true);
28439                    return Ok(response);
28440                }
28441            }
28442        }
28443    }
28444
28445    ///
28446    /// Sets the *request* property to the given value.
28447    ///
28448    /// Even though the property as already been set when instantiating this call,
28449    /// we provide this method for API completeness.
28450    pub fn request(mut self, new_value: LoyaltyObject) -> LoyaltyobjectInsertCall<'a, C> {
28451        self._request = new_value;
28452        self
28453    }
28454    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28455    /// while executing the actual API request.
28456    ///
28457    /// ````text
28458    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28459    /// ````
28460    ///
28461    /// Sets the *delegate* property to the given value.
28462    pub fn delegate(
28463        mut self,
28464        new_value: &'a mut dyn common::Delegate,
28465    ) -> LoyaltyobjectInsertCall<'a, C> {
28466        self._delegate = Some(new_value);
28467        self
28468    }
28469
28470    /// Set any additional parameter of the query string used in the request.
28471    /// It should be used to set parameters which are not yet available through their own
28472    /// setters.
28473    ///
28474    /// Please note that this method must not be used to set any of the known parameters
28475    /// which have their own setter method. If done anyway, the request will fail.
28476    ///
28477    /// # Additional Parameters
28478    ///
28479    /// * *$.xgafv* (query-string) - V1 error format.
28480    /// * *access_token* (query-string) - OAuth access token.
28481    /// * *alt* (query-string) - Data format for response.
28482    /// * *callback* (query-string) - JSONP
28483    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28484    /// * *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.
28485    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28486    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28487    /// * *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.
28488    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28489    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28490    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectInsertCall<'a, C>
28491    where
28492        T: AsRef<str>,
28493    {
28494        self._additional_params
28495            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28496        self
28497    }
28498
28499    /// Identifies the authorization scope for the method you are building.
28500    ///
28501    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28502    /// [`Scope::WalletObjectIssuer`].
28503    ///
28504    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28505    /// tokens for more than one scope.
28506    ///
28507    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28508    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28509    /// sufficient, a read-write scope will do as well.
28510    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectInsertCall<'a, C>
28511    where
28512        St: AsRef<str>,
28513    {
28514        self._scopes.insert(String::from(scope.as_ref()));
28515        self
28516    }
28517    /// Identifies the authorization scope(s) for the method you are building.
28518    ///
28519    /// See [`Self::add_scope()`] for details.
28520    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectInsertCall<'a, C>
28521    where
28522        I: IntoIterator<Item = St>,
28523        St: AsRef<str>,
28524    {
28525        self._scopes
28526            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28527        self
28528    }
28529
28530    /// Removes all scopes, and no default scope will be used either.
28531    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28532    /// for details).
28533    pub fn clear_scopes(mut self) -> LoyaltyobjectInsertCall<'a, C> {
28534        self._scopes.clear();
28535        self
28536    }
28537}
28538
28539/// Returns a list of all loyalty objects for a given issuer ID.
28540///
28541/// A builder for the *list* method supported by a *loyaltyobject* resource.
28542/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
28543///
28544/// # Example
28545///
28546/// Instantiate a resource method builder
28547///
28548/// ```test_harness,no_run
28549/// # extern crate hyper;
28550/// # extern crate hyper_rustls;
28551/// # extern crate google_walletobjects1 as walletobjects1;
28552/// # async fn dox() {
28553/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28554///
28555/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28556/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28557/// #     .with_native_roots()
28558/// #     .unwrap()
28559/// #     .https_only()
28560/// #     .enable_http2()
28561/// #     .build();
28562///
28563/// # let executor = hyper_util::rt::TokioExecutor::new();
28564/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28565/// #     secret,
28566/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28567/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
28568/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28569/// #     ),
28570/// # ).build().await.unwrap();
28571///
28572/// # let client = hyper_util::client::legacy::Client::builder(
28573/// #     hyper_util::rt::TokioExecutor::new()
28574/// # )
28575/// # .build(
28576/// #     hyper_rustls::HttpsConnectorBuilder::new()
28577/// #         .with_native_roots()
28578/// #         .unwrap()
28579/// #         .https_or_http()
28580/// #         .enable_http2()
28581/// #         .build()
28582/// # );
28583/// # let mut hub = Walletobjects::new(client, auth);
28584/// // You can configure optional parameters by calling the respective setters at will, and
28585/// // execute the final call using `doit()`.
28586/// // Values shown here are possibly random and not representative !
28587/// let result = hub.loyaltyobject().list()
28588///              .token("diam")
28589///              .max_results(-61)
28590///              .class_id("ipsum")
28591///              .doit().await;
28592/// # }
28593/// ```
28594pub struct LoyaltyobjectListCall<'a, C>
28595where
28596    C: 'a,
28597{
28598    hub: &'a Walletobjects<C>,
28599    _token: Option<String>,
28600    _max_results: Option<i32>,
28601    _class_id: Option<String>,
28602    _delegate: Option<&'a mut dyn common::Delegate>,
28603    _additional_params: HashMap<String, String>,
28604    _scopes: BTreeSet<String>,
28605}
28606
28607impl<'a, C> common::CallBuilder for LoyaltyobjectListCall<'a, C> {}
28608
28609impl<'a, C> LoyaltyobjectListCall<'a, C>
28610where
28611    C: common::Connector,
28612{
28613    /// Perform the operation you have build so far.
28614    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObjectListResponse)> {
28615        use std::borrow::Cow;
28616        use std::io::{Read, Seek};
28617
28618        use common::{url::Params, ToParts};
28619        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28620
28621        let mut dd = common::DefaultDelegate;
28622        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28623        dlg.begin(common::MethodInfo {
28624            id: "walletobjects.loyaltyobject.list",
28625            http_method: hyper::Method::GET,
28626        });
28627
28628        for &field in ["alt", "token", "maxResults", "classId"].iter() {
28629            if self._additional_params.contains_key(field) {
28630                dlg.finished(false);
28631                return Err(common::Error::FieldClash(field));
28632            }
28633        }
28634
28635        let mut params = Params::with_capacity(5 + self._additional_params.len());
28636        if let Some(value) = self._token.as_ref() {
28637            params.push("token", value);
28638        }
28639        if let Some(value) = self._max_results.as_ref() {
28640            params.push("maxResults", value.to_string());
28641        }
28642        if let Some(value) = self._class_id.as_ref() {
28643            params.push("classId", value);
28644        }
28645
28646        params.extend(self._additional_params.iter());
28647
28648        params.push("alt", "json");
28649        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject";
28650        if self._scopes.is_empty() {
28651            self._scopes
28652                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
28653        }
28654
28655        let url = params.parse_with_url(&url);
28656
28657        loop {
28658            let token = match self
28659                .hub
28660                .auth
28661                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28662                .await
28663            {
28664                Ok(token) => token,
28665                Err(e) => match dlg.token(e) {
28666                    Ok(token) => token,
28667                    Err(e) => {
28668                        dlg.finished(false);
28669                        return Err(common::Error::MissingToken(e));
28670                    }
28671                },
28672            };
28673            let mut req_result = {
28674                let client = &self.hub.client;
28675                dlg.pre_request();
28676                let mut req_builder = hyper::Request::builder()
28677                    .method(hyper::Method::GET)
28678                    .uri(url.as_str())
28679                    .header(USER_AGENT, self.hub._user_agent.clone());
28680
28681                if let Some(token) = token.as_ref() {
28682                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28683                }
28684
28685                let request = req_builder
28686                    .header(CONTENT_LENGTH, 0_u64)
28687                    .body(common::to_body::<String>(None));
28688
28689                client.request(request.unwrap()).await
28690            };
28691
28692            match req_result {
28693                Err(err) => {
28694                    if let common::Retry::After(d) = dlg.http_error(&err) {
28695                        sleep(d).await;
28696                        continue;
28697                    }
28698                    dlg.finished(false);
28699                    return Err(common::Error::HttpError(err));
28700                }
28701                Ok(res) => {
28702                    let (mut parts, body) = res.into_parts();
28703                    let mut body = common::Body::new(body);
28704                    if !parts.status.is_success() {
28705                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28706                        let error = serde_json::from_str(&common::to_string(&bytes));
28707                        let response = common::to_response(parts, bytes.into());
28708
28709                        if let common::Retry::After(d) =
28710                            dlg.http_failure(&response, error.as_ref().ok())
28711                        {
28712                            sleep(d).await;
28713                            continue;
28714                        }
28715
28716                        dlg.finished(false);
28717
28718                        return Err(match error {
28719                            Ok(value) => common::Error::BadRequest(value),
28720                            _ => common::Error::Failure(response),
28721                        });
28722                    }
28723                    let response = {
28724                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28725                        let encoded = common::to_string(&bytes);
28726                        match serde_json::from_str(&encoded) {
28727                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28728                            Err(error) => {
28729                                dlg.response_json_decode_error(&encoded, &error);
28730                                return Err(common::Error::JsonDecodeError(
28731                                    encoded.to_string(),
28732                                    error,
28733                                ));
28734                            }
28735                        }
28736                    };
28737
28738                    dlg.finished(true);
28739                    return Ok(response);
28740                }
28741            }
28742        }
28743    }
28744
28745    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` objects are available in a list. For example, if you have a list of 200 objects and you call list with `maxResults` set to 20, list will return the first 20 objects and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 objects.
28746    ///
28747    /// Sets the *token* query property to the given value.
28748    pub fn token(mut self, new_value: &str) -> LoyaltyobjectListCall<'a, C> {
28749        self._token = Some(new_value.to_string());
28750        self
28751    }
28752    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
28753    ///
28754    /// Sets the *max results* query property to the given value.
28755    pub fn max_results(mut self, new_value: i32) -> LoyaltyobjectListCall<'a, C> {
28756        self._max_results = Some(new_value);
28757        self
28758    }
28759    /// The ID of the class whose objects will be listed.
28760    ///
28761    /// Sets the *class id* query property to the given value.
28762    pub fn class_id(mut self, new_value: &str) -> LoyaltyobjectListCall<'a, C> {
28763        self._class_id = Some(new_value.to_string());
28764        self
28765    }
28766    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28767    /// while executing the actual API request.
28768    ///
28769    /// ````text
28770    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28771    /// ````
28772    ///
28773    /// Sets the *delegate* property to the given value.
28774    pub fn delegate(
28775        mut self,
28776        new_value: &'a mut dyn common::Delegate,
28777    ) -> LoyaltyobjectListCall<'a, C> {
28778        self._delegate = Some(new_value);
28779        self
28780    }
28781
28782    /// Set any additional parameter of the query string used in the request.
28783    /// It should be used to set parameters which are not yet available through their own
28784    /// setters.
28785    ///
28786    /// Please note that this method must not be used to set any of the known parameters
28787    /// which have their own setter method. If done anyway, the request will fail.
28788    ///
28789    /// # Additional Parameters
28790    ///
28791    /// * *$.xgafv* (query-string) - V1 error format.
28792    /// * *access_token* (query-string) - OAuth access token.
28793    /// * *alt* (query-string) - Data format for response.
28794    /// * *callback* (query-string) - JSONP
28795    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28796    /// * *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.
28797    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28798    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28799    /// * *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.
28800    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28801    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28802    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectListCall<'a, C>
28803    where
28804        T: AsRef<str>,
28805    {
28806        self._additional_params
28807            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28808        self
28809    }
28810
28811    /// Identifies the authorization scope for the method you are building.
28812    ///
28813    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28814    /// [`Scope::WalletObjectIssuer`].
28815    ///
28816    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28817    /// tokens for more than one scope.
28818    ///
28819    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28820    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28821    /// sufficient, a read-write scope will do as well.
28822    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectListCall<'a, C>
28823    where
28824        St: AsRef<str>,
28825    {
28826        self._scopes.insert(String::from(scope.as_ref()));
28827        self
28828    }
28829    /// Identifies the authorization scope(s) for the method you are building.
28830    ///
28831    /// See [`Self::add_scope()`] for details.
28832    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectListCall<'a, C>
28833    where
28834        I: IntoIterator<Item = St>,
28835        St: AsRef<str>,
28836    {
28837        self._scopes
28838            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28839        self
28840    }
28841
28842    /// Removes all scopes, and no default scope will be used either.
28843    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28844    /// for details).
28845    pub fn clear_scopes(mut self) -> LoyaltyobjectListCall<'a, C> {
28846        self._scopes.clear();
28847        self
28848    }
28849}
28850
28851/// Modifies linked offer objects for the loyalty object with the given ID.
28852///
28853/// A builder for the *modifylinkedofferobjects* method supported by a *loyaltyobject* resource.
28854/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
28855///
28856/// # Example
28857///
28858/// Instantiate a resource method builder
28859///
28860/// ```test_harness,no_run
28861/// # extern crate hyper;
28862/// # extern crate hyper_rustls;
28863/// # extern crate google_walletobjects1 as walletobjects1;
28864/// use walletobjects1::api::ModifyLinkedOfferObjectsRequest;
28865/// # async fn dox() {
28866/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28867///
28868/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28869/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28870/// #     .with_native_roots()
28871/// #     .unwrap()
28872/// #     .https_only()
28873/// #     .enable_http2()
28874/// #     .build();
28875///
28876/// # let executor = hyper_util::rt::TokioExecutor::new();
28877/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28878/// #     secret,
28879/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28880/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
28881/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28882/// #     ),
28883/// # ).build().await.unwrap();
28884///
28885/// # let client = hyper_util::client::legacy::Client::builder(
28886/// #     hyper_util::rt::TokioExecutor::new()
28887/// # )
28888/// # .build(
28889/// #     hyper_rustls::HttpsConnectorBuilder::new()
28890/// #         .with_native_roots()
28891/// #         .unwrap()
28892/// #         .https_or_http()
28893/// #         .enable_http2()
28894/// #         .build()
28895/// # );
28896/// # let mut hub = Walletobjects::new(client, auth);
28897/// // As the method needs a request, you would usually fill it with the desired information
28898/// // into the respective structure. Some of the parts shown here might not be applicable !
28899/// // Values shown here are possibly random and not representative !
28900/// let mut req = ModifyLinkedOfferObjectsRequest::default();
28901///
28902/// // You can configure optional parameters by calling the respective setters at will, and
28903/// // execute the final call using `doit()`.
28904/// // Values shown here are possibly random and not representative !
28905/// let result = hub.loyaltyobject().modifylinkedofferobjects(req, "resourceId")
28906///              .doit().await;
28907/// # }
28908/// ```
28909pub struct LoyaltyobjectModifylinkedofferobjectCall<'a, C>
28910where
28911    C: 'a,
28912{
28913    hub: &'a Walletobjects<C>,
28914    _request: ModifyLinkedOfferObjectsRequest,
28915    _resource_id: String,
28916    _delegate: Option<&'a mut dyn common::Delegate>,
28917    _additional_params: HashMap<String, String>,
28918    _scopes: BTreeSet<String>,
28919}
28920
28921impl<'a, C> common::CallBuilder for LoyaltyobjectModifylinkedofferobjectCall<'a, C> {}
28922
28923impl<'a, C> LoyaltyobjectModifylinkedofferobjectCall<'a, C>
28924where
28925    C: common::Connector,
28926{
28927    /// Perform the operation you have build so far.
28928    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
28929        use std::borrow::Cow;
28930        use std::io::{Read, Seek};
28931
28932        use common::{url::Params, ToParts};
28933        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28934
28935        let mut dd = common::DefaultDelegate;
28936        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28937        dlg.begin(common::MethodInfo {
28938            id: "walletobjects.loyaltyobject.modifylinkedofferobjects",
28939            http_method: hyper::Method::POST,
28940        });
28941
28942        for &field in ["alt", "resourceId"].iter() {
28943            if self._additional_params.contains_key(field) {
28944                dlg.finished(false);
28945                return Err(common::Error::FieldClash(field));
28946            }
28947        }
28948
28949        let mut params = Params::with_capacity(4 + self._additional_params.len());
28950        params.push("resourceId", self._resource_id);
28951
28952        params.extend(self._additional_params.iter());
28953
28954        params.push("alt", "json");
28955        let mut url = self.hub._base_url.clone()
28956            + "walletobjects/v1/loyaltyObject/{resourceId}/modifyLinkedOfferObjects";
28957        if self._scopes.is_empty() {
28958            self._scopes
28959                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
28960        }
28961
28962        #[allow(clippy::single_element_loop)]
28963        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
28964            url = params.uri_replacement(url, param_name, find_this, false);
28965        }
28966        {
28967            let to_remove = ["resourceId"];
28968            params.remove_params(&to_remove);
28969        }
28970
28971        let url = params.parse_with_url(&url);
28972
28973        let mut json_mime_type = mime::APPLICATION_JSON;
28974        let mut request_value_reader = {
28975            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28976            common::remove_json_null_values(&mut value);
28977            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28978            serde_json::to_writer(&mut dst, &value).unwrap();
28979            dst
28980        };
28981        let request_size = request_value_reader
28982            .seek(std::io::SeekFrom::End(0))
28983            .unwrap();
28984        request_value_reader
28985            .seek(std::io::SeekFrom::Start(0))
28986            .unwrap();
28987
28988        loop {
28989            let token = match self
28990                .hub
28991                .auth
28992                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28993                .await
28994            {
28995                Ok(token) => token,
28996                Err(e) => match dlg.token(e) {
28997                    Ok(token) => token,
28998                    Err(e) => {
28999                        dlg.finished(false);
29000                        return Err(common::Error::MissingToken(e));
29001                    }
29002                },
29003            };
29004            request_value_reader
29005                .seek(std::io::SeekFrom::Start(0))
29006                .unwrap();
29007            let mut req_result = {
29008                let client = &self.hub.client;
29009                dlg.pre_request();
29010                let mut req_builder = hyper::Request::builder()
29011                    .method(hyper::Method::POST)
29012                    .uri(url.as_str())
29013                    .header(USER_AGENT, self.hub._user_agent.clone());
29014
29015                if let Some(token) = token.as_ref() {
29016                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29017                }
29018
29019                let request = req_builder
29020                    .header(CONTENT_TYPE, json_mime_type.to_string())
29021                    .header(CONTENT_LENGTH, request_size as u64)
29022                    .body(common::to_body(
29023                        request_value_reader.get_ref().clone().into(),
29024                    ));
29025
29026                client.request(request.unwrap()).await
29027            };
29028
29029            match req_result {
29030                Err(err) => {
29031                    if let common::Retry::After(d) = dlg.http_error(&err) {
29032                        sleep(d).await;
29033                        continue;
29034                    }
29035                    dlg.finished(false);
29036                    return Err(common::Error::HttpError(err));
29037                }
29038                Ok(res) => {
29039                    let (mut parts, body) = res.into_parts();
29040                    let mut body = common::Body::new(body);
29041                    if !parts.status.is_success() {
29042                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29043                        let error = serde_json::from_str(&common::to_string(&bytes));
29044                        let response = common::to_response(parts, bytes.into());
29045
29046                        if let common::Retry::After(d) =
29047                            dlg.http_failure(&response, error.as_ref().ok())
29048                        {
29049                            sleep(d).await;
29050                            continue;
29051                        }
29052
29053                        dlg.finished(false);
29054
29055                        return Err(match error {
29056                            Ok(value) => common::Error::BadRequest(value),
29057                            _ => common::Error::Failure(response),
29058                        });
29059                    }
29060                    let response = {
29061                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29062                        let encoded = common::to_string(&bytes);
29063                        match serde_json::from_str(&encoded) {
29064                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29065                            Err(error) => {
29066                                dlg.response_json_decode_error(&encoded, &error);
29067                                return Err(common::Error::JsonDecodeError(
29068                                    encoded.to_string(),
29069                                    error,
29070                                ));
29071                            }
29072                        }
29073                    };
29074
29075                    dlg.finished(true);
29076                    return Ok(response);
29077                }
29078            }
29079        }
29080    }
29081
29082    ///
29083    /// Sets the *request* property to the given value.
29084    ///
29085    /// Even though the property as already been set when instantiating this call,
29086    /// we provide this method for API completeness.
29087    pub fn request(
29088        mut self,
29089        new_value: ModifyLinkedOfferObjectsRequest,
29090    ) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
29091        self._request = new_value;
29092        self
29093    }
29094    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
29095    ///
29096    /// Sets the *resource id* path property to the given value.
29097    ///
29098    /// Even though the property as already been set when instantiating this call,
29099    /// we provide this method for API completeness.
29100    pub fn resource_id(
29101        mut self,
29102        new_value: &str,
29103    ) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
29104        self._resource_id = new_value.to_string();
29105        self
29106    }
29107    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29108    /// while executing the actual API request.
29109    ///
29110    /// ````text
29111    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29112    /// ````
29113    ///
29114    /// Sets the *delegate* property to the given value.
29115    pub fn delegate(
29116        mut self,
29117        new_value: &'a mut dyn common::Delegate,
29118    ) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
29119        self._delegate = Some(new_value);
29120        self
29121    }
29122
29123    /// Set any additional parameter of the query string used in the request.
29124    /// It should be used to set parameters which are not yet available through their own
29125    /// setters.
29126    ///
29127    /// Please note that this method must not be used to set any of the known parameters
29128    /// which have their own setter method. If done anyway, the request will fail.
29129    ///
29130    /// # Additional Parameters
29131    ///
29132    /// * *$.xgafv* (query-string) - V1 error format.
29133    /// * *access_token* (query-string) - OAuth access token.
29134    /// * *alt* (query-string) - Data format for response.
29135    /// * *callback* (query-string) - JSONP
29136    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29137    /// * *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.
29138    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29139    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29140    /// * *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.
29141    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29142    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29143    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C>
29144    where
29145        T: AsRef<str>,
29146    {
29147        self._additional_params
29148            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29149        self
29150    }
29151
29152    /// Identifies the authorization scope for the method you are building.
29153    ///
29154    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29155    /// [`Scope::WalletObjectIssuer`].
29156    ///
29157    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29158    /// tokens for more than one scope.
29159    ///
29160    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29161    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29162    /// sufficient, a read-write scope will do as well.
29163    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C>
29164    where
29165        St: AsRef<str>,
29166    {
29167        self._scopes.insert(String::from(scope.as_ref()));
29168        self
29169    }
29170    /// Identifies the authorization scope(s) for the method you are building.
29171    ///
29172    /// See [`Self::add_scope()`] for details.
29173    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C>
29174    where
29175        I: IntoIterator<Item = St>,
29176        St: AsRef<str>,
29177    {
29178        self._scopes
29179            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29180        self
29181    }
29182
29183    /// Removes all scopes, and no default scope will be used either.
29184    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29185    /// for details).
29186    pub fn clear_scopes(mut self) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
29187        self._scopes.clear();
29188        self
29189    }
29190}
29191
29192/// Updates the loyalty object referenced by the given object ID. This method supports patch semantics.
29193///
29194/// A builder for the *patch* method supported by a *loyaltyobject* resource.
29195/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
29196///
29197/// # Example
29198///
29199/// Instantiate a resource method builder
29200///
29201/// ```test_harness,no_run
29202/// # extern crate hyper;
29203/// # extern crate hyper_rustls;
29204/// # extern crate google_walletobjects1 as walletobjects1;
29205/// use walletobjects1::api::LoyaltyObject;
29206/// # async fn dox() {
29207/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29208///
29209/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29210/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29211/// #     .with_native_roots()
29212/// #     .unwrap()
29213/// #     .https_only()
29214/// #     .enable_http2()
29215/// #     .build();
29216///
29217/// # let executor = hyper_util::rt::TokioExecutor::new();
29218/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29219/// #     secret,
29220/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29221/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
29222/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
29223/// #     ),
29224/// # ).build().await.unwrap();
29225///
29226/// # let client = hyper_util::client::legacy::Client::builder(
29227/// #     hyper_util::rt::TokioExecutor::new()
29228/// # )
29229/// # .build(
29230/// #     hyper_rustls::HttpsConnectorBuilder::new()
29231/// #         .with_native_roots()
29232/// #         .unwrap()
29233/// #         .https_or_http()
29234/// #         .enable_http2()
29235/// #         .build()
29236/// # );
29237/// # let mut hub = Walletobjects::new(client, auth);
29238/// // As the method needs a request, you would usually fill it with the desired information
29239/// // into the respective structure. Some of the parts shown here might not be applicable !
29240/// // Values shown here are possibly random and not representative !
29241/// let mut req = LoyaltyObject::default();
29242///
29243/// // You can configure optional parameters by calling the respective setters at will, and
29244/// // execute the final call using `doit()`.
29245/// // Values shown here are possibly random and not representative !
29246/// let result = hub.loyaltyobject().patch(req, "resourceId")
29247///              .doit().await;
29248/// # }
29249/// ```
29250pub struct LoyaltyobjectPatchCall<'a, C>
29251where
29252    C: 'a,
29253{
29254    hub: &'a Walletobjects<C>,
29255    _request: LoyaltyObject,
29256    _resource_id: String,
29257    _delegate: Option<&'a mut dyn common::Delegate>,
29258    _additional_params: HashMap<String, String>,
29259    _scopes: BTreeSet<String>,
29260}
29261
29262impl<'a, C> common::CallBuilder for LoyaltyobjectPatchCall<'a, C> {}
29263
29264impl<'a, C> LoyaltyobjectPatchCall<'a, C>
29265where
29266    C: common::Connector,
29267{
29268    /// Perform the operation you have build so far.
29269    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
29270        use std::borrow::Cow;
29271        use std::io::{Read, Seek};
29272
29273        use common::{url::Params, ToParts};
29274        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29275
29276        let mut dd = common::DefaultDelegate;
29277        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29278        dlg.begin(common::MethodInfo {
29279            id: "walletobjects.loyaltyobject.patch",
29280            http_method: hyper::Method::PATCH,
29281        });
29282
29283        for &field in ["alt", "resourceId"].iter() {
29284            if self._additional_params.contains_key(field) {
29285                dlg.finished(false);
29286                return Err(common::Error::FieldClash(field));
29287            }
29288        }
29289
29290        let mut params = Params::with_capacity(4 + self._additional_params.len());
29291        params.push("resourceId", self._resource_id);
29292
29293        params.extend(self._additional_params.iter());
29294
29295        params.push("alt", "json");
29296        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject/{resourceId}";
29297        if self._scopes.is_empty() {
29298            self._scopes
29299                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
29300        }
29301
29302        #[allow(clippy::single_element_loop)]
29303        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
29304            url = params.uri_replacement(url, param_name, find_this, false);
29305        }
29306        {
29307            let to_remove = ["resourceId"];
29308            params.remove_params(&to_remove);
29309        }
29310
29311        let url = params.parse_with_url(&url);
29312
29313        let mut json_mime_type = mime::APPLICATION_JSON;
29314        let mut request_value_reader = {
29315            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29316            common::remove_json_null_values(&mut value);
29317            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29318            serde_json::to_writer(&mut dst, &value).unwrap();
29319            dst
29320        };
29321        let request_size = request_value_reader
29322            .seek(std::io::SeekFrom::End(0))
29323            .unwrap();
29324        request_value_reader
29325            .seek(std::io::SeekFrom::Start(0))
29326            .unwrap();
29327
29328        loop {
29329            let token = match self
29330                .hub
29331                .auth
29332                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29333                .await
29334            {
29335                Ok(token) => token,
29336                Err(e) => match dlg.token(e) {
29337                    Ok(token) => token,
29338                    Err(e) => {
29339                        dlg.finished(false);
29340                        return Err(common::Error::MissingToken(e));
29341                    }
29342                },
29343            };
29344            request_value_reader
29345                .seek(std::io::SeekFrom::Start(0))
29346                .unwrap();
29347            let mut req_result = {
29348                let client = &self.hub.client;
29349                dlg.pre_request();
29350                let mut req_builder = hyper::Request::builder()
29351                    .method(hyper::Method::PATCH)
29352                    .uri(url.as_str())
29353                    .header(USER_AGENT, self.hub._user_agent.clone());
29354
29355                if let Some(token) = token.as_ref() {
29356                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29357                }
29358
29359                let request = req_builder
29360                    .header(CONTENT_TYPE, json_mime_type.to_string())
29361                    .header(CONTENT_LENGTH, request_size as u64)
29362                    .body(common::to_body(
29363                        request_value_reader.get_ref().clone().into(),
29364                    ));
29365
29366                client.request(request.unwrap()).await
29367            };
29368
29369            match req_result {
29370                Err(err) => {
29371                    if let common::Retry::After(d) = dlg.http_error(&err) {
29372                        sleep(d).await;
29373                        continue;
29374                    }
29375                    dlg.finished(false);
29376                    return Err(common::Error::HttpError(err));
29377                }
29378                Ok(res) => {
29379                    let (mut parts, body) = res.into_parts();
29380                    let mut body = common::Body::new(body);
29381                    if !parts.status.is_success() {
29382                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29383                        let error = serde_json::from_str(&common::to_string(&bytes));
29384                        let response = common::to_response(parts, bytes.into());
29385
29386                        if let common::Retry::After(d) =
29387                            dlg.http_failure(&response, error.as_ref().ok())
29388                        {
29389                            sleep(d).await;
29390                            continue;
29391                        }
29392
29393                        dlg.finished(false);
29394
29395                        return Err(match error {
29396                            Ok(value) => common::Error::BadRequest(value),
29397                            _ => common::Error::Failure(response),
29398                        });
29399                    }
29400                    let response = {
29401                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29402                        let encoded = common::to_string(&bytes);
29403                        match serde_json::from_str(&encoded) {
29404                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29405                            Err(error) => {
29406                                dlg.response_json_decode_error(&encoded, &error);
29407                                return Err(common::Error::JsonDecodeError(
29408                                    encoded.to_string(),
29409                                    error,
29410                                ));
29411                            }
29412                        }
29413                    };
29414
29415                    dlg.finished(true);
29416                    return Ok(response);
29417                }
29418            }
29419        }
29420    }
29421
29422    ///
29423    /// Sets the *request* property to the given value.
29424    ///
29425    /// Even though the property as already been set when instantiating this call,
29426    /// we provide this method for API completeness.
29427    pub fn request(mut self, new_value: LoyaltyObject) -> LoyaltyobjectPatchCall<'a, C> {
29428        self._request = new_value;
29429        self
29430    }
29431    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
29432    ///
29433    /// Sets the *resource id* path property to the given value.
29434    ///
29435    /// Even though the property as already been set when instantiating this call,
29436    /// we provide this method for API completeness.
29437    pub fn resource_id(mut self, new_value: &str) -> LoyaltyobjectPatchCall<'a, C> {
29438        self._resource_id = new_value.to_string();
29439        self
29440    }
29441    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29442    /// while executing the actual API request.
29443    ///
29444    /// ````text
29445    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29446    /// ````
29447    ///
29448    /// Sets the *delegate* property to the given value.
29449    pub fn delegate(
29450        mut self,
29451        new_value: &'a mut dyn common::Delegate,
29452    ) -> LoyaltyobjectPatchCall<'a, C> {
29453        self._delegate = Some(new_value);
29454        self
29455    }
29456
29457    /// Set any additional parameter of the query string used in the request.
29458    /// It should be used to set parameters which are not yet available through their own
29459    /// setters.
29460    ///
29461    /// Please note that this method must not be used to set any of the known parameters
29462    /// which have their own setter method. If done anyway, the request will fail.
29463    ///
29464    /// # Additional Parameters
29465    ///
29466    /// * *$.xgafv* (query-string) - V1 error format.
29467    /// * *access_token* (query-string) - OAuth access token.
29468    /// * *alt* (query-string) - Data format for response.
29469    /// * *callback* (query-string) - JSONP
29470    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29471    /// * *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.
29472    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29473    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29474    /// * *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.
29475    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29476    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29477    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectPatchCall<'a, C>
29478    where
29479        T: AsRef<str>,
29480    {
29481        self._additional_params
29482            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29483        self
29484    }
29485
29486    /// Identifies the authorization scope for the method you are building.
29487    ///
29488    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29489    /// [`Scope::WalletObjectIssuer`].
29490    ///
29491    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29492    /// tokens for more than one scope.
29493    ///
29494    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29495    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29496    /// sufficient, a read-write scope will do as well.
29497    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectPatchCall<'a, C>
29498    where
29499        St: AsRef<str>,
29500    {
29501        self._scopes.insert(String::from(scope.as_ref()));
29502        self
29503    }
29504    /// Identifies the authorization scope(s) for the method you are building.
29505    ///
29506    /// See [`Self::add_scope()`] for details.
29507    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectPatchCall<'a, C>
29508    where
29509        I: IntoIterator<Item = St>,
29510        St: AsRef<str>,
29511    {
29512        self._scopes
29513            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29514        self
29515    }
29516
29517    /// Removes all scopes, and no default scope will be used either.
29518    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29519    /// for details).
29520    pub fn clear_scopes(mut self) -> LoyaltyobjectPatchCall<'a, C> {
29521        self._scopes.clear();
29522        self
29523    }
29524}
29525
29526/// Updates the loyalty object referenced by the given object ID.
29527///
29528/// A builder for the *update* method supported by a *loyaltyobject* resource.
29529/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
29530///
29531/// # Example
29532///
29533/// Instantiate a resource method builder
29534///
29535/// ```test_harness,no_run
29536/// # extern crate hyper;
29537/// # extern crate hyper_rustls;
29538/// # extern crate google_walletobjects1 as walletobjects1;
29539/// use walletobjects1::api::LoyaltyObject;
29540/// # async fn dox() {
29541/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29542///
29543/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29544/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29545/// #     .with_native_roots()
29546/// #     .unwrap()
29547/// #     .https_only()
29548/// #     .enable_http2()
29549/// #     .build();
29550///
29551/// # let executor = hyper_util::rt::TokioExecutor::new();
29552/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29553/// #     secret,
29554/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29555/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
29556/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
29557/// #     ),
29558/// # ).build().await.unwrap();
29559///
29560/// # let client = hyper_util::client::legacy::Client::builder(
29561/// #     hyper_util::rt::TokioExecutor::new()
29562/// # )
29563/// # .build(
29564/// #     hyper_rustls::HttpsConnectorBuilder::new()
29565/// #         .with_native_roots()
29566/// #         .unwrap()
29567/// #         .https_or_http()
29568/// #         .enable_http2()
29569/// #         .build()
29570/// # );
29571/// # let mut hub = Walletobjects::new(client, auth);
29572/// // As the method needs a request, you would usually fill it with the desired information
29573/// // into the respective structure. Some of the parts shown here might not be applicable !
29574/// // Values shown here are possibly random and not representative !
29575/// let mut req = LoyaltyObject::default();
29576///
29577/// // You can configure optional parameters by calling the respective setters at will, and
29578/// // execute the final call using `doit()`.
29579/// // Values shown here are possibly random and not representative !
29580/// let result = hub.loyaltyobject().update(req, "resourceId")
29581///              .doit().await;
29582/// # }
29583/// ```
29584pub struct LoyaltyobjectUpdateCall<'a, C>
29585where
29586    C: 'a,
29587{
29588    hub: &'a Walletobjects<C>,
29589    _request: LoyaltyObject,
29590    _resource_id: String,
29591    _delegate: Option<&'a mut dyn common::Delegate>,
29592    _additional_params: HashMap<String, String>,
29593    _scopes: BTreeSet<String>,
29594}
29595
29596impl<'a, C> common::CallBuilder for LoyaltyobjectUpdateCall<'a, C> {}
29597
29598impl<'a, C> LoyaltyobjectUpdateCall<'a, C>
29599where
29600    C: common::Connector,
29601{
29602    /// Perform the operation you have build so far.
29603    pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
29604        use std::borrow::Cow;
29605        use std::io::{Read, Seek};
29606
29607        use common::{url::Params, ToParts};
29608        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29609
29610        let mut dd = common::DefaultDelegate;
29611        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29612        dlg.begin(common::MethodInfo {
29613            id: "walletobjects.loyaltyobject.update",
29614            http_method: hyper::Method::PUT,
29615        });
29616
29617        for &field in ["alt", "resourceId"].iter() {
29618            if self._additional_params.contains_key(field) {
29619                dlg.finished(false);
29620                return Err(common::Error::FieldClash(field));
29621            }
29622        }
29623
29624        let mut params = Params::with_capacity(4 + self._additional_params.len());
29625        params.push("resourceId", self._resource_id);
29626
29627        params.extend(self._additional_params.iter());
29628
29629        params.push("alt", "json");
29630        let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject/{resourceId}";
29631        if self._scopes.is_empty() {
29632            self._scopes
29633                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
29634        }
29635
29636        #[allow(clippy::single_element_loop)]
29637        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
29638            url = params.uri_replacement(url, param_name, find_this, false);
29639        }
29640        {
29641            let to_remove = ["resourceId"];
29642            params.remove_params(&to_remove);
29643        }
29644
29645        let url = params.parse_with_url(&url);
29646
29647        let mut json_mime_type = mime::APPLICATION_JSON;
29648        let mut request_value_reader = {
29649            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29650            common::remove_json_null_values(&mut value);
29651            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29652            serde_json::to_writer(&mut dst, &value).unwrap();
29653            dst
29654        };
29655        let request_size = request_value_reader
29656            .seek(std::io::SeekFrom::End(0))
29657            .unwrap();
29658        request_value_reader
29659            .seek(std::io::SeekFrom::Start(0))
29660            .unwrap();
29661
29662        loop {
29663            let token = match self
29664                .hub
29665                .auth
29666                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29667                .await
29668            {
29669                Ok(token) => token,
29670                Err(e) => match dlg.token(e) {
29671                    Ok(token) => token,
29672                    Err(e) => {
29673                        dlg.finished(false);
29674                        return Err(common::Error::MissingToken(e));
29675                    }
29676                },
29677            };
29678            request_value_reader
29679                .seek(std::io::SeekFrom::Start(0))
29680                .unwrap();
29681            let mut req_result = {
29682                let client = &self.hub.client;
29683                dlg.pre_request();
29684                let mut req_builder = hyper::Request::builder()
29685                    .method(hyper::Method::PUT)
29686                    .uri(url.as_str())
29687                    .header(USER_AGENT, self.hub._user_agent.clone());
29688
29689                if let Some(token) = token.as_ref() {
29690                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29691                }
29692
29693                let request = req_builder
29694                    .header(CONTENT_TYPE, json_mime_type.to_string())
29695                    .header(CONTENT_LENGTH, request_size as u64)
29696                    .body(common::to_body(
29697                        request_value_reader.get_ref().clone().into(),
29698                    ));
29699
29700                client.request(request.unwrap()).await
29701            };
29702
29703            match req_result {
29704                Err(err) => {
29705                    if let common::Retry::After(d) = dlg.http_error(&err) {
29706                        sleep(d).await;
29707                        continue;
29708                    }
29709                    dlg.finished(false);
29710                    return Err(common::Error::HttpError(err));
29711                }
29712                Ok(res) => {
29713                    let (mut parts, body) = res.into_parts();
29714                    let mut body = common::Body::new(body);
29715                    if !parts.status.is_success() {
29716                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29717                        let error = serde_json::from_str(&common::to_string(&bytes));
29718                        let response = common::to_response(parts, bytes.into());
29719
29720                        if let common::Retry::After(d) =
29721                            dlg.http_failure(&response, error.as_ref().ok())
29722                        {
29723                            sleep(d).await;
29724                            continue;
29725                        }
29726
29727                        dlg.finished(false);
29728
29729                        return Err(match error {
29730                            Ok(value) => common::Error::BadRequest(value),
29731                            _ => common::Error::Failure(response),
29732                        });
29733                    }
29734                    let response = {
29735                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29736                        let encoded = common::to_string(&bytes);
29737                        match serde_json::from_str(&encoded) {
29738                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29739                            Err(error) => {
29740                                dlg.response_json_decode_error(&encoded, &error);
29741                                return Err(common::Error::JsonDecodeError(
29742                                    encoded.to_string(),
29743                                    error,
29744                                ));
29745                            }
29746                        }
29747                    };
29748
29749                    dlg.finished(true);
29750                    return Ok(response);
29751                }
29752            }
29753        }
29754    }
29755
29756    ///
29757    /// Sets the *request* property to the given value.
29758    ///
29759    /// Even though the property as already been set when instantiating this call,
29760    /// we provide this method for API completeness.
29761    pub fn request(mut self, new_value: LoyaltyObject) -> LoyaltyobjectUpdateCall<'a, C> {
29762        self._request = new_value;
29763        self
29764    }
29765    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
29766    ///
29767    /// Sets the *resource id* path property to the given value.
29768    ///
29769    /// Even though the property as already been set when instantiating this call,
29770    /// we provide this method for API completeness.
29771    pub fn resource_id(mut self, new_value: &str) -> LoyaltyobjectUpdateCall<'a, C> {
29772        self._resource_id = new_value.to_string();
29773        self
29774    }
29775    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29776    /// while executing the actual API request.
29777    ///
29778    /// ````text
29779    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29780    /// ````
29781    ///
29782    /// Sets the *delegate* property to the given value.
29783    pub fn delegate(
29784        mut self,
29785        new_value: &'a mut dyn common::Delegate,
29786    ) -> LoyaltyobjectUpdateCall<'a, C> {
29787        self._delegate = Some(new_value);
29788        self
29789    }
29790
29791    /// Set any additional parameter of the query string used in the request.
29792    /// It should be used to set parameters which are not yet available through their own
29793    /// setters.
29794    ///
29795    /// Please note that this method must not be used to set any of the known parameters
29796    /// which have their own setter method. If done anyway, the request will fail.
29797    ///
29798    /// # Additional Parameters
29799    ///
29800    /// * *$.xgafv* (query-string) - V1 error format.
29801    /// * *access_token* (query-string) - OAuth access token.
29802    /// * *alt* (query-string) - Data format for response.
29803    /// * *callback* (query-string) - JSONP
29804    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29805    /// * *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.
29806    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29807    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29808    /// * *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.
29809    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29810    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29811    pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectUpdateCall<'a, C>
29812    where
29813        T: AsRef<str>,
29814    {
29815        self._additional_params
29816            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29817        self
29818    }
29819
29820    /// Identifies the authorization scope for the method you are building.
29821    ///
29822    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29823    /// [`Scope::WalletObjectIssuer`].
29824    ///
29825    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29826    /// tokens for more than one scope.
29827    ///
29828    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29829    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29830    /// sufficient, a read-write scope will do as well.
29831    pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectUpdateCall<'a, C>
29832    where
29833        St: AsRef<str>,
29834    {
29835        self._scopes.insert(String::from(scope.as_ref()));
29836        self
29837    }
29838    /// Identifies the authorization scope(s) for the method you are building.
29839    ///
29840    /// See [`Self::add_scope()`] for details.
29841    pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectUpdateCall<'a, C>
29842    where
29843        I: IntoIterator<Item = St>,
29844        St: AsRef<str>,
29845    {
29846        self._scopes
29847            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29848        self
29849    }
29850
29851    /// Removes all scopes, and no default scope will be used either.
29852    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29853    /// for details).
29854    pub fn clear_scopes(mut self) -> LoyaltyobjectUpdateCall<'a, C> {
29855        self._scopes.clear();
29856        self
29857    }
29858}
29859
29860/// Downloads rotating barcode values for the transit object referenced by the given object ID.
29861///
29862/// This method supports **media download**. To enable it, adjust the builder like this:
29863/// `.param("alt", "media")`.
29864/// Please note that due to missing multi-part support on the server side, you will only receive the media,
29865/// but not the `Media` structure that you would usually get. The latter will be a default value.
29866///
29867/// A builder for the *download* method supported by a *media* resource.
29868/// It is not used directly, but through a [`MediaMethods`] instance.
29869///
29870/// # Example
29871///
29872/// Instantiate a resource method builder
29873///
29874/// ```test_harness,no_run
29875/// # extern crate hyper;
29876/// # extern crate hyper_rustls;
29877/// # extern crate google_walletobjects1 as walletobjects1;
29878/// # async fn dox() {
29879/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29880///
29881/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29882/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29883/// #     .with_native_roots()
29884/// #     .unwrap()
29885/// #     .https_only()
29886/// #     .enable_http2()
29887/// #     .build();
29888///
29889/// # let executor = hyper_util::rt::TokioExecutor::new();
29890/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29891/// #     secret,
29892/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29893/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
29894/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
29895/// #     ),
29896/// # ).build().await.unwrap();
29897///
29898/// # let client = hyper_util::client::legacy::Client::builder(
29899/// #     hyper_util::rt::TokioExecutor::new()
29900/// # )
29901/// # .build(
29902/// #     hyper_rustls::HttpsConnectorBuilder::new()
29903/// #         .with_native_roots()
29904/// #         .unwrap()
29905/// #         .https_or_http()
29906/// #         .enable_http2()
29907/// #         .build()
29908/// # );
29909/// # let mut hub = Walletobjects::new(client, auth);
29910/// // You can configure optional parameters by calling the respective setters at will, and
29911/// // execute the final call using `doit()`.
29912/// // Values shown here are possibly random and not representative !
29913/// let result = hub.media().download("resourceId")
29914///              .doit().await;
29915/// # }
29916/// ```
29917pub struct MediaDownloadCall<'a, C>
29918where
29919    C: 'a,
29920{
29921    hub: &'a Walletobjects<C>,
29922    _resource_id: String,
29923    _delegate: Option<&'a mut dyn common::Delegate>,
29924    _additional_params: HashMap<String, String>,
29925    _scopes: BTreeSet<String>,
29926}
29927
29928impl<'a, C> common::CallBuilder for MediaDownloadCall<'a, C> {}
29929
29930impl<'a, C> MediaDownloadCall<'a, C>
29931where
29932    C: common::Connector,
29933{
29934    /// Perform the operation you have build so far.
29935    pub async fn doit(mut self) -> common::Result<(common::Response, Media)> {
29936        use std::borrow::Cow;
29937        use std::io::{Read, Seek};
29938
29939        use common::{url::Params, ToParts};
29940        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29941
29942        let mut dd = common::DefaultDelegate;
29943        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29944        dlg.begin(common::MethodInfo {
29945            id: "walletobjects.media.download",
29946            http_method: hyper::Method::GET,
29947        });
29948
29949        for &field in ["resourceId"].iter() {
29950            if self._additional_params.contains_key(field) {
29951                dlg.finished(false);
29952                return Err(common::Error::FieldClash(field));
29953            }
29954        }
29955
29956        let mut params = Params::with_capacity(2 + self._additional_params.len());
29957        params.push("resourceId", self._resource_id);
29958
29959        params.extend(self._additional_params.iter());
29960
29961        let (alt_field_missing, enable_resource_parsing) = {
29962            if let Some(value) = params.get("alt") {
29963                (false, value == "json")
29964            } else {
29965                (true, true)
29966            }
29967        };
29968        if alt_field_missing {
29969            params.push("alt", "json");
29970        }
29971        let mut url = self.hub._base_url.clone()
29972            + "walletobjects/v1/transitObject/{resourceId}/downloadRotatingBarcodeValues";
29973        if self._scopes.is_empty() {
29974            self._scopes
29975                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
29976        }
29977
29978        #[allow(clippy::single_element_loop)]
29979        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
29980            url = params.uri_replacement(url, param_name, find_this, false);
29981        }
29982        {
29983            let to_remove = ["resourceId"];
29984            params.remove_params(&to_remove);
29985        }
29986
29987        let url = params.parse_with_url(&url);
29988
29989        loop {
29990            let token = match self
29991                .hub
29992                .auth
29993                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29994                .await
29995            {
29996                Ok(token) => token,
29997                Err(e) => match dlg.token(e) {
29998                    Ok(token) => token,
29999                    Err(e) => {
30000                        dlg.finished(false);
30001                        return Err(common::Error::MissingToken(e));
30002                    }
30003                },
30004            };
30005            let mut req_result = {
30006                let client = &self.hub.client;
30007                dlg.pre_request();
30008                let mut req_builder = hyper::Request::builder()
30009                    .method(hyper::Method::GET)
30010                    .uri(url.as_str())
30011                    .header(USER_AGENT, self.hub._user_agent.clone());
30012
30013                if let Some(token) = token.as_ref() {
30014                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30015                }
30016
30017                let request = req_builder
30018                    .header(CONTENT_LENGTH, 0_u64)
30019                    .body(common::to_body::<String>(None));
30020
30021                client.request(request.unwrap()).await
30022            };
30023
30024            match req_result {
30025                Err(err) => {
30026                    if let common::Retry::After(d) = dlg.http_error(&err) {
30027                        sleep(d).await;
30028                        continue;
30029                    }
30030                    dlg.finished(false);
30031                    return Err(common::Error::HttpError(err));
30032                }
30033                Ok(res) => {
30034                    let (mut parts, body) = res.into_parts();
30035                    let mut body = common::Body::new(body);
30036                    if !parts.status.is_success() {
30037                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30038                        let error = serde_json::from_str(&common::to_string(&bytes));
30039                        let response = common::to_response(parts, bytes.into());
30040
30041                        if let common::Retry::After(d) =
30042                            dlg.http_failure(&response, error.as_ref().ok())
30043                        {
30044                            sleep(d).await;
30045                            continue;
30046                        }
30047
30048                        dlg.finished(false);
30049
30050                        return Err(match error {
30051                            Ok(value) => common::Error::BadRequest(value),
30052                            _ => common::Error::Failure(response),
30053                        });
30054                    }
30055                    let response = if enable_resource_parsing {
30056                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30057                        let encoded = common::to_string(&bytes);
30058                        match serde_json::from_str(&encoded) {
30059                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30060                            Err(error) => {
30061                                dlg.response_json_decode_error(&encoded, &error);
30062                                return Err(common::Error::JsonDecodeError(
30063                                    encoded.to_string(),
30064                                    error,
30065                                ));
30066                            }
30067                        }
30068                    } else {
30069                        (
30070                            common::Response::from_parts(parts, body),
30071                            Default::default(),
30072                        )
30073                    };
30074
30075                    dlg.finished(true);
30076                    return Ok(response);
30077                }
30078            }
30079        }
30080    }
30081
30082    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
30083    ///
30084    /// Sets the *resource id* path property to the given value.
30085    ///
30086    /// Even though the property as already been set when instantiating this call,
30087    /// we provide this method for API completeness.
30088    pub fn resource_id(mut self, new_value: &str) -> MediaDownloadCall<'a, C> {
30089        self._resource_id = new_value.to_string();
30090        self
30091    }
30092    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30093    /// while executing the actual API request.
30094    ///
30095    /// ````text
30096    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30097    /// ````
30098    ///
30099    /// Sets the *delegate* property to the given value.
30100    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MediaDownloadCall<'a, C> {
30101        self._delegate = Some(new_value);
30102        self
30103    }
30104
30105    /// Set any additional parameter of the query string used in the request.
30106    /// It should be used to set parameters which are not yet available through their own
30107    /// setters.
30108    ///
30109    /// Please note that this method must not be used to set any of the known parameters
30110    /// which have their own setter method. If done anyway, the request will fail.
30111    ///
30112    /// # Additional Parameters
30113    ///
30114    /// * *$.xgafv* (query-string) - V1 error format.
30115    /// * *access_token* (query-string) - OAuth access token.
30116    /// * *alt* (query-string) - Data format for response.
30117    /// * *callback* (query-string) - JSONP
30118    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30119    /// * *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.
30120    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30121    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30122    /// * *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.
30123    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30124    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30125    pub fn param<T>(mut self, name: T, value: T) -> MediaDownloadCall<'a, C>
30126    where
30127        T: AsRef<str>,
30128    {
30129        self._additional_params
30130            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30131        self
30132    }
30133
30134    /// Identifies the authorization scope for the method you are building.
30135    ///
30136    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30137    /// [`Scope::WalletObjectIssuer`].
30138    ///
30139    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30140    /// tokens for more than one scope.
30141    ///
30142    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30143    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30144    /// sufficient, a read-write scope will do as well.
30145    pub fn add_scope<St>(mut self, scope: St) -> MediaDownloadCall<'a, C>
30146    where
30147        St: AsRef<str>,
30148    {
30149        self._scopes.insert(String::from(scope.as_ref()));
30150        self
30151    }
30152    /// Identifies the authorization scope(s) for the method you are building.
30153    ///
30154    /// See [`Self::add_scope()`] for details.
30155    pub fn add_scopes<I, St>(mut self, scopes: I) -> MediaDownloadCall<'a, C>
30156    where
30157        I: IntoIterator<Item = St>,
30158        St: AsRef<str>,
30159    {
30160        self._scopes
30161            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30162        self
30163    }
30164
30165    /// Removes all scopes, and no default scope will be used either.
30166    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30167    /// for details).
30168    pub fn clear_scopes(mut self) -> MediaDownloadCall<'a, C> {
30169        self._scopes.clear();
30170        self
30171    }
30172}
30173
30174/// Uploads rotating barcode values for the transit object referenced by the given object ID. Note the max upload size is specified in google3/production/config/cdd/apps-upload/customers/payments-consumer-passes/config.gcl and enforced by Scotty.
30175///
30176/// A builder for the *upload* method supported by a *media* resource.
30177/// It is not used directly, but through a [`MediaMethods`] instance.
30178///
30179/// # Example
30180///
30181/// Instantiate a resource method builder
30182///
30183/// ```test_harness,no_run
30184/// # extern crate hyper;
30185/// # extern crate hyper_rustls;
30186/// # extern crate google_walletobjects1 as walletobjects1;
30187/// use walletobjects1::api::TransitObjectUploadRotatingBarcodeValuesRequest;
30188/// use std::fs;
30189/// # async fn dox() {
30190/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30191///
30192/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30193/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30194/// #     .with_native_roots()
30195/// #     .unwrap()
30196/// #     .https_only()
30197/// #     .enable_http2()
30198/// #     .build();
30199///
30200/// # let executor = hyper_util::rt::TokioExecutor::new();
30201/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30202/// #     secret,
30203/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30204/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
30205/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
30206/// #     ),
30207/// # ).build().await.unwrap();
30208///
30209/// # let client = hyper_util::client::legacy::Client::builder(
30210/// #     hyper_util::rt::TokioExecutor::new()
30211/// # )
30212/// # .build(
30213/// #     hyper_rustls::HttpsConnectorBuilder::new()
30214/// #         .with_native_roots()
30215/// #         .unwrap()
30216/// #         .https_or_http()
30217/// #         .enable_http2()
30218/// #         .build()
30219/// # );
30220/// # let mut hub = Walletobjects::new(client, auth);
30221/// // As the method needs a request, you would usually fill it with the desired information
30222/// // into the respective structure. Some of the parts shown here might not be applicable !
30223/// // Values shown here are possibly random and not representative !
30224/// let mut req = TransitObjectUploadRotatingBarcodeValuesRequest::default();
30225///
30226/// // You can configure optional parameters by calling the respective setters at will, and
30227/// // execute the final call using `upload(...)`.
30228/// // Values shown here are possibly random and not representative !
30229/// let result = hub.media().upload(req, "resourceId")
30230///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
30231/// # }
30232/// ```
30233pub struct MediaUploadCall<'a, C>
30234where
30235    C: 'a,
30236{
30237    hub: &'a Walletobjects<C>,
30238    _request: TransitObjectUploadRotatingBarcodeValuesRequest,
30239    _resource_id: String,
30240    _delegate: Option<&'a mut dyn common::Delegate>,
30241    _additional_params: HashMap<String, String>,
30242    _scopes: BTreeSet<String>,
30243}
30244
30245impl<'a, C> common::CallBuilder for MediaUploadCall<'a, C> {}
30246
30247impl<'a, C> MediaUploadCall<'a, C>
30248where
30249    C: common::Connector,
30250{
30251    /// Perform the operation you have build so far.
30252    async fn doit<RS>(
30253        mut self,
30254        mut reader: RS,
30255        reader_mime_type: mime::Mime,
30256        protocol: common::UploadProtocol,
30257    ) -> common::Result<(
30258        common::Response,
30259        TransitObjectUploadRotatingBarcodeValuesResponse,
30260    )>
30261    where
30262        RS: common::ReadSeek,
30263    {
30264        use std::borrow::Cow;
30265        use std::io::{Read, Seek};
30266
30267        use common::{url::Params, ToParts};
30268        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30269
30270        let mut dd = common::DefaultDelegate;
30271        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30272        dlg.begin(common::MethodInfo {
30273            id: "walletobjects.media.upload",
30274            http_method: hyper::Method::POST,
30275        });
30276
30277        for &field in ["alt", "resourceId"].iter() {
30278            if self._additional_params.contains_key(field) {
30279                dlg.finished(false);
30280                return Err(common::Error::FieldClash(field));
30281            }
30282        }
30283
30284        let mut params = Params::with_capacity(4 + self._additional_params.len());
30285        params.push("resourceId", self._resource_id);
30286
30287        params.extend(self._additional_params.iter());
30288
30289        params.push("alt", "json");
30290        let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
30291            (self.hub._root_url.clone() + "upload/walletobjects/v1/transitObject/{resourceId}/uploadRotatingBarcodeValues", "multipart")
30292        } else {
30293            unreachable!()
30294        };
30295        params.push("uploadType", upload_type);
30296        if self._scopes.is_empty() {
30297            self._scopes
30298                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
30299        }
30300
30301        #[allow(clippy::single_element_loop)]
30302        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
30303            url = params.uri_replacement(url, param_name, find_this, false);
30304        }
30305        {
30306            let to_remove = ["resourceId"];
30307            params.remove_params(&to_remove);
30308        }
30309
30310        let url = params.parse_with_url(&url);
30311
30312        let mut json_mime_type = mime::APPLICATION_JSON;
30313        let mut request_value_reader = {
30314            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30315            common::remove_json_null_values(&mut value);
30316            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30317            serde_json::to_writer(&mut dst, &value).unwrap();
30318            dst
30319        };
30320        let request_size = request_value_reader
30321            .seek(std::io::SeekFrom::End(0))
30322            .unwrap();
30323        request_value_reader
30324            .seek(std::io::SeekFrom::Start(0))
30325            .unwrap();
30326
30327        loop {
30328            let token = match self
30329                .hub
30330                .auth
30331                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30332                .await
30333            {
30334                Ok(token) => token,
30335                Err(e) => match dlg.token(e) {
30336                    Ok(token) => token,
30337                    Err(e) => {
30338                        dlg.finished(false);
30339                        return Err(common::Error::MissingToken(e));
30340                    }
30341                },
30342            };
30343            request_value_reader
30344                .seek(std::io::SeekFrom::Start(0))
30345                .unwrap();
30346            let mut req_result = {
30347                let mut mp_reader: common::MultiPartReader = Default::default();
30348                let (mut body_reader, content_type) = match protocol {
30349                    common::UploadProtocol::Simple => {
30350                        mp_reader.reserve_exact(2);
30351                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
30352                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
30353
30354                        mp_reader
30355                            .add_part(
30356                                &mut request_value_reader,
30357                                request_size,
30358                                json_mime_type.clone(),
30359                            )
30360                            .add_part(&mut reader, size, reader_mime_type.clone());
30361                        (
30362                            &mut mp_reader as &mut (dyn std::io::Read + Send),
30363                            common::MultiPartReader::mime_type(),
30364                        )
30365                    }
30366                    _ => (
30367                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
30368                        json_mime_type.clone(),
30369                    ),
30370                };
30371                let client = &self.hub.client;
30372                dlg.pre_request();
30373                let mut req_builder = hyper::Request::builder()
30374                    .method(hyper::Method::POST)
30375                    .uri(url.as_str())
30376                    .header(USER_AGENT, self.hub._user_agent.clone());
30377
30378                if let Some(token) = token.as_ref() {
30379                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30380                }
30381
30382                let mut body_reader_bytes = vec![];
30383                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
30384                let request = req_builder
30385                    .header(CONTENT_TYPE, content_type.to_string())
30386                    .body(common::to_body(body_reader_bytes.into()));
30387
30388                client.request(request.unwrap()).await
30389            };
30390
30391            match req_result {
30392                Err(err) => {
30393                    if let common::Retry::After(d) = dlg.http_error(&err) {
30394                        sleep(d).await;
30395                        continue;
30396                    }
30397                    dlg.finished(false);
30398                    return Err(common::Error::HttpError(err));
30399                }
30400                Ok(res) => {
30401                    let (mut parts, body) = res.into_parts();
30402                    let mut body = common::Body::new(body);
30403                    if !parts.status.is_success() {
30404                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30405                        let error = serde_json::from_str(&common::to_string(&bytes));
30406                        let response = common::to_response(parts, bytes.into());
30407
30408                        if let common::Retry::After(d) =
30409                            dlg.http_failure(&response, error.as_ref().ok())
30410                        {
30411                            sleep(d).await;
30412                            continue;
30413                        }
30414
30415                        dlg.finished(false);
30416
30417                        return Err(match error {
30418                            Ok(value) => common::Error::BadRequest(value),
30419                            _ => common::Error::Failure(response),
30420                        });
30421                    }
30422                    let response = {
30423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30424                        let encoded = common::to_string(&bytes);
30425                        match serde_json::from_str(&encoded) {
30426                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30427                            Err(error) => {
30428                                dlg.response_json_decode_error(&encoded, &error);
30429                                return Err(common::Error::JsonDecodeError(
30430                                    encoded.to_string(),
30431                                    error,
30432                                ));
30433                            }
30434                        }
30435                    };
30436
30437                    dlg.finished(true);
30438                    return Ok(response);
30439                }
30440            }
30441        }
30442    }
30443
30444    /// Upload media all at once.
30445    /// If the upload fails for whichever reason, all progress is lost.
30446    ///
30447    /// * *multipart*: yes
30448    /// * *max size*: 0kb
30449    /// * *valid mime types*: '*/*'
30450    pub async fn upload<RS>(
30451        self,
30452        stream: RS,
30453        mime_type: mime::Mime,
30454    ) -> common::Result<(
30455        common::Response,
30456        TransitObjectUploadRotatingBarcodeValuesResponse,
30457    )>
30458    where
30459        RS: common::ReadSeek,
30460    {
30461        self.doit(stream, mime_type, common::UploadProtocol::Simple)
30462            .await
30463    }
30464
30465    ///
30466    /// Sets the *request* property to the given value.
30467    ///
30468    /// Even though the property as already been set when instantiating this call,
30469    /// we provide this method for API completeness.
30470    pub fn request(
30471        mut self,
30472        new_value: TransitObjectUploadRotatingBarcodeValuesRequest,
30473    ) -> MediaUploadCall<'a, C> {
30474        self._request = new_value;
30475        self
30476    }
30477    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
30478    ///
30479    /// Sets the *resource id* path property to the given value.
30480    ///
30481    /// Even though the property as already been set when instantiating this call,
30482    /// we provide this method for API completeness.
30483    pub fn resource_id(mut self, new_value: &str) -> MediaUploadCall<'a, C> {
30484        self._resource_id = new_value.to_string();
30485        self
30486    }
30487    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30488    /// while executing the actual API request.
30489    ///
30490    /// ````text
30491    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30492    /// ````
30493    ///
30494    /// Sets the *delegate* property to the given value.
30495    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MediaUploadCall<'a, C> {
30496        self._delegate = Some(new_value);
30497        self
30498    }
30499
30500    /// Set any additional parameter of the query string used in the request.
30501    /// It should be used to set parameters which are not yet available through their own
30502    /// setters.
30503    ///
30504    /// Please note that this method must not be used to set any of the known parameters
30505    /// which have their own setter method. If done anyway, the request will fail.
30506    ///
30507    /// # Additional Parameters
30508    ///
30509    /// * *$.xgafv* (query-string) - V1 error format.
30510    /// * *access_token* (query-string) - OAuth access token.
30511    /// * *alt* (query-string) - Data format for response.
30512    /// * *callback* (query-string) - JSONP
30513    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30514    /// * *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.
30515    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30516    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30517    /// * *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.
30518    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30519    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30520    pub fn param<T>(mut self, name: T, value: T) -> MediaUploadCall<'a, C>
30521    where
30522        T: AsRef<str>,
30523    {
30524        self._additional_params
30525            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30526        self
30527    }
30528
30529    /// Identifies the authorization scope for the method you are building.
30530    ///
30531    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30532    /// [`Scope::WalletObjectIssuer`].
30533    ///
30534    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30535    /// tokens for more than one scope.
30536    ///
30537    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30538    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30539    /// sufficient, a read-write scope will do as well.
30540    pub fn add_scope<St>(mut self, scope: St) -> MediaUploadCall<'a, C>
30541    where
30542        St: AsRef<str>,
30543    {
30544        self._scopes.insert(String::from(scope.as_ref()));
30545        self
30546    }
30547    /// Identifies the authorization scope(s) for the method you are building.
30548    ///
30549    /// See [`Self::add_scope()`] for details.
30550    pub fn add_scopes<I, St>(mut self, scopes: I) -> MediaUploadCall<'a, C>
30551    where
30552        I: IntoIterator<Item = St>,
30553        St: AsRef<str>,
30554    {
30555        self._scopes
30556            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30557        self
30558    }
30559
30560    /// Removes all scopes, and no default scope will be used either.
30561    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30562    /// for details).
30563    pub fn clear_scopes(mut self) -> MediaUploadCall<'a, C> {
30564        self._scopes.clear();
30565        self
30566    }
30567}
30568
30569/// Adds a message to the offer class referenced by the given class ID.
30570///
30571/// A builder for the *addmessage* method supported by a *offerclas* resource.
30572/// It is not used directly, but through a [`OfferclasMethods`] instance.
30573///
30574/// # Example
30575///
30576/// Instantiate a resource method builder
30577///
30578/// ```test_harness,no_run
30579/// # extern crate hyper;
30580/// # extern crate hyper_rustls;
30581/// # extern crate google_walletobjects1 as walletobjects1;
30582/// use walletobjects1::api::AddMessageRequest;
30583/// # async fn dox() {
30584/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30585///
30586/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30587/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30588/// #     .with_native_roots()
30589/// #     .unwrap()
30590/// #     .https_only()
30591/// #     .enable_http2()
30592/// #     .build();
30593///
30594/// # let executor = hyper_util::rt::TokioExecutor::new();
30595/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30596/// #     secret,
30597/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30598/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
30599/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
30600/// #     ),
30601/// # ).build().await.unwrap();
30602///
30603/// # let client = hyper_util::client::legacy::Client::builder(
30604/// #     hyper_util::rt::TokioExecutor::new()
30605/// # )
30606/// # .build(
30607/// #     hyper_rustls::HttpsConnectorBuilder::new()
30608/// #         .with_native_roots()
30609/// #         .unwrap()
30610/// #         .https_or_http()
30611/// #         .enable_http2()
30612/// #         .build()
30613/// # );
30614/// # let mut hub = Walletobjects::new(client, auth);
30615/// // As the method needs a request, you would usually fill it with the desired information
30616/// // into the respective structure. Some of the parts shown here might not be applicable !
30617/// // Values shown here are possibly random and not representative !
30618/// let mut req = AddMessageRequest::default();
30619///
30620/// // You can configure optional parameters by calling the respective setters at will, and
30621/// // execute the final call using `doit()`.
30622/// // Values shown here are possibly random and not representative !
30623/// let result = hub.offerclass().addmessage(req, "resourceId")
30624///              .doit().await;
30625/// # }
30626/// ```
30627pub struct OfferclasAddmessageCall<'a, C>
30628where
30629    C: 'a,
30630{
30631    hub: &'a Walletobjects<C>,
30632    _request: AddMessageRequest,
30633    _resource_id: String,
30634    _delegate: Option<&'a mut dyn common::Delegate>,
30635    _additional_params: HashMap<String, String>,
30636    _scopes: BTreeSet<String>,
30637}
30638
30639impl<'a, C> common::CallBuilder for OfferclasAddmessageCall<'a, C> {}
30640
30641impl<'a, C> OfferclasAddmessageCall<'a, C>
30642where
30643    C: common::Connector,
30644{
30645    /// Perform the operation you have build so far.
30646    pub async fn doit(
30647        mut self,
30648    ) -> common::Result<(common::Response, OfferClassAddMessageResponse)> {
30649        use std::borrow::Cow;
30650        use std::io::{Read, Seek};
30651
30652        use common::{url::Params, ToParts};
30653        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30654
30655        let mut dd = common::DefaultDelegate;
30656        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30657        dlg.begin(common::MethodInfo {
30658            id: "walletobjects.offerclass.addmessage",
30659            http_method: hyper::Method::POST,
30660        });
30661
30662        for &field in ["alt", "resourceId"].iter() {
30663            if self._additional_params.contains_key(field) {
30664                dlg.finished(false);
30665                return Err(common::Error::FieldClash(field));
30666            }
30667        }
30668
30669        let mut params = Params::with_capacity(4 + self._additional_params.len());
30670        params.push("resourceId", self._resource_id);
30671
30672        params.extend(self._additional_params.iter());
30673
30674        params.push("alt", "json");
30675        let mut url =
30676            self.hub._base_url.clone() + "walletobjects/v1/offerClass/{resourceId}/addMessage";
30677        if self._scopes.is_empty() {
30678            self._scopes
30679                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
30680        }
30681
30682        #[allow(clippy::single_element_loop)]
30683        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
30684            url = params.uri_replacement(url, param_name, find_this, false);
30685        }
30686        {
30687            let to_remove = ["resourceId"];
30688            params.remove_params(&to_remove);
30689        }
30690
30691        let url = params.parse_with_url(&url);
30692
30693        let mut json_mime_type = mime::APPLICATION_JSON;
30694        let mut request_value_reader = {
30695            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30696            common::remove_json_null_values(&mut value);
30697            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30698            serde_json::to_writer(&mut dst, &value).unwrap();
30699            dst
30700        };
30701        let request_size = request_value_reader
30702            .seek(std::io::SeekFrom::End(0))
30703            .unwrap();
30704        request_value_reader
30705            .seek(std::io::SeekFrom::Start(0))
30706            .unwrap();
30707
30708        loop {
30709            let token = match self
30710                .hub
30711                .auth
30712                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30713                .await
30714            {
30715                Ok(token) => token,
30716                Err(e) => match dlg.token(e) {
30717                    Ok(token) => token,
30718                    Err(e) => {
30719                        dlg.finished(false);
30720                        return Err(common::Error::MissingToken(e));
30721                    }
30722                },
30723            };
30724            request_value_reader
30725                .seek(std::io::SeekFrom::Start(0))
30726                .unwrap();
30727            let mut req_result = {
30728                let client = &self.hub.client;
30729                dlg.pre_request();
30730                let mut req_builder = hyper::Request::builder()
30731                    .method(hyper::Method::POST)
30732                    .uri(url.as_str())
30733                    .header(USER_AGENT, self.hub._user_agent.clone());
30734
30735                if let Some(token) = token.as_ref() {
30736                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30737                }
30738
30739                let request = req_builder
30740                    .header(CONTENT_TYPE, json_mime_type.to_string())
30741                    .header(CONTENT_LENGTH, request_size as u64)
30742                    .body(common::to_body(
30743                        request_value_reader.get_ref().clone().into(),
30744                    ));
30745
30746                client.request(request.unwrap()).await
30747            };
30748
30749            match req_result {
30750                Err(err) => {
30751                    if let common::Retry::After(d) = dlg.http_error(&err) {
30752                        sleep(d).await;
30753                        continue;
30754                    }
30755                    dlg.finished(false);
30756                    return Err(common::Error::HttpError(err));
30757                }
30758                Ok(res) => {
30759                    let (mut parts, body) = res.into_parts();
30760                    let mut body = common::Body::new(body);
30761                    if !parts.status.is_success() {
30762                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30763                        let error = serde_json::from_str(&common::to_string(&bytes));
30764                        let response = common::to_response(parts, bytes.into());
30765
30766                        if let common::Retry::After(d) =
30767                            dlg.http_failure(&response, error.as_ref().ok())
30768                        {
30769                            sleep(d).await;
30770                            continue;
30771                        }
30772
30773                        dlg.finished(false);
30774
30775                        return Err(match error {
30776                            Ok(value) => common::Error::BadRequest(value),
30777                            _ => common::Error::Failure(response),
30778                        });
30779                    }
30780                    let response = {
30781                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30782                        let encoded = common::to_string(&bytes);
30783                        match serde_json::from_str(&encoded) {
30784                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30785                            Err(error) => {
30786                                dlg.response_json_decode_error(&encoded, &error);
30787                                return Err(common::Error::JsonDecodeError(
30788                                    encoded.to_string(),
30789                                    error,
30790                                ));
30791                            }
30792                        }
30793                    };
30794
30795                    dlg.finished(true);
30796                    return Ok(response);
30797                }
30798            }
30799        }
30800    }
30801
30802    ///
30803    /// Sets the *request* property to the given value.
30804    ///
30805    /// Even though the property as already been set when instantiating this call,
30806    /// we provide this method for API completeness.
30807    pub fn request(mut self, new_value: AddMessageRequest) -> OfferclasAddmessageCall<'a, C> {
30808        self._request = new_value;
30809        self
30810    }
30811    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
30812    ///
30813    /// Sets the *resource id* path property to the given value.
30814    ///
30815    /// Even though the property as already been set when instantiating this call,
30816    /// we provide this method for API completeness.
30817    pub fn resource_id(mut self, new_value: &str) -> OfferclasAddmessageCall<'a, C> {
30818        self._resource_id = new_value.to_string();
30819        self
30820    }
30821    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30822    /// while executing the actual API request.
30823    ///
30824    /// ````text
30825    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30826    /// ````
30827    ///
30828    /// Sets the *delegate* property to the given value.
30829    pub fn delegate(
30830        mut self,
30831        new_value: &'a mut dyn common::Delegate,
30832    ) -> OfferclasAddmessageCall<'a, C> {
30833        self._delegate = Some(new_value);
30834        self
30835    }
30836
30837    /// Set any additional parameter of the query string used in the request.
30838    /// It should be used to set parameters which are not yet available through their own
30839    /// setters.
30840    ///
30841    /// Please note that this method must not be used to set any of the known parameters
30842    /// which have their own setter method. If done anyway, the request will fail.
30843    ///
30844    /// # Additional Parameters
30845    ///
30846    /// * *$.xgafv* (query-string) - V1 error format.
30847    /// * *access_token* (query-string) - OAuth access token.
30848    /// * *alt* (query-string) - Data format for response.
30849    /// * *callback* (query-string) - JSONP
30850    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30851    /// * *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.
30852    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30853    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30854    /// * *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.
30855    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30856    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30857    pub fn param<T>(mut self, name: T, value: T) -> OfferclasAddmessageCall<'a, C>
30858    where
30859        T: AsRef<str>,
30860    {
30861        self._additional_params
30862            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30863        self
30864    }
30865
30866    /// Identifies the authorization scope for the method you are building.
30867    ///
30868    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30869    /// [`Scope::WalletObjectIssuer`].
30870    ///
30871    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30872    /// tokens for more than one scope.
30873    ///
30874    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30875    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30876    /// sufficient, a read-write scope will do as well.
30877    pub fn add_scope<St>(mut self, scope: St) -> OfferclasAddmessageCall<'a, C>
30878    where
30879        St: AsRef<str>,
30880    {
30881        self._scopes.insert(String::from(scope.as_ref()));
30882        self
30883    }
30884    /// Identifies the authorization scope(s) for the method you are building.
30885    ///
30886    /// See [`Self::add_scope()`] for details.
30887    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasAddmessageCall<'a, C>
30888    where
30889        I: IntoIterator<Item = St>,
30890        St: AsRef<str>,
30891    {
30892        self._scopes
30893            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30894        self
30895    }
30896
30897    /// Removes all scopes, and no default scope will be used either.
30898    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30899    /// for details).
30900    pub fn clear_scopes(mut self) -> OfferclasAddmessageCall<'a, C> {
30901        self._scopes.clear();
30902        self
30903    }
30904}
30905
30906/// Returns the offer class with the given class ID.
30907///
30908/// A builder for the *get* method supported by a *offerclas* resource.
30909/// It is not used directly, but through a [`OfferclasMethods`] instance.
30910///
30911/// # Example
30912///
30913/// Instantiate a resource method builder
30914///
30915/// ```test_harness,no_run
30916/// # extern crate hyper;
30917/// # extern crate hyper_rustls;
30918/// # extern crate google_walletobjects1 as walletobjects1;
30919/// # async fn dox() {
30920/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30921///
30922/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30923/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30924/// #     .with_native_roots()
30925/// #     .unwrap()
30926/// #     .https_only()
30927/// #     .enable_http2()
30928/// #     .build();
30929///
30930/// # let executor = hyper_util::rt::TokioExecutor::new();
30931/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30932/// #     secret,
30933/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30934/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
30935/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
30936/// #     ),
30937/// # ).build().await.unwrap();
30938///
30939/// # let client = hyper_util::client::legacy::Client::builder(
30940/// #     hyper_util::rt::TokioExecutor::new()
30941/// # )
30942/// # .build(
30943/// #     hyper_rustls::HttpsConnectorBuilder::new()
30944/// #         .with_native_roots()
30945/// #         .unwrap()
30946/// #         .https_or_http()
30947/// #         .enable_http2()
30948/// #         .build()
30949/// # );
30950/// # let mut hub = Walletobjects::new(client, auth);
30951/// // You can configure optional parameters by calling the respective setters at will, and
30952/// // execute the final call using `doit()`.
30953/// // Values shown here are possibly random and not representative !
30954/// let result = hub.offerclass().get("resourceId")
30955///              .doit().await;
30956/// # }
30957/// ```
30958pub struct OfferclasGetCall<'a, C>
30959where
30960    C: 'a,
30961{
30962    hub: &'a Walletobjects<C>,
30963    _resource_id: String,
30964    _delegate: Option<&'a mut dyn common::Delegate>,
30965    _additional_params: HashMap<String, String>,
30966    _scopes: BTreeSet<String>,
30967}
30968
30969impl<'a, C> common::CallBuilder for OfferclasGetCall<'a, C> {}
30970
30971impl<'a, C> OfferclasGetCall<'a, C>
30972where
30973    C: common::Connector,
30974{
30975    /// Perform the operation you have build so far.
30976    pub async fn doit(mut self) -> common::Result<(common::Response, OfferClass)> {
30977        use std::borrow::Cow;
30978        use std::io::{Read, Seek};
30979
30980        use common::{url::Params, ToParts};
30981        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30982
30983        let mut dd = common::DefaultDelegate;
30984        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30985        dlg.begin(common::MethodInfo {
30986            id: "walletobjects.offerclass.get",
30987            http_method: hyper::Method::GET,
30988        });
30989
30990        for &field in ["alt", "resourceId"].iter() {
30991            if self._additional_params.contains_key(field) {
30992                dlg.finished(false);
30993                return Err(common::Error::FieldClash(field));
30994            }
30995        }
30996
30997        let mut params = Params::with_capacity(3 + self._additional_params.len());
30998        params.push("resourceId", self._resource_id);
30999
31000        params.extend(self._additional_params.iter());
31001
31002        params.push("alt", "json");
31003        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass/{resourceId}";
31004        if self._scopes.is_empty() {
31005            self._scopes
31006                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
31007        }
31008
31009        #[allow(clippy::single_element_loop)]
31010        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
31011            url = params.uri_replacement(url, param_name, find_this, false);
31012        }
31013        {
31014            let to_remove = ["resourceId"];
31015            params.remove_params(&to_remove);
31016        }
31017
31018        let url = params.parse_with_url(&url);
31019
31020        loop {
31021            let token = match self
31022                .hub
31023                .auth
31024                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31025                .await
31026            {
31027                Ok(token) => token,
31028                Err(e) => match dlg.token(e) {
31029                    Ok(token) => token,
31030                    Err(e) => {
31031                        dlg.finished(false);
31032                        return Err(common::Error::MissingToken(e));
31033                    }
31034                },
31035            };
31036            let mut req_result = {
31037                let client = &self.hub.client;
31038                dlg.pre_request();
31039                let mut req_builder = hyper::Request::builder()
31040                    .method(hyper::Method::GET)
31041                    .uri(url.as_str())
31042                    .header(USER_AGENT, self.hub._user_agent.clone());
31043
31044                if let Some(token) = token.as_ref() {
31045                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31046                }
31047
31048                let request = req_builder
31049                    .header(CONTENT_LENGTH, 0_u64)
31050                    .body(common::to_body::<String>(None));
31051
31052                client.request(request.unwrap()).await
31053            };
31054
31055            match req_result {
31056                Err(err) => {
31057                    if let common::Retry::After(d) = dlg.http_error(&err) {
31058                        sleep(d).await;
31059                        continue;
31060                    }
31061                    dlg.finished(false);
31062                    return Err(common::Error::HttpError(err));
31063                }
31064                Ok(res) => {
31065                    let (mut parts, body) = res.into_parts();
31066                    let mut body = common::Body::new(body);
31067                    if !parts.status.is_success() {
31068                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31069                        let error = serde_json::from_str(&common::to_string(&bytes));
31070                        let response = common::to_response(parts, bytes.into());
31071
31072                        if let common::Retry::After(d) =
31073                            dlg.http_failure(&response, error.as_ref().ok())
31074                        {
31075                            sleep(d).await;
31076                            continue;
31077                        }
31078
31079                        dlg.finished(false);
31080
31081                        return Err(match error {
31082                            Ok(value) => common::Error::BadRequest(value),
31083                            _ => common::Error::Failure(response),
31084                        });
31085                    }
31086                    let response = {
31087                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31088                        let encoded = common::to_string(&bytes);
31089                        match serde_json::from_str(&encoded) {
31090                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31091                            Err(error) => {
31092                                dlg.response_json_decode_error(&encoded, &error);
31093                                return Err(common::Error::JsonDecodeError(
31094                                    encoded.to_string(),
31095                                    error,
31096                                ));
31097                            }
31098                        }
31099                    };
31100
31101                    dlg.finished(true);
31102                    return Ok(response);
31103                }
31104            }
31105        }
31106    }
31107
31108    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
31109    ///
31110    /// Sets the *resource id* path property to the given value.
31111    ///
31112    /// Even though the property as already been set when instantiating this call,
31113    /// we provide this method for API completeness.
31114    pub fn resource_id(mut self, new_value: &str) -> OfferclasGetCall<'a, C> {
31115        self._resource_id = new_value.to_string();
31116        self
31117    }
31118    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31119    /// while executing the actual API request.
31120    ///
31121    /// ````text
31122    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31123    /// ````
31124    ///
31125    /// Sets the *delegate* property to the given value.
31126    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OfferclasGetCall<'a, C> {
31127        self._delegate = Some(new_value);
31128        self
31129    }
31130
31131    /// Set any additional parameter of the query string used in the request.
31132    /// It should be used to set parameters which are not yet available through their own
31133    /// setters.
31134    ///
31135    /// Please note that this method must not be used to set any of the known parameters
31136    /// which have their own setter method. If done anyway, the request will fail.
31137    ///
31138    /// # Additional Parameters
31139    ///
31140    /// * *$.xgafv* (query-string) - V1 error format.
31141    /// * *access_token* (query-string) - OAuth access token.
31142    /// * *alt* (query-string) - Data format for response.
31143    /// * *callback* (query-string) - JSONP
31144    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31145    /// * *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.
31146    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31147    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31148    /// * *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.
31149    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31150    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31151    pub fn param<T>(mut self, name: T, value: T) -> OfferclasGetCall<'a, C>
31152    where
31153        T: AsRef<str>,
31154    {
31155        self._additional_params
31156            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31157        self
31158    }
31159
31160    /// Identifies the authorization scope for the method you are building.
31161    ///
31162    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31163    /// [`Scope::WalletObjectIssuer`].
31164    ///
31165    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31166    /// tokens for more than one scope.
31167    ///
31168    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31169    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31170    /// sufficient, a read-write scope will do as well.
31171    pub fn add_scope<St>(mut self, scope: St) -> OfferclasGetCall<'a, C>
31172    where
31173        St: AsRef<str>,
31174    {
31175        self._scopes.insert(String::from(scope.as_ref()));
31176        self
31177    }
31178    /// Identifies the authorization scope(s) for the method you are building.
31179    ///
31180    /// See [`Self::add_scope()`] for details.
31181    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasGetCall<'a, C>
31182    where
31183        I: IntoIterator<Item = St>,
31184        St: AsRef<str>,
31185    {
31186        self._scopes
31187            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31188        self
31189    }
31190
31191    /// Removes all scopes, and no default scope will be used either.
31192    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31193    /// for details).
31194    pub fn clear_scopes(mut self) -> OfferclasGetCall<'a, C> {
31195        self._scopes.clear();
31196        self
31197    }
31198}
31199
31200/// Inserts an offer class with the given ID and properties.
31201///
31202/// A builder for the *insert* method supported by a *offerclas* resource.
31203/// It is not used directly, but through a [`OfferclasMethods`] instance.
31204///
31205/// # Example
31206///
31207/// Instantiate a resource method builder
31208///
31209/// ```test_harness,no_run
31210/// # extern crate hyper;
31211/// # extern crate hyper_rustls;
31212/// # extern crate google_walletobjects1 as walletobjects1;
31213/// use walletobjects1::api::OfferClass;
31214/// # async fn dox() {
31215/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31216///
31217/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31218/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31219/// #     .with_native_roots()
31220/// #     .unwrap()
31221/// #     .https_only()
31222/// #     .enable_http2()
31223/// #     .build();
31224///
31225/// # let executor = hyper_util::rt::TokioExecutor::new();
31226/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31227/// #     secret,
31228/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31229/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
31230/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
31231/// #     ),
31232/// # ).build().await.unwrap();
31233///
31234/// # let client = hyper_util::client::legacy::Client::builder(
31235/// #     hyper_util::rt::TokioExecutor::new()
31236/// # )
31237/// # .build(
31238/// #     hyper_rustls::HttpsConnectorBuilder::new()
31239/// #         .with_native_roots()
31240/// #         .unwrap()
31241/// #         .https_or_http()
31242/// #         .enable_http2()
31243/// #         .build()
31244/// # );
31245/// # let mut hub = Walletobjects::new(client, auth);
31246/// // As the method needs a request, you would usually fill it with the desired information
31247/// // into the respective structure. Some of the parts shown here might not be applicable !
31248/// // Values shown here are possibly random and not representative !
31249/// let mut req = OfferClass::default();
31250///
31251/// // You can configure optional parameters by calling the respective setters at will, and
31252/// // execute the final call using `doit()`.
31253/// // Values shown here are possibly random and not representative !
31254/// let result = hub.offerclass().insert(req)
31255///              .doit().await;
31256/// # }
31257/// ```
31258pub struct OfferclasInsertCall<'a, C>
31259where
31260    C: 'a,
31261{
31262    hub: &'a Walletobjects<C>,
31263    _request: OfferClass,
31264    _delegate: Option<&'a mut dyn common::Delegate>,
31265    _additional_params: HashMap<String, String>,
31266    _scopes: BTreeSet<String>,
31267}
31268
31269impl<'a, C> common::CallBuilder for OfferclasInsertCall<'a, C> {}
31270
31271impl<'a, C> OfferclasInsertCall<'a, C>
31272where
31273    C: common::Connector,
31274{
31275    /// Perform the operation you have build so far.
31276    pub async fn doit(mut self) -> common::Result<(common::Response, OfferClass)> {
31277        use std::borrow::Cow;
31278        use std::io::{Read, Seek};
31279
31280        use common::{url::Params, ToParts};
31281        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31282
31283        let mut dd = common::DefaultDelegate;
31284        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31285        dlg.begin(common::MethodInfo {
31286            id: "walletobjects.offerclass.insert",
31287            http_method: hyper::Method::POST,
31288        });
31289
31290        for &field in ["alt"].iter() {
31291            if self._additional_params.contains_key(field) {
31292                dlg.finished(false);
31293                return Err(common::Error::FieldClash(field));
31294            }
31295        }
31296
31297        let mut params = Params::with_capacity(3 + self._additional_params.len());
31298
31299        params.extend(self._additional_params.iter());
31300
31301        params.push("alt", "json");
31302        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass";
31303        if self._scopes.is_empty() {
31304            self._scopes
31305                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
31306        }
31307
31308        let url = params.parse_with_url(&url);
31309
31310        let mut json_mime_type = mime::APPLICATION_JSON;
31311        let mut request_value_reader = {
31312            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31313            common::remove_json_null_values(&mut value);
31314            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31315            serde_json::to_writer(&mut dst, &value).unwrap();
31316            dst
31317        };
31318        let request_size = request_value_reader
31319            .seek(std::io::SeekFrom::End(0))
31320            .unwrap();
31321        request_value_reader
31322            .seek(std::io::SeekFrom::Start(0))
31323            .unwrap();
31324
31325        loop {
31326            let token = match self
31327                .hub
31328                .auth
31329                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31330                .await
31331            {
31332                Ok(token) => token,
31333                Err(e) => match dlg.token(e) {
31334                    Ok(token) => token,
31335                    Err(e) => {
31336                        dlg.finished(false);
31337                        return Err(common::Error::MissingToken(e));
31338                    }
31339                },
31340            };
31341            request_value_reader
31342                .seek(std::io::SeekFrom::Start(0))
31343                .unwrap();
31344            let mut req_result = {
31345                let client = &self.hub.client;
31346                dlg.pre_request();
31347                let mut req_builder = hyper::Request::builder()
31348                    .method(hyper::Method::POST)
31349                    .uri(url.as_str())
31350                    .header(USER_AGENT, self.hub._user_agent.clone());
31351
31352                if let Some(token) = token.as_ref() {
31353                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31354                }
31355
31356                let request = req_builder
31357                    .header(CONTENT_TYPE, json_mime_type.to_string())
31358                    .header(CONTENT_LENGTH, request_size as u64)
31359                    .body(common::to_body(
31360                        request_value_reader.get_ref().clone().into(),
31361                    ));
31362
31363                client.request(request.unwrap()).await
31364            };
31365
31366            match req_result {
31367                Err(err) => {
31368                    if let common::Retry::After(d) = dlg.http_error(&err) {
31369                        sleep(d).await;
31370                        continue;
31371                    }
31372                    dlg.finished(false);
31373                    return Err(common::Error::HttpError(err));
31374                }
31375                Ok(res) => {
31376                    let (mut parts, body) = res.into_parts();
31377                    let mut body = common::Body::new(body);
31378                    if !parts.status.is_success() {
31379                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31380                        let error = serde_json::from_str(&common::to_string(&bytes));
31381                        let response = common::to_response(parts, bytes.into());
31382
31383                        if let common::Retry::After(d) =
31384                            dlg.http_failure(&response, error.as_ref().ok())
31385                        {
31386                            sleep(d).await;
31387                            continue;
31388                        }
31389
31390                        dlg.finished(false);
31391
31392                        return Err(match error {
31393                            Ok(value) => common::Error::BadRequest(value),
31394                            _ => common::Error::Failure(response),
31395                        });
31396                    }
31397                    let response = {
31398                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31399                        let encoded = common::to_string(&bytes);
31400                        match serde_json::from_str(&encoded) {
31401                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31402                            Err(error) => {
31403                                dlg.response_json_decode_error(&encoded, &error);
31404                                return Err(common::Error::JsonDecodeError(
31405                                    encoded.to_string(),
31406                                    error,
31407                                ));
31408                            }
31409                        }
31410                    };
31411
31412                    dlg.finished(true);
31413                    return Ok(response);
31414                }
31415            }
31416        }
31417    }
31418
31419    ///
31420    /// Sets the *request* property to the given value.
31421    ///
31422    /// Even though the property as already been set when instantiating this call,
31423    /// we provide this method for API completeness.
31424    pub fn request(mut self, new_value: OfferClass) -> OfferclasInsertCall<'a, C> {
31425        self._request = new_value;
31426        self
31427    }
31428    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31429    /// while executing the actual API request.
31430    ///
31431    /// ````text
31432    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31433    /// ````
31434    ///
31435    /// Sets the *delegate* property to the given value.
31436    pub fn delegate(
31437        mut self,
31438        new_value: &'a mut dyn common::Delegate,
31439    ) -> OfferclasInsertCall<'a, C> {
31440        self._delegate = Some(new_value);
31441        self
31442    }
31443
31444    /// Set any additional parameter of the query string used in the request.
31445    /// It should be used to set parameters which are not yet available through their own
31446    /// setters.
31447    ///
31448    /// Please note that this method must not be used to set any of the known parameters
31449    /// which have their own setter method. If done anyway, the request will fail.
31450    ///
31451    /// # Additional Parameters
31452    ///
31453    /// * *$.xgafv* (query-string) - V1 error format.
31454    /// * *access_token* (query-string) - OAuth access token.
31455    /// * *alt* (query-string) - Data format for response.
31456    /// * *callback* (query-string) - JSONP
31457    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31458    /// * *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.
31459    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31460    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31461    /// * *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.
31462    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31463    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31464    pub fn param<T>(mut self, name: T, value: T) -> OfferclasInsertCall<'a, C>
31465    where
31466        T: AsRef<str>,
31467    {
31468        self._additional_params
31469            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31470        self
31471    }
31472
31473    /// Identifies the authorization scope for the method you are building.
31474    ///
31475    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31476    /// [`Scope::WalletObjectIssuer`].
31477    ///
31478    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31479    /// tokens for more than one scope.
31480    ///
31481    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31482    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31483    /// sufficient, a read-write scope will do as well.
31484    pub fn add_scope<St>(mut self, scope: St) -> OfferclasInsertCall<'a, C>
31485    where
31486        St: AsRef<str>,
31487    {
31488        self._scopes.insert(String::from(scope.as_ref()));
31489        self
31490    }
31491    /// Identifies the authorization scope(s) for the method you are building.
31492    ///
31493    /// See [`Self::add_scope()`] for details.
31494    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasInsertCall<'a, C>
31495    where
31496        I: IntoIterator<Item = St>,
31497        St: AsRef<str>,
31498    {
31499        self._scopes
31500            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31501        self
31502    }
31503
31504    /// Removes all scopes, and no default scope will be used either.
31505    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31506    /// for details).
31507    pub fn clear_scopes(mut self) -> OfferclasInsertCall<'a, C> {
31508        self._scopes.clear();
31509        self
31510    }
31511}
31512
31513/// Returns a list of all offer classes for a given issuer ID.
31514///
31515/// A builder for the *list* method supported by a *offerclas* resource.
31516/// It is not used directly, but through a [`OfferclasMethods`] instance.
31517///
31518/// # Example
31519///
31520/// Instantiate a resource method builder
31521///
31522/// ```test_harness,no_run
31523/// # extern crate hyper;
31524/// # extern crate hyper_rustls;
31525/// # extern crate google_walletobjects1 as walletobjects1;
31526/// # async fn dox() {
31527/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31528///
31529/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31530/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31531/// #     .with_native_roots()
31532/// #     .unwrap()
31533/// #     .https_only()
31534/// #     .enable_http2()
31535/// #     .build();
31536///
31537/// # let executor = hyper_util::rt::TokioExecutor::new();
31538/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31539/// #     secret,
31540/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31541/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
31542/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
31543/// #     ),
31544/// # ).build().await.unwrap();
31545///
31546/// # let client = hyper_util::client::legacy::Client::builder(
31547/// #     hyper_util::rt::TokioExecutor::new()
31548/// # )
31549/// # .build(
31550/// #     hyper_rustls::HttpsConnectorBuilder::new()
31551/// #         .with_native_roots()
31552/// #         .unwrap()
31553/// #         .https_or_http()
31554/// #         .enable_http2()
31555/// #         .build()
31556/// # );
31557/// # let mut hub = Walletobjects::new(client, auth);
31558/// // You can configure optional parameters by calling the respective setters at will, and
31559/// // execute the final call using `doit()`.
31560/// // Values shown here are possibly random and not representative !
31561/// let result = hub.offerclass().list()
31562///              .token("amet.")
31563///              .max_results(-30)
31564///              .issuer_id(-9)
31565///              .doit().await;
31566/// # }
31567/// ```
31568pub struct OfferclasListCall<'a, C>
31569where
31570    C: 'a,
31571{
31572    hub: &'a Walletobjects<C>,
31573    _token: Option<String>,
31574    _max_results: Option<i32>,
31575    _issuer_id: Option<i64>,
31576    _delegate: Option<&'a mut dyn common::Delegate>,
31577    _additional_params: HashMap<String, String>,
31578    _scopes: BTreeSet<String>,
31579}
31580
31581impl<'a, C> common::CallBuilder for OfferclasListCall<'a, C> {}
31582
31583impl<'a, C> OfferclasListCall<'a, C>
31584where
31585    C: common::Connector,
31586{
31587    /// Perform the operation you have build so far.
31588    pub async fn doit(mut self) -> common::Result<(common::Response, OfferClassListResponse)> {
31589        use std::borrow::Cow;
31590        use std::io::{Read, Seek};
31591
31592        use common::{url::Params, ToParts};
31593        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31594
31595        let mut dd = common::DefaultDelegate;
31596        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31597        dlg.begin(common::MethodInfo {
31598            id: "walletobjects.offerclass.list",
31599            http_method: hyper::Method::GET,
31600        });
31601
31602        for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
31603            if self._additional_params.contains_key(field) {
31604                dlg.finished(false);
31605                return Err(common::Error::FieldClash(field));
31606            }
31607        }
31608
31609        let mut params = Params::with_capacity(5 + self._additional_params.len());
31610        if let Some(value) = self._token.as_ref() {
31611            params.push("token", value);
31612        }
31613        if let Some(value) = self._max_results.as_ref() {
31614            params.push("maxResults", value.to_string());
31615        }
31616        if let Some(value) = self._issuer_id.as_ref() {
31617            params.push("issuerId", value.to_string());
31618        }
31619
31620        params.extend(self._additional_params.iter());
31621
31622        params.push("alt", "json");
31623        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass";
31624        if self._scopes.is_empty() {
31625            self._scopes
31626                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
31627        }
31628
31629        let url = params.parse_with_url(&url);
31630
31631        loop {
31632            let token = match self
31633                .hub
31634                .auth
31635                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31636                .await
31637            {
31638                Ok(token) => token,
31639                Err(e) => match dlg.token(e) {
31640                    Ok(token) => token,
31641                    Err(e) => {
31642                        dlg.finished(false);
31643                        return Err(common::Error::MissingToken(e));
31644                    }
31645                },
31646            };
31647            let mut req_result = {
31648                let client = &self.hub.client;
31649                dlg.pre_request();
31650                let mut req_builder = hyper::Request::builder()
31651                    .method(hyper::Method::GET)
31652                    .uri(url.as_str())
31653                    .header(USER_AGENT, self.hub._user_agent.clone());
31654
31655                if let Some(token) = token.as_ref() {
31656                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31657                }
31658
31659                let request = req_builder
31660                    .header(CONTENT_LENGTH, 0_u64)
31661                    .body(common::to_body::<String>(None));
31662
31663                client.request(request.unwrap()).await
31664            };
31665
31666            match req_result {
31667                Err(err) => {
31668                    if let common::Retry::After(d) = dlg.http_error(&err) {
31669                        sleep(d).await;
31670                        continue;
31671                    }
31672                    dlg.finished(false);
31673                    return Err(common::Error::HttpError(err));
31674                }
31675                Ok(res) => {
31676                    let (mut parts, body) = res.into_parts();
31677                    let mut body = common::Body::new(body);
31678                    if !parts.status.is_success() {
31679                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31680                        let error = serde_json::from_str(&common::to_string(&bytes));
31681                        let response = common::to_response(parts, bytes.into());
31682
31683                        if let common::Retry::After(d) =
31684                            dlg.http_failure(&response, error.as_ref().ok())
31685                        {
31686                            sleep(d).await;
31687                            continue;
31688                        }
31689
31690                        dlg.finished(false);
31691
31692                        return Err(match error {
31693                            Ok(value) => common::Error::BadRequest(value),
31694                            _ => common::Error::Failure(response),
31695                        });
31696                    }
31697                    let response = {
31698                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31699                        let encoded = common::to_string(&bytes);
31700                        match serde_json::from_str(&encoded) {
31701                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31702                            Err(error) => {
31703                                dlg.response_json_decode_error(&encoded, &error);
31704                                return Err(common::Error::JsonDecodeError(
31705                                    encoded.to_string(),
31706                                    error,
31707                                ));
31708                            }
31709                        }
31710                    };
31711
31712                    dlg.finished(true);
31713                    return Ok(response);
31714                }
31715            }
31716        }
31717    }
31718
31719    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` classes are available in a list. For example, if you have a list of 200 classes and you call list with `maxResults` set to 20, list will return the first 20 classes and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 classes.
31720    ///
31721    /// Sets the *token* query property to the given value.
31722    pub fn token(mut self, new_value: &str) -> OfferclasListCall<'a, C> {
31723        self._token = Some(new_value.to_string());
31724        self
31725    }
31726    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
31727    ///
31728    /// Sets the *max results* query property to the given value.
31729    pub fn max_results(mut self, new_value: i32) -> OfferclasListCall<'a, C> {
31730        self._max_results = Some(new_value);
31731        self
31732    }
31733    /// The ID of the issuer authorized to list classes.
31734    ///
31735    /// Sets the *issuer id* query property to the given value.
31736    pub fn issuer_id(mut self, new_value: i64) -> OfferclasListCall<'a, C> {
31737        self._issuer_id = Some(new_value);
31738        self
31739    }
31740    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31741    /// while executing the actual API request.
31742    ///
31743    /// ````text
31744    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31745    /// ````
31746    ///
31747    /// Sets the *delegate* property to the given value.
31748    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OfferclasListCall<'a, C> {
31749        self._delegate = Some(new_value);
31750        self
31751    }
31752
31753    /// Set any additional parameter of the query string used in the request.
31754    /// It should be used to set parameters which are not yet available through their own
31755    /// setters.
31756    ///
31757    /// Please note that this method must not be used to set any of the known parameters
31758    /// which have their own setter method. If done anyway, the request will fail.
31759    ///
31760    /// # Additional Parameters
31761    ///
31762    /// * *$.xgafv* (query-string) - V1 error format.
31763    /// * *access_token* (query-string) - OAuth access token.
31764    /// * *alt* (query-string) - Data format for response.
31765    /// * *callback* (query-string) - JSONP
31766    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31767    /// * *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.
31768    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31769    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31770    /// * *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.
31771    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31772    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31773    pub fn param<T>(mut self, name: T, value: T) -> OfferclasListCall<'a, C>
31774    where
31775        T: AsRef<str>,
31776    {
31777        self._additional_params
31778            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31779        self
31780    }
31781
31782    /// Identifies the authorization scope for the method you are building.
31783    ///
31784    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31785    /// [`Scope::WalletObjectIssuer`].
31786    ///
31787    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31788    /// tokens for more than one scope.
31789    ///
31790    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31791    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31792    /// sufficient, a read-write scope will do as well.
31793    pub fn add_scope<St>(mut self, scope: St) -> OfferclasListCall<'a, C>
31794    where
31795        St: AsRef<str>,
31796    {
31797        self._scopes.insert(String::from(scope.as_ref()));
31798        self
31799    }
31800    /// Identifies the authorization scope(s) for the method you are building.
31801    ///
31802    /// See [`Self::add_scope()`] for details.
31803    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasListCall<'a, C>
31804    where
31805        I: IntoIterator<Item = St>,
31806        St: AsRef<str>,
31807    {
31808        self._scopes
31809            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31810        self
31811    }
31812
31813    /// Removes all scopes, and no default scope will be used either.
31814    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31815    /// for details).
31816    pub fn clear_scopes(mut self) -> OfferclasListCall<'a, C> {
31817        self._scopes.clear();
31818        self
31819    }
31820}
31821
31822/// Updates the offer class referenced by the given class ID. This method supports patch semantics.
31823///
31824/// A builder for the *patch* method supported by a *offerclas* resource.
31825/// It is not used directly, but through a [`OfferclasMethods`] instance.
31826///
31827/// # Example
31828///
31829/// Instantiate a resource method builder
31830///
31831/// ```test_harness,no_run
31832/// # extern crate hyper;
31833/// # extern crate hyper_rustls;
31834/// # extern crate google_walletobjects1 as walletobjects1;
31835/// use walletobjects1::api::OfferClass;
31836/// # async fn dox() {
31837/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31838///
31839/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31840/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31841/// #     .with_native_roots()
31842/// #     .unwrap()
31843/// #     .https_only()
31844/// #     .enable_http2()
31845/// #     .build();
31846///
31847/// # let executor = hyper_util::rt::TokioExecutor::new();
31848/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31849/// #     secret,
31850/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31851/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
31852/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
31853/// #     ),
31854/// # ).build().await.unwrap();
31855///
31856/// # let client = hyper_util::client::legacy::Client::builder(
31857/// #     hyper_util::rt::TokioExecutor::new()
31858/// # )
31859/// # .build(
31860/// #     hyper_rustls::HttpsConnectorBuilder::new()
31861/// #         .with_native_roots()
31862/// #         .unwrap()
31863/// #         .https_or_http()
31864/// #         .enable_http2()
31865/// #         .build()
31866/// # );
31867/// # let mut hub = Walletobjects::new(client, auth);
31868/// // As the method needs a request, you would usually fill it with the desired information
31869/// // into the respective structure. Some of the parts shown here might not be applicable !
31870/// // Values shown here are possibly random and not representative !
31871/// let mut req = OfferClass::default();
31872///
31873/// // You can configure optional parameters by calling the respective setters at will, and
31874/// // execute the final call using `doit()`.
31875/// // Values shown here are possibly random and not representative !
31876/// let result = hub.offerclass().patch(req, "resourceId")
31877///              .doit().await;
31878/// # }
31879/// ```
31880pub struct OfferclasPatchCall<'a, C>
31881where
31882    C: 'a,
31883{
31884    hub: &'a Walletobjects<C>,
31885    _request: OfferClass,
31886    _resource_id: String,
31887    _delegate: Option<&'a mut dyn common::Delegate>,
31888    _additional_params: HashMap<String, String>,
31889    _scopes: BTreeSet<String>,
31890}
31891
31892impl<'a, C> common::CallBuilder for OfferclasPatchCall<'a, C> {}
31893
31894impl<'a, C> OfferclasPatchCall<'a, C>
31895where
31896    C: common::Connector,
31897{
31898    /// Perform the operation you have build so far.
31899    pub async fn doit(mut self) -> common::Result<(common::Response, OfferClass)> {
31900        use std::borrow::Cow;
31901        use std::io::{Read, Seek};
31902
31903        use common::{url::Params, ToParts};
31904        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31905
31906        let mut dd = common::DefaultDelegate;
31907        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31908        dlg.begin(common::MethodInfo {
31909            id: "walletobjects.offerclass.patch",
31910            http_method: hyper::Method::PATCH,
31911        });
31912
31913        for &field in ["alt", "resourceId"].iter() {
31914            if self._additional_params.contains_key(field) {
31915                dlg.finished(false);
31916                return Err(common::Error::FieldClash(field));
31917            }
31918        }
31919
31920        let mut params = Params::with_capacity(4 + self._additional_params.len());
31921        params.push("resourceId", self._resource_id);
31922
31923        params.extend(self._additional_params.iter());
31924
31925        params.push("alt", "json");
31926        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass/{resourceId}";
31927        if self._scopes.is_empty() {
31928            self._scopes
31929                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
31930        }
31931
31932        #[allow(clippy::single_element_loop)]
31933        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
31934            url = params.uri_replacement(url, param_name, find_this, false);
31935        }
31936        {
31937            let to_remove = ["resourceId"];
31938            params.remove_params(&to_remove);
31939        }
31940
31941        let url = params.parse_with_url(&url);
31942
31943        let mut json_mime_type = mime::APPLICATION_JSON;
31944        let mut request_value_reader = {
31945            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31946            common::remove_json_null_values(&mut value);
31947            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31948            serde_json::to_writer(&mut dst, &value).unwrap();
31949            dst
31950        };
31951        let request_size = request_value_reader
31952            .seek(std::io::SeekFrom::End(0))
31953            .unwrap();
31954        request_value_reader
31955            .seek(std::io::SeekFrom::Start(0))
31956            .unwrap();
31957
31958        loop {
31959            let token = match self
31960                .hub
31961                .auth
31962                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31963                .await
31964            {
31965                Ok(token) => token,
31966                Err(e) => match dlg.token(e) {
31967                    Ok(token) => token,
31968                    Err(e) => {
31969                        dlg.finished(false);
31970                        return Err(common::Error::MissingToken(e));
31971                    }
31972                },
31973            };
31974            request_value_reader
31975                .seek(std::io::SeekFrom::Start(0))
31976                .unwrap();
31977            let mut req_result = {
31978                let client = &self.hub.client;
31979                dlg.pre_request();
31980                let mut req_builder = hyper::Request::builder()
31981                    .method(hyper::Method::PATCH)
31982                    .uri(url.as_str())
31983                    .header(USER_AGENT, self.hub._user_agent.clone());
31984
31985                if let Some(token) = token.as_ref() {
31986                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31987                }
31988
31989                let request = req_builder
31990                    .header(CONTENT_TYPE, json_mime_type.to_string())
31991                    .header(CONTENT_LENGTH, request_size as u64)
31992                    .body(common::to_body(
31993                        request_value_reader.get_ref().clone().into(),
31994                    ));
31995
31996                client.request(request.unwrap()).await
31997            };
31998
31999            match req_result {
32000                Err(err) => {
32001                    if let common::Retry::After(d) = dlg.http_error(&err) {
32002                        sleep(d).await;
32003                        continue;
32004                    }
32005                    dlg.finished(false);
32006                    return Err(common::Error::HttpError(err));
32007                }
32008                Ok(res) => {
32009                    let (mut parts, body) = res.into_parts();
32010                    let mut body = common::Body::new(body);
32011                    if !parts.status.is_success() {
32012                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32013                        let error = serde_json::from_str(&common::to_string(&bytes));
32014                        let response = common::to_response(parts, bytes.into());
32015
32016                        if let common::Retry::After(d) =
32017                            dlg.http_failure(&response, error.as_ref().ok())
32018                        {
32019                            sleep(d).await;
32020                            continue;
32021                        }
32022
32023                        dlg.finished(false);
32024
32025                        return Err(match error {
32026                            Ok(value) => common::Error::BadRequest(value),
32027                            _ => common::Error::Failure(response),
32028                        });
32029                    }
32030                    let response = {
32031                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32032                        let encoded = common::to_string(&bytes);
32033                        match serde_json::from_str(&encoded) {
32034                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32035                            Err(error) => {
32036                                dlg.response_json_decode_error(&encoded, &error);
32037                                return Err(common::Error::JsonDecodeError(
32038                                    encoded.to_string(),
32039                                    error,
32040                                ));
32041                            }
32042                        }
32043                    };
32044
32045                    dlg.finished(true);
32046                    return Ok(response);
32047                }
32048            }
32049        }
32050    }
32051
32052    ///
32053    /// Sets the *request* property to the given value.
32054    ///
32055    /// Even though the property as already been set when instantiating this call,
32056    /// we provide this method for API completeness.
32057    pub fn request(mut self, new_value: OfferClass) -> OfferclasPatchCall<'a, C> {
32058        self._request = new_value;
32059        self
32060    }
32061    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
32062    ///
32063    /// Sets the *resource id* path property to the given value.
32064    ///
32065    /// Even though the property as already been set when instantiating this call,
32066    /// we provide this method for API completeness.
32067    pub fn resource_id(mut self, new_value: &str) -> OfferclasPatchCall<'a, C> {
32068        self._resource_id = new_value.to_string();
32069        self
32070    }
32071    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32072    /// while executing the actual API request.
32073    ///
32074    /// ````text
32075    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32076    /// ````
32077    ///
32078    /// Sets the *delegate* property to the given value.
32079    pub fn delegate(
32080        mut self,
32081        new_value: &'a mut dyn common::Delegate,
32082    ) -> OfferclasPatchCall<'a, C> {
32083        self._delegate = Some(new_value);
32084        self
32085    }
32086
32087    /// Set any additional parameter of the query string used in the request.
32088    /// It should be used to set parameters which are not yet available through their own
32089    /// setters.
32090    ///
32091    /// Please note that this method must not be used to set any of the known parameters
32092    /// which have their own setter method. If done anyway, the request will fail.
32093    ///
32094    /// # Additional Parameters
32095    ///
32096    /// * *$.xgafv* (query-string) - V1 error format.
32097    /// * *access_token* (query-string) - OAuth access token.
32098    /// * *alt* (query-string) - Data format for response.
32099    /// * *callback* (query-string) - JSONP
32100    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32101    /// * *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.
32102    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32103    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32104    /// * *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.
32105    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32106    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32107    pub fn param<T>(mut self, name: T, value: T) -> OfferclasPatchCall<'a, C>
32108    where
32109        T: AsRef<str>,
32110    {
32111        self._additional_params
32112            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32113        self
32114    }
32115
32116    /// Identifies the authorization scope for the method you are building.
32117    ///
32118    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32119    /// [`Scope::WalletObjectIssuer`].
32120    ///
32121    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32122    /// tokens for more than one scope.
32123    ///
32124    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32125    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32126    /// sufficient, a read-write scope will do as well.
32127    pub fn add_scope<St>(mut self, scope: St) -> OfferclasPatchCall<'a, C>
32128    where
32129        St: AsRef<str>,
32130    {
32131        self._scopes.insert(String::from(scope.as_ref()));
32132        self
32133    }
32134    /// Identifies the authorization scope(s) for the method you are building.
32135    ///
32136    /// See [`Self::add_scope()`] for details.
32137    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasPatchCall<'a, C>
32138    where
32139        I: IntoIterator<Item = St>,
32140        St: AsRef<str>,
32141    {
32142        self._scopes
32143            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32144        self
32145    }
32146
32147    /// Removes all scopes, and no default scope will be used either.
32148    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32149    /// for details).
32150    pub fn clear_scopes(mut self) -> OfferclasPatchCall<'a, C> {
32151        self._scopes.clear();
32152        self
32153    }
32154}
32155
32156/// Updates the offer class referenced by the given class ID.
32157///
32158/// A builder for the *update* method supported by a *offerclas* resource.
32159/// It is not used directly, but through a [`OfferclasMethods`] instance.
32160///
32161/// # Example
32162///
32163/// Instantiate a resource method builder
32164///
32165/// ```test_harness,no_run
32166/// # extern crate hyper;
32167/// # extern crate hyper_rustls;
32168/// # extern crate google_walletobjects1 as walletobjects1;
32169/// use walletobjects1::api::OfferClass;
32170/// # async fn dox() {
32171/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32172///
32173/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32174/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32175/// #     .with_native_roots()
32176/// #     .unwrap()
32177/// #     .https_only()
32178/// #     .enable_http2()
32179/// #     .build();
32180///
32181/// # let executor = hyper_util::rt::TokioExecutor::new();
32182/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32183/// #     secret,
32184/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32185/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
32186/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
32187/// #     ),
32188/// # ).build().await.unwrap();
32189///
32190/// # let client = hyper_util::client::legacy::Client::builder(
32191/// #     hyper_util::rt::TokioExecutor::new()
32192/// # )
32193/// # .build(
32194/// #     hyper_rustls::HttpsConnectorBuilder::new()
32195/// #         .with_native_roots()
32196/// #         .unwrap()
32197/// #         .https_or_http()
32198/// #         .enable_http2()
32199/// #         .build()
32200/// # );
32201/// # let mut hub = Walletobjects::new(client, auth);
32202/// // As the method needs a request, you would usually fill it with the desired information
32203/// // into the respective structure. Some of the parts shown here might not be applicable !
32204/// // Values shown here are possibly random and not representative !
32205/// let mut req = OfferClass::default();
32206///
32207/// // You can configure optional parameters by calling the respective setters at will, and
32208/// // execute the final call using `doit()`.
32209/// // Values shown here are possibly random and not representative !
32210/// let result = hub.offerclass().update(req, "resourceId")
32211///              .doit().await;
32212/// # }
32213/// ```
32214pub struct OfferclasUpdateCall<'a, C>
32215where
32216    C: 'a,
32217{
32218    hub: &'a Walletobjects<C>,
32219    _request: OfferClass,
32220    _resource_id: String,
32221    _delegate: Option<&'a mut dyn common::Delegate>,
32222    _additional_params: HashMap<String, String>,
32223    _scopes: BTreeSet<String>,
32224}
32225
32226impl<'a, C> common::CallBuilder for OfferclasUpdateCall<'a, C> {}
32227
32228impl<'a, C> OfferclasUpdateCall<'a, C>
32229where
32230    C: common::Connector,
32231{
32232    /// Perform the operation you have build so far.
32233    pub async fn doit(mut self) -> common::Result<(common::Response, OfferClass)> {
32234        use std::borrow::Cow;
32235        use std::io::{Read, Seek};
32236
32237        use common::{url::Params, ToParts};
32238        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32239
32240        let mut dd = common::DefaultDelegate;
32241        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32242        dlg.begin(common::MethodInfo {
32243            id: "walletobjects.offerclass.update",
32244            http_method: hyper::Method::PUT,
32245        });
32246
32247        for &field in ["alt", "resourceId"].iter() {
32248            if self._additional_params.contains_key(field) {
32249                dlg.finished(false);
32250                return Err(common::Error::FieldClash(field));
32251            }
32252        }
32253
32254        let mut params = Params::with_capacity(4 + self._additional_params.len());
32255        params.push("resourceId", self._resource_id);
32256
32257        params.extend(self._additional_params.iter());
32258
32259        params.push("alt", "json");
32260        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass/{resourceId}";
32261        if self._scopes.is_empty() {
32262            self._scopes
32263                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
32264        }
32265
32266        #[allow(clippy::single_element_loop)]
32267        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
32268            url = params.uri_replacement(url, param_name, find_this, false);
32269        }
32270        {
32271            let to_remove = ["resourceId"];
32272            params.remove_params(&to_remove);
32273        }
32274
32275        let url = params.parse_with_url(&url);
32276
32277        let mut json_mime_type = mime::APPLICATION_JSON;
32278        let mut request_value_reader = {
32279            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32280            common::remove_json_null_values(&mut value);
32281            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32282            serde_json::to_writer(&mut dst, &value).unwrap();
32283            dst
32284        };
32285        let request_size = request_value_reader
32286            .seek(std::io::SeekFrom::End(0))
32287            .unwrap();
32288        request_value_reader
32289            .seek(std::io::SeekFrom::Start(0))
32290            .unwrap();
32291
32292        loop {
32293            let token = match self
32294                .hub
32295                .auth
32296                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32297                .await
32298            {
32299                Ok(token) => token,
32300                Err(e) => match dlg.token(e) {
32301                    Ok(token) => token,
32302                    Err(e) => {
32303                        dlg.finished(false);
32304                        return Err(common::Error::MissingToken(e));
32305                    }
32306                },
32307            };
32308            request_value_reader
32309                .seek(std::io::SeekFrom::Start(0))
32310                .unwrap();
32311            let mut req_result = {
32312                let client = &self.hub.client;
32313                dlg.pre_request();
32314                let mut req_builder = hyper::Request::builder()
32315                    .method(hyper::Method::PUT)
32316                    .uri(url.as_str())
32317                    .header(USER_AGENT, self.hub._user_agent.clone());
32318
32319                if let Some(token) = token.as_ref() {
32320                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32321                }
32322
32323                let request = req_builder
32324                    .header(CONTENT_TYPE, json_mime_type.to_string())
32325                    .header(CONTENT_LENGTH, request_size as u64)
32326                    .body(common::to_body(
32327                        request_value_reader.get_ref().clone().into(),
32328                    ));
32329
32330                client.request(request.unwrap()).await
32331            };
32332
32333            match req_result {
32334                Err(err) => {
32335                    if let common::Retry::After(d) = dlg.http_error(&err) {
32336                        sleep(d).await;
32337                        continue;
32338                    }
32339                    dlg.finished(false);
32340                    return Err(common::Error::HttpError(err));
32341                }
32342                Ok(res) => {
32343                    let (mut parts, body) = res.into_parts();
32344                    let mut body = common::Body::new(body);
32345                    if !parts.status.is_success() {
32346                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32347                        let error = serde_json::from_str(&common::to_string(&bytes));
32348                        let response = common::to_response(parts, bytes.into());
32349
32350                        if let common::Retry::After(d) =
32351                            dlg.http_failure(&response, error.as_ref().ok())
32352                        {
32353                            sleep(d).await;
32354                            continue;
32355                        }
32356
32357                        dlg.finished(false);
32358
32359                        return Err(match error {
32360                            Ok(value) => common::Error::BadRequest(value),
32361                            _ => common::Error::Failure(response),
32362                        });
32363                    }
32364                    let response = {
32365                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32366                        let encoded = common::to_string(&bytes);
32367                        match serde_json::from_str(&encoded) {
32368                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32369                            Err(error) => {
32370                                dlg.response_json_decode_error(&encoded, &error);
32371                                return Err(common::Error::JsonDecodeError(
32372                                    encoded.to_string(),
32373                                    error,
32374                                ));
32375                            }
32376                        }
32377                    };
32378
32379                    dlg.finished(true);
32380                    return Ok(response);
32381                }
32382            }
32383        }
32384    }
32385
32386    ///
32387    /// Sets the *request* property to the given value.
32388    ///
32389    /// Even though the property as already been set when instantiating this call,
32390    /// we provide this method for API completeness.
32391    pub fn request(mut self, new_value: OfferClass) -> OfferclasUpdateCall<'a, C> {
32392        self._request = new_value;
32393        self
32394    }
32395    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
32396    ///
32397    /// Sets the *resource id* path property to the given value.
32398    ///
32399    /// Even though the property as already been set when instantiating this call,
32400    /// we provide this method for API completeness.
32401    pub fn resource_id(mut self, new_value: &str) -> OfferclasUpdateCall<'a, C> {
32402        self._resource_id = new_value.to_string();
32403        self
32404    }
32405    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32406    /// while executing the actual API request.
32407    ///
32408    /// ````text
32409    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32410    /// ````
32411    ///
32412    /// Sets the *delegate* property to the given value.
32413    pub fn delegate(
32414        mut self,
32415        new_value: &'a mut dyn common::Delegate,
32416    ) -> OfferclasUpdateCall<'a, C> {
32417        self._delegate = Some(new_value);
32418        self
32419    }
32420
32421    /// Set any additional parameter of the query string used in the request.
32422    /// It should be used to set parameters which are not yet available through their own
32423    /// setters.
32424    ///
32425    /// Please note that this method must not be used to set any of the known parameters
32426    /// which have their own setter method. If done anyway, the request will fail.
32427    ///
32428    /// # Additional Parameters
32429    ///
32430    /// * *$.xgafv* (query-string) - V1 error format.
32431    /// * *access_token* (query-string) - OAuth access token.
32432    /// * *alt* (query-string) - Data format for response.
32433    /// * *callback* (query-string) - JSONP
32434    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32435    /// * *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.
32436    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32437    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32438    /// * *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.
32439    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32440    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32441    pub fn param<T>(mut self, name: T, value: T) -> OfferclasUpdateCall<'a, C>
32442    where
32443        T: AsRef<str>,
32444    {
32445        self._additional_params
32446            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32447        self
32448    }
32449
32450    /// Identifies the authorization scope for the method you are building.
32451    ///
32452    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32453    /// [`Scope::WalletObjectIssuer`].
32454    ///
32455    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32456    /// tokens for more than one scope.
32457    ///
32458    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32459    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32460    /// sufficient, a read-write scope will do as well.
32461    pub fn add_scope<St>(mut self, scope: St) -> OfferclasUpdateCall<'a, C>
32462    where
32463        St: AsRef<str>,
32464    {
32465        self._scopes.insert(String::from(scope.as_ref()));
32466        self
32467    }
32468    /// Identifies the authorization scope(s) for the method you are building.
32469    ///
32470    /// See [`Self::add_scope()`] for details.
32471    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasUpdateCall<'a, C>
32472    where
32473        I: IntoIterator<Item = St>,
32474        St: AsRef<str>,
32475    {
32476        self._scopes
32477            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32478        self
32479    }
32480
32481    /// Removes all scopes, and no default scope will be used either.
32482    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32483    /// for details).
32484    pub fn clear_scopes(mut self) -> OfferclasUpdateCall<'a, C> {
32485        self._scopes.clear();
32486        self
32487    }
32488}
32489
32490/// Adds a message to the offer object referenced by the given object ID.
32491///
32492/// A builder for the *addmessage* method supported by a *offerobject* resource.
32493/// It is not used directly, but through a [`OfferobjectMethods`] instance.
32494///
32495/// # Example
32496///
32497/// Instantiate a resource method builder
32498///
32499/// ```test_harness,no_run
32500/// # extern crate hyper;
32501/// # extern crate hyper_rustls;
32502/// # extern crate google_walletobjects1 as walletobjects1;
32503/// use walletobjects1::api::AddMessageRequest;
32504/// # async fn dox() {
32505/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32506///
32507/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32508/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32509/// #     .with_native_roots()
32510/// #     .unwrap()
32511/// #     .https_only()
32512/// #     .enable_http2()
32513/// #     .build();
32514///
32515/// # let executor = hyper_util::rt::TokioExecutor::new();
32516/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32517/// #     secret,
32518/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32519/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
32520/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
32521/// #     ),
32522/// # ).build().await.unwrap();
32523///
32524/// # let client = hyper_util::client::legacy::Client::builder(
32525/// #     hyper_util::rt::TokioExecutor::new()
32526/// # )
32527/// # .build(
32528/// #     hyper_rustls::HttpsConnectorBuilder::new()
32529/// #         .with_native_roots()
32530/// #         .unwrap()
32531/// #         .https_or_http()
32532/// #         .enable_http2()
32533/// #         .build()
32534/// # );
32535/// # let mut hub = Walletobjects::new(client, auth);
32536/// // As the method needs a request, you would usually fill it with the desired information
32537/// // into the respective structure. Some of the parts shown here might not be applicable !
32538/// // Values shown here are possibly random and not representative !
32539/// let mut req = AddMessageRequest::default();
32540///
32541/// // You can configure optional parameters by calling the respective setters at will, and
32542/// // execute the final call using `doit()`.
32543/// // Values shown here are possibly random and not representative !
32544/// let result = hub.offerobject().addmessage(req, "resourceId")
32545///              .doit().await;
32546/// # }
32547/// ```
32548pub struct OfferobjectAddmessageCall<'a, C>
32549where
32550    C: 'a,
32551{
32552    hub: &'a Walletobjects<C>,
32553    _request: AddMessageRequest,
32554    _resource_id: String,
32555    _delegate: Option<&'a mut dyn common::Delegate>,
32556    _additional_params: HashMap<String, String>,
32557    _scopes: BTreeSet<String>,
32558}
32559
32560impl<'a, C> common::CallBuilder for OfferobjectAddmessageCall<'a, C> {}
32561
32562impl<'a, C> OfferobjectAddmessageCall<'a, C>
32563where
32564    C: common::Connector,
32565{
32566    /// Perform the operation you have build so far.
32567    pub async fn doit(
32568        mut self,
32569    ) -> common::Result<(common::Response, OfferObjectAddMessageResponse)> {
32570        use std::borrow::Cow;
32571        use std::io::{Read, Seek};
32572
32573        use common::{url::Params, ToParts};
32574        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32575
32576        let mut dd = common::DefaultDelegate;
32577        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32578        dlg.begin(common::MethodInfo {
32579            id: "walletobjects.offerobject.addmessage",
32580            http_method: hyper::Method::POST,
32581        });
32582
32583        for &field in ["alt", "resourceId"].iter() {
32584            if self._additional_params.contains_key(field) {
32585                dlg.finished(false);
32586                return Err(common::Error::FieldClash(field));
32587            }
32588        }
32589
32590        let mut params = Params::with_capacity(4 + self._additional_params.len());
32591        params.push("resourceId", self._resource_id);
32592
32593        params.extend(self._additional_params.iter());
32594
32595        params.push("alt", "json");
32596        let mut url =
32597            self.hub._base_url.clone() + "walletobjects/v1/offerObject/{resourceId}/addMessage";
32598        if self._scopes.is_empty() {
32599            self._scopes
32600                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
32601        }
32602
32603        #[allow(clippy::single_element_loop)]
32604        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
32605            url = params.uri_replacement(url, param_name, find_this, false);
32606        }
32607        {
32608            let to_remove = ["resourceId"];
32609            params.remove_params(&to_remove);
32610        }
32611
32612        let url = params.parse_with_url(&url);
32613
32614        let mut json_mime_type = mime::APPLICATION_JSON;
32615        let mut request_value_reader = {
32616            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32617            common::remove_json_null_values(&mut value);
32618            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32619            serde_json::to_writer(&mut dst, &value).unwrap();
32620            dst
32621        };
32622        let request_size = request_value_reader
32623            .seek(std::io::SeekFrom::End(0))
32624            .unwrap();
32625        request_value_reader
32626            .seek(std::io::SeekFrom::Start(0))
32627            .unwrap();
32628
32629        loop {
32630            let token = match self
32631                .hub
32632                .auth
32633                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32634                .await
32635            {
32636                Ok(token) => token,
32637                Err(e) => match dlg.token(e) {
32638                    Ok(token) => token,
32639                    Err(e) => {
32640                        dlg.finished(false);
32641                        return Err(common::Error::MissingToken(e));
32642                    }
32643                },
32644            };
32645            request_value_reader
32646                .seek(std::io::SeekFrom::Start(0))
32647                .unwrap();
32648            let mut req_result = {
32649                let client = &self.hub.client;
32650                dlg.pre_request();
32651                let mut req_builder = hyper::Request::builder()
32652                    .method(hyper::Method::POST)
32653                    .uri(url.as_str())
32654                    .header(USER_AGENT, self.hub._user_agent.clone());
32655
32656                if let Some(token) = token.as_ref() {
32657                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32658                }
32659
32660                let request = req_builder
32661                    .header(CONTENT_TYPE, json_mime_type.to_string())
32662                    .header(CONTENT_LENGTH, request_size as u64)
32663                    .body(common::to_body(
32664                        request_value_reader.get_ref().clone().into(),
32665                    ));
32666
32667                client.request(request.unwrap()).await
32668            };
32669
32670            match req_result {
32671                Err(err) => {
32672                    if let common::Retry::After(d) = dlg.http_error(&err) {
32673                        sleep(d).await;
32674                        continue;
32675                    }
32676                    dlg.finished(false);
32677                    return Err(common::Error::HttpError(err));
32678                }
32679                Ok(res) => {
32680                    let (mut parts, body) = res.into_parts();
32681                    let mut body = common::Body::new(body);
32682                    if !parts.status.is_success() {
32683                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32684                        let error = serde_json::from_str(&common::to_string(&bytes));
32685                        let response = common::to_response(parts, bytes.into());
32686
32687                        if let common::Retry::After(d) =
32688                            dlg.http_failure(&response, error.as_ref().ok())
32689                        {
32690                            sleep(d).await;
32691                            continue;
32692                        }
32693
32694                        dlg.finished(false);
32695
32696                        return Err(match error {
32697                            Ok(value) => common::Error::BadRequest(value),
32698                            _ => common::Error::Failure(response),
32699                        });
32700                    }
32701                    let response = {
32702                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32703                        let encoded = common::to_string(&bytes);
32704                        match serde_json::from_str(&encoded) {
32705                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32706                            Err(error) => {
32707                                dlg.response_json_decode_error(&encoded, &error);
32708                                return Err(common::Error::JsonDecodeError(
32709                                    encoded.to_string(),
32710                                    error,
32711                                ));
32712                            }
32713                        }
32714                    };
32715
32716                    dlg.finished(true);
32717                    return Ok(response);
32718                }
32719            }
32720        }
32721    }
32722
32723    ///
32724    /// Sets the *request* property to the given value.
32725    ///
32726    /// Even though the property as already been set when instantiating this call,
32727    /// we provide this method for API completeness.
32728    pub fn request(mut self, new_value: AddMessageRequest) -> OfferobjectAddmessageCall<'a, C> {
32729        self._request = new_value;
32730        self
32731    }
32732    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
32733    ///
32734    /// Sets the *resource id* path property to the given value.
32735    ///
32736    /// Even though the property as already been set when instantiating this call,
32737    /// we provide this method for API completeness.
32738    pub fn resource_id(mut self, new_value: &str) -> OfferobjectAddmessageCall<'a, C> {
32739        self._resource_id = new_value.to_string();
32740        self
32741    }
32742    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32743    /// while executing the actual API request.
32744    ///
32745    /// ````text
32746    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32747    /// ````
32748    ///
32749    /// Sets the *delegate* property to the given value.
32750    pub fn delegate(
32751        mut self,
32752        new_value: &'a mut dyn common::Delegate,
32753    ) -> OfferobjectAddmessageCall<'a, C> {
32754        self._delegate = Some(new_value);
32755        self
32756    }
32757
32758    /// Set any additional parameter of the query string used in the request.
32759    /// It should be used to set parameters which are not yet available through their own
32760    /// setters.
32761    ///
32762    /// Please note that this method must not be used to set any of the known parameters
32763    /// which have their own setter method. If done anyway, the request will fail.
32764    ///
32765    /// # Additional Parameters
32766    ///
32767    /// * *$.xgafv* (query-string) - V1 error format.
32768    /// * *access_token* (query-string) - OAuth access token.
32769    /// * *alt* (query-string) - Data format for response.
32770    /// * *callback* (query-string) - JSONP
32771    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32772    /// * *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.
32773    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32774    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32775    /// * *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.
32776    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32777    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32778    pub fn param<T>(mut self, name: T, value: T) -> OfferobjectAddmessageCall<'a, C>
32779    where
32780        T: AsRef<str>,
32781    {
32782        self._additional_params
32783            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32784        self
32785    }
32786
32787    /// Identifies the authorization scope for the method you are building.
32788    ///
32789    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32790    /// [`Scope::WalletObjectIssuer`].
32791    ///
32792    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32793    /// tokens for more than one scope.
32794    ///
32795    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32796    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32797    /// sufficient, a read-write scope will do as well.
32798    pub fn add_scope<St>(mut self, scope: St) -> OfferobjectAddmessageCall<'a, C>
32799    where
32800        St: AsRef<str>,
32801    {
32802        self._scopes.insert(String::from(scope.as_ref()));
32803        self
32804    }
32805    /// Identifies the authorization scope(s) for the method you are building.
32806    ///
32807    /// See [`Self::add_scope()`] for details.
32808    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectAddmessageCall<'a, C>
32809    where
32810        I: IntoIterator<Item = St>,
32811        St: AsRef<str>,
32812    {
32813        self._scopes
32814            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32815        self
32816    }
32817
32818    /// Removes all scopes, and no default scope will be used either.
32819    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32820    /// for details).
32821    pub fn clear_scopes(mut self) -> OfferobjectAddmessageCall<'a, C> {
32822        self._scopes.clear();
32823        self
32824    }
32825}
32826
32827/// Returns the offer object with the given object ID.
32828///
32829/// A builder for the *get* method supported by a *offerobject* resource.
32830/// It is not used directly, but through a [`OfferobjectMethods`] instance.
32831///
32832/// # Example
32833///
32834/// Instantiate a resource method builder
32835///
32836/// ```test_harness,no_run
32837/// # extern crate hyper;
32838/// # extern crate hyper_rustls;
32839/// # extern crate google_walletobjects1 as walletobjects1;
32840/// # async fn dox() {
32841/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32842///
32843/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32844/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32845/// #     .with_native_roots()
32846/// #     .unwrap()
32847/// #     .https_only()
32848/// #     .enable_http2()
32849/// #     .build();
32850///
32851/// # let executor = hyper_util::rt::TokioExecutor::new();
32852/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32853/// #     secret,
32854/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32855/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
32856/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
32857/// #     ),
32858/// # ).build().await.unwrap();
32859///
32860/// # let client = hyper_util::client::legacy::Client::builder(
32861/// #     hyper_util::rt::TokioExecutor::new()
32862/// # )
32863/// # .build(
32864/// #     hyper_rustls::HttpsConnectorBuilder::new()
32865/// #         .with_native_roots()
32866/// #         .unwrap()
32867/// #         .https_or_http()
32868/// #         .enable_http2()
32869/// #         .build()
32870/// # );
32871/// # let mut hub = Walletobjects::new(client, auth);
32872/// // You can configure optional parameters by calling the respective setters at will, and
32873/// // execute the final call using `doit()`.
32874/// // Values shown here are possibly random and not representative !
32875/// let result = hub.offerobject().get("resourceId")
32876///              .doit().await;
32877/// # }
32878/// ```
32879pub struct OfferobjectGetCall<'a, C>
32880where
32881    C: 'a,
32882{
32883    hub: &'a Walletobjects<C>,
32884    _resource_id: String,
32885    _delegate: Option<&'a mut dyn common::Delegate>,
32886    _additional_params: HashMap<String, String>,
32887    _scopes: BTreeSet<String>,
32888}
32889
32890impl<'a, C> common::CallBuilder for OfferobjectGetCall<'a, C> {}
32891
32892impl<'a, C> OfferobjectGetCall<'a, C>
32893where
32894    C: common::Connector,
32895{
32896    /// Perform the operation you have build so far.
32897    pub async fn doit(mut self) -> common::Result<(common::Response, OfferObject)> {
32898        use std::borrow::Cow;
32899        use std::io::{Read, Seek};
32900
32901        use common::{url::Params, ToParts};
32902        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32903
32904        let mut dd = common::DefaultDelegate;
32905        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32906        dlg.begin(common::MethodInfo {
32907            id: "walletobjects.offerobject.get",
32908            http_method: hyper::Method::GET,
32909        });
32910
32911        for &field in ["alt", "resourceId"].iter() {
32912            if self._additional_params.contains_key(field) {
32913                dlg.finished(false);
32914                return Err(common::Error::FieldClash(field));
32915            }
32916        }
32917
32918        let mut params = Params::with_capacity(3 + self._additional_params.len());
32919        params.push("resourceId", self._resource_id);
32920
32921        params.extend(self._additional_params.iter());
32922
32923        params.push("alt", "json");
32924        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject/{resourceId}";
32925        if self._scopes.is_empty() {
32926            self._scopes
32927                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
32928        }
32929
32930        #[allow(clippy::single_element_loop)]
32931        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
32932            url = params.uri_replacement(url, param_name, find_this, false);
32933        }
32934        {
32935            let to_remove = ["resourceId"];
32936            params.remove_params(&to_remove);
32937        }
32938
32939        let url = params.parse_with_url(&url);
32940
32941        loop {
32942            let token = match self
32943                .hub
32944                .auth
32945                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32946                .await
32947            {
32948                Ok(token) => token,
32949                Err(e) => match dlg.token(e) {
32950                    Ok(token) => token,
32951                    Err(e) => {
32952                        dlg.finished(false);
32953                        return Err(common::Error::MissingToken(e));
32954                    }
32955                },
32956            };
32957            let mut req_result = {
32958                let client = &self.hub.client;
32959                dlg.pre_request();
32960                let mut req_builder = hyper::Request::builder()
32961                    .method(hyper::Method::GET)
32962                    .uri(url.as_str())
32963                    .header(USER_AGENT, self.hub._user_agent.clone());
32964
32965                if let Some(token) = token.as_ref() {
32966                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32967                }
32968
32969                let request = req_builder
32970                    .header(CONTENT_LENGTH, 0_u64)
32971                    .body(common::to_body::<String>(None));
32972
32973                client.request(request.unwrap()).await
32974            };
32975
32976            match req_result {
32977                Err(err) => {
32978                    if let common::Retry::After(d) = dlg.http_error(&err) {
32979                        sleep(d).await;
32980                        continue;
32981                    }
32982                    dlg.finished(false);
32983                    return Err(common::Error::HttpError(err));
32984                }
32985                Ok(res) => {
32986                    let (mut parts, body) = res.into_parts();
32987                    let mut body = common::Body::new(body);
32988                    if !parts.status.is_success() {
32989                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32990                        let error = serde_json::from_str(&common::to_string(&bytes));
32991                        let response = common::to_response(parts, bytes.into());
32992
32993                        if let common::Retry::After(d) =
32994                            dlg.http_failure(&response, error.as_ref().ok())
32995                        {
32996                            sleep(d).await;
32997                            continue;
32998                        }
32999
33000                        dlg.finished(false);
33001
33002                        return Err(match error {
33003                            Ok(value) => common::Error::BadRequest(value),
33004                            _ => common::Error::Failure(response),
33005                        });
33006                    }
33007                    let response = {
33008                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33009                        let encoded = common::to_string(&bytes);
33010                        match serde_json::from_str(&encoded) {
33011                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33012                            Err(error) => {
33013                                dlg.response_json_decode_error(&encoded, &error);
33014                                return Err(common::Error::JsonDecodeError(
33015                                    encoded.to_string(),
33016                                    error,
33017                                ));
33018                            }
33019                        }
33020                    };
33021
33022                    dlg.finished(true);
33023                    return Ok(response);
33024                }
33025            }
33026        }
33027    }
33028
33029    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
33030    ///
33031    /// Sets the *resource id* path property to the given value.
33032    ///
33033    /// Even though the property as already been set when instantiating this call,
33034    /// we provide this method for API completeness.
33035    pub fn resource_id(mut self, new_value: &str) -> OfferobjectGetCall<'a, C> {
33036        self._resource_id = new_value.to_string();
33037        self
33038    }
33039    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33040    /// while executing the actual API request.
33041    ///
33042    /// ````text
33043    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33044    /// ````
33045    ///
33046    /// Sets the *delegate* property to the given value.
33047    pub fn delegate(
33048        mut self,
33049        new_value: &'a mut dyn common::Delegate,
33050    ) -> OfferobjectGetCall<'a, C> {
33051        self._delegate = Some(new_value);
33052        self
33053    }
33054
33055    /// Set any additional parameter of the query string used in the request.
33056    /// It should be used to set parameters which are not yet available through their own
33057    /// setters.
33058    ///
33059    /// Please note that this method must not be used to set any of the known parameters
33060    /// which have their own setter method. If done anyway, the request will fail.
33061    ///
33062    /// # Additional Parameters
33063    ///
33064    /// * *$.xgafv* (query-string) - V1 error format.
33065    /// * *access_token* (query-string) - OAuth access token.
33066    /// * *alt* (query-string) - Data format for response.
33067    /// * *callback* (query-string) - JSONP
33068    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33069    /// * *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.
33070    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33071    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33072    /// * *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.
33073    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33074    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33075    pub fn param<T>(mut self, name: T, value: T) -> OfferobjectGetCall<'a, C>
33076    where
33077        T: AsRef<str>,
33078    {
33079        self._additional_params
33080            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33081        self
33082    }
33083
33084    /// Identifies the authorization scope for the method you are building.
33085    ///
33086    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33087    /// [`Scope::WalletObjectIssuer`].
33088    ///
33089    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33090    /// tokens for more than one scope.
33091    ///
33092    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33093    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33094    /// sufficient, a read-write scope will do as well.
33095    pub fn add_scope<St>(mut self, scope: St) -> OfferobjectGetCall<'a, C>
33096    where
33097        St: AsRef<str>,
33098    {
33099        self._scopes.insert(String::from(scope.as_ref()));
33100        self
33101    }
33102    /// Identifies the authorization scope(s) for the method you are building.
33103    ///
33104    /// See [`Self::add_scope()`] for details.
33105    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectGetCall<'a, C>
33106    where
33107        I: IntoIterator<Item = St>,
33108        St: AsRef<str>,
33109    {
33110        self._scopes
33111            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33112        self
33113    }
33114
33115    /// Removes all scopes, and no default scope will be used either.
33116    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33117    /// for details).
33118    pub fn clear_scopes(mut self) -> OfferobjectGetCall<'a, C> {
33119        self._scopes.clear();
33120        self
33121    }
33122}
33123
33124/// Inserts an offer object with the given ID and properties.
33125///
33126/// A builder for the *insert* method supported by a *offerobject* resource.
33127/// It is not used directly, but through a [`OfferobjectMethods`] instance.
33128///
33129/// # Example
33130///
33131/// Instantiate a resource method builder
33132///
33133/// ```test_harness,no_run
33134/// # extern crate hyper;
33135/// # extern crate hyper_rustls;
33136/// # extern crate google_walletobjects1 as walletobjects1;
33137/// use walletobjects1::api::OfferObject;
33138/// # async fn dox() {
33139/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33140///
33141/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33142/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33143/// #     .with_native_roots()
33144/// #     .unwrap()
33145/// #     .https_only()
33146/// #     .enable_http2()
33147/// #     .build();
33148///
33149/// # let executor = hyper_util::rt::TokioExecutor::new();
33150/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33151/// #     secret,
33152/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33153/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
33154/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
33155/// #     ),
33156/// # ).build().await.unwrap();
33157///
33158/// # let client = hyper_util::client::legacy::Client::builder(
33159/// #     hyper_util::rt::TokioExecutor::new()
33160/// # )
33161/// # .build(
33162/// #     hyper_rustls::HttpsConnectorBuilder::new()
33163/// #         .with_native_roots()
33164/// #         .unwrap()
33165/// #         .https_or_http()
33166/// #         .enable_http2()
33167/// #         .build()
33168/// # );
33169/// # let mut hub = Walletobjects::new(client, auth);
33170/// // As the method needs a request, you would usually fill it with the desired information
33171/// // into the respective structure. Some of the parts shown here might not be applicable !
33172/// // Values shown here are possibly random and not representative !
33173/// let mut req = OfferObject::default();
33174///
33175/// // You can configure optional parameters by calling the respective setters at will, and
33176/// // execute the final call using `doit()`.
33177/// // Values shown here are possibly random and not representative !
33178/// let result = hub.offerobject().insert(req)
33179///              .doit().await;
33180/// # }
33181/// ```
33182pub struct OfferobjectInsertCall<'a, C>
33183where
33184    C: 'a,
33185{
33186    hub: &'a Walletobjects<C>,
33187    _request: OfferObject,
33188    _delegate: Option<&'a mut dyn common::Delegate>,
33189    _additional_params: HashMap<String, String>,
33190    _scopes: BTreeSet<String>,
33191}
33192
33193impl<'a, C> common::CallBuilder for OfferobjectInsertCall<'a, C> {}
33194
33195impl<'a, C> OfferobjectInsertCall<'a, C>
33196where
33197    C: common::Connector,
33198{
33199    /// Perform the operation you have build so far.
33200    pub async fn doit(mut self) -> common::Result<(common::Response, OfferObject)> {
33201        use std::borrow::Cow;
33202        use std::io::{Read, Seek};
33203
33204        use common::{url::Params, ToParts};
33205        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33206
33207        let mut dd = common::DefaultDelegate;
33208        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33209        dlg.begin(common::MethodInfo {
33210            id: "walletobjects.offerobject.insert",
33211            http_method: hyper::Method::POST,
33212        });
33213
33214        for &field in ["alt"].iter() {
33215            if self._additional_params.contains_key(field) {
33216                dlg.finished(false);
33217                return Err(common::Error::FieldClash(field));
33218            }
33219        }
33220
33221        let mut params = Params::with_capacity(3 + self._additional_params.len());
33222
33223        params.extend(self._additional_params.iter());
33224
33225        params.push("alt", "json");
33226        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject";
33227        if self._scopes.is_empty() {
33228            self._scopes
33229                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
33230        }
33231
33232        let url = params.parse_with_url(&url);
33233
33234        let mut json_mime_type = mime::APPLICATION_JSON;
33235        let mut request_value_reader = {
33236            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33237            common::remove_json_null_values(&mut value);
33238            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33239            serde_json::to_writer(&mut dst, &value).unwrap();
33240            dst
33241        };
33242        let request_size = request_value_reader
33243            .seek(std::io::SeekFrom::End(0))
33244            .unwrap();
33245        request_value_reader
33246            .seek(std::io::SeekFrom::Start(0))
33247            .unwrap();
33248
33249        loop {
33250            let token = match self
33251                .hub
33252                .auth
33253                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33254                .await
33255            {
33256                Ok(token) => token,
33257                Err(e) => match dlg.token(e) {
33258                    Ok(token) => token,
33259                    Err(e) => {
33260                        dlg.finished(false);
33261                        return Err(common::Error::MissingToken(e));
33262                    }
33263                },
33264            };
33265            request_value_reader
33266                .seek(std::io::SeekFrom::Start(0))
33267                .unwrap();
33268            let mut req_result = {
33269                let client = &self.hub.client;
33270                dlg.pre_request();
33271                let mut req_builder = hyper::Request::builder()
33272                    .method(hyper::Method::POST)
33273                    .uri(url.as_str())
33274                    .header(USER_AGENT, self.hub._user_agent.clone());
33275
33276                if let Some(token) = token.as_ref() {
33277                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33278                }
33279
33280                let request = req_builder
33281                    .header(CONTENT_TYPE, json_mime_type.to_string())
33282                    .header(CONTENT_LENGTH, request_size as u64)
33283                    .body(common::to_body(
33284                        request_value_reader.get_ref().clone().into(),
33285                    ));
33286
33287                client.request(request.unwrap()).await
33288            };
33289
33290            match req_result {
33291                Err(err) => {
33292                    if let common::Retry::After(d) = dlg.http_error(&err) {
33293                        sleep(d).await;
33294                        continue;
33295                    }
33296                    dlg.finished(false);
33297                    return Err(common::Error::HttpError(err));
33298                }
33299                Ok(res) => {
33300                    let (mut parts, body) = res.into_parts();
33301                    let mut body = common::Body::new(body);
33302                    if !parts.status.is_success() {
33303                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33304                        let error = serde_json::from_str(&common::to_string(&bytes));
33305                        let response = common::to_response(parts, bytes.into());
33306
33307                        if let common::Retry::After(d) =
33308                            dlg.http_failure(&response, error.as_ref().ok())
33309                        {
33310                            sleep(d).await;
33311                            continue;
33312                        }
33313
33314                        dlg.finished(false);
33315
33316                        return Err(match error {
33317                            Ok(value) => common::Error::BadRequest(value),
33318                            _ => common::Error::Failure(response),
33319                        });
33320                    }
33321                    let response = {
33322                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33323                        let encoded = common::to_string(&bytes);
33324                        match serde_json::from_str(&encoded) {
33325                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33326                            Err(error) => {
33327                                dlg.response_json_decode_error(&encoded, &error);
33328                                return Err(common::Error::JsonDecodeError(
33329                                    encoded.to_string(),
33330                                    error,
33331                                ));
33332                            }
33333                        }
33334                    };
33335
33336                    dlg.finished(true);
33337                    return Ok(response);
33338                }
33339            }
33340        }
33341    }
33342
33343    ///
33344    /// Sets the *request* property to the given value.
33345    ///
33346    /// Even though the property as already been set when instantiating this call,
33347    /// we provide this method for API completeness.
33348    pub fn request(mut self, new_value: OfferObject) -> OfferobjectInsertCall<'a, C> {
33349        self._request = new_value;
33350        self
33351    }
33352    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33353    /// while executing the actual API request.
33354    ///
33355    /// ````text
33356    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33357    /// ````
33358    ///
33359    /// Sets the *delegate* property to the given value.
33360    pub fn delegate(
33361        mut self,
33362        new_value: &'a mut dyn common::Delegate,
33363    ) -> OfferobjectInsertCall<'a, C> {
33364        self._delegate = Some(new_value);
33365        self
33366    }
33367
33368    /// Set any additional parameter of the query string used in the request.
33369    /// It should be used to set parameters which are not yet available through their own
33370    /// setters.
33371    ///
33372    /// Please note that this method must not be used to set any of the known parameters
33373    /// which have their own setter method. If done anyway, the request will fail.
33374    ///
33375    /// # Additional Parameters
33376    ///
33377    /// * *$.xgafv* (query-string) - V1 error format.
33378    /// * *access_token* (query-string) - OAuth access token.
33379    /// * *alt* (query-string) - Data format for response.
33380    /// * *callback* (query-string) - JSONP
33381    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33382    /// * *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.
33383    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33384    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33385    /// * *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.
33386    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33387    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33388    pub fn param<T>(mut self, name: T, value: T) -> OfferobjectInsertCall<'a, C>
33389    where
33390        T: AsRef<str>,
33391    {
33392        self._additional_params
33393            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33394        self
33395    }
33396
33397    /// Identifies the authorization scope for the method you are building.
33398    ///
33399    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33400    /// [`Scope::WalletObjectIssuer`].
33401    ///
33402    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33403    /// tokens for more than one scope.
33404    ///
33405    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33406    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33407    /// sufficient, a read-write scope will do as well.
33408    pub fn add_scope<St>(mut self, scope: St) -> OfferobjectInsertCall<'a, C>
33409    where
33410        St: AsRef<str>,
33411    {
33412        self._scopes.insert(String::from(scope.as_ref()));
33413        self
33414    }
33415    /// Identifies the authorization scope(s) for the method you are building.
33416    ///
33417    /// See [`Self::add_scope()`] for details.
33418    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectInsertCall<'a, C>
33419    where
33420        I: IntoIterator<Item = St>,
33421        St: AsRef<str>,
33422    {
33423        self._scopes
33424            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33425        self
33426    }
33427
33428    /// Removes all scopes, and no default scope will be used either.
33429    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33430    /// for details).
33431    pub fn clear_scopes(mut self) -> OfferobjectInsertCall<'a, C> {
33432        self._scopes.clear();
33433        self
33434    }
33435}
33436
33437/// Returns a list of all offer objects for a given issuer ID.
33438///
33439/// A builder for the *list* method supported by a *offerobject* resource.
33440/// It is not used directly, but through a [`OfferobjectMethods`] instance.
33441///
33442/// # Example
33443///
33444/// Instantiate a resource method builder
33445///
33446/// ```test_harness,no_run
33447/// # extern crate hyper;
33448/// # extern crate hyper_rustls;
33449/// # extern crate google_walletobjects1 as walletobjects1;
33450/// # async fn dox() {
33451/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33452///
33453/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33454/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33455/// #     .with_native_roots()
33456/// #     .unwrap()
33457/// #     .https_only()
33458/// #     .enable_http2()
33459/// #     .build();
33460///
33461/// # let executor = hyper_util::rt::TokioExecutor::new();
33462/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33463/// #     secret,
33464/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33465/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
33466/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
33467/// #     ),
33468/// # ).build().await.unwrap();
33469///
33470/// # let client = hyper_util::client::legacy::Client::builder(
33471/// #     hyper_util::rt::TokioExecutor::new()
33472/// # )
33473/// # .build(
33474/// #     hyper_rustls::HttpsConnectorBuilder::new()
33475/// #         .with_native_roots()
33476/// #         .unwrap()
33477/// #         .https_or_http()
33478/// #         .enable_http2()
33479/// #         .build()
33480/// # );
33481/// # let mut hub = Walletobjects::new(client, auth);
33482/// // You can configure optional parameters by calling the respective setters at will, and
33483/// // execute the final call using `doit()`.
33484/// // Values shown here are possibly random and not representative !
33485/// let result = hub.offerobject().list()
33486///              .token("voluptua.")
33487///              .max_results(-34)
33488///              .class_id("dolore")
33489///              .doit().await;
33490/// # }
33491/// ```
33492pub struct OfferobjectListCall<'a, C>
33493where
33494    C: 'a,
33495{
33496    hub: &'a Walletobjects<C>,
33497    _token: Option<String>,
33498    _max_results: Option<i32>,
33499    _class_id: Option<String>,
33500    _delegate: Option<&'a mut dyn common::Delegate>,
33501    _additional_params: HashMap<String, String>,
33502    _scopes: BTreeSet<String>,
33503}
33504
33505impl<'a, C> common::CallBuilder for OfferobjectListCall<'a, C> {}
33506
33507impl<'a, C> OfferobjectListCall<'a, C>
33508where
33509    C: common::Connector,
33510{
33511    /// Perform the operation you have build so far.
33512    pub async fn doit(mut self) -> common::Result<(common::Response, OfferObjectListResponse)> {
33513        use std::borrow::Cow;
33514        use std::io::{Read, Seek};
33515
33516        use common::{url::Params, ToParts};
33517        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33518
33519        let mut dd = common::DefaultDelegate;
33520        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33521        dlg.begin(common::MethodInfo {
33522            id: "walletobjects.offerobject.list",
33523            http_method: hyper::Method::GET,
33524        });
33525
33526        for &field in ["alt", "token", "maxResults", "classId"].iter() {
33527            if self._additional_params.contains_key(field) {
33528                dlg.finished(false);
33529                return Err(common::Error::FieldClash(field));
33530            }
33531        }
33532
33533        let mut params = Params::with_capacity(5 + self._additional_params.len());
33534        if let Some(value) = self._token.as_ref() {
33535            params.push("token", value);
33536        }
33537        if let Some(value) = self._max_results.as_ref() {
33538            params.push("maxResults", value.to_string());
33539        }
33540        if let Some(value) = self._class_id.as_ref() {
33541            params.push("classId", value);
33542        }
33543
33544        params.extend(self._additional_params.iter());
33545
33546        params.push("alt", "json");
33547        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject";
33548        if self._scopes.is_empty() {
33549            self._scopes
33550                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
33551        }
33552
33553        let url = params.parse_with_url(&url);
33554
33555        loop {
33556            let token = match self
33557                .hub
33558                .auth
33559                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33560                .await
33561            {
33562                Ok(token) => token,
33563                Err(e) => match dlg.token(e) {
33564                    Ok(token) => token,
33565                    Err(e) => {
33566                        dlg.finished(false);
33567                        return Err(common::Error::MissingToken(e));
33568                    }
33569                },
33570            };
33571            let mut req_result = {
33572                let client = &self.hub.client;
33573                dlg.pre_request();
33574                let mut req_builder = hyper::Request::builder()
33575                    .method(hyper::Method::GET)
33576                    .uri(url.as_str())
33577                    .header(USER_AGENT, self.hub._user_agent.clone());
33578
33579                if let Some(token) = token.as_ref() {
33580                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33581                }
33582
33583                let request = req_builder
33584                    .header(CONTENT_LENGTH, 0_u64)
33585                    .body(common::to_body::<String>(None));
33586
33587                client.request(request.unwrap()).await
33588            };
33589
33590            match req_result {
33591                Err(err) => {
33592                    if let common::Retry::After(d) = dlg.http_error(&err) {
33593                        sleep(d).await;
33594                        continue;
33595                    }
33596                    dlg.finished(false);
33597                    return Err(common::Error::HttpError(err));
33598                }
33599                Ok(res) => {
33600                    let (mut parts, body) = res.into_parts();
33601                    let mut body = common::Body::new(body);
33602                    if !parts.status.is_success() {
33603                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33604                        let error = serde_json::from_str(&common::to_string(&bytes));
33605                        let response = common::to_response(parts, bytes.into());
33606
33607                        if let common::Retry::After(d) =
33608                            dlg.http_failure(&response, error.as_ref().ok())
33609                        {
33610                            sleep(d).await;
33611                            continue;
33612                        }
33613
33614                        dlg.finished(false);
33615
33616                        return Err(match error {
33617                            Ok(value) => common::Error::BadRequest(value),
33618                            _ => common::Error::Failure(response),
33619                        });
33620                    }
33621                    let response = {
33622                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33623                        let encoded = common::to_string(&bytes);
33624                        match serde_json::from_str(&encoded) {
33625                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33626                            Err(error) => {
33627                                dlg.response_json_decode_error(&encoded, &error);
33628                                return Err(common::Error::JsonDecodeError(
33629                                    encoded.to_string(),
33630                                    error,
33631                                ));
33632                            }
33633                        }
33634                    };
33635
33636                    dlg.finished(true);
33637                    return Ok(response);
33638                }
33639            }
33640        }
33641    }
33642
33643    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` objects are available in a list. For example, if you have a list of 200 objects and you call list with `maxResults` set to 20, list will return the first 20 objects and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 objects.
33644    ///
33645    /// Sets the *token* query property to the given value.
33646    pub fn token(mut self, new_value: &str) -> OfferobjectListCall<'a, C> {
33647        self._token = Some(new_value.to_string());
33648        self
33649    }
33650    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
33651    ///
33652    /// Sets the *max results* query property to the given value.
33653    pub fn max_results(mut self, new_value: i32) -> OfferobjectListCall<'a, C> {
33654        self._max_results = Some(new_value);
33655        self
33656    }
33657    /// The ID of the class whose objects will be listed.
33658    ///
33659    /// Sets the *class id* query property to the given value.
33660    pub fn class_id(mut self, new_value: &str) -> OfferobjectListCall<'a, C> {
33661        self._class_id = Some(new_value.to_string());
33662        self
33663    }
33664    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33665    /// while executing the actual API request.
33666    ///
33667    /// ````text
33668    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33669    /// ````
33670    ///
33671    /// Sets the *delegate* property to the given value.
33672    pub fn delegate(
33673        mut self,
33674        new_value: &'a mut dyn common::Delegate,
33675    ) -> OfferobjectListCall<'a, C> {
33676        self._delegate = Some(new_value);
33677        self
33678    }
33679
33680    /// Set any additional parameter of the query string used in the request.
33681    /// It should be used to set parameters which are not yet available through their own
33682    /// setters.
33683    ///
33684    /// Please note that this method must not be used to set any of the known parameters
33685    /// which have their own setter method. If done anyway, the request will fail.
33686    ///
33687    /// # Additional Parameters
33688    ///
33689    /// * *$.xgafv* (query-string) - V1 error format.
33690    /// * *access_token* (query-string) - OAuth access token.
33691    /// * *alt* (query-string) - Data format for response.
33692    /// * *callback* (query-string) - JSONP
33693    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33694    /// * *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.
33695    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33696    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33697    /// * *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.
33698    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33699    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33700    pub fn param<T>(mut self, name: T, value: T) -> OfferobjectListCall<'a, C>
33701    where
33702        T: AsRef<str>,
33703    {
33704        self._additional_params
33705            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33706        self
33707    }
33708
33709    /// Identifies the authorization scope for the method you are building.
33710    ///
33711    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33712    /// [`Scope::WalletObjectIssuer`].
33713    ///
33714    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33715    /// tokens for more than one scope.
33716    ///
33717    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33718    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33719    /// sufficient, a read-write scope will do as well.
33720    pub fn add_scope<St>(mut self, scope: St) -> OfferobjectListCall<'a, C>
33721    where
33722        St: AsRef<str>,
33723    {
33724        self._scopes.insert(String::from(scope.as_ref()));
33725        self
33726    }
33727    /// Identifies the authorization scope(s) for the method you are building.
33728    ///
33729    /// See [`Self::add_scope()`] for details.
33730    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectListCall<'a, C>
33731    where
33732        I: IntoIterator<Item = St>,
33733        St: AsRef<str>,
33734    {
33735        self._scopes
33736            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33737        self
33738    }
33739
33740    /// Removes all scopes, and no default scope will be used either.
33741    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33742    /// for details).
33743    pub fn clear_scopes(mut self) -> OfferobjectListCall<'a, C> {
33744        self._scopes.clear();
33745        self
33746    }
33747}
33748
33749/// Updates the offer object referenced by the given object ID. This method supports patch semantics.
33750///
33751/// A builder for the *patch* method supported by a *offerobject* resource.
33752/// It is not used directly, but through a [`OfferobjectMethods`] instance.
33753///
33754/// # Example
33755///
33756/// Instantiate a resource method builder
33757///
33758/// ```test_harness,no_run
33759/// # extern crate hyper;
33760/// # extern crate hyper_rustls;
33761/// # extern crate google_walletobjects1 as walletobjects1;
33762/// use walletobjects1::api::OfferObject;
33763/// # async fn dox() {
33764/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33765///
33766/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33767/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33768/// #     .with_native_roots()
33769/// #     .unwrap()
33770/// #     .https_only()
33771/// #     .enable_http2()
33772/// #     .build();
33773///
33774/// # let executor = hyper_util::rt::TokioExecutor::new();
33775/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33776/// #     secret,
33777/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33778/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
33779/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
33780/// #     ),
33781/// # ).build().await.unwrap();
33782///
33783/// # let client = hyper_util::client::legacy::Client::builder(
33784/// #     hyper_util::rt::TokioExecutor::new()
33785/// # )
33786/// # .build(
33787/// #     hyper_rustls::HttpsConnectorBuilder::new()
33788/// #         .with_native_roots()
33789/// #         .unwrap()
33790/// #         .https_or_http()
33791/// #         .enable_http2()
33792/// #         .build()
33793/// # );
33794/// # let mut hub = Walletobjects::new(client, auth);
33795/// // As the method needs a request, you would usually fill it with the desired information
33796/// // into the respective structure. Some of the parts shown here might not be applicable !
33797/// // Values shown here are possibly random and not representative !
33798/// let mut req = OfferObject::default();
33799///
33800/// // You can configure optional parameters by calling the respective setters at will, and
33801/// // execute the final call using `doit()`.
33802/// // Values shown here are possibly random and not representative !
33803/// let result = hub.offerobject().patch(req, "resourceId")
33804///              .doit().await;
33805/// # }
33806/// ```
33807pub struct OfferobjectPatchCall<'a, C>
33808where
33809    C: 'a,
33810{
33811    hub: &'a Walletobjects<C>,
33812    _request: OfferObject,
33813    _resource_id: String,
33814    _delegate: Option<&'a mut dyn common::Delegate>,
33815    _additional_params: HashMap<String, String>,
33816    _scopes: BTreeSet<String>,
33817}
33818
33819impl<'a, C> common::CallBuilder for OfferobjectPatchCall<'a, C> {}
33820
33821impl<'a, C> OfferobjectPatchCall<'a, C>
33822where
33823    C: common::Connector,
33824{
33825    /// Perform the operation you have build so far.
33826    pub async fn doit(mut self) -> common::Result<(common::Response, OfferObject)> {
33827        use std::borrow::Cow;
33828        use std::io::{Read, Seek};
33829
33830        use common::{url::Params, ToParts};
33831        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33832
33833        let mut dd = common::DefaultDelegate;
33834        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33835        dlg.begin(common::MethodInfo {
33836            id: "walletobjects.offerobject.patch",
33837            http_method: hyper::Method::PATCH,
33838        });
33839
33840        for &field in ["alt", "resourceId"].iter() {
33841            if self._additional_params.contains_key(field) {
33842                dlg.finished(false);
33843                return Err(common::Error::FieldClash(field));
33844            }
33845        }
33846
33847        let mut params = Params::with_capacity(4 + self._additional_params.len());
33848        params.push("resourceId", self._resource_id);
33849
33850        params.extend(self._additional_params.iter());
33851
33852        params.push("alt", "json");
33853        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject/{resourceId}";
33854        if self._scopes.is_empty() {
33855            self._scopes
33856                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
33857        }
33858
33859        #[allow(clippy::single_element_loop)]
33860        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
33861            url = params.uri_replacement(url, param_name, find_this, false);
33862        }
33863        {
33864            let to_remove = ["resourceId"];
33865            params.remove_params(&to_remove);
33866        }
33867
33868        let url = params.parse_with_url(&url);
33869
33870        let mut json_mime_type = mime::APPLICATION_JSON;
33871        let mut request_value_reader = {
33872            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33873            common::remove_json_null_values(&mut value);
33874            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33875            serde_json::to_writer(&mut dst, &value).unwrap();
33876            dst
33877        };
33878        let request_size = request_value_reader
33879            .seek(std::io::SeekFrom::End(0))
33880            .unwrap();
33881        request_value_reader
33882            .seek(std::io::SeekFrom::Start(0))
33883            .unwrap();
33884
33885        loop {
33886            let token = match self
33887                .hub
33888                .auth
33889                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33890                .await
33891            {
33892                Ok(token) => token,
33893                Err(e) => match dlg.token(e) {
33894                    Ok(token) => token,
33895                    Err(e) => {
33896                        dlg.finished(false);
33897                        return Err(common::Error::MissingToken(e));
33898                    }
33899                },
33900            };
33901            request_value_reader
33902                .seek(std::io::SeekFrom::Start(0))
33903                .unwrap();
33904            let mut req_result = {
33905                let client = &self.hub.client;
33906                dlg.pre_request();
33907                let mut req_builder = hyper::Request::builder()
33908                    .method(hyper::Method::PATCH)
33909                    .uri(url.as_str())
33910                    .header(USER_AGENT, self.hub._user_agent.clone());
33911
33912                if let Some(token) = token.as_ref() {
33913                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33914                }
33915
33916                let request = req_builder
33917                    .header(CONTENT_TYPE, json_mime_type.to_string())
33918                    .header(CONTENT_LENGTH, request_size as u64)
33919                    .body(common::to_body(
33920                        request_value_reader.get_ref().clone().into(),
33921                    ));
33922
33923                client.request(request.unwrap()).await
33924            };
33925
33926            match req_result {
33927                Err(err) => {
33928                    if let common::Retry::After(d) = dlg.http_error(&err) {
33929                        sleep(d).await;
33930                        continue;
33931                    }
33932                    dlg.finished(false);
33933                    return Err(common::Error::HttpError(err));
33934                }
33935                Ok(res) => {
33936                    let (mut parts, body) = res.into_parts();
33937                    let mut body = common::Body::new(body);
33938                    if !parts.status.is_success() {
33939                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33940                        let error = serde_json::from_str(&common::to_string(&bytes));
33941                        let response = common::to_response(parts, bytes.into());
33942
33943                        if let common::Retry::After(d) =
33944                            dlg.http_failure(&response, error.as_ref().ok())
33945                        {
33946                            sleep(d).await;
33947                            continue;
33948                        }
33949
33950                        dlg.finished(false);
33951
33952                        return Err(match error {
33953                            Ok(value) => common::Error::BadRequest(value),
33954                            _ => common::Error::Failure(response),
33955                        });
33956                    }
33957                    let response = {
33958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33959                        let encoded = common::to_string(&bytes);
33960                        match serde_json::from_str(&encoded) {
33961                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33962                            Err(error) => {
33963                                dlg.response_json_decode_error(&encoded, &error);
33964                                return Err(common::Error::JsonDecodeError(
33965                                    encoded.to_string(),
33966                                    error,
33967                                ));
33968                            }
33969                        }
33970                    };
33971
33972                    dlg.finished(true);
33973                    return Ok(response);
33974                }
33975            }
33976        }
33977    }
33978
33979    ///
33980    /// Sets the *request* property to the given value.
33981    ///
33982    /// Even though the property as already been set when instantiating this call,
33983    /// we provide this method for API completeness.
33984    pub fn request(mut self, new_value: OfferObject) -> OfferobjectPatchCall<'a, C> {
33985        self._request = new_value;
33986        self
33987    }
33988    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
33989    ///
33990    /// Sets the *resource id* path property to the given value.
33991    ///
33992    /// Even though the property as already been set when instantiating this call,
33993    /// we provide this method for API completeness.
33994    pub fn resource_id(mut self, new_value: &str) -> OfferobjectPatchCall<'a, C> {
33995        self._resource_id = new_value.to_string();
33996        self
33997    }
33998    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33999    /// while executing the actual API request.
34000    ///
34001    /// ````text
34002    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34003    /// ````
34004    ///
34005    /// Sets the *delegate* property to the given value.
34006    pub fn delegate(
34007        mut self,
34008        new_value: &'a mut dyn common::Delegate,
34009    ) -> OfferobjectPatchCall<'a, C> {
34010        self._delegate = Some(new_value);
34011        self
34012    }
34013
34014    /// Set any additional parameter of the query string used in the request.
34015    /// It should be used to set parameters which are not yet available through their own
34016    /// setters.
34017    ///
34018    /// Please note that this method must not be used to set any of the known parameters
34019    /// which have their own setter method. If done anyway, the request will fail.
34020    ///
34021    /// # Additional Parameters
34022    ///
34023    /// * *$.xgafv* (query-string) - V1 error format.
34024    /// * *access_token* (query-string) - OAuth access token.
34025    /// * *alt* (query-string) - Data format for response.
34026    /// * *callback* (query-string) - JSONP
34027    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34028    /// * *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.
34029    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34030    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34031    /// * *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.
34032    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34033    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34034    pub fn param<T>(mut self, name: T, value: T) -> OfferobjectPatchCall<'a, C>
34035    where
34036        T: AsRef<str>,
34037    {
34038        self._additional_params
34039            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34040        self
34041    }
34042
34043    /// Identifies the authorization scope for the method you are building.
34044    ///
34045    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34046    /// [`Scope::WalletObjectIssuer`].
34047    ///
34048    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34049    /// tokens for more than one scope.
34050    ///
34051    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34052    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34053    /// sufficient, a read-write scope will do as well.
34054    pub fn add_scope<St>(mut self, scope: St) -> OfferobjectPatchCall<'a, C>
34055    where
34056        St: AsRef<str>,
34057    {
34058        self._scopes.insert(String::from(scope.as_ref()));
34059        self
34060    }
34061    /// Identifies the authorization scope(s) for the method you are building.
34062    ///
34063    /// See [`Self::add_scope()`] for details.
34064    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectPatchCall<'a, C>
34065    where
34066        I: IntoIterator<Item = St>,
34067        St: AsRef<str>,
34068    {
34069        self._scopes
34070            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34071        self
34072    }
34073
34074    /// Removes all scopes, and no default scope will be used either.
34075    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34076    /// for details).
34077    pub fn clear_scopes(mut self) -> OfferobjectPatchCall<'a, C> {
34078        self._scopes.clear();
34079        self
34080    }
34081}
34082
34083/// Updates the offer object referenced by the given object ID.
34084///
34085/// A builder for the *update* method supported by a *offerobject* resource.
34086/// It is not used directly, but through a [`OfferobjectMethods`] instance.
34087///
34088/// # Example
34089///
34090/// Instantiate a resource method builder
34091///
34092/// ```test_harness,no_run
34093/// # extern crate hyper;
34094/// # extern crate hyper_rustls;
34095/// # extern crate google_walletobjects1 as walletobjects1;
34096/// use walletobjects1::api::OfferObject;
34097/// # async fn dox() {
34098/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34099///
34100/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34101/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34102/// #     .with_native_roots()
34103/// #     .unwrap()
34104/// #     .https_only()
34105/// #     .enable_http2()
34106/// #     .build();
34107///
34108/// # let executor = hyper_util::rt::TokioExecutor::new();
34109/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34110/// #     secret,
34111/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34112/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
34113/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
34114/// #     ),
34115/// # ).build().await.unwrap();
34116///
34117/// # let client = hyper_util::client::legacy::Client::builder(
34118/// #     hyper_util::rt::TokioExecutor::new()
34119/// # )
34120/// # .build(
34121/// #     hyper_rustls::HttpsConnectorBuilder::new()
34122/// #         .with_native_roots()
34123/// #         .unwrap()
34124/// #         .https_or_http()
34125/// #         .enable_http2()
34126/// #         .build()
34127/// # );
34128/// # let mut hub = Walletobjects::new(client, auth);
34129/// // As the method needs a request, you would usually fill it with the desired information
34130/// // into the respective structure. Some of the parts shown here might not be applicable !
34131/// // Values shown here are possibly random and not representative !
34132/// let mut req = OfferObject::default();
34133///
34134/// // You can configure optional parameters by calling the respective setters at will, and
34135/// // execute the final call using `doit()`.
34136/// // Values shown here are possibly random and not representative !
34137/// let result = hub.offerobject().update(req, "resourceId")
34138///              .doit().await;
34139/// # }
34140/// ```
34141pub struct OfferobjectUpdateCall<'a, C>
34142where
34143    C: 'a,
34144{
34145    hub: &'a Walletobjects<C>,
34146    _request: OfferObject,
34147    _resource_id: String,
34148    _delegate: Option<&'a mut dyn common::Delegate>,
34149    _additional_params: HashMap<String, String>,
34150    _scopes: BTreeSet<String>,
34151}
34152
34153impl<'a, C> common::CallBuilder for OfferobjectUpdateCall<'a, C> {}
34154
34155impl<'a, C> OfferobjectUpdateCall<'a, C>
34156where
34157    C: common::Connector,
34158{
34159    /// Perform the operation you have build so far.
34160    pub async fn doit(mut self) -> common::Result<(common::Response, OfferObject)> {
34161        use std::borrow::Cow;
34162        use std::io::{Read, Seek};
34163
34164        use common::{url::Params, ToParts};
34165        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34166
34167        let mut dd = common::DefaultDelegate;
34168        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34169        dlg.begin(common::MethodInfo {
34170            id: "walletobjects.offerobject.update",
34171            http_method: hyper::Method::PUT,
34172        });
34173
34174        for &field in ["alt", "resourceId"].iter() {
34175            if self._additional_params.contains_key(field) {
34176                dlg.finished(false);
34177                return Err(common::Error::FieldClash(field));
34178            }
34179        }
34180
34181        let mut params = Params::with_capacity(4 + self._additional_params.len());
34182        params.push("resourceId", self._resource_id);
34183
34184        params.extend(self._additional_params.iter());
34185
34186        params.push("alt", "json");
34187        let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject/{resourceId}";
34188        if self._scopes.is_empty() {
34189            self._scopes
34190                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
34191        }
34192
34193        #[allow(clippy::single_element_loop)]
34194        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
34195            url = params.uri_replacement(url, param_name, find_this, false);
34196        }
34197        {
34198            let to_remove = ["resourceId"];
34199            params.remove_params(&to_remove);
34200        }
34201
34202        let url = params.parse_with_url(&url);
34203
34204        let mut json_mime_type = mime::APPLICATION_JSON;
34205        let mut request_value_reader = {
34206            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34207            common::remove_json_null_values(&mut value);
34208            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34209            serde_json::to_writer(&mut dst, &value).unwrap();
34210            dst
34211        };
34212        let request_size = request_value_reader
34213            .seek(std::io::SeekFrom::End(0))
34214            .unwrap();
34215        request_value_reader
34216            .seek(std::io::SeekFrom::Start(0))
34217            .unwrap();
34218
34219        loop {
34220            let token = match self
34221                .hub
34222                .auth
34223                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34224                .await
34225            {
34226                Ok(token) => token,
34227                Err(e) => match dlg.token(e) {
34228                    Ok(token) => token,
34229                    Err(e) => {
34230                        dlg.finished(false);
34231                        return Err(common::Error::MissingToken(e));
34232                    }
34233                },
34234            };
34235            request_value_reader
34236                .seek(std::io::SeekFrom::Start(0))
34237                .unwrap();
34238            let mut req_result = {
34239                let client = &self.hub.client;
34240                dlg.pre_request();
34241                let mut req_builder = hyper::Request::builder()
34242                    .method(hyper::Method::PUT)
34243                    .uri(url.as_str())
34244                    .header(USER_AGENT, self.hub._user_agent.clone());
34245
34246                if let Some(token) = token.as_ref() {
34247                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34248                }
34249
34250                let request = req_builder
34251                    .header(CONTENT_TYPE, json_mime_type.to_string())
34252                    .header(CONTENT_LENGTH, request_size as u64)
34253                    .body(common::to_body(
34254                        request_value_reader.get_ref().clone().into(),
34255                    ));
34256
34257                client.request(request.unwrap()).await
34258            };
34259
34260            match req_result {
34261                Err(err) => {
34262                    if let common::Retry::After(d) = dlg.http_error(&err) {
34263                        sleep(d).await;
34264                        continue;
34265                    }
34266                    dlg.finished(false);
34267                    return Err(common::Error::HttpError(err));
34268                }
34269                Ok(res) => {
34270                    let (mut parts, body) = res.into_parts();
34271                    let mut body = common::Body::new(body);
34272                    if !parts.status.is_success() {
34273                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34274                        let error = serde_json::from_str(&common::to_string(&bytes));
34275                        let response = common::to_response(parts, bytes.into());
34276
34277                        if let common::Retry::After(d) =
34278                            dlg.http_failure(&response, error.as_ref().ok())
34279                        {
34280                            sleep(d).await;
34281                            continue;
34282                        }
34283
34284                        dlg.finished(false);
34285
34286                        return Err(match error {
34287                            Ok(value) => common::Error::BadRequest(value),
34288                            _ => common::Error::Failure(response),
34289                        });
34290                    }
34291                    let response = {
34292                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34293                        let encoded = common::to_string(&bytes);
34294                        match serde_json::from_str(&encoded) {
34295                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34296                            Err(error) => {
34297                                dlg.response_json_decode_error(&encoded, &error);
34298                                return Err(common::Error::JsonDecodeError(
34299                                    encoded.to_string(),
34300                                    error,
34301                                ));
34302                            }
34303                        }
34304                    };
34305
34306                    dlg.finished(true);
34307                    return Ok(response);
34308                }
34309            }
34310        }
34311    }
34312
34313    ///
34314    /// Sets the *request* property to the given value.
34315    ///
34316    /// Even though the property as already been set when instantiating this call,
34317    /// we provide this method for API completeness.
34318    pub fn request(mut self, new_value: OfferObject) -> OfferobjectUpdateCall<'a, C> {
34319        self._request = new_value;
34320        self
34321    }
34322    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
34323    ///
34324    /// Sets the *resource id* path property to the given value.
34325    ///
34326    /// Even though the property as already been set when instantiating this call,
34327    /// we provide this method for API completeness.
34328    pub fn resource_id(mut self, new_value: &str) -> OfferobjectUpdateCall<'a, C> {
34329        self._resource_id = new_value.to_string();
34330        self
34331    }
34332    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34333    /// while executing the actual API request.
34334    ///
34335    /// ````text
34336    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34337    /// ````
34338    ///
34339    /// Sets the *delegate* property to the given value.
34340    pub fn delegate(
34341        mut self,
34342        new_value: &'a mut dyn common::Delegate,
34343    ) -> OfferobjectUpdateCall<'a, C> {
34344        self._delegate = Some(new_value);
34345        self
34346    }
34347
34348    /// Set any additional parameter of the query string used in the request.
34349    /// It should be used to set parameters which are not yet available through their own
34350    /// setters.
34351    ///
34352    /// Please note that this method must not be used to set any of the known parameters
34353    /// which have their own setter method. If done anyway, the request will fail.
34354    ///
34355    /// # Additional Parameters
34356    ///
34357    /// * *$.xgafv* (query-string) - V1 error format.
34358    /// * *access_token* (query-string) - OAuth access token.
34359    /// * *alt* (query-string) - Data format for response.
34360    /// * *callback* (query-string) - JSONP
34361    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34362    /// * *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.
34363    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34364    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34365    /// * *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.
34366    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34367    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34368    pub fn param<T>(mut self, name: T, value: T) -> OfferobjectUpdateCall<'a, C>
34369    where
34370        T: AsRef<str>,
34371    {
34372        self._additional_params
34373            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34374        self
34375    }
34376
34377    /// Identifies the authorization scope for the method you are building.
34378    ///
34379    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34380    /// [`Scope::WalletObjectIssuer`].
34381    ///
34382    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34383    /// tokens for more than one scope.
34384    ///
34385    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34386    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34387    /// sufficient, a read-write scope will do as well.
34388    pub fn add_scope<St>(mut self, scope: St) -> OfferobjectUpdateCall<'a, C>
34389    where
34390        St: AsRef<str>,
34391    {
34392        self._scopes.insert(String::from(scope.as_ref()));
34393        self
34394    }
34395    /// Identifies the authorization scope(s) for the method you are building.
34396    ///
34397    /// See [`Self::add_scope()`] for details.
34398    pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectUpdateCall<'a, C>
34399    where
34400        I: IntoIterator<Item = St>,
34401        St: AsRef<str>,
34402    {
34403        self._scopes
34404            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34405        self
34406    }
34407
34408    /// Removes all scopes, and no default scope will be used either.
34409    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34410    /// for details).
34411    pub fn clear_scopes(mut self) -> OfferobjectUpdateCall<'a, C> {
34412        self._scopes.clear();
34413        self
34414    }
34415}
34416
34417/// Returns the permissions for the given issuer id.
34418///
34419/// A builder for the *get* method supported by a *permission* resource.
34420/// It is not used directly, but through a [`PermissionMethods`] instance.
34421///
34422/// # Example
34423///
34424/// Instantiate a resource method builder
34425///
34426/// ```test_harness,no_run
34427/// # extern crate hyper;
34428/// # extern crate hyper_rustls;
34429/// # extern crate google_walletobjects1 as walletobjects1;
34430/// # async fn dox() {
34431/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34432///
34433/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34434/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34435/// #     .with_native_roots()
34436/// #     .unwrap()
34437/// #     .https_only()
34438/// #     .enable_http2()
34439/// #     .build();
34440///
34441/// # let executor = hyper_util::rt::TokioExecutor::new();
34442/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34443/// #     secret,
34444/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34445/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
34446/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
34447/// #     ),
34448/// # ).build().await.unwrap();
34449///
34450/// # let client = hyper_util::client::legacy::Client::builder(
34451/// #     hyper_util::rt::TokioExecutor::new()
34452/// # )
34453/// # .build(
34454/// #     hyper_rustls::HttpsConnectorBuilder::new()
34455/// #         .with_native_roots()
34456/// #         .unwrap()
34457/// #         .https_or_http()
34458/// #         .enable_http2()
34459/// #         .build()
34460/// # );
34461/// # let mut hub = Walletobjects::new(client, auth);
34462/// // You can configure optional parameters by calling the respective setters at will, and
34463/// // execute the final call using `doit()`.
34464/// // Values shown here are possibly random and not representative !
34465/// let result = hub.permissions().get(-2)
34466///              .doit().await;
34467/// # }
34468/// ```
34469pub struct PermissionGetCall<'a, C>
34470where
34471    C: 'a,
34472{
34473    hub: &'a Walletobjects<C>,
34474    _resource_id: i64,
34475    _delegate: Option<&'a mut dyn common::Delegate>,
34476    _additional_params: HashMap<String, String>,
34477    _scopes: BTreeSet<String>,
34478}
34479
34480impl<'a, C> common::CallBuilder for PermissionGetCall<'a, C> {}
34481
34482impl<'a, C> PermissionGetCall<'a, C>
34483where
34484    C: common::Connector,
34485{
34486    /// Perform the operation you have build so far.
34487    pub async fn doit(mut self) -> common::Result<(common::Response, Permissions)> {
34488        use std::borrow::Cow;
34489        use std::io::{Read, Seek};
34490
34491        use common::{url::Params, ToParts};
34492        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34493
34494        let mut dd = common::DefaultDelegate;
34495        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34496        dlg.begin(common::MethodInfo {
34497            id: "walletobjects.permissions.get",
34498            http_method: hyper::Method::GET,
34499        });
34500
34501        for &field in ["alt", "resourceId"].iter() {
34502            if self._additional_params.contains_key(field) {
34503                dlg.finished(false);
34504                return Err(common::Error::FieldClash(field));
34505            }
34506        }
34507
34508        let mut params = Params::with_capacity(3 + self._additional_params.len());
34509        params.push("resourceId", self._resource_id.to_string());
34510
34511        params.extend(self._additional_params.iter());
34512
34513        params.push("alt", "json");
34514        let mut url = self.hub._base_url.clone() + "walletobjects/v1/permissions/{resourceId}";
34515        if self._scopes.is_empty() {
34516            self._scopes
34517                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
34518        }
34519
34520        #[allow(clippy::single_element_loop)]
34521        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
34522            url = params.uri_replacement(url, param_name, find_this, false);
34523        }
34524        {
34525            let to_remove = ["resourceId"];
34526            params.remove_params(&to_remove);
34527        }
34528
34529        let url = params.parse_with_url(&url);
34530
34531        loop {
34532            let token = match self
34533                .hub
34534                .auth
34535                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34536                .await
34537            {
34538                Ok(token) => token,
34539                Err(e) => match dlg.token(e) {
34540                    Ok(token) => token,
34541                    Err(e) => {
34542                        dlg.finished(false);
34543                        return Err(common::Error::MissingToken(e));
34544                    }
34545                },
34546            };
34547            let mut req_result = {
34548                let client = &self.hub.client;
34549                dlg.pre_request();
34550                let mut req_builder = hyper::Request::builder()
34551                    .method(hyper::Method::GET)
34552                    .uri(url.as_str())
34553                    .header(USER_AGENT, self.hub._user_agent.clone());
34554
34555                if let Some(token) = token.as_ref() {
34556                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34557                }
34558
34559                let request = req_builder
34560                    .header(CONTENT_LENGTH, 0_u64)
34561                    .body(common::to_body::<String>(None));
34562
34563                client.request(request.unwrap()).await
34564            };
34565
34566            match req_result {
34567                Err(err) => {
34568                    if let common::Retry::After(d) = dlg.http_error(&err) {
34569                        sleep(d).await;
34570                        continue;
34571                    }
34572                    dlg.finished(false);
34573                    return Err(common::Error::HttpError(err));
34574                }
34575                Ok(res) => {
34576                    let (mut parts, body) = res.into_parts();
34577                    let mut body = common::Body::new(body);
34578                    if !parts.status.is_success() {
34579                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34580                        let error = serde_json::from_str(&common::to_string(&bytes));
34581                        let response = common::to_response(parts, bytes.into());
34582
34583                        if let common::Retry::After(d) =
34584                            dlg.http_failure(&response, error.as_ref().ok())
34585                        {
34586                            sleep(d).await;
34587                            continue;
34588                        }
34589
34590                        dlg.finished(false);
34591
34592                        return Err(match error {
34593                            Ok(value) => common::Error::BadRequest(value),
34594                            _ => common::Error::Failure(response),
34595                        });
34596                    }
34597                    let response = {
34598                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34599                        let encoded = common::to_string(&bytes);
34600                        match serde_json::from_str(&encoded) {
34601                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34602                            Err(error) => {
34603                                dlg.response_json_decode_error(&encoded, &error);
34604                                return Err(common::Error::JsonDecodeError(
34605                                    encoded.to_string(),
34606                                    error,
34607                                ));
34608                            }
34609                        }
34610                    };
34611
34612                    dlg.finished(true);
34613                    return Ok(response);
34614                }
34615            }
34616        }
34617    }
34618
34619    /// The unique identifier for an issuer. This ID must be unique across all issuers.
34620    ///
34621    /// Sets the *resource id* path property to the given value.
34622    ///
34623    /// Even though the property as already been set when instantiating this call,
34624    /// we provide this method for API completeness.
34625    pub fn resource_id(mut self, new_value: i64) -> PermissionGetCall<'a, C> {
34626        self._resource_id = new_value;
34627        self
34628    }
34629    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34630    /// while executing the actual API request.
34631    ///
34632    /// ````text
34633    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34634    /// ````
34635    ///
34636    /// Sets the *delegate* property to the given value.
34637    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PermissionGetCall<'a, C> {
34638        self._delegate = Some(new_value);
34639        self
34640    }
34641
34642    /// Set any additional parameter of the query string used in the request.
34643    /// It should be used to set parameters which are not yet available through their own
34644    /// setters.
34645    ///
34646    /// Please note that this method must not be used to set any of the known parameters
34647    /// which have their own setter method. If done anyway, the request will fail.
34648    ///
34649    /// # Additional Parameters
34650    ///
34651    /// * *$.xgafv* (query-string) - V1 error format.
34652    /// * *access_token* (query-string) - OAuth access token.
34653    /// * *alt* (query-string) - Data format for response.
34654    /// * *callback* (query-string) - JSONP
34655    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34656    /// * *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.
34657    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34658    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34659    /// * *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.
34660    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34661    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34662    pub fn param<T>(mut self, name: T, value: T) -> PermissionGetCall<'a, C>
34663    where
34664        T: AsRef<str>,
34665    {
34666        self._additional_params
34667            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34668        self
34669    }
34670
34671    /// Identifies the authorization scope for the method you are building.
34672    ///
34673    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34674    /// [`Scope::WalletObjectIssuer`].
34675    ///
34676    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34677    /// tokens for more than one scope.
34678    ///
34679    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34680    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34681    /// sufficient, a read-write scope will do as well.
34682    pub fn add_scope<St>(mut self, scope: St) -> PermissionGetCall<'a, C>
34683    where
34684        St: AsRef<str>,
34685    {
34686        self._scopes.insert(String::from(scope.as_ref()));
34687        self
34688    }
34689    /// Identifies the authorization scope(s) for the method you are building.
34690    ///
34691    /// See [`Self::add_scope()`] for details.
34692    pub fn add_scopes<I, St>(mut self, scopes: I) -> PermissionGetCall<'a, C>
34693    where
34694        I: IntoIterator<Item = St>,
34695        St: AsRef<str>,
34696    {
34697        self._scopes
34698            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34699        self
34700    }
34701
34702    /// Removes all scopes, and no default scope will be used either.
34703    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34704    /// for details).
34705    pub fn clear_scopes(mut self) -> PermissionGetCall<'a, C> {
34706        self._scopes.clear();
34707        self
34708    }
34709}
34710
34711/// Updates the permissions for the given issuer.
34712///
34713/// A builder for the *update* method supported by a *permission* resource.
34714/// It is not used directly, but through a [`PermissionMethods`] instance.
34715///
34716/// # Example
34717///
34718/// Instantiate a resource method builder
34719///
34720/// ```test_harness,no_run
34721/// # extern crate hyper;
34722/// # extern crate hyper_rustls;
34723/// # extern crate google_walletobjects1 as walletobjects1;
34724/// use walletobjects1::api::Permissions;
34725/// # async fn dox() {
34726/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34727///
34728/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34729/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34730/// #     .with_native_roots()
34731/// #     .unwrap()
34732/// #     .https_only()
34733/// #     .enable_http2()
34734/// #     .build();
34735///
34736/// # let executor = hyper_util::rt::TokioExecutor::new();
34737/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34738/// #     secret,
34739/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34740/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
34741/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
34742/// #     ),
34743/// # ).build().await.unwrap();
34744///
34745/// # let client = hyper_util::client::legacy::Client::builder(
34746/// #     hyper_util::rt::TokioExecutor::new()
34747/// # )
34748/// # .build(
34749/// #     hyper_rustls::HttpsConnectorBuilder::new()
34750/// #         .with_native_roots()
34751/// #         .unwrap()
34752/// #         .https_or_http()
34753/// #         .enable_http2()
34754/// #         .build()
34755/// # );
34756/// # let mut hub = Walletobjects::new(client, auth);
34757/// // As the method needs a request, you would usually fill it with the desired information
34758/// // into the respective structure. Some of the parts shown here might not be applicable !
34759/// // Values shown here are possibly random and not representative !
34760/// let mut req = Permissions::default();
34761///
34762/// // You can configure optional parameters by calling the respective setters at will, and
34763/// // execute the final call using `doit()`.
34764/// // Values shown here are possibly random and not representative !
34765/// let result = hub.permissions().update(req, -17)
34766///              .doit().await;
34767/// # }
34768/// ```
34769pub struct PermissionUpdateCall<'a, C>
34770where
34771    C: 'a,
34772{
34773    hub: &'a Walletobjects<C>,
34774    _request: Permissions,
34775    _resource_id: i64,
34776    _delegate: Option<&'a mut dyn common::Delegate>,
34777    _additional_params: HashMap<String, String>,
34778    _scopes: BTreeSet<String>,
34779}
34780
34781impl<'a, C> common::CallBuilder for PermissionUpdateCall<'a, C> {}
34782
34783impl<'a, C> PermissionUpdateCall<'a, C>
34784where
34785    C: common::Connector,
34786{
34787    /// Perform the operation you have build so far.
34788    pub async fn doit(mut self) -> common::Result<(common::Response, Permissions)> {
34789        use std::borrow::Cow;
34790        use std::io::{Read, Seek};
34791
34792        use common::{url::Params, ToParts};
34793        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34794
34795        let mut dd = common::DefaultDelegate;
34796        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34797        dlg.begin(common::MethodInfo {
34798            id: "walletobjects.permissions.update",
34799            http_method: hyper::Method::PUT,
34800        });
34801
34802        for &field in ["alt", "resourceId"].iter() {
34803            if self._additional_params.contains_key(field) {
34804                dlg.finished(false);
34805                return Err(common::Error::FieldClash(field));
34806            }
34807        }
34808
34809        let mut params = Params::with_capacity(4 + self._additional_params.len());
34810        params.push("resourceId", self._resource_id.to_string());
34811
34812        params.extend(self._additional_params.iter());
34813
34814        params.push("alt", "json");
34815        let mut url = self.hub._base_url.clone() + "walletobjects/v1/permissions/{resourceId}";
34816        if self._scopes.is_empty() {
34817            self._scopes
34818                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
34819        }
34820
34821        #[allow(clippy::single_element_loop)]
34822        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
34823            url = params.uri_replacement(url, param_name, find_this, false);
34824        }
34825        {
34826            let to_remove = ["resourceId"];
34827            params.remove_params(&to_remove);
34828        }
34829
34830        let url = params.parse_with_url(&url);
34831
34832        let mut json_mime_type = mime::APPLICATION_JSON;
34833        let mut request_value_reader = {
34834            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34835            common::remove_json_null_values(&mut value);
34836            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34837            serde_json::to_writer(&mut dst, &value).unwrap();
34838            dst
34839        };
34840        let request_size = request_value_reader
34841            .seek(std::io::SeekFrom::End(0))
34842            .unwrap();
34843        request_value_reader
34844            .seek(std::io::SeekFrom::Start(0))
34845            .unwrap();
34846
34847        loop {
34848            let token = match self
34849                .hub
34850                .auth
34851                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34852                .await
34853            {
34854                Ok(token) => token,
34855                Err(e) => match dlg.token(e) {
34856                    Ok(token) => token,
34857                    Err(e) => {
34858                        dlg.finished(false);
34859                        return Err(common::Error::MissingToken(e));
34860                    }
34861                },
34862            };
34863            request_value_reader
34864                .seek(std::io::SeekFrom::Start(0))
34865                .unwrap();
34866            let mut req_result = {
34867                let client = &self.hub.client;
34868                dlg.pre_request();
34869                let mut req_builder = hyper::Request::builder()
34870                    .method(hyper::Method::PUT)
34871                    .uri(url.as_str())
34872                    .header(USER_AGENT, self.hub._user_agent.clone());
34873
34874                if let Some(token) = token.as_ref() {
34875                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34876                }
34877
34878                let request = req_builder
34879                    .header(CONTENT_TYPE, json_mime_type.to_string())
34880                    .header(CONTENT_LENGTH, request_size as u64)
34881                    .body(common::to_body(
34882                        request_value_reader.get_ref().clone().into(),
34883                    ));
34884
34885                client.request(request.unwrap()).await
34886            };
34887
34888            match req_result {
34889                Err(err) => {
34890                    if let common::Retry::After(d) = dlg.http_error(&err) {
34891                        sleep(d).await;
34892                        continue;
34893                    }
34894                    dlg.finished(false);
34895                    return Err(common::Error::HttpError(err));
34896                }
34897                Ok(res) => {
34898                    let (mut parts, body) = res.into_parts();
34899                    let mut body = common::Body::new(body);
34900                    if !parts.status.is_success() {
34901                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34902                        let error = serde_json::from_str(&common::to_string(&bytes));
34903                        let response = common::to_response(parts, bytes.into());
34904
34905                        if let common::Retry::After(d) =
34906                            dlg.http_failure(&response, error.as_ref().ok())
34907                        {
34908                            sleep(d).await;
34909                            continue;
34910                        }
34911
34912                        dlg.finished(false);
34913
34914                        return Err(match error {
34915                            Ok(value) => common::Error::BadRequest(value),
34916                            _ => common::Error::Failure(response),
34917                        });
34918                    }
34919                    let response = {
34920                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34921                        let encoded = common::to_string(&bytes);
34922                        match serde_json::from_str(&encoded) {
34923                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34924                            Err(error) => {
34925                                dlg.response_json_decode_error(&encoded, &error);
34926                                return Err(common::Error::JsonDecodeError(
34927                                    encoded.to_string(),
34928                                    error,
34929                                ));
34930                            }
34931                        }
34932                    };
34933
34934                    dlg.finished(true);
34935                    return Ok(response);
34936                }
34937            }
34938        }
34939    }
34940
34941    ///
34942    /// Sets the *request* property to the given value.
34943    ///
34944    /// Even though the property as already been set when instantiating this call,
34945    /// we provide this method for API completeness.
34946    pub fn request(mut self, new_value: Permissions) -> PermissionUpdateCall<'a, C> {
34947        self._request = new_value;
34948        self
34949    }
34950    /// The unique identifier for an issuer. This ID must be unique across all issuers.
34951    ///
34952    /// Sets the *resource id* path property to the given value.
34953    ///
34954    /// Even though the property as already been set when instantiating this call,
34955    /// we provide this method for API completeness.
34956    pub fn resource_id(mut self, new_value: i64) -> PermissionUpdateCall<'a, C> {
34957        self._resource_id = new_value;
34958        self
34959    }
34960    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34961    /// while executing the actual API request.
34962    ///
34963    /// ````text
34964    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34965    /// ````
34966    ///
34967    /// Sets the *delegate* property to the given value.
34968    pub fn delegate(
34969        mut self,
34970        new_value: &'a mut dyn common::Delegate,
34971    ) -> PermissionUpdateCall<'a, C> {
34972        self._delegate = Some(new_value);
34973        self
34974    }
34975
34976    /// Set any additional parameter of the query string used in the request.
34977    /// It should be used to set parameters which are not yet available through their own
34978    /// setters.
34979    ///
34980    /// Please note that this method must not be used to set any of the known parameters
34981    /// which have their own setter method. If done anyway, the request will fail.
34982    ///
34983    /// # Additional Parameters
34984    ///
34985    /// * *$.xgafv* (query-string) - V1 error format.
34986    /// * *access_token* (query-string) - OAuth access token.
34987    /// * *alt* (query-string) - Data format for response.
34988    /// * *callback* (query-string) - JSONP
34989    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34990    /// * *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.
34991    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34992    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34993    /// * *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.
34994    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34995    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34996    pub fn param<T>(mut self, name: T, value: T) -> PermissionUpdateCall<'a, C>
34997    where
34998        T: AsRef<str>,
34999    {
35000        self._additional_params
35001            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35002        self
35003    }
35004
35005    /// Identifies the authorization scope for the method you are building.
35006    ///
35007    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35008    /// [`Scope::WalletObjectIssuer`].
35009    ///
35010    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35011    /// tokens for more than one scope.
35012    ///
35013    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35014    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35015    /// sufficient, a read-write scope will do as well.
35016    pub fn add_scope<St>(mut self, scope: St) -> PermissionUpdateCall<'a, C>
35017    where
35018        St: AsRef<str>,
35019    {
35020        self._scopes.insert(String::from(scope.as_ref()));
35021        self
35022    }
35023    /// Identifies the authorization scope(s) for the method you are building.
35024    ///
35025    /// See [`Self::add_scope()`] for details.
35026    pub fn add_scopes<I, St>(mut self, scopes: I) -> PermissionUpdateCall<'a, C>
35027    where
35028        I: IntoIterator<Item = St>,
35029        St: AsRef<str>,
35030    {
35031        self._scopes
35032            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35033        self
35034    }
35035
35036    /// Removes all scopes, and no default scope will be used either.
35037    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35038    /// for details).
35039    pub fn clear_scopes(mut self) -> PermissionUpdateCall<'a, C> {
35040        self._scopes.clear();
35041        self
35042    }
35043}
35044
35045/// Inserts the smart tap.
35046///
35047/// A builder for the *insert* method supported by a *smarttap* resource.
35048/// It is not used directly, but through a [`SmarttapMethods`] instance.
35049///
35050/// # Example
35051///
35052/// Instantiate a resource method builder
35053///
35054/// ```test_harness,no_run
35055/// # extern crate hyper;
35056/// # extern crate hyper_rustls;
35057/// # extern crate google_walletobjects1 as walletobjects1;
35058/// use walletobjects1::api::SmartTap;
35059/// # async fn dox() {
35060/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35061///
35062/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35063/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35064/// #     .with_native_roots()
35065/// #     .unwrap()
35066/// #     .https_only()
35067/// #     .enable_http2()
35068/// #     .build();
35069///
35070/// # let executor = hyper_util::rt::TokioExecutor::new();
35071/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35072/// #     secret,
35073/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35074/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
35075/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
35076/// #     ),
35077/// # ).build().await.unwrap();
35078///
35079/// # let client = hyper_util::client::legacy::Client::builder(
35080/// #     hyper_util::rt::TokioExecutor::new()
35081/// # )
35082/// # .build(
35083/// #     hyper_rustls::HttpsConnectorBuilder::new()
35084/// #         .with_native_roots()
35085/// #         .unwrap()
35086/// #         .https_or_http()
35087/// #         .enable_http2()
35088/// #         .build()
35089/// # );
35090/// # let mut hub = Walletobjects::new(client, auth);
35091/// // As the method needs a request, you would usually fill it with the desired information
35092/// // into the respective structure. Some of the parts shown here might not be applicable !
35093/// // Values shown here are possibly random and not representative !
35094/// let mut req = SmartTap::default();
35095///
35096/// // You can configure optional parameters by calling the respective setters at will, and
35097/// // execute the final call using `doit()`.
35098/// // Values shown here are possibly random and not representative !
35099/// let result = hub.smarttap().insert(req)
35100///              .doit().await;
35101/// # }
35102/// ```
35103pub struct SmarttapInsertCall<'a, C>
35104where
35105    C: 'a,
35106{
35107    hub: &'a Walletobjects<C>,
35108    _request: SmartTap,
35109    _delegate: Option<&'a mut dyn common::Delegate>,
35110    _additional_params: HashMap<String, String>,
35111    _scopes: BTreeSet<String>,
35112}
35113
35114impl<'a, C> common::CallBuilder for SmarttapInsertCall<'a, C> {}
35115
35116impl<'a, C> SmarttapInsertCall<'a, C>
35117where
35118    C: common::Connector,
35119{
35120    /// Perform the operation you have build so far.
35121    pub async fn doit(mut self) -> common::Result<(common::Response, SmartTap)> {
35122        use std::borrow::Cow;
35123        use std::io::{Read, Seek};
35124
35125        use common::{url::Params, ToParts};
35126        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35127
35128        let mut dd = common::DefaultDelegate;
35129        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35130        dlg.begin(common::MethodInfo {
35131            id: "walletobjects.smarttap.insert",
35132            http_method: hyper::Method::POST,
35133        });
35134
35135        for &field in ["alt"].iter() {
35136            if self._additional_params.contains_key(field) {
35137                dlg.finished(false);
35138                return Err(common::Error::FieldClash(field));
35139            }
35140        }
35141
35142        let mut params = Params::with_capacity(3 + self._additional_params.len());
35143
35144        params.extend(self._additional_params.iter());
35145
35146        params.push("alt", "json");
35147        let mut url = self.hub._base_url.clone() + "walletobjects/v1/smartTap";
35148        if self._scopes.is_empty() {
35149            self._scopes
35150                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
35151        }
35152
35153        let url = params.parse_with_url(&url);
35154
35155        let mut json_mime_type = mime::APPLICATION_JSON;
35156        let mut request_value_reader = {
35157            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35158            common::remove_json_null_values(&mut value);
35159            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35160            serde_json::to_writer(&mut dst, &value).unwrap();
35161            dst
35162        };
35163        let request_size = request_value_reader
35164            .seek(std::io::SeekFrom::End(0))
35165            .unwrap();
35166        request_value_reader
35167            .seek(std::io::SeekFrom::Start(0))
35168            .unwrap();
35169
35170        loop {
35171            let token = match self
35172                .hub
35173                .auth
35174                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35175                .await
35176            {
35177                Ok(token) => token,
35178                Err(e) => match dlg.token(e) {
35179                    Ok(token) => token,
35180                    Err(e) => {
35181                        dlg.finished(false);
35182                        return Err(common::Error::MissingToken(e));
35183                    }
35184                },
35185            };
35186            request_value_reader
35187                .seek(std::io::SeekFrom::Start(0))
35188                .unwrap();
35189            let mut req_result = {
35190                let client = &self.hub.client;
35191                dlg.pre_request();
35192                let mut req_builder = hyper::Request::builder()
35193                    .method(hyper::Method::POST)
35194                    .uri(url.as_str())
35195                    .header(USER_AGENT, self.hub._user_agent.clone());
35196
35197                if let Some(token) = token.as_ref() {
35198                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35199                }
35200
35201                let request = req_builder
35202                    .header(CONTENT_TYPE, json_mime_type.to_string())
35203                    .header(CONTENT_LENGTH, request_size as u64)
35204                    .body(common::to_body(
35205                        request_value_reader.get_ref().clone().into(),
35206                    ));
35207
35208                client.request(request.unwrap()).await
35209            };
35210
35211            match req_result {
35212                Err(err) => {
35213                    if let common::Retry::After(d) = dlg.http_error(&err) {
35214                        sleep(d).await;
35215                        continue;
35216                    }
35217                    dlg.finished(false);
35218                    return Err(common::Error::HttpError(err));
35219                }
35220                Ok(res) => {
35221                    let (mut parts, body) = res.into_parts();
35222                    let mut body = common::Body::new(body);
35223                    if !parts.status.is_success() {
35224                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35225                        let error = serde_json::from_str(&common::to_string(&bytes));
35226                        let response = common::to_response(parts, bytes.into());
35227
35228                        if let common::Retry::After(d) =
35229                            dlg.http_failure(&response, error.as_ref().ok())
35230                        {
35231                            sleep(d).await;
35232                            continue;
35233                        }
35234
35235                        dlg.finished(false);
35236
35237                        return Err(match error {
35238                            Ok(value) => common::Error::BadRequest(value),
35239                            _ => common::Error::Failure(response),
35240                        });
35241                    }
35242                    let response = {
35243                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35244                        let encoded = common::to_string(&bytes);
35245                        match serde_json::from_str(&encoded) {
35246                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35247                            Err(error) => {
35248                                dlg.response_json_decode_error(&encoded, &error);
35249                                return Err(common::Error::JsonDecodeError(
35250                                    encoded.to_string(),
35251                                    error,
35252                                ));
35253                            }
35254                        }
35255                    };
35256
35257                    dlg.finished(true);
35258                    return Ok(response);
35259                }
35260            }
35261        }
35262    }
35263
35264    ///
35265    /// Sets the *request* property to the given value.
35266    ///
35267    /// Even though the property as already been set when instantiating this call,
35268    /// we provide this method for API completeness.
35269    pub fn request(mut self, new_value: SmartTap) -> SmarttapInsertCall<'a, C> {
35270        self._request = new_value;
35271        self
35272    }
35273    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35274    /// while executing the actual API request.
35275    ///
35276    /// ````text
35277    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35278    /// ````
35279    ///
35280    /// Sets the *delegate* property to the given value.
35281    pub fn delegate(
35282        mut self,
35283        new_value: &'a mut dyn common::Delegate,
35284    ) -> SmarttapInsertCall<'a, C> {
35285        self._delegate = Some(new_value);
35286        self
35287    }
35288
35289    /// Set any additional parameter of the query string used in the request.
35290    /// It should be used to set parameters which are not yet available through their own
35291    /// setters.
35292    ///
35293    /// Please note that this method must not be used to set any of the known parameters
35294    /// which have their own setter method. If done anyway, the request will fail.
35295    ///
35296    /// # Additional Parameters
35297    ///
35298    /// * *$.xgafv* (query-string) - V1 error format.
35299    /// * *access_token* (query-string) - OAuth access token.
35300    /// * *alt* (query-string) - Data format for response.
35301    /// * *callback* (query-string) - JSONP
35302    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35303    /// * *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.
35304    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35305    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35306    /// * *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.
35307    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35308    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35309    pub fn param<T>(mut self, name: T, value: T) -> SmarttapInsertCall<'a, C>
35310    where
35311        T: AsRef<str>,
35312    {
35313        self._additional_params
35314            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35315        self
35316    }
35317
35318    /// Identifies the authorization scope for the method you are building.
35319    ///
35320    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35321    /// [`Scope::WalletObjectIssuer`].
35322    ///
35323    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35324    /// tokens for more than one scope.
35325    ///
35326    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35327    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35328    /// sufficient, a read-write scope will do as well.
35329    pub fn add_scope<St>(mut self, scope: St) -> SmarttapInsertCall<'a, C>
35330    where
35331        St: AsRef<str>,
35332    {
35333        self._scopes.insert(String::from(scope.as_ref()));
35334        self
35335    }
35336    /// Identifies the authorization scope(s) for the method you are building.
35337    ///
35338    /// See [`Self::add_scope()`] for details.
35339    pub fn add_scopes<I, St>(mut self, scopes: I) -> SmarttapInsertCall<'a, C>
35340    where
35341        I: IntoIterator<Item = St>,
35342        St: AsRef<str>,
35343    {
35344        self._scopes
35345            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35346        self
35347    }
35348
35349    /// Removes all scopes, and no default scope will be used either.
35350    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35351    /// for details).
35352    pub fn clear_scopes(mut self) -> SmarttapInsertCall<'a, C> {
35353        self._scopes.clear();
35354        self
35355    }
35356}
35357
35358/// Adds a message to the transit class referenced by the given class ID.
35359///
35360/// A builder for the *addmessage* method supported by a *transitclas* resource.
35361/// It is not used directly, but through a [`TransitclasMethods`] instance.
35362///
35363/// # Example
35364///
35365/// Instantiate a resource method builder
35366///
35367/// ```test_harness,no_run
35368/// # extern crate hyper;
35369/// # extern crate hyper_rustls;
35370/// # extern crate google_walletobjects1 as walletobjects1;
35371/// use walletobjects1::api::AddMessageRequest;
35372/// # async fn dox() {
35373/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35374///
35375/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35376/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35377/// #     .with_native_roots()
35378/// #     .unwrap()
35379/// #     .https_only()
35380/// #     .enable_http2()
35381/// #     .build();
35382///
35383/// # let executor = hyper_util::rt::TokioExecutor::new();
35384/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35385/// #     secret,
35386/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35387/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
35388/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
35389/// #     ),
35390/// # ).build().await.unwrap();
35391///
35392/// # let client = hyper_util::client::legacy::Client::builder(
35393/// #     hyper_util::rt::TokioExecutor::new()
35394/// # )
35395/// # .build(
35396/// #     hyper_rustls::HttpsConnectorBuilder::new()
35397/// #         .with_native_roots()
35398/// #         .unwrap()
35399/// #         .https_or_http()
35400/// #         .enable_http2()
35401/// #         .build()
35402/// # );
35403/// # let mut hub = Walletobjects::new(client, auth);
35404/// // As the method needs a request, you would usually fill it with the desired information
35405/// // into the respective structure. Some of the parts shown here might not be applicable !
35406/// // Values shown here are possibly random and not representative !
35407/// let mut req = AddMessageRequest::default();
35408///
35409/// // You can configure optional parameters by calling the respective setters at will, and
35410/// // execute the final call using `doit()`.
35411/// // Values shown here are possibly random and not representative !
35412/// let result = hub.transitclass().addmessage(req, "resourceId")
35413///              .doit().await;
35414/// # }
35415/// ```
35416pub struct TransitclasAddmessageCall<'a, C>
35417where
35418    C: 'a,
35419{
35420    hub: &'a Walletobjects<C>,
35421    _request: AddMessageRequest,
35422    _resource_id: String,
35423    _delegate: Option<&'a mut dyn common::Delegate>,
35424    _additional_params: HashMap<String, String>,
35425    _scopes: BTreeSet<String>,
35426}
35427
35428impl<'a, C> common::CallBuilder for TransitclasAddmessageCall<'a, C> {}
35429
35430impl<'a, C> TransitclasAddmessageCall<'a, C>
35431where
35432    C: common::Connector,
35433{
35434    /// Perform the operation you have build so far.
35435    pub async fn doit(
35436        mut self,
35437    ) -> common::Result<(common::Response, TransitClassAddMessageResponse)> {
35438        use std::borrow::Cow;
35439        use std::io::{Read, Seek};
35440
35441        use common::{url::Params, ToParts};
35442        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35443
35444        let mut dd = common::DefaultDelegate;
35445        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35446        dlg.begin(common::MethodInfo {
35447            id: "walletobjects.transitclass.addmessage",
35448            http_method: hyper::Method::POST,
35449        });
35450
35451        for &field in ["alt", "resourceId"].iter() {
35452            if self._additional_params.contains_key(field) {
35453                dlg.finished(false);
35454                return Err(common::Error::FieldClash(field));
35455            }
35456        }
35457
35458        let mut params = Params::with_capacity(4 + self._additional_params.len());
35459        params.push("resourceId", self._resource_id);
35460
35461        params.extend(self._additional_params.iter());
35462
35463        params.push("alt", "json");
35464        let mut url =
35465            self.hub._base_url.clone() + "walletobjects/v1/transitClass/{resourceId}/addMessage";
35466        if self._scopes.is_empty() {
35467            self._scopes
35468                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
35469        }
35470
35471        #[allow(clippy::single_element_loop)]
35472        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
35473            url = params.uri_replacement(url, param_name, find_this, false);
35474        }
35475        {
35476            let to_remove = ["resourceId"];
35477            params.remove_params(&to_remove);
35478        }
35479
35480        let url = params.parse_with_url(&url);
35481
35482        let mut json_mime_type = mime::APPLICATION_JSON;
35483        let mut request_value_reader = {
35484            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35485            common::remove_json_null_values(&mut value);
35486            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35487            serde_json::to_writer(&mut dst, &value).unwrap();
35488            dst
35489        };
35490        let request_size = request_value_reader
35491            .seek(std::io::SeekFrom::End(0))
35492            .unwrap();
35493        request_value_reader
35494            .seek(std::io::SeekFrom::Start(0))
35495            .unwrap();
35496
35497        loop {
35498            let token = match self
35499                .hub
35500                .auth
35501                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35502                .await
35503            {
35504                Ok(token) => token,
35505                Err(e) => match dlg.token(e) {
35506                    Ok(token) => token,
35507                    Err(e) => {
35508                        dlg.finished(false);
35509                        return Err(common::Error::MissingToken(e));
35510                    }
35511                },
35512            };
35513            request_value_reader
35514                .seek(std::io::SeekFrom::Start(0))
35515                .unwrap();
35516            let mut req_result = {
35517                let client = &self.hub.client;
35518                dlg.pre_request();
35519                let mut req_builder = hyper::Request::builder()
35520                    .method(hyper::Method::POST)
35521                    .uri(url.as_str())
35522                    .header(USER_AGENT, self.hub._user_agent.clone());
35523
35524                if let Some(token) = token.as_ref() {
35525                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35526                }
35527
35528                let request = req_builder
35529                    .header(CONTENT_TYPE, json_mime_type.to_string())
35530                    .header(CONTENT_LENGTH, request_size as u64)
35531                    .body(common::to_body(
35532                        request_value_reader.get_ref().clone().into(),
35533                    ));
35534
35535                client.request(request.unwrap()).await
35536            };
35537
35538            match req_result {
35539                Err(err) => {
35540                    if let common::Retry::After(d) = dlg.http_error(&err) {
35541                        sleep(d).await;
35542                        continue;
35543                    }
35544                    dlg.finished(false);
35545                    return Err(common::Error::HttpError(err));
35546                }
35547                Ok(res) => {
35548                    let (mut parts, body) = res.into_parts();
35549                    let mut body = common::Body::new(body);
35550                    if !parts.status.is_success() {
35551                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35552                        let error = serde_json::from_str(&common::to_string(&bytes));
35553                        let response = common::to_response(parts, bytes.into());
35554
35555                        if let common::Retry::After(d) =
35556                            dlg.http_failure(&response, error.as_ref().ok())
35557                        {
35558                            sleep(d).await;
35559                            continue;
35560                        }
35561
35562                        dlg.finished(false);
35563
35564                        return Err(match error {
35565                            Ok(value) => common::Error::BadRequest(value),
35566                            _ => common::Error::Failure(response),
35567                        });
35568                    }
35569                    let response = {
35570                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35571                        let encoded = common::to_string(&bytes);
35572                        match serde_json::from_str(&encoded) {
35573                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35574                            Err(error) => {
35575                                dlg.response_json_decode_error(&encoded, &error);
35576                                return Err(common::Error::JsonDecodeError(
35577                                    encoded.to_string(),
35578                                    error,
35579                                ));
35580                            }
35581                        }
35582                    };
35583
35584                    dlg.finished(true);
35585                    return Ok(response);
35586                }
35587            }
35588        }
35589    }
35590
35591    ///
35592    /// Sets the *request* property to the given value.
35593    ///
35594    /// Even though the property as already been set when instantiating this call,
35595    /// we provide this method for API completeness.
35596    pub fn request(mut self, new_value: AddMessageRequest) -> TransitclasAddmessageCall<'a, C> {
35597        self._request = new_value;
35598        self
35599    }
35600    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
35601    ///
35602    /// Sets the *resource id* path property to the given value.
35603    ///
35604    /// Even though the property as already been set when instantiating this call,
35605    /// we provide this method for API completeness.
35606    pub fn resource_id(mut self, new_value: &str) -> TransitclasAddmessageCall<'a, C> {
35607        self._resource_id = new_value.to_string();
35608        self
35609    }
35610    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35611    /// while executing the actual API request.
35612    ///
35613    /// ````text
35614    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35615    /// ````
35616    ///
35617    /// Sets the *delegate* property to the given value.
35618    pub fn delegate(
35619        mut self,
35620        new_value: &'a mut dyn common::Delegate,
35621    ) -> TransitclasAddmessageCall<'a, C> {
35622        self._delegate = Some(new_value);
35623        self
35624    }
35625
35626    /// Set any additional parameter of the query string used in the request.
35627    /// It should be used to set parameters which are not yet available through their own
35628    /// setters.
35629    ///
35630    /// Please note that this method must not be used to set any of the known parameters
35631    /// which have their own setter method. If done anyway, the request will fail.
35632    ///
35633    /// # Additional Parameters
35634    ///
35635    /// * *$.xgafv* (query-string) - V1 error format.
35636    /// * *access_token* (query-string) - OAuth access token.
35637    /// * *alt* (query-string) - Data format for response.
35638    /// * *callback* (query-string) - JSONP
35639    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35640    /// * *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.
35641    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35642    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35643    /// * *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.
35644    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35645    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35646    pub fn param<T>(mut self, name: T, value: T) -> TransitclasAddmessageCall<'a, C>
35647    where
35648        T: AsRef<str>,
35649    {
35650        self._additional_params
35651            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35652        self
35653    }
35654
35655    /// Identifies the authorization scope for the method you are building.
35656    ///
35657    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35658    /// [`Scope::WalletObjectIssuer`].
35659    ///
35660    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35661    /// tokens for more than one scope.
35662    ///
35663    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35664    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35665    /// sufficient, a read-write scope will do as well.
35666    pub fn add_scope<St>(mut self, scope: St) -> TransitclasAddmessageCall<'a, C>
35667    where
35668        St: AsRef<str>,
35669    {
35670        self._scopes.insert(String::from(scope.as_ref()));
35671        self
35672    }
35673    /// Identifies the authorization scope(s) for the method you are building.
35674    ///
35675    /// See [`Self::add_scope()`] for details.
35676    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasAddmessageCall<'a, C>
35677    where
35678        I: IntoIterator<Item = St>,
35679        St: AsRef<str>,
35680    {
35681        self._scopes
35682            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35683        self
35684    }
35685
35686    /// Removes all scopes, and no default scope will be used either.
35687    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35688    /// for details).
35689    pub fn clear_scopes(mut self) -> TransitclasAddmessageCall<'a, C> {
35690        self._scopes.clear();
35691        self
35692    }
35693}
35694
35695/// Returns the transit class with the given class ID.
35696///
35697/// A builder for the *get* method supported by a *transitclas* resource.
35698/// It is not used directly, but through a [`TransitclasMethods`] instance.
35699///
35700/// # Example
35701///
35702/// Instantiate a resource method builder
35703///
35704/// ```test_harness,no_run
35705/// # extern crate hyper;
35706/// # extern crate hyper_rustls;
35707/// # extern crate google_walletobjects1 as walletobjects1;
35708/// # async fn dox() {
35709/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35710///
35711/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35712/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35713/// #     .with_native_roots()
35714/// #     .unwrap()
35715/// #     .https_only()
35716/// #     .enable_http2()
35717/// #     .build();
35718///
35719/// # let executor = hyper_util::rt::TokioExecutor::new();
35720/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35721/// #     secret,
35722/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35723/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
35724/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
35725/// #     ),
35726/// # ).build().await.unwrap();
35727///
35728/// # let client = hyper_util::client::legacy::Client::builder(
35729/// #     hyper_util::rt::TokioExecutor::new()
35730/// # )
35731/// # .build(
35732/// #     hyper_rustls::HttpsConnectorBuilder::new()
35733/// #         .with_native_roots()
35734/// #         .unwrap()
35735/// #         .https_or_http()
35736/// #         .enable_http2()
35737/// #         .build()
35738/// # );
35739/// # let mut hub = Walletobjects::new(client, auth);
35740/// // You can configure optional parameters by calling the respective setters at will, and
35741/// // execute the final call using `doit()`.
35742/// // Values shown here are possibly random and not representative !
35743/// let result = hub.transitclass().get("resourceId")
35744///              .doit().await;
35745/// # }
35746/// ```
35747pub struct TransitclasGetCall<'a, C>
35748where
35749    C: 'a,
35750{
35751    hub: &'a Walletobjects<C>,
35752    _resource_id: String,
35753    _delegate: Option<&'a mut dyn common::Delegate>,
35754    _additional_params: HashMap<String, String>,
35755    _scopes: BTreeSet<String>,
35756}
35757
35758impl<'a, C> common::CallBuilder for TransitclasGetCall<'a, C> {}
35759
35760impl<'a, C> TransitclasGetCall<'a, C>
35761where
35762    C: common::Connector,
35763{
35764    /// Perform the operation you have build so far.
35765    pub async fn doit(mut self) -> common::Result<(common::Response, TransitClass)> {
35766        use std::borrow::Cow;
35767        use std::io::{Read, Seek};
35768
35769        use common::{url::Params, ToParts};
35770        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35771
35772        let mut dd = common::DefaultDelegate;
35773        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35774        dlg.begin(common::MethodInfo {
35775            id: "walletobjects.transitclass.get",
35776            http_method: hyper::Method::GET,
35777        });
35778
35779        for &field in ["alt", "resourceId"].iter() {
35780            if self._additional_params.contains_key(field) {
35781                dlg.finished(false);
35782                return Err(common::Error::FieldClash(field));
35783            }
35784        }
35785
35786        let mut params = Params::with_capacity(3 + self._additional_params.len());
35787        params.push("resourceId", self._resource_id);
35788
35789        params.extend(self._additional_params.iter());
35790
35791        params.push("alt", "json");
35792        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass/{resourceId}";
35793        if self._scopes.is_empty() {
35794            self._scopes
35795                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
35796        }
35797
35798        #[allow(clippy::single_element_loop)]
35799        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
35800            url = params.uri_replacement(url, param_name, find_this, false);
35801        }
35802        {
35803            let to_remove = ["resourceId"];
35804            params.remove_params(&to_remove);
35805        }
35806
35807        let url = params.parse_with_url(&url);
35808
35809        loop {
35810            let token = match self
35811                .hub
35812                .auth
35813                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35814                .await
35815            {
35816                Ok(token) => token,
35817                Err(e) => match dlg.token(e) {
35818                    Ok(token) => token,
35819                    Err(e) => {
35820                        dlg.finished(false);
35821                        return Err(common::Error::MissingToken(e));
35822                    }
35823                },
35824            };
35825            let mut req_result = {
35826                let client = &self.hub.client;
35827                dlg.pre_request();
35828                let mut req_builder = hyper::Request::builder()
35829                    .method(hyper::Method::GET)
35830                    .uri(url.as_str())
35831                    .header(USER_AGENT, self.hub._user_agent.clone());
35832
35833                if let Some(token) = token.as_ref() {
35834                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35835                }
35836
35837                let request = req_builder
35838                    .header(CONTENT_LENGTH, 0_u64)
35839                    .body(common::to_body::<String>(None));
35840
35841                client.request(request.unwrap()).await
35842            };
35843
35844            match req_result {
35845                Err(err) => {
35846                    if let common::Retry::After(d) = dlg.http_error(&err) {
35847                        sleep(d).await;
35848                        continue;
35849                    }
35850                    dlg.finished(false);
35851                    return Err(common::Error::HttpError(err));
35852                }
35853                Ok(res) => {
35854                    let (mut parts, body) = res.into_parts();
35855                    let mut body = common::Body::new(body);
35856                    if !parts.status.is_success() {
35857                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35858                        let error = serde_json::from_str(&common::to_string(&bytes));
35859                        let response = common::to_response(parts, bytes.into());
35860
35861                        if let common::Retry::After(d) =
35862                            dlg.http_failure(&response, error.as_ref().ok())
35863                        {
35864                            sleep(d).await;
35865                            continue;
35866                        }
35867
35868                        dlg.finished(false);
35869
35870                        return Err(match error {
35871                            Ok(value) => common::Error::BadRequest(value),
35872                            _ => common::Error::Failure(response),
35873                        });
35874                    }
35875                    let response = {
35876                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35877                        let encoded = common::to_string(&bytes);
35878                        match serde_json::from_str(&encoded) {
35879                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35880                            Err(error) => {
35881                                dlg.response_json_decode_error(&encoded, &error);
35882                                return Err(common::Error::JsonDecodeError(
35883                                    encoded.to_string(),
35884                                    error,
35885                                ));
35886                            }
35887                        }
35888                    };
35889
35890                    dlg.finished(true);
35891                    return Ok(response);
35892                }
35893            }
35894        }
35895    }
35896
35897    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
35898    ///
35899    /// Sets the *resource id* path property to the given value.
35900    ///
35901    /// Even though the property as already been set when instantiating this call,
35902    /// we provide this method for API completeness.
35903    pub fn resource_id(mut self, new_value: &str) -> TransitclasGetCall<'a, C> {
35904        self._resource_id = new_value.to_string();
35905        self
35906    }
35907    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35908    /// while executing the actual API request.
35909    ///
35910    /// ````text
35911    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35912    /// ````
35913    ///
35914    /// Sets the *delegate* property to the given value.
35915    pub fn delegate(
35916        mut self,
35917        new_value: &'a mut dyn common::Delegate,
35918    ) -> TransitclasGetCall<'a, C> {
35919        self._delegate = Some(new_value);
35920        self
35921    }
35922
35923    /// Set any additional parameter of the query string used in the request.
35924    /// It should be used to set parameters which are not yet available through their own
35925    /// setters.
35926    ///
35927    /// Please note that this method must not be used to set any of the known parameters
35928    /// which have their own setter method. If done anyway, the request will fail.
35929    ///
35930    /// # Additional Parameters
35931    ///
35932    /// * *$.xgafv* (query-string) - V1 error format.
35933    /// * *access_token* (query-string) - OAuth access token.
35934    /// * *alt* (query-string) - Data format for response.
35935    /// * *callback* (query-string) - JSONP
35936    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35937    /// * *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.
35938    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35939    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35940    /// * *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.
35941    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35942    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35943    pub fn param<T>(mut self, name: T, value: T) -> TransitclasGetCall<'a, C>
35944    where
35945        T: AsRef<str>,
35946    {
35947        self._additional_params
35948            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35949        self
35950    }
35951
35952    /// Identifies the authorization scope for the method you are building.
35953    ///
35954    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35955    /// [`Scope::WalletObjectIssuer`].
35956    ///
35957    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35958    /// tokens for more than one scope.
35959    ///
35960    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35961    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35962    /// sufficient, a read-write scope will do as well.
35963    pub fn add_scope<St>(mut self, scope: St) -> TransitclasGetCall<'a, C>
35964    where
35965        St: AsRef<str>,
35966    {
35967        self._scopes.insert(String::from(scope.as_ref()));
35968        self
35969    }
35970    /// Identifies the authorization scope(s) for the method you are building.
35971    ///
35972    /// See [`Self::add_scope()`] for details.
35973    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasGetCall<'a, C>
35974    where
35975        I: IntoIterator<Item = St>,
35976        St: AsRef<str>,
35977    {
35978        self._scopes
35979            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35980        self
35981    }
35982
35983    /// Removes all scopes, and no default scope will be used either.
35984    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35985    /// for details).
35986    pub fn clear_scopes(mut self) -> TransitclasGetCall<'a, C> {
35987        self._scopes.clear();
35988        self
35989    }
35990}
35991
35992/// Inserts a transit class with the given ID and properties.
35993///
35994/// A builder for the *insert* method supported by a *transitclas* resource.
35995/// It is not used directly, but through a [`TransitclasMethods`] instance.
35996///
35997/// # Example
35998///
35999/// Instantiate a resource method builder
36000///
36001/// ```test_harness,no_run
36002/// # extern crate hyper;
36003/// # extern crate hyper_rustls;
36004/// # extern crate google_walletobjects1 as walletobjects1;
36005/// use walletobjects1::api::TransitClass;
36006/// # async fn dox() {
36007/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36008///
36009/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36010/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36011/// #     .with_native_roots()
36012/// #     .unwrap()
36013/// #     .https_only()
36014/// #     .enable_http2()
36015/// #     .build();
36016///
36017/// # let executor = hyper_util::rt::TokioExecutor::new();
36018/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36019/// #     secret,
36020/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36021/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
36022/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
36023/// #     ),
36024/// # ).build().await.unwrap();
36025///
36026/// # let client = hyper_util::client::legacy::Client::builder(
36027/// #     hyper_util::rt::TokioExecutor::new()
36028/// # )
36029/// # .build(
36030/// #     hyper_rustls::HttpsConnectorBuilder::new()
36031/// #         .with_native_roots()
36032/// #         .unwrap()
36033/// #         .https_or_http()
36034/// #         .enable_http2()
36035/// #         .build()
36036/// # );
36037/// # let mut hub = Walletobjects::new(client, auth);
36038/// // As the method needs a request, you would usually fill it with the desired information
36039/// // into the respective structure. Some of the parts shown here might not be applicable !
36040/// // Values shown here are possibly random and not representative !
36041/// let mut req = TransitClass::default();
36042///
36043/// // You can configure optional parameters by calling the respective setters at will, and
36044/// // execute the final call using `doit()`.
36045/// // Values shown here are possibly random and not representative !
36046/// let result = hub.transitclass().insert(req)
36047///              .doit().await;
36048/// # }
36049/// ```
36050pub struct TransitclasInsertCall<'a, C>
36051where
36052    C: 'a,
36053{
36054    hub: &'a Walletobjects<C>,
36055    _request: TransitClass,
36056    _delegate: Option<&'a mut dyn common::Delegate>,
36057    _additional_params: HashMap<String, String>,
36058    _scopes: BTreeSet<String>,
36059}
36060
36061impl<'a, C> common::CallBuilder for TransitclasInsertCall<'a, C> {}
36062
36063impl<'a, C> TransitclasInsertCall<'a, C>
36064where
36065    C: common::Connector,
36066{
36067    /// Perform the operation you have build so far.
36068    pub async fn doit(mut self) -> common::Result<(common::Response, TransitClass)> {
36069        use std::borrow::Cow;
36070        use std::io::{Read, Seek};
36071
36072        use common::{url::Params, ToParts};
36073        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36074
36075        let mut dd = common::DefaultDelegate;
36076        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36077        dlg.begin(common::MethodInfo {
36078            id: "walletobjects.transitclass.insert",
36079            http_method: hyper::Method::POST,
36080        });
36081
36082        for &field in ["alt"].iter() {
36083            if self._additional_params.contains_key(field) {
36084                dlg.finished(false);
36085                return Err(common::Error::FieldClash(field));
36086            }
36087        }
36088
36089        let mut params = Params::with_capacity(3 + self._additional_params.len());
36090
36091        params.extend(self._additional_params.iter());
36092
36093        params.push("alt", "json");
36094        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass";
36095        if self._scopes.is_empty() {
36096            self._scopes
36097                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
36098        }
36099
36100        let url = params.parse_with_url(&url);
36101
36102        let mut json_mime_type = mime::APPLICATION_JSON;
36103        let mut request_value_reader = {
36104            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36105            common::remove_json_null_values(&mut value);
36106            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36107            serde_json::to_writer(&mut dst, &value).unwrap();
36108            dst
36109        };
36110        let request_size = request_value_reader
36111            .seek(std::io::SeekFrom::End(0))
36112            .unwrap();
36113        request_value_reader
36114            .seek(std::io::SeekFrom::Start(0))
36115            .unwrap();
36116
36117        loop {
36118            let token = match self
36119                .hub
36120                .auth
36121                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36122                .await
36123            {
36124                Ok(token) => token,
36125                Err(e) => match dlg.token(e) {
36126                    Ok(token) => token,
36127                    Err(e) => {
36128                        dlg.finished(false);
36129                        return Err(common::Error::MissingToken(e));
36130                    }
36131                },
36132            };
36133            request_value_reader
36134                .seek(std::io::SeekFrom::Start(0))
36135                .unwrap();
36136            let mut req_result = {
36137                let client = &self.hub.client;
36138                dlg.pre_request();
36139                let mut req_builder = hyper::Request::builder()
36140                    .method(hyper::Method::POST)
36141                    .uri(url.as_str())
36142                    .header(USER_AGENT, self.hub._user_agent.clone());
36143
36144                if let Some(token) = token.as_ref() {
36145                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36146                }
36147
36148                let request = req_builder
36149                    .header(CONTENT_TYPE, json_mime_type.to_string())
36150                    .header(CONTENT_LENGTH, request_size as u64)
36151                    .body(common::to_body(
36152                        request_value_reader.get_ref().clone().into(),
36153                    ));
36154
36155                client.request(request.unwrap()).await
36156            };
36157
36158            match req_result {
36159                Err(err) => {
36160                    if let common::Retry::After(d) = dlg.http_error(&err) {
36161                        sleep(d).await;
36162                        continue;
36163                    }
36164                    dlg.finished(false);
36165                    return Err(common::Error::HttpError(err));
36166                }
36167                Ok(res) => {
36168                    let (mut parts, body) = res.into_parts();
36169                    let mut body = common::Body::new(body);
36170                    if !parts.status.is_success() {
36171                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36172                        let error = serde_json::from_str(&common::to_string(&bytes));
36173                        let response = common::to_response(parts, bytes.into());
36174
36175                        if let common::Retry::After(d) =
36176                            dlg.http_failure(&response, error.as_ref().ok())
36177                        {
36178                            sleep(d).await;
36179                            continue;
36180                        }
36181
36182                        dlg.finished(false);
36183
36184                        return Err(match error {
36185                            Ok(value) => common::Error::BadRequest(value),
36186                            _ => common::Error::Failure(response),
36187                        });
36188                    }
36189                    let response = {
36190                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36191                        let encoded = common::to_string(&bytes);
36192                        match serde_json::from_str(&encoded) {
36193                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36194                            Err(error) => {
36195                                dlg.response_json_decode_error(&encoded, &error);
36196                                return Err(common::Error::JsonDecodeError(
36197                                    encoded.to_string(),
36198                                    error,
36199                                ));
36200                            }
36201                        }
36202                    };
36203
36204                    dlg.finished(true);
36205                    return Ok(response);
36206                }
36207            }
36208        }
36209    }
36210
36211    ///
36212    /// Sets the *request* property to the given value.
36213    ///
36214    /// Even though the property as already been set when instantiating this call,
36215    /// we provide this method for API completeness.
36216    pub fn request(mut self, new_value: TransitClass) -> TransitclasInsertCall<'a, C> {
36217        self._request = new_value;
36218        self
36219    }
36220    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36221    /// while executing the actual API request.
36222    ///
36223    /// ````text
36224    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36225    /// ````
36226    ///
36227    /// Sets the *delegate* property to the given value.
36228    pub fn delegate(
36229        mut self,
36230        new_value: &'a mut dyn common::Delegate,
36231    ) -> TransitclasInsertCall<'a, C> {
36232        self._delegate = Some(new_value);
36233        self
36234    }
36235
36236    /// Set any additional parameter of the query string used in the request.
36237    /// It should be used to set parameters which are not yet available through their own
36238    /// setters.
36239    ///
36240    /// Please note that this method must not be used to set any of the known parameters
36241    /// which have their own setter method. If done anyway, the request will fail.
36242    ///
36243    /// # Additional Parameters
36244    ///
36245    /// * *$.xgafv* (query-string) - V1 error format.
36246    /// * *access_token* (query-string) - OAuth access token.
36247    /// * *alt* (query-string) - Data format for response.
36248    /// * *callback* (query-string) - JSONP
36249    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36250    /// * *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.
36251    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36252    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36253    /// * *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.
36254    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36255    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36256    pub fn param<T>(mut self, name: T, value: T) -> TransitclasInsertCall<'a, C>
36257    where
36258        T: AsRef<str>,
36259    {
36260        self._additional_params
36261            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36262        self
36263    }
36264
36265    /// Identifies the authorization scope for the method you are building.
36266    ///
36267    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36268    /// [`Scope::WalletObjectIssuer`].
36269    ///
36270    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36271    /// tokens for more than one scope.
36272    ///
36273    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36274    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36275    /// sufficient, a read-write scope will do as well.
36276    pub fn add_scope<St>(mut self, scope: St) -> TransitclasInsertCall<'a, C>
36277    where
36278        St: AsRef<str>,
36279    {
36280        self._scopes.insert(String::from(scope.as_ref()));
36281        self
36282    }
36283    /// Identifies the authorization scope(s) for the method you are building.
36284    ///
36285    /// See [`Self::add_scope()`] for details.
36286    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasInsertCall<'a, C>
36287    where
36288        I: IntoIterator<Item = St>,
36289        St: AsRef<str>,
36290    {
36291        self._scopes
36292            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36293        self
36294    }
36295
36296    /// Removes all scopes, and no default scope will be used either.
36297    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36298    /// for details).
36299    pub fn clear_scopes(mut self) -> TransitclasInsertCall<'a, C> {
36300        self._scopes.clear();
36301        self
36302    }
36303}
36304
36305/// Returns a list of all transit classes for a given issuer ID.
36306///
36307/// A builder for the *list* method supported by a *transitclas* resource.
36308/// It is not used directly, but through a [`TransitclasMethods`] instance.
36309///
36310/// # Example
36311///
36312/// Instantiate a resource method builder
36313///
36314/// ```test_harness,no_run
36315/// # extern crate hyper;
36316/// # extern crate hyper_rustls;
36317/// # extern crate google_walletobjects1 as walletobjects1;
36318/// # async fn dox() {
36319/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36320///
36321/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36322/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36323/// #     .with_native_roots()
36324/// #     .unwrap()
36325/// #     .https_only()
36326/// #     .enable_http2()
36327/// #     .build();
36328///
36329/// # let executor = hyper_util::rt::TokioExecutor::new();
36330/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36331/// #     secret,
36332/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36333/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
36334/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
36335/// #     ),
36336/// # ).build().await.unwrap();
36337///
36338/// # let client = hyper_util::client::legacy::Client::builder(
36339/// #     hyper_util::rt::TokioExecutor::new()
36340/// # )
36341/// # .build(
36342/// #     hyper_rustls::HttpsConnectorBuilder::new()
36343/// #         .with_native_roots()
36344/// #         .unwrap()
36345/// #         .https_or_http()
36346/// #         .enable_http2()
36347/// #         .build()
36348/// # );
36349/// # let mut hub = Walletobjects::new(client, auth);
36350/// // You can configure optional parameters by calling the respective setters at will, and
36351/// // execute the final call using `doit()`.
36352/// // Values shown here are possibly random and not representative !
36353/// let result = hub.transitclass().list()
36354///              .token("invidunt")
36355///              .max_results(-11)
36356///              .issuer_id(-7)
36357///              .doit().await;
36358/// # }
36359/// ```
36360pub struct TransitclasListCall<'a, C>
36361where
36362    C: 'a,
36363{
36364    hub: &'a Walletobjects<C>,
36365    _token: Option<String>,
36366    _max_results: Option<i32>,
36367    _issuer_id: Option<i64>,
36368    _delegate: Option<&'a mut dyn common::Delegate>,
36369    _additional_params: HashMap<String, String>,
36370    _scopes: BTreeSet<String>,
36371}
36372
36373impl<'a, C> common::CallBuilder for TransitclasListCall<'a, C> {}
36374
36375impl<'a, C> TransitclasListCall<'a, C>
36376where
36377    C: common::Connector,
36378{
36379    /// Perform the operation you have build so far.
36380    pub async fn doit(mut self) -> common::Result<(common::Response, TransitClassListResponse)> {
36381        use std::borrow::Cow;
36382        use std::io::{Read, Seek};
36383
36384        use common::{url::Params, ToParts};
36385        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36386
36387        let mut dd = common::DefaultDelegate;
36388        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36389        dlg.begin(common::MethodInfo {
36390            id: "walletobjects.transitclass.list",
36391            http_method: hyper::Method::GET,
36392        });
36393
36394        for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
36395            if self._additional_params.contains_key(field) {
36396                dlg.finished(false);
36397                return Err(common::Error::FieldClash(field));
36398            }
36399        }
36400
36401        let mut params = Params::with_capacity(5 + self._additional_params.len());
36402        if let Some(value) = self._token.as_ref() {
36403            params.push("token", value);
36404        }
36405        if let Some(value) = self._max_results.as_ref() {
36406            params.push("maxResults", value.to_string());
36407        }
36408        if let Some(value) = self._issuer_id.as_ref() {
36409            params.push("issuerId", value.to_string());
36410        }
36411
36412        params.extend(self._additional_params.iter());
36413
36414        params.push("alt", "json");
36415        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass";
36416        if self._scopes.is_empty() {
36417            self._scopes
36418                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
36419        }
36420
36421        let url = params.parse_with_url(&url);
36422
36423        loop {
36424            let token = match self
36425                .hub
36426                .auth
36427                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36428                .await
36429            {
36430                Ok(token) => token,
36431                Err(e) => match dlg.token(e) {
36432                    Ok(token) => token,
36433                    Err(e) => {
36434                        dlg.finished(false);
36435                        return Err(common::Error::MissingToken(e));
36436                    }
36437                },
36438            };
36439            let mut req_result = {
36440                let client = &self.hub.client;
36441                dlg.pre_request();
36442                let mut req_builder = hyper::Request::builder()
36443                    .method(hyper::Method::GET)
36444                    .uri(url.as_str())
36445                    .header(USER_AGENT, self.hub._user_agent.clone());
36446
36447                if let Some(token) = token.as_ref() {
36448                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36449                }
36450
36451                let request = req_builder
36452                    .header(CONTENT_LENGTH, 0_u64)
36453                    .body(common::to_body::<String>(None));
36454
36455                client.request(request.unwrap()).await
36456            };
36457
36458            match req_result {
36459                Err(err) => {
36460                    if let common::Retry::After(d) = dlg.http_error(&err) {
36461                        sleep(d).await;
36462                        continue;
36463                    }
36464                    dlg.finished(false);
36465                    return Err(common::Error::HttpError(err));
36466                }
36467                Ok(res) => {
36468                    let (mut parts, body) = res.into_parts();
36469                    let mut body = common::Body::new(body);
36470                    if !parts.status.is_success() {
36471                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36472                        let error = serde_json::from_str(&common::to_string(&bytes));
36473                        let response = common::to_response(parts, bytes.into());
36474
36475                        if let common::Retry::After(d) =
36476                            dlg.http_failure(&response, error.as_ref().ok())
36477                        {
36478                            sleep(d).await;
36479                            continue;
36480                        }
36481
36482                        dlg.finished(false);
36483
36484                        return Err(match error {
36485                            Ok(value) => common::Error::BadRequest(value),
36486                            _ => common::Error::Failure(response),
36487                        });
36488                    }
36489                    let response = {
36490                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36491                        let encoded = common::to_string(&bytes);
36492                        match serde_json::from_str(&encoded) {
36493                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36494                            Err(error) => {
36495                                dlg.response_json_decode_error(&encoded, &error);
36496                                return Err(common::Error::JsonDecodeError(
36497                                    encoded.to_string(),
36498                                    error,
36499                                ));
36500                            }
36501                        }
36502                    };
36503
36504                    dlg.finished(true);
36505                    return Ok(response);
36506                }
36507            }
36508        }
36509    }
36510
36511    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` classes are available in a list. For example, if you have a list of 200 classes and you call list with `maxResults` set to 20, list will return the first 20 classes and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 classes.
36512    ///
36513    /// Sets the *token* query property to the given value.
36514    pub fn token(mut self, new_value: &str) -> TransitclasListCall<'a, C> {
36515        self._token = Some(new_value.to_string());
36516        self
36517    }
36518    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
36519    ///
36520    /// Sets the *max results* query property to the given value.
36521    pub fn max_results(mut self, new_value: i32) -> TransitclasListCall<'a, C> {
36522        self._max_results = Some(new_value);
36523        self
36524    }
36525    /// The ID of the issuer authorized to list classes.
36526    ///
36527    /// Sets the *issuer id* query property to the given value.
36528    pub fn issuer_id(mut self, new_value: i64) -> TransitclasListCall<'a, C> {
36529        self._issuer_id = Some(new_value);
36530        self
36531    }
36532    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36533    /// while executing the actual API request.
36534    ///
36535    /// ````text
36536    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36537    /// ````
36538    ///
36539    /// Sets the *delegate* property to the given value.
36540    pub fn delegate(
36541        mut self,
36542        new_value: &'a mut dyn common::Delegate,
36543    ) -> TransitclasListCall<'a, C> {
36544        self._delegate = Some(new_value);
36545        self
36546    }
36547
36548    /// Set any additional parameter of the query string used in the request.
36549    /// It should be used to set parameters which are not yet available through their own
36550    /// setters.
36551    ///
36552    /// Please note that this method must not be used to set any of the known parameters
36553    /// which have their own setter method. If done anyway, the request will fail.
36554    ///
36555    /// # Additional Parameters
36556    ///
36557    /// * *$.xgafv* (query-string) - V1 error format.
36558    /// * *access_token* (query-string) - OAuth access token.
36559    /// * *alt* (query-string) - Data format for response.
36560    /// * *callback* (query-string) - JSONP
36561    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36562    /// * *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.
36563    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36564    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36565    /// * *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.
36566    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36567    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36568    pub fn param<T>(mut self, name: T, value: T) -> TransitclasListCall<'a, C>
36569    where
36570        T: AsRef<str>,
36571    {
36572        self._additional_params
36573            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36574        self
36575    }
36576
36577    /// Identifies the authorization scope for the method you are building.
36578    ///
36579    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36580    /// [`Scope::WalletObjectIssuer`].
36581    ///
36582    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36583    /// tokens for more than one scope.
36584    ///
36585    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36586    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36587    /// sufficient, a read-write scope will do as well.
36588    pub fn add_scope<St>(mut self, scope: St) -> TransitclasListCall<'a, C>
36589    where
36590        St: AsRef<str>,
36591    {
36592        self._scopes.insert(String::from(scope.as_ref()));
36593        self
36594    }
36595    /// Identifies the authorization scope(s) for the method you are building.
36596    ///
36597    /// See [`Self::add_scope()`] for details.
36598    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasListCall<'a, C>
36599    where
36600        I: IntoIterator<Item = St>,
36601        St: AsRef<str>,
36602    {
36603        self._scopes
36604            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36605        self
36606    }
36607
36608    /// Removes all scopes, and no default scope will be used either.
36609    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36610    /// for details).
36611    pub fn clear_scopes(mut self) -> TransitclasListCall<'a, C> {
36612        self._scopes.clear();
36613        self
36614    }
36615}
36616
36617/// Updates the transit class referenced by the given class ID. This method supports patch semantics.
36618///
36619/// A builder for the *patch* method supported by a *transitclas* resource.
36620/// It is not used directly, but through a [`TransitclasMethods`] instance.
36621///
36622/// # Example
36623///
36624/// Instantiate a resource method builder
36625///
36626/// ```test_harness,no_run
36627/// # extern crate hyper;
36628/// # extern crate hyper_rustls;
36629/// # extern crate google_walletobjects1 as walletobjects1;
36630/// use walletobjects1::api::TransitClass;
36631/// # async fn dox() {
36632/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36633///
36634/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36635/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36636/// #     .with_native_roots()
36637/// #     .unwrap()
36638/// #     .https_only()
36639/// #     .enable_http2()
36640/// #     .build();
36641///
36642/// # let executor = hyper_util::rt::TokioExecutor::new();
36643/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36644/// #     secret,
36645/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36646/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
36647/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
36648/// #     ),
36649/// # ).build().await.unwrap();
36650///
36651/// # let client = hyper_util::client::legacy::Client::builder(
36652/// #     hyper_util::rt::TokioExecutor::new()
36653/// # )
36654/// # .build(
36655/// #     hyper_rustls::HttpsConnectorBuilder::new()
36656/// #         .with_native_roots()
36657/// #         .unwrap()
36658/// #         .https_or_http()
36659/// #         .enable_http2()
36660/// #         .build()
36661/// # );
36662/// # let mut hub = Walletobjects::new(client, auth);
36663/// // As the method needs a request, you would usually fill it with the desired information
36664/// // into the respective structure. Some of the parts shown here might not be applicable !
36665/// // Values shown here are possibly random and not representative !
36666/// let mut req = TransitClass::default();
36667///
36668/// // You can configure optional parameters by calling the respective setters at will, and
36669/// // execute the final call using `doit()`.
36670/// // Values shown here are possibly random and not representative !
36671/// let result = hub.transitclass().patch(req, "resourceId")
36672///              .doit().await;
36673/// # }
36674/// ```
36675pub struct TransitclasPatchCall<'a, C>
36676where
36677    C: 'a,
36678{
36679    hub: &'a Walletobjects<C>,
36680    _request: TransitClass,
36681    _resource_id: String,
36682    _delegate: Option<&'a mut dyn common::Delegate>,
36683    _additional_params: HashMap<String, String>,
36684    _scopes: BTreeSet<String>,
36685}
36686
36687impl<'a, C> common::CallBuilder for TransitclasPatchCall<'a, C> {}
36688
36689impl<'a, C> TransitclasPatchCall<'a, C>
36690where
36691    C: common::Connector,
36692{
36693    /// Perform the operation you have build so far.
36694    pub async fn doit(mut self) -> common::Result<(common::Response, TransitClass)> {
36695        use std::borrow::Cow;
36696        use std::io::{Read, Seek};
36697
36698        use common::{url::Params, ToParts};
36699        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36700
36701        let mut dd = common::DefaultDelegate;
36702        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36703        dlg.begin(common::MethodInfo {
36704            id: "walletobjects.transitclass.patch",
36705            http_method: hyper::Method::PATCH,
36706        });
36707
36708        for &field in ["alt", "resourceId"].iter() {
36709            if self._additional_params.contains_key(field) {
36710                dlg.finished(false);
36711                return Err(common::Error::FieldClash(field));
36712            }
36713        }
36714
36715        let mut params = Params::with_capacity(4 + self._additional_params.len());
36716        params.push("resourceId", self._resource_id);
36717
36718        params.extend(self._additional_params.iter());
36719
36720        params.push("alt", "json");
36721        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass/{resourceId}";
36722        if self._scopes.is_empty() {
36723            self._scopes
36724                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
36725        }
36726
36727        #[allow(clippy::single_element_loop)]
36728        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
36729            url = params.uri_replacement(url, param_name, find_this, false);
36730        }
36731        {
36732            let to_remove = ["resourceId"];
36733            params.remove_params(&to_remove);
36734        }
36735
36736        let url = params.parse_with_url(&url);
36737
36738        let mut json_mime_type = mime::APPLICATION_JSON;
36739        let mut request_value_reader = {
36740            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36741            common::remove_json_null_values(&mut value);
36742            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36743            serde_json::to_writer(&mut dst, &value).unwrap();
36744            dst
36745        };
36746        let request_size = request_value_reader
36747            .seek(std::io::SeekFrom::End(0))
36748            .unwrap();
36749        request_value_reader
36750            .seek(std::io::SeekFrom::Start(0))
36751            .unwrap();
36752
36753        loop {
36754            let token = match self
36755                .hub
36756                .auth
36757                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36758                .await
36759            {
36760                Ok(token) => token,
36761                Err(e) => match dlg.token(e) {
36762                    Ok(token) => token,
36763                    Err(e) => {
36764                        dlg.finished(false);
36765                        return Err(common::Error::MissingToken(e));
36766                    }
36767                },
36768            };
36769            request_value_reader
36770                .seek(std::io::SeekFrom::Start(0))
36771                .unwrap();
36772            let mut req_result = {
36773                let client = &self.hub.client;
36774                dlg.pre_request();
36775                let mut req_builder = hyper::Request::builder()
36776                    .method(hyper::Method::PATCH)
36777                    .uri(url.as_str())
36778                    .header(USER_AGENT, self.hub._user_agent.clone());
36779
36780                if let Some(token) = token.as_ref() {
36781                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36782                }
36783
36784                let request = req_builder
36785                    .header(CONTENT_TYPE, json_mime_type.to_string())
36786                    .header(CONTENT_LENGTH, request_size as u64)
36787                    .body(common::to_body(
36788                        request_value_reader.get_ref().clone().into(),
36789                    ));
36790
36791                client.request(request.unwrap()).await
36792            };
36793
36794            match req_result {
36795                Err(err) => {
36796                    if let common::Retry::After(d) = dlg.http_error(&err) {
36797                        sleep(d).await;
36798                        continue;
36799                    }
36800                    dlg.finished(false);
36801                    return Err(common::Error::HttpError(err));
36802                }
36803                Ok(res) => {
36804                    let (mut parts, body) = res.into_parts();
36805                    let mut body = common::Body::new(body);
36806                    if !parts.status.is_success() {
36807                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36808                        let error = serde_json::from_str(&common::to_string(&bytes));
36809                        let response = common::to_response(parts, bytes.into());
36810
36811                        if let common::Retry::After(d) =
36812                            dlg.http_failure(&response, error.as_ref().ok())
36813                        {
36814                            sleep(d).await;
36815                            continue;
36816                        }
36817
36818                        dlg.finished(false);
36819
36820                        return Err(match error {
36821                            Ok(value) => common::Error::BadRequest(value),
36822                            _ => common::Error::Failure(response),
36823                        });
36824                    }
36825                    let response = {
36826                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36827                        let encoded = common::to_string(&bytes);
36828                        match serde_json::from_str(&encoded) {
36829                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36830                            Err(error) => {
36831                                dlg.response_json_decode_error(&encoded, &error);
36832                                return Err(common::Error::JsonDecodeError(
36833                                    encoded.to_string(),
36834                                    error,
36835                                ));
36836                            }
36837                        }
36838                    };
36839
36840                    dlg.finished(true);
36841                    return Ok(response);
36842                }
36843            }
36844        }
36845    }
36846
36847    ///
36848    /// Sets the *request* property to the given value.
36849    ///
36850    /// Even though the property as already been set when instantiating this call,
36851    /// we provide this method for API completeness.
36852    pub fn request(mut self, new_value: TransitClass) -> TransitclasPatchCall<'a, C> {
36853        self._request = new_value;
36854        self
36855    }
36856    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
36857    ///
36858    /// Sets the *resource id* path property to the given value.
36859    ///
36860    /// Even though the property as already been set when instantiating this call,
36861    /// we provide this method for API completeness.
36862    pub fn resource_id(mut self, new_value: &str) -> TransitclasPatchCall<'a, C> {
36863        self._resource_id = new_value.to_string();
36864        self
36865    }
36866    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36867    /// while executing the actual API request.
36868    ///
36869    /// ````text
36870    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36871    /// ````
36872    ///
36873    /// Sets the *delegate* property to the given value.
36874    pub fn delegate(
36875        mut self,
36876        new_value: &'a mut dyn common::Delegate,
36877    ) -> TransitclasPatchCall<'a, C> {
36878        self._delegate = Some(new_value);
36879        self
36880    }
36881
36882    /// Set any additional parameter of the query string used in the request.
36883    /// It should be used to set parameters which are not yet available through their own
36884    /// setters.
36885    ///
36886    /// Please note that this method must not be used to set any of the known parameters
36887    /// which have their own setter method. If done anyway, the request will fail.
36888    ///
36889    /// # Additional Parameters
36890    ///
36891    /// * *$.xgafv* (query-string) - V1 error format.
36892    /// * *access_token* (query-string) - OAuth access token.
36893    /// * *alt* (query-string) - Data format for response.
36894    /// * *callback* (query-string) - JSONP
36895    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36896    /// * *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.
36897    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36898    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36899    /// * *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.
36900    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36901    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36902    pub fn param<T>(mut self, name: T, value: T) -> TransitclasPatchCall<'a, C>
36903    where
36904        T: AsRef<str>,
36905    {
36906        self._additional_params
36907            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36908        self
36909    }
36910
36911    /// Identifies the authorization scope for the method you are building.
36912    ///
36913    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36914    /// [`Scope::WalletObjectIssuer`].
36915    ///
36916    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36917    /// tokens for more than one scope.
36918    ///
36919    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36920    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36921    /// sufficient, a read-write scope will do as well.
36922    pub fn add_scope<St>(mut self, scope: St) -> TransitclasPatchCall<'a, C>
36923    where
36924        St: AsRef<str>,
36925    {
36926        self._scopes.insert(String::from(scope.as_ref()));
36927        self
36928    }
36929    /// Identifies the authorization scope(s) for the method you are building.
36930    ///
36931    /// See [`Self::add_scope()`] for details.
36932    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasPatchCall<'a, C>
36933    where
36934        I: IntoIterator<Item = St>,
36935        St: AsRef<str>,
36936    {
36937        self._scopes
36938            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36939        self
36940    }
36941
36942    /// Removes all scopes, and no default scope will be used either.
36943    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36944    /// for details).
36945    pub fn clear_scopes(mut self) -> TransitclasPatchCall<'a, C> {
36946        self._scopes.clear();
36947        self
36948    }
36949}
36950
36951/// Updates the transit class referenced by the given class ID.
36952///
36953/// A builder for the *update* method supported by a *transitclas* resource.
36954/// It is not used directly, but through a [`TransitclasMethods`] instance.
36955///
36956/// # Example
36957///
36958/// Instantiate a resource method builder
36959///
36960/// ```test_harness,no_run
36961/// # extern crate hyper;
36962/// # extern crate hyper_rustls;
36963/// # extern crate google_walletobjects1 as walletobjects1;
36964/// use walletobjects1::api::TransitClass;
36965/// # async fn dox() {
36966/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36967///
36968/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36969/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36970/// #     .with_native_roots()
36971/// #     .unwrap()
36972/// #     .https_only()
36973/// #     .enable_http2()
36974/// #     .build();
36975///
36976/// # let executor = hyper_util::rt::TokioExecutor::new();
36977/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36978/// #     secret,
36979/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36980/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
36981/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
36982/// #     ),
36983/// # ).build().await.unwrap();
36984///
36985/// # let client = hyper_util::client::legacy::Client::builder(
36986/// #     hyper_util::rt::TokioExecutor::new()
36987/// # )
36988/// # .build(
36989/// #     hyper_rustls::HttpsConnectorBuilder::new()
36990/// #         .with_native_roots()
36991/// #         .unwrap()
36992/// #         .https_or_http()
36993/// #         .enable_http2()
36994/// #         .build()
36995/// # );
36996/// # let mut hub = Walletobjects::new(client, auth);
36997/// // As the method needs a request, you would usually fill it with the desired information
36998/// // into the respective structure. Some of the parts shown here might not be applicable !
36999/// // Values shown here are possibly random and not representative !
37000/// let mut req = TransitClass::default();
37001///
37002/// // You can configure optional parameters by calling the respective setters at will, and
37003/// // execute the final call using `doit()`.
37004/// // Values shown here are possibly random and not representative !
37005/// let result = hub.transitclass().update(req, "resourceId")
37006///              .doit().await;
37007/// # }
37008/// ```
37009pub struct TransitclasUpdateCall<'a, C>
37010where
37011    C: 'a,
37012{
37013    hub: &'a Walletobjects<C>,
37014    _request: TransitClass,
37015    _resource_id: String,
37016    _delegate: Option<&'a mut dyn common::Delegate>,
37017    _additional_params: HashMap<String, String>,
37018    _scopes: BTreeSet<String>,
37019}
37020
37021impl<'a, C> common::CallBuilder for TransitclasUpdateCall<'a, C> {}
37022
37023impl<'a, C> TransitclasUpdateCall<'a, C>
37024where
37025    C: common::Connector,
37026{
37027    /// Perform the operation you have build so far.
37028    pub async fn doit(mut self) -> common::Result<(common::Response, TransitClass)> {
37029        use std::borrow::Cow;
37030        use std::io::{Read, Seek};
37031
37032        use common::{url::Params, ToParts};
37033        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37034
37035        let mut dd = common::DefaultDelegate;
37036        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37037        dlg.begin(common::MethodInfo {
37038            id: "walletobjects.transitclass.update",
37039            http_method: hyper::Method::PUT,
37040        });
37041
37042        for &field in ["alt", "resourceId"].iter() {
37043            if self._additional_params.contains_key(field) {
37044                dlg.finished(false);
37045                return Err(common::Error::FieldClash(field));
37046            }
37047        }
37048
37049        let mut params = Params::with_capacity(4 + self._additional_params.len());
37050        params.push("resourceId", self._resource_id);
37051
37052        params.extend(self._additional_params.iter());
37053
37054        params.push("alt", "json");
37055        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass/{resourceId}";
37056        if self._scopes.is_empty() {
37057            self._scopes
37058                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
37059        }
37060
37061        #[allow(clippy::single_element_loop)]
37062        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
37063            url = params.uri_replacement(url, param_name, find_this, false);
37064        }
37065        {
37066            let to_remove = ["resourceId"];
37067            params.remove_params(&to_remove);
37068        }
37069
37070        let url = params.parse_with_url(&url);
37071
37072        let mut json_mime_type = mime::APPLICATION_JSON;
37073        let mut request_value_reader = {
37074            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37075            common::remove_json_null_values(&mut value);
37076            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37077            serde_json::to_writer(&mut dst, &value).unwrap();
37078            dst
37079        };
37080        let request_size = request_value_reader
37081            .seek(std::io::SeekFrom::End(0))
37082            .unwrap();
37083        request_value_reader
37084            .seek(std::io::SeekFrom::Start(0))
37085            .unwrap();
37086
37087        loop {
37088            let token = match self
37089                .hub
37090                .auth
37091                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37092                .await
37093            {
37094                Ok(token) => token,
37095                Err(e) => match dlg.token(e) {
37096                    Ok(token) => token,
37097                    Err(e) => {
37098                        dlg.finished(false);
37099                        return Err(common::Error::MissingToken(e));
37100                    }
37101                },
37102            };
37103            request_value_reader
37104                .seek(std::io::SeekFrom::Start(0))
37105                .unwrap();
37106            let mut req_result = {
37107                let client = &self.hub.client;
37108                dlg.pre_request();
37109                let mut req_builder = hyper::Request::builder()
37110                    .method(hyper::Method::PUT)
37111                    .uri(url.as_str())
37112                    .header(USER_AGENT, self.hub._user_agent.clone());
37113
37114                if let Some(token) = token.as_ref() {
37115                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37116                }
37117
37118                let request = req_builder
37119                    .header(CONTENT_TYPE, json_mime_type.to_string())
37120                    .header(CONTENT_LENGTH, request_size as u64)
37121                    .body(common::to_body(
37122                        request_value_reader.get_ref().clone().into(),
37123                    ));
37124
37125                client.request(request.unwrap()).await
37126            };
37127
37128            match req_result {
37129                Err(err) => {
37130                    if let common::Retry::After(d) = dlg.http_error(&err) {
37131                        sleep(d).await;
37132                        continue;
37133                    }
37134                    dlg.finished(false);
37135                    return Err(common::Error::HttpError(err));
37136                }
37137                Ok(res) => {
37138                    let (mut parts, body) = res.into_parts();
37139                    let mut body = common::Body::new(body);
37140                    if !parts.status.is_success() {
37141                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37142                        let error = serde_json::from_str(&common::to_string(&bytes));
37143                        let response = common::to_response(parts, bytes.into());
37144
37145                        if let common::Retry::After(d) =
37146                            dlg.http_failure(&response, error.as_ref().ok())
37147                        {
37148                            sleep(d).await;
37149                            continue;
37150                        }
37151
37152                        dlg.finished(false);
37153
37154                        return Err(match error {
37155                            Ok(value) => common::Error::BadRequest(value),
37156                            _ => common::Error::Failure(response),
37157                        });
37158                    }
37159                    let response = {
37160                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37161                        let encoded = common::to_string(&bytes);
37162                        match serde_json::from_str(&encoded) {
37163                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37164                            Err(error) => {
37165                                dlg.response_json_decode_error(&encoded, &error);
37166                                return Err(common::Error::JsonDecodeError(
37167                                    encoded.to_string(),
37168                                    error,
37169                                ));
37170                            }
37171                        }
37172                    };
37173
37174                    dlg.finished(true);
37175                    return Ok(response);
37176                }
37177            }
37178        }
37179    }
37180
37181    ///
37182    /// Sets the *request* property to the given value.
37183    ///
37184    /// Even though the property as already been set when instantiating this call,
37185    /// we provide this method for API completeness.
37186    pub fn request(mut self, new_value: TransitClass) -> TransitclasUpdateCall<'a, C> {
37187        self._request = new_value;
37188        self
37189    }
37190    /// The unique identifier for a class. This ID must be unique across all classes from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
37191    ///
37192    /// Sets the *resource id* path property to the given value.
37193    ///
37194    /// Even though the property as already been set when instantiating this call,
37195    /// we provide this method for API completeness.
37196    pub fn resource_id(mut self, new_value: &str) -> TransitclasUpdateCall<'a, C> {
37197        self._resource_id = new_value.to_string();
37198        self
37199    }
37200    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37201    /// while executing the actual API request.
37202    ///
37203    /// ````text
37204    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37205    /// ````
37206    ///
37207    /// Sets the *delegate* property to the given value.
37208    pub fn delegate(
37209        mut self,
37210        new_value: &'a mut dyn common::Delegate,
37211    ) -> TransitclasUpdateCall<'a, C> {
37212        self._delegate = Some(new_value);
37213        self
37214    }
37215
37216    /// Set any additional parameter of the query string used in the request.
37217    /// It should be used to set parameters which are not yet available through their own
37218    /// setters.
37219    ///
37220    /// Please note that this method must not be used to set any of the known parameters
37221    /// which have their own setter method. If done anyway, the request will fail.
37222    ///
37223    /// # Additional Parameters
37224    ///
37225    /// * *$.xgafv* (query-string) - V1 error format.
37226    /// * *access_token* (query-string) - OAuth access token.
37227    /// * *alt* (query-string) - Data format for response.
37228    /// * *callback* (query-string) - JSONP
37229    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37230    /// * *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.
37231    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37232    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37233    /// * *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.
37234    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37235    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37236    pub fn param<T>(mut self, name: T, value: T) -> TransitclasUpdateCall<'a, C>
37237    where
37238        T: AsRef<str>,
37239    {
37240        self._additional_params
37241            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37242        self
37243    }
37244
37245    /// Identifies the authorization scope for the method you are building.
37246    ///
37247    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37248    /// [`Scope::WalletObjectIssuer`].
37249    ///
37250    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37251    /// tokens for more than one scope.
37252    ///
37253    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37254    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37255    /// sufficient, a read-write scope will do as well.
37256    pub fn add_scope<St>(mut self, scope: St) -> TransitclasUpdateCall<'a, C>
37257    where
37258        St: AsRef<str>,
37259    {
37260        self._scopes.insert(String::from(scope.as_ref()));
37261        self
37262    }
37263    /// Identifies the authorization scope(s) for the method you are building.
37264    ///
37265    /// See [`Self::add_scope()`] for details.
37266    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasUpdateCall<'a, C>
37267    where
37268        I: IntoIterator<Item = St>,
37269        St: AsRef<str>,
37270    {
37271        self._scopes
37272            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37273        self
37274    }
37275
37276    /// Removes all scopes, and no default scope will be used either.
37277    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37278    /// for details).
37279    pub fn clear_scopes(mut self) -> TransitclasUpdateCall<'a, C> {
37280        self._scopes.clear();
37281        self
37282    }
37283}
37284
37285/// Adds a message to the transit object referenced by the given object ID.
37286///
37287/// A builder for the *addmessage* method supported by a *transitobject* resource.
37288/// It is not used directly, but through a [`TransitobjectMethods`] instance.
37289///
37290/// # Example
37291///
37292/// Instantiate a resource method builder
37293///
37294/// ```test_harness,no_run
37295/// # extern crate hyper;
37296/// # extern crate hyper_rustls;
37297/// # extern crate google_walletobjects1 as walletobjects1;
37298/// use walletobjects1::api::AddMessageRequest;
37299/// # async fn dox() {
37300/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37301///
37302/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37303/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37304/// #     .with_native_roots()
37305/// #     .unwrap()
37306/// #     .https_only()
37307/// #     .enable_http2()
37308/// #     .build();
37309///
37310/// # let executor = hyper_util::rt::TokioExecutor::new();
37311/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37312/// #     secret,
37313/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37314/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
37315/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
37316/// #     ),
37317/// # ).build().await.unwrap();
37318///
37319/// # let client = hyper_util::client::legacy::Client::builder(
37320/// #     hyper_util::rt::TokioExecutor::new()
37321/// # )
37322/// # .build(
37323/// #     hyper_rustls::HttpsConnectorBuilder::new()
37324/// #         .with_native_roots()
37325/// #         .unwrap()
37326/// #         .https_or_http()
37327/// #         .enable_http2()
37328/// #         .build()
37329/// # );
37330/// # let mut hub = Walletobjects::new(client, auth);
37331/// // As the method needs a request, you would usually fill it with the desired information
37332/// // into the respective structure. Some of the parts shown here might not be applicable !
37333/// // Values shown here are possibly random and not representative !
37334/// let mut req = AddMessageRequest::default();
37335///
37336/// // You can configure optional parameters by calling the respective setters at will, and
37337/// // execute the final call using `doit()`.
37338/// // Values shown here are possibly random and not representative !
37339/// let result = hub.transitobject().addmessage(req, "resourceId")
37340///              .doit().await;
37341/// # }
37342/// ```
37343pub struct TransitobjectAddmessageCall<'a, C>
37344where
37345    C: 'a,
37346{
37347    hub: &'a Walletobjects<C>,
37348    _request: AddMessageRequest,
37349    _resource_id: String,
37350    _delegate: Option<&'a mut dyn common::Delegate>,
37351    _additional_params: HashMap<String, String>,
37352    _scopes: BTreeSet<String>,
37353}
37354
37355impl<'a, C> common::CallBuilder for TransitobjectAddmessageCall<'a, C> {}
37356
37357impl<'a, C> TransitobjectAddmessageCall<'a, C>
37358where
37359    C: common::Connector,
37360{
37361    /// Perform the operation you have build so far.
37362    pub async fn doit(
37363        mut self,
37364    ) -> common::Result<(common::Response, TransitObjectAddMessageResponse)> {
37365        use std::borrow::Cow;
37366        use std::io::{Read, Seek};
37367
37368        use common::{url::Params, ToParts};
37369        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37370
37371        let mut dd = common::DefaultDelegate;
37372        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37373        dlg.begin(common::MethodInfo {
37374            id: "walletobjects.transitobject.addmessage",
37375            http_method: hyper::Method::POST,
37376        });
37377
37378        for &field in ["alt", "resourceId"].iter() {
37379            if self._additional_params.contains_key(field) {
37380                dlg.finished(false);
37381                return Err(common::Error::FieldClash(field));
37382            }
37383        }
37384
37385        let mut params = Params::with_capacity(4 + self._additional_params.len());
37386        params.push("resourceId", self._resource_id);
37387
37388        params.extend(self._additional_params.iter());
37389
37390        params.push("alt", "json");
37391        let mut url =
37392            self.hub._base_url.clone() + "walletobjects/v1/transitObject/{resourceId}/addMessage";
37393        if self._scopes.is_empty() {
37394            self._scopes
37395                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
37396        }
37397
37398        #[allow(clippy::single_element_loop)]
37399        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
37400            url = params.uri_replacement(url, param_name, find_this, false);
37401        }
37402        {
37403            let to_remove = ["resourceId"];
37404            params.remove_params(&to_remove);
37405        }
37406
37407        let url = params.parse_with_url(&url);
37408
37409        let mut json_mime_type = mime::APPLICATION_JSON;
37410        let mut request_value_reader = {
37411            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37412            common::remove_json_null_values(&mut value);
37413            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37414            serde_json::to_writer(&mut dst, &value).unwrap();
37415            dst
37416        };
37417        let request_size = request_value_reader
37418            .seek(std::io::SeekFrom::End(0))
37419            .unwrap();
37420        request_value_reader
37421            .seek(std::io::SeekFrom::Start(0))
37422            .unwrap();
37423
37424        loop {
37425            let token = match self
37426                .hub
37427                .auth
37428                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37429                .await
37430            {
37431                Ok(token) => token,
37432                Err(e) => match dlg.token(e) {
37433                    Ok(token) => token,
37434                    Err(e) => {
37435                        dlg.finished(false);
37436                        return Err(common::Error::MissingToken(e));
37437                    }
37438                },
37439            };
37440            request_value_reader
37441                .seek(std::io::SeekFrom::Start(0))
37442                .unwrap();
37443            let mut req_result = {
37444                let client = &self.hub.client;
37445                dlg.pre_request();
37446                let mut req_builder = hyper::Request::builder()
37447                    .method(hyper::Method::POST)
37448                    .uri(url.as_str())
37449                    .header(USER_AGENT, self.hub._user_agent.clone());
37450
37451                if let Some(token) = token.as_ref() {
37452                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37453                }
37454
37455                let request = req_builder
37456                    .header(CONTENT_TYPE, json_mime_type.to_string())
37457                    .header(CONTENT_LENGTH, request_size as u64)
37458                    .body(common::to_body(
37459                        request_value_reader.get_ref().clone().into(),
37460                    ));
37461
37462                client.request(request.unwrap()).await
37463            };
37464
37465            match req_result {
37466                Err(err) => {
37467                    if let common::Retry::After(d) = dlg.http_error(&err) {
37468                        sleep(d).await;
37469                        continue;
37470                    }
37471                    dlg.finished(false);
37472                    return Err(common::Error::HttpError(err));
37473                }
37474                Ok(res) => {
37475                    let (mut parts, body) = res.into_parts();
37476                    let mut body = common::Body::new(body);
37477                    if !parts.status.is_success() {
37478                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37479                        let error = serde_json::from_str(&common::to_string(&bytes));
37480                        let response = common::to_response(parts, bytes.into());
37481
37482                        if let common::Retry::After(d) =
37483                            dlg.http_failure(&response, error.as_ref().ok())
37484                        {
37485                            sleep(d).await;
37486                            continue;
37487                        }
37488
37489                        dlg.finished(false);
37490
37491                        return Err(match error {
37492                            Ok(value) => common::Error::BadRequest(value),
37493                            _ => common::Error::Failure(response),
37494                        });
37495                    }
37496                    let response = {
37497                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37498                        let encoded = common::to_string(&bytes);
37499                        match serde_json::from_str(&encoded) {
37500                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37501                            Err(error) => {
37502                                dlg.response_json_decode_error(&encoded, &error);
37503                                return Err(common::Error::JsonDecodeError(
37504                                    encoded.to_string(),
37505                                    error,
37506                                ));
37507                            }
37508                        }
37509                    };
37510
37511                    dlg.finished(true);
37512                    return Ok(response);
37513                }
37514            }
37515        }
37516    }
37517
37518    ///
37519    /// Sets the *request* property to the given value.
37520    ///
37521    /// Even though the property as already been set when instantiating this call,
37522    /// we provide this method for API completeness.
37523    pub fn request(mut self, new_value: AddMessageRequest) -> TransitobjectAddmessageCall<'a, C> {
37524        self._request = new_value;
37525        self
37526    }
37527    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
37528    ///
37529    /// Sets the *resource id* path property to the given value.
37530    ///
37531    /// Even though the property as already been set when instantiating this call,
37532    /// we provide this method for API completeness.
37533    pub fn resource_id(mut self, new_value: &str) -> TransitobjectAddmessageCall<'a, C> {
37534        self._resource_id = new_value.to_string();
37535        self
37536    }
37537    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37538    /// while executing the actual API request.
37539    ///
37540    /// ````text
37541    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37542    /// ````
37543    ///
37544    /// Sets the *delegate* property to the given value.
37545    pub fn delegate(
37546        mut self,
37547        new_value: &'a mut dyn common::Delegate,
37548    ) -> TransitobjectAddmessageCall<'a, C> {
37549        self._delegate = Some(new_value);
37550        self
37551    }
37552
37553    /// Set any additional parameter of the query string used in the request.
37554    /// It should be used to set parameters which are not yet available through their own
37555    /// setters.
37556    ///
37557    /// Please note that this method must not be used to set any of the known parameters
37558    /// which have their own setter method. If done anyway, the request will fail.
37559    ///
37560    /// # Additional Parameters
37561    ///
37562    /// * *$.xgafv* (query-string) - V1 error format.
37563    /// * *access_token* (query-string) - OAuth access token.
37564    /// * *alt* (query-string) - Data format for response.
37565    /// * *callback* (query-string) - JSONP
37566    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37567    /// * *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.
37568    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37569    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37570    /// * *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.
37571    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37572    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37573    pub fn param<T>(mut self, name: T, value: T) -> TransitobjectAddmessageCall<'a, C>
37574    where
37575        T: AsRef<str>,
37576    {
37577        self._additional_params
37578            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37579        self
37580    }
37581
37582    /// Identifies the authorization scope for the method you are building.
37583    ///
37584    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37585    /// [`Scope::WalletObjectIssuer`].
37586    ///
37587    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37588    /// tokens for more than one scope.
37589    ///
37590    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37591    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37592    /// sufficient, a read-write scope will do as well.
37593    pub fn add_scope<St>(mut self, scope: St) -> TransitobjectAddmessageCall<'a, C>
37594    where
37595        St: AsRef<str>,
37596    {
37597        self._scopes.insert(String::from(scope.as_ref()));
37598        self
37599    }
37600    /// Identifies the authorization scope(s) for the method you are building.
37601    ///
37602    /// See [`Self::add_scope()`] for details.
37603    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectAddmessageCall<'a, C>
37604    where
37605        I: IntoIterator<Item = St>,
37606        St: AsRef<str>,
37607    {
37608        self._scopes
37609            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37610        self
37611    }
37612
37613    /// Removes all scopes, and no default scope will be used either.
37614    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37615    /// for details).
37616    pub fn clear_scopes(mut self) -> TransitobjectAddmessageCall<'a, C> {
37617        self._scopes.clear();
37618        self
37619    }
37620}
37621
37622/// Returns the transit object with the given object ID.
37623///
37624/// A builder for the *get* method supported by a *transitobject* resource.
37625/// It is not used directly, but through a [`TransitobjectMethods`] instance.
37626///
37627/// # Example
37628///
37629/// Instantiate a resource method builder
37630///
37631/// ```test_harness,no_run
37632/// # extern crate hyper;
37633/// # extern crate hyper_rustls;
37634/// # extern crate google_walletobjects1 as walletobjects1;
37635/// # async fn dox() {
37636/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37637///
37638/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37639/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37640/// #     .with_native_roots()
37641/// #     .unwrap()
37642/// #     .https_only()
37643/// #     .enable_http2()
37644/// #     .build();
37645///
37646/// # let executor = hyper_util::rt::TokioExecutor::new();
37647/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37648/// #     secret,
37649/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37650/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
37651/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
37652/// #     ),
37653/// # ).build().await.unwrap();
37654///
37655/// # let client = hyper_util::client::legacy::Client::builder(
37656/// #     hyper_util::rt::TokioExecutor::new()
37657/// # )
37658/// # .build(
37659/// #     hyper_rustls::HttpsConnectorBuilder::new()
37660/// #         .with_native_roots()
37661/// #         .unwrap()
37662/// #         .https_or_http()
37663/// #         .enable_http2()
37664/// #         .build()
37665/// # );
37666/// # let mut hub = Walletobjects::new(client, auth);
37667/// // You can configure optional parameters by calling the respective setters at will, and
37668/// // execute the final call using `doit()`.
37669/// // Values shown here are possibly random and not representative !
37670/// let result = hub.transitobject().get("resourceId")
37671///              .doit().await;
37672/// # }
37673/// ```
37674pub struct TransitobjectGetCall<'a, C>
37675where
37676    C: 'a,
37677{
37678    hub: &'a Walletobjects<C>,
37679    _resource_id: String,
37680    _delegate: Option<&'a mut dyn common::Delegate>,
37681    _additional_params: HashMap<String, String>,
37682    _scopes: BTreeSet<String>,
37683}
37684
37685impl<'a, C> common::CallBuilder for TransitobjectGetCall<'a, C> {}
37686
37687impl<'a, C> TransitobjectGetCall<'a, C>
37688where
37689    C: common::Connector,
37690{
37691    /// Perform the operation you have build so far.
37692    pub async fn doit(mut self) -> common::Result<(common::Response, TransitObject)> {
37693        use std::borrow::Cow;
37694        use std::io::{Read, Seek};
37695
37696        use common::{url::Params, ToParts};
37697        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37698
37699        let mut dd = common::DefaultDelegate;
37700        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37701        dlg.begin(common::MethodInfo {
37702            id: "walletobjects.transitobject.get",
37703            http_method: hyper::Method::GET,
37704        });
37705
37706        for &field in ["alt", "resourceId"].iter() {
37707            if self._additional_params.contains_key(field) {
37708                dlg.finished(false);
37709                return Err(common::Error::FieldClash(field));
37710            }
37711        }
37712
37713        let mut params = Params::with_capacity(3 + self._additional_params.len());
37714        params.push("resourceId", self._resource_id);
37715
37716        params.extend(self._additional_params.iter());
37717
37718        params.push("alt", "json");
37719        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject/{resourceId}";
37720        if self._scopes.is_empty() {
37721            self._scopes
37722                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
37723        }
37724
37725        #[allow(clippy::single_element_loop)]
37726        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
37727            url = params.uri_replacement(url, param_name, find_this, false);
37728        }
37729        {
37730            let to_remove = ["resourceId"];
37731            params.remove_params(&to_remove);
37732        }
37733
37734        let url = params.parse_with_url(&url);
37735
37736        loop {
37737            let token = match self
37738                .hub
37739                .auth
37740                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37741                .await
37742            {
37743                Ok(token) => token,
37744                Err(e) => match dlg.token(e) {
37745                    Ok(token) => token,
37746                    Err(e) => {
37747                        dlg.finished(false);
37748                        return Err(common::Error::MissingToken(e));
37749                    }
37750                },
37751            };
37752            let mut req_result = {
37753                let client = &self.hub.client;
37754                dlg.pre_request();
37755                let mut req_builder = hyper::Request::builder()
37756                    .method(hyper::Method::GET)
37757                    .uri(url.as_str())
37758                    .header(USER_AGENT, self.hub._user_agent.clone());
37759
37760                if let Some(token) = token.as_ref() {
37761                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37762                }
37763
37764                let request = req_builder
37765                    .header(CONTENT_LENGTH, 0_u64)
37766                    .body(common::to_body::<String>(None));
37767
37768                client.request(request.unwrap()).await
37769            };
37770
37771            match req_result {
37772                Err(err) => {
37773                    if let common::Retry::After(d) = dlg.http_error(&err) {
37774                        sleep(d).await;
37775                        continue;
37776                    }
37777                    dlg.finished(false);
37778                    return Err(common::Error::HttpError(err));
37779                }
37780                Ok(res) => {
37781                    let (mut parts, body) = res.into_parts();
37782                    let mut body = common::Body::new(body);
37783                    if !parts.status.is_success() {
37784                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37785                        let error = serde_json::from_str(&common::to_string(&bytes));
37786                        let response = common::to_response(parts, bytes.into());
37787
37788                        if let common::Retry::After(d) =
37789                            dlg.http_failure(&response, error.as_ref().ok())
37790                        {
37791                            sleep(d).await;
37792                            continue;
37793                        }
37794
37795                        dlg.finished(false);
37796
37797                        return Err(match error {
37798                            Ok(value) => common::Error::BadRequest(value),
37799                            _ => common::Error::Failure(response),
37800                        });
37801                    }
37802                    let response = {
37803                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37804                        let encoded = common::to_string(&bytes);
37805                        match serde_json::from_str(&encoded) {
37806                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37807                            Err(error) => {
37808                                dlg.response_json_decode_error(&encoded, &error);
37809                                return Err(common::Error::JsonDecodeError(
37810                                    encoded.to_string(),
37811                                    error,
37812                                ));
37813                            }
37814                        }
37815                    };
37816
37817                    dlg.finished(true);
37818                    return Ok(response);
37819                }
37820            }
37821        }
37822    }
37823
37824    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
37825    ///
37826    /// Sets the *resource id* path property to the given value.
37827    ///
37828    /// Even though the property as already been set when instantiating this call,
37829    /// we provide this method for API completeness.
37830    pub fn resource_id(mut self, new_value: &str) -> TransitobjectGetCall<'a, C> {
37831        self._resource_id = new_value.to_string();
37832        self
37833    }
37834    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37835    /// while executing the actual API request.
37836    ///
37837    /// ````text
37838    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37839    /// ````
37840    ///
37841    /// Sets the *delegate* property to the given value.
37842    pub fn delegate(
37843        mut self,
37844        new_value: &'a mut dyn common::Delegate,
37845    ) -> TransitobjectGetCall<'a, C> {
37846        self._delegate = Some(new_value);
37847        self
37848    }
37849
37850    /// Set any additional parameter of the query string used in the request.
37851    /// It should be used to set parameters which are not yet available through their own
37852    /// setters.
37853    ///
37854    /// Please note that this method must not be used to set any of the known parameters
37855    /// which have their own setter method. If done anyway, the request will fail.
37856    ///
37857    /// # Additional Parameters
37858    ///
37859    /// * *$.xgafv* (query-string) - V1 error format.
37860    /// * *access_token* (query-string) - OAuth access token.
37861    /// * *alt* (query-string) - Data format for response.
37862    /// * *callback* (query-string) - JSONP
37863    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37864    /// * *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.
37865    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37866    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37867    /// * *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.
37868    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37869    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37870    pub fn param<T>(mut self, name: T, value: T) -> TransitobjectGetCall<'a, C>
37871    where
37872        T: AsRef<str>,
37873    {
37874        self._additional_params
37875            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37876        self
37877    }
37878
37879    /// Identifies the authorization scope for the method you are building.
37880    ///
37881    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37882    /// [`Scope::WalletObjectIssuer`].
37883    ///
37884    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37885    /// tokens for more than one scope.
37886    ///
37887    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37888    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37889    /// sufficient, a read-write scope will do as well.
37890    pub fn add_scope<St>(mut self, scope: St) -> TransitobjectGetCall<'a, C>
37891    where
37892        St: AsRef<str>,
37893    {
37894        self._scopes.insert(String::from(scope.as_ref()));
37895        self
37896    }
37897    /// Identifies the authorization scope(s) for the method you are building.
37898    ///
37899    /// See [`Self::add_scope()`] for details.
37900    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectGetCall<'a, C>
37901    where
37902        I: IntoIterator<Item = St>,
37903        St: AsRef<str>,
37904    {
37905        self._scopes
37906            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37907        self
37908    }
37909
37910    /// Removes all scopes, and no default scope will be used either.
37911    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37912    /// for details).
37913    pub fn clear_scopes(mut self) -> TransitobjectGetCall<'a, C> {
37914        self._scopes.clear();
37915        self
37916    }
37917}
37918
37919/// Inserts an transit object with the given ID and properties.
37920///
37921/// A builder for the *insert* method supported by a *transitobject* resource.
37922/// It is not used directly, but through a [`TransitobjectMethods`] instance.
37923///
37924/// # Example
37925///
37926/// Instantiate a resource method builder
37927///
37928/// ```test_harness,no_run
37929/// # extern crate hyper;
37930/// # extern crate hyper_rustls;
37931/// # extern crate google_walletobjects1 as walletobjects1;
37932/// use walletobjects1::api::TransitObject;
37933/// # async fn dox() {
37934/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37935///
37936/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37937/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37938/// #     .with_native_roots()
37939/// #     .unwrap()
37940/// #     .https_only()
37941/// #     .enable_http2()
37942/// #     .build();
37943///
37944/// # let executor = hyper_util::rt::TokioExecutor::new();
37945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37946/// #     secret,
37947/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37948/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
37949/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
37950/// #     ),
37951/// # ).build().await.unwrap();
37952///
37953/// # let client = hyper_util::client::legacy::Client::builder(
37954/// #     hyper_util::rt::TokioExecutor::new()
37955/// # )
37956/// # .build(
37957/// #     hyper_rustls::HttpsConnectorBuilder::new()
37958/// #         .with_native_roots()
37959/// #         .unwrap()
37960/// #         .https_or_http()
37961/// #         .enable_http2()
37962/// #         .build()
37963/// # );
37964/// # let mut hub = Walletobjects::new(client, auth);
37965/// // As the method needs a request, you would usually fill it with the desired information
37966/// // into the respective structure. Some of the parts shown here might not be applicable !
37967/// // Values shown here are possibly random and not representative !
37968/// let mut req = TransitObject::default();
37969///
37970/// // You can configure optional parameters by calling the respective setters at will, and
37971/// // execute the final call using `doit()`.
37972/// // Values shown here are possibly random and not representative !
37973/// let result = hub.transitobject().insert(req)
37974///              .doit().await;
37975/// # }
37976/// ```
37977pub struct TransitobjectInsertCall<'a, C>
37978where
37979    C: 'a,
37980{
37981    hub: &'a Walletobjects<C>,
37982    _request: TransitObject,
37983    _delegate: Option<&'a mut dyn common::Delegate>,
37984    _additional_params: HashMap<String, String>,
37985    _scopes: BTreeSet<String>,
37986}
37987
37988impl<'a, C> common::CallBuilder for TransitobjectInsertCall<'a, C> {}
37989
37990impl<'a, C> TransitobjectInsertCall<'a, C>
37991where
37992    C: common::Connector,
37993{
37994    /// Perform the operation you have build so far.
37995    pub async fn doit(mut self) -> common::Result<(common::Response, TransitObject)> {
37996        use std::borrow::Cow;
37997        use std::io::{Read, Seek};
37998
37999        use common::{url::Params, ToParts};
38000        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38001
38002        let mut dd = common::DefaultDelegate;
38003        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38004        dlg.begin(common::MethodInfo {
38005            id: "walletobjects.transitobject.insert",
38006            http_method: hyper::Method::POST,
38007        });
38008
38009        for &field in ["alt"].iter() {
38010            if self._additional_params.contains_key(field) {
38011                dlg.finished(false);
38012                return Err(common::Error::FieldClash(field));
38013            }
38014        }
38015
38016        let mut params = Params::with_capacity(3 + self._additional_params.len());
38017
38018        params.extend(self._additional_params.iter());
38019
38020        params.push("alt", "json");
38021        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject";
38022        if self._scopes.is_empty() {
38023            self._scopes
38024                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
38025        }
38026
38027        let url = params.parse_with_url(&url);
38028
38029        let mut json_mime_type = mime::APPLICATION_JSON;
38030        let mut request_value_reader = {
38031            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
38032            common::remove_json_null_values(&mut value);
38033            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
38034            serde_json::to_writer(&mut dst, &value).unwrap();
38035            dst
38036        };
38037        let request_size = request_value_reader
38038            .seek(std::io::SeekFrom::End(0))
38039            .unwrap();
38040        request_value_reader
38041            .seek(std::io::SeekFrom::Start(0))
38042            .unwrap();
38043
38044        loop {
38045            let token = match self
38046                .hub
38047                .auth
38048                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38049                .await
38050            {
38051                Ok(token) => token,
38052                Err(e) => match dlg.token(e) {
38053                    Ok(token) => token,
38054                    Err(e) => {
38055                        dlg.finished(false);
38056                        return Err(common::Error::MissingToken(e));
38057                    }
38058                },
38059            };
38060            request_value_reader
38061                .seek(std::io::SeekFrom::Start(0))
38062                .unwrap();
38063            let mut req_result = {
38064                let client = &self.hub.client;
38065                dlg.pre_request();
38066                let mut req_builder = hyper::Request::builder()
38067                    .method(hyper::Method::POST)
38068                    .uri(url.as_str())
38069                    .header(USER_AGENT, self.hub._user_agent.clone());
38070
38071                if let Some(token) = token.as_ref() {
38072                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38073                }
38074
38075                let request = req_builder
38076                    .header(CONTENT_TYPE, json_mime_type.to_string())
38077                    .header(CONTENT_LENGTH, request_size as u64)
38078                    .body(common::to_body(
38079                        request_value_reader.get_ref().clone().into(),
38080                    ));
38081
38082                client.request(request.unwrap()).await
38083            };
38084
38085            match req_result {
38086                Err(err) => {
38087                    if let common::Retry::After(d) = dlg.http_error(&err) {
38088                        sleep(d).await;
38089                        continue;
38090                    }
38091                    dlg.finished(false);
38092                    return Err(common::Error::HttpError(err));
38093                }
38094                Ok(res) => {
38095                    let (mut parts, body) = res.into_parts();
38096                    let mut body = common::Body::new(body);
38097                    if !parts.status.is_success() {
38098                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38099                        let error = serde_json::from_str(&common::to_string(&bytes));
38100                        let response = common::to_response(parts, bytes.into());
38101
38102                        if let common::Retry::After(d) =
38103                            dlg.http_failure(&response, error.as_ref().ok())
38104                        {
38105                            sleep(d).await;
38106                            continue;
38107                        }
38108
38109                        dlg.finished(false);
38110
38111                        return Err(match error {
38112                            Ok(value) => common::Error::BadRequest(value),
38113                            _ => common::Error::Failure(response),
38114                        });
38115                    }
38116                    let response = {
38117                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38118                        let encoded = common::to_string(&bytes);
38119                        match serde_json::from_str(&encoded) {
38120                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38121                            Err(error) => {
38122                                dlg.response_json_decode_error(&encoded, &error);
38123                                return Err(common::Error::JsonDecodeError(
38124                                    encoded.to_string(),
38125                                    error,
38126                                ));
38127                            }
38128                        }
38129                    };
38130
38131                    dlg.finished(true);
38132                    return Ok(response);
38133                }
38134            }
38135        }
38136    }
38137
38138    ///
38139    /// Sets the *request* property to the given value.
38140    ///
38141    /// Even though the property as already been set when instantiating this call,
38142    /// we provide this method for API completeness.
38143    pub fn request(mut self, new_value: TransitObject) -> TransitobjectInsertCall<'a, C> {
38144        self._request = new_value;
38145        self
38146    }
38147    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38148    /// while executing the actual API request.
38149    ///
38150    /// ````text
38151    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38152    /// ````
38153    ///
38154    /// Sets the *delegate* property to the given value.
38155    pub fn delegate(
38156        mut self,
38157        new_value: &'a mut dyn common::Delegate,
38158    ) -> TransitobjectInsertCall<'a, C> {
38159        self._delegate = Some(new_value);
38160        self
38161    }
38162
38163    /// Set any additional parameter of the query string used in the request.
38164    /// It should be used to set parameters which are not yet available through their own
38165    /// setters.
38166    ///
38167    /// Please note that this method must not be used to set any of the known parameters
38168    /// which have their own setter method. If done anyway, the request will fail.
38169    ///
38170    /// # Additional Parameters
38171    ///
38172    /// * *$.xgafv* (query-string) - V1 error format.
38173    /// * *access_token* (query-string) - OAuth access token.
38174    /// * *alt* (query-string) - Data format for response.
38175    /// * *callback* (query-string) - JSONP
38176    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38177    /// * *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.
38178    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38179    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38180    /// * *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.
38181    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38182    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38183    pub fn param<T>(mut self, name: T, value: T) -> TransitobjectInsertCall<'a, C>
38184    where
38185        T: AsRef<str>,
38186    {
38187        self._additional_params
38188            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38189        self
38190    }
38191
38192    /// Identifies the authorization scope for the method you are building.
38193    ///
38194    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38195    /// [`Scope::WalletObjectIssuer`].
38196    ///
38197    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38198    /// tokens for more than one scope.
38199    ///
38200    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38201    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38202    /// sufficient, a read-write scope will do as well.
38203    pub fn add_scope<St>(mut self, scope: St) -> TransitobjectInsertCall<'a, C>
38204    where
38205        St: AsRef<str>,
38206    {
38207        self._scopes.insert(String::from(scope.as_ref()));
38208        self
38209    }
38210    /// Identifies the authorization scope(s) for the method you are building.
38211    ///
38212    /// See [`Self::add_scope()`] for details.
38213    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectInsertCall<'a, C>
38214    where
38215        I: IntoIterator<Item = St>,
38216        St: AsRef<str>,
38217    {
38218        self._scopes
38219            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38220        self
38221    }
38222
38223    /// Removes all scopes, and no default scope will be used either.
38224    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38225    /// for details).
38226    pub fn clear_scopes(mut self) -> TransitobjectInsertCall<'a, C> {
38227        self._scopes.clear();
38228        self
38229    }
38230}
38231
38232/// Returns a list of all transit objects for a given issuer ID.
38233///
38234/// A builder for the *list* method supported by a *transitobject* resource.
38235/// It is not used directly, but through a [`TransitobjectMethods`] instance.
38236///
38237/// # Example
38238///
38239/// Instantiate a resource method builder
38240///
38241/// ```test_harness,no_run
38242/// # extern crate hyper;
38243/// # extern crate hyper_rustls;
38244/// # extern crate google_walletobjects1 as walletobjects1;
38245/// # async fn dox() {
38246/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38247///
38248/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38249/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
38250/// #     .with_native_roots()
38251/// #     .unwrap()
38252/// #     .https_only()
38253/// #     .enable_http2()
38254/// #     .build();
38255///
38256/// # let executor = hyper_util::rt::TokioExecutor::new();
38257/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
38258/// #     secret,
38259/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38260/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
38261/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
38262/// #     ),
38263/// # ).build().await.unwrap();
38264///
38265/// # let client = hyper_util::client::legacy::Client::builder(
38266/// #     hyper_util::rt::TokioExecutor::new()
38267/// # )
38268/// # .build(
38269/// #     hyper_rustls::HttpsConnectorBuilder::new()
38270/// #         .with_native_roots()
38271/// #         .unwrap()
38272/// #         .https_or_http()
38273/// #         .enable_http2()
38274/// #         .build()
38275/// # );
38276/// # let mut hub = Walletobjects::new(client, auth);
38277/// // You can configure optional parameters by calling the respective setters at will, and
38278/// // execute the final call using `doit()`.
38279/// // Values shown here are possibly random and not representative !
38280/// let result = hub.transitobject().list()
38281///              .token("tempor")
38282///              .max_results(-32)
38283///              .class_id("ipsum")
38284///              .doit().await;
38285/// # }
38286/// ```
38287pub struct TransitobjectListCall<'a, C>
38288where
38289    C: 'a,
38290{
38291    hub: &'a Walletobjects<C>,
38292    _token: Option<String>,
38293    _max_results: Option<i32>,
38294    _class_id: Option<String>,
38295    _delegate: Option<&'a mut dyn common::Delegate>,
38296    _additional_params: HashMap<String, String>,
38297    _scopes: BTreeSet<String>,
38298}
38299
38300impl<'a, C> common::CallBuilder for TransitobjectListCall<'a, C> {}
38301
38302impl<'a, C> TransitobjectListCall<'a, C>
38303where
38304    C: common::Connector,
38305{
38306    /// Perform the operation you have build so far.
38307    pub async fn doit(mut self) -> common::Result<(common::Response, TransitObjectListResponse)> {
38308        use std::borrow::Cow;
38309        use std::io::{Read, Seek};
38310
38311        use common::{url::Params, ToParts};
38312        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38313
38314        let mut dd = common::DefaultDelegate;
38315        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38316        dlg.begin(common::MethodInfo {
38317            id: "walletobjects.transitobject.list",
38318            http_method: hyper::Method::GET,
38319        });
38320
38321        for &field in ["alt", "token", "maxResults", "classId"].iter() {
38322            if self._additional_params.contains_key(field) {
38323                dlg.finished(false);
38324                return Err(common::Error::FieldClash(field));
38325            }
38326        }
38327
38328        let mut params = Params::with_capacity(5 + self._additional_params.len());
38329        if let Some(value) = self._token.as_ref() {
38330            params.push("token", value);
38331        }
38332        if let Some(value) = self._max_results.as_ref() {
38333            params.push("maxResults", value.to_string());
38334        }
38335        if let Some(value) = self._class_id.as_ref() {
38336            params.push("classId", value);
38337        }
38338
38339        params.extend(self._additional_params.iter());
38340
38341        params.push("alt", "json");
38342        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject";
38343        if self._scopes.is_empty() {
38344            self._scopes
38345                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
38346        }
38347
38348        let url = params.parse_with_url(&url);
38349
38350        loop {
38351            let token = match self
38352                .hub
38353                .auth
38354                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38355                .await
38356            {
38357                Ok(token) => token,
38358                Err(e) => match dlg.token(e) {
38359                    Ok(token) => token,
38360                    Err(e) => {
38361                        dlg.finished(false);
38362                        return Err(common::Error::MissingToken(e));
38363                    }
38364                },
38365            };
38366            let mut req_result = {
38367                let client = &self.hub.client;
38368                dlg.pre_request();
38369                let mut req_builder = hyper::Request::builder()
38370                    .method(hyper::Method::GET)
38371                    .uri(url.as_str())
38372                    .header(USER_AGENT, self.hub._user_agent.clone());
38373
38374                if let Some(token) = token.as_ref() {
38375                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38376                }
38377
38378                let request = req_builder
38379                    .header(CONTENT_LENGTH, 0_u64)
38380                    .body(common::to_body::<String>(None));
38381
38382                client.request(request.unwrap()).await
38383            };
38384
38385            match req_result {
38386                Err(err) => {
38387                    if let common::Retry::After(d) = dlg.http_error(&err) {
38388                        sleep(d).await;
38389                        continue;
38390                    }
38391                    dlg.finished(false);
38392                    return Err(common::Error::HttpError(err));
38393                }
38394                Ok(res) => {
38395                    let (mut parts, body) = res.into_parts();
38396                    let mut body = common::Body::new(body);
38397                    if !parts.status.is_success() {
38398                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38399                        let error = serde_json::from_str(&common::to_string(&bytes));
38400                        let response = common::to_response(parts, bytes.into());
38401
38402                        if let common::Retry::After(d) =
38403                            dlg.http_failure(&response, error.as_ref().ok())
38404                        {
38405                            sleep(d).await;
38406                            continue;
38407                        }
38408
38409                        dlg.finished(false);
38410
38411                        return Err(match error {
38412                            Ok(value) => common::Error::BadRequest(value),
38413                            _ => common::Error::Failure(response),
38414                        });
38415                    }
38416                    let response = {
38417                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38418                        let encoded = common::to_string(&bytes);
38419                        match serde_json::from_str(&encoded) {
38420                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38421                            Err(error) => {
38422                                dlg.response_json_decode_error(&encoded, &error);
38423                                return Err(common::Error::JsonDecodeError(
38424                                    encoded.to_string(),
38425                                    error,
38426                                ));
38427                            }
38428                        }
38429                    };
38430
38431                    dlg.finished(true);
38432                    return Ok(response);
38433                }
38434            }
38435        }
38436    }
38437
38438    /// Used to get the next set of results if `maxResults` is specified, but more than `maxResults` objects are available in a list. For example, if you have a list of 200 objects and you call list with `maxResults` set to 20, list will return the first 20 objects and a token. Call list again with `maxResults` set to 20 and the token to get the next 20 objects.
38439    ///
38440    /// Sets the *token* query property to the given value.
38441    pub fn token(mut self, new_value: &str) -> TransitobjectListCall<'a, C> {
38442        self._token = Some(new_value.to_string());
38443        self
38444    }
38445    /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
38446    ///
38447    /// Sets the *max results* query property to the given value.
38448    pub fn max_results(mut self, new_value: i32) -> TransitobjectListCall<'a, C> {
38449        self._max_results = Some(new_value);
38450        self
38451    }
38452    /// The ID of the class whose objects will be listed.
38453    ///
38454    /// Sets the *class id* query property to the given value.
38455    pub fn class_id(mut self, new_value: &str) -> TransitobjectListCall<'a, C> {
38456        self._class_id = Some(new_value.to_string());
38457        self
38458    }
38459    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38460    /// while executing the actual API request.
38461    ///
38462    /// ````text
38463    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38464    /// ````
38465    ///
38466    /// Sets the *delegate* property to the given value.
38467    pub fn delegate(
38468        mut self,
38469        new_value: &'a mut dyn common::Delegate,
38470    ) -> TransitobjectListCall<'a, C> {
38471        self._delegate = Some(new_value);
38472        self
38473    }
38474
38475    /// Set any additional parameter of the query string used in the request.
38476    /// It should be used to set parameters which are not yet available through their own
38477    /// setters.
38478    ///
38479    /// Please note that this method must not be used to set any of the known parameters
38480    /// which have their own setter method. If done anyway, the request will fail.
38481    ///
38482    /// # Additional Parameters
38483    ///
38484    /// * *$.xgafv* (query-string) - V1 error format.
38485    /// * *access_token* (query-string) - OAuth access token.
38486    /// * *alt* (query-string) - Data format for response.
38487    /// * *callback* (query-string) - JSONP
38488    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38489    /// * *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.
38490    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38491    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38492    /// * *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.
38493    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38494    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38495    pub fn param<T>(mut self, name: T, value: T) -> TransitobjectListCall<'a, C>
38496    where
38497        T: AsRef<str>,
38498    {
38499        self._additional_params
38500            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38501        self
38502    }
38503
38504    /// Identifies the authorization scope for the method you are building.
38505    ///
38506    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38507    /// [`Scope::WalletObjectIssuer`].
38508    ///
38509    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38510    /// tokens for more than one scope.
38511    ///
38512    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38513    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38514    /// sufficient, a read-write scope will do as well.
38515    pub fn add_scope<St>(mut self, scope: St) -> TransitobjectListCall<'a, C>
38516    where
38517        St: AsRef<str>,
38518    {
38519        self._scopes.insert(String::from(scope.as_ref()));
38520        self
38521    }
38522    /// Identifies the authorization scope(s) for the method you are building.
38523    ///
38524    /// See [`Self::add_scope()`] for details.
38525    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectListCall<'a, C>
38526    where
38527        I: IntoIterator<Item = St>,
38528        St: AsRef<str>,
38529    {
38530        self._scopes
38531            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38532        self
38533    }
38534
38535    /// Removes all scopes, and no default scope will be used either.
38536    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38537    /// for details).
38538    pub fn clear_scopes(mut self) -> TransitobjectListCall<'a, C> {
38539        self._scopes.clear();
38540        self
38541    }
38542}
38543
38544/// Updates the transit object referenced by the given object ID. This method supports patch semantics.
38545///
38546/// A builder for the *patch* method supported by a *transitobject* resource.
38547/// It is not used directly, but through a [`TransitobjectMethods`] instance.
38548///
38549/// # Example
38550///
38551/// Instantiate a resource method builder
38552///
38553/// ```test_harness,no_run
38554/// # extern crate hyper;
38555/// # extern crate hyper_rustls;
38556/// # extern crate google_walletobjects1 as walletobjects1;
38557/// use walletobjects1::api::TransitObject;
38558/// # async fn dox() {
38559/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38560///
38561/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38562/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
38563/// #     .with_native_roots()
38564/// #     .unwrap()
38565/// #     .https_only()
38566/// #     .enable_http2()
38567/// #     .build();
38568///
38569/// # let executor = hyper_util::rt::TokioExecutor::new();
38570/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
38571/// #     secret,
38572/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38573/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
38574/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
38575/// #     ),
38576/// # ).build().await.unwrap();
38577///
38578/// # let client = hyper_util::client::legacy::Client::builder(
38579/// #     hyper_util::rt::TokioExecutor::new()
38580/// # )
38581/// # .build(
38582/// #     hyper_rustls::HttpsConnectorBuilder::new()
38583/// #         .with_native_roots()
38584/// #         .unwrap()
38585/// #         .https_or_http()
38586/// #         .enable_http2()
38587/// #         .build()
38588/// # );
38589/// # let mut hub = Walletobjects::new(client, auth);
38590/// // As the method needs a request, you would usually fill it with the desired information
38591/// // into the respective structure. Some of the parts shown here might not be applicable !
38592/// // Values shown here are possibly random and not representative !
38593/// let mut req = TransitObject::default();
38594///
38595/// // You can configure optional parameters by calling the respective setters at will, and
38596/// // execute the final call using `doit()`.
38597/// // Values shown here are possibly random and not representative !
38598/// let result = hub.transitobject().patch(req, "resourceId")
38599///              .doit().await;
38600/// # }
38601/// ```
38602pub struct TransitobjectPatchCall<'a, C>
38603where
38604    C: 'a,
38605{
38606    hub: &'a Walletobjects<C>,
38607    _request: TransitObject,
38608    _resource_id: String,
38609    _delegate: Option<&'a mut dyn common::Delegate>,
38610    _additional_params: HashMap<String, String>,
38611    _scopes: BTreeSet<String>,
38612}
38613
38614impl<'a, C> common::CallBuilder for TransitobjectPatchCall<'a, C> {}
38615
38616impl<'a, C> TransitobjectPatchCall<'a, C>
38617where
38618    C: common::Connector,
38619{
38620    /// Perform the operation you have build so far.
38621    pub async fn doit(mut self) -> common::Result<(common::Response, TransitObject)> {
38622        use std::borrow::Cow;
38623        use std::io::{Read, Seek};
38624
38625        use common::{url::Params, ToParts};
38626        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38627
38628        let mut dd = common::DefaultDelegate;
38629        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38630        dlg.begin(common::MethodInfo {
38631            id: "walletobjects.transitobject.patch",
38632            http_method: hyper::Method::PATCH,
38633        });
38634
38635        for &field in ["alt", "resourceId"].iter() {
38636            if self._additional_params.contains_key(field) {
38637                dlg.finished(false);
38638                return Err(common::Error::FieldClash(field));
38639            }
38640        }
38641
38642        let mut params = Params::with_capacity(4 + self._additional_params.len());
38643        params.push("resourceId", self._resource_id);
38644
38645        params.extend(self._additional_params.iter());
38646
38647        params.push("alt", "json");
38648        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject/{resourceId}";
38649        if self._scopes.is_empty() {
38650            self._scopes
38651                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
38652        }
38653
38654        #[allow(clippy::single_element_loop)]
38655        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
38656            url = params.uri_replacement(url, param_name, find_this, false);
38657        }
38658        {
38659            let to_remove = ["resourceId"];
38660            params.remove_params(&to_remove);
38661        }
38662
38663        let url = params.parse_with_url(&url);
38664
38665        let mut json_mime_type = mime::APPLICATION_JSON;
38666        let mut request_value_reader = {
38667            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
38668            common::remove_json_null_values(&mut value);
38669            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
38670            serde_json::to_writer(&mut dst, &value).unwrap();
38671            dst
38672        };
38673        let request_size = request_value_reader
38674            .seek(std::io::SeekFrom::End(0))
38675            .unwrap();
38676        request_value_reader
38677            .seek(std::io::SeekFrom::Start(0))
38678            .unwrap();
38679
38680        loop {
38681            let token = match self
38682                .hub
38683                .auth
38684                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38685                .await
38686            {
38687                Ok(token) => token,
38688                Err(e) => match dlg.token(e) {
38689                    Ok(token) => token,
38690                    Err(e) => {
38691                        dlg.finished(false);
38692                        return Err(common::Error::MissingToken(e));
38693                    }
38694                },
38695            };
38696            request_value_reader
38697                .seek(std::io::SeekFrom::Start(0))
38698                .unwrap();
38699            let mut req_result = {
38700                let client = &self.hub.client;
38701                dlg.pre_request();
38702                let mut req_builder = hyper::Request::builder()
38703                    .method(hyper::Method::PATCH)
38704                    .uri(url.as_str())
38705                    .header(USER_AGENT, self.hub._user_agent.clone());
38706
38707                if let Some(token) = token.as_ref() {
38708                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38709                }
38710
38711                let request = req_builder
38712                    .header(CONTENT_TYPE, json_mime_type.to_string())
38713                    .header(CONTENT_LENGTH, request_size as u64)
38714                    .body(common::to_body(
38715                        request_value_reader.get_ref().clone().into(),
38716                    ));
38717
38718                client.request(request.unwrap()).await
38719            };
38720
38721            match req_result {
38722                Err(err) => {
38723                    if let common::Retry::After(d) = dlg.http_error(&err) {
38724                        sleep(d).await;
38725                        continue;
38726                    }
38727                    dlg.finished(false);
38728                    return Err(common::Error::HttpError(err));
38729                }
38730                Ok(res) => {
38731                    let (mut parts, body) = res.into_parts();
38732                    let mut body = common::Body::new(body);
38733                    if !parts.status.is_success() {
38734                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38735                        let error = serde_json::from_str(&common::to_string(&bytes));
38736                        let response = common::to_response(parts, bytes.into());
38737
38738                        if let common::Retry::After(d) =
38739                            dlg.http_failure(&response, error.as_ref().ok())
38740                        {
38741                            sleep(d).await;
38742                            continue;
38743                        }
38744
38745                        dlg.finished(false);
38746
38747                        return Err(match error {
38748                            Ok(value) => common::Error::BadRequest(value),
38749                            _ => common::Error::Failure(response),
38750                        });
38751                    }
38752                    let response = {
38753                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38754                        let encoded = common::to_string(&bytes);
38755                        match serde_json::from_str(&encoded) {
38756                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38757                            Err(error) => {
38758                                dlg.response_json_decode_error(&encoded, &error);
38759                                return Err(common::Error::JsonDecodeError(
38760                                    encoded.to_string(),
38761                                    error,
38762                                ));
38763                            }
38764                        }
38765                    };
38766
38767                    dlg.finished(true);
38768                    return Ok(response);
38769                }
38770            }
38771        }
38772    }
38773
38774    ///
38775    /// Sets the *request* property to the given value.
38776    ///
38777    /// Even though the property as already been set when instantiating this call,
38778    /// we provide this method for API completeness.
38779    pub fn request(mut self, new_value: TransitObject) -> TransitobjectPatchCall<'a, C> {
38780        self._request = new_value;
38781        self
38782    }
38783    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
38784    ///
38785    /// Sets the *resource id* path property to the given value.
38786    ///
38787    /// Even though the property as already been set when instantiating this call,
38788    /// we provide this method for API completeness.
38789    pub fn resource_id(mut self, new_value: &str) -> TransitobjectPatchCall<'a, C> {
38790        self._resource_id = new_value.to_string();
38791        self
38792    }
38793    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38794    /// while executing the actual API request.
38795    ///
38796    /// ````text
38797    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38798    /// ````
38799    ///
38800    /// Sets the *delegate* property to the given value.
38801    pub fn delegate(
38802        mut self,
38803        new_value: &'a mut dyn common::Delegate,
38804    ) -> TransitobjectPatchCall<'a, C> {
38805        self._delegate = Some(new_value);
38806        self
38807    }
38808
38809    /// Set any additional parameter of the query string used in the request.
38810    /// It should be used to set parameters which are not yet available through their own
38811    /// setters.
38812    ///
38813    /// Please note that this method must not be used to set any of the known parameters
38814    /// which have their own setter method. If done anyway, the request will fail.
38815    ///
38816    /// # Additional Parameters
38817    ///
38818    /// * *$.xgafv* (query-string) - V1 error format.
38819    /// * *access_token* (query-string) - OAuth access token.
38820    /// * *alt* (query-string) - Data format for response.
38821    /// * *callback* (query-string) - JSONP
38822    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38823    /// * *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.
38824    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38825    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38826    /// * *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.
38827    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38828    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38829    pub fn param<T>(mut self, name: T, value: T) -> TransitobjectPatchCall<'a, C>
38830    where
38831        T: AsRef<str>,
38832    {
38833        self._additional_params
38834            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38835        self
38836    }
38837
38838    /// Identifies the authorization scope for the method you are building.
38839    ///
38840    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38841    /// [`Scope::WalletObjectIssuer`].
38842    ///
38843    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38844    /// tokens for more than one scope.
38845    ///
38846    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38847    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38848    /// sufficient, a read-write scope will do as well.
38849    pub fn add_scope<St>(mut self, scope: St) -> TransitobjectPatchCall<'a, C>
38850    where
38851        St: AsRef<str>,
38852    {
38853        self._scopes.insert(String::from(scope.as_ref()));
38854        self
38855    }
38856    /// Identifies the authorization scope(s) for the method you are building.
38857    ///
38858    /// See [`Self::add_scope()`] for details.
38859    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectPatchCall<'a, C>
38860    where
38861        I: IntoIterator<Item = St>,
38862        St: AsRef<str>,
38863    {
38864        self._scopes
38865            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38866        self
38867    }
38868
38869    /// Removes all scopes, and no default scope will be used either.
38870    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38871    /// for details).
38872    pub fn clear_scopes(mut self) -> TransitobjectPatchCall<'a, C> {
38873        self._scopes.clear();
38874        self
38875    }
38876}
38877
38878/// Updates the transit object referenced by the given object ID.
38879///
38880/// A builder for the *update* method supported by a *transitobject* resource.
38881/// It is not used directly, but through a [`TransitobjectMethods`] instance.
38882///
38883/// # Example
38884///
38885/// Instantiate a resource method builder
38886///
38887/// ```test_harness,no_run
38888/// # extern crate hyper;
38889/// # extern crate hyper_rustls;
38890/// # extern crate google_walletobjects1 as walletobjects1;
38891/// use walletobjects1::api::TransitObject;
38892/// # async fn dox() {
38893/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38894///
38895/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38896/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
38897/// #     .with_native_roots()
38898/// #     .unwrap()
38899/// #     .https_only()
38900/// #     .enable_http2()
38901/// #     .build();
38902///
38903/// # let executor = hyper_util::rt::TokioExecutor::new();
38904/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
38905/// #     secret,
38906/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38907/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
38908/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
38909/// #     ),
38910/// # ).build().await.unwrap();
38911///
38912/// # let client = hyper_util::client::legacy::Client::builder(
38913/// #     hyper_util::rt::TokioExecutor::new()
38914/// # )
38915/// # .build(
38916/// #     hyper_rustls::HttpsConnectorBuilder::new()
38917/// #         .with_native_roots()
38918/// #         .unwrap()
38919/// #         .https_or_http()
38920/// #         .enable_http2()
38921/// #         .build()
38922/// # );
38923/// # let mut hub = Walletobjects::new(client, auth);
38924/// // As the method needs a request, you would usually fill it with the desired information
38925/// // into the respective structure. Some of the parts shown here might not be applicable !
38926/// // Values shown here are possibly random and not representative !
38927/// let mut req = TransitObject::default();
38928///
38929/// // You can configure optional parameters by calling the respective setters at will, and
38930/// // execute the final call using `doit()`.
38931/// // Values shown here are possibly random and not representative !
38932/// let result = hub.transitobject().update(req, "resourceId")
38933///              .doit().await;
38934/// # }
38935/// ```
38936pub struct TransitobjectUpdateCall<'a, C>
38937where
38938    C: 'a,
38939{
38940    hub: &'a Walletobjects<C>,
38941    _request: TransitObject,
38942    _resource_id: String,
38943    _delegate: Option<&'a mut dyn common::Delegate>,
38944    _additional_params: HashMap<String, String>,
38945    _scopes: BTreeSet<String>,
38946}
38947
38948impl<'a, C> common::CallBuilder for TransitobjectUpdateCall<'a, C> {}
38949
38950impl<'a, C> TransitobjectUpdateCall<'a, C>
38951where
38952    C: common::Connector,
38953{
38954    /// Perform the operation you have build so far.
38955    pub async fn doit(mut self) -> common::Result<(common::Response, TransitObject)> {
38956        use std::borrow::Cow;
38957        use std::io::{Read, Seek};
38958
38959        use common::{url::Params, ToParts};
38960        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38961
38962        let mut dd = common::DefaultDelegate;
38963        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38964        dlg.begin(common::MethodInfo {
38965            id: "walletobjects.transitobject.update",
38966            http_method: hyper::Method::PUT,
38967        });
38968
38969        for &field in ["alt", "resourceId"].iter() {
38970            if self._additional_params.contains_key(field) {
38971                dlg.finished(false);
38972                return Err(common::Error::FieldClash(field));
38973            }
38974        }
38975
38976        let mut params = Params::with_capacity(4 + self._additional_params.len());
38977        params.push("resourceId", self._resource_id);
38978
38979        params.extend(self._additional_params.iter());
38980
38981        params.push("alt", "json");
38982        let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject/{resourceId}";
38983        if self._scopes.is_empty() {
38984            self._scopes
38985                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
38986        }
38987
38988        #[allow(clippy::single_element_loop)]
38989        for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
38990            url = params.uri_replacement(url, param_name, find_this, false);
38991        }
38992        {
38993            let to_remove = ["resourceId"];
38994            params.remove_params(&to_remove);
38995        }
38996
38997        let url = params.parse_with_url(&url);
38998
38999        let mut json_mime_type = mime::APPLICATION_JSON;
39000        let mut request_value_reader = {
39001            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
39002            common::remove_json_null_values(&mut value);
39003            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
39004            serde_json::to_writer(&mut dst, &value).unwrap();
39005            dst
39006        };
39007        let request_size = request_value_reader
39008            .seek(std::io::SeekFrom::End(0))
39009            .unwrap();
39010        request_value_reader
39011            .seek(std::io::SeekFrom::Start(0))
39012            .unwrap();
39013
39014        loop {
39015            let token = match self
39016                .hub
39017                .auth
39018                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39019                .await
39020            {
39021                Ok(token) => token,
39022                Err(e) => match dlg.token(e) {
39023                    Ok(token) => token,
39024                    Err(e) => {
39025                        dlg.finished(false);
39026                        return Err(common::Error::MissingToken(e));
39027                    }
39028                },
39029            };
39030            request_value_reader
39031                .seek(std::io::SeekFrom::Start(0))
39032                .unwrap();
39033            let mut req_result = {
39034                let client = &self.hub.client;
39035                dlg.pre_request();
39036                let mut req_builder = hyper::Request::builder()
39037                    .method(hyper::Method::PUT)
39038                    .uri(url.as_str())
39039                    .header(USER_AGENT, self.hub._user_agent.clone());
39040
39041                if let Some(token) = token.as_ref() {
39042                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39043                }
39044
39045                let request = req_builder
39046                    .header(CONTENT_TYPE, json_mime_type.to_string())
39047                    .header(CONTENT_LENGTH, request_size as u64)
39048                    .body(common::to_body(
39049                        request_value_reader.get_ref().clone().into(),
39050                    ));
39051
39052                client.request(request.unwrap()).await
39053            };
39054
39055            match req_result {
39056                Err(err) => {
39057                    if let common::Retry::After(d) = dlg.http_error(&err) {
39058                        sleep(d).await;
39059                        continue;
39060                    }
39061                    dlg.finished(false);
39062                    return Err(common::Error::HttpError(err));
39063                }
39064                Ok(res) => {
39065                    let (mut parts, body) = res.into_parts();
39066                    let mut body = common::Body::new(body);
39067                    if !parts.status.is_success() {
39068                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39069                        let error = serde_json::from_str(&common::to_string(&bytes));
39070                        let response = common::to_response(parts, bytes.into());
39071
39072                        if let common::Retry::After(d) =
39073                            dlg.http_failure(&response, error.as_ref().ok())
39074                        {
39075                            sleep(d).await;
39076                            continue;
39077                        }
39078
39079                        dlg.finished(false);
39080
39081                        return Err(match error {
39082                            Ok(value) => common::Error::BadRequest(value),
39083                            _ => common::Error::Failure(response),
39084                        });
39085                    }
39086                    let response = {
39087                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39088                        let encoded = common::to_string(&bytes);
39089                        match serde_json::from_str(&encoded) {
39090                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39091                            Err(error) => {
39092                                dlg.response_json_decode_error(&encoded, &error);
39093                                return Err(common::Error::JsonDecodeError(
39094                                    encoded.to_string(),
39095                                    error,
39096                                ));
39097                            }
39098                        }
39099                    };
39100
39101                    dlg.finished(true);
39102                    return Ok(response);
39103                }
39104            }
39105        }
39106    }
39107
39108    ///
39109    /// Sets the *request* property to the given value.
39110    ///
39111    /// Even though the property as already been set when instantiating this call,
39112    /// we provide this method for API completeness.
39113    pub fn request(mut self, new_value: TransitObject) -> TransitobjectUpdateCall<'a, C> {
39114        self._request = new_value;
39115        self
39116    }
39117    /// The unique identifier for an object. This ID must be unique across all objects from an issuer. This value should follow the format issuer ID. identifier where the former is issued by Google and latter is chosen by you. Your unique identifier should only include alphanumeric characters, '.', '_', or '-'.
39118    ///
39119    /// Sets the *resource id* path property to the given value.
39120    ///
39121    /// Even though the property as already been set when instantiating this call,
39122    /// we provide this method for API completeness.
39123    pub fn resource_id(mut self, new_value: &str) -> TransitobjectUpdateCall<'a, C> {
39124        self._resource_id = new_value.to_string();
39125        self
39126    }
39127    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39128    /// while executing the actual API request.
39129    ///
39130    /// ````text
39131    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39132    /// ````
39133    ///
39134    /// Sets the *delegate* property to the given value.
39135    pub fn delegate(
39136        mut self,
39137        new_value: &'a mut dyn common::Delegate,
39138    ) -> TransitobjectUpdateCall<'a, C> {
39139        self._delegate = Some(new_value);
39140        self
39141    }
39142
39143    /// Set any additional parameter of the query string used in the request.
39144    /// It should be used to set parameters which are not yet available through their own
39145    /// setters.
39146    ///
39147    /// Please note that this method must not be used to set any of the known parameters
39148    /// which have their own setter method. If done anyway, the request will fail.
39149    ///
39150    /// # Additional Parameters
39151    ///
39152    /// * *$.xgafv* (query-string) - V1 error format.
39153    /// * *access_token* (query-string) - OAuth access token.
39154    /// * *alt* (query-string) - Data format for response.
39155    /// * *callback* (query-string) - JSONP
39156    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39157    /// * *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.
39158    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39159    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39160    /// * *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.
39161    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39162    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39163    pub fn param<T>(mut self, name: T, value: T) -> TransitobjectUpdateCall<'a, C>
39164    where
39165        T: AsRef<str>,
39166    {
39167        self._additional_params
39168            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39169        self
39170    }
39171
39172    /// Identifies the authorization scope for the method you are building.
39173    ///
39174    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39175    /// [`Scope::WalletObjectIssuer`].
39176    ///
39177    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39178    /// tokens for more than one scope.
39179    ///
39180    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39181    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39182    /// sufficient, a read-write scope will do as well.
39183    pub fn add_scope<St>(mut self, scope: St) -> TransitobjectUpdateCall<'a, C>
39184    where
39185        St: AsRef<str>,
39186    {
39187        self._scopes.insert(String::from(scope.as_ref()));
39188        self
39189    }
39190    /// Identifies the authorization scope(s) for the method you are building.
39191    ///
39192    /// See [`Self::add_scope()`] for details.
39193    pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectUpdateCall<'a, C>
39194    where
39195        I: IntoIterator<Item = St>,
39196        St: AsRef<str>,
39197    {
39198        self._scopes
39199            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39200        self
39201    }
39202
39203    /// Removes all scopes, and no default scope will be used either.
39204    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39205    /// for details).
39206    pub fn clear_scopes(mut self) -> TransitobjectUpdateCall<'a, C> {
39207        self._scopes.clear();
39208        self
39209    }
39210}
39211
39212/// Provide Google with information about awaiting private pass update. This will allow Google to provide the update notification to the device that currently holds this pass.
39213///
39214/// A builder for the *v1.privateContent.setPassUpdateNotice* method supported by a *walletobject* resource.
39215/// It is not used directly, but through a [`WalletobjectMethods`] instance.
39216///
39217/// # Example
39218///
39219/// Instantiate a resource method builder
39220///
39221/// ```test_harness,no_run
39222/// # extern crate hyper;
39223/// # extern crate hyper_rustls;
39224/// # extern crate google_walletobjects1 as walletobjects1;
39225/// use walletobjects1::api::SetPassUpdateNoticeRequest;
39226/// # async fn dox() {
39227/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39228///
39229/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39230/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
39231/// #     .with_native_roots()
39232/// #     .unwrap()
39233/// #     .https_only()
39234/// #     .enable_http2()
39235/// #     .build();
39236///
39237/// # let executor = hyper_util::rt::TokioExecutor::new();
39238/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
39239/// #     secret,
39240/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39241/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
39242/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
39243/// #     ),
39244/// # ).build().await.unwrap();
39245///
39246/// # let client = hyper_util::client::legacy::Client::builder(
39247/// #     hyper_util::rt::TokioExecutor::new()
39248/// # )
39249/// # .build(
39250/// #     hyper_rustls::HttpsConnectorBuilder::new()
39251/// #         .with_native_roots()
39252/// #         .unwrap()
39253/// #         .https_or_http()
39254/// #         .enable_http2()
39255/// #         .build()
39256/// # );
39257/// # let mut hub = Walletobjects::new(client, auth);
39258/// // As the method needs a request, you would usually fill it with the desired information
39259/// // into the respective structure. Some of the parts shown here might not be applicable !
39260/// // Values shown here are possibly random and not representative !
39261/// let mut req = SetPassUpdateNoticeRequest::default();
39262///
39263/// // You can configure optional parameters by calling the respective setters at will, and
39264/// // execute the final call using `doit()`.
39265/// // Values shown here are possibly random and not representative !
39266/// let result = hub.walletobjects().v1_private_content_set_pass_update_notice(req)
39267///              .doit().await;
39268/// # }
39269/// ```
39270pub struct WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C>
39271where
39272    C: 'a,
39273{
39274    hub: &'a Walletobjects<C>,
39275    _request: SetPassUpdateNoticeRequest,
39276    _delegate: Option<&'a mut dyn common::Delegate>,
39277    _additional_params: HashMap<String, String>,
39278    _scopes: BTreeSet<String>,
39279}
39280
39281impl<'a, C> common::CallBuilder for WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C> {}
39282
39283impl<'a, C> WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C>
39284where
39285    C: common::Connector,
39286{
39287    /// Perform the operation you have build so far.
39288    pub async fn doit(mut self) -> common::Result<(common::Response, SetPassUpdateNoticeResponse)> {
39289        use std::borrow::Cow;
39290        use std::io::{Read, Seek};
39291
39292        use common::{url::Params, ToParts};
39293        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39294
39295        let mut dd = common::DefaultDelegate;
39296        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39297        dlg.begin(common::MethodInfo {
39298            id: "walletobjects.walletobjects.v1.privateContent.setPassUpdateNotice",
39299            http_method: hyper::Method::POST,
39300        });
39301
39302        for &field in ["alt"].iter() {
39303            if self._additional_params.contains_key(field) {
39304                dlg.finished(false);
39305                return Err(common::Error::FieldClash(field));
39306            }
39307        }
39308
39309        let mut params = Params::with_capacity(3 + self._additional_params.len());
39310
39311        params.extend(self._additional_params.iter());
39312
39313        params.push("alt", "json");
39314        let mut url =
39315            self.hub._base_url.clone() + "walletobjects/v1/privateContent/setPassUpdateNotice";
39316        if self._scopes.is_empty() {
39317            self._scopes
39318                .insert(Scope::WalletObjectIssuer.as_ref().to_string());
39319        }
39320
39321        let url = params.parse_with_url(&url);
39322
39323        let mut json_mime_type = mime::APPLICATION_JSON;
39324        let mut request_value_reader = {
39325            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
39326            common::remove_json_null_values(&mut value);
39327            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
39328            serde_json::to_writer(&mut dst, &value).unwrap();
39329            dst
39330        };
39331        let request_size = request_value_reader
39332            .seek(std::io::SeekFrom::End(0))
39333            .unwrap();
39334        request_value_reader
39335            .seek(std::io::SeekFrom::Start(0))
39336            .unwrap();
39337
39338        loop {
39339            let token = match self
39340                .hub
39341                .auth
39342                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39343                .await
39344            {
39345                Ok(token) => token,
39346                Err(e) => match dlg.token(e) {
39347                    Ok(token) => token,
39348                    Err(e) => {
39349                        dlg.finished(false);
39350                        return Err(common::Error::MissingToken(e));
39351                    }
39352                },
39353            };
39354            request_value_reader
39355                .seek(std::io::SeekFrom::Start(0))
39356                .unwrap();
39357            let mut req_result = {
39358                let client = &self.hub.client;
39359                dlg.pre_request();
39360                let mut req_builder = hyper::Request::builder()
39361                    .method(hyper::Method::POST)
39362                    .uri(url.as_str())
39363                    .header(USER_AGENT, self.hub._user_agent.clone());
39364
39365                if let Some(token) = token.as_ref() {
39366                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39367                }
39368
39369                let request = req_builder
39370                    .header(CONTENT_TYPE, json_mime_type.to_string())
39371                    .header(CONTENT_LENGTH, request_size as u64)
39372                    .body(common::to_body(
39373                        request_value_reader.get_ref().clone().into(),
39374                    ));
39375
39376                client.request(request.unwrap()).await
39377            };
39378
39379            match req_result {
39380                Err(err) => {
39381                    if let common::Retry::After(d) = dlg.http_error(&err) {
39382                        sleep(d).await;
39383                        continue;
39384                    }
39385                    dlg.finished(false);
39386                    return Err(common::Error::HttpError(err));
39387                }
39388                Ok(res) => {
39389                    let (mut parts, body) = res.into_parts();
39390                    let mut body = common::Body::new(body);
39391                    if !parts.status.is_success() {
39392                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39393                        let error = serde_json::from_str(&common::to_string(&bytes));
39394                        let response = common::to_response(parts, bytes.into());
39395
39396                        if let common::Retry::After(d) =
39397                            dlg.http_failure(&response, error.as_ref().ok())
39398                        {
39399                            sleep(d).await;
39400                            continue;
39401                        }
39402
39403                        dlg.finished(false);
39404
39405                        return Err(match error {
39406                            Ok(value) => common::Error::BadRequest(value),
39407                            _ => common::Error::Failure(response),
39408                        });
39409                    }
39410                    let response = {
39411                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39412                        let encoded = common::to_string(&bytes);
39413                        match serde_json::from_str(&encoded) {
39414                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39415                            Err(error) => {
39416                                dlg.response_json_decode_error(&encoded, &error);
39417                                return Err(common::Error::JsonDecodeError(
39418                                    encoded.to_string(),
39419                                    error,
39420                                ));
39421                            }
39422                        }
39423                    };
39424
39425                    dlg.finished(true);
39426                    return Ok(response);
39427                }
39428            }
39429        }
39430    }
39431
39432    ///
39433    /// Sets the *request* property to the given value.
39434    ///
39435    /// Even though the property as already been set when instantiating this call,
39436    /// we provide this method for API completeness.
39437    pub fn request(
39438        mut self,
39439        new_value: SetPassUpdateNoticeRequest,
39440    ) -> WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C> {
39441        self._request = new_value;
39442        self
39443    }
39444    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39445    /// while executing the actual API request.
39446    ///
39447    /// ````text
39448    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39449    /// ````
39450    ///
39451    /// Sets the *delegate* property to the given value.
39452    pub fn delegate(
39453        mut self,
39454        new_value: &'a mut dyn common::Delegate,
39455    ) -> WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C> {
39456        self._delegate = Some(new_value);
39457        self
39458    }
39459
39460    /// Set any additional parameter of the query string used in the request.
39461    /// It should be used to set parameters which are not yet available through their own
39462    /// setters.
39463    ///
39464    /// Please note that this method must not be used to set any of the known parameters
39465    /// which have their own setter method. If done anyway, the request will fail.
39466    ///
39467    /// # Additional Parameters
39468    ///
39469    /// * *$.xgafv* (query-string) - V1 error format.
39470    /// * *access_token* (query-string) - OAuth access token.
39471    /// * *alt* (query-string) - Data format for response.
39472    /// * *callback* (query-string) - JSONP
39473    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39474    /// * *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.
39475    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39476    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39477    /// * *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.
39478    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39479    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39480    pub fn param<T>(
39481        mut self,
39482        name: T,
39483        value: T,
39484    ) -> WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C>
39485    where
39486        T: AsRef<str>,
39487    {
39488        self._additional_params
39489            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39490        self
39491    }
39492
39493    /// Identifies the authorization scope for the method you are building.
39494    ///
39495    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39496    /// [`Scope::WalletObjectIssuer`].
39497    ///
39498    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39499    /// tokens for more than one scope.
39500    ///
39501    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39502    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39503    /// sufficient, a read-write scope will do as well.
39504    pub fn add_scope<St>(
39505        mut self,
39506        scope: St,
39507    ) -> WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C>
39508    where
39509        St: AsRef<str>,
39510    {
39511        self._scopes.insert(String::from(scope.as_ref()));
39512        self
39513    }
39514    /// Identifies the authorization scope(s) for the method you are building.
39515    ///
39516    /// See [`Self::add_scope()`] for details.
39517    pub fn add_scopes<I, St>(
39518        mut self,
39519        scopes: I,
39520    ) -> WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C>
39521    where
39522        I: IntoIterator<Item = St>,
39523        St: AsRef<str>,
39524    {
39525        self._scopes
39526            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39527        self
39528    }
39529
39530    /// Removes all scopes, and no default scope will be used either.
39531    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39532    /// for details).
39533    pub fn clear_scopes(mut self) -> WalletobjectV1PrivateContentSetPassUpdateNoticeCall<'a, C> {
39534        self._scopes.clear();
39535        self
39536    }
39537}