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 auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63/// secret,
64/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68/// hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71/// hyper_rustls::HttpsConnectorBuilder::new()
72/// .with_native_roots()
73/// .unwrap()
74/// .https_or_http()
75/// .enable_http1()
76/// .build()
77/// );
78/// let mut hub = Walletobjects::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = AddMessageRequest::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.eventticketclass().addmessage(req, "resourceId")
88/// .doit().await;
89///
90/// match result {
91/// Err(e) => match e {
92/// // The Error enum provides details about what exactly happened.
93/// // You can also just use its `Debug`, `Display` or `Error` traits
94/// Error::HttpError(_)
95/// |Error::Io(_)
96/// |Error::MissingAPIKey
97/// |Error::MissingToken(_)
98/// |Error::Cancelled
99/// |Error::UploadSizeLimitExceeded(_, _)
100/// |Error::Failure(_)
101/// |Error::BadRequest(_)
102/// |Error::FieldClash(_)
103/// |Error::JsonDecodeError(_, _) => println!("{}", e),
104/// },
105/// Ok(res) => println!("Success: {:?}", res),
106/// }
107/// # }
108/// ```
109#[derive(Clone)]
110pub struct Walletobjects<C> {
111 pub client: common::Client<C>,
112 pub auth: Box<dyn common::GetToken>,
113 _user_agent: String,
114 _base_url: String,
115 _root_url: String,
116}
117
118impl<C> common::Hub for Walletobjects<C> {}
119
120impl<'a, C> Walletobjects<C> {
121 pub fn new<A: 'static + common::GetToken>(
122 client: common::Client<C>,
123 auth: A,
124 ) -> Walletobjects<C> {
125 Walletobjects {
126 client,
127 auth: Box::new(auth),
128 _user_agent: "google-api-rust-client/6.0.0".to_string(),
129 _base_url: "https://walletobjects.googleapis.com/".to_string(),
130 _root_url: "https://walletobjects.googleapis.com/".to_string(),
131 }
132 }
133
134 pub fn eventticketclass(&'a self) -> EventticketclasMethods<'a, C> {
135 EventticketclasMethods { hub: self }
136 }
137 pub fn eventticketobject(&'a self) -> EventticketobjectMethods<'a, C> {
138 EventticketobjectMethods { hub: self }
139 }
140 pub fn flightclass(&'a self) -> FlightclasMethods<'a, C> {
141 FlightclasMethods { hub: self }
142 }
143 pub fn flightobject(&'a self) -> FlightobjectMethods<'a, C> {
144 FlightobjectMethods { hub: self }
145 }
146 pub fn genericclass(&'a self) -> GenericclasMethods<'a, C> {
147 GenericclasMethods { hub: self }
148 }
149 pub fn genericobject(&'a self) -> GenericobjectMethods<'a, C> {
150 GenericobjectMethods { hub: self }
151 }
152 pub fn giftcardclass(&'a self) -> GiftcardclasMethods<'a, C> {
153 GiftcardclasMethods { hub: self }
154 }
155 pub fn giftcardobject(&'a self) -> GiftcardobjectMethods<'a, C> {
156 GiftcardobjectMethods { hub: self }
157 }
158 pub fn issuer(&'a self) -> IssuerMethods<'a, C> {
159 IssuerMethods { hub: self }
160 }
161 pub fn jwt(&'a self) -> JwtMethods<'a, C> {
162 JwtMethods { hub: self }
163 }
164 pub fn loyaltyclass(&'a self) -> LoyaltyclasMethods<'a, C> {
165 LoyaltyclasMethods { hub: self }
166 }
167 pub fn loyaltyobject(&'a self) -> LoyaltyobjectMethods<'a, C> {
168 LoyaltyobjectMethods { hub: self }
169 }
170 pub fn media(&'a self) -> MediaMethods<'a, C> {
171 MediaMethods { hub: self }
172 }
173 pub fn offerclass(&'a self) -> OfferclasMethods<'a, C> {
174 OfferclasMethods { hub: self }
175 }
176 pub fn offerobject(&'a self) -> OfferobjectMethods<'a, C> {
177 OfferobjectMethods { hub: self }
178 }
179 pub fn permissions(&'a self) -> PermissionMethods<'a, C> {
180 PermissionMethods { hub: self }
181 }
182 pub fn smarttap(&'a self) -> SmarttapMethods<'a, C> {
183 SmarttapMethods { hub: self }
184 }
185 pub fn transitclass(&'a self) -> TransitclasMethods<'a, C> {
186 TransitclasMethods { hub: self }
187 }
188 pub fn transitobject(&'a self) -> TransitobjectMethods<'a, C> {
189 TransitobjectMethods { hub: self }
190 }
191
192 /// Set the user-agent header field to use in all requests to the server.
193 /// It defaults to `google-api-rust-client/6.0.0`.
194 ///
195 /// Returns the previously set user-agent.
196 pub fn user_agent(&mut self, agent_name: String) -> String {
197 std::mem::replace(&mut self._user_agent, agent_name)
198 }
199
200 /// Set the base url to use in all requests to the server.
201 /// It defaults to `https://walletobjects.googleapis.com/`.
202 ///
203 /// Returns the previously set base url.
204 pub fn base_url(&mut self, new_base_url: String) -> String {
205 std::mem::replace(&mut self._base_url, new_base_url)
206 }
207
208 /// Set the root url to use in all requests to the server.
209 /// It defaults to `https://walletobjects.googleapis.com/`.
210 ///
211 /// Returns the previously set root url.
212 pub fn root_url(&mut self, new_root_url: String) -> String {
213 std::mem::replace(&mut self._root_url, new_root_url)
214 }
215}
216
217// ############
218// SCHEMAS ###
219// ##########
220/// ActivationOptions for the class
221///
222/// This type is not used in any activity, and only used as *part* of another schema.
223///
224#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
225#[serde_with::serde_as]
226#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
227pub struct ActivationOptions {
228 /// HTTPS URL that supports REST semantics. Would be used for requesting activation from partners for given valuable, triggered by the users.
229 #[serde(rename = "activationUrl")]
230 pub activation_url: Option<String>,
231 /// 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.
232 #[serde(rename = "allowReactivation")]
233 pub allow_reactivation: Option<bool>,
234}
235
236impl common::Part for ActivationOptions {}
237
238/// The activation status of the object. This field includes activation status if valuable supports activation.
239///
240/// This type is not used in any activity, and only used as *part* of another schema.
241///
242#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
243#[serde_with::serde_as]
244#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
245pub struct ActivationStatus {
246 /// no description provided
247 pub state: Option<String>,
248}
249
250impl common::Part for ActivationStatus {}
251
252/// Resource used when the AddMessage endpoints are called.
253///
254/// # Activities
255///
256/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
257/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
258///
259/// * [addmessage eventticketclass](EventticketclasAddmessageCall) (request)
260/// * [addmessage eventticketobject](EventticketobjectAddmessageCall) (request)
261/// * [addmessage flightclass](FlightclasAddmessageCall) (request)
262/// * [addmessage flightobject](FlightobjectAddmessageCall) (request)
263/// * [addmessage genericclass](GenericclasAddmessageCall) (request)
264/// * [addmessage genericobject](GenericobjectAddmessageCall) (request)
265/// * [addmessage giftcardclass](GiftcardclasAddmessageCall) (request)
266/// * [addmessage giftcardobject](GiftcardobjectAddmessageCall) (request)
267/// * [addmessage loyaltyclass](LoyaltyclasAddmessageCall) (request)
268/// * [addmessage loyaltyobject](LoyaltyobjectAddmessageCall) (request)
269/// * [addmessage offerclass](OfferclasAddmessageCall) (request)
270/// * [addmessage offerobject](OfferobjectAddmessageCall) (request)
271/// * [addmessage transitclass](TransitclasAddmessageCall) (request)
272/// * [addmessage transitobject](TransitobjectAddmessageCall) (request)
273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
274#[serde_with::serde_as]
275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
276pub struct AddMessageRequest {
277 /// no description provided
278 pub message: Option<Message>,
279}
280
281impl common::RequestValue for AddMessageRequest {}
282
283/// There is no detailed description.
284///
285/// This type is not used in any activity, and only used as *part* of another schema.
286///
287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
288#[serde_with::serde_as]
289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
290pub struct AirportInfo {
291 /// Three character IATA airport code. This is a required field for `origin` and `destination`. Eg: "SFO"
292 #[serde(rename = "airportIataCode")]
293 pub airport_iata_code: Option<String>,
294 /// 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.
295 #[serde(rename = "airportNameOverride")]
296 pub airport_name_override: Option<LocalizedString>,
297 /// A name of the gate. Eg: "B59" or "59"
298 pub gate: Option<String>,
299 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#airportInfo"`.
300 pub kind: Option<String>,
301 /// Terminal name. Eg: "INTL" or "I"
302 pub terminal: Option<String>,
303}
304
305impl common::Part for AirportInfo {}
306
307/// There is no detailed description.
308///
309/// This type is not used in any activity, and only used as *part* of another schema.
310///
311#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
312#[serde_with::serde_as]
313#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
314pub struct AppLinkData {
315 /// Optional information about the partner app link.
316 #[serde(rename = "androidAppLinkInfo")]
317 pub android_app_link_info: Option<AppLinkDataAppLinkInfo>,
318 /// Deprecated. Links to open iOS apps are not supported.
319 #[serde(rename = "iosAppLinkInfo")]
320 pub ios_app_link_info: Option<AppLinkDataAppLinkInfo>,
321 /// Optional information about the partner web link.
322 #[serde(rename = "webAppLinkInfo")]
323 pub web_app_link_info: Option<AppLinkDataAppLinkInfo>,
324}
325
326impl common::Part for AppLinkData {}
327
328/// There is no detailed description.
329///
330/// This type is not used in any activity, and only used as *part* of another schema.
331///
332#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
333#[serde_with::serde_as]
334#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
335pub struct AppLinkDataAppLinkInfo {
336 /// Deprecated. Image isn't supported in the app link module.
337 #[serde(rename = "appLogoImage")]
338 pub app_logo_image: Option<Image>,
339 /// Target to follow when opening the app link on clients. It will be used by partners to open their app or webpage.
340 #[serde(rename = "appTarget")]
341 pub app_target: Option<AppLinkDataAppLinkInfoAppTarget>,
342 /// Deprecated. Description isn't supported in the app link module.
343 pub description: Option<LocalizedString>,
344 /// Deprecated. Title isn't supported in the app link module.
345 pub title: Option<LocalizedString>,
346}
347
348impl common::Part for AppLinkDataAppLinkInfo {}
349
350/// There is no detailed description.
351///
352/// This type is not used in any activity, and only used as *part* of another schema.
353///
354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
355#[serde_with::serde_as]
356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
357pub struct AppLinkDataAppLinkInfoAppTarget {
358 /// Package name for AppTarget. For example: com.google.android.gm
359 #[serde(rename = "packageName")]
360 pub package_name: Option<String>,
361 /// URI for AppTarget. The description on the URI must be set. Prefer setting package field instead, if this target is defined for your application.
362 #[serde(rename = "targetUri")]
363 pub target_uri: Option<Uri>,
364}
365
366impl common::Part for AppLinkDataAppLinkInfoAppTarget {}
367
368/// There is no detailed description.
369///
370/// This type is not used in any activity, and only used as *part* of another schema.
371///
372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
373#[serde_with::serde_as]
374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
375pub struct AuthenticationKey {
376 /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
377 pub id: Option<i32>,
378 /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
379 #[serde(rename = "publicKeyPem")]
380 pub public_key_pem: Option<String>,
381}
382
383impl common::Part for AuthenticationKey {}
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 Barcode {
393 /// 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.
394 #[serde(rename = "alternateText")]
395 pub alternate_text: Option<String>,
396 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#barcode"`.
397 pub kind: Option<String>,
398 /// The render encoding for the barcode. When specified, barcode is rendered in the given encoding. Otherwise best known encoding is chosen by Google.
399 #[serde(rename = "renderEncoding")]
400 pub render_encoding: Option<String>,
401 /// 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.
402 #[serde(rename = "showCodeText")]
403 pub show_code_text: Option<LocalizedString>,
404 /// The type of barcode.
405 #[serde(rename = "type")]
406 pub type_: Option<String>,
407 /// The value encoded in the barcode.
408 pub value: Option<String>,
409}
410
411impl common::Part for Barcode {}
412
413/// There is no detailed description.
414///
415/// This type is not used in any activity, and only used as *part* of another schema.
416///
417#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
418#[serde_with::serde_as]
419#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
420pub struct BarcodeSectionDetail {
421 /// A reference to an existing text-based or image field to display.
422 #[serde(rename = "fieldSelector")]
423 pub field_selector: Option<FieldSelector>,
424}
425
426impl common::Part for BarcodeSectionDetail {}
427
428/// Information to read/write to blobstore2.
429///
430/// This type is not used in any activity, and only used as *part* of another schema.
431///
432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
433#[serde_with::serde_as]
434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
435pub struct Blobstore2Info {
436 /// The blob generation id.
437 #[serde(rename = "blobGeneration")]
438 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
439 pub blob_generation: Option<i64>,
440 /// The blob id, e.g., /blobstore/prod/playground/scotty
441 #[serde(rename = "blobId")]
442 pub blob_id: Option<String>,
443 /// 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.
444 #[serde(rename = "downloadReadHandle")]
445 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
446 pub download_read_handle: Option<Vec<u8>>,
447 /// The blob read token. Needed to read blobs that have not been replicated. Might not be available until the final call.
448 #[serde(rename = "readToken")]
449 pub read_token: Option<String>,
450 /// 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.
451 #[serde(rename = "uploadMetadataContainer")]
452 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
453 pub upload_metadata_container: Option<Vec<u8>>,
454}
455
456impl common::Part for Blobstore2Info {}
457
458/// There is no detailed description.
459///
460/// This type is not used in any activity, and only used as *part* of another schema.
461///
462#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
463#[serde_with::serde_as]
464#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
465pub struct BoardingAndSeatingInfo {
466 /// 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.
467 #[serde(rename = "boardingDoor")]
468 pub boarding_door: Option<String>,
469 /// 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.
470 #[serde(rename = "boardingGroup")]
471 pub boarding_group: Option<String>,
472 /// The value of boarding position. eg: "76"
473 #[serde(rename = "boardingPosition")]
474 pub boarding_position: Option<String>,
475 /// 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.
476 #[serde(rename = "boardingPrivilegeImage")]
477 pub boarding_privilege_image: Option<Image>,
478 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#boardingAndSeatingInfo"`.
479 pub kind: Option<String>,
480 /// The passenger's seat assignment. To be used when there is no specific identifier to use in `seatNumber`. eg: "assigned at gate"
481 #[serde(rename = "seatAssignment")]
482 pub seat_assignment: Option<LocalizedString>,
483 /// The value of the seat class. eg: "Economy" or "Economy Plus"
484 #[serde(rename = "seatClass")]
485 pub seat_class: Option<String>,
486 /// The value of passenger seat. If there is no specific identifier, use `seatAssignment` instead. eg: "25A"
487 #[serde(rename = "seatNumber")]
488 pub seat_number: Option<String>,
489 /// 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"
490 #[serde(rename = "sequenceNumber")]
491 pub sequence_number: Option<String>,
492}
493
494impl common::Part for BoardingAndSeatingInfo {}
495
496/// There is no detailed description.
497///
498/// This type is not used in any activity, and only used as *part* of another schema.
499///
500#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
501#[serde_with::serde_as]
502#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
503pub struct BoardingAndSeatingPolicy {
504 /// Indicates the policy the airline uses for boarding. If unset, Google will default to `zoneBased`.
505 #[serde(rename = "boardingPolicy")]
506 pub boarding_policy: Option<String>,
507 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#boardingAndSeatingPolicy"`.
508 pub kind: Option<String>,
509 /// Seating policy which dictates how we display the seat class. If unset, Google will default to `cabinBased`.
510 #[serde(rename = "seatClassPolicy")]
511 pub seat_class_policy: Option<String>,
512}
513
514impl common::Part for BoardingAndSeatingPolicy {}
515
516/// There is no detailed description.
517///
518/// This type is not used in any activity, and only used as *part* of another schema.
519///
520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
521#[serde_with::serde_as]
522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
523pub struct CallbackOptions {
524 /// 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.
525 #[serde(rename = "updateRequestUrl")]
526 pub update_request_url: Option<String>,
527 /// 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.
528 pub url: Option<String>,
529}
530
531impl common::Part for CallbackOptions {}
532
533/// There is no detailed description.
534///
535/// This type is not used in any activity, and only used as *part* of another schema.
536///
537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
538#[serde_with::serde_as]
539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
540pub struct CardBarcodeSectionDetails {
541 /// Optional information to display below the barcode.
542 #[serde(rename = "firstBottomDetail")]
543 pub first_bottom_detail: Option<BarcodeSectionDetail>,
544 /// Optional information to display above the barcode. If `secondTopDetail` is defined, this will be displayed to the start side of this detail section.
545 #[serde(rename = "firstTopDetail")]
546 pub first_top_detail: Option<BarcodeSectionDetail>,
547 /// 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.
548 #[serde(rename = "secondTopDetail")]
549 pub second_top_detail: Option<BarcodeSectionDetail>,
550}
551
552impl common::Part for CardBarcodeSectionDetails {}
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 CardRowOneItem {
562 /// The item to be displayed in the row. This item will be automatically centered.
563 pub item: Option<TemplateItem>,
564}
565
566impl common::Part for CardRowOneItem {}
567
568/// There is no detailed description.
569///
570/// This type is not used in any activity, and only used as *part* of another schema.
571///
572#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
573#[serde_with::serde_as]
574#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
575pub struct CardRowTemplateInfo {
576 /// Template for a row containing one item. Exactly one of "one_item", "two_items", "three_items" must be set.
577 #[serde(rename = "oneItem")]
578 pub one_item: Option<CardRowOneItem>,
579 /// Template for a row containing three items. Exactly one of "one_item", "two_items", "three_items" must be set.
580 #[serde(rename = "threeItems")]
581 pub three_items: Option<CardRowThreeItems>,
582 /// Template for a row containing two items. Exactly one of "one_item", "two_items", "three_items" must be set.
583 #[serde(rename = "twoItems")]
584 pub two_items: Option<CardRowTwoItems>,
585}
586
587impl common::Part for CardRowTemplateInfo {}
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 CardRowThreeItems {
597 /// The item to be displayed at the end of the row. This item will be aligned to the right.
598 #[serde(rename = "endItem")]
599 pub end_item: Option<TemplateItem>,
600 /// The item to be displayed in the middle of the row. This item will be centered between the start and end items.
601 #[serde(rename = "middleItem")]
602 pub middle_item: Option<TemplateItem>,
603 /// The item to be displayed at the start of the row. This item will be aligned to the left.
604 #[serde(rename = "startItem")]
605 pub start_item: Option<TemplateItem>,
606}
607
608impl common::Part for CardRowThreeItems {}
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 CardRowTwoItems {
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 at the start of the row. This item will be aligned to the left.
622 #[serde(rename = "startItem")]
623 pub start_item: Option<TemplateItem>,
624}
625
626impl common::Part for CardRowTwoItems {}
627
628/// There is no detailed description.
629///
630/// This type is not used in any activity, and only used as *part* of another schema.
631///
632#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
633#[serde_with::serde_as]
634#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
635pub struct CardTemplateOverride {
636 /// Template information for rows in the card view. At most three rows are allowed to be specified.
637 #[serde(rename = "cardRowTemplateInfos")]
638 pub card_row_template_infos: Option<Vec<CardRowTemplateInfo>>,
639}
640
641impl common::Part for CardTemplateOverride {}
642
643/// There is no detailed description.
644///
645/// This type is not used in any activity, and only used as *part* of another schema.
646///
647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
648#[serde_with::serde_as]
649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
650pub struct ClassTemplateInfo {
651 /// Specifies extra information to be displayed above and below the barcode.
652 #[serde(rename = "cardBarcodeSectionDetails")]
653 pub card_barcode_section_details: Option<CardBarcodeSectionDetails>,
654 /// Override for the card view.
655 #[serde(rename = "cardTemplateOverride")]
656 pub card_template_override: Option<CardTemplateOverride>,
657 /// Override for the details view (beneath the card view).
658 #[serde(rename = "detailsTemplateOverride")]
659 pub details_template_override: Option<DetailsTemplateOverride>,
660 /// Override for the passes list view.
661 #[serde(rename = "listTemplateOverride")]
662 pub list_template_override: Option<ListTemplateOverride>,
663}
664
665impl common::Part for ClassTemplateInfo {}
666
667/// A sequence of media data references representing composite data. Introduced to support Bigstore composite objects. For details, visit http://go/bigstore-composites.
668///
669/// This type is not used in any activity, and only used as *part* of another schema.
670///
671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
672#[serde_with::serde_as]
673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
674pub struct CompositeMedia {
675 /// 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.
676 #[serde(rename = "blobRef")]
677 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
678 pub blob_ref: Option<Vec<u8>>,
679 /// Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers to a v2 blob.
680 #[serde(rename = "blobstore2Info")]
681 pub blobstore2_info: Option<Blobstore2Info>,
682 /// 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.
683 #[serde(rename = "cosmoBinaryReference")]
684 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
685 pub cosmo_binary_reference: Option<Vec<u8>>,
686 /// crc32.c hash for the payload.
687 #[serde(rename = "crc32cHash")]
688 pub crc32c_hash: Option<u32>,
689 /// Media data, set if reference_type is INLINE
690 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
691 pub inline: Option<Vec<u8>>,
692 /// Size of the data, in bytes
693 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
694 pub length: Option<i64>,
695 /// MD5 hash for the payload.
696 #[serde(rename = "md5Hash")]
697 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
698 pub md5_hash: Option<Vec<u8>>,
699 /// Reference to a TI Blob, set if reference_type is BIGSTORE_REF.
700 #[serde(rename = "objectId")]
701 pub object_id: Option<ObjectId>,
702 /// Path to the data, set if reference_type is PATH
703 pub path: Option<String>,
704 /// Describes what the field reference contains.
705 #[serde(rename = "referenceType")]
706 pub reference_type: Option<String>,
707 /// SHA-1 hash for the payload.
708 #[serde(rename = "sha1Hash")]
709 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
710 pub sha1_hash: Option<Vec<u8>>,
711}
712
713impl common::Part for CompositeMedia {}
714
715/// 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.
716///
717/// This type is not used in any activity, and only used as *part* of another schema.
718///
719#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
720#[serde_with::serde_as]
721#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
722pub struct ContentTypeInfo {
723 /// Scotty's best guess of what the content type of the file is.
724 #[serde(rename = "bestGuess")]
725 pub best_guess: Option<String>,
726 /// The content type of the file derived by looking at specific bytes (i.e. "magic bytes") of the actual file.
727 #[serde(rename = "fromBytes")]
728 pub from_bytes: Option<String>,
729 /// The content type of the file derived from the file extension of the original file name used by the client.
730 #[serde(rename = "fromFileName")]
731 pub from_file_name: Option<String>,
732 /// The content type of the file as specified in the request headers, multipart headers, or RUPIO start request.
733 #[serde(rename = "fromHeader")]
734 pub from_header: Option<String>,
735 /// 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).
736 #[serde(rename = "fromUrlPath")]
737 pub from_url_path: Option<String>,
738}
739
740impl common::Part for ContentTypeInfo {}
741
742/// There is no detailed description.
743///
744/// This type is not used in any activity, and only used as *part* of another schema.
745///
746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
747#[serde_with::serde_as]
748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
749pub struct DateTime {
750 /// 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.
751 pub date: Option<String>,
752}
753
754impl common::Part for DateTime {}
755
756/// There is no detailed description.
757///
758/// This type is not used in any activity, and only used as *part* of another schema.
759///
760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
761#[serde_with::serde_as]
762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
763pub struct DetailsItemInfo {
764 /// The item to be displayed in the details list.
765 pub item: Option<TemplateItem>,
766}
767
768impl common::Part for DetailsItemInfo {}
769
770/// There is no detailed description.
771///
772/// This type is not used in any activity, and only used as *part* of another schema.
773///
774#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
775#[serde_with::serde_as]
776#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
777pub struct DetailsTemplateOverride {
778 /// Information for the "nth" item displayed in the details list.
779 #[serde(rename = "detailsItemInfos")]
780 pub details_item_infos: Option<Vec<DetailsItemInfo>>,
781}
782
783impl common::Part for DetailsTemplateOverride {}
784
785/// Device context associated with the object.
786///
787/// This type is not used in any activity, and only used as *part* of another schema.
788///
789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
790#[serde_with::serde_as]
791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
792pub struct DeviceContext {
793 /// 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.
794 #[serde(rename = "deviceToken")]
795 pub device_token: Option<String>,
796}
797
798impl common::Part for DeviceContext {}
799
800/// Backend response for a Diff get checksums response. For details on the Scotty Diff protocol, visit http://go/scotty-diff-protocol.
801///
802/// This type is not used in any activity, and only used as *part* of another schema.
803///
804#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
805#[serde_with::serde_as]
806#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
807pub struct DiffChecksumsResponse {
808 /// 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.
809 #[serde(rename = "checksumsLocation")]
810 pub checksums_location: Option<CompositeMedia>,
811 /// The chunk size of checksums. Must be a multiple of 256KB.
812 #[serde(rename = "chunkSizeBytes")]
813 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
814 pub chunk_size_bytes: Option<i64>,
815 /// If set, calculate the checksums based on the contents and return them to the caller.
816 #[serde(rename = "objectLocation")]
817 pub object_location: Option<CompositeMedia>,
818 /// The total size of the server object.
819 #[serde(rename = "objectSizeBytes")]
820 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
821 pub object_size_bytes: Option<i64>,
822 /// The object version of the object the checksums are being returned for.
823 #[serde(rename = "objectVersion")]
824 pub object_version: Option<String>,
825}
826
827impl common::Part for DiffChecksumsResponse {}
828
829/// Backend response for a Diff download response. For details on the Scotty Diff protocol, visit http://go/scotty-diff-protocol.
830///
831/// This type is not used in any activity, and only used as *part* of another schema.
832///
833#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
834#[serde_with::serde_as]
835#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
836pub struct DiffDownloadResponse {
837 /// The original object location.
838 #[serde(rename = "objectLocation")]
839 pub object_location: Option<CompositeMedia>,
840}
841
842impl common::Part for DiffDownloadResponse {}
843
844/// A Diff upload request. For details on the Scotty Diff protocol, visit http://go/scotty-diff-protocol.
845///
846/// This type is not used in any activity, and only used as *part* of another schema.
847///
848#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
849#[serde_with::serde_as]
850#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
851pub struct DiffUploadRequest {
852 /// 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.
853 #[serde(rename = "checksumsInfo")]
854 pub checksums_info: Option<CompositeMedia>,
855 /// 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.
856 #[serde(rename = "objectInfo")]
857 pub object_info: Option<CompositeMedia>,
858 /// 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.
859 #[serde(rename = "objectVersion")]
860 pub object_version: Option<String>,
861}
862
863impl common::Part for DiffUploadRequest {}
864
865/// Backend response for 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 DiffUploadResponse {
873 /// 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.
874 #[serde(rename = "objectVersion")]
875 pub object_version: Option<String>,
876 /// The location of the original file for a diff upload request. Must be filled in if responding to an upload start notification.
877 #[serde(rename = "originalObject")]
878 pub original_object: Option<CompositeMedia>,
879}
880
881impl common::Part for DiffUploadResponse {}
882
883/// Backend response for a Diff get version response. For details on the Scotty Diff protocol, visit http://go/scotty-diff-protocol.
884///
885/// This type is not used in any activity, and only used as *part* of another schema.
886///
887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
888#[serde_with::serde_as]
889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
890pub struct DiffVersionResponse {
891 /// The total size of the server object.
892 #[serde(rename = "objectSizeBytes")]
893 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
894 pub object_size_bytes: Option<i64>,
895 /// The version of the object stored at the server.
896 #[serde(rename = "objectVersion")]
897 pub object_version: Option<String>,
898}
899
900impl common::Part for DiffVersionResponse {}
901
902/// Information about how a class may be discovered and instantiated from within the Android Pay app. This is done by searching for a loyalty or gift card program and scanning or manually entering.
903///
904/// This type is not used in any activity, and only used as *part* of another schema.
905///
906#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
907#[serde_with::serde_as]
908#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
909pub struct DiscoverableProgram {
910 /// Information about the ability to signin and add a valuable for this program through a merchant site. Used when MERCHANT_HOSTED_SIGNIN is enabled.
911 #[serde(rename = "merchantSigninInfo")]
912 pub merchant_signin_info: Option<DiscoverableProgramMerchantSigninInfo>,
913 /// Information about the ability to signup and add a valuable for this program through a merchant site. Used when MERCHANT_HOSTED_SIGNUP is enabled.
914 #[serde(rename = "merchantSignupInfo")]
915 pub merchant_signup_info: Option<DiscoverableProgramMerchantSignupInfo>,
916 /// Visibility state of the discoverable program.
917 pub state: Option<String>,
918}
919
920impl common::Part for DiscoverableProgram {}
921
922/// Information about the merchant hosted signin flow for a program.
923///
924/// This type is not used in any activity, and only used as *part* of another schema.
925///
926#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
927#[serde_with::serde_as]
928#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
929pub struct DiscoverableProgramMerchantSigninInfo {
930 /// The URL to direct the user to for the merchant's signin site.
931 #[serde(rename = "signinWebsite")]
932 pub signin_website: Option<Uri>,
933}
934
935impl common::Part for DiscoverableProgramMerchantSigninInfo {}
936
937/// Information about the merchant hosted signup flow for a program.
938///
939/// This type is not used in any activity, and only used as *part* of another schema.
940///
941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
942#[serde_with::serde_as]
943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
944pub struct DiscoverableProgramMerchantSignupInfo {
945 /// 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.
946 #[serde(rename = "signupSharedDatas")]
947 pub signup_shared_datas: Option<Vec<String>>,
948 /// The URL to direct the user to for the merchant's signup site.
949 #[serde(rename = "signupWebsite")]
950 pub signup_website: Option<Uri>,
951}
952
953impl common::Part for DiscoverableProgramMerchantSignupInfo {}
954
955/// Parameters specific to media downloads.
956///
957/// This type is not used in any activity, and only used as *part* of another schema.
958///
959#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
960#[serde_with::serde_as]
961#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
962pub struct DownloadParameters {
963 /// 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.
964 #[serde(rename = "allowGzipCompression")]
965 pub allow_gzip_compression: Option<bool>,
966 /// Determining whether or not Apiary should skip the inclusion of any Content-Range header on its response to Scotty.
967 #[serde(rename = "ignoreRange")]
968 pub ignore_range: Option<bool>,
969}
970
971impl common::Part for DownloadParameters {}
972
973/// There is no detailed description.
974///
975/// This type is not used in any activity, and only used as *part* of another schema.
976///
977#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
978#[serde_with::serde_as]
979#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
980pub struct EventDateTime {
981 /// 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.
982 #[serde(rename = "customDoorsOpenLabel")]
983 pub custom_doors_open_label: Option<LocalizedString>,
984 /// 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.
985 #[serde(rename = "doorsOpen")]
986 pub doors_open: Option<String>,
987 /// 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.
988 #[serde(rename = "doorsOpenLabel")]
989 pub doors_open_label: Option<String>,
990 /// 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.
991 pub end: Option<String>,
992 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventDateTime"`.
993 pub kind: Option<String>,
994 /// 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.
995 pub start: Option<String>,
996}
997
998impl common::Part for EventDateTime {}
999
1000/// There is no detailed description.
1001///
1002/// This type is not used in any activity, and only used as *part* of another schema.
1003///
1004#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1005#[serde_with::serde_as]
1006#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1007pub struct EventReservationInfo {
1008 /// The confirmation code of the event reservation. This may also take the form of an "order number", "confirmation number", "reservation number", or other equivalent.
1009 #[serde(rename = "confirmationCode")]
1010 pub confirmation_code: Option<String>,
1011 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventReservationInfo"`.
1012 pub kind: Option<String>,
1013}
1014
1015impl common::Part for EventReservationInfo {}
1016
1017/// There is no detailed description.
1018///
1019/// This type is not used in any activity, and only used as *part* of another schema.
1020///
1021#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1022#[serde_with::serde_as]
1023#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1024pub struct EventSeat {
1025 /// 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.
1026 pub gate: Option<LocalizedString>,
1027 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventSeat"`.
1028 pub kind: Option<String>,
1029 /// 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.
1030 pub row: Option<LocalizedString>,
1031 /// 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.
1032 pub seat: Option<LocalizedString>,
1033 /// 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.
1034 pub section: Option<LocalizedString>,
1035}
1036
1037impl common::Part for EventSeat {}
1038
1039/// There is no detailed description.
1040///
1041/// # Activities
1042///
1043/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1044/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1045///
1046/// * [get eventticketclass](EventticketclasGetCall) (response)
1047/// * [insert eventticketclass](EventticketclasInsertCall) (request|response)
1048/// * [patch eventticketclass](EventticketclasPatchCall) (request|response)
1049/// * [update eventticketclass](EventticketclasUpdateCall) (request|response)
1050#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1051#[serde_with::serde_as]
1052#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1053pub struct EventTicketClass {
1054 /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
1055 #[serde(rename = "allowMultipleUsersPerObject")]
1056 pub allow_multiple_users_per_object: Option<bool>,
1057 /// 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.
1058 #[serde(rename = "appLinkData")]
1059 pub app_link_data: Option<AppLinkData>,
1060 /// 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.
1061 #[serde(rename = "callbackOptions")]
1062 pub callback_options: Option<CallbackOptions>,
1063 /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
1064 #[serde(rename = "classTemplateInfo")]
1065 pub class_template_info: Option<ClassTemplateInfo>,
1066 /// 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.
1067 #[serde(rename = "confirmationCodeLabel")]
1068 pub confirmation_code_label: Option<String>,
1069 /// 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.
1070 #[serde(rename = "countryCode")]
1071 pub country_code: Option<String>,
1072 /// 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.
1073 #[serde(rename = "customConfirmationCodeLabel")]
1074 pub custom_confirmation_code_label: Option<LocalizedString>,
1075 /// 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.
1076 #[serde(rename = "customGateLabel")]
1077 pub custom_gate_label: Option<LocalizedString>,
1078 /// 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.
1079 #[serde(rename = "customRowLabel")]
1080 pub custom_row_label: Option<LocalizedString>,
1081 /// 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.
1082 #[serde(rename = "customSeatLabel")]
1083 pub custom_seat_label: Option<LocalizedString>,
1084 /// 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.
1085 #[serde(rename = "customSectionLabel")]
1086 pub custom_section_label: Option<LocalizedString>,
1087 /// The date & time information of the event.
1088 #[serde(rename = "dateTime")]
1089 pub date_time: Option<EventDateTime>,
1090 /// 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.
1091 #[serde(rename = "enableSmartTap")]
1092 pub enable_smart_tap: Option<bool>,
1093 /// 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).
1094 #[serde(rename = "eventId")]
1095 pub event_id: Option<String>,
1096 /// Required. The name of the event, such as "LA Dodgers at SF Giants".
1097 #[serde(rename = "eventName")]
1098 pub event_name: Option<LocalizedString>,
1099 /// The fine print, terms, or conditions of the ticket.
1100 #[serde(rename = "finePrint")]
1101 pub fine_print: Option<LocalizedString>,
1102 /// 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.
1103 #[serde(rename = "gateLabel")]
1104 pub gate_label: Option<String>,
1105 /// 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.
1106 #[serde(rename = "heroImage")]
1107 pub hero_image: Option<Image>,
1108 /// 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`.
1109 #[serde(rename = "hexBackgroundColor")]
1110 pub hex_background_color: Option<String>,
1111 /// 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).
1112 #[serde(rename = "homepageUri")]
1113 pub homepage_uri: Option<Uri>,
1114 /// 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 '-'.
1115 pub id: Option<String>,
1116 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
1117 #[serde(rename = "imageModulesData")]
1118 pub image_modules_data: Option<Vec<ImageModuleData>>,
1119 /// Deprecated. Use textModulesData instead.
1120 #[serde(rename = "infoModuleData")]
1121 pub info_module_data: Option<InfoModuleData>,
1122 /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
1123 #[serde(rename = "issuerName")]
1124 pub issuer_name: Option<String>,
1125 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventTicketClass"`.
1126 pub kind: Option<String>,
1127 /// Links module data. If links module data is also defined on the object, both will be displayed.
1128 #[serde(rename = "linksModuleData")]
1129 pub links_module_data: Option<LinksModuleData>,
1130 /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
1131 #[serde(rename = "localizedIssuerName")]
1132 pub localized_issuer_name: Option<LocalizedString>,
1133 /// Note: This field is currently not supported to trigger geo notifications.
1134 pub locations: Option<Vec<LatLongPoint>>,
1135 /// The logo image of the ticket. This image is displayed in the card detail view of the app.
1136 pub logo: Option<Image>,
1137 /// 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.
1138 pub messages: Option<Vec<Message>>,
1139 /// Identifies whether multiple users and devices will save the same object referencing this class.
1140 #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
1141 pub multiple_devices_and_holders_allowed_status: Option<String>,
1142 /// 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.
1143 #[serde(rename = "redemptionIssuers")]
1144 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1145 pub redemption_issuers: Option<Vec<i64>>,
1146 /// The review comments set by the platform when a class is marked `approved` or `rejected`.
1147 pub review: Option<Review>,
1148 /// 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`.
1149 #[serde(rename = "reviewStatus")]
1150 pub review_status: Option<String>,
1151 /// 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.
1152 #[serde(rename = "rowLabel")]
1153 pub row_label: Option<String>,
1154 /// 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.
1155 #[serde(rename = "seatLabel")]
1156 pub seat_label: Option<String>,
1157 /// 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.
1158 #[serde(rename = "sectionLabel")]
1159 pub section_label: Option<String>,
1160 /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
1161 #[serde(rename = "securityAnimation")]
1162 pub security_animation: Option<SecurityAnimation>,
1163 /// 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.
1164 #[serde(rename = "textModulesData")]
1165 pub text_modules_data: Option<Vec<TextModuleData>>,
1166 /// Event venue details.
1167 pub venue: Option<EventVenue>,
1168 /// Deprecated
1169 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1170 pub version: Option<i64>,
1171 /// View Unlock Requirement options for the event ticket.
1172 #[serde(rename = "viewUnlockRequirement")]
1173 pub view_unlock_requirement: Option<String>,
1174 /// 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.
1175 #[serde(rename = "wideLogo")]
1176 pub wide_logo: Option<Image>,
1177 /// Deprecated.
1178 #[serde(rename = "wordMark")]
1179 pub word_mark: Option<Image>,
1180}
1181
1182impl common::RequestValue for EventTicketClass {}
1183impl common::ResponseResult for EventTicketClass {}
1184
1185/// There is no detailed description.
1186///
1187/// # Activities
1188///
1189/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1190/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1191///
1192/// * [addmessage eventticketclass](EventticketclasAddmessageCall) (response)
1193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1194#[serde_with::serde_as]
1195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1196pub struct EventTicketClassAddMessageResponse {
1197 /// The updated EventTicketClass resource.
1198 pub resource: Option<EventTicketClass>,
1199}
1200
1201impl common::ResponseResult for EventTicketClassAddMessageResponse {}
1202
1203/// There is no detailed description.
1204///
1205/// # Activities
1206///
1207/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1208/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1209///
1210/// * [list eventticketclass](EventticketclasListCall) (response)
1211#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1212#[serde_with::serde_as]
1213#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1214pub struct EventTicketClassListResponse {
1215 /// Pagination of the response.
1216 pub pagination: Option<Pagination>,
1217 /// Resources corresponding to the list request.
1218 pub resources: Option<Vec<EventTicketClass>>,
1219}
1220
1221impl common::ResponseResult for EventTicketClassListResponse {}
1222
1223/// There is no detailed description.
1224///
1225/// # Activities
1226///
1227/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1228/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1229///
1230/// * [get eventticketobject](EventticketobjectGetCall) (response)
1231/// * [insert eventticketobject](EventticketobjectInsertCall) (request|response)
1232/// * [modifylinkedofferobjects eventticketobject](EventticketobjectModifylinkedofferobjectCall) (response)
1233/// * [patch eventticketobject](EventticketobjectPatchCall) (request|response)
1234/// * [update eventticketobject](EventticketobjectUpdateCall) (request|response)
1235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1236#[serde_with::serde_as]
1237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1238pub struct EventTicketObject {
1239 /// 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.
1240 #[serde(rename = "appLinkData")]
1241 pub app_link_data: Option<AppLinkData>,
1242 /// The barcode type and value.
1243 pub barcode: Option<Barcode>,
1244 /// 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.
1245 #[serde(rename = "classId")]
1246 pub class_id: Option<String>,
1247 /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
1248 #[serde(rename = "classReference")]
1249 pub class_reference: Option<EventTicketClass>,
1250 /// 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.
1251 #[serde(rename = "disableExpirationNotification")]
1252 pub disable_expiration_notification: Option<bool>,
1253 /// The face value of the ticket, matching what would be printed on a physical version of the ticket.
1254 #[serde(rename = "faceValue")]
1255 pub face_value: Option<Money>,
1256 /// Information that controls how passes are grouped together.
1257 #[serde(rename = "groupingInfo")]
1258 pub grouping_info: Option<GroupingInfo>,
1259 /// 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.
1260 #[serde(rename = "hasLinkedDevice")]
1261 pub has_linked_device: Option<bool>,
1262 /// Indicates if the object has users. This field is set by the platform.
1263 #[serde(rename = "hasUsers")]
1264 pub has_users: Option<bool>,
1265 /// 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.
1266 #[serde(rename = "heroImage")]
1267 pub hero_image: Option<Image>,
1268 /// 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`.
1269 #[serde(rename = "hexBackgroundColor")]
1270 pub hex_background_color: Option<String>,
1271 /// 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 '-'.
1272 pub id: Option<String>,
1273 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
1274 #[serde(rename = "imageModulesData")]
1275 pub image_modules_data: Option<Vec<ImageModuleData>>,
1276 /// Deprecated. Use textModulesData instead.
1277 #[serde(rename = "infoModuleData")]
1278 pub info_module_data: Option<InfoModuleData>,
1279 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventTicketObject"`.
1280 pub kind: Option<String>,
1281 /// 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.
1282 #[serde(rename = "linkedOfferIds")]
1283 pub linked_offer_ids: Option<Vec<String>>,
1284 /// Links module data. If links module data is also defined on the class, both will be displayed.
1285 #[serde(rename = "linksModuleData")]
1286 pub links_module_data: Option<LinksModuleData>,
1287 /// Note: This field is currently not supported to trigger geo notifications.
1288 pub locations: Option<Vec<LatLongPoint>>,
1289 /// 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.
1290 pub messages: Option<Vec<Message>>,
1291 /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
1292 #[serde(rename = "passConstraints")]
1293 pub pass_constraints: Option<PassConstraints>,
1294 /// Reservation details for this ticket. This is expected to be shared amongst all tickets that were purchased in the same order.
1295 #[serde(rename = "reservationInfo")]
1296 pub reservation_info: Option<EventReservationInfo>,
1297 /// The rotating barcode type and value.
1298 #[serde(rename = "rotatingBarcode")]
1299 pub rotating_barcode: Option<RotatingBarcode>,
1300 /// Seating details for this ticket.
1301 #[serde(rename = "seatInfo")]
1302 pub seat_info: Option<EventSeat>,
1303 /// 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.
1304 #[serde(rename = "smartTapRedemptionValue")]
1305 pub smart_tap_redemption_value: Option<String>,
1306 /// 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.
1307 pub state: Option<String>,
1308 /// 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.
1309 #[serde(rename = "textModulesData")]
1310 pub text_modules_data: Option<Vec<TextModuleData>>,
1311 /// Name of the ticket holder, if the ticket is assigned to a person. E.g. "John Doe" or "Jane Doe".
1312 #[serde(rename = "ticketHolderName")]
1313 pub ticket_holder_name: Option<String>,
1314 /// 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.).
1315 #[serde(rename = "ticketNumber")]
1316 pub ticket_number: Option<String>,
1317 /// The type of the ticket, such as "Adult" or "Child", or "VIP" or "Standard".
1318 #[serde(rename = "ticketType")]
1319 pub ticket_type: Option<LocalizedString>,
1320 /// 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.
1321 #[serde(rename = "validTimeInterval")]
1322 pub valid_time_interval: Option<TimeInterval>,
1323 /// Deprecated
1324 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1325 pub version: Option<i64>,
1326}
1327
1328impl common::RequestValue for EventTicketObject {}
1329impl common::ResponseResult for EventTicketObject {}
1330
1331/// There is no detailed description.
1332///
1333/// # Activities
1334///
1335/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1336/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1337///
1338/// * [addmessage eventticketobject](EventticketobjectAddmessageCall) (response)
1339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1340#[serde_with::serde_as]
1341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1342pub struct EventTicketObjectAddMessageResponse {
1343 /// The updated EventTicketObject resource.
1344 pub resource: Option<EventTicketObject>,
1345}
1346
1347impl common::ResponseResult for EventTicketObjectAddMessageResponse {}
1348
1349/// There is no detailed description.
1350///
1351/// # Activities
1352///
1353/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1354/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1355///
1356/// * [list eventticketobject](EventticketobjectListCall) (response)
1357#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1358#[serde_with::serde_as]
1359#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1360pub struct EventTicketObjectListResponse {
1361 /// Pagination of the response.
1362 pub pagination: Option<Pagination>,
1363 /// Resources corresponding to the list request.
1364 pub resources: Option<Vec<EventTicketObject>>,
1365}
1366
1367impl common::ResponseResult for EventTicketObjectListResponse {}
1368
1369/// There is no detailed description.
1370///
1371/// This type is not used in any activity, and only used as *part* of another schema.
1372///
1373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1374#[serde_with::serde_as]
1375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1376pub struct EventVenue {
1377 /// 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.
1378 pub address: Option<LocalizedString>,
1379 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#eventVenue"`.
1380 pub kind: Option<String>,
1381 /// The name of the venue, such as "AT&T Park". This is required.
1382 pub name: Option<LocalizedString>,
1383}
1384
1385impl common::Part for EventVenue {}
1386
1387/// Indicates that the issuer would like Google Wallet to send expiry notifications 2 days prior to the card expiration.
1388///
1389/// This type is not used in any activity, and only used as *part* of another schema.
1390///
1391#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1392#[serde_with::serde_as]
1393#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1394pub struct ExpiryNotification {
1395 /// Indicates if the object needs to have expiry notification enabled.
1396 #[serde(rename = "enableNotification")]
1397 pub enable_notification: Option<bool>,
1398}
1399
1400impl common::Part for ExpiryNotification {}
1401
1402/// Reference definition to use with field overrides.
1403///
1404/// This type is not used in any activity, and only used as *part* of another schema.
1405///
1406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1407#[serde_with::serde_as]
1408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1409pub struct FieldReference {
1410 /// Only valid if the `fieldPath` references a date field. Chooses how the date field will be formatted and displayed in the UI.
1411 #[serde(rename = "dateFormat")]
1412 pub date_format: Option<String>,
1413 /// 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".
1414 #[serde(rename = "fieldPath")]
1415 pub field_path: Option<String>,
1416}
1417
1418impl common::Part for FieldReference {}
1419
1420/// Custom field selector to use with field overrides.
1421///
1422/// This type is not used in any activity, and only used as *part* of another schema.
1423///
1424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1425#[serde_with::serde_as]
1426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1427pub struct FieldSelector {
1428 /// If more than one reference is supplied, then the first one that references a non-empty field will be displayed.
1429 pub fields: Option<Vec<FieldReference>>,
1430}
1431
1432impl common::Part for FieldSelector {}
1433
1434/// There is no detailed description.
1435///
1436/// This type is not used in any activity, and only used as *part* of another schema.
1437///
1438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1439#[serde_with::serde_as]
1440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1441pub struct FirstRowOption {
1442 /// A reference to the field to be displayed in the first row.
1443 #[serde(rename = "fieldOption")]
1444 pub field_option: Option<FieldSelector>,
1445 /// no description provided
1446 #[serde(rename = "transitOption")]
1447 pub transit_option: Option<String>,
1448}
1449
1450impl common::Part for FirstRowOption {}
1451
1452/// There is no detailed description.
1453///
1454/// This type is not used in any activity, and only used as *part* of another schema.
1455///
1456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1457#[serde_with::serde_as]
1458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1459pub struct FlightCarrier {
1460 /// A logo for the airline alliance, displayed below the QR code that the passenger scans to board.
1461 #[serde(rename = "airlineAllianceLogo")]
1462 pub airline_alliance_logo: Option<Image>,
1463 /// A logo for the airline described by carrierIataCode and localizedAirlineName. This logo will be rendered at the top of the detailed card view.
1464 #[serde(rename = "airlineLogo")]
1465 pub airline_logo: Option<Image>,
1466 /// 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"
1467 #[serde(rename = "airlineName")]
1468 pub airline_name: Option<LocalizedString>,
1469 /// 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
1470 #[serde(rename = "carrierIataCode")]
1471 pub carrier_iata_code: Option<String>,
1472 /// 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
1473 #[serde(rename = "carrierIcaoCode")]
1474 pub carrier_icao_code: Option<String>,
1475 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#flightCarrier"`.
1476 pub kind: Option<String>,
1477 /// 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.
1478 #[serde(rename = "wideAirlineLogo")]
1479 pub wide_airline_logo: Option<Image>,
1480}
1481
1482impl common::Part for FlightCarrier {}
1483
1484/// There is no detailed description.
1485///
1486/// # Activities
1487///
1488/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1489/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1490///
1491/// * [get flightclass](FlightclasGetCall) (response)
1492/// * [insert flightclass](FlightclasInsertCall) (request|response)
1493/// * [patch flightclass](FlightclasPatchCall) (request|response)
1494/// * [update flightclass](FlightclasUpdateCall) (request|response)
1495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1496#[serde_with::serde_as]
1497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1498pub struct FlightClass {
1499 /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
1500 #[serde(rename = "allowMultipleUsersPerObject")]
1501 pub allow_multiple_users_per_object: Option<bool>,
1502 /// 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.
1503 #[serde(rename = "appLinkData")]
1504 pub app_link_data: Option<AppLinkData>,
1505 /// Policies for boarding and seating. These will inform which labels will be shown to users.
1506 #[serde(rename = "boardingAndSeatingPolicy")]
1507 pub boarding_and_seating_policy: Option<BoardingAndSeatingPolicy>,
1508 /// 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.
1509 #[serde(rename = "callbackOptions")]
1510 pub callback_options: Option<CallbackOptions>,
1511 /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
1512 #[serde(rename = "classTemplateInfo")]
1513 pub class_template_info: Option<ClassTemplateInfo>,
1514 /// 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.
1515 #[serde(rename = "countryCode")]
1516 pub country_code: Option<String>,
1517 /// Required. Destination airport.
1518 pub destination: Option<AirportInfo>,
1519 /// 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.
1520 #[serde(rename = "enableSmartTap")]
1521 pub enable_smart_tap: Option<bool>,
1522 /// Required. Information about the flight carrier and number.
1523 #[serde(rename = "flightHeader")]
1524 pub flight_header: Option<FlightHeader>,
1525 /// 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.
1526 #[serde(rename = "flightStatus")]
1527 pub flight_status: Option<String>,
1528 /// 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.
1529 #[serde(rename = "heroImage")]
1530 pub hero_image: Option<Image>,
1531 /// 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`.
1532 #[serde(rename = "hexBackgroundColor")]
1533 pub hex_background_color: Option<String>,
1534 /// 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).
1535 #[serde(rename = "homepageUri")]
1536 pub homepage_uri: Option<Uri>,
1537 /// 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 '-'.
1538 pub id: Option<String>,
1539 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
1540 #[serde(rename = "imageModulesData")]
1541 pub image_modules_data: Option<Vec<ImageModuleData>>,
1542 /// Deprecated. Use textModulesData instead.
1543 #[serde(rename = "infoModuleData")]
1544 pub info_module_data: Option<InfoModuleData>,
1545 /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
1546 #[serde(rename = "issuerName")]
1547 pub issuer_name: Option<String>,
1548 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#flightClass"`.
1549 pub kind: Option<String>,
1550 /// 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".
1551 #[serde(rename = "languageOverride")]
1552 pub language_override: Option<String>,
1553 /// Links module data. If links module data is also defined on the object, both will be displayed.
1554 #[serde(rename = "linksModuleData")]
1555 pub links_module_data: Option<LinksModuleData>,
1556 /// 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. If this is not set, Google will set it based on data from other sources.
1557 #[serde(rename = "localBoardingDateTime")]
1558 pub local_boarding_date_time: Option<String>,
1559 /// 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. If this is not set, Google will set it based on data from other sources.
1560 #[serde(rename = "localEstimatedOrActualArrivalDateTime")]
1561 pub local_estimated_or_actual_arrival_date_time: Option<String>,
1562 /// 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. If this is not set, Google will set it based on data from other sources.
1563 #[serde(rename = "localEstimatedOrActualDepartureDateTime")]
1564 pub local_estimated_or_actual_departure_date_time: Option<String>,
1565 /// 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.
1566 #[serde(rename = "localGateClosingDateTime")]
1567 pub local_gate_closing_date_time: Option<String>,
1568 /// 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. If this is not set, Google will set it based on data from other sources.
1569 #[serde(rename = "localScheduledArrivalDateTime")]
1570 pub local_scheduled_arrival_date_time: Option<String>,
1571 /// 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.
1572 #[serde(rename = "localScheduledDepartureDateTime")]
1573 pub local_scheduled_departure_date_time: Option<String>,
1574 /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
1575 #[serde(rename = "localizedIssuerName")]
1576 pub localized_issuer_name: Option<LocalizedString>,
1577 /// Note: This field is currently not supported to trigger geo notifications.
1578 pub locations: Option<Vec<LatLongPoint>>,
1579 /// 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.
1580 pub messages: Option<Vec<Message>>,
1581 /// Identifies whether multiple users and devices will save the same object referencing this class.
1582 #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
1583 pub multiple_devices_and_holders_allowed_status: Option<String>,
1584 /// Required. Origin airport.
1585 pub origin: Option<AirportInfo>,
1586 /// 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.
1587 #[serde(rename = "redemptionIssuers")]
1588 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1589 pub redemption_issuers: Option<Vec<i64>>,
1590 /// The review comments set by the platform when a class is marked `approved` or `rejected`.
1591 pub review: Option<Review>,
1592 /// 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`.
1593 #[serde(rename = "reviewStatus")]
1594 pub review_status: Option<String>,
1595 /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
1596 #[serde(rename = "securityAnimation")]
1597 pub security_animation: Option<SecurityAnimation>,
1598 /// 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.
1599 #[serde(rename = "textModulesData")]
1600 pub text_modules_data: Option<Vec<TextModuleData>>,
1601 /// Deprecated
1602 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1603 pub version: Option<i64>,
1604 /// View Unlock Requirement options for the boarding pass.
1605 #[serde(rename = "viewUnlockRequirement")]
1606 pub view_unlock_requirement: Option<String>,
1607 /// Deprecated.
1608 #[serde(rename = "wordMark")]
1609 pub word_mark: Option<Image>,
1610}
1611
1612impl common::RequestValue for FlightClass {}
1613impl common::ResponseResult for FlightClass {}
1614
1615/// There is no detailed description.
1616///
1617/// # Activities
1618///
1619/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1620/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1621///
1622/// * [addmessage flightclass](FlightclasAddmessageCall) (response)
1623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1624#[serde_with::serde_as]
1625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1626pub struct FlightClassAddMessageResponse {
1627 /// The updated FlightClass resource.
1628 pub resource: Option<FlightClass>,
1629}
1630
1631impl common::ResponseResult for FlightClassAddMessageResponse {}
1632
1633/// There is no detailed description.
1634///
1635/// # Activities
1636///
1637/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1638/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1639///
1640/// * [list flightclass](FlightclasListCall) (response)
1641#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1642#[serde_with::serde_as]
1643#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1644pub struct FlightClassListResponse {
1645 /// Pagination of the response.
1646 pub pagination: Option<Pagination>,
1647 /// Resources corresponding to the list request.
1648 pub resources: Option<Vec<FlightClass>>,
1649}
1650
1651impl common::ResponseResult for FlightClassListResponse {}
1652
1653/// There is no detailed description.
1654///
1655/// This type is not used in any activity, and only used as *part* of another schema.
1656///
1657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1658#[serde_with::serde_as]
1659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1660pub struct FlightHeader {
1661 /// Information about airline carrier. This is a required property of `flightHeader`.
1662 pub carrier: Option<FlightCarrier>,
1663 /// The flight number without IATA carrier code. This field should contain only digits. This is a required property of `flightHeader`. eg: "123"
1664 #[serde(rename = "flightNumber")]
1665 pub flight_number: Option<String>,
1666 /// 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"
1667 #[serde(rename = "flightNumberDisplayOverride")]
1668 pub flight_number_display_override: Option<String>,
1669 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#flightHeader"`.
1670 pub kind: Option<String>,
1671 /// Information about operating airline carrier.
1672 #[serde(rename = "operatingCarrier")]
1673 pub operating_carrier: Option<FlightCarrier>,
1674 /// The flight number used by the operating carrier without IATA carrier code. This field should contain only digits. eg: "234"
1675 #[serde(rename = "operatingFlightNumber")]
1676 pub operating_flight_number: Option<String>,
1677}
1678
1679impl common::Part for FlightHeader {}
1680
1681/// There is no detailed description.
1682///
1683/// # Activities
1684///
1685/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1686/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1687///
1688/// * [get flightobject](FlightobjectGetCall) (response)
1689/// * [insert flightobject](FlightobjectInsertCall) (request|response)
1690/// * [patch flightobject](FlightobjectPatchCall) (request|response)
1691/// * [update flightobject](FlightobjectUpdateCall) (request|response)
1692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1693#[serde_with::serde_as]
1694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1695pub struct FlightObject {
1696 /// 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.
1697 #[serde(rename = "appLinkData")]
1698 pub app_link_data: Option<AppLinkData>,
1699 /// The barcode type and value.
1700 pub barcode: Option<Barcode>,
1701 /// Passenger specific information about boarding and seating.
1702 #[serde(rename = "boardingAndSeatingInfo")]
1703 pub boarding_and_seating_info: Option<BoardingAndSeatingInfo>,
1704 /// 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.
1705 #[serde(rename = "classId")]
1706 pub class_id: Option<String>,
1707 /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
1708 #[serde(rename = "classReference")]
1709 pub class_reference: Option<FlightClass>,
1710 /// 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.
1711 #[serde(rename = "disableExpirationNotification")]
1712 pub disable_expiration_notification: Option<bool>,
1713 /// Information that controls how passes are grouped together.
1714 #[serde(rename = "groupingInfo")]
1715 pub grouping_info: Option<GroupingInfo>,
1716 /// 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.
1717 #[serde(rename = "hasLinkedDevice")]
1718 pub has_linked_device: Option<bool>,
1719 /// Indicates if the object has users. This field is set by the platform.
1720 #[serde(rename = "hasUsers")]
1721 pub has_users: Option<bool>,
1722 /// 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.
1723 #[serde(rename = "heroImage")]
1724 pub hero_image: Option<Image>,
1725 /// 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`.
1726 #[serde(rename = "hexBackgroundColor")]
1727 pub hex_background_color: Option<String>,
1728 /// 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 '-'.
1729 pub id: Option<String>,
1730 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
1731 #[serde(rename = "imageModulesData")]
1732 pub image_modules_data: Option<Vec<ImageModuleData>>,
1733 /// Deprecated. Use textModulesData instead.
1734 #[serde(rename = "infoModuleData")]
1735 pub info_module_data: Option<InfoModuleData>,
1736 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#flightObject"`.
1737 pub kind: Option<String>,
1738 /// Links module data. If links module data is also defined on the class, both will be displayed.
1739 #[serde(rename = "linksModuleData")]
1740 pub links_module_data: Option<LinksModuleData>,
1741 /// Note: This field is currently not supported to trigger geo notifications.
1742 pub locations: Option<Vec<LatLongPoint>>,
1743 /// 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.
1744 pub messages: Option<Vec<Message>>,
1745 /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
1746 #[serde(rename = "passConstraints")]
1747 pub pass_constraints: Option<PassConstraints>,
1748 /// Required. Passenger name as it would appear on the boarding pass. eg: "Dave M Gahan" or "Gahan/Dave" or "GAHAN/DAVEM"
1749 #[serde(rename = "passengerName")]
1750 pub passenger_name: Option<String>,
1751 /// Required. Information about flight reservation.
1752 #[serde(rename = "reservationInfo")]
1753 pub reservation_info: Option<ReservationInfo>,
1754 /// The rotating barcode type and value.
1755 #[serde(rename = "rotatingBarcode")]
1756 pub rotating_barcode: Option<RotatingBarcode>,
1757 /// An image for the security program that applies to the passenger.
1758 #[serde(rename = "securityProgramLogo")]
1759 pub security_program_logo: Option<Image>,
1760 /// 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.
1761 #[serde(rename = "smartTapRedemptionValue")]
1762 pub smart_tap_redemption_value: Option<String>,
1763 /// 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.
1764 pub state: Option<String>,
1765 /// 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.
1766 #[serde(rename = "textModulesData")]
1767 pub text_modules_data: Option<Vec<TextModuleData>>,
1768 /// 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.
1769 #[serde(rename = "validTimeInterval")]
1770 pub valid_time_interval: Option<TimeInterval>,
1771 /// Deprecated
1772 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1773 pub version: Option<i64>,
1774}
1775
1776impl common::RequestValue for FlightObject {}
1777impl common::ResponseResult for FlightObject {}
1778
1779/// There is no detailed description.
1780///
1781/// # Activities
1782///
1783/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1784/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1785///
1786/// * [addmessage flightobject](FlightobjectAddmessageCall) (response)
1787#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1788#[serde_with::serde_as]
1789#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1790pub struct FlightObjectAddMessageResponse {
1791 /// The updated FlightObject resource.
1792 pub resource: Option<FlightObject>,
1793}
1794
1795impl common::ResponseResult for FlightObjectAddMessageResponse {}
1796
1797/// There is no detailed description.
1798///
1799/// # Activities
1800///
1801/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1802/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1803///
1804/// * [list flightobject](FlightobjectListCall) (response)
1805#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1806#[serde_with::serde_as]
1807#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1808pub struct FlightObjectListResponse {
1809 /// Pagination of the response.
1810 pub pagination: Option<Pagination>,
1811 /// Resources corresponding to the list request.
1812 pub resources: Option<Vec<FlightObject>>,
1813}
1814
1815impl common::ResponseResult for FlightObjectListResponse {}
1816
1817/// There is no detailed description.
1818///
1819/// This type is not used in any activity, and only used as *part* of another schema.
1820///
1821#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1822#[serde_with::serde_as]
1823#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1824pub struct FrequentFlyerInfo {
1825 /// Frequent flyer number. Required for each nested object of kind `walletobjects#frequentFlyerInfo`.
1826 #[serde(rename = "frequentFlyerNumber")]
1827 pub frequent_flyer_number: Option<String>,
1828 /// Frequent flyer program name. eg: "Lufthansa Miles & More"
1829 #[serde(rename = "frequentFlyerProgramName")]
1830 pub frequent_flyer_program_name: Option<LocalizedString>,
1831 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#frequentFlyerInfo"`.
1832 pub kind: Option<String>,
1833}
1834
1835impl common::Part for FrequentFlyerInfo {}
1836
1837/// Generic Class
1838///
1839/// # Activities
1840///
1841/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1842/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1843///
1844/// * [get genericclass](GenericclasGetCall) (response)
1845/// * [insert genericclass](GenericclasInsertCall) (request|response)
1846/// * [patch genericclass](GenericclasPatchCall) (request|response)
1847/// * [update genericclass](GenericclasUpdateCall) (request|response)
1848#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1849#[serde_with::serde_as]
1850#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1851pub struct GenericClass {
1852 /// 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.
1853 #[serde(rename = "appLinkData")]
1854 pub app_link_data: Option<AppLinkData>,
1855 /// 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.
1856 #[serde(rename = "callbackOptions")]
1857 pub callback_options: Option<CallbackOptions>,
1858 /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
1859 #[serde(rename = "classTemplateInfo")]
1860 pub class_template_info: Option<ClassTemplateInfo>,
1861 /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
1862 #[serde(rename = "enableSmartTap")]
1863 pub enable_smart_tap: Option<bool>,
1864 /// 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 `-`.
1865 pub id: Option<String>,
1866 /// 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.
1867 #[serde(rename = "imageModulesData")]
1868 pub image_modules_data: Option<Vec<ImageModuleData>>,
1869 /// 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.
1870 #[serde(rename = "linksModuleData")]
1871 pub links_module_data: Option<LinksModuleData>,
1872 /// 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.
1873 pub messages: Option<Vec<Message>>,
1874 /// Identifies whether multiple users and devices will save the same object referencing this class.
1875 #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
1876 pub multiple_devices_and_holders_allowed_status: Option<String>,
1877 /// 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.
1878 #[serde(rename = "redemptionIssuers")]
1879 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1880 pub redemption_issuers: Option<Vec<i64>>,
1881 /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
1882 #[serde(rename = "securityAnimation")]
1883 pub security_animation: Option<SecurityAnimation>,
1884 /// 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.
1885 #[serde(rename = "textModulesData")]
1886 pub text_modules_data: Option<Vec<TextModuleData>>,
1887 /// View Unlock Requirement options for the generic pass.
1888 #[serde(rename = "viewUnlockRequirement")]
1889 pub view_unlock_requirement: Option<String>,
1890}
1891
1892impl common::RequestValue for GenericClass {}
1893impl common::ResponseResult for GenericClass {}
1894
1895/// Response to adding a new issuer message to the class. This contains the entire updated GenericClass.
1896///
1897/// # Activities
1898///
1899/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1900/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1901///
1902/// * [addmessage genericclass](GenericclasAddmessageCall) (response)
1903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1904#[serde_with::serde_as]
1905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1906pub struct GenericClassAddMessageResponse {
1907 /// The updated EventTicketClass resource.
1908 pub resource: Option<GenericClass>,
1909}
1910
1911impl common::ResponseResult for GenericClassAddMessageResponse {}
1912
1913/// List response which contains the list of all generic classes for a given issuer ID.
1914///
1915/// # Activities
1916///
1917/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1918/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1919///
1920/// * [list genericclass](GenericclasListCall) (response)
1921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1922#[serde_with::serde_as]
1923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1924pub struct GenericClassListResponse {
1925 /// Pagination of the response.
1926 pub pagination: Option<Pagination>,
1927 /// Resources corresponding to the list request.
1928 pub resources: Option<Vec<GenericClass>>,
1929}
1930
1931impl common::ResponseResult for GenericClassListResponse {}
1932
1933/// Generic Object
1934///
1935/// # Activities
1936///
1937/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1938/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1939///
1940/// * [get genericobject](GenericobjectGetCall) (response)
1941/// * [insert genericobject](GenericobjectInsertCall) (request|response)
1942/// * [patch genericobject](GenericobjectPatchCall) (request|response)
1943/// * [update genericobject](GenericobjectUpdateCall) (request|response)
1944#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1945#[serde_with::serde_as]
1946#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1947pub struct GenericObject {
1948 /// 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.
1949 #[serde(rename = "appLinkData")]
1950 pub app_link_data: Option<AppLinkData>,
1951 /// 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.
1952 pub barcode: Option<Barcode>,
1953 /// 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.
1954 #[serde(rename = "cardTitle")]
1955 pub card_title: Option<LocalizedString>,
1956 /// 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.
1957 #[serde(rename = "classId")]
1958 pub class_id: Option<String>,
1959 /// Specify which `GenericType` the card belongs to.
1960 #[serde(rename = "genericType")]
1961 pub generic_type: Option<String>,
1962 /// Information that controls how passes are grouped together.
1963 #[serde(rename = "groupingInfo")]
1964 pub grouping_info: Option<GroupingInfo>,
1965 /// Indicates if the object has users. This field is set by the platform.
1966 #[serde(rename = "hasUsers")]
1967 pub has_users: Option<bool>,
1968 /// 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.
1969 pub header: Option<LocalizedString>,
1970 /// Banner image displayed on the front of the card if present. The image will be displayed at 100% width.
1971 #[serde(rename = "heroImage")]
1972 pub hero_image: Option<Image>,
1973 /// 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.
1974 #[serde(rename = "hexBackgroundColor")]
1975 pub hex_background_color: Option<String>,
1976 /// 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 `-`.
1977 pub id: Option<String>,
1978 /// Image module data. Only one of the image from class and one from object level will be rendered when both set.
1979 #[serde(rename = "imageModulesData")]
1980 pub image_modules_data: Option<Vec<ImageModuleData>>,
1981 /// 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.
1982 #[serde(rename = "linksModuleData")]
1983 pub links_module_data: Option<LinksModuleData>,
1984 /// 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.
1985 pub logo: Option<Image>,
1986 /// The notification settings that are enabled for this object.
1987 pub notifications: Option<Notifications>,
1988 /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
1989 #[serde(rename = "passConstraints")]
1990 pub pass_constraints: Option<PassConstraints>,
1991 /// The rotating barcode settings/details.
1992 #[serde(rename = "rotatingBarcode")]
1993 pub rotating_barcode: Option<RotatingBarcode>,
1994 /// 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.
1995 #[serde(rename = "smartTapRedemptionValue")]
1996 pub smart_tap_redemption_value: Option<String>,
1997 /// 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`.
1998 pub state: Option<String>,
1999 /// 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.
2000 pub subheader: Option<LocalizedString>,
2001 /// 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.
2002 #[serde(rename = "textModulesData")]
2003 pub text_modules_data: Option<Vec<TextModuleData>>,
2004 /// 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.
2005 #[serde(rename = "validTimeInterval")]
2006 pub valid_time_interval: Option<TimeInterval>,
2007 /// 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.
2008 #[serde(rename = "wideLogo")]
2009 pub wide_logo: Option<Image>,
2010}
2011
2012impl common::RequestValue for GenericObject {}
2013impl common::ResponseResult for GenericObject {}
2014
2015/// Response to adding a new issuer message to the object. This contains the entire updated GenericObject.
2016///
2017/// # Activities
2018///
2019/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2020/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2021///
2022/// * [addmessage genericobject](GenericobjectAddmessageCall) (response)
2023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2024#[serde_with::serde_as]
2025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2026pub struct GenericObjectAddMessageResponse {
2027 /// The updated GenericObject resource.
2028 pub resource: Option<GenericObject>,
2029}
2030
2031impl common::ResponseResult for GenericObjectAddMessageResponse {}
2032
2033/// List response which contains the list of all generic objects for a given issuer ID.
2034///
2035/// # Activities
2036///
2037/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2038/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2039///
2040/// * [list genericobject](GenericobjectListCall) (response)
2041#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2042#[serde_with::serde_as]
2043#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2044pub struct GenericObjectListResponse {
2045 /// Pagination of the response.
2046 pub pagination: Option<Pagination>,
2047 /// Resources corresponding to the list request.
2048 pub resources: Option<Vec<GenericObject>>,
2049}
2050
2051impl common::ResponseResult for GenericObjectListResponse {}
2052
2053/// There is no detailed description.
2054///
2055/// # Activities
2056///
2057/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2058/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2059///
2060/// * [get giftcardclass](GiftcardclasGetCall) (response)
2061/// * [insert giftcardclass](GiftcardclasInsertCall) (request|response)
2062/// * [patch giftcardclass](GiftcardclasPatchCall) (request|response)
2063/// * [update giftcardclass](GiftcardclasUpdateCall) (request|response)
2064#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2065#[serde_with::serde_as]
2066#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2067pub struct GiftCardClass {
2068 /// 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.
2069 #[serde(rename = "allowBarcodeRedemption")]
2070 pub allow_barcode_redemption: Option<bool>,
2071 /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
2072 #[serde(rename = "allowMultipleUsersPerObject")]
2073 pub allow_multiple_users_per_object: Option<bool>,
2074 /// 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.
2075 #[serde(rename = "appLinkData")]
2076 pub app_link_data: Option<AppLinkData>,
2077 /// 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.
2078 #[serde(rename = "callbackOptions")]
2079 pub callback_options: Option<CallbackOptions>,
2080 /// The label to display for the card number, such as "Card Number".
2081 #[serde(rename = "cardNumberLabel")]
2082 pub card_number_label: Option<String>,
2083 /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
2084 #[serde(rename = "classTemplateInfo")]
2085 pub class_template_info: Option<ClassTemplateInfo>,
2086 /// 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.
2087 #[serde(rename = "countryCode")]
2088 pub country_code: Option<String>,
2089 /// 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.
2090 #[serde(rename = "enableSmartTap")]
2091 pub enable_smart_tap: Option<bool>,
2092 /// The label to display for event number, such as "Target Event #".
2093 #[serde(rename = "eventNumberLabel")]
2094 pub event_number_label: Option<String>,
2095 /// 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.
2096 #[serde(rename = "heroImage")]
2097 pub hero_image: Option<Image>,
2098 /// 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`.
2099 #[serde(rename = "hexBackgroundColor")]
2100 pub hex_background_color: Option<String>,
2101 /// 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).
2102 #[serde(rename = "homepageUri")]
2103 pub homepage_uri: Option<Uri>,
2104 /// 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 '-'.
2105 pub id: Option<String>,
2106 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
2107 #[serde(rename = "imageModulesData")]
2108 pub image_modules_data: Option<Vec<ImageModuleData>>,
2109 /// Deprecated. Use textModulesData instead.
2110 #[serde(rename = "infoModuleData")]
2111 pub info_module_data: Option<InfoModuleData>,
2112 /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
2113 #[serde(rename = "issuerName")]
2114 pub issuer_name: Option<String>,
2115 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#giftCardClass"`.
2116 pub kind: Option<String>,
2117 /// Links module data. If links module data is also defined on the object, both will be displayed.
2118 #[serde(rename = "linksModuleData")]
2119 pub links_module_data: Option<LinksModuleData>,
2120 /// Translated strings for the card_number_label.
2121 #[serde(rename = "localizedCardNumberLabel")]
2122 pub localized_card_number_label: Option<LocalizedString>,
2123 /// Translated strings for the event_number_label.
2124 #[serde(rename = "localizedEventNumberLabel")]
2125 pub localized_event_number_label: Option<LocalizedString>,
2126 /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
2127 #[serde(rename = "localizedIssuerName")]
2128 pub localized_issuer_name: Option<LocalizedString>,
2129 /// 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.
2130 #[serde(rename = "localizedMerchantName")]
2131 pub localized_merchant_name: Option<LocalizedString>,
2132 /// Translated strings for the pin_label.
2133 #[serde(rename = "localizedPinLabel")]
2134 pub localized_pin_label: Option<LocalizedString>,
2135 /// Note: This field is currently not supported to trigger geo notifications.
2136 pub locations: Option<Vec<LatLongPoint>>,
2137 /// 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.
2138 #[serde(rename = "merchantName")]
2139 pub merchant_name: Option<String>,
2140 /// 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.
2141 pub messages: Option<Vec<Message>>,
2142 /// Identifies whether multiple users and devices will save the same object referencing this class.
2143 #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
2144 pub multiple_devices_and_holders_allowed_status: Option<String>,
2145 /// The label to display for the PIN, such as "4-digit PIN".
2146 #[serde(rename = "pinLabel")]
2147 pub pin_label: Option<String>,
2148 /// The logo of the gift card program or company. This logo is displayed in both the details and list views of the app.
2149 #[serde(rename = "programLogo")]
2150 pub program_logo: Option<Image>,
2151 /// 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.
2152 #[serde(rename = "redemptionIssuers")]
2153 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2154 pub redemption_issuers: Option<Vec<i64>>,
2155 /// The review comments set by the platform when a class is marked `approved` or `rejected`.
2156 pub review: Option<Review>,
2157 /// 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`.
2158 #[serde(rename = "reviewStatus")]
2159 pub review_status: Option<String>,
2160 /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
2161 #[serde(rename = "securityAnimation")]
2162 pub security_animation: Option<SecurityAnimation>,
2163 /// 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.
2164 #[serde(rename = "textModulesData")]
2165 pub text_modules_data: Option<Vec<TextModuleData>>,
2166 /// Deprecated
2167 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2168 pub version: Option<i64>,
2169 /// View Unlock Requirement options for the gift card.
2170 #[serde(rename = "viewUnlockRequirement")]
2171 pub view_unlock_requirement: Option<String>,
2172 /// 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.
2173 #[serde(rename = "wideProgramLogo")]
2174 pub wide_program_logo: Option<Image>,
2175 /// Deprecated.
2176 #[serde(rename = "wordMark")]
2177 pub word_mark: Option<Image>,
2178}
2179
2180impl common::RequestValue for GiftCardClass {}
2181impl common::ResponseResult for GiftCardClass {}
2182
2183/// There is no detailed description.
2184///
2185/// # Activities
2186///
2187/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2188/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2189///
2190/// * [addmessage giftcardclass](GiftcardclasAddmessageCall) (response)
2191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2192#[serde_with::serde_as]
2193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2194pub struct GiftCardClassAddMessageResponse {
2195 /// The updated GiftCardClass resource.
2196 pub resource: Option<GiftCardClass>,
2197}
2198
2199impl common::ResponseResult for GiftCardClassAddMessageResponse {}
2200
2201/// There is no detailed description.
2202///
2203/// # Activities
2204///
2205/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2206/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2207///
2208/// * [list giftcardclass](GiftcardclasListCall) (response)
2209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2210#[serde_with::serde_as]
2211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2212pub struct GiftCardClassListResponse {
2213 /// Pagination of the response.
2214 pub pagination: Option<Pagination>,
2215 /// Resources corresponding to the list request.
2216 pub resources: Option<Vec<GiftCardClass>>,
2217}
2218
2219impl common::ResponseResult for GiftCardClassListResponse {}
2220
2221/// There is no detailed description.
2222///
2223/// # Activities
2224///
2225/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2226/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2227///
2228/// * [get giftcardobject](GiftcardobjectGetCall) (response)
2229/// * [insert giftcardobject](GiftcardobjectInsertCall) (request|response)
2230/// * [patch giftcardobject](GiftcardobjectPatchCall) (request|response)
2231/// * [update giftcardobject](GiftcardobjectUpdateCall) (request|response)
2232#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2233#[serde_with::serde_as]
2234#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2235pub struct GiftCardObject {
2236 /// 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.
2237 #[serde(rename = "appLinkData")]
2238 pub app_link_data: Option<AppLinkData>,
2239 /// The card's monetary balance.
2240 pub balance: Option<Money>,
2241 /// 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.
2242 #[serde(rename = "balanceUpdateTime")]
2243 pub balance_update_time: Option<DateTime>,
2244 /// The barcode type and value.
2245 pub barcode: Option<Barcode>,
2246 /// Required. The card's number.
2247 #[serde(rename = "cardNumber")]
2248 pub card_number: Option<String>,
2249 /// 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.
2250 #[serde(rename = "classId")]
2251 pub class_id: Option<String>,
2252 /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
2253 #[serde(rename = "classReference")]
2254 pub class_reference: Option<GiftCardClass>,
2255 /// 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.
2256 #[serde(rename = "disableExpirationNotification")]
2257 pub disable_expiration_notification: Option<bool>,
2258 /// The card's event number, an optional field used by some gift cards.
2259 #[serde(rename = "eventNumber")]
2260 pub event_number: Option<String>,
2261 /// Information that controls how passes are grouped together.
2262 #[serde(rename = "groupingInfo")]
2263 pub grouping_info: Option<GroupingInfo>,
2264 /// 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.
2265 #[serde(rename = "hasLinkedDevice")]
2266 pub has_linked_device: Option<bool>,
2267 /// Indicates if the object has users. This field is set by the platform.
2268 #[serde(rename = "hasUsers")]
2269 pub has_users: Option<bool>,
2270 /// 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.
2271 #[serde(rename = "heroImage")]
2272 pub hero_image: Option<Image>,
2273 /// 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 '-'.
2274 pub id: Option<String>,
2275 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
2276 #[serde(rename = "imageModulesData")]
2277 pub image_modules_data: Option<Vec<ImageModuleData>>,
2278 /// Deprecated. Use textModulesData instead.
2279 #[serde(rename = "infoModuleData")]
2280 pub info_module_data: Option<InfoModuleData>,
2281 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#giftCardObject"`.
2282 pub kind: Option<String>,
2283 /// Links module data. If links module data is also defined on the class, both will be displayed.
2284 #[serde(rename = "linksModuleData")]
2285 pub links_module_data: Option<LinksModuleData>,
2286 /// Note: This field is currently not supported to trigger geo notifications.
2287 pub locations: Option<Vec<LatLongPoint>>,
2288 /// 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.
2289 pub messages: Option<Vec<Message>>,
2290 /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
2291 #[serde(rename = "passConstraints")]
2292 pub pass_constraints: Option<PassConstraints>,
2293 /// The card's PIN.
2294 pub pin: Option<String>,
2295 /// The rotating barcode type and value.
2296 #[serde(rename = "rotatingBarcode")]
2297 pub rotating_barcode: Option<RotatingBarcode>,
2298 /// 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.
2299 #[serde(rename = "smartTapRedemptionValue")]
2300 pub smart_tap_redemption_value: Option<String>,
2301 /// 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.
2302 pub state: Option<String>,
2303 /// 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.
2304 #[serde(rename = "textModulesData")]
2305 pub text_modules_data: Option<Vec<TextModuleData>>,
2306 /// 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.
2307 #[serde(rename = "validTimeInterval")]
2308 pub valid_time_interval: Option<TimeInterval>,
2309 /// Deprecated
2310 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2311 pub version: Option<i64>,
2312}
2313
2314impl common::RequestValue for GiftCardObject {}
2315impl common::ResponseResult for GiftCardObject {}
2316
2317/// There is no detailed description.
2318///
2319/// # Activities
2320///
2321/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2322/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2323///
2324/// * [addmessage giftcardobject](GiftcardobjectAddmessageCall) (response)
2325#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2326#[serde_with::serde_as]
2327#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2328pub struct GiftCardObjectAddMessageResponse {
2329 /// The updated GiftCardObject resource.
2330 pub resource: Option<GiftCardObject>,
2331}
2332
2333impl common::ResponseResult for GiftCardObjectAddMessageResponse {}
2334
2335/// There is no detailed description.
2336///
2337/// # Activities
2338///
2339/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2340/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2341///
2342/// * [list giftcardobject](GiftcardobjectListCall) (response)
2343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2344#[serde_with::serde_as]
2345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2346pub struct GiftCardObjectListResponse {
2347 /// Pagination of the response.
2348 pub pagination: Option<Pagination>,
2349 /// Resources corresponding to the list request.
2350 pub resources: Option<Vec<GiftCardObject>>,
2351}
2352
2353impl common::ResponseResult for GiftCardObjectListResponse {}
2354
2355/// There is no detailed description.
2356///
2357/// This type is not used in any activity, and only used as *part* of another schema.
2358///
2359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2360#[serde_with::serde_as]
2361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2362pub struct GroupingInfo {
2363 /// Optional grouping ID for grouping the passes with the same ID visually together. Grouping with different types of passes is allowed.
2364 #[serde(rename = "groupingId")]
2365 pub grouping_id: Option<String>,
2366 /// 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.
2367 #[serde(rename = "sortIndex")]
2368 pub sort_index: Option<i32>,
2369}
2370
2371impl common::Part for GroupingInfo {}
2372
2373/// Wrapping type for Google hosted images. Next ID: 7
2374///
2375/// This type is not used in any activity, and only used as *part* of another schema.
2376///
2377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2378#[serde_with::serde_as]
2379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2380pub struct Image {
2381 /// Description of the image used for accessibility.
2382 #[serde(rename = "contentDescription")]
2383 pub content_description: Option<LocalizedString>,
2384 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#image"`.
2385 pub kind: Option<String>,
2386 /// The URI for the image.
2387 #[serde(rename = "sourceUri")]
2388 pub source_uri: Option<ImageUri>,
2389}
2390
2391impl common::Part for Image {}
2392
2393/// There is no detailed description.
2394///
2395/// This type is not used in any activity, and only used as *part* of another schema.
2396///
2397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2398#[serde_with::serde_as]
2399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2400pub struct ImageModuleData {
2401 /// The ID associated with an image module. This field is here to enable ease of management of image modules.
2402 pub id: Option<String>,
2403 /// A 100% width image.
2404 #[serde(rename = "mainImage")]
2405 pub main_image: Option<Image>,
2406}
2407
2408impl common::Part for ImageModuleData {}
2409
2410/// There is no detailed description.
2411///
2412/// This type is not used in any activity, and only used as *part* of another schema.
2413///
2414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2415#[serde_with::serde_as]
2416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2417pub struct ImageUri {
2418 /// Additional information about the image, which is unused and retained only for backward compatibility.
2419 pub description: Option<String>,
2420 /// Translated strings for the description, which are unused and retained only for backward compatibility.
2421 #[serde(rename = "localizedDescription")]
2422 pub localized_description: Option<LocalizedString>,
2423 /// The location of the image. URIs must have a scheme.
2424 pub uri: Option<String>,
2425}
2426
2427impl common::Part for ImageUri {}
2428
2429/// There is no detailed description.
2430///
2431/// This type is not used in any activity, and only used as *part* of another schema.
2432///
2433#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2434#[serde_with::serde_as]
2435#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2436pub struct InfoModuleData {
2437 /// A list of collections of labels and values. These will be displayed one after the other in a singular column.
2438 #[serde(rename = "labelValueRows")]
2439 pub label_value_rows: Option<Vec<LabelValueRow>>,
2440 /// no description provided
2441 #[serde(rename = "showLastUpdateTime")]
2442 pub show_last_update_time: Option<bool>,
2443}
2444
2445impl common::Part for InfoModuleData {}
2446
2447/// There is no detailed description.
2448///
2449/// # Activities
2450///
2451/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2452/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2453///
2454/// * [get issuer](IssuerGetCall) (response)
2455/// * [insert issuer](IssuerInsertCall) (request|response)
2456/// * [patch issuer](IssuerPatchCall) (request|response)
2457/// * [update issuer](IssuerUpdateCall) (request|response)
2458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2459#[serde_with::serde_as]
2460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2461pub struct Issuer {
2462 /// Allows the issuer to provide their callback settings.
2463 #[serde(rename = "callbackOptions")]
2464 pub callback_options: Option<CallbackOptions>,
2465 /// Issuer contact information.
2466 #[serde(rename = "contactInfo")]
2467 pub contact_info: Option<IssuerContactInfo>,
2468 /// URL for the issuer's home page.
2469 #[serde(rename = "homepageUrl")]
2470 pub homepage_url: Option<String>,
2471 /// The unique identifier for an issuer account. This is automatically generated when the issuer is inserted.
2472 #[serde(rename = "issuerId")]
2473 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2474 pub issuer_id: Option<i64>,
2475 /// The account name of the issuer.
2476 pub name: Option<String>,
2477 /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
2478 #[serde(rename = "smartTapMerchantData")]
2479 pub smart_tap_merchant_data: Option<SmartTapMerchantData>,
2480}
2481
2482impl common::RequestValue for Issuer {}
2483impl common::ResponseResult for Issuer {}
2484
2485/// There is no detailed description.
2486///
2487/// This type is not used in any activity, and only used as *part* of another schema.
2488///
2489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2490#[serde_with::serde_as]
2491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2492pub struct IssuerContactInfo {
2493 /// Email addresses which will receive alerts.
2494 #[serde(rename = "alertsEmails")]
2495 pub alerts_emails: Option<Vec<String>>,
2496 /// The primary contact email address.
2497 pub email: Option<String>,
2498 /// The primary contact name.
2499 pub name: Option<String>,
2500 /// The primary contact phone number.
2501 pub phone: Option<String>,
2502}
2503
2504impl common::Part for IssuerContactInfo {}
2505
2506/// There is no detailed description.
2507///
2508/// # Activities
2509///
2510/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2511/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2512///
2513/// * [list issuer](IssuerListCall) (response)
2514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2515#[serde_with::serde_as]
2516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2517pub struct IssuerListResponse {
2518 /// Resources corresponding to the list request.
2519 pub resources: Option<Vec<Issuer>>,
2520}
2521
2522impl common::ResponseResult for IssuerListResponse {}
2523
2524/// There is no detailed description.
2525///
2526/// This type is not used in any activity, and only used as *part* of another schema.
2527///
2528#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2529#[serde_with::serde_as]
2530#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2531pub struct IssuerToUserInfo {
2532 /// no description provided
2533 pub action: Option<String>,
2534 /// no description provided
2535 #[serde(rename = "signUpInfo")]
2536 pub sign_up_info: Option<SignUpInfo>,
2537 /// Currently not used, consider deprecating.
2538 pub url: Option<String>,
2539 /// JSON web token for action S2AP.
2540 pub value: Option<String>,
2541}
2542
2543impl common::Part for IssuerToUserInfo {}
2544
2545/// There is no detailed description.
2546///
2547/// # Activities
2548///
2549/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2550/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2551///
2552/// * [insert jwt](JwtInsertCall) (response)
2553#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2554#[serde_with::serde_as]
2555#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2556pub struct JwtInsertResponse {
2557 /// 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).
2558 pub resources: Option<Resources>,
2559 /// A URI that, when opened, will allow the end user to save the object(s) identified in the JWT to their Google account.
2560 #[serde(rename = "saveUri")]
2561 pub save_uri: Option<String>,
2562}
2563
2564impl common::ResponseResult for JwtInsertResponse {}
2565
2566/// There is no detailed description.
2567///
2568/// # Activities
2569///
2570/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2571/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2572///
2573/// * [insert jwt](JwtInsertCall) (request)
2574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2575#[serde_with::serde_as]
2576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2577pub struct JwtResource {
2578 /// A string representing a JWT of the format described at https://developers.google.com/wallet/reference/rest/v1/Jwt
2579 pub jwt: Option<String>,
2580}
2581
2582impl common::RequestValue for JwtResource {}
2583
2584/// 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.
2585///
2586/// This type is not used in any activity, and only used as *part* of another schema.
2587///
2588#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2589#[serde_with::serde_as]
2590#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2591pub struct LabelValue {
2592 /// 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.
2593 pub label: Option<String>,
2594 /// Translated strings for the label. Recommended maximum is 15 characters for a two-column layout and 30 characters for a one-column layout.
2595 #[serde(rename = "localizedLabel")]
2596 pub localized_label: Option<LocalizedString>,
2597 /// Translated strings for the value. Recommended maximum is 15 characters for a two-column layout and 30 characters for a one-column layout.
2598 #[serde(rename = "localizedValue")]
2599 pub localized_value: Option<LocalizedString>,
2600 /// 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.
2601 pub value: Option<String>,
2602}
2603
2604impl common::Part for LabelValue {}
2605
2606/// There is no detailed description.
2607///
2608/// This type is not used in any activity, and only used as *part* of another schema.
2609///
2610#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2611#[serde_with::serde_as]
2612#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2613pub struct LabelValueRow {
2614 /// 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.
2615 pub columns: Option<Vec<LabelValue>>,
2616}
2617
2618impl common::Part for LabelValueRow {}
2619
2620/// There is no detailed description.
2621///
2622/// This type is not used in any activity, and only used as *part* of another schema.
2623///
2624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2625#[serde_with::serde_as]
2626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2627pub struct LatLongPoint {
2628 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#latLongPoint"`.
2629 pub kind: Option<String>,
2630 /// The latitude specified as any value in the range of -90.0 through +90.0, both inclusive. Values outside these bounds will be rejected.
2631 pub latitude: Option<f64>,
2632 /// The longitude specified in the range -180.0 through +180.0, both inclusive. Values outside these bounds will be rejected.
2633 pub longitude: Option<f64>,
2634}
2635
2636impl common::Part for LatLongPoint {}
2637
2638/// There is no detailed description.
2639///
2640/// This type is not used in any activity, and only used as *part* of another schema.
2641///
2642#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2643#[serde_with::serde_as]
2644#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2645pub struct LinksModuleData {
2646 /// The list of URIs.
2647 pub uris: Option<Vec<Uri>>,
2648}
2649
2650impl common::Part for LinksModuleData {}
2651
2652/// There is no detailed description.
2653///
2654/// This type is not used in any activity, and only used as *part* of another schema.
2655///
2656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2657#[serde_with::serde_as]
2658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2659pub struct ListTemplateOverride {
2660 /// 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.
2661 #[serde(rename = "firstRowOption")]
2662 pub first_row_option: Option<FirstRowOption>,
2663 /// 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.
2664 #[serde(rename = "secondRowOption")]
2665 pub second_row_option: Option<FieldSelector>,
2666 /// An unused/deprecated field. Setting it will have no effect on what the user sees.
2667 #[serde(rename = "thirdRowOption")]
2668 pub third_row_option: Option<FieldSelector>,
2669}
2670
2671impl common::Part for ListTemplateOverride {}
2672
2673/// There is no detailed description.
2674///
2675/// This type is not used in any activity, and only used as *part* of another schema.
2676///
2677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2678#[serde_with::serde_as]
2679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2680pub struct LocalizedString {
2681 /// Contains the string to be displayed if no appropriate translation is available.
2682 #[serde(rename = "defaultValue")]
2683 pub default_value: Option<TranslatedString>,
2684 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#localizedString"`.
2685 pub kind: Option<String>,
2686 /// Contains the translations for the string.
2687 #[serde(rename = "translatedValues")]
2688 pub translated_values: Option<Vec<TranslatedString>>,
2689}
2690
2691impl common::Part for LocalizedString {}
2692
2693/// There is no detailed description.
2694///
2695/// # Activities
2696///
2697/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2698/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2699///
2700/// * [get loyaltyclass](LoyaltyclasGetCall) (response)
2701/// * [insert loyaltyclass](LoyaltyclasInsertCall) (request|response)
2702/// * [patch loyaltyclass](LoyaltyclasPatchCall) (request|response)
2703/// * [update loyaltyclass](LoyaltyclasUpdateCall) (request|response)
2704#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2705#[serde_with::serde_as]
2706#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2707pub struct LoyaltyClass {
2708 /// The account ID label, such as "Member ID." Recommended maximum length is 15 characters to ensure full string is displayed on smaller screens.
2709 #[serde(rename = "accountIdLabel")]
2710 pub account_id_label: Option<String>,
2711 /// The account name label, such as "Member Name." Recommended maximum length is 15 characters to ensure full string is displayed on smaller screens.
2712 #[serde(rename = "accountNameLabel")]
2713 pub account_name_label: Option<String>,
2714 /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
2715 #[serde(rename = "allowMultipleUsersPerObject")]
2716 pub allow_multiple_users_per_object: Option<bool>,
2717 /// 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.
2718 #[serde(rename = "appLinkData")]
2719 pub app_link_data: Option<AppLinkData>,
2720 /// 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.
2721 #[serde(rename = "callbackOptions")]
2722 pub callback_options: Option<CallbackOptions>,
2723 /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
2724 #[serde(rename = "classTemplateInfo")]
2725 pub class_template_info: Option<ClassTemplateInfo>,
2726 /// 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.
2727 #[serde(rename = "countryCode")]
2728 pub country_code: Option<String>,
2729 /// Information about how the class may be discovered and instantiated from within the Google Pay app.
2730 #[serde(rename = "discoverableProgram")]
2731 pub discoverable_program: Option<DiscoverableProgram>,
2732 /// 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.
2733 #[serde(rename = "enableSmartTap")]
2734 pub enable_smart_tap: Option<bool>,
2735 /// 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.
2736 #[serde(rename = "heroImage")]
2737 pub hero_image: Option<Image>,
2738 /// 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`.
2739 #[serde(rename = "hexBackgroundColor")]
2740 pub hex_background_color: Option<String>,
2741 /// 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).
2742 #[serde(rename = "homepageUri")]
2743 pub homepage_uri: Option<Uri>,
2744 /// 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 '-'.
2745 pub id: Option<String>,
2746 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
2747 #[serde(rename = "imageModulesData")]
2748 pub image_modules_data: Option<Vec<ImageModuleData>>,
2749 /// Deprecated. Use textModulesData instead.
2750 #[serde(rename = "infoModuleData")]
2751 pub info_module_data: Option<InfoModuleData>,
2752 /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
2753 #[serde(rename = "issuerName")]
2754 pub issuer_name: Option<String>,
2755 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#loyaltyClass"`.
2756 pub kind: Option<String>,
2757 /// Links module data. If links module data is also defined on the object, both will be displayed.
2758 #[serde(rename = "linksModuleData")]
2759 pub links_module_data: Option<LinksModuleData>,
2760 /// Translated strings for the account_id_label. Recommended maximum length is 15 characters to ensure full string is displayed on smaller screens.
2761 #[serde(rename = "localizedAccountIdLabel")]
2762 pub localized_account_id_label: Option<LocalizedString>,
2763 /// Translated strings for the account_name_label. Recommended maximum length is 15 characters to ensure full string is displayed on smaller screens.
2764 #[serde(rename = "localizedAccountNameLabel")]
2765 pub localized_account_name_label: Option<LocalizedString>,
2766 /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
2767 #[serde(rename = "localizedIssuerName")]
2768 pub localized_issuer_name: Option<LocalizedString>,
2769 /// 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.
2770 #[serde(rename = "localizedProgramName")]
2771 pub localized_program_name: Option<LocalizedString>,
2772 /// Translated strings for the rewards_tier. Recommended maximum length is 7 characters to ensure full string is displayed on smaller screens.
2773 #[serde(rename = "localizedRewardsTier")]
2774 pub localized_rewards_tier: Option<LocalizedString>,
2775 /// Translated strings for the rewards_tier_label. Recommended maximum length is 9 characters to ensure full string is displayed on smaller screens.
2776 #[serde(rename = "localizedRewardsTierLabel")]
2777 pub localized_rewards_tier_label: Option<LocalizedString>,
2778 /// Translated strings for the secondary_rewards_tier.
2779 #[serde(rename = "localizedSecondaryRewardsTier")]
2780 pub localized_secondary_rewards_tier: Option<LocalizedString>,
2781 /// Translated strings for the secondary_rewards_tier_label.
2782 #[serde(rename = "localizedSecondaryRewardsTierLabel")]
2783 pub localized_secondary_rewards_tier_label: Option<LocalizedString>,
2784 /// Note: This field is currently not supported to trigger geo notifications.
2785 pub locations: Option<Vec<LatLongPoint>>,
2786 /// 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.
2787 pub messages: Option<Vec<Message>>,
2788 /// Identifies whether multiple users and devices will save the same object referencing this class.
2789 #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
2790 pub multiple_devices_and_holders_allowed_status: Option<String>,
2791 /// Required. The logo of the loyalty program or company. This logo is displayed in both the details and list views of the app.
2792 #[serde(rename = "programLogo")]
2793 pub program_logo: Option<Image>,
2794 /// 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.
2795 #[serde(rename = "programName")]
2796 pub program_name: Option<String>,
2797 /// 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.
2798 #[serde(rename = "redemptionIssuers")]
2799 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2800 pub redemption_issuers: Option<Vec<i64>>,
2801 /// The review comments set by the platform when a class is marked `approved` or `rejected`.
2802 pub review: Option<Review>,
2803 /// 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`.
2804 #[serde(rename = "reviewStatus")]
2805 pub review_status: Option<String>,
2806 /// The rewards tier, such as "Gold" or "Platinum." Recommended maximum length is 7 characters to ensure full string is displayed on smaller screens.
2807 #[serde(rename = "rewardsTier")]
2808 pub rewards_tier: Option<String>,
2809 /// The rewards tier label, such as "Rewards Tier." Recommended maximum length is 9 characters to ensure full string is displayed on smaller screens.
2810 #[serde(rename = "rewardsTierLabel")]
2811 pub rewards_tier_label: Option<String>,
2812 /// The secondary rewards tier, such as "Gold" or "Platinum."
2813 #[serde(rename = "secondaryRewardsTier")]
2814 pub secondary_rewards_tier: Option<String>,
2815 /// The secondary rewards tier label, such as "Rewards Tier."
2816 #[serde(rename = "secondaryRewardsTierLabel")]
2817 pub secondary_rewards_tier_label: Option<String>,
2818 /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
2819 #[serde(rename = "securityAnimation")]
2820 pub security_animation: Option<SecurityAnimation>,
2821 /// 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.
2822 #[serde(rename = "textModulesData")]
2823 pub text_modules_data: Option<Vec<TextModuleData>>,
2824 /// Deprecated
2825 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2826 pub version: Option<i64>,
2827 /// View Unlock Requirement options for the loyalty card.
2828 #[serde(rename = "viewUnlockRequirement")]
2829 pub view_unlock_requirement: Option<String>,
2830 /// 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.
2831 #[serde(rename = "wideProgramLogo")]
2832 pub wide_program_logo: Option<Image>,
2833 /// Deprecated.
2834 #[serde(rename = "wordMark")]
2835 pub word_mark: Option<Image>,
2836}
2837
2838impl common::RequestValue for LoyaltyClass {}
2839impl common::ResponseResult for LoyaltyClass {}
2840
2841/// There is no detailed description.
2842///
2843/// # Activities
2844///
2845/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2846/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2847///
2848/// * [addmessage loyaltyclass](LoyaltyclasAddmessageCall) (response)
2849#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2850#[serde_with::serde_as]
2851#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2852pub struct LoyaltyClassAddMessageResponse {
2853 /// The updated LoyaltyClass resource.
2854 pub resource: Option<LoyaltyClass>,
2855}
2856
2857impl common::ResponseResult for LoyaltyClassAddMessageResponse {}
2858
2859/// There is no detailed description.
2860///
2861/// # Activities
2862///
2863/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2864/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2865///
2866/// * [list loyaltyclass](LoyaltyclasListCall) (response)
2867#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2868#[serde_with::serde_as]
2869#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2870pub struct LoyaltyClassListResponse {
2871 /// Pagination of the response.
2872 pub pagination: Option<Pagination>,
2873 /// Resources corresponding to the list request.
2874 pub resources: Option<Vec<LoyaltyClass>>,
2875}
2876
2877impl common::ResponseResult for LoyaltyClassListResponse {}
2878
2879/// There is no detailed description.
2880///
2881/// # Activities
2882///
2883/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2884/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2885///
2886/// * [get loyaltyobject](LoyaltyobjectGetCall) (response)
2887/// * [insert loyaltyobject](LoyaltyobjectInsertCall) (request|response)
2888/// * [modifylinkedofferobjects loyaltyobject](LoyaltyobjectModifylinkedofferobjectCall) (response)
2889/// * [patch loyaltyobject](LoyaltyobjectPatchCall) (request|response)
2890/// * [update loyaltyobject](LoyaltyobjectUpdateCall) (request|response)
2891#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2892#[serde_with::serde_as]
2893#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2894pub struct LoyaltyObject {
2895 /// The loyalty account identifier. Recommended maximum length is 20 characters.
2896 #[serde(rename = "accountId")]
2897 pub account_id: Option<String>,
2898 /// The loyalty account holder name, such as "John Smith." Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
2899 #[serde(rename = "accountName")]
2900 pub account_name: Option<String>,
2901 /// 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.
2902 #[serde(rename = "appLinkData")]
2903 pub app_link_data: Option<AppLinkData>,
2904 /// The barcode type and value.
2905 pub barcode: Option<Barcode>,
2906 /// 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.
2907 #[serde(rename = "classId")]
2908 pub class_id: Option<String>,
2909 /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
2910 #[serde(rename = "classReference")]
2911 pub class_reference: Option<LoyaltyClass>,
2912 /// 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.
2913 #[serde(rename = "disableExpirationNotification")]
2914 pub disable_expiration_notification: Option<bool>,
2915 /// Information that controls how passes are grouped together.
2916 #[serde(rename = "groupingInfo")]
2917 pub grouping_info: Option<GroupingInfo>,
2918 /// 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.
2919 #[serde(rename = "hasLinkedDevice")]
2920 pub has_linked_device: Option<bool>,
2921 /// Indicates if the object has users. This field is set by the platform.
2922 #[serde(rename = "hasUsers")]
2923 pub has_users: Option<bool>,
2924 /// 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.
2925 #[serde(rename = "heroImage")]
2926 pub hero_image: Option<Image>,
2927 /// 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 '-'.
2928 pub id: Option<String>,
2929 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
2930 #[serde(rename = "imageModulesData")]
2931 pub image_modules_data: Option<Vec<ImageModuleData>>,
2932 /// Deprecated. Use textModulesData instead.
2933 #[serde(rename = "infoModuleData")]
2934 pub info_module_data: Option<InfoModuleData>,
2935 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#loyaltyObject"`.
2936 pub kind: Option<String>,
2937 /// 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.
2938 #[serde(rename = "linkedOfferIds")]
2939 pub linked_offer_ids: Option<Vec<String>>,
2940 /// Links module data. If links module data is also defined on the class, both will be displayed.
2941 #[serde(rename = "linksModuleData")]
2942 pub links_module_data: Option<LinksModuleData>,
2943 /// Note: This field is currently not supported to trigger geo notifications.
2944 pub locations: Option<Vec<LatLongPoint>>,
2945 /// The loyalty reward points label, balance, and type.
2946 #[serde(rename = "loyaltyPoints")]
2947 pub loyalty_points: Option<LoyaltyPoints>,
2948 /// 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.
2949 pub messages: Option<Vec<Message>>,
2950 /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
2951 #[serde(rename = "passConstraints")]
2952 pub pass_constraints: Option<PassConstraints>,
2953 /// The rotating barcode type and value.
2954 #[serde(rename = "rotatingBarcode")]
2955 pub rotating_barcode: Option<RotatingBarcode>,
2956 /// The secondary loyalty reward points label, balance, and type. Shown in addition to the primary loyalty points.
2957 #[serde(rename = "secondaryLoyaltyPoints")]
2958 pub secondary_loyalty_points: Option<LoyaltyPoints>,
2959 /// 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.
2960 #[serde(rename = "smartTapRedemptionValue")]
2961 pub smart_tap_redemption_value: Option<String>,
2962 /// 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.
2963 pub state: Option<String>,
2964 /// 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.
2965 #[serde(rename = "textModulesData")]
2966 pub text_modules_data: Option<Vec<TextModuleData>>,
2967 /// 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.
2968 #[serde(rename = "validTimeInterval")]
2969 pub valid_time_interval: Option<TimeInterval>,
2970 /// Deprecated
2971 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2972 pub version: Option<i64>,
2973}
2974
2975impl common::RequestValue for LoyaltyObject {}
2976impl common::ResponseResult for LoyaltyObject {}
2977
2978/// There is no detailed description.
2979///
2980/// # Activities
2981///
2982/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2983/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2984///
2985/// * [addmessage loyaltyobject](LoyaltyobjectAddmessageCall) (response)
2986#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2987#[serde_with::serde_as]
2988#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2989pub struct LoyaltyObjectAddMessageResponse {
2990 /// The updated LoyaltyObject resource.
2991 pub resource: Option<LoyaltyObject>,
2992}
2993
2994impl common::ResponseResult for LoyaltyObjectAddMessageResponse {}
2995
2996/// There is no detailed description.
2997///
2998/// # Activities
2999///
3000/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3001/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3002///
3003/// * [list loyaltyobject](LoyaltyobjectListCall) (response)
3004#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3005#[serde_with::serde_as]
3006#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3007pub struct LoyaltyObjectListResponse {
3008 /// Pagination of the response.
3009 pub pagination: Option<Pagination>,
3010 /// Resources corresponding to the list request.
3011 pub resources: Option<Vec<LoyaltyObject>>,
3012}
3013
3014impl common::ResponseResult for LoyaltyObjectListResponse {}
3015
3016/// There is no detailed description.
3017///
3018/// This type is not used in any activity, and only used as *part* of another schema.
3019///
3020#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3021#[serde_with::serde_as]
3022#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3023pub struct LoyaltyPoints {
3024 /// 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`.
3025 pub balance: Option<LoyaltyPointsBalance>,
3026 /// The loyalty points label, such as "Points". Recommended maximum length is 9 characters.
3027 pub label: Option<String>,
3028 /// Translated strings for the label. Recommended maximum length is 9 characters.
3029 #[serde(rename = "localizedLabel")]
3030 pub localized_label: Option<LocalizedString>,
3031}
3032
3033impl common::Part for LoyaltyPoints {}
3034
3035/// There is no detailed description.
3036///
3037/// This type is not used in any activity, and only used as *part* of another schema.
3038///
3039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3040#[serde_with::serde_as]
3041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3042pub struct LoyaltyPointsBalance {
3043 /// The double form of a balance. Only one of these subtypes (string, int, double, money) should be populated.
3044 pub double: Option<f64>,
3045 /// The integer form of a balance. Only one of these subtypes (string, int, double, money) should be populated.
3046 pub int: Option<i32>,
3047 /// The money form of a balance. Only one of these subtypes (string, int, double, money) should be populated.
3048 pub money: Option<Money>,
3049 /// The string form of a balance. Only one of these subtypes (string, int, double, money) should be populated.
3050 pub string: Option<String>,
3051}
3052
3053impl common::Part for LoyaltyPointsBalance {}
3054
3055/// A reference to data stored on the filesystem, on GFS or in blobstore.
3056///
3057/// # Activities
3058///
3059/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3060/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3061///
3062/// * [download media](MediaDownloadCall) (response)
3063#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3064#[serde_with::serde_as]
3065#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3066pub struct Media {
3067 /// 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.
3068 pub algorithm: Option<String>,
3069 /// Use object_id instead.
3070 #[serde(rename = "bigstoreObjectRef")]
3071 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3072 pub bigstore_object_ref: Option<Vec<u8>>,
3073 /// 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.
3074 #[serde(rename = "blobRef")]
3075 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3076 pub blob_ref: Option<Vec<u8>>,
3077 /// Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers to a v2 blob.
3078 #[serde(rename = "blobstore2Info")]
3079 pub blobstore2_info: Option<Blobstore2Info>,
3080 /// 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.
3081 #[serde(rename = "compositeMedia")]
3082 pub composite_media: Option<Vec<CompositeMedia>>,
3083 /// MIME type of the data
3084 #[serde(rename = "contentType")]
3085 pub content_type: Option<String>,
3086 /// Extended content type information provided for Scotty uploads.
3087 #[serde(rename = "contentTypeInfo")]
3088 pub content_type_info: Option<ContentTypeInfo>,
3089 /// 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.
3090 #[serde(rename = "cosmoBinaryReference")]
3091 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3092 pub cosmo_binary_reference: Option<Vec<u8>>,
3093 /// 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.
3094 #[serde(rename = "crc32cHash")]
3095 pub crc32c_hash: Option<u32>,
3096 /// Set if reference_type is DIFF_CHECKSUMS_RESPONSE.
3097 #[serde(rename = "diffChecksumsResponse")]
3098 pub diff_checksums_response: Option<DiffChecksumsResponse>,
3099 /// Set if reference_type is DIFF_DOWNLOAD_RESPONSE.
3100 #[serde(rename = "diffDownloadResponse")]
3101 pub diff_download_response: Option<DiffDownloadResponse>,
3102 /// Set if reference_type is DIFF_UPLOAD_REQUEST.
3103 #[serde(rename = "diffUploadRequest")]
3104 pub diff_upload_request: Option<DiffUploadRequest>,
3105 /// Set if reference_type is DIFF_UPLOAD_RESPONSE.
3106 #[serde(rename = "diffUploadResponse")]
3107 pub diff_upload_response: Option<DiffUploadResponse>,
3108 /// Set if reference_type is DIFF_VERSION_RESPONSE.
3109 #[serde(rename = "diffVersionResponse")]
3110 pub diff_version_response: Option<DiffVersionResponse>,
3111 /// Parameters for a media download.
3112 #[serde(rename = "downloadParameters")]
3113 pub download_parameters: Option<DownloadParameters>,
3114 /// Original file name
3115 pub filename: Option<String>,
3116 /// 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.
3117 pub hash: Option<String>,
3118 /// 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.
3119 #[serde(rename = "hashVerified")]
3120 pub hash_verified: Option<bool>,
3121 /// Media data, set if reference_type is INLINE
3122 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3123 pub inline: Option<Vec<u8>>,
3124 /// |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.
3125 #[serde(rename = "isPotentialRetry")]
3126 pub is_potential_retry: Option<bool>,
3127 /// Size of the data, in bytes
3128 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3129 pub length: Option<i64>,
3130 /// Scotty-provided MD5 hash for an upload.
3131 #[serde(rename = "md5Hash")]
3132 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3133 pub md5_hash: Option<Vec<u8>>,
3134 /// Media id to forward to the operation GetMedia. Can be set if reference_type is GET_MEDIA.
3135 #[serde(rename = "mediaId")]
3136 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3137 pub media_id: Option<Vec<u8>>,
3138 /// Reference to a TI Blob, set if reference_type is BIGSTORE_REF.
3139 #[serde(rename = "objectId")]
3140 pub object_id: Option<ObjectId>,
3141 /// Path to the data, set if reference_type is PATH
3142 pub path: Option<String>,
3143 /// Describes what the field reference contains.
3144 #[serde(rename = "referenceType")]
3145 pub reference_type: Option<String>,
3146 /// Scotty-provided SHA1 hash for an upload.
3147 #[serde(rename = "sha1Hash")]
3148 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3149 pub sha1_hash: Option<Vec<u8>>,
3150 /// Scotty-provided SHA256 hash for an upload.
3151 #[serde(rename = "sha256Hash")]
3152 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3153 pub sha256_hash: Option<Vec<u8>>,
3154 /// Time at which the media data was last updated, in milliseconds since UNIX epoch
3155 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3156 pub timestamp: Option<u64>,
3157 /// A unique fingerprint/version id for the media data
3158 pub token: Option<String>,
3159}
3160
3161impl common::ResponseResult for Media {}
3162
3163/// Extra information added to operations that support Scotty media requests.
3164///
3165/// This type is not used in any activity, and only used as *part* of another schema.
3166///
3167#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3168#[serde_with::serde_as]
3169#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3170pub struct MediaRequestInfo {
3171 /// The number of current bytes uploaded or downloaded.
3172 #[serde(rename = "currentBytes")]
3173 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3174 pub current_bytes: Option<i64>,
3175 /// 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.
3176 #[serde(rename = "customData")]
3177 pub custom_data: Option<String>,
3178 /// 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.
3179 #[serde(rename = "diffObjectVersion")]
3180 pub diff_object_version: Option<String>,
3181 /// 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
3182 #[serde(rename = "finalStatus")]
3183 pub final_status: Option<i32>,
3184 /// The type of notification received from Scotty.
3185 #[serde(rename = "notificationType")]
3186 pub notification_type: Option<String>,
3187 /// The Scotty request ID.
3188 #[serde(rename = "requestId")]
3189 pub request_id: Option<String>,
3190 /// The partition of the Scotty server handling this request. type is uploader_service.RequestReceivedParamsServingInfo LINT.IfChange(request_received_params_serving_info_annotations) LINT.ThenChange()
3191 #[serde(rename = "requestReceivedParamsServingInfo")]
3192 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3193 pub request_received_params_serving_info: Option<Vec<u8>>,
3194 /// The total size of the file.
3195 #[serde(rename = "totalBytes")]
3196 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3197 pub total_bytes: Option<i64>,
3198 /// Whether the total bytes field contains an estimated data.
3199 #[serde(rename = "totalBytesIsEstimated")]
3200 pub total_bytes_is_estimated: Option<bool>,
3201}
3202
3203impl common::Part for MediaRequestInfo {}
3204
3205/// A message that will be displayed with a Valuable
3206///
3207/// This type is not used in any activity, and only used as *part* of another schema.
3208///
3209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3210#[serde_with::serde_as]
3211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3212pub struct Message {
3213 /// The message body.
3214 pub body: Option<String>,
3215 /// 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.
3216 #[serde(rename = "displayInterval")]
3217 pub display_interval: Option<TimeInterval>,
3218 /// The message header.
3219 pub header: Option<String>,
3220 /// 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.
3221 pub id: Option<String>,
3222 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#walletObjectMessage"`.
3223 pub kind: Option<String>,
3224 /// Translated strings for the message body.
3225 #[serde(rename = "localizedBody")]
3226 pub localized_body: Option<LocalizedString>,
3227 /// Translated strings for the message header.
3228 #[serde(rename = "localizedHeader")]
3229 pub localized_header: Option<LocalizedString>,
3230 /// The message type.
3231 #[serde(rename = "messageType")]
3232 pub message_type: Option<String>,
3233}
3234
3235impl common::Part for Message {}
3236
3237/// There is no detailed description.
3238///
3239/// This type is not used in any activity, and only used as *part* of another schema.
3240///
3241#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3242#[serde_with::serde_as]
3243#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3244pub struct ModifyLinkedOfferObjects {
3245 /// The linked offer object ids to add to the object.
3246 #[serde(rename = "addLinkedOfferObjectIds")]
3247 pub add_linked_offer_object_ids: Option<Vec<String>>,
3248 /// The linked offer object ids to remove from the object.
3249 #[serde(rename = "removeLinkedOfferObjectIds")]
3250 pub remove_linked_offer_object_ids: Option<Vec<String>>,
3251}
3252
3253impl common::Part for ModifyLinkedOfferObjects {}
3254
3255/// There is no detailed description.
3256///
3257/// # Activities
3258///
3259/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3260/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3261///
3262/// * [modifylinkedofferobjects eventticketobject](EventticketobjectModifylinkedofferobjectCall) (request)
3263/// * [modifylinkedofferobjects loyaltyobject](LoyaltyobjectModifylinkedofferobjectCall) (request)
3264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3265#[serde_with::serde_as]
3266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3267pub struct ModifyLinkedOfferObjectsRequest {
3268 /// The linked offer object ids to add or remove from the object.
3269 #[serde(rename = "linkedOfferObjectIds")]
3270 pub linked_offer_object_ids: Option<ModifyLinkedOfferObjects>,
3271}
3272
3273impl common::RequestValue for ModifyLinkedOfferObjectsRequest {}
3274
3275/// There is no detailed description.
3276///
3277/// This type is not used in any activity, and only used as *part* of another schema.
3278///
3279#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3280#[serde_with::serde_as]
3281#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3282pub struct Money {
3283 /// The currency code, such as "USD" or "EUR."
3284 #[serde(rename = "currencyCode")]
3285 pub currency_code: Option<String>,
3286 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#money"`.
3287 pub kind: Option<String>,
3288 /// The unit of money amount in micros. For example, $1 USD would be represented as 1000000 micros.
3289 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3290 pub micros: Option<i64>,
3291}
3292
3293impl common::Part for Money {}
3294
3295/// 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.
3296///
3297/// This type is not used in any activity, and only used as *part* of another schema.
3298///
3299#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3300#[serde_with::serde_as]
3301#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3302pub struct Notifications {
3303 /// A notification would be triggered at a specific time before the card expires.
3304 #[serde(rename = "expiryNotification")]
3305 pub expiry_notification: Option<ExpiryNotification>,
3306 /// A notification would be triggered at a specific time before the card becomes usable.
3307 #[serde(rename = "upcomingNotification")]
3308 pub upcoming_notification: Option<UpcomingNotification>,
3309}
3310
3311impl common::Part for Notifications {}
3312
3313/// 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.
3314///
3315/// This type is not used in any activity, and only used as *part* of another schema.
3316///
3317#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3318#[serde_with::serde_as]
3319#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3320pub struct ObjectId {
3321 /// The name of the bucket to which this object belongs.
3322 #[serde(rename = "bucketName")]
3323 pub bucket_name: Option<String>,
3324 /// 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
3325 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3326 pub generation: Option<i64>,
3327 /// The name of the object.
3328 #[serde(rename = "objectName")]
3329 pub object_name: Option<String>,
3330}
3331
3332impl common::Part for ObjectId {}
3333
3334/// There is no detailed description.
3335///
3336/// # Activities
3337///
3338/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3339/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3340///
3341/// * [get offerclass](OfferclasGetCall) (response)
3342/// * [insert offerclass](OfferclasInsertCall) (request|response)
3343/// * [patch offerclass](OfferclasPatchCall) (request|response)
3344/// * [update offerclass](OfferclasUpdateCall) (request|response)
3345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3346#[serde_with::serde_as]
3347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3348pub struct OfferClass {
3349 /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
3350 #[serde(rename = "allowMultipleUsersPerObject")]
3351 pub allow_multiple_users_per_object: Option<bool>,
3352 /// 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.
3353 #[serde(rename = "appLinkData")]
3354 pub app_link_data: Option<AppLinkData>,
3355 /// 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.
3356 #[serde(rename = "callbackOptions")]
3357 pub callback_options: Option<CallbackOptions>,
3358 /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
3359 #[serde(rename = "classTemplateInfo")]
3360 pub class_template_info: Option<ClassTemplateInfo>,
3361 /// 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.
3362 #[serde(rename = "countryCode")]
3363 pub country_code: Option<String>,
3364 /// The details of the offer.
3365 pub details: Option<String>,
3366 /// 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.
3367 #[serde(rename = "enableSmartTap")]
3368 pub enable_smart_tap: Option<bool>,
3369 /// The fine print or terms of the offer, such as "20% off any t-shirt at Adam's Apparel."
3370 #[serde(rename = "finePrint")]
3371 pub fine_print: Option<String>,
3372 /// The help link for the offer, such as `http://myownpersonaldomain.com/help`
3373 #[serde(rename = "helpUri")]
3374 pub help_uri: Option<Uri>,
3375 /// 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.
3376 #[serde(rename = "heroImage")]
3377 pub hero_image: Option<Image>,
3378 /// 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`.
3379 #[serde(rename = "hexBackgroundColor")]
3380 pub hex_background_color: Option<String>,
3381 /// 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).
3382 #[serde(rename = "homepageUri")]
3383 pub homepage_uri: Option<Uri>,
3384 /// 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 '-'.
3385 pub id: Option<String>,
3386 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
3387 #[serde(rename = "imageModulesData")]
3388 pub image_modules_data: Option<Vec<ImageModuleData>>,
3389 /// Deprecated. Use textModulesData instead.
3390 #[serde(rename = "infoModuleData")]
3391 pub info_module_data: Option<InfoModuleData>,
3392 /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
3393 #[serde(rename = "issuerName")]
3394 pub issuer_name: Option<String>,
3395 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#offerClass"`.
3396 pub kind: Option<String>,
3397 /// Links module data. If links module data is also defined on the object, both will be displayed.
3398 #[serde(rename = "linksModuleData")]
3399 pub links_module_data: Option<LinksModuleData>,
3400 /// Translated strings for the details.
3401 #[serde(rename = "localizedDetails")]
3402 pub localized_details: Option<LocalizedString>,
3403 /// Translated strings for the fine_print.
3404 #[serde(rename = "localizedFinePrint")]
3405 pub localized_fine_print: Option<LocalizedString>,
3406 /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
3407 #[serde(rename = "localizedIssuerName")]
3408 pub localized_issuer_name: Option<LocalizedString>,
3409 /// Translated strings for the provider. Recommended maximum length is 12 characters to ensure full string is displayed on smaller screens.
3410 #[serde(rename = "localizedProvider")]
3411 pub localized_provider: Option<LocalizedString>,
3412 /// Translated strings for the short title. Recommended maximum length is 20 characters.
3413 #[serde(rename = "localizedShortTitle")]
3414 pub localized_short_title: Option<LocalizedString>,
3415 /// Translated strings for the title. Recommended maximum length is 60 characters to ensure full string is displayed on smaller screens.
3416 #[serde(rename = "localizedTitle")]
3417 pub localized_title: Option<LocalizedString>,
3418 /// Note: This field is currently not supported to trigger geo notifications.
3419 pub locations: Option<Vec<LatLongPoint>>,
3420 /// 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.
3421 pub messages: Option<Vec<Message>>,
3422 /// Identifies whether multiple users and devices will save the same object referencing this class.
3423 #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
3424 pub multiple_devices_and_holders_allowed_status: Option<String>,
3425 /// 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.
3426 pub provider: Option<String>,
3427 /// Required. The redemption channels applicable to this offer.
3428 #[serde(rename = "redemptionChannel")]
3429 pub redemption_channel: Option<String>,
3430 /// 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.
3431 #[serde(rename = "redemptionIssuers")]
3432 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3433 pub redemption_issuers: Option<Vec<i64>>,
3434 /// The review comments set by the platform when a class is marked `approved` or `rejected`.
3435 pub review: Option<Review>,
3436 /// 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`.
3437 #[serde(rename = "reviewStatus")]
3438 pub review_status: Option<String>,
3439 /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
3440 #[serde(rename = "securityAnimation")]
3441 pub security_animation: Option<SecurityAnimation>,
3442 /// 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.
3443 #[serde(rename = "shortTitle")]
3444 pub short_title: Option<String>,
3445 /// 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.
3446 #[serde(rename = "textModulesData")]
3447 pub text_modules_data: Option<Vec<TextModuleData>>,
3448 /// 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.
3449 pub title: Option<String>,
3450 /// The title image of the offer. This image is displayed in both the details and list views of the app.
3451 #[serde(rename = "titleImage")]
3452 pub title_image: Option<Image>,
3453 /// Deprecated
3454 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3455 pub version: Option<i64>,
3456 /// View Unlock Requirement options for the offer.
3457 #[serde(rename = "viewUnlockRequirement")]
3458 pub view_unlock_requirement: Option<String>,
3459 /// 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.
3460 #[serde(rename = "wideTitleImage")]
3461 pub wide_title_image: Option<Image>,
3462 /// Deprecated.
3463 #[serde(rename = "wordMark")]
3464 pub word_mark: Option<Image>,
3465}
3466
3467impl common::RequestValue for OfferClass {}
3468impl common::ResponseResult for OfferClass {}
3469
3470/// There is no detailed description.
3471///
3472/// # Activities
3473///
3474/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3475/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3476///
3477/// * [addmessage offerclass](OfferclasAddmessageCall) (response)
3478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3479#[serde_with::serde_as]
3480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3481pub struct OfferClassAddMessageResponse {
3482 /// The updated OfferClass resource.
3483 pub resource: Option<OfferClass>,
3484}
3485
3486impl common::ResponseResult for OfferClassAddMessageResponse {}
3487
3488/// There is no detailed description.
3489///
3490/// # Activities
3491///
3492/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3493/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3494///
3495/// * [list offerclass](OfferclasListCall) (response)
3496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3497#[serde_with::serde_as]
3498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3499pub struct OfferClassListResponse {
3500 /// Pagination of the response.
3501 pub pagination: Option<Pagination>,
3502 /// Resources corresponding to the list request.
3503 pub resources: Option<Vec<OfferClass>>,
3504}
3505
3506impl common::ResponseResult for OfferClassListResponse {}
3507
3508/// There is no detailed description.
3509///
3510/// # Activities
3511///
3512/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3513/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3514///
3515/// * [get offerobject](OfferobjectGetCall) (response)
3516/// * [insert offerobject](OfferobjectInsertCall) (request|response)
3517/// * [patch offerobject](OfferobjectPatchCall) (request|response)
3518/// * [update offerobject](OfferobjectUpdateCall) (request|response)
3519#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3520#[serde_with::serde_as]
3521#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3522pub struct OfferObject {
3523 /// 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.
3524 #[serde(rename = "appLinkData")]
3525 pub app_link_data: Option<AppLinkData>,
3526 /// The barcode type and value.
3527 pub barcode: Option<Barcode>,
3528 /// 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.
3529 #[serde(rename = "classId")]
3530 pub class_id: Option<String>,
3531 /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
3532 #[serde(rename = "classReference")]
3533 pub class_reference: Option<OfferClass>,
3534 /// 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.
3535 #[serde(rename = "disableExpirationNotification")]
3536 pub disable_expiration_notification: Option<bool>,
3537 /// Information that controls how passes are grouped together.
3538 #[serde(rename = "groupingInfo")]
3539 pub grouping_info: Option<GroupingInfo>,
3540 /// 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.
3541 #[serde(rename = "hasLinkedDevice")]
3542 pub has_linked_device: Option<bool>,
3543 /// Indicates if the object has users. This field is set by the platform.
3544 #[serde(rename = "hasUsers")]
3545 pub has_users: Option<bool>,
3546 /// 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.
3547 #[serde(rename = "heroImage")]
3548 pub hero_image: Option<Image>,
3549 /// 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 '-'.
3550 pub id: Option<String>,
3551 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
3552 #[serde(rename = "imageModulesData")]
3553 pub image_modules_data: Option<Vec<ImageModuleData>>,
3554 /// Deprecated. Use textModulesData instead.
3555 #[serde(rename = "infoModuleData")]
3556 pub info_module_data: Option<InfoModuleData>,
3557 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#offerObject"`.
3558 pub kind: Option<String>,
3559 /// Links module data. If links module data is also defined on the class, both will be displayed.
3560 #[serde(rename = "linksModuleData")]
3561 pub links_module_data: Option<LinksModuleData>,
3562 /// Note: This field is currently not supported to trigger geo notifications.
3563 pub locations: Option<Vec<LatLongPoint>>,
3564 /// 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.
3565 pub messages: Option<Vec<Message>>,
3566 /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
3567 #[serde(rename = "passConstraints")]
3568 pub pass_constraints: Option<PassConstraints>,
3569 /// The rotating barcode type and value.
3570 #[serde(rename = "rotatingBarcode")]
3571 pub rotating_barcode: Option<RotatingBarcode>,
3572 /// 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.
3573 #[serde(rename = "smartTapRedemptionValue")]
3574 pub smart_tap_redemption_value: Option<String>,
3575 /// 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.
3576 pub state: Option<String>,
3577 /// 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.
3578 #[serde(rename = "textModulesData")]
3579 pub text_modules_data: Option<Vec<TextModuleData>>,
3580 /// 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.
3581 #[serde(rename = "validTimeInterval")]
3582 pub valid_time_interval: Option<TimeInterval>,
3583 /// Deprecated
3584 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3585 pub version: Option<i64>,
3586}
3587
3588impl common::RequestValue for OfferObject {}
3589impl common::ResponseResult for OfferObject {}
3590
3591/// There is no detailed description.
3592///
3593/// # Activities
3594///
3595/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3596/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3597///
3598/// * [addmessage offerobject](OfferobjectAddmessageCall) (response)
3599#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3600#[serde_with::serde_as]
3601#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3602pub struct OfferObjectAddMessageResponse {
3603 /// The updated OfferObject resource.
3604 pub resource: Option<OfferObject>,
3605}
3606
3607impl common::ResponseResult for OfferObjectAddMessageResponse {}
3608
3609/// There is no detailed description.
3610///
3611/// # Activities
3612///
3613/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3614/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3615///
3616/// * [list offerobject](OfferobjectListCall) (response)
3617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3618#[serde_with::serde_as]
3619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3620pub struct OfferObjectListResponse {
3621 /// Pagination of the response.
3622 pub pagination: Option<Pagination>,
3623 /// Resources corresponding to the list request.
3624 pub resources: Option<Vec<OfferObject>>,
3625}
3626
3627impl common::ResponseResult for OfferObjectListResponse {}
3628
3629/// There is no detailed description.
3630///
3631/// This type is not used in any activity, and only used as *part* of another schema.
3632///
3633#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3634#[serde_with::serde_as]
3635#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3636pub struct Pagination {
3637 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#pagination"`.
3638 pub kind: Option<String>,
3639 /// Page token to send to fetch the next page.
3640 #[serde(rename = "nextPageToken")]
3641 pub next_page_token: Option<String>,
3642 /// Number of results returned in this page.
3643 #[serde(rename = "resultsPerPage")]
3644 pub results_per_page: Option<i32>,
3645}
3646
3647impl common::Part for Pagination {}
3648
3649/// Container for any constraints that may be placed on passes.
3650///
3651/// This type is not used in any activity, and only used as *part* of another schema.
3652///
3653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3654#[serde_with::serde_as]
3655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3656pub struct PassConstraints {
3657 /// The NFC constraints for the pass.
3658 #[serde(rename = "nfcConstraint")]
3659 pub nfc_constraint: Option<Vec<String>>,
3660 /// The screenshot eligibility for the pass.
3661 #[serde(rename = "screenshotEligibility")]
3662 pub screenshot_eligibility: Option<String>,
3663}
3664
3665impl common::Part for PassConstraints {}
3666
3667/// There is no detailed description.
3668///
3669/// # Activities
3670///
3671/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3672/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3673///
3674/// * [get permissions](PermissionGetCall) (none)
3675/// * [update permissions](PermissionUpdateCall) (none)
3676#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3677#[serde_with::serde_as]
3678#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3679pub struct Permission {
3680 /// The email address of the user, group, or service account to which this permission refers to.
3681 #[serde(rename = "emailAddress")]
3682 pub email_address: Option<String>,
3683 /// The role granted by this permission.
3684 pub role: Option<String>,
3685}
3686
3687impl common::Resource for Permission {}
3688
3689/// There is no detailed description.
3690///
3691/// # Activities
3692///
3693/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3694/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3695///
3696/// * [get permissions](PermissionGetCall) (response)
3697/// * [update permissions](PermissionUpdateCall) (request|response)
3698#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3699#[serde_with::serde_as]
3700#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3701pub struct Permissions {
3702 /// ID of the issuer the list of permissions refer to.
3703 #[serde(rename = "issuerId")]
3704 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3705 pub issuer_id: Option<i64>,
3706 /// The complete list of permissions for the issuer account.
3707 pub permissions: Option<Vec<Permission>>,
3708}
3709
3710impl common::RequestValue for Permissions {}
3711impl common::ResponseResult for Permissions {}
3712
3713/// There is no detailed description.
3714///
3715/// This type is not used in any activity, and only used as *part* of another schema.
3716///
3717#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3718#[serde_with::serde_as]
3719#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3720pub struct PurchaseDetails {
3721 /// ID of the account used to purchase the ticket.
3722 #[serde(rename = "accountId")]
3723 pub account_id: Option<String>,
3724 /// The confirmation code for the purchase. This may be the same for multiple different tickets and is used to group tickets together.
3725 #[serde(rename = "confirmationCode")]
3726 pub confirmation_code: Option<String>,
3727 /// 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.
3728 #[serde(rename = "purchaseDateTime")]
3729 pub purchase_date_time: Option<String>,
3730 /// Receipt number/identifier for tracking the ticket purchase via the body that sold the ticket.
3731 #[serde(rename = "purchaseReceiptNumber")]
3732 pub purchase_receipt_number: Option<String>,
3733 /// The cost of the ticket.
3734 #[serde(rename = "ticketCost")]
3735 pub ticket_cost: Option<TicketCost>,
3736}
3737
3738impl common::Part for PurchaseDetails {}
3739
3740/// There is no detailed description.
3741///
3742/// This type is not used in any activity, and only used as *part* of another schema.
3743///
3744#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3745#[serde_with::serde_as]
3746#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3747pub struct ReservationInfo {
3748 /// 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.
3749 #[serde(rename = "confirmationCode")]
3750 pub confirmation_code: Option<String>,
3751 /// E-ticket number.
3752 #[serde(rename = "eticketNumber")]
3753 pub eticket_number: Option<String>,
3754 /// Frequent flyer membership information.
3755 #[serde(rename = "frequentFlyerInfo")]
3756 pub frequent_flyer_info: Option<FrequentFlyerInfo>,
3757 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#reservationInfo"`.
3758 pub kind: Option<String>,
3759}
3760
3761impl common::Part for ReservationInfo {}
3762
3763/// There is no detailed description.
3764///
3765/// This type is not used in any activity, and only used as *part* of another schema.
3766///
3767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3768#[serde_with::serde_as]
3769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3770pub struct Resources {
3771 /// A list of event ticket classes.
3772 #[serde(rename = "eventTicketClasses")]
3773 pub event_ticket_classes: Option<Vec<EventTicketClass>>,
3774 /// A list of event ticket objects.
3775 #[serde(rename = "eventTicketObjects")]
3776 pub event_ticket_objects: Option<Vec<EventTicketObject>>,
3777 /// A list of flight classes.
3778 #[serde(rename = "flightClasses")]
3779 pub flight_classes: Option<Vec<FlightClass>>,
3780 /// A list of flight objects.
3781 #[serde(rename = "flightObjects")]
3782 pub flight_objects: Option<Vec<FlightObject>>,
3783 /// A list of generic classes.
3784 #[serde(rename = "genericClasses")]
3785 pub generic_classes: Option<Vec<GenericClass>>,
3786 /// A list of generic objects.
3787 #[serde(rename = "genericObjects")]
3788 pub generic_objects: Option<Vec<GenericObject>>,
3789 /// A list of gift card classes.
3790 #[serde(rename = "giftCardClasses")]
3791 pub gift_card_classes: Option<Vec<GiftCardClass>>,
3792 /// A list of gift card objects.
3793 #[serde(rename = "giftCardObjects")]
3794 pub gift_card_objects: Option<Vec<GiftCardObject>>,
3795 /// A list of loyalty classes.
3796 #[serde(rename = "loyaltyClasses")]
3797 pub loyalty_classes: Option<Vec<LoyaltyClass>>,
3798 /// A list of loyalty objects.
3799 #[serde(rename = "loyaltyObjects")]
3800 pub loyalty_objects: Option<Vec<LoyaltyObject>>,
3801 /// A list of offer classes.
3802 #[serde(rename = "offerClasses")]
3803 pub offer_classes: Option<Vec<OfferClass>>,
3804 /// A list of offer objects.
3805 #[serde(rename = "offerObjects")]
3806 pub offer_objects: Option<Vec<OfferObject>>,
3807 /// A list of transit classes.
3808 #[serde(rename = "transitClasses")]
3809 pub transit_classes: Option<Vec<TransitClass>>,
3810 /// A list of transit objects.
3811 #[serde(rename = "transitObjects")]
3812 pub transit_objects: Option<Vec<TransitObject>>,
3813}
3814
3815impl common::Part for Resources {}
3816
3817/// There is no detailed description.
3818///
3819/// This type is not used in any activity, and only used as *part* of another schema.
3820///
3821#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3822#[serde_with::serde_as]
3823#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3824pub struct Review {
3825 /// no description provided
3826 pub comments: Option<String>,
3827}
3828
3829impl common::Part for Review {}
3830
3831/// There is no detailed description.
3832///
3833/// This type is not used in any activity, and only used as *part* of another schema.
3834///
3835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3836#[serde_with::serde_as]
3837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3838pub struct RotatingBarcode {
3839 /// 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.
3840 #[serde(rename = "alternateText")]
3841 pub alternate_text: Option<String>,
3842 /// 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.
3843 #[serde(rename = "initialRotatingBarcodeValues")]
3844 pub initial_rotating_barcode_values: Option<RotatingBarcodeValues>,
3845 /// The render encoding for the barcode. When specified, barcode is rendered in the given encoding. Otherwise best known encoding is chosen by Google.
3846 #[serde(rename = "renderEncoding")]
3847 pub render_encoding: Option<String>,
3848 /// 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.
3849 #[serde(rename = "showCodeText")]
3850 pub show_code_text: Option<LocalizedString>,
3851 /// Details used to evaluate the {totp_value_n} substitutions.
3852 #[serde(rename = "totpDetails")]
3853 pub totp_details: Option<RotatingBarcodeTotpDetails>,
3854 /// The type of this barcode.
3855 #[serde(rename = "type")]
3856 pub type_: Option<String>,
3857 /// 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.
3858 #[serde(rename = "valuePattern")]
3859 pub value_pattern: Option<String>,
3860}
3861
3862impl common::Part for RotatingBarcode {}
3863
3864/// Configuration for the time-based OTP substitutions. See https://tools.ietf.org/html/rfc6238
3865///
3866/// This type is not used in any activity, and only used as *part* of another schema.
3867///
3868#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3869#[serde_with::serde_as]
3870#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3871pub struct RotatingBarcodeTotpDetails {
3872 /// The TOTP algorithm used to generate the OTP.
3873 pub algorithm: Option<String>,
3874 /// The TOTP parameters for each of the {totp_value_*} substitutions. The TotpParameters at index n is used for the {totp_value_n} substitution.
3875 pub parameters: Option<Vec<RotatingBarcodeTotpDetailsTotpParameters>>,
3876 /// The time interval used for the TOTP value generation, in milliseconds.
3877 #[serde(rename = "periodMillis")]
3878 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3879 pub period_millis: Option<i64>,
3880}
3881
3882impl common::Part for RotatingBarcodeTotpDetails {}
3883
3884/// Configuration for the key and value length. See https://www.rfc-editor.org/rfc/rfc4226#section-5.3
3885///
3886/// This type is not used in any activity, and only used as *part* of another schema.
3887///
3888#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3889#[serde_with::serde_as]
3890#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3891pub struct RotatingBarcodeTotpDetailsTotpParameters {
3892 /// The secret key used for the TOTP value generation, encoded as a Base16 string.
3893 pub key: Option<String>,
3894 /// The length of the TOTP value in decimal digits.
3895 #[serde(rename = "valueLength")]
3896 pub value_length: Option<i32>,
3897}
3898
3899impl common::Part for RotatingBarcodeTotpDetailsTotpParameters {}
3900
3901/// A payload containing many barcode values and start date/time.
3902///
3903/// This type is not used in any activity, and only used as *part* of another schema.
3904///
3905#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3906#[serde_with::serde_as]
3907#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3908pub struct RotatingBarcodeValues {
3909 /// Required. The amount of time each barcode is valid for.
3910 #[serde(rename = "periodMillis")]
3911 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3912 pub period_millis: Option<i64>,
3913 /// 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.
3914 #[serde(rename = "startDateTime")]
3915 pub start_date_time: Option<String>,
3916 /// Required. The values to encode in the barcode. At least one value is required.
3917 pub values: Option<Vec<String>>,
3918}
3919
3920impl common::Part for RotatingBarcodeValues {}
3921
3922/// There is no detailed description.
3923///
3924/// This type is not used in any activity, and only used as *part* of another schema.
3925///
3926#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3927#[serde_with::serde_as]
3928#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3929pub struct SecurityAnimation {
3930 /// Type of animation.
3931 #[serde(rename = "animationType")]
3932 pub animation_type: Option<String>,
3933}
3934
3935impl common::Part for SecurityAnimation {}
3936
3937/// There is no detailed description.
3938///
3939/// This type is not used in any activity, and only used as *part* of another schema.
3940///
3941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3942#[serde_with::serde_as]
3943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3944pub struct SignUpInfo {
3945 /// ID of the class the user can sign up for.
3946 #[serde(rename = "classId")]
3947 pub class_id: Option<String>,
3948}
3949
3950impl common::Part for SignUpInfo {}
3951
3952/// There is no detailed description.
3953///
3954/// # Activities
3955///
3956/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3957/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3958///
3959/// * [insert smarttap](SmarttapInsertCall) (request|response)
3960#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3961#[serde_with::serde_as]
3962#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3963pub struct SmartTap {
3964 /// 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.
3965 pub id: Option<String>,
3966 /// Communication from merchant to user.
3967 pub infos: Option<Vec<IssuerToUserInfo>>,
3968 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#smartTap"`.
3969 pub kind: Option<String>,
3970 /// Smart Tap merchant ID of who engaged in the Smart Tap interaction.
3971 #[serde(rename = "merchantId")]
3972 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3973 pub merchant_id: Option<i64>,
3974}
3975
3976impl common::RequestValue for SmartTap {}
3977impl common::ResponseResult for SmartTap {}
3978
3979/// There is no detailed description.
3980///
3981/// This type is not used in any activity, and only used as *part* of another schema.
3982///
3983#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3984#[serde_with::serde_as]
3985#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3986pub struct SmartTapMerchantData {
3987 /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
3988 #[serde(rename = "authenticationKeys")]
3989 pub authentication_keys: Option<Vec<AuthenticationKey>>,
3990 /// Available only to Smart Tap enabled partners. Contact support for additional guidance.
3991 #[serde(rename = "smartTapMerchantId")]
3992 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3993 pub smart_tap_merchant_id: Option<i64>,
3994}
3995
3996impl common::Part for SmartTapMerchantData {}
3997
3998/// There is no detailed description.
3999///
4000/// This type is not used in any activity, and only used as *part* of another schema.
4001///
4002#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4003#[serde_with::serde_as]
4004#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4005pub struct TemplateItem {
4006 /// 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".
4007 #[serde(rename = "firstValue")]
4008 pub first_value: Option<FieldSelector>,
4009 /// A predefined item to display. Only one of `firstValue` or `predefinedItem` may be set.
4010 #[serde(rename = "predefinedItem")]
4011 pub predefined_item: Option<String>,
4012 /// A reference to a field to display. This may only be populated if the `firstValue` field is populated.
4013 #[serde(rename = "secondValue")]
4014 pub second_value: Option<FieldSelector>,
4015}
4016
4017impl common::Part for TemplateItem {}
4018
4019/// 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.
4020///
4021/// This type is not used in any activity, and only used as *part* of another schema.
4022///
4023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4024#[serde_with::serde_as]
4025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4026pub struct TextModuleData {
4027 /// 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.
4028 pub body: Option<String>,
4029 /// The header of the Text Module. Recommended maximum length is 35 characters to ensure full string is displayed on smaller screens.
4030 pub header: Option<String>,
4031 /// The ID associated with a text module. This field is here to enable ease of management of text modules.
4032 pub id: Option<String>,
4033 /// Translated strings for the body. Recommended maximum length is 500 characters to ensure full string is displayed on smaller screens.
4034 #[serde(rename = "localizedBody")]
4035 pub localized_body: Option<LocalizedString>,
4036 /// Translated strings for the header. Recommended maximum length is 35 characters to ensure full string is displayed on smaller screens.
4037 #[serde(rename = "localizedHeader")]
4038 pub localized_header: Option<LocalizedString>,
4039}
4040
4041impl common::Part for TextModuleData {}
4042
4043/// There is no detailed description.
4044///
4045/// This type is not used in any activity, and only used as *part* of another schema.
4046///
4047#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4048#[serde_with::serde_as]
4049#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4050pub struct TicketCost {
4051 /// A message describing any kind of discount that was applied.
4052 #[serde(rename = "discountMessage")]
4053 pub discount_message: Option<LocalizedString>,
4054 /// The face value of the ticket.
4055 #[serde(rename = "faceValue")]
4056 pub face_value: Option<Money>,
4057 /// The actual purchase price of the ticket, after tax and/or discounts.
4058 #[serde(rename = "purchasePrice")]
4059 pub purchase_price: Option<Money>,
4060}
4061
4062impl common::Part for TicketCost {}
4063
4064/// There is no detailed description.
4065///
4066/// This type is not used in any activity, and only used as *part* of another schema.
4067///
4068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4069#[serde_with::serde_as]
4070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4071pub struct TicketLeg {
4072 /// 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.
4073 #[serde(rename = "arrivalDateTime")]
4074 pub arrival_date_time: Option<String>,
4075 /// The train or ship name/number that the passsenger needs to board.
4076 pub carriage: Option<String>,
4077 /// 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.
4078 #[serde(rename = "departureDateTime")]
4079 pub departure_date_time: Option<String>,
4080 /// The destination name.
4081 #[serde(rename = "destinationName")]
4082 pub destination_name: Option<LocalizedString>,
4083 /// The destination station code.
4084 #[serde(rename = "destinationStationCode")]
4085 pub destination_station_code: Option<String>,
4086 /// Short description/name of the fare for this leg of travel. Eg "Anytime Single Use".
4087 #[serde(rename = "fareName")]
4088 pub fare_name: Option<LocalizedString>,
4089 /// The name of the origin station. This is required if `desinationName` is present or if `originStationCode` is not present.
4090 #[serde(rename = "originName")]
4091 pub origin_name: Option<LocalizedString>,
4092 /// The origin station code. This is required if `destinationStationCode` is present or if `originName` is not present.
4093 #[serde(rename = "originStationCode")]
4094 pub origin_station_code: Option<String>,
4095 /// The platform or gate where the passenger can board the carriage.
4096 pub platform: Option<String>,
4097 /// 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.
4098 #[serde(rename = "ticketSeat")]
4099 pub ticket_seat: Option<TicketSeat>,
4100 /// 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.
4101 #[serde(rename = "ticketSeats")]
4102 pub ticket_seats: Option<Vec<TicketSeat>>,
4103 /// The name of the transit operator that is operating this leg of a trip.
4104 #[serde(rename = "transitOperatorName")]
4105 pub transit_operator_name: Option<LocalizedString>,
4106 /// Terminus station or destination of the train/bus/etc.
4107 #[serde(rename = "transitTerminusName")]
4108 pub transit_terminus_name: Option<LocalizedString>,
4109 /// The zone of boarding within the platform.
4110 pub zone: Option<String>,
4111}
4112
4113impl common::Part for TicketLeg {}
4114
4115/// There is no detailed description.
4116///
4117/// This type is not used in any activity, and only used as *part* of another schema.
4118///
4119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4120#[serde_with::serde_as]
4121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4122pub struct TicketRestrictions {
4123 /// Extra restrictions that don't fall under the "route" or "time" categories.
4124 #[serde(rename = "otherRestrictions")]
4125 pub other_restrictions: Option<LocalizedString>,
4126 /// Restrictions about routes that may be taken. For example, this may be the string "Reserved CrossCountry trains only".
4127 #[serde(rename = "routeRestrictions")]
4128 pub route_restrictions: Option<LocalizedString>,
4129 /// More details about the above `routeRestrictions`.
4130 #[serde(rename = "routeRestrictionsDetails")]
4131 pub route_restrictions_details: Option<LocalizedString>,
4132 /// Restrictions about times this ticket may be used.
4133 #[serde(rename = "timeRestrictions")]
4134 pub time_restrictions: Option<LocalizedString>,
4135}
4136
4137impl common::Part for TicketRestrictions {}
4138
4139/// There is no detailed description.
4140///
4141/// This type is not used in any activity, and only used as *part* of another schema.
4142///
4143#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4144#[serde_with::serde_as]
4145#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4146pub struct TicketSeat {
4147 /// The identifier of the train car or coach in which the ticketed seat is located. Eg. "10"
4148 pub coach: Option<String>,
4149 /// A custome fare class to be used if no `fareClass` applies. Both `fareClass` and `customFareClass` may not be set.
4150 #[serde(rename = "customFareClass")]
4151 pub custom_fare_class: Option<LocalizedString>,
4152 /// The fare class of the ticketed seat.
4153 #[serde(rename = "fareClass")]
4154 pub fare_class: Option<String>,
4155 /// The identifier of where the ticketed seat is located. Eg. "42". If there is no specific identifier, use `seatAssigment` instead.
4156 pub seat: Option<String>,
4157 /// The passenger's seat assignment. Eg. "no specific seat". To be used when there is no specific identifier to use in `seat`.
4158 #[serde(rename = "seatAssignment")]
4159 pub seat_assignment: Option<LocalizedString>,
4160}
4161
4162impl common::Part for TicketSeat {}
4163
4164/// There is no detailed description.
4165///
4166/// This type is not used in any activity, and only used as *part* of another schema.
4167///
4168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4169#[serde_with::serde_as]
4170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4171pub struct TimeInterval {
4172 /// 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.
4173 pub end: Option<DateTime>,
4174 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#timeInterval"`.
4175 pub kind: Option<String>,
4176 /// 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.
4177 pub start: Option<DateTime>,
4178}
4179
4180impl common::Part for TimeInterval {}
4181
4182/// There is no detailed description.
4183///
4184/// # Activities
4185///
4186/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4187/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4188///
4189/// * [get transitclass](TransitclasGetCall) (response)
4190/// * [insert transitclass](TransitclasInsertCall) (request|response)
4191/// * [patch transitclass](TransitclasPatchCall) (request|response)
4192/// * [update transitclass](TransitclasUpdateCall) (request|response)
4193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4194#[serde_with::serde_as]
4195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4196pub struct TransitClass {
4197 /// Activation options for an activatable ticket.
4198 #[serde(rename = "activationOptions")]
4199 pub activation_options: Option<ActivationOptions>,
4200 /// Deprecated. Use `multipleDevicesAndHoldersAllowedStatus` instead.
4201 #[serde(rename = "allowMultipleUsersPerObject")]
4202 pub allow_multiple_users_per_object: Option<bool>,
4203 /// 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.
4204 #[serde(rename = "appLinkData")]
4205 pub app_link_data: Option<AppLinkData>,
4206 /// 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.
4207 #[serde(rename = "callbackOptions")]
4208 pub callback_options: Option<CallbackOptions>,
4209 /// Template information about how the class should be displayed. If unset, Google will fallback to a default set of fields to display.
4210 #[serde(rename = "classTemplateInfo")]
4211 pub class_template_info: Option<ClassTemplateInfo>,
4212 /// 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.
4213 #[serde(rename = "countryCode")]
4214 pub country_code: Option<String>,
4215 /// A custom label to use for the carriage value (`transitObject.ticketLeg.carriage`).
4216 #[serde(rename = "customCarriageLabel")]
4217 pub custom_carriage_label: Option<LocalizedString>,
4218 /// A custom label to use for the coach value (`transitObject.ticketLeg.ticketSeat.coach`).
4219 #[serde(rename = "customCoachLabel")]
4220 pub custom_coach_label: Option<LocalizedString>,
4221 /// A custom label to use for the transit concession category value (`transitObject.concessionCategory`).
4222 #[serde(rename = "customConcessionCategoryLabel")]
4223 pub custom_concession_category_label: Option<LocalizedString>,
4224 /// A custom label to use for the confirmation code value (`transitObject.purchaseDetails.confirmationCode`).
4225 #[serde(rename = "customConfirmationCodeLabel")]
4226 pub custom_confirmation_code_label: Option<LocalizedString>,
4227 /// A custom label to use for the transit discount message value (`transitObject.purchaseDetails.ticketCost.discountMessage`).
4228 #[serde(rename = "customDiscountMessageLabel")]
4229 pub custom_discount_message_label: Option<LocalizedString>,
4230 /// A custom label to use for the fare class value (`transitObject.ticketLeg.ticketSeat.fareClass`).
4231 #[serde(rename = "customFareClassLabel")]
4232 pub custom_fare_class_label: Option<LocalizedString>,
4233 /// A custom label to use for the transit fare name value (`transitObject.ticketLeg.fareName`).
4234 #[serde(rename = "customFareNameLabel")]
4235 pub custom_fare_name_label: Option<LocalizedString>,
4236 /// A custom label to use for the other restrictions value (`transitObject.ticketRestrictions.otherRestrictions`).
4237 #[serde(rename = "customOtherRestrictionsLabel")]
4238 pub custom_other_restrictions_label: Option<LocalizedString>,
4239 /// A custom label to use for the boarding platform value (`transitObject.ticketLeg.platform`).
4240 #[serde(rename = "customPlatformLabel")]
4241 pub custom_platform_label: Option<LocalizedString>,
4242 /// A custom label to use for the purchase face value (`transitObject.purchaseDetails.ticketCost.faceValue`).
4243 #[serde(rename = "customPurchaseFaceValueLabel")]
4244 pub custom_purchase_face_value_label: Option<LocalizedString>,
4245 /// A custom label to use for the purchase price value (`transitObject.purchaseDetails.ticketCost.purchasePrice`).
4246 #[serde(rename = "customPurchasePriceLabel")]
4247 pub custom_purchase_price_label: Option<LocalizedString>,
4248 /// A custom label to use for the purchase receipt number value (`transitObject.purchaseDetails.purchaseReceiptNumber`).
4249 #[serde(rename = "customPurchaseReceiptNumberLabel")]
4250 pub custom_purchase_receipt_number_label: Option<LocalizedString>,
4251 /// A custom label to use for the route restrictions details value (`transitObject.ticketRestrictions.routeRestrictionsDetails`).
4252 #[serde(rename = "customRouteRestrictionsDetailsLabel")]
4253 pub custom_route_restrictions_details_label: Option<LocalizedString>,
4254 /// A custom label to use for the route restrictions value (`transitObject.ticketRestrictions.routeRestrictions`).
4255 #[serde(rename = "customRouteRestrictionsLabel")]
4256 pub custom_route_restrictions_label: Option<LocalizedString>,
4257 /// A custom label to use for the seat location value (`transitObject.ticketLeg.ticketSeat.seat`).
4258 #[serde(rename = "customSeatLabel")]
4259 pub custom_seat_label: Option<LocalizedString>,
4260 /// A custom label to use for the ticket number value (`transitObject.ticketNumber`).
4261 #[serde(rename = "customTicketNumberLabel")]
4262 pub custom_ticket_number_label: Option<LocalizedString>,
4263 /// A custom label to use for the time restrictions details value (`transitObject.ticketRestrictions.timeRestrictions`).
4264 #[serde(rename = "customTimeRestrictionsLabel")]
4265 pub custom_time_restrictions_label: Option<LocalizedString>,
4266 /// A custom label to use for the transit terminus name value (`transitObject.ticketLeg.transitTerminusName`).
4267 #[serde(rename = "customTransitTerminusNameLabel")]
4268 pub custom_transit_terminus_name_label: Option<LocalizedString>,
4269 /// A custom label to use for the boarding zone value (`transitObject.ticketLeg.zone`).
4270 #[serde(rename = "customZoneLabel")]
4271 pub custom_zone_label: Option<LocalizedString>,
4272 /// Controls the display of the single-leg itinerary for this class. By default, an itinerary will only display for multi-leg trips.
4273 #[serde(rename = "enableSingleLegItinerary")]
4274 pub enable_single_leg_itinerary: Option<bool>,
4275 /// 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.
4276 #[serde(rename = "enableSmartTap")]
4277 pub enable_smart_tap: Option<bool>,
4278 /// 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.
4279 #[serde(rename = "heroImage")]
4280 pub hero_image: Option<Image>,
4281 /// 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`.
4282 #[serde(rename = "hexBackgroundColor")]
4283 pub hex_background_color: Option<String>,
4284 /// 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).
4285 #[serde(rename = "homepageUri")]
4286 pub homepage_uri: Option<Uri>,
4287 /// 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 '-'.
4288 pub id: Option<String>,
4289 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
4290 #[serde(rename = "imageModulesData")]
4291 pub image_modules_data: Option<Vec<ImageModuleData>>,
4292 /// Deprecated. Use textModulesData instead.
4293 #[serde(rename = "infoModuleData")]
4294 pub info_module_data: Option<InfoModuleData>,
4295 /// Required. The issuer name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
4296 #[serde(rename = "issuerName")]
4297 pub issuer_name: Option<String>,
4298 /// 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".
4299 #[serde(rename = "languageOverride")]
4300 pub language_override: Option<String>,
4301 /// Links module data. If links module data is also defined on the object, both will be displayed.
4302 #[serde(rename = "linksModuleData")]
4303 pub links_module_data: Option<LinksModuleData>,
4304 /// Translated strings for the issuer_name. Recommended maximum length is 20 characters to ensure full string is displayed on smaller screens.
4305 #[serde(rename = "localizedIssuerName")]
4306 pub localized_issuer_name: Option<LocalizedString>,
4307 /// Note: This field is currently not supported to trigger geo notifications.
4308 pub locations: Option<Vec<LatLongPoint>>,
4309 /// Required. The logo image of the ticket. This image is displayed in the card detail view of the app.
4310 pub logo: Option<Image>,
4311 /// 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.
4312 pub messages: Option<Vec<Message>>,
4313 /// Identifies whether multiple users and devices will save the same object referencing this class.
4314 #[serde(rename = "multipleDevicesAndHoldersAllowedStatus")]
4315 pub multiple_devices_and_holders_allowed_status: Option<String>,
4316 /// 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.
4317 #[serde(rename = "redemptionIssuers")]
4318 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4319 pub redemption_issuers: Option<Vec<i64>>,
4320 /// The review comments set by the platform when a class is marked `approved` or `rejected`.
4321 pub review: Option<Review>,
4322 /// 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`.
4323 #[serde(rename = "reviewStatus")]
4324 pub review_status: Option<String>,
4325 /// Optional information about the security animation. If this is set a security animation will be rendered on pass details.
4326 #[serde(rename = "securityAnimation")]
4327 pub security_animation: Option<SecurityAnimation>,
4328 /// 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.
4329 #[serde(rename = "textModulesData")]
4330 pub text_modules_data: Option<Vec<TextModuleData>>,
4331 /// The name of the transit operator.
4332 #[serde(rename = "transitOperatorName")]
4333 pub transit_operator_name: Option<LocalizedString>,
4334 /// Required. The type of transit this class represents, such as "bus".
4335 #[serde(rename = "transitType")]
4336 pub transit_type: Option<String>,
4337 /// Deprecated
4338 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4339 pub version: Option<i64>,
4340 /// View Unlock Requirement options for the transit ticket.
4341 #[serde(rename = "viewUnlockRequirement")]
4342 pub view_unlock_requirement: Option<String>,
4343 /// Watermark image to display on the user's device.
4344 pub watermark: Option<Image>,
4345 /// 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.
4346 #[serde(rename = "wideLogo")]
4347 pub wide_logo: Option<Image>,
4348 /// Deprecated.
4349 #[serde(rename = "wordMark")]
4350 pub word_mark: Option<Image>,
4351}
4352
4353impl common::RequestValue for TransitClass {}
4354impl common::ResponseResult for TransitClass {}
4355
4356/// There is no detailed description.
4357///
4358/// # Activities
4359///
4360/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4361/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4362///
4363/// * [addmessage transitclass](TransitclasAddmessageCall) (response)
4364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4365#[serde_with::serde_as]
4366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4367pub struct TransitClassAddMessageResponse {
4368 /// The updated TransitClass resource.
4369 pub resource: Option<TransitClass>,
4370}
4371
4372impl common::ResponseResult for TransitClassAddMessageResponse {}
4373
4374/// There is no detailed description.
4375///
4376/// # Activities
4377///
4378/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4379/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4380///
4381/// * [list transitclass](TransitclasListCall) (response)
4382#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4383#[serde_with::serde_as]
4384#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4385pub struct TransitClassListResponse {
4386 /// Pagination of the response.
4387 pub pagination: Option<Pagination>,
4388 /// Resources corresponding to the list request.
4389 pub resources: Option<Vec<TransitClass>>,
4390}
4391
4392impl common::ResponseResult for TransitClassListResponse {}
4393
4394/// There is no detailed description.
4395///
4396/// # Activities
4397///
4398/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4399/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4400///
4401/// * [get transitobject](TransitobjectGetCall) (response)
4402/// * [insert transitobject](TransitobjectInsertCall) (request|response)
4403/// * [patch transitobject](TransitobjectPatchCall) (request|response)
4404/// * [update transitobject](TransitobjectUpdateCall) (request|response)
4405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4406#[serde_with::serde_as]
4407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4408pub struct TransitObject {
4409 /// The activation status for the object. Required if the class has `activationOptions` set.
4410 #[serde(rename = "activationStatus")]
4411 pub activation_status: Option<ActivationStatus>,
4412 /// 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.
4413 #[serde(rename = "appLinkData")]
4414 pub app_link_data: Option<AppLinkData>,
4415 /// The barcode type and value.
4416 pub barcode: Option<Barcode>,
4417 /// 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.
4418 #[serde(rename = "classId")]
4419 pub class_id: Option<String>,
4420 /// A copy of the inherited fields of the parent class. These fields are retrieved during a GET.
4421 #[serde(rename = "classReference")]
4422 pub class_reference: Option<TransitClass>,
4423 /// The concession category for the ticket.
4424 #[serde(rename = "concessionCategory")]
4425 pub concession_category: Option<String>,
4426 /// A custom concession category to use when `concessionCategory` does not provide the right option. Both `concessionCategory` and `customConcessionCategory` may not be set.
4427 #[serde(rename = "customConcessionCategory")]
4428 pub custom_concession_category: Option<LocalizedString>,
4429 /// 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.
4430 #[serde(rename = "customTicketStatus")]
4431 pub custom_ticket_status: Option<LocalizedString>,
4432 /// Device context associated with the object.
4433 #[serde(rename = "deviceContext")]
4434 pub device_context: Option<DeviceContext>,
4435 /// 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.
4436 #[serde(rename = "disableExpirationNotification")]
4437 pub disable_expiration_notification: Option<bool>,
4438 /// Information that controls how passes are grouped together.
4439 #[serde(rename = "groupingInfo")]
4440 pub grouping_info: Option<GroupingInfo>,
4441 /// 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.
4442 #[serde(rename = "hasLinkedDevice")]
4443 pub has_linked_device: Option<bool>,
4444 /// Indicates if the object has users. This field is set by the platform.
4445 #[serde(rename = "hasUsers")]
4446 pub has_users: Option<bool>,
4447 /// 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.
4448 #[serde(rename = "heroImage")]
4449 pub hero_image: Option<Image>,
4450 /// 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`.
4451 #[serde(rename = "hexBackgroundColor")]
4452 pub hex_background_color: Option<String>,
4453 /// 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 '-'.
4454 pub id: Option<String>,
4455 /// Image module data. The maximum number of these fields displayed is 1 from object level and 1 for class object level.
4456 #[serde(rename = "imageModulesData")]
4457 pub image_modules_data: Option<Vec<ImageModuleData>>,
4458 /// Deprecated. Use textModulesData instead.
4459 #[serde(rename = "infoModuleData")]
4460 pub info_module_data: Option<InfoModuleData>,
4461 /// Links module data. If links module data is also defined on the class, both will be displayed.
4462 #[serde(rename = "linksModuleData")]
4463 pub links_module_data: Option<LinksModuleData>,
4464 /// Note: This field is currently not supported to trigger geo notifications.
4465 pub locations: Option<Vec<LatLongPoint>>,
4466 /// 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.
4467 pub messages: Option<Vec<Message>>,
4468 /// Pass constraints for the object. Includes limiting NFC and screenshot behaviors.
4469 #[serde(rename = "passConstraints")]
4470 pub pass_constraints: Option<PassConstraints>,
4471 /// The name(s) of the passengers the ticket is assigned to. The above `passengerType` field is meant to give Google context on this field.
4472 #[serde(rename = "passengerNames")]
4473 pub passenger_names: Option<String>,
4474 /// The number of passengers.
4475 #[serde(rename = "passengerType")]
4476 pub passenger_type: Option<String>,
4477 /// Purchase details for this ticket.
4478 #[serde(rename = "purchaseDetails")]
4479 pub purchase_details: Option<PurchaseDetails>,
4480 /// The rotating barcode type and value.
4481 #[serde(rename = "rotatingBarcode")]
4482 pub rotating_barcode: Option<RotatingBarcode>,
4483 /// 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.
4484 #[serde(rename = "smartTapRedemptionValue")]
4485 pub smart_tap_redemption_value: Option<String>,
4486 /// 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.
4487 pub state: Option<String>,
4488 /// 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.
4489 #[serde(rename = "textModulesData")]
4490 pub text_modules_data: Option<Vec<TextModuleData>>,
4491 /// 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.
4492 #[serde(rename = "ticketLeg")]
4493 pub ticket_leg: Option<TicketLeg>,
4494 /// 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.
4495 #[serde(rename = "ticketLegs")]
4496 pub ticket_legs: Option<Vec<TicketLeg>>,
4497 /// The number of the ticket. This is a unique identifier for the ticket in the transit operator's system.
4498 #[serde(rename = "ticketNumber")]
4499 pub ticket_number: Option<String>,
4500 /// 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.
4501 #[serde(rename = "ticketRestrictions")]
4502 pub ticket_restrictions: Option<TicketRestrictions>,
4503 /// The status of the ticket. For states which affect display, use the `state` field instead.
4504 #[serde(rename = "ticketStatus")]
4505 pub ticket_status: Option<String>,
4506 /// This id is used to group tickets together if the user has saved multiple tickets for the same trip.
4507 #[serde(rename = "tripId")]
4508 pub trip_id: Option<String>,
4509 /// 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.
4510 #[serde(rename = "tripType")]
4511 pub trip_type: Option<String>,
4512 /// 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.
4513 #[serde(rename = "validTimeInterval")]
4514 pub valid_time_interval: Option<TimeInterval>,
4515 /// Deprecated
4516 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4517 pub version: Option<i64>,
4518}
4519
4520impl common::RequestValue for TransitObject {}
4521impl common::ResponseResult for TransitObject {}
4522
4523/// There is no detailed description.
4524///
4525/// # Activities
4526///
4527/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4528/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4529///
4530/// * [addmessage transitobject](TransitobjectAddmessageCall) (response)
4531#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4532#[serde_with::serde_as]
4533#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4534pub struct TransitObjectAddMessageResponse {
4535 /// The updated TransitObject resource.
4536 pub resource: Option<TransitObject>,
4537}
4538
4539impl common::ResponseResult for TransitObjectAddMessageResponse {}
4540
4541/// There is no detailed description.
4542///
4543/// # Activities
4544///
4545/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4546/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4547///
4548/// * [list transitobject](TransitobjectListCall) (response)
4549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4550#[serde_with::serde_as]
4551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4552pub struct TransitObjectListResponse {
4553 /// Pagination of the response.
4554 pub pagination: Option<Pagination>,
4555 /// Resources corresponding to the list request.
4556 pub resources: Option<Vec<TransitObject>>,
4557}
4558
4559impl common::ResponseResult for TransitObjectListResponse {}
4560
4561/// Request to upload rotating barcode values.
4562///
4563/// # Activities
4564///
4565/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4566/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4567///
4568/// * [upload media](MediaUploadCall) (request)
4569#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4570#[serde_with::serde_as]
4571#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4572pub struct TransitObjectUploadRotatingBarcodeValuesRequest {
4573 /// A reference to the rotating barcode values payload that was uploaded.
4574 pub blob: Option<Media>,
4575 /// Extra information about the uploaded media.
4576 #[serde(rename = "mediaRequestInfo")]
4577 pub media_request_info: Option<MediaRequestInfo>,
4578}
4579
4580impl common::RequestValue for TransitObjectUploadRotatingBarcodeValuesRequest {}
4581
4582/// Response for uploading rotating barcode values.
4583///
4584/// # Activities
4585///
4586/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4587/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4588///
4589/// * [upload media](MediaUploadCall) (response)
4590#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4591#[serde_with::serde_as]
4592#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4593pub struct TransitObjectUploadRotatingBarcodeValuesResponse {
4594 _never_set: Option<bool>,
4595}
4596
4597impl common::ResponseResult for TransitObjectUploadRotatingBarcodeValuesResponse {}
4598
4599/// There is no detailed description.
4600///
4601/// This type is not used in any activity, and only used as *part* of another schema.
4602///
4603#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4604#[serde_with::serde_as]
4605#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4606pub struct TranslatedString {
4607 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#translatedString"`.
4608 pub kind: Option<String>,
4609 /// Represents the BCP 47 language tag. Example values are "en-US", "en-GB", "de", or "de-AT".
4610 pub language: Option<String>,
4611 /// The UTF-8 encoded translated string.
4612 pub value: Option<String>,
4613}
4614
4615impl common::Part for TranslatedString {}
4616
4617/// Indicates that the issuer would like Google Wallet to send an upcoming card validity notification 1 day before card becomes valid/usable.
4618///
4619/// This type is not used in any activity, and only used as *part* of another schema.
4620///
4621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4622#[serde_with::serde_as]
4623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4624pub struct UpcomingNotification {
4625 /// Indicates if the object needs to have upcoming notification enabled.
4626 #[serde(rename = "enableNotification")]
4627 pub enable_notification: Option<bool>,
4628}
4629
4630impl common::Part for UpcomingNotification {}
4631
4632/// There is no detailed description.
4633///
4634/// This type is not used in any activity, and only used as *part* of another schema.
4635///
4636#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4637#[serde_with::serde_as]
4638#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4639pub struct Uri {
4640 /// 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.
4641 pub description: Option<String>,
4642 /// The ID associated with a uri. This field is here to enable ease of management of uris.
4643 pub id: Option<String>,
4644 /// Identifies what kind of resource this is. Value: the fixed string `"walletobjects#uri"`.
4645 pub kind: Option<String>,
4646 /// Translated strings for the description. Recommended maximum is 20 characters to ensure full string is displayed on smaller screens.
4647 #[serde(rename = "localizedDescription")]
4648 pub localized_description: Option<LocalizedString>,
4649 /// 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.
4650 pub uri: Option<String>,
4651}
4652
4653impl common::Part for Uri {}
4654
4655// ###################
4656// MethodBuilders ###
4657// #################
4658
4659/// A builder providing access to all methods supported on *eventticketclas* resources.
4660/// It is not used directly, but through the [`Walletobjects`] hub.
4661///
4662/// # Example
4663///
4664/// Instantiate a resource builder
4665///
4666/// ```test_harness,no_run
4667/// extern crate hyper;
4668/// extern crate hyper_rustls;
4669/// extern crate google_walletobjects1 as walletobjects1;
4670///
4671/// # async fn dox() {
4672/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4673///
4674/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4675/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4676/// secret,
4677/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4678/// ).build().await.unwrap();
4679///
4680/// let client = hyper_util::client::legacy::Client::builder(
4681/// hyper_util::rt::TokioExecutor::new()
4682/// )
4683/// .build(
4684/// hyper_rustls::HttpsConnectorBuilder::new()
4685/// .with_native_roots()
4686/// .unwrap()
4687/// .https_or_http()
4688/// .enable_http1()
4689/// .build()
4690/// );
4691/// let mut hub = Walletobjects::new(client, auth);
4692/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4693/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
4694/// // to build up your call.
4695/// let rb = hub.eventticketclass();
4696/// # }
4697/// ```
4698pub struct EventticketclasMethods<'a, C>
4699where
4700 C: 'a,
4701{
4702 hub: &'a Walletobjects<C>,
4703}
4704
4705impl<'a, C> common::MethodsBuilder for EventticketclasMethods<'a, C> {}
4706
4707impl<'a, C> EventticketclasMethods<'a, C> {
4708 /// Create a builder to help you perform the following task:
4709 ///
4710 /// Adds a message to the event ticket class referenced by the given class ID.
4711 ///
4712 /// # Arguments
4713 ///
4714 /// * `request` - No description provided.
4715 /// * `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 '-'.
4716 pub fn addmessage(
4717 &self,
4718 request: AddMessageRequest,
4719 resource_id: &str,
4720 ) -> EventticketclasAddmessageCall<'a, C> {
4721 EventticketclasAddmessageCall {
4722 hub: self.hub,
4723 _request: request,
4724 _resource_id: resource_id.to_string(),
4725 _delegate: Default::default(),
4726 _additional_params: Default::default(),
4727 _scopes: Default::default(),
4728 }
4729 }
4730
4731 /// Create a builder to help you perform the following task:
4732 ///
4733 /// Returns the event ticket class with the given class ID.
4734 ///
4735 /// # Arguments
4736 ///
4737 /// * `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 '-'.
4738 pub fn get(&self, resource_id: &str) -> EventticketclasGetCall<'a, C> {
4739 EventticketclasGetCall {
4740 hub: self.hub,
4741 _resource_id: resource_id.to_string(),
4742 _delegate: Default::default(),
4743 _additional_params: Default::default(),
4744 _scopes: Default::default(),
4745 }
4746 }
4747
4748 /// Create a builder to help you perform the following task:
4749 ///
4750 /// Inserts an event ticket class with the given ID and properties.
4751 ///
4752 /// # Arguments
4753 ///
4754 /// * `request` - No description provided.
4755 pub fn insert(&self, request: EventTicketClass) -> EventticketclasInsertCall<'a, C> {
4756 EventticketclasInsertCall {
4757 hub: self.hub,
4758 _request: request,
4759 _delegate: Default::default(),
4760 _additional_params: Default::default(),
4761 _scopes: Default::default(),
4762 }
4763 }
4764
4765 /// Create a builder to help you perform the following task:
4766 ///
4767 /// Returns a list of all event ticket classes for a given issuer ID.
4768 pub fn list(&self) -> EventticketclasListCall<'a, C> {
4769 EventticketclasListCall {
4770 hub: self.hub,
4771 _token: Default::default(),
4772 _max_results: Default::default(),
4773 _issuer_id: Default::default(),
4774 _delegate: Default::default(),
4775 _additional_params: Default::default(),
4776 _scopes: Default::default(),
4777 }
4778 }
4779
4780 /// Create a builder to help you perform the following task:
4781 ///
4782 /// Updates the event ticket class referenced by the given class ID. This method supports patch semantics.
4783 ///
4784 /// # Arguments
4785 ///
4786 /// * `request` - No description provided.
4787 /// * `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 '-'.
4788 pub fn patch(
4789 &self,
4790 request: EventTicketClass,
4791 resource_id: &str,
4792 ) -> EventticketclasPatchCall<'a, C> {
4793 EventticketclasPatchCall {
4794 hub: self.hub,
4795 _request: request,
4796 _resource_id: resource_id.to_string(),
4797 _delegate: Default::default(),
4798 _additional_params: Default::default(),
4799 _scopes: Default::default(),
4800 }
4801 }
4802
4803 /// Create a builder to help you perform the following task:
4804 ///
4805 /// Updates the event ticket class referenced by the given class ID.
4806 ///
4807 /// # Arguments
4808 ///
4809 /// * `request` - No description provided.
4810 /// * `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 '-'.
4811 pub fn update(
4812 &self,
4813 request: EventTicketClass,
4814 resource_id: &str,
4815 ) -> EventticketclasUpdateCall<'a, C> {
4816 EventticketclasUpdateCall {
4817 hub: self.hub,
4818 _request: request,
4819 _resource_id: resource_id.to_string(),
4820 _delegate: Default::default(),
4821 _additional_params: Default::default(),
4822 _scopes: Default::default(),
4823 }
4824 }
4825}
4826
4827/// A builder providing access to all methods supported on *eventticketobject* resources.
4828/// It is not used directly, but through the [`Walletobjects`] hub.
4829///
4830/// # Example
4831///
4832/// Instantiate a resource builder
4833///
4834/// ```test_harness,no_run
4835/// extern crate hyper;
4836/// extern crate hyper_rustls;
4837/// extern crate google_walletobjects1 as walletobjects1;
4838///
4839/// # async fn dox() {
4840/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4841///
4842/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4843/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4844/// secret,
4845/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4846/// ).build().await.unwrap();
4847///
4848/// let client = hyper_util::client::legacy::Client::builder(
4849/// hyper_util::rt::TokioExecutor::new()
4850/// )
4851/// .build(
4852/// hyper_rustls::HttpsConnectorBuilder::new()
4853/// .with_native_roots()
4854/// .unwrap()
4855/// .https_or_http()
4856/// .enable_http1()
4857/// .build()
4858/// );
4859/// let mut hub = Walletobjects::new(client, auth);
4860/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4861/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `modifylinkedofferobjects(...)`, `patch(...)` and `update(...)`
4862/// // to build up your call.
4863/// let rb = hub.eventticketobject();
4864/// # }
4865/// ```
4866pub struct EventticketobjectMethods<'a, C>
4867where
4868 C: 'a,
4869{
4870 hub: &'a Walletobjects<C>,
4871}
4872
4873impl<'a, C> common::MethodsBuilder for EventticketobjectMethods<'a, C> {}
4874
4875impl<'a, C> EventticketobjectMethods<'a, C> {
4876 /// Create a builder to help you perform the following task:
4877 ///
4878 /// Adds a message to the event ticket object referenced by the given object ID.
4879 ///
4880 /// # Arguments
4881 ///
4882 /// * `request` - No description provided.
4883 /// * `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 '-'.
4884 pub fn addmessage(
4885 &self,
4886 request: AddMessageRequest,
4887 resource_id: &str,
4888 ) -> EventticketobjectAddmessageCall<'a, C> {
4889 EventticketobjectAddmessageCall {
4890 hub: self.hub,
4891 _request: request,
4892 _resource_id: resource_id.to_string(),
4893 _delegate: Default::default(),
4894 _additional_params: Default::default(),
4895 _scopes: Default::default(),
4896 }
4897 }
4898
4899 /// Create a builder to help you perform the following task:
4900 ///
4901 /// Returns the event ticket object with the given object ID.
4902 ///
4903 /// # Arguments
4904 ///
4905 /// * `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 '-'.
4906 pub fn get(&self, resource_id: &str) -> EventticketobjectGetCall<'a, C> {
4907 EventticketobjectGetCall {
4908 hub: self.hub,
4909 _resource_id: resource_id.to_string(),
4910 _delegate: Default::default(),
4911 _additional_params: Default::default(),
4912 _scopes: Default::default(),
4913 }
4914 }
4915
4916 /// Create a builder to help you perform the following task:
4917 ///
4918 /// Inserts an event ticket object with the given ID and properties.
4919 ///
4920 /// # Arguments
4921 ///
4922 /// * `request` - No description provided.
4923 pub fn insert(&self, request: EventTicketObject) -> EventticketobjectInsertCall<'a, C> {
4924 EventticketobjectInsertCall {
4925 hub: self.hub,
4926 _request: request,
4927 _delegate: Default::default(),
4928 _additional_params: Default::default(),
4929 _scopes: Default::default(),
4930 }
4931 }
4932
4933 /// Create a builder to help you perform the following task:
4934 ///
4935 /// Returns a list of all event ticket objects for a given issuer ID.
4936 pub fn list(&self) -> EventticketobjectListCall<'a, C> {
4937 EventticketobjectListCall {
4938 hub: self.hub,
4939 _token: Default::default(),
4940 _max_results: Default::default(),
4941 _class_id: Default::default(),
4942 _delegate: Default::default(),
4943 _additional_params: Default::default(),
4944 _scopes: Default::default(),
4945 }
4946 }
4947
4948 /// Create a builder to help you perform the following task:
4949 ///
4950 /// Modifies linked offer objects for the event ticket object with the given ID.
4951 ///
4952 /// # Arguments
4953 ///
4954 /// * `request` - No description provided.
4955 /// * `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 '-'.
4956 pub fn modifylinkedofferobjects(
4957 &self,
4958 request: ModifyLinkedOfferObjectsRequest,
4959 resource_id: &str,
4960 ) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
4961 EventticketobjectModifylinkedofferobjectCall {
4962 hub: self.hub,
4963 _request: request,
4964 _resource_id: resource_id.to_string(),
4965 _delegate: Default::default(),
4966 _additional_params: Default::default(),
4967 _scopes: Default::default(),
4968 }
4969 }
4970
4971 /// Create a builder to help you perform the following task:
4972 ///
4973 /// Updates the event ticket object referenced by the given object ID. This method supports patch semantics.
4974 ///
4975 /// # Arguments
4976 ///
4977 /// * `request` - No description provided.
4978 /// * `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 '-'.
4979 pub fn patch(
4980 &self,
4981 request: EventTicketObject,
4982 resource_id: &str,
4983 ) -> EventticketobjectPatchCall<'a, C> {
4984 EventticketobjectPatchCall {
4985 hub: self.hub,
4986 _request: request,
4987 _resource_id: resource_id.to_string(),
4988 _delegate: Default::default(),
4989 _additional_params: Default::default(),
4990 _scopes: Default::default(),
4991 }
4992 }
4993
4994 /// Create a builder to help you perform the following task:
4995 ///
4996 /// Updates the event ticket object referenced by the given object ID.
4997 ///
4998 /// # Arguments
4999 ///
5000 /// * `request` - No description provided.
5001 /// * `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 '-'.
5002 pub fn update(
5003 &self,
5004 request: EventTicketObject,
5005 resource_id: &str,
5006 ) -> EventticketobjectUpdateCall<'a, C> {
5007 EventticketobjectUpdateCall {
5008 hub: self.hub,
5009 _request: request,
5010 _resource_id: resource_id.to_string(),
5011 _delegate: Default::default(),
5012 _additional_params: Default::default(),
5013 _scopes: Default::default(),
5014 }
5015 }
5016}
5017
5018/// A builder providing access to all methods supported on *flightclas* resources.
5019/// It is not used directly, but through the [`Walletobjects`] hub.
5020///
5021/// # Example
5022///
5023/// Instantiate a resource builder
5024///
5025/// ```test_harness,no_run
5026/// extern crate hyper;
5027/// extern crate hyper_rustls;
5028/// extern crate google_walletobjects1 as walletobjects1;
5029///
5030/// # async fn dox() {
5031/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5032///
5033/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5034/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5035/// secret,
5036/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5037/// ).build().await.unwrap();
5038///
5039/// let client = hyper_util::client::legacy::Client::builder(
5040/// hyper_util::rt::TokioExecutor::new()
5041/// )
5042/// .build(
5043/// hyper_rustls::HttpsConnectorBuilder::new()
5044/// .with_native_roots()
5045/// .unwrap()
5046/// .https_or_http()
5047/// .enable_http1()
5048/// .build()
5049/// );
5050/// let mut hub = Walletobjects::new(client, auth);
5051/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5052/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5053/// // to build up your call.
5054/// let rb = hub.flightclass();
5055/// # }
5056/// ```
5057pub struct FlightclasMethods<'a, C>
5058where
5059 C: 'a,
5060{
5061 hub: &'a Walletobjects<C>,
5062}
5063
5064impl<'a, C> common::MethodsBuilder for FlightclasMethods<'a, C> {}
5065
5066impl<'a, C> FlightclasMethods<'a, C> {
5067 /// Create a builder to help you perform the following task:
5068 ///
5069 /// Adds a message to the flight class referenced by the given class ID.
5070 ///
5071 /// # Arguments
5072 ///
5073 /// * `request` - No description provided.
5074 /// * `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 '-'.
5075 pub fn addmessage(
5076 &self,
5077 request: AddMessageRequest,
5078 resource_id: &str,
5079 ) -> FlightclasAddmessageCall<'a, C> {
5080 FlightclasAddmessageCall {
5081 hub: self.hub,
5082 _request: request,
5083 _resource_id: resource_id.to_string(),
5084 _delegate: Default::default(),
5085 _additional_params: Default::default(),
5086 _scopes: Default::default(),
5087 }
5088 }
5089
5090 /// Create a builder to help you perform the following task:
5091 ///
5092 /// Returns the flight class with the given class ID.
5093 ///
5094 /// # Arguments
5095 ///
5096 /// * `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 '-'.
5097 pub fn get(&self, resource_id: &str) -> FlightclasGetCall<'a, C> {
5098 FlightclasGetCall {
5099 hub: self.hub,
5100 _resource_id: resource_id.to_string(),
5101 _delegate: Default::default(),
5102 _additional_params: Default::default(),
5103 _scopes: Default::default(),
5104 }
5105 }
5106
5107 /// Create a builder to help you perform the following task:
5108 ///
5109 /// Inserts an flight class with the given ID and properties.
5110 ///
5111 /// # Arguments
5112 ///
5113 /// * `request` - No description provided.
5114 pub fn insert(&self, request: FlightClass) -> FlightclasInsertCall<'a, C> {
5115 FlightclasInsertCall {
5116 hub: self.hub,
5117 _request: request,
5118 _delegate: Default::default(),
5119 _additional_params: Default::default(),
5120 _scopes: Default::default(),
5121 }
5122 }
5123
5124 /// Create a builder to help you perform the following task:
5125 ///
5126 /// Returns a list of all flight classes for a given issuer ID.
5127 pub fn list(&self) -> FlightclasListCall<'a, C> {
5128 FlightclasListCall {
5129 hub: self.hub,
5130 _token: Default::default(),
5131 _max_results: Default::default(),
5132 _issuer_id: Default::default(),
5133 _delegate: Default::default(),
5134 _additional_params: Default::default(),
5135 _scopes: Default::default(),
5136 }
5137 }
5138
5139 /// Create a builder to help you perform the following task:
5140 ///
5141 /// Updates the flight class referenced by the given class ID. This method supports patch semantics.
5142 ///
5143 /// # Arguments
5144 ///
5145 /// * `request` - No description provided.
5146 /// * `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 '-'.
5147 pub fn patch(&self, request: FlightClass, resource_id: &str) -> FlightclasPatchCall<'a, C> {
5148 FlightclasPatchCall {
5149 hub: self.hub,
5150 _request: request,
5151 _resource_id: resource_id.to_string(),
5152 _delegate: Default::default(),
5153 _additional_params: Default::default(),
5154 _scopes: Default::default(),
5155 }
5156 }
5157
5158 /// Create a builder to help you perform the following task:
5159 ///
5160 /// Updates the flight class referenced by the given class ID.
5161 ///
5162 /// # Arguments
5163 ///
5164 /// * `request` - No description provided.
5165 /// * `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 '-'.
5166 pub fn update(&self, request: FlightClass, resource_id: &str) -> FlightclasUpdateCall<'a, C> {
5167 FlightclasUpdateCall {
5168 hub: self.hub,
5169 _request: request,
5170 _resource_id: resource_id.to_string(),
5171 _delegate: Default::default(),
5172 _additional_params: Default::default(),
5173 _scopes: Default::default(),
5174 }
5175 }
5176}
5177
5178/// A builder providing access to all methods supported on *flightobject* resources.
5179/// It is not used directly, but through the [`Walletobjects`] hub.
5180///
5181/// # Example
5182///
5183/// Instantiate a resource builder
5184///
5185/// ```test_harness,no_run
5186/// extern crate hyper;
5187/// extern crate hyper_rustls;
5188/// extern crate google_walletobjects1 as walletobjects1;
5189///
5190/// # async fn dox() {
5191/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5192///
5193/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5194/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5195/// secret,
5196/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5197/// ).build().await.unwrap();
5198///
5199/// let client = hyper_util::client::legacy::Client::builder(
5200/// hyper_util::rt::TokioExecutor::new()
5201/// )
5202/// .build(
5203/// hyper_rustls::HttpsConnectorBuilder::new()
5204/// .with_native_roots()
5205/// .unwrap()
5206/// .https_or_http()
5207/// .enable_http1()
5208/// .build()
5209/// );
5210/// let mut hub = Walletobjects::new(client, auth);
5211/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5212/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5213/// // to build up your call.
5214/// let rb = hub.flightobject();
5215/// # }
5216/// ```
5217pub struct FlightobjectMethods<'a, C>
5218where
5219 C: 'a,
5220{
5221 hub: &'a Walletobjects<C>,
5222}
5223
5224impl<'a, C> common::MethodsBuilder for FlightobjectMethods<'a, C> {}
5225
5226impl<'a, C> FlightobjectMethods<'a, C> {
5227 /// Create a builder to help you perform the following task:
5228 ///
5229 /// Adds a message to the flight object referenced by the given object ID.
5230 ///
5231 /// # Arguments
5232 ///
5233 /// * `request` - No description provided.
5234 /// * `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 '-'.
5235 pub fn addmessage(
5236 &self,
5237 request: AddMessageRequest,
5238 resource_id: &str,
5239 ) -> FlightobjectAddmessageCall<'a, C> {
5240 FlightobjectAddmessageCall {
5241 hub: self.hub,
5242 _request: request,
5243 _resource_id: resource_id.to_string(),
5244 _delegate: Default::default(),
5245 _additional_params: Default::default(),
5246 _scopes: Default::default(),
5247 }
5248 }
5249
5250 /// Create a builder to help you perform the following task:
5251 ///
5252 /// Returns the flight object with the given object ID.
5253 ///
5254 /// # Arguments
5255 ///
5256 /// * `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 '-'.
5257 pub fn get(&self, resource_id: &str) -> FlightobjectGetCall<'a, C> {
5258 FlightobjectGetCall {
5259 hub: self.hub,
5260 _resource_id: resource_id.to_string(),
5261 _delegate: Default::default(),
5262 _additional_params: Default::default(),
5263 _scopes: Default::default(),
5264 }
5265 }
5266
5267 /// Create a builder to help you perform the following task:
5268 ///
5269 /// Inserts an flight object with the given ID and properties.
5270 ///
5271 /// # Arguments
5272 ///
5273 /// * `request` - No description provided.
5274 pub fn insert(&self, request: FlightObject) -> FlightobjectInsertCall<'a, C> {
5275 FlightobjectInsertCall {
5276 hub: self.hub,
5277 _request: request,
5278 _delegate: Default::default(),
5279 _additional_params: Default::default(),
5280 _scopes: Default::default(),
5281 }
5282 }
5283
5284 /// Create a builder to help you perform the following task:
5285 ///
5286 /// Returns a list of all flight objects for a given issuer ID.
5287 pub fn list(&self) -> FlightobjectListCall<'a, C> {
5288 FlightobjectListCall {
5289 hub: self.hub,
5290 _token: Default::default(),
5291 _max_results: Default::default(),
5292 _class_id: Default::default(),
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 flight 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(&self, request: FlightObject, resource_id: &str) -> FlightobjectPatchCall<'a, C> {
5308 FlightobjectPatchCall {
5309 hub: self.hub,
5310 _request: request,
5311 _resource_id: resource_id.to_string(),
5312 _delegate: Default::default(),
5313 _additional_params: Default::default(),
5314 _scopes: Default::default(),
5315 }
5316 }
5317
5318 /// Create a builder to help you perform the following task:
5319 ///
5320 /// Updates the flight object referenced by the given object ID.
5321 ///
5322 /// # Arguments
5323 ///
5324 /// * `request` - No description provided.
5325 /// * `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 '-'.
5326 pub fn update(
5327 &self,
5328 request: FlightObject,
5329 resource_id: &str,
5330 ) -> FlightobjectUpdateCall<'a, C> {
5331 FlightobjectUpdateCall {
5332 hub: self.hub,
5333 _request: request,
5334 _resource_id: resource_id.to_string(),
5335 _delegate: Default::default(),
5336 _additional_params: Default::default(),
5337 _scopes: Default::default(),
5338 }
5339 }
5340}
5341
5342/// A builder providing access to all methods supported on *genericclas* resources.
5343/// It is not used directly, but through the [`Walletobjects`] hub.
5344///
5345/// # Example
5346///
5347/// Instantiate a resource builder
5348///
5349/// ```test_harness,no_run
5350/// extern crate hyper;
5351/// extern crate hyper_rustls;
5352/// extern crate google_walletobjects1 as walletobjects1;
5353///
5354/// # async fn dox() {
5355/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5356///
5357/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5358/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5359/// secret,
5360/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5361/// ).build().await.unwrap();
5362///
5363/// let client = hyper_util::client::legacy::Client::builder(
5364/// hyper_util::rt::TokioExecutor::new()
5365/// )
5366/// .build(
5367/// hyper_rustls::HttpsConnectorBuilder::new()
5368/// .with_native_roots()
5369/// .unwrap()
5370/// .https_or_http()
5371/// .enable_http1()
5372/// .build()
5373/// );
5374/// let mut hub = Walletobjects::new(client, auth);
5375/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5376/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5377/// // to build up your call.
5378/// let rb = hub.genericclass();
5379/// # }
5380/// ```
5381pub struct GenericclasMethods<'a, C>
5382where
5383 C: 'a,
5384{
5385 hub: &'a Walletobjects<C>,
5386}
5387
5388impl<'a, C> common::MethodsBuilder for GenericclasMethods<'a, C> {}
5389
5390impl<'a, C> GenericclasMethods<'a, C> {
5391 /// Create a builder to help you perform the following task:
5392 ///
5393 /// Adds a message to the generic class referenced by the given class ID.
5394 ///
5395 /// # Arguments
5396 ///
5397 /// * `request` - No description provided.
5398 /// * `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 '-'.
5399 pub fn addmessage(
5400 &self,
5401 request: AddMessageRequest,
5402 resource_id: &str,
5403 ) -> GenericclasAddmessageCall<'a, C> {
5404 GenericclasAddmessageCall {
5405 hub: self.hub,
5406 _request: request,
5407 _resource_id: resource_id.to_string(),
5408 _delegate: Default::default(),
5409 _additional_params: Default::default(),
5410 _scopes: Default::default(),
5411 }
5412 }
5413
5414 /// Create a builder to help you perform the following task:
5415 ///
5416 /// Returns the generic class with the given class ID.
5417 ///
5418 /// # Arguments
5419 ///
5420 /// * `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 `-`.
5421 pub fn get(&self, resource_id: &str) -> GenericclasGetCall<'a, C> {
5422 GenericclasGetCall {
5423 hub: self.hub,
5424 _resource_id: resource_id.to_string(),
5425 _delegate: Default::default(),
5426 _additional_params: Default::default(),
5427 _scopes: Default::default(),
5428 }
5429 }
5430
5431 /// Create a builder to help you perform the following task:
5432 ///
5433 /// Inserts a generic class with the given ID and properties.
5434 ///
5435 /// # Arguments
5436 ///
5437 /// * `request` - No description provided.
5438 pub fn insert(&self, request: GenericClass) -> GenericclasInsertCall<'a, C> {
5439 GenericclasInsertCall {
5440 hub: self.hub,
5441 _request: request,
5442 _delegate: Default::default(),
5443 _additional_params: Default::default(),
5444 _scopes: Default::default(),
5445 }
5446 }
5447
5448 /// Create a builder to help you perform the following task:
5449 ///
5450 /// Returns a list of all generic classes for a given issuer ID.
5451 pub fn list(&self) -> GenericclasListCall<'a, C> {
5452 GenericclasListCall {
5453 hub: self.hub,
5454 _token: Default::default(),
5455 _max_results: Default::default(),
5456 _issuer_id: Default::default(),
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 /// Updates the generic class referenced by the given class ID. This method supports patch semantics.
5466 ///
5467 /// # Arguments
5468 ///
5469 /// * `request` - No description provided.
5470 /// * `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 `-`.
5471 pub fn patch(&self, request: GenericClass, resource_id: &str) -> GenericclasPatchCall<'a, C> {
5472 GenericclasPatchCall {
5473 hub: self.hub,
5474 _request: request,
5475 _resource_id: resource_id.to_string(),
5476 _delegate: Default::default(),
5477 _additional_params: Default::default(),
5478 _scopes: Default::default(),
5479 }
5480 }
5481
5482 /// Create a builder to help you perform the following task:
5483 ///
5484 /// Updates the Generic class referenced by the given class ID.
5485 ///
5486 /// # Arguments
5487 ///
5488 /// * `request` - No description provided.
5489 /// * `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 `-`.
5490 pub fn update(&self, request: GenericClass, resource_id: &str) -> GenericclasUpdateCall<'a, C> {
5491 GenericclasUpdateCall {
5492 hub: self.hub,
5493 _request: request,
5494 _resource_id: resource_id.to_string(),
5495 _delegate: Default::default(),
5496 _additional_params: Default::default(),
5497 _scopes: Default::default(),
5498 }
5499 }
5500}
5501
5502/// A builder providing access to all methods supported on *genericobject* resources.
5503/// It is not used directly, but through the [`Walletobjects`] hub.
5504///
5505/// # Example
5506///
5507/// Instantiate a resource builder
5508///
5509/// ```test_harness,no_run
5510/// extern crate hyper;
5511/// extern crate hyper_rustls;
5512/// extern crate google_walletobjects1 as walletobjects1;
5513///
5514/// # async fn dox() {
5515/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5516///
5517/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5518/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5519/// secret,
5520/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5521/// ).build().await.unwrap();
5522///
5523/// let client = hyper_util::client::legacy::Client::builder(
5524/// hyper_util::rt::TokioExecutor::new()
5525/// )
5526/// .build(
5527/// hyper_rustls::HttpsConnectorBuilder::new()
5528/// .with_native_roots()
5529/// .unwrap()
5530/// .https_or_http()
5531/// .enable_http1()
5532/// .build()
5533/// );
5534/// let mut hub = Walletobjects::new(client, auth);
5535/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5536/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5537/// // to build up your call.
5538/// let rb = hub.genericobject();
5539/// # }
5540/// ```
5541pub struct GenericobjectMethods<'a, C>
5542where
5543 C: 'a,
5544{
5545 hub: &'a Walletobjects<C>,
5546}
5547
5548impl<'a, C> common::MethodsBuilder for GenericobjectMethods<'a, C> {}
5549
5550impl<'a, C> GenericobjectMethods<'a, C> {
5551 /// Create a builder to help you perform the following task:
5552 ///
5553 /// Adds a message to the generic object referenced by the given object ID.
5554 ///
5555 /// # Arguments
5556 ///
5557 /// * `request` - No description provided.
5558 /// * `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 '-'.
5559 pub fn addmessage(
5560 &self,
5561 request: AddMessageRequest,
5562 resource_id: &str,
5563 ) -> GenericobjectAddmessageCall<'a, C> {
5564 GenericobjectAddmessageCall {
5565 hub: self.hub,
5566 _request: request,
5567 _resource_id: resource_id.to_string(),
5568 _delegate: Default::default(),
5569 _additional_params: Default::default(),
5570 _scopes: Default::default(),
5571 }
5572 }
5573
5574 /// Create a builder to help you perform the following task:
5575 ///
5576 /// Returns the generic object with the given object ID.
5577 ///
5578 /// # Arguments
5579 ///
5580 /// * `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 `-`.
5581 pub fn get(&self, resource_id: &str) -> GenericobjectGetCall<'a, C> {
5582 GenericobjectGetCall {
5583 hub: self.hub,
5584 _resource_id: resource_id.to_string(),
5585 _delegate: Default::default(),
5586 _additional_params: Default::default(),
5587 _scopes: Default::default(),
5588 }
5589 }
5590
5591 /// Create a builder to help you perform the following task:
5592 ///
5593 /// Inserts a generic object with the given ID and properties.
5594 ///
5595 /// # Arguments
5596 ///
5597 /// * `request` - No description provided.
5598 pub fn insert(&self, request: GenericObject) -> GenericobjectInsertCall<'a, C> {
5599 GenericobjectInsertCall {
5600 hub: self.hub,
5601 _request: request,
5602 _delegate: Default::default(),
5603 _additional_params: Default::default(),
5604 _scopes: Default::default(),
5605 }
5606 }
5607
5608 /// Create a builder to help you perform the following task:
5609 ///
5610 /// Returns a list of all generic objects for a given issuer ID.
5611 pub fn list(&self) -> GenericobjectListCall<'a, C> {
5612 GenericobjectListCall {
5613 hub: self.hub,
5614 _token: Default::default(),
5615 _max_results: Default::default(),
5616 _class_id: Default::default(),
5617 _delegate: Default::default(),
5618 _additional_params: Default::default(),
5619 _scopes: Default::default(),
5620 }
5621 }
5622
5623 /// Create a builder to help you perform the following task:
5624 ///
5625 /// Updates the generic object referenced by the given object ID. This method supports patch semantics.
5626 ///
5627 /// # Arguments
5628 ///
5629 /// * `request` - No description provided.
5630 /// * `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 `-`.
5631 pub fn patch(
5632 &self,
5633 request: GenericObject,
5634 resource_id: &str,
5635 ) -> GenericobjectPatchCall<'a, C> {
5636 GenericobjectPatchCall {
5637 hub: self.hub,
5638 _request: request,
5639 _resource_id: resource_id.to_string(),
5640 _delegate: Default::default(),
5641 _additional_params: Default::default(),
5642 _scopes: Default::default(),
5643 }
5644 }
5645
5646 /// Create a builder to help you perform the following task:
5647 ///
5648 /// Updates the generic object referenced by the given object ID.
5649 ///
5650 /// # Arguments
5651 ///
5652 /// * `request` - No description provided.
5653 /// * `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 `-`.
5654 pub fn update(
5655 &self,
5656 request: GenericObject,
5657 resource_id: &str,
5658 ) -> GenericobjectUpdateCall<'a, C> {
5659 GenericobjectUpdateCall {
5660 hub: self.hub,
5661 _request: request,
5662 _resource_id: resource_id.to_string(),
5663 _delegate: Default::default(),
5664 _additional_params: Default::default(),
5665 _scopes: Default::default(),
5666 }
5667 }
5668}
5669
5670/// A builder providing access to all methods supported on *giftcardclas* resources.
5671/// It is not used directly, but through the [`Walletobjects`] hub.
5672///
5673/// # Example
5674///
5675/// Instantiate a resource builder
5676///
5677/// ```test_harness,no_run
5678/// extern crate hyper;
5679/// extern crate hyper_rustls;
5680/// extern crate google_walletobjects1 as walletobjects1;
5681///
5682/// # async fn dox() {
5683/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5684///
5685/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5686/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5687/// secret,
5688/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5689/// ).build().await.unwrap();
5690///
5691/// let client = hyper_util::client::legacy::Client::builder(
5692/// hyper_util::rt::TokioExecutor::new()
5693/// )
5694/// .build(
5695/// hyper_rustls::HttpsConnectorBuilder::new()
5696/// .with_native_roots()
5697/// .unwrap()
5698/// .https_or_http()
5699/// .enable_http1()
5700/// .build()
5701/// );
5702/// let mut hub = Walletobjects::new(client, auth);
5703/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5704/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5705/// // to build up your call.
5706/// let rb = hub.giftcardclass();
5707/// # }
5708/// ```
5709pub struct GiftcardclasMethods<'a, C>
5710where
5711 C: 'a,
5712{
5713 hub: &'a Walletobjects<C>,
5714}
5715
5716impl<'a, C> common::MethodsBuilder for GiftcardclasMethods<'a, C> {}
5717
5718impl<'a, C> GiftcardclasMethods<'a, C> {
5719 /// Create a builder to help you perform the following task:
5720 ///
5721 /// Adds a message to the gift card class referenced by the given class ID.
5722 ///
5723 /// # Arguments
5724 ///
5725 /// * `request` - No description provided.
5726 /// * `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 '-'.
5727 pub fn addmessage(
5728 &self,
5729 request: AddMessageRequest,
5730 resource_id: &str,
5731 ) -> GiftcardclasAddmessageCall<'a, C> {
5732 GiftcardclasAddmessageCall {
5733 hub: self.hub,
5734 _request: request,
5735 _resource_id: resource_id.to_string(),
5736 _delegate: Default::default(),
5737 _additional_params: Default::default(),
5738 _scopes: Default::default(),
5739 }
5740 }
5741
5742 /// Create a builder to help you perform the following task:
5743 ///
5744 /// Returns the gift card class with the given class ID.
5745 ///
5746 /// # Arguments
5747 ///
5748 /// * `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 '-'.
5749 pub fn get(&self, resource_id: &str) -> GiftcardclasGetCall<'a, C> {
5750 GiftcardclasGetCall {
5751 hub: self.hub,
5752 _resource_id: resource_id.to_string(),
5753 _delegate: Default::default(),
5754 _additional_params: Default::default(),
5755 _scopes: Default::default(),
5756 }
5757 }
5758
5759 /// Create a builder to help you perform the following task:
5760 ///
5761 /// Inserts an gift card class with the given ID and properties.
5762 ///
5763 /// # Arguments
5764 ///
5765 /// * `request` - No description provided.
5766 pub fn insert(&self, request: GiftCardClass) -> GiftcardclasInsertCall<'a, C> {
5767 GiftcardclasInsertCall {
5768 hub: self.hub,
5769 _request: request,
5770 _delegate: Default::default(),
5771 _additional_params: Default::default(),
5772 _scopes: Default::default(),
5773 }
5774 }
5775
5776 /// Create a builder to help you perform the following task:
5777 ///
5778 /// Returns a list of all gift card classes for a given issuer ID.
5779 pub fn list(&self) -> GiftcardclasListCall<'a, C> {
5780 GiftcardclasListCall {
5781 hub: self.hub,
5782 _token: Default::default(),
5783 _max_results: Default::default(),
5784 _issuer_id: Default::default(),
5785 _delegate: Default::default(),
5786 _additional_params: Default::default(),
5787 _scopes: Default::default(),
5788 }
5789 }
5790
5791 /// Create a builder to help you perform the following task:
5792 ///
5793 /// Updates the gift card class referenced by the given class ID. This method supports patch semantics.
5794 ///
5795 /// # Arguments
5796 ///
5797 /// * `request` - No description provided.
5798 /// * `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 '-'.
5799 pub fn patch(&self, request: GiftCardClass, resource_id: &str) -> GiftcardclasPatchCall<'a, C> {
5800 GiftcardclasPatchCall {
5801 hub: self.hub,
5802 _request: request,
5803 _resource_id: resource_id.to_string(),
5804 _delegate: Default::default(),
5805 _additional_params: Default::default(),
5806 _scopes: Default::default(),
5807 }
5808 }
5809
5810 /// Create a builder to help you perform the following task:
5811 ///
5812 /// Updates the gift card class referenced by the given class ID.
5813 ///
5814 /// # Arguments
5815 ///
5816 /// * `request` - No description provided.
5817 /// * `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 '-'.
5818 pub fn update(
5819 &self,
5820 request: GiftCardClass,
5821 resource_id: &str,
5822 ) -> GiftcardclasUpdateCall<'a, C> {
5823 GiftcardclasUpdateCall {
5824 hub: self.hub,
5825 _request: request,
5826 _resource_id: resource_id.to_string(),
5827 _delegate: Default::default(),
5828 _additional_params: Default::default(),
5829 _scopes: Default::default(),
5830 }
5831 }
5832}
5833
5834/// A builder providing access to all methods supported on *giftcardobject* resources.
5835/// It is not used directly, but through the [`Walletobjects`] hub.
5836///
5837/// # Example
5838///
5839/// Instantiate a resource builder
5840///
5841/// ```test_harness,no_run
5842/// extern crate hyper;
5843/// extern crate hyper_rustls;
5844/// extern crate google_walletobjects1 as walletobjects1;
5845///
5846/// # async fn dox() {
5847/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5848///
5849/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5850/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5851/// secret,
5852/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5853/// ).build().await.unwrap();
5854///
5855/// let client = hyper_util::client::legacy::Client::builder(
5856/// hyper_util::rt::TokioExecutor::new()
5857/// )
5858/// .build(
5859/// hyper_rustls::HttpsConnectorBuilder::new()
5860/// .with_native_roots()
5861/// .unwrap()
5862/// .https_or_http()
5863/// .enable_http1()
5864/// .build()
5865/// );
5866/// let mut hub = Walletobjects::new(client, auth);
5867/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5868/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
5869/// // to build up your call.
5870/// let rb = hub.giftcardobject();
5871/// # }
5872/// ```
5873pub struct GiftcardobjectMethods<'a, C>
5874where
5875 C: 'a,
5876{
5877 hub: &'a Walletobjects<C>,
5878}
5879
5880impl<'a, C> common::MethodsBuilder for GiftcardobjectMethods<'a, C> {}
5881
5882impl<'a, C> GiftcardobjectMethods<'a, C> {
5883 /// Create a builder to help you perform the following task:
5884 ///
5885 /// Adds a message to the gift card object referenced by the given object ID.
5886 ///
5887 /// # Arguments
5888 ///
5889 /// * `request` - No description provided.
5890 /// * `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 '-'.
5891 pub fn addmessage(
5892 &self,
5893 request: AddMessageRequest,
5894 resource_id: &str,
5895 ) -> GiftcardobjectAddmessageCall<'a, C> {
5896 GiftcardobjectAddmessageCall {
5897 hub: self.hub,
5898 _request: request,
5899 _resource_id: resource_id.to_string(),
5900 _delegate: Default::default(),
5901 _additional_params: Default::default(),
5902 _scopes: Default::default(),
5903 }
5904 }
5905
5906 /// Create a builder to help you perform the following task:
5907 ///
5908 /// Returns the gift card object with the given object ID.
5909 ///
5910 /// # Arguments
5911 ///
5912 /// * `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 '-'.
5913 pub fn get(&self, resource_id: &str) -> GiftcardobjectGetCall<'a, C> {
5914 GiftcardobjectGetCall {
5915 hub: self.hub,
5916 _resource_id: resource_id.to_string(),
5917 _delegate: Default::default(),
5918 _additional_params: Default::default(),
5919 _scopes: Default::default(),
5920 }
5921 }
5922
5923 /// Create a builder to help you perform the following task:
5924 ///
5925 /// Inserts an gift card object with the given ID and properties.
5926 ///
5927 /// # Arguments
5928 ///
5929 /// * `request` - No description provided.
5930 pub fn insert(&self, request: GiftCardObject) -> GiftcardobjectInsertCall<'a, C> {
5931 GiftcardobjectInsertCall {
5932 hub: self.hub,
5933 _request: request,
5934 _delegate: Default::default(),
5935 _additional_params: Default::default(),
5936 _scopes: Default::default(),
5937 }
5938 }
5939
5940 /// Create a builder to help you perform the following task:
5941 ///
5942 /// Returns a list of all gift card objects for a given issuer ID.
5943 pub fn list(&self) -> GiftcardobjectListCall<'a, C> {
5944 GiftcardobjectListCall {
5945 hub: self.hub,
5946 _token: Default::default(),
5947 _max_results: Default::default(),
5948 _class_id: Default::default(),
5949 _delegate: Default::default(),
5950 _additional_params: Default::default(),
5951 _scopes: Default::default(),
5952 }
5953 }
5954
5955 /// Create a builder to help you perform the following task:
5956 ///
5957 /// Updates the gift card object referenced by the given object ID. This method supports patch semantics.
5958 ///
5959 /// # Arguments
5960 ///
5961 /// * `request` - No description provided.
5962 /// * `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 '-'.
5963 pub fn patch(
5964 &self,
5965 request: GiftCardObject,
5966 resource_id: &str,
5967 ) -> GiftcardobjectPatchCall<'a, C> {
5968 GiftcardobjectPatchCall {
5969 hub: self.hub,
5970 _request: request,
5971 _resource_id: resource_id.to_string(),
5972 _delegate: Default::default(),
5973 _additional_params: Default::default(),
5974 _scopes: Default::default(),
5975 }
5976 }
5977
5978 /// Create a builder to help you perform the following task:
5979 ///
5980 /// Updates the gift card object referenced by the given object ID.
5981 ///
5982 /// # Arguments
5983 ///
5984 /// * `request` - No description provided.
5985 /// * `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 '-'.
5986 pub fn update(
5987 &self,
5988 request: GiftCardObject,
5989 resource_id: &str,
5990 ) -> GiftcardobjectUpdateCall<'a, C> {
5991 GiftcardobjectUpdateCall {
5992 hub: self.hub,
5993 _request: request,
5994 _resource_id: resource_id.to_string(),
5995 _delegate: Default::default(),
5996 _additional_params: Default::default(),
5997 _scopes: Default::default(),
5998 }
5999 }
6000}
6001
6002/// A builder providing access to all methods supported on *issuer* resources.
6003/// It is not used directly, but through the [`Walletobjects`] hub.
6004///
6005/// # Example
6006///
6007/// Instantiate a resource builder
6008///
6009/// ```test_harness,no_run
6010/// extern crate hyper;
6011/// extern crate hyper_rustls;
6012/// extern crate google_walletobjects1 as walletobjects1;
6013///
6014/// # async fn dox() {
6015/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6016///
6017/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6018/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6019/// secret,
6020/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6021/// ).build().await.unwrap();
6022///
6023/// let client = hyper_util::client::legacy::Client::builder(
6024/// hyper_util::rt::TokioExecutor::new()
6025/// )
6026/// .build(
6027/// hyper_rustls::HttpsConnectorBuilder::new()
6028/// .with_native_roots()
6029/// .unwrap()
6030/// .https_or_http()
6031/// .enable_http1()
6032/// .build()
6033/// );
6034/// let mut hub = Walletobjects::new(client, auth);
6035/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6036/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
6037/// // to build up your call.
6038/// let rb = hub.issuer();
6039/// # }
6040/// ```
6041pub struct IssuerMethods<'a, C>
6042where
6043 C: 'a,
6044{
6045 hub: &'a Walletobjects<C>,
6046}
6047
6048impl<'a, C> common::MethodsBuilder for IssuerMethods<'a, C> {}
6049
6050impl<'a, C> IssuerMethods<'a, C> {
6051 /// Create a builder to help you perform the following task:
6052 ///
6053 /// Returns the issuer with the given issuer ID.
6054 ///
6055 /// # Arguments
6056 ///
6057 /// * `resourceId` - The unique identifier for an issuer.
6058 pub fn get(&self, resource_id: i64) -> IssuerGetCall<'a, C> {
6059 IssuerGetCall {
6060 hub: self.hub,
6061 _resource_id: resource_id,
6062 _delegate: Default::default(),
6063 _additional_params: Default::default(),
6064 _scopes: Default::default(),
6065 }
6066 }
6067
6068 /// Create a builder to help you perform the following task:
6069 ///
6070 /// Inserts an issuer with the given ID and properties.
6071 ///
6072 /// # Arguments
6073 ///
6074 /// * `request` - No description provided.
6075 pub fn insert(&self, request: Issuer) -> IssuerInsertCall<'a, C> {
6076 IssuerInsertCall {
6077 hub: self.hub,
6078 _request: request,
6079 _delegate: Default::default(),
6080 _additional_params: Default::default(),
6081 _scopes: Default::default(),
6082 }
6083 }
6084
6085 /// Create a builder to help you perform the following task:
6086 ///
6087 /// Returns a list of all issuers shared to the caller.
6088 pub fn list(&self) -> IssuerListCall<'a, C> {
6089 IssuerListCall {
6090 hub: self.hub,
6091 _delegate: Default::default(),
6092 _additional_params: Default::default(),
6093 _scopes: Default::default(),
6094 }
6095 }
6096
6097 /// Create a builder to help you perform the following task:
6098 ///
6099 /// Updates the issuer referenced by the given issuer ID. This method supports patch semantics.
6100 ///
6101 /// # Arguments
6102 ///
6103 /// * `request` - No description provided.
6104 /// * `resourceId` - The unique identifier for an issuer.
6105 pub fn patch(&self, request: Issuer, resource_id: i64) -> IssuerPatchCall<'a, C> {
6106 IssuerPatchCall {
6107 hub: self.hub,
6108 _request: request,
6109 _resource_id: resource_id,
6110 _delegate: Default::default(),
6111 _additional_params: Default::default(),
6112 _scopes: Default::default(),
6113 }
6114 }
6115
6116 /// Create a builder to help you perform the following task:
6117 ///
6118 /// Updates the issuer referenced by the given issuer ID.
6119 ///
6120 /// # Arguments
6121 ///
6122 /// * `request` - No description provided.
6123 /// * `resourceId` - The unique identifier for an issuer.
6124 pub fn update(&self, request: Issuer, resource_id: i64) -> IssuerUpdateCall<'a, C> {
6125 IssuerUpdateCall {
6126 hub: self.hub,
6127 _request: request,
6128 _resource_id: resource_id,
6129 _delegate: Default::default(),
6130 _additional_params: Default::default(),
6131 _scopes: Default::default(),
6132 }
6133 }
6134}
6135
6136/// A builder providing access to all methods supported on *jwt* resources.
6137/// It is not used directly, but through the [`Walletobjects`] hub.
6138///
6139/// # Example
6140///
6141/// Instantiate a resource builder
6142///
6143/// ```test_harness,no_run
6144/// extern crate hyper;
6145/// extern crate hyper_rustls;
6146/// extern crate google_walletobjects1 as walletobjects1;
6147///
6148/// # async fn dox() {
6149/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6150///
6151/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6152/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6153/// secret,
6154/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6155/// ).build().await.unwrap();
6156///
6157/// let client = hyper_util::client::legacy::Client::builder(
6158/// hyper_util::rt::TokioExecutor::new()
6159/// )
6160/// .build(
6161/// hyper_rustls::HttpsConnectorBuilder::new()
6162/// .with_native_roots()
6163/// .unwrap()
6164/// .https_or_http()
6165/// .enable_http1()
6166/// .build()
6167/// );
6168/// let mut hub = Walletobjects::new(client, auth);
6169/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6170/// // like `insert(...)`
6171/// // to build up your call.
6172/// let rb = hub.jwt();
6173/// # }
6174/// ```
6175pub struct JwtMethods<'a, C>
6176where
6177 C: 'a,
6178{
6179 hub: &'a Walletobjects<C>,
6180}
6181
6182impl<'a, C> common::MethodsBuilder for JwtMethods<'a, C> {}
6183
6184impl<'a, C> JwtMethods<'a, C> {
6185 /// Create a builder to help you perform the following task:
6186 ///
6187 /// Inserts the resources in the JWT.
6188 ///
6189 /// # Arguments
6190 ///
6191 /// * `request` - No description provided.
6192 pub fn insert(&self, request: JwtResource) -> JwtInsertCall<'a, C> {
6193 JwtInsertCall {
6194 hub: self.hub,
6195 _request: request,
6196 _delegate: Default::default(),
6197 _additional_params: Default::default(),
6198 _scopes: Default::default(),
6199 }
6200 }
6201}
6202
6203/// A builder providing access to all methods supported on *loyaltyclas* resources.
6204/// It is not used directly, but through the [`Walletobjects`] hub.
6205///
6206/// # Example
6207///
6208/// Instantiate a resource builder
6209///
6210/// ```test_harness,no_run
6211/// extern crate hyper;
6212/// extern crate hyper_rustls;
6213/// extern crate google_walletobjects1 as walletobjects1;
6214///
6215/// # async fn dox() {
6216/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6217///
6218/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6219/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6220/// secret,
6221/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6222/// ).build().await.unwrap();
6223///
6224/// let client = hyper_util::client::legacy::Client::builder(
6225/// hyper_util::rt::TokioExecutor::new()
6226/// )
6227/// .build(
6228/// hyper_rustls::HttpsConnectorBuilder::new()
6229/// .with_native_roots()
6230/// .unwrap()
6231/// .https_or_http()
6232/// .enable_http1()
6233/// .build()
6234/// );
6235/// let mut hub = Walletobjects::new(client, auth);
6236/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6237/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
6238/// // to build up your call.
6239/// let rb = hub.loyaltyclass();
6240/// # }
6241/// ```
6242pub struct LoyaltyclasMethods<'a, C>
6243where
6244 C: 'a,
6245{
6246 hub: &'a Walletobjects<C>,
6247}
6248
6249impl<'a, C> common::MethodsBuilder for LoyaltyclasMethods<'a, C> {}
6250
6251impl<'a, C> LoyaltyclasMethods<'a, C> {
6252 /// Create a builder to help you perform the following task:
6253 ///
6254 /// Adds a message to the loyalty class referenced by the given class ID.
6255 ///
6256 /// # Arguments
6257 ///
6258 /// * `request` - No description provided.
6259 /// * `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 '-'.
6260 pub fn addmessage(
6261 &self,
6262 request: AddMessageRequest,
6263 resource_id: &str,
6264 ) -> LoyaltyclasAddmessageCall<'a, C> {
6265 LoyaltyclasAddmessageCall {
6266 hub: self.hub,
6267 _request: request,
6268 _resource_id: resource_id.to_string(),
6269 _delegate: Default::default(),
6270 _additional_params: Default::default(),
6271 _scopes: Default::default(),
6272 }
6273 }
6274
6275 /// Create a builder to help you perform the following task:
6276 ///
6277 /// Returns the loyalty class with the given class ID.
6278 ///
6279 /// # Arguments
6280 ///
6281 /// * `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 '-'.
6282 pub fn get(&self, resource_id: &str) -> LoyaltyclasGetCall<'a, C> {
6283 LoyaltyclasGetCall {
6284 hub: self.hub,
6285 _resource_id: resource_id.to_string(),
6286 _delegate: Default::default(),
6287 _additional_params: Default::default(),
6288 _scopes: Default::default(),
6289 }
6290 }
6291
6292 /// Create a builder to help you perform the following task:
6293 ///
6294 /// Inserts an loyalty class with the given ID and properties.
6295 ///
6296 /// # Arguments
6297 ///
6298 /// * `request` - No description provided.
6299 pub fn insert(&self, request: LoyaltyClass) -> LoyaltyclasInsertCall<'a, C> {
6300 LoyaltyclasInsertCall {
6301 hub: self.hub,
6302 _request: request,
6303 _delegate: Default::default(),
6304 _additional_params: Default::default(),
6305 _scopes: Default::default(),
6306 }
6307 }
6308
6309 /// Create a builder to help you perform the following task:
6310 ///
6311 /// Returns a list of all loyalty classes for a given issuer ID.
6312 pub fn list(&self) -> LoyaltyclasListCall<'a, C> {
6313 LoyaltyclasListCall {
6314 hub: self.hub,
6315 _token: Default::default(),
6316 _max_results: Default::default(),
6317 _issuer_id: Default::default(),
6318 _delegate: Default::default(),
6319 _additional_params: Default::default(),
6320 _scopes: Default::default(),
6321 }
6322 }
6323
6324 /// Create a builder to help you perform the following task:
6325 ///
6326 /// Updates the loyalty class referenced by the given class ID. This method supports patch semantics.
6327 ///
6328 /// # Arguments
6329 ///
6330 /// * `request` - No description provided.
6331 /// * `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 '-'.
6332 pub fn patch(&self, request: LoyaltyClass, resource_id: &str) -> LoyaltyclasPatchCall<'a, C> {
6333 LoyaltyclasPatchCall {
6334 hub: self.hub,
6335 _request: request,
6336 _resource_id: resource_id.to_string(),
6337 _delegate: Default::default(),
6338 _additional_params: Default::default(),
6339 _scopes: Default::default(),
6340 }
6341 }
6342
6343 /// Create a builder to help you perform the following task:
6344 ///
6345 /// Updates the loyalty class referenced by the given class ID.
6346 ///
6347 /// # Arguments
6348 ///
6349 /// * `request` - No description provided.
6350 /// * `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 '-'.
6351 pub fn update(&self, request: LoyaltyClass, resource_id: &str) -> LoyaltyclasUpdateCall<'a, C> {
6352 LoyaltyclasUpdateCall {
6353 hub: self.hub,
6354 _request: request,
6355 _resource_id: resource_id.to_string(),
6356 _delegate: Default::default(),
6357 _additional_params: Default::default(),
6358 _scopes: Default::default(),
6359 }
6360 }
6361}
6362
6363/// A builder providing access to all methods supported on *loyaltyobject* resources.
6364/// It is not used directly, but through the [`Walletobjects`] hub.
6365///
6366/// # Example
6367///
6368/// Instantiate a resource builder
6369///
6370/// ```test_harness,no_run
6371/// extern crate hyper;
6372/// extern crate hyper_rustls;
6373/// extern crate google_walletobjects1 as walletobjects1;
6374///
6375/// # async fn dox() {
6376/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6377///
6378/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6379/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6380/// secret,
6381/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6382/// ).build().await.unwrap();
6383///
6384/// let client = hyper_util::client::legacy::Client::builder(
6385/// hyper_util::rt::TokioExecutor::new()
6386/// )
6387/// .build(
6388/// hyper_rustls::HttpsConnectorBuilder::new()
6389/// .with_native_roots()
6390/// .unwrap()
6391/// .https_or_http()
6392/// .enable_http1()
6393/// .build()
6394/// );
6395/// let mut hub = Walletobjects::new(client, auth);
6396/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6397/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `modifylinkedofferobjects(...)`, `patch(...)` and `update(...)`
6398/// // to build up your call.
6399/// let rb = hub.loyaltyobject();
6400/// # }
6401/// ```
6402pub struct LoyaltyobjectMethods<'a, C>
6403where
6404 C: 'a,
6405{
6406 hub: &'a Walletobjects<C>,
6407}
6408
6409impl<'a, C> common::MethodsBuilder for LoyaltyobjectMethods<'a, C> {}
6410
6411impl<'a, C> LoyaltyobjectMethods<'a, C> {
6412 /// Create a builder to help you perform the following task:
6413 ///
6414 /// Adds a message to the loyalty object referenced by the given object ID.
6415 ///
6416 /// # Arguments
6417 ///
6418 /// * `request` - No description provided.
6419 /// * `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 '-'.
6420 pub fn addmessage(
6421 &self,
6422 request: AddMessageRequest,
6423 resource_id: &str,
6424 ) -> LoyaltyobjectAddmessageCall<'a, C> {
6425 LoyaltyobjectAddmessageCall {
6426 hub: self.hub,
6427 _request: request,
6428 _resource_id: resource_id.to_string(),
6429 _delegate: Default::default(),
6430 _additional_params: Default::default(),
6431 _scopes: Default::default(),
6432 }
6433 }
6434
6435 /// Create a builder to help you perform the following task:
6436 ///
6437 /// Returns the loyalty object with the given object ID.
6438 ///
6439 /// # Arguments
6440 ///
6441 /// * `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 '-'.
6442 pub fn get(&self, resource_id: &str) -> LoyaltyobjectGetCall<'a, C> {
6443 LoyaltyobjectGetCall {
6444 hub: self.hub,
6445 _resource_id: resource_id.to_string(),
6446 _delegate: Default::default(),
6447 _additional_params: Default::default(),
6448 _scopes: Default::default(),
6449 }
6450 }
6451
6452 /// Create a builder to help you perform the following task:
6453 ///
6454 /// Inserts an loyalty object with the given ID and properties.
6455 ///
6456 /// # Arguments
6457 ///
6458 /// * `request` - No description provided.
6459 pub fn insert(&self, request: LoyaltyObject) -> LoyaltyobjectInsertCall<'a, C> {
6460 LoyaltyobjectInsertCall {
6461 hub: self.hub,
6462 _request: request,
6463 _delegate: Default::default(),
6464 _additional_params: Default::default(),
6465 _scopes: Default::default(),
6466 }
6467 }
6468
6469 /// Create a builder to help you perform the following task:
6470 ///
6471 /// Returns a list of all loyalty objects for a given issuer ID.
6472 pub fn list(&self) -> LoyaltyobjectListCall<'a, C> {
6473 LoyaltyobjectListCall {
6474 hub: self.hub,
6475 _token: Default::default(),
6476 _max_results: Default::default(),
6477 _class_id: Default::default(),
6478 _delegate: Default::default(),
6479 _additional_params: Default::default(),
6480 _scopes: Default::default(),
6481 }
6482 }
6483
6484 /// Create a builder to help you perform the following task:
6485 ///
6486 /// Modifies linked offer objects for the loyalty object with the given ID.
6487 ///
6488 /// # Arguments
6489 ///
6490 /// * `request` - No description provided.
6491 /// * `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 '-'.
6492 pub fn modifylinkedofferobjects(
6493 &self,
6494 request: ModifyLinkedOfferObjectsRequest,
6495 resource_id: &str,
6496 ) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
6497 LoyaltyobjectModifylinkedofferobjectCall {
6498 hub: self.hub,
6499 _request: request,
6500 _resource_id: resource_id.to_string(),
6501 _delegate: Default::default(),
6502 _additional_params: Default::default(),
6503 _scopes: Default::default(),
6504 }
6505 }
6506
6507 /// Create a builder to help you perform the following task:
6508 ///
6509 /// Updates the loyalty object referenced by the given object ID. This method supports patch semantics.
6510 ///
6511 /// # Arguments
6512 ///
6513 /// * `request` - No description provided.
6514 /// * `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 '-'.
6515 pub fn patch(
6516 &self,
6517 request: LoyaltyObject,
6518 resource_id: &str,
6519 ) -> LoyaltyobjectPatchCall<'a, C> {
6520 LoyaltyobjectPatchCall {
6521 hub: self.hub,
6522 _request: request,
6523 _resource_id: resource_id.to_string(),
6524 _delegate: Default::default(),
6525 _additional_params: Default::default(),
6526 _scopes: Default::default(),
6527 }
6528 }
6529
6530 /// Create a builder to help you perform the following task:
6531 ///
6532 /// Updates the loyalty object referenced by the given object ID.
6533 ///
6534 /// # Arguments
6535 ///
6536 /// * `request` - No description provided.
6537 /// * `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 '-'.
6538 pub fn update(
6539 &self,
6540 request: LoyaltyObject,
6541 resource_id: &str,
6542 ) -> LoyaltyobjectUpdateCall<'a, C> {
6543 LoyaltyobjectUpdateCall {
6544 hub: self.hub,
6545 _request: request,
6546 _resource_id: resource_id.to_string(),
6547 _delegate: Default::default(),
6548 _additional_params: Default::default(),
6549 _scopes: Default::default(),
6550 }
6551 }
6552}
6553
6554/// A builder providing access to all methods supported on *media* resources.
6555/// It is not used directly, but through the [`Walletobjects`] hub.
6556///
6557/// # Example
6558///
6559/// Instantiate a resource builder
6560///
6561/// ```test_harness,no_run
6562/// extern crate hyper;
6563/// extern crate hyper_rustls;
6564/// extern crate google_walletobjects1 as walletobjects1;
6565///
6566/// # async fn dox() {
6567/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6568///
6569/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6570/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6571/// secret,
6572/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6573/// ).build().await.unwrap();
6574///
6575/// let client = hyper_util::client::legacy::Client::builder(
6576/// hyper_util::rt::TokioExecutor::new()
6577/// )
6578/// .build(
6579/// hyper_rustls::HttpsConnectorBuilder::new()
6580/// .with_native_roots()
6581/// .unwrap()
6582/// .https_or_http()
6583/// .enable_http1()
6584/// .build()
6585/// );
6586/// let mut hub = Walletobjects::new(client, auth);
6587/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6588/// // like `download(...)` and `upload(...)`
6589/// // to build up your call.
6590/// let rb = hub.media();
6591/// # }
6592/// ```
6593pub struct MediaMethods<'a, C>
6594where
6595 C: 'a,
6596{
6597 hub: &'a Walletobjects<C>,
6598}
6599
6600impl<'a, C> common::MethodsBuilder for MediaMethods<'a, C> {}
6601
6602impl<'a, C> MediaMethods<'a, C> {
6603 /// Create a builder to help you perform the following task:
6604 ///
6605 /// Downloads rotating barcode values for the transit object referenced by the given object ID.
6606 ///
6607 /// # Arguments
6608 ///
6609 /// * `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 '-'.
6610 pub fn download(&self, resource_id: &str) -> MediaDownloadCall<'a, C> {
6611 MediaDownloadCall {
6612 hub: self.hub,
6613 _resource_id: resource_id.to_string(),
6614 _delegate: Default::default(),
6615 _additional_params: Default::default(),
6616 _scopes: Default::default(),
6617 }
6618 }
6619
6620 /// Create a builder to help you perform the following task:
6621 ///
6622 /// 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.
6623 ///
6624 /// # Arguments
6625 ///
6626 /// * `request` - No description provided.
6627 /// * `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 '-'.
6628 pub fn upload(
6629 &self,
6630 request: TransitObjectUploadRotatingBarcodeValuesRequest,
6631 resource_id: &str,
6632 ) -> MediaUploadCall<'a, C> {
6633 MediaUploadCall {
6634 hub: self.hub,
6635 _request: request,
6636 _resource_id: resource_id.to_string(),
6637 _delegate: Default::default(),
6638 _additional_params: Default::default(),
6639 _scopes: Default::default(),
6640 }
6641 }
6642}
6643
6644/// A builder providing access to all methods supported on *offerclas* resources.
6645/// It is not used directly, but through the [`Walletobjects`] hub.
6646///
6647/// # Example
6648///
6649/// Instantiate a resource builder
6650///
6651/// ```test_harness,no_run
6652/// extern crate hyper;
6653/// extern crate hyper_rustls;
6654/// extern crate google_walletobjects1 as walletobjects1;
6655///
6656/// # async fn dox() {
6657/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6658///
6659/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6660/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6661/// secret,
6662/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6663/// ).build().await.unwrap();
6664///
6665/// let client = hyper_util::client::legacy::Client::builder(
6666/// hyper_util::rt::TokioExecutor::new()
6667/// )
6668/// .build(
6669/// hyper_rustls::HttpsConnectorBuilder::new()
6670/// .with_native_roots()
6671/// .unwrap()
6672/// .https_or_http()
6673/// .enable_http1()
6674/// .build()
6675/// );
6676/// let mut hub = Walletobjects::new(client, auth);
6677/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6678/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
6679/// // to build up your call.
6680/// let rb = hub.offerclass();
6681/// # }
6682/// ```
6683pub struct OfferclasMethods<'a, C>
6684where
6685 C: 'a,
6686{
6687 hub: &'a Walletobjects<C>,
6688}
6689
6690impl<'a, C> common::MethodsBuilder for OfferclasMethods<'a, C> {}
6691
6692impl<'a, C> OfferclasMethods<'a, C> {
6693 /// Create a builder to help you perform the following task:
6694 ///
6695 /// Adds a message to the offer class referenced by the given class ID.
6696 ///
6697 /// # Arguments
6698 ///
6699 /// * `request` - No description provided.
6700 /// * `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 '-'.
6701 pub fn addmessage(
6702 &self,
6703 request: AddMessageRequest,
6704 resource_id: &str,
6705 ) -> OfferclasAddmessageCall<'a, C> {
6706 OfferclasAddmessageCall {
6707 hub: self.hub,
6708 _request: request,
6709 _resource_id: resource_id.to_string(),
6710 _delegate: Default::default(),
6711 _additional_params: Default::default(),
6712 _scopes: Default::default(),
6713 }
6714 }
6715
6716 /// Create a builder to help you perform the following task:
6717 ///
6718 /// Returns the offer class with the given class ID.
6719 ///
6720 /// # Arguments
6721 ///
6722 /// * `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 '-'.
6723 pub fn get(&self, resource_id: &str) -> OfferclasGetCall<'a, C> {
6724 OfferclasGetCall {
6725 hub: self.hub,
6726 _resource_id: resource_id.to_string(),
6727 _delegate: Default::default(),
6728 _additional_params: Default::default(),
6729 _scopes: Default::default(),
6730 }
6731 }
6732
6733 /// Create a builder to help you perform the following task:
6734 ///
6735 /// Inserts an offer class with the given ID and properties.
6736 ///
6737 /// # Arguments
6738 ///
6739 /// * `request` - No description provided.
6740 pub fn insert(&self, request: OfferClass) -> OfferclasInsertCall<'a, C> {
6741 OfferclasInsertCall {
6742 hub: self.hub,
6743 _request: request,
6744 _delegate: Default::default(),
6745 _additional_params: Default::default(),
6746 _scopes: Default::default(),
6747 }
6748 }
6749
6750 /// Create a builder to help you perform the following task:
6751 ///
6752 /// Returns a list of all offer classes for a given issuer ID.
6753 pub fn list(&self) -> OfferclasListCall<'a, C> {
6754 OfferclasListCall {
6755 hub: self.hub,
6756 _token: Default::default(),
6757 _max_results: Default::default(),
6758 _issuer_id: Default::default(),
6759 _delegate: Default::default(),
6760 _additional_params: Default::default(),
6761 _scopes: Default::default(),
6762 }
6763 }
6764
6765 /// Create a builder to help you perform the following task:
6766 ///
6767 /// Updates the offer class referenced by the given class ID. This method supports patch semantics.
6768 ///
6769 /// # Arguments
6770 ///
6771 /// * `request` - No description provided.
6772 /// * `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 '-'.
6773 pub fn patch(&self, request: OfferClass, resource_id: &str) -> OfferclasPatchCall<'a, C> {
6774 OfferclasPatchCall {
6775 hub: self.hub,
6776 _request: request,
6777 _resource_id: resource_id.to_string(),
6778 _delegate: Default::default(),
6779 _additional_params: Default::default(),
6780 _scopes: Default::default(),
6781 }
6782 }
6783
6784 /// Create a builder to help you perform the following task:
6785 ///
6786 /// Updates the offer class referenced by the given class ID.
6787 ///
6788 /// # Arguments
6789 ///
6790 /// * `request` - No description provided.
6791 /// * `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 '-'.
6792 pub fn update(&self, request: OfferClass, resource_id: &str) -> OfferclasUpdateCall<'a, C> {
6793 OfferclasUpdateCall {
6794 hub: self.hub,
6795 _request: request,
6796 _resource_id: resource_id.to_string(),
6797 _delegate: Default::default(),
6798 _additional_params: Default::default(),
6799 _scopes: Default::default(),
6800 }
6801 }
6802}
6803
6804/// A builder providing access to all methods supported on *offerobject* resources.
6805/// It is not used directly, but through the [`Walletobjects`] hub.
6806///
6807/// # Example
6808///
6809/// Instantiate a resource builder
6810///
6811/// ```test_harness,no_run
6812/// extern crate hyper;
6813/// extern crate hyper_rustls;
6814/// extern crate google_walletobjects1 as walletobjects1;
6815///
6816/// # async fn dox() {
6817/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6818///
6819/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6820/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6821/// secret,
6822/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6823/// ).build().await.unwrap();
6824///
6825/// let client = hyper_util::client::legacy::Client::builder(
6826/// hyper_util::rt::TokioExecutor::new()
6827/// )
6828/// .build(
6829/// hyper_rustls::HttpsConnectorBuilder::new()
6830/// .with_native_roots()
6831/// .unwrap()
6832/// .https_or_http()
6833/// .enable_http1()
6834/// .build()
6835/// );
6836/// let mut hub = Walletobjects::new(client, auth);
6837/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6838/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
6839/// // to build up your call.
6840/// let rb = hub.offerobject();
6841/// # }
6842/// ```
6843pub struct OfferobjectMethods<'a, C>
6844where
6845 C: 'a,
6846{
6847 hub: &'a Walletobjects<C>,
6848}
6849
6850impl<'a, C> common::MethodsBuilder for OfferobjectMethods<'a, C> {}
6851
6852impl<'a, C> OfferobjectMethods<'a, C> {
6853 /// Create a builder to help you perform the following task:
6854 ///
6855 /// Adds a message to the offer object referenced by the given object ID.
6856 ///
6857 /// # Arguments
6858 ///
6859 /// * `request` - No description provided.
6860 /// * `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 '-'.
6861 pub fn addmessage(
6862 &self,
6863 request: AddMessageRequest,
6864 resource_id: &str,
6865 ) -> OfferobjectAddmessageCall<'a, C> {
6866 OfferobjectAddmessageCall {
6867 hub: self.hub,
6868 _request: request,
6869 _resource_id: resource_id.to_string(),
6870 _delegate: Default::default(),
6871 _additional_params: Default::default(),
6872 _scopes: Default::default(),
6873 }
6874 }
6875
6876 /// Create a builder to help you perform the following task:
6877 ///
6878 /// Returns the offer object with the given object ID.
6879 ///
6880 /// # Arguments
6881 ///
6882 /// * `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 '-'.
6883 pub fn get(&self, resource_id: &str) -> OfferobjectGetCall<'a, C> {
6884 OfferobjectGetCall {
6885 hub: self.hub,
6886 _resource_id: resource_id.to_string(),
6887 _delegate: Default::default(),
6888 _additional_params: Default::default(),
6889 _scopes: Default::default(),
6890 }
6891 }
6892
6893 /// Create a builder to help you perform the following task:
6894 ///
6895 /// Inserts an offer object with the given ID and properties.
6896 ///
6897 /// # Arguments
6898 ///
6899 /// * `request` - No description provided.
6900 pub fn insert(&self, request: OfferObject) -> OfferobjectInsertCall<'a, C> {
6901 OfferobjectInsertCall {
6902 hub: self.hub,
6903 _request: request,
6904 _delegate: Default::default(),
6905 _additional_params: Default::default(),
6906 _scopes: Default::default(),
6907 }
6908 }
6909
6910 /// Create a builder to help you perform the following task:
6911 ///
6912 /// Returns a list of all offer objects for a given issuer ID.
6913 pub fn list(&self) -> OfferobjectListCall<'a, C> {
6914 OfferobjectListCall {
6915 hub: self.hub,
6916 _token: Default::default(),
6917 _max_results: Default::default(),
6918 _class_id: Default::default(),
6919 _delegate: Default::default(),
6920 _additional_params: Default::default(),
6921 _scopes: Default::default(),
6922 }
6923 }
6924
6925 /// Create a builder to help you perform the following task:
6926 ///
6927 /// Updates the offer object referenced by the given object ID. This method supports patch semantics.
6928 ///
6929 /// # Arguments
6930 ///
6931 /// * `request` - No description provided.
6932 /// * `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 '-'.
6933 pub fn patch(&self, request: OfferObject, resource_id: &str) -> OfferobjectPatchCall<'a, C> {
6934 OfferobjectPatchCall {
6935 hub: self.hub,
6936 _request: request,
6937 _resource_id: resource_id.to_string(),
6938 _delegate: Default::default(),
6939 _additional_params: Default::default(),
6940 _scopes: Default::default(),
6941 }
6942 }
6943
6944 /// Create a builder to help you perform the following task:
6945 ///
6946 /// Updates the offer object referenced by the given object ID.
6947 ///
6948 /// # Arguments
6949 ///
6950 /// * `request` - No description provided.
6951 /// * `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 '-'.
6952 pub fn update(&self, request: OfferObject, resource_id: &str) -> OfferobjectUpdateCall<'a, C> {
6953 OfferobjectUpdateCall {
6954 hub: self.hub,
6955 _request: request,
6956 _resource_id: resource_id.to_string(),
6957 _delegate: Default::default(),
6958 _additional_params: Default::default(),
6959 _scopes: Default::default(),
6960 }
6961 }
6962}
6963
6964/// A builder providing access to all methods supported on *permission* resources.
6965/// It is not used directly, but through the [`Walletobjects`] hub.
6966///
6967/// # Example
6968///
6969/// Instantiate a resource builder
6970///
6971/// ```test_harness,no_run
6972/// extern crate hyper;
6973/// extern crate hyper_rustls;
6974/// extern crate google_walletobjects1 as walletobjects1;
6975///
6976/// # async fn dox() {
6977/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6978///
6979/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6980/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6981/// secret,
6982/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6983/// ).build().await.unwrap();
6984///
6985/// let client = hyper_util::client::legacy::Client::builder(
6986/// hyper_util::rt::TokioExecutor::new()
6987/// )
6988/// .build(
6989/// hyper_rustls::HttpsConnectorBuilder::new()
6990/// .with_native_roots()
6991/// .unwrap()
6992/// .https_or_http()
6993/// .enable_http1()
6994/// .build()
6995/// );
6996/// let mut hub = Walletobjects::new(client, auth);
6997/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6998/// // like `get(...)` and `update(...)`
6999/// // to build up your call.
7000/// let rb = hub.permissions();
7001/// # }
7002/// ```
7003pub struct PermissionMethods<'a, C>
7004where
7005 C: 'a,
7006{
7007 hub: &'a Walletobjects<C>,
7008}
7009
7010impl<'a, C> common::MethodsBuilder for PermissionMethods<'a, C> {}
7011
7012impl<'a, C> PermissionMethods<'a, C> {
7013 /// Create a builder to help you perform the following task:
7014 ///
7015 /// Returns the permissions for the given issuer id.
7016 ///
7017 /// # Arguments
7018 ///
7019 /// * `resourceId` - The unique identifier for an issuer. This ID must be unique across all issuers.
7020 pub fn get(&self, resource_id: i64) -> PermissionGetCall<'a, C> {
7021 PermissionGetCall {
7022 hub: self.hub,
7023 _resource_id: resource_id,
7024 _delegate: Default::default(),
7025 _additional_params: Default::default(),
7026 _scopes: Default::default(),
7027 }
7028 }
7029
7030 /// Create a builder to help you perform the following task:
7031 ///
7032 /// Updates the permissions for the given issuer.
7033 ///
7034 /// # Arguments
7035 ///
7036 /// * `request` - No description provided.
7037 /// * `resourceId` - The unique identifier for an issuer. This ID must be unique across all issuers.
7038 pub fn update(&self, request: Permissions, resource_id: i64) -> PermissionUpdateCall<'a, C> {
7039 PermissionUpdateCall {
7040 hub: self.hub,
7041 _request: request,
7042 _resource_id: resource_id,
7043 _delegate: Default::default(),
7044 _additional_params: Default::default(),
7045 _scopes: Default::default(),
7046 }
7047 }
7048}
7049
7050/// A builder providing access to all methods supported on *smarttap* resources.
7051/// It is not used directly, but through the [`Walletobjects`] hub.
7052///
7053/// # Example
7054///
7055/// Instantiate a resource builder
7056///
7057/// ```test_harness,no_run
7058/// extern crate hyper;
7059/// extern crate hyper_rustls;
7060/// extern crate google_walletobjects1 as walletobjects1;
7061///
7062/// # async fn dox() {
7063/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7064///
7065/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7066/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7067/// secret,
7068/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7069/// ).build().await.unwrap();
7070///
7071/// let client = hyper_util::client::legacy::Client::builder(
7072/// hyper_util::rt::TokioExecutor::new()
7073/// )
7074/// .build(
7075/// hyper_rustls::HttpsConnectorBuilder::new()
7076/// .with_native_roots()
7077/// .unwrap()
7078/// .https_or_http()
7079/// .enable_http1()
7080/// .build()
7081/// );
7082/// let mut hub = Walletobjects::new(client, auth);
7083/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7084/// // like `insert(...)`
7085/// // to build up your call.
7086/// let rb = hub.smarttap();
7087/// # }
7088/// ```
7089pub struct SmarttapMethods<'a, C>
7090where
7091 C: 'a,
7092{
7093 hub: &'a Walletobjects<C>,
7094}
7095
7096impl<'a, C> common::MethodsBuilder for SmarttapMethods<'a, C> {}
7097
7098impl<'a, C> SmarttapMethods<'a, C> {
7099 /// Create a builder to help you perform the following task:
7100 ///
7101 /// Inserts the smart tap.
7102 ///
7103 /// # Arguments
7104 ///
7105 /// * `request` - No description provided.
7106 pub fn insert(&self, request: SmartTap) -> SmarttapInsertCall<'a, C> {
7107 SmarttapInsertCall {
7108 hub: self.hub,
7109 _request: request,
7110 _delegate: Default::default(),
7111 _additional_params: Default::default(),
7112 _scopes: Default::default(),
7113 }
7114 }
7115}
7116
7117/// A builder providing access to all methods supported on *transitclas* resources.
7118/// It is not used directly, but through the [`Walletobjects`] hub.
7119///
7120/// # Example
7121///
7122/// Instantiate a resource builder
7123///
7124/// ```test_harness,no_run
7125/// extern crate hyper;
7126/// extern crate hyper_rustls;
7127/// extern crate google_walletobjects1 as walletobjects1;
7128///
7129/// # async fn dox() {
7130/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7131///
7132/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7133/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7134/// secret,
7135/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7136/// ).build().await.unwrap();
7137///
7138/// let client = hyper_util::client::legacy::Client::builder(
7139/// hyper_util::rt::TokioExecutor::new()
7140/// )
7141/// .build(
7142/// hyper_rustls::HttpsConnectorBuilder::new()
7143/// .with_native_roots()
7144/// .unwrap()
7145/// .https_or_http()
7146/// .enable_http1()
7147/// .build()
7148/// );
7149/// let mut hub = Walletobjects::new(client, auth);
7150/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7151/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
7152/// // to build up your call.
7153/// let rb = hub.transitclass();
7154/// # }
7155/// ```
7156pub struct TransitclasMethods<'a, C>
7157where
7158 C: 'a,
7159{
7160 hub: &'a Walletobjects<C>,
7161}
7162
7163impl<'a, C> common::MethodsBuilder for TransitclasMethods<'a, C> {}
7164
7165impl<'a, C> TransitclasMethods<'a, C> {
7166 /// Create a builder to help you perform the following task:
7167 ///
7168 /// Adds a message to the transit class referenced by the given class ID.
7169 ///
7170 /// # Arguments
7171 ///
7172 /// * `request` - No description provided.
7173 /// * `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 '-'.
7174 pub fn addmessage(
7175 &self,
7176 request: AddMessageRequest,
7177 resource_id: &str,
7178 ) -> TransitclasAddmessageCall<'a, C> {
7179 TransitclasAddmessageCall {
7180 hub: self.hub,
7181 _request: request,
7182 _resource_id: resource_id.to_string(),
7183 _delegate: Default::default(),
7184 _additional_params: Default::default(),
7185 _scopes: Default::default(),
7186 }
7187 }
7188
7189 /// Create a builder to help you perform the following task:
7190 ///
7191 /// Returns the transit class with the given class ID.
7192 ///
7193 /// # Arguments
7194 ///
7195 /// * `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 '-'.
7196 pub fn get(&self, resource_id: &str) -> TransitclasGetCall<'a, C> {
7197 TransitclasGetCall {
7198 hub: self.hub,
7199 _resource_id: resource_id.to_string(),
7200 _delegate: Default::default(),
7201 _additional_params: Default::default(),
7202 _scopes: Default::default(),
7203 }
7204 }
7205
7206 /// Create a builder to help you perform the following task:
7207 ///
7208 /// Inserts a transit class with the given ID and properties.
7209 ///
7210 /// # Arguments
7211 ///
7212 /// * `request` - No description provided.
7213 pub fn insert(&self, request: TransitClass) -> TransitclasInsertCall<'a, C> {
7214 TransitclasInsertCall {
7215 hub: self.hub,
7216 _request: request,
7217 _delegate: Default::default(),
7218 _additional_params: Default::default(),
7219 _scopes: Default::default(),
7220 }
7221 }
7222
7223 /// Create a builder to help you perform the following task:
7224 ///
7225 /// Returns a list of all transit classes for a given issuer ID.
7226 pub fn list(&self) -> TransitclasListCall<'a, C> {
7227 TransitclasListCall {
7228 hub: self.hub,
7229 _token: Default::default(),
7230 _max_results: Default::default(),
7231 _issuer_id: Default::default(),
7232 _delegate: Default::default(),
7233 _additional_params: Default::default(),
7234 _scopes: Default::default(),
7235 }
7236 }
7237
7238 /// Create a builder to help you perform the following task:
7239 ///
7240 /// Updates the transit class referenced by the given class ID. This method supports patch semantics.
7241 ///
7242 /// # Arguments
7243 ///
7244 /// * `request` - No description provided.
7245 /// * `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 '-'.
7246 pub fn patch(&self, request: TransitClass, resource_id: &str) -> TransitclasPatchCall<'a, C> {
7247 TransitclasPatchCall {
7248 hub: self.hub,
7249 _request: request,
7250 _resource_id: resource_id.to_string(),
7251 _delegate: Default::default(),
7252 _additional_params: Default::default(),
7253 _scopes: Default::default(),
7254 }
7255 }
7256
7257 /// Create a builder to help you perform the following task:
7258 ///
7259 /// Updates the transit class referenced by the given class ID.
7260 ///
7261 /// # Arguments
7262 ///
7263 /// * `request` - No description provided.
7264 /// * `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 '-'.
7265 pub fn update(&self, request: TransitClass, resource_id: &str) -> TransitclasUpdateCall<'a, C> {
7266 TransitclasUpdateCall {
7267 hub: self.hub,
7268 _request: request,
7269 _resource_id: resource_id.to_string(),
7270 _delegate: Default::default(),
7271 _additional_params: Default::default(),
7272 _scopes: Default::default(),
7273 }
7274 }
7275}
7276
7277/// A builder providing access to all methods supported on *transitobject* resources.
7278/// It is not used directly, but through the [`Walletobjects`] hub.
7279///
7280/// # Example
7281///
7282/// Instantiate a resource builder
7283///
7284/// ```test_harness,no_run
7285/// extern crate hyper;
7286/// extern crate hyper_rustls;
7287/// extern crate google_walletobjects1 as walletobjects1;
7288///
7289/// # async fn dox() {
7290/// use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7291///
7292/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7293/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7294/// secret,
7295/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7296/// ).build().await.unwrap();
7297///
7298/// let client = hyper_util::client::legacy::Client::builder(
7299/// hyper_util::rt::TokioExecutor::new()
7300/// )
7301/// .build(
7302/// hyper_rustls::HttpsConnectorBuilder::new()
7303/// .with_native_roots()
7304/// .unwrap()
7305/// .https_or_http()
7306/// .enable_http1()
7307/// .build()
7308/// );
7309/// let mut hub = Walletobjects::new(client, auth);
7310/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7311/// // like `addmessage(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
7312/// // to build up your call.
7313/// let rb = hub.transitobject();
7314/// # }
7315/// ```
7316pub struct TransitobjectMethods<'a, C>
7317where
7318 C: 'a,
7319{
7320 hub: &'a Walletobjects<C>,
7321}
7322
7323impl<'a, C> common::MethodsBuilder for TransitobjectMethods<'a, C> {}
7324
7325impl<'a, C> TransitobjectMethods<'a, C> {
7326 /// Create a builder to help you perform the following task:
7327 ///
7328 /// Adds a message to the transit object referenced by the given object ID.
7329 ///
7330 /// # Arguments
7331 ///
7332 /// * `request` - No description provided.
7333 /// * `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 '-'.
7334 pub fn addmessage(
7335 &self,
7336 request: AddMessageRequest,
7337 resource_id: &str,
7338 ) -> TransitobjectAddmessageCall<'a, C> {
7339 TransitobjectAddmessageCall {
7340 hub: self.hub,
7341 _request: request,
7342 _resource_id: resource_id.to_string(),
7343 _delegate: Default::default(),
7344 _additional_params: Default::default(),
7345 _scopes: Default::default(),
7346 }
7347 }
7348
7349 /// Create a builder to help you perform the following task:
7350 ///
7351 /// Returns the transit object with the given object ID.
7352 ///
7353 /// # Arguments
7354 ///
7355 /// * `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 '-'.
7356 pub fn get(&self, resource_id: &str) -> TransitobjectGetCall<'a, C> {
7357 TransitobjectGetCall {
7358 hub: self.hub,
7359 _resource_id: resource_id.to_string(),
7360 _delegate: Default::default(),
7361 _additional_params: Default::default(),
7362 _scopes: Default::default(),
7363 }
7364 }
7365
7366 /// Create a builder to help you perform the following task:
7367 ///
7368 /// Inserts an transit object with the given ID and properties.
7369 ///
7370 /// # Arguments
7371 ///
7372 /// * `request` - No description provided.
7373 pub fn insert(&self, request: TransitObject) -> TransitobjectInsertCall<'a, C> {
7374 TransitobjectInsertCall {
7375 hub: self.hub,
7376 _request: request,
7377 _delegate: Default::default(),
7378 _additional_params: Default::default(),
7379 _scopes: Default::default(),
7380 }
7381 }
7382
7383 /// Create a builder to help you perform the following task:
7384 ///
7385 /// Returns a list of all transit objects for a given issuer ID.
7386 pub fn list(&self) -> TransitobjectListCall<'a, C> {
7387 TransitobjectListCall {
7388 hub: self.hub,
7389 _token: Default::default(),
7390 _max_results: Default::default(),
7391 _class_id: Default::default(),
7392 _delegate: Default::default(),
7393 _additional_params: Default::default(),
7394 _scopes: Default::default(),
7395 }
7396 }
7397
7398 /// Create a builder to help you perform the following task:
7399 ///
7400 /// Updates the transit object referenced by the given object ID. This method supports patch semantics.
7401 ///
7402 /// # Arguments
7403 ///
7404 /// * `request` - No description provided.
7405 /// * `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 '-'.
7406 pub fn patch(
7407 &self,
7408 request: TransitObject,
7409 resource_id: &str,
7410 ) -> TransitobjectPatchCall<'a, C> {
7411 TransitobjectPatchCall {
7412 hub: self.hub,
7413 _request: request,
7414 _resource_id: resource_id.to_string(),
7415 _delegate: Default::default(),
7416 _additional_params: Default::default(),
7417 _scopes: Default::default(),
7418 }
7419 }
7420
7421 /// Create a builder to help you perform the following task:
7422 ///
7423 /// Updates the transit object referenced by the given object ID.
7424 ///
7425 /// # Arguments
7426 ///
7427 /// * `request` - No description provided.
7428 /// * `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 '-'.
7429 pub fn update(
7430 &self,
7431 request: TransitObject,
7432 resource_id: &str,
7433 ) -> TransitobjectUpdateCall<'a, C> {
7434 TransitobjectUpdateCall {
7435 hub: self.hub,
7436 _request: request,
7437 _resource_id: resource_id.to_string(),
7438 _delegate: Default::default(),
7439 _additional_params: Default::default(),
7440 _scopes: Default::default(),
7441 }
7442 }
7443}
7444
7445// ###################
7446// CallBuilders ###
7447// #################
7448
7449/// Adds a message to the event ticket class referenced by the given class ID.
7450///
7451/// A builder for the *addmessage* method supported by a *eventticketclas* resource.
7452/// It is not used directly, but through a [`EventticketclasMethods`] instance.
7453///
7454/// # Example
7455///
7456/// Instantiate a resource method builder
7457///
7458/// ```test_harness,no_run
7459/// # extern crate hyper;
7460/// # extern crate hyper_rustls;
7461/// # extern crate google_walletobjects1 as walletobjects1;
7462/// use walletobjects1::api::AddMessageRequest;
7463/// # async fn dox() {
7464/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7465///
7466/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7467/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7468/// # secret,
7469/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7470/// # ).build().await.unwrap();
7471///
7472/// # let client = hyper_util::client::legacy::Client::builder(
7473/// # hyper_util::rt::TokioExecutor::new()
7474/// # )
7475/// # .build(
7476/// # hyper_rustls::HttpsConnectorBuilder::new()
7477/// # .with_native_roots()
7478/// # .unwrap()
7479/// # .https_or_http()
7480/// # .enable_http1()
7481/// # .build()
7482/// # );
7483/// # let mut hub = Walletobjects::new(client, auth);
7484/// // As the method needs a request, you would usually fill it with the desired information
7485/// // into the respective structure. Some of the parts shown here might not be applicable !
7486/// // Values shown here are possibly random and not representative !
7487/// let mut req = AddMessageRequest::default();
7488///
7489/// // You can configure optional parameters by calling the respective setters at will, and
7490/// // execute the final call using `doit()`.
7491/// // Values shown here are possibly random and not representative !
7492/// let result = hub.eventticketclass().addmessage(req, "resourceId")
7493/// .doit().await;
7494/// # }
7495/// ```
7496pub struct EventticketclasAddmessageCall<'a, C>
7497where
7498 C: 'a,
7499{
7500 hub: &'a Walletobjects<C>,
7501 _request: AddMessageRequest,
7502 _resource_id: String,
7503 _delegate: Option<&'a mut dyn common::Delegate>,
7504 _additional_params: HashMap<String, String>,
7505 _scopes: BTreeSet<String>,
7506}
7507
7508impl<'a, C> common::CallBuilder for EventticketclasAddmessageCall<'a, C> {}
7509
7510impl<'a, C> EventticketclasAddmessageCall<'a, C>
7511where
7512 C: common::Connector,
7513{
7514 /// Perform the operation you have build so far.
7515 pub async fn doit(
7516 mut self,
7517 ) -> common::Result<(common::Response, EventTicketClassAddMessageResponse)> {
7518 use std::borrow::Cow;
7519 use std::io::{Read, Seek};
7520
7521 use common::{url::Params, ToParts};
7522 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7523
7524 let mut dd = common::DefaultDelegate;
7525 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7526 dlg.begin(common::MethodInfo {
7527 id: "walletobjects.eventticketclass.addmessage",
7528 http_method: hyper::Method::POST,
7529 });
7530
7531 for &field in ["alt", "resourceId"].iter() {
7532 if self._additional_params.contains_key(field) {
7533 dlg.finished(false);
7534 return Err(common::Error::FieldClash(field));
7535 }
7536 }
7537
7538 let mut params = Params::with_capacity(4 + self._additional_params.len());
7539 params.push("resourceId", self._resource_id);
7540
7541 params.extend(self._additional_params.iter());
7542
7543 params.push("alt", "json");
7544 let mut url = self.hub._base_url.clone()
7545 + "walletobjects/v1/eventTicketClass/{resourceId}/addMessage";
7546 if self._scopes.is_empty() {
7547 self._scopes
7548 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
7549 }
7550
7551 #[allow(clippy::single_element_loop)]
7552 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
7553 url = params.uri_replacement(url, param_name, find_this, false);
7554 }
7555 {
7556 let to_remove = ["resourceId"];
7557 params.remove_params(&to_remove);
7558 }
7559
7560 let url = params.parse_with_url(&url);
7561
7562 let mut json_mime_type = mime::APPLICATION_JSON;
7563 let mut request_value_reader = {
7564 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7565 common::remove_json_null_values(&mut value);
7566 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7567 serde_json::to_writer(&mut dst, &value).unwrap();
7568 dst
7569 };
7570 let request_size = request_value_reader
7571 .seek(std::io::SeekFrom::End(0))
7572 .unwrap();
7573 request_value_reader
7574 .seek(std::io::SeekFrom::Start(0))
7575 .unwrap();
7576
7577 loop {
7578 let token = match self
7579 .hub
7580 .auth
7581 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7582 .await
7583 {
7584 Ok(token) => token,
7585 Err(e) => match dlg.token(e) {
7586 Ok(token) => token,
7587 Err(e) => {
7588 dlg.finished(false);
7589 return Err(common::Error::MissingToken(e));
7590 }
7591 },
7592 };
7593 request_value_reader
7594 .seek(std::io::SeekFrom::Start(0))
7595 .unwrap();
7596 let mut req_result = {
7597 let client = &self.hub.client;
7598 dlg.pre_request();
7599 let mut req_builder = hyper::Request::builder()
7600 .method(hyper::Method::POST)
7601 .uri(url.as_str())
7602 .header(USER_AGENT, self.hub._user_agent.clone());
7603
7604 if let Some(token) = token.as_ref() {
7605 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7606 }
7607
7608 let request = req_builder
7609 .header(CONTENT_TYPE, json_mime_type.to_string())
7610 .header(CONTENT_LENGTH, request_size as u64)
7611 .body(common::to_body(
7612 request_value_reader.get_ref().clone().into(),
7613 ));
7614
7615 client.request(request.unwrap()).await
7616 };
7617
7618 match req_result {
7619 Err(err) => {
7620 if let common::Retry::After(d) = dlg.http_error(&err) {
7621 sleep(d).await;
7622 continue;
7623 }
7624 dlg.finished(false);
7625 return Err(common::Error::HttpError(err));
7626 }
7627 Ok(res) => {
7628 let (mut parts, body) = res.into_parts();
7629 let mut body = common::Body::new(body);
7630 if !parts.status.is_success() {
7631 let bytes = common::to_bytes(body).await.unwrap_or_default();
7632 let error = serde_json::from_str(&common::to_string(&bytes));
7633 let response = common::to_response(parts, bytes.into());
7634
7635 if let common::Retry::After(d) =
7636 dlg.http_failure(&response, error.as_ref().ok())
7637 {
7638 sleep(d).await;
7639 continue;
7640 }
7641
7642 dlg.finished(false);
7643
7644 return Err(match error {
7645 Ok(value) => common::Error::BadRequest(value),
7646 _ => common::Error::Failure(response),
7647 });
7648 }
7649 let response = {
7650 let bytes = common::to_bytes(body).await.unwrap_or_default();
7651 let encoded = common::to_string(&bytes);
7652 match serde_json::from_str(&encoded) {
7653 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7654 Err(error) => {
7655 dlg.response_json_decode_error(&encoded, &error);
7656 return Err(common::Error::JsonDecodeError(
7657 encoded.to_string(),
7658 error,
7659 ));
7660 }
7661 }
7662 };
7663
7664 dlg.finished(true);
7665 return Ok(response);
7666 }
7667 }
7668 }
7669 }
7670
7671 ///
7672 /// Sets the *request* property to the given value.
7673 ///
7674 /// Even though the property as already been set when instantiating this call,
7675 /// we provide this method for API completeness.
7676 pub fn request(mut self, new_value: AddMessageRequest) -> EventticketclasAddmessageCall<'a, C> {
7677 self._request = new_value;
7678 self
7679 }
7680 /// 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 '-'.
7681 ///
7682 /// Sets the *resource id* path property to the given value.
7683 ///
7684 /// Even though the property as already been set when instantiating this call,
7685 /// we provide this method for API completeness.
7686 pub fn resource_id(mut self, new_value: &str) -> EventticketclasAddmessageCall<'a, C> {
7687 self._resource_id = new_value.to_string();
7688 self
7689 }
7690 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7691 /// while executing the actual API request.
7692 ///
7693 /// ````text
7694 /// It should be used to handle progress information, and to implement a certain level of resilience.
7695 /// ````
7696 ///
7697 /// Sets the *delegate* property to the given value.
7698 pub fn delegate(
7699 mut self,
7700 new_value: &'a mut dyn common::Delegate,
7701 ) -> EventticketclasAddmessageCall<'a, C> {
7702 self._delegate = Some(new_value);
7703 self
7704 }
7705
7706 /// Set any additional parameter of the query string used in the request.
7707 /// It should be used to set parameters which are not yet available through their own
7708 /// setters.
7709 ///
7710 /// Please note that this method must not be used to set any of the known parameters
7711 /// which have their own setter method. If done anyway, the request will fail.
7712 ///
7713 /// # Additional Parameters
7714 ///
7715 /// * *$.xgafv* (query-string) - V1 error format.
7716 /// * *access_token* (query-string) - OAuth access token.
7717 /// * *alt* (query-string) - Data format for response.
7718 /// * *callback* (query-string) - JSONP
7719 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7720 /// * *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.
7721 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7722 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7723 /// * *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.
7724 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7725 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7726 pub fn param<T>(mut self, name: T, value: T) -> EventticketclasAddmessageCall<'a, C>
7727 where
7728 T: AsRef<str>,
7729 {
7730 self._additional_params
7731 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7732 self
7733 }
7734
7735 /// Identifies the authorization scope for the method you are building.
7736 ///
7737 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7738 /// [`Scope::WalletObjectIssuer`].
7739 ///
7740 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7741 /// tokens for more than one scope.
7742 ///
7743 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7744 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7745 /// sufficient, a read-write scope will do as well.
7746 pub fn add_scope<St>(mut self, scope: St) -> EventticketclasAddmessageCall<'a, C>
7747 where
7748 St: AsRef<str>,
7749 {
7750 self._scopes.insert(String::from(scope.as_ref()));
7751 self
7752 }
7753 /// Identifies the authorization scope(s) for the method you are building.
7754 ///
7755 /// See [`Self::add_scope()`] for details.
7756 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasAddmessageCall<'a, C>
7757 where
7758 I: IntoIterator<Item = St>,
7759 St: AsRef<str>,
7760 {
7761 self._scopes
7762 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7763 self
7764 }
7765
7766 /// Removes all scopes, and no default scope will be used either.
7767 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7768 /// for details).
7769 pub fn clear_scopes(mut self) -> EventticketclasAddmessageCall<'a, C> {
7770 self._scopes.clear();
7771 self
7772 }
7773}
7774
7775/// Returns the event ticket class with the given class ID.
7776///
7777/// A builder for the *get* method supported by a *eventticketclas* resource.
7778/// It is not used directly, but through a [`EventticketclasMethods`] instance.
7779///
7780/// # Example
7781///
7782/// Instantiate a resource method builder
7783///
7784/// ```test_harness,no_run
7785/// # extern crate hyper;
7786/// # extern crate hyper_rustls;
7787/// # extern crate google_walletobjects1 as walletobjects1;
7788/// # async fn dox() {
7789/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7790///
7791/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7792/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7793/// # secret,
7794/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7795/// # ).build().await.unwrap();
7796///
7797/// # let client = hyper_util::client::legacy::Client::builder(
7798/// # hyper_util::rt::TokioExecutor::new()
7799/// # )
7800/// # .build(
7801/// # hyper_rustls::HttpsConnectorBuilder::new()
7802/// # .with_native_roots()
7803/// # .unwrap()
7804/// # .https_or_http()
7805/// # .enable_http1()
7806/// # .build()
7807/// # );
7808/// # let mut hub = Walletobjects::new(client, auth);
7809/// // You can configure optional parameters by calling the respective setters at will, and
7810/// // execute the final call using `doit()`.
7811/// // Values shown here are possibly random and not representative !
7812/// let result = hub.eventticketclass().get("resourceId")
7813/// .doit().await;
7814/// # }
7815/// ```
7816pub struct EventticketclasGetCall<'a, C>
7817where
7818 C: 'a,
7819{
7820 hub: &'a Walletobjects<C>,
7821 _resource_id: String,
7822 _delegate: Option<&'a mut dyn common::Delegate>,
7823 _additional_params: HashMap<String, String>,
7824 _scopes: BTreeSet<String>,
7825}
7826
7827impl<'a, C> common::CallBuilder for EventticketclasGetCall<'a, C> {}
7828
7829impl<'a, C> EventticketclasGetCall<'a, C>
7830where
7831 C: common::Connector,
7832{
7833 /// Perform the operation you have build so far.
7834 pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketClass)> {
7835 use std::borrow::Cow;
7836 use std::io::{Read, Seek};
7837
7838 use common::{url::Params, ToParts};
7839 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7840
7841 let mut dd = common::DefaultDelegate;
7842 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7843 dlg.begin(common::MethodInfo {
7844 id: "walletobjects.eventticketclass.get",
7845 http_method: hyper::Method::GET,
7846 });
7847
7848 for &field in ["alt", "resourceId"].iter() {
7849 if self._additional_params.contains_key(field) {
7850 dlg.finished(false);
7851 return Err(common::Error::FieldClash(field));
7852 }
7853 }
7854
7855 let mut params = Params::with_capacity(3 + self._additional_params.len());
7856 params.push("resourceId", self._resource_id);
7857
7858 params.extend(self._additional_params.iter());
7859
7860 params.push("alt", "json");
7861 let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass/{resourceId}";
7862 if self._scopes.is_empty() {
7863 self._scopes
7864 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
7865 }
7866
7867 #[allow(clippy::single_element_loop)]
7868 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
7869 url = params.uri_replacement(url, param_name, find_this, false);
7870 }
7871 {
7872 let to_remove = ["resourceId"];
7873 params.remove_params(&to_remove);
7874 }
7875
7876 let url = params.parse_with_url(&url);
7877
7878 loop {
7879 let token = match self
7880 .hub
7881 .auth
7882 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7883 .await
7884 {
7885 Ok(token) => token,
7886 Err(e) => match dlg.token(e) {
7887 Ok(token) => token,
7888 Err(e) => {
7889 dlg.finished(false);
7890 return Err(common::Error::MissingToken(e));
7891 }
7892 },
7893 };
7894 let mut req_result = {
7895 let client = &self.hub.client;
7896 dlg.pre_request();
7897 let mut req_builder = hyper::Request::builder()
7898 .method(hyper::Method::GET)
7899 .uri(url.as_str())
7900 .header(USER_AGENT, self.hub._user_agent.clone());
7901
7902 if let Some(token) = token.as_ref() {
7903 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7904 }
7905
7906 let request = req_builder
7907 .header(CONTENT_LENGTH, 0_u64)
7908 .body(common::to_body::<String>(None));
7909
7910 client.request(request.unwrap()).await
7911 };
7912
7913 match req_result {
7914 Err(err) => {
7915 if let common::Retry::After(d) = dlg.http_error(&err) {
7916 sleep(d).await;
7917 continue;
7918 }
7919 dlg.finished(false);
7920 return Err(common::Error::HttpError(err));
7921 }
7922 Ok(res) => {
7923 let (mut parts, body) = res.into_parts();
7924 let mut body = common::Body::new(body);
7925 if !parts.status.is_success() {
7926 let bytes = common::to_bytes(body).await.unwrap_or_default();
7927 let error = serde_json::from_str(&common::to_string(&bytes));
7928 let response = common::to_response(parts, bytes.into());
7929
7930 if let common::Retry::After(d) =
7931 dlg.http_failure(&response, error.as_ref().ok())
7932 {
7933 sleep(d).await;
7934 continue;
7935 }
7936
7937 dlg.finished(false);
7938
7939 return Err(match error {
7940 Ok(value) => common::Error::BadRequest(value),
7941 _ => common::Error::Failure(response),
7942 });
7943 }
7944 let response = {
7945 let bytes = common::to_bytes(body).await.unwrap_or_default();
7946 let encoded = common::to_string(&bytes);
7947 match serde_json::from_str(&encoded) {
7948 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7949 Err(error) => {
7950 dlg.response_json_decode_error(&encoded, &error);
7951 return Err(common::Error::JsonDecodeError(
7952 encoded.to_string(),
7953 error,
7954 ));
7955 }
7956 }
7957 };
7958
7959 dlg.finished(true);
7960 return Ok(response);
7961 }
7962 }
7963 }
7964 }
7965
7966 /// 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 '-'.
7967 ///
7968 /// Sets the *resource id* path property to the given value.
7969 ///
7970 /// Even though the property as already been set when instantiating this call,
7971 /// we provide this method for API completeness.
7972 pub fn resource_id(mut self, new_value: &str) -> EventticketclasGetCall<'a, C> {
7973 self._resource_id = new_value.to_string();
7974 self
7975 }
7976 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7977 /// while executing the actual API request.
7978 ///
7979 /// ````text
7980 /// It should be used to handle progress information, and to implement a certain level of resilience.
7981 /// ````
7982 ///
7983 /// Sets the *delegate* property to the given value.
7984 pub fn delegate(
7985 mut self,
7986 new_value: &'a mut dyn common::Delegate,
7987 ) -> EventticketclasGetCall<'a, C> {
7988 self._delegate = Some(new_value);
7989 self
7990 }
7991
7992 /// Set any additional parameter of the query string used in the request.
7993 /// It should be used to set parameters which are not yet available through their own
7994 /// setters.
7995 ///
7996 /// Please note that this method must not be used to set any of the known parameters
7997 /// which have their own setter method. If done anyway, the request will fail.
7998 ///
7999 /// # Additional Parameters
8000 ///
8001 /// * *$.xgafv* (query-string) - V1 error format.
8002 /// * *access_token* (query-string) - OAuth access token.
8003 /// * *alt* (query-string) - Data format for response.
8004 /// * *callback* (query-string) - JSONP
8005 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8006 /// * *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.
8007 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8008 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8009 /// * *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.
8010 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8011 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8012 pub fn param<T>(mut self, name: T, value: T) -> EventticketclasGetCall<'a, C>
8013 where
8014 T: AsRef<str>,
8015 {
8016 self._additional_params
8017 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8018 self
8019 }
8020
8021 /// Identifies the authorization scope for the method you are building.
8022 ///
8023 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8024 /// [`Scope::WalletObjectIssuer`].
8025 ///
8026 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8027 /// tokens for more than one scope.
8028 ///
8029 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8030 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8031 /// sufficient, a read-write scope will do as well.
8032 pub fn add_scope<St>(mut self, scope: St) -> EventticketclasGetCall<'a, C>
8033 where
8034 St: AsRef<str>,
8035 {
8036 self._scopes.insert(String::from(scope.as_ref()));
8037 self
8038 }
8039 /// Identifies the authorization scope(s) for the method you are building.
8040 ///
8041 /// See [`Self::add_scope()`] for details.
8042 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasGetCall<'a, C>
8043 where
8044 I: IntoIterator<Item = St>,
8045 St: AsRef<str>,
8046 {
8047 self._scopes
8048 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8049 self
8050 }
8051
8052 /// Removes all scopes, and no default scope will be used either.
8053 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8054 /// for details).
8055 pub fn clear_scopes(mut self) -> EventticketclasGetCall<'a, C> {
8056 self._scopes.clear();
8057 self
8058 }
8059}
8060
8061/// Inserts an event ticket class with the given ID and properties.
8062///
8063/// A builder for the *insert* method supported by a *eventticketclas* resource.
8064/// It is not used directly, but through a [`EventticketclasMethods`] instance.
8065///
8066/// # Example
8067///
8068/// Instantiate a resource method builder
8069///
8070/// ```test_harness,no_run
8071/// # extern crate hyper;
8072/// # extern crate hyper_rustls;
8073/// # extern crate google_walletobjects1 as walletobjects1;
8074/// use walletobjects1::api::EventTicketClass;
8075/// # async fn dox() {
8076/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8077///
8078/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8079/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8080/// # secret,
8081/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8082/// # ).build().await.unwrap();
8083///
8084/// # let client = hyper_util::client::legacy::Client::builder(
8085/// # hyper_util::rt::TokioExecutor::new()
8086/// # )
8087/// # .build(
8088/// # hyper_rustls::HttpsConnectorBuilder::new()
8089/// # .with_native_roots()
8090/// # .unwrap()
8091/// # .https_or_http()
8092/// # .enable_http1()
8093/// # .build()
8094/// # );
8095/// # let mut hub = Walletobjects::new(client, auth);
8096/// // As the method needs a request, you would usually fill it with the desired information
8097/// // into the respective structure. Some of the parts shown here might not be applicable !
8098/// // Values shown here are possibly random and not representative !
8099/// let mut req = EventTicketClass::default();
8100///
8101/// // You can configure optional parameters by calling the respective setters at will, and
8102/// // execute the final call using `doit()`.
8103/// // Values shown here are possibly random and not representative !
8104/// let result = hub.eventticketclass().insert(req)
8105/// .doit().await;
8106/// # }
8107/// ```
8108pub struct EventticketclasInsertCall<'a, C>
8109where
8110 C: 'a,
8111{
8112 hub: &'a Walletobjects<C>,
8113 _request: EventTicketClass,
8114 _delegate: Option<&'a mut dyn common::Delegate>,
8115 _additional_params: HashMap<String, String>,
8116 _scopes: BTreeSet<String>,
8117}
8118
8119impl<'a, C> common::CallBuilder for EventticketclasInsertCall<'a, C> {}
8120
8121impl<'a, C> EventticketclasInsertCall<'a, C>
8122where
8123 C: common::Connector,
8124{
8125 /// Perform the operation you have build so far.
8126 pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketClass)> {
8127 use std::borrow::Cow;
8128 use std::io::{Read, Seek};
8129
8130 use common::{url::Params, ToParts};
8131 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8132
8133 let mut dd = common::DefaultDelegate;
8134 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8135 dlg.begin(common::MethodInfo {
8136 id: "walletobjects.eventticketclass.insert",
8137 http_method: hyper::Method::POST,
8138 });
8139
8140 for &field in ["alt"].iter() {
8141 if self._additional_params.contains_key(field) {
8142 dlg.finished(false);
8143 return Err(common::Error::FieldClash(field));
8144 }
8145 }
8146
8147 let mut params = Params::with_capacity(3 + self._additional_params.len());
8148
8149 params.extend(self._additional_params.iter());
8150
8151 params.push("alt", "json");
8152 let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass";
8153 if self._scopes.is_empty() {
8154 self._scopes
8155 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
8156 }
8157
8158 let url = params.parse_with_url(&url);
8159
8160 let mut json_mime_type = mime::APPLICATION_JSON;
8161 let mut request_value_reader = {
8162 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8163 common::remove_json_null_values(&mut value);
8164 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8165 serde_json::to_writer(&mut dst, &value).unwrap();
8166 dst
8167 };
8168 let request_size = request_value_reader
8169 .seek(std::io::SeekFrom::End(0))
8170 .unwrap();
8171 request_value_reader
8172 .seek(std::io::SeekFrom::Start(0))
8173 .unwrap();
8174
8175 loop {
8176 let token = match self
8177 .hub
8178 .auth
8179 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8180 .await
8181 {
8182 Ok(token) => token,
8183 Err(e) => match dlg.token(e) {
8184 Ok(token) => token,
8185 Err(e) => {
8186 dlg.finished(false);
8187 return Err(common::Error::MissingToken(e));
8188 }
8189 },
8190 };
8191 request_value_reader
8192 .seek(std::io::SeekFrom::Start(0))
8193 .unwrap();
8194 let mut req_result = {
8195 let client = &self.hub.client;
8196 dlg.pre_request();
8197 let mut req_builder = hyper::Request::builder()
8198 .method(hyper::Method::POST)
8199 .uri(url.as_str())
8200 .header(USER_AGENT, self.hub._user_agent.clone());
8201
8202 if let Some(token) = token.as_ref() {
8203 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8204 }
8205
8206 let request = req_builder
8207 .header(CONTENT_TYPE, json_mime_type.to_string())
8208 .header(CONTENT_LENGTH, request_size as u64)
8209 .body(common::to_body(
8210 request_value_reader.get_ref().clone().into(),
8211 ));
8212
8213 client.request(request.unwrap()).await
8214 };
8215
8216 match req_result {
8217 Err(err) => {
8218 if let common::Retry::After(d) = dlg.http_error(&err) {
8219 sleep(d).await;
8220 continue;
8221 }
8222 dlg.finished(false);
8223 return Err(common::Error::HttpError(err));
8224 }
8225 Ok(res) => {
8226 let (mut parts, body) = res.into_parts();
8227 let mut body = common::Body::new(body);
8228 if !parts.status.is_success() {
8229 let bytes = common::to_bytes(body).await.unwrap_or_default();
8230 let error = serde_json::from_str(&common::to_string(&bytes));
8231 let response = common::to_response(parts, bytes.into());
8232
8233 if let common::Retry::After(d) =
8234 dlg.http_failure(&response, error.as_ref().ok())
8235 {
8236 sleep(d).await;
8237 continue;
8238 }
8239
8240 dlg.finished(false);
8241
8242 return Err(match error {
8243 Ok(value) => common::Error::BadRequest(value),
8244 _ => common::Error::Failure(response),
8245 });
8246 }
8247 let response = {
8248 let bytes = common::to_bytes(body).await.unwrap_or_default();
8249 let encoded = common::to_string(&bytes);
8250 match serde_json::from_str(&encoded) {
8251 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8252 Err(error) => {
8253 dlg.response_json_decode_error(&encoded, &error);
8254 return Err(common::Error::JsonDecodeError(
8255 encoded.to_string(),
8256 error,
8257 ));
8258 }
8259 }
8260 };
8261
8262 dlg.finished(true);
8263 return Ok(response);
8264 }
8265 }
8266 }
8267 }
8268
8269 ///
8270 /// Sets the *request* property to the given value.
8271 ///
8272 /// Even though the property as already been set when instantiating this call,
8273 /// we provide this method for API completeness.
8274 pub fn request(mut self, new_value: EventTicketClass) -> EventticketclasInsertCall<'a, C> {
8275 self._request = new_value;
8276 self
8277 }
8278 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8279 /// while executing the actual API request.
8280 ///
8281 /// ````text
8282 /// It should be used to handle progress information, and to implement a certain level of resilience.
8283 /// ````
8284 ///
8285 /// Sets the *delegate* property to the given value.
8286 pub fn delegate(
8287 mut self,
8288 new_value: &'a mut dyn common::Delegate,
8289 ) -> EventticketclasInsertCall<'a, C> {
8290 self._delegate = Some(new_value);
8291 self
8292 }
8293
8294 /// Set any additional parameter of the query string used in the request.
8295 /// It should be used to set parameters which are not yet available through their own
8296 /// setters.
8297 ///
8298 /// Please note that this method must not be used to set any of the known parameters
8299 /// which have their own setter method. If done anyway, the request will fail.
8300 ///
8301 /// # Additional Parameters
8302 ///
8303 /// * *$.xgafv* (query-string) - V1 error format.
8304 /// * *access_token* (query-string) - OAuth access token.
8305 /// * *alt* (query-string) - Data format for response.
8306 /// * *callback* (query-string) - JSONP
8307 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8308 /// * *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.
8309 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8310 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8311 /// * *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.
8312 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8313 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8314 pub fn param<T>(mut self, name: T, value: T) -> EventticketclasInsertCall<'a, C>
8315 where
8316 T: AsRef<str>,
8317 {
8318 self._additional_params
8319 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8320 self
8321 }
8322
8323 /// Identifies the authorization scope for the method you are building.
8324 ///
8325 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8326 /// [`Scope::WalletObjectIssuer`].
8327 ///
8328 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8329 /// tokens for more than one scope.
8330 ///
8331 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8332 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8333 /// sufficient, a read-write scope will do as well.
8334 pub fn add_scope<St>(mut self, scope: St) -> EventticketclasInsertCall<'a, C>
8335 where
8336 St: AsRef<str>,
8337 {
8338 self._scopes.insert(String::from(scope.as_ref()));
8339 self
8340 }
8341 /// Identifies the authorization scope(s) for the method you are building.
8342 ///
8343 /// See [`Self::add_scope()`] for details.
8344 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasInsertCall<'a, C>
8345 where
8346 I: IntoIterator<Item = St>,
8347 St: AsRef<str>,
8348 {
8349 self._scopes
8350 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8351 self
8352 }
8353
8354 /// Removes all scopes, and no default scope will be used either.
8355 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8356 /// for details).
8357 pub fn clear_scopes(mut self) -> EventticketclasInsertCall<'a, C> {
8358 self._scopes.clear();
8359 self
8360 }
8361}
8362
8363/// Returns a list of all event ticket classes for a given issuer ID.
8364///
8365/// A builder for the *list* method supported by a *eventticketclas* resource.
8366/// It is not used directly, but through a [`EventticketclasMethods`] instance.
8367///
8368/// # Example
8369///
8370/// Instantiate a resource method builder
8371///
8372/// ```test_harness,no_run
8373/// # extern crate hyper;
8374/// # extern crate hyper_rustls;
8375/// # extern crate google_walletobjects1 as walletobjects1;
8376/// # async fn dox() {
8377/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8378///
8379/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8380/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8381/// # secret,
8382/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8383/// # ).build().await.unwrap();
8384///
8385/// # let client = hyper_util::client::legacy::Client::builder(
8386/// # hyper_util::rt::TokioExecutor::new()
8387/// # )
8388/// # .build(
8389/// # hyper_rustls::HttpsConnectorBuilder::new()
8390/// # .with_native_roots()
8391/// # .unwrap()
8392/// # .https_or_http()
8393/// # .enable_http1()
8394/// # .build()
8395/// # );
8396/// # let mut hub = Walletobjects::new(client, auth);
8397/// // You can configure optional parameters by calling the respective setters at will, and
8398/// // execute the final call using `doit()`.
8399/// // Values shown here are possibly random and not representative !
8400/// let result = hub.eventticketclass().list()
8401/// .token("At")
8402/// .max_results(-8)
8403/// .issuer_id(-80)
8404/// .doit().await;
8405/// # }
8406/// ```
8407pub struct EventticketclasListCall<'a, C>
8408where
8409 C: 'a,
8410{
8411 hub: &'a Walletobjects<C>,
8412 _token: Option<String>,
8413 _max_results: Option<i32>,
8414 _issuer_id: Option<i64>,
8415 _delegate: Option<&'a mut dyn common::Delegate>,
8416 _additional_params: HashMap<String, String>,
8417 _scopes: BTreeSet<String>,
8418}
8419
8420impl<'a, C> common::CallBuilder for EventticketclasListCall<'a, C> {}
8421
8422impl<'a, C> EventticketclasListCall<'a, C>
8423where
8424 C: common::Connector,
8425{
8426 /// Perform the operation you have build so far.
8427 pub async fn doit(
8428 mut self,
8429 ) -> common::Result<(common::Response, EventTicketClassListResponse)> {
8430 use std::borrow::Cow;
8431 use std::io::{Read, Seek};
8432
8433 use common::{url::Params, ToParts};
8434 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8435
8436 let mut dd = common::DefaultDelegate;
8437 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8438 dlg.begin(common::MethodInfo {
8439 id: "walletobjects.eventticketclass.list",
8440 http_method: hyper::Method::GET,
8441 });
8442
8443 for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
8444 if self._additional_params.contains_key(field) {
8445 dlg.finished(false);
8446 return Err(common::Error::FieldClash(field));
8447 }
8448 }
8449
8450 let mut params = Params::with_capacity(5 + self._additional_params.len());
8451 if let Some(value) = self._token.as_ref() {
8452 params.push("token", value);
8453 }
8454 if let Some(value) = self._max_results.as_ref() {
8455 params.push("maxResults", value.to_string());
8456 }
8457 if let Some(value) = self._issuer_id.as_ref() {
8458 params.push("issuerId", value.to_string());
8459 }
8460
8461 params.extend(self._additional_params.iter());
8462
8463 params.push("alt", "json");
8464 let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass";
8465 if self._scopes.is_empty() {
8466 self._scopes
8467 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
8468 }
8469
8470 let url = params.parse_with_url(&url);
8471
8472 loop {
8473 let token = match self
8474 .hub
8475 .auth
8476 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8477 .await
8478 {
8479 Ok(token) => token,
8480 Err(e) => match dlg.token(e) {
8481 Ok(token) => token,
8482 Err(e) => {
8483 dlg.finished(false);
8484 return Err(common::Error::MissingToken(e));
8485 }
8486 },
8487 };
8488 let mut req_result = {
8489 let client = &self.hub.client;
8490 dlg.pre_request();
8491 let mut req_builder = hyper::Request::builder()
8492 .method(hyper::Method::GET)
8493 .uri(url.as_str())
8494 .header(USER_AGENT, self.hub._user_agent.clone());
8495
8496 if let Some(token) = token.as_ref() {
8497 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8498 }
8499
8500 let request = req_builder
8501 .header(CONTENT_LENGTH, 0_u64)
8502 .body(common::to_body::<String>(None));
8503
8504 client.request(request.unwrap()).await
8505 };
8506
8507 match req_result {
8508 Err(err) => {
8509 if let common::Retry::After(d) = dlg.http_error(&err) {
8510 sleep(d).await;
8511 continue;
8512 }
8513 dlg.finished(false);
8514 return Err(common::Error::HttpError(err));
8515 }
8516 Ok(res) => {
8517 let (mut parts, body) = res.into_parts();
8518 let mut body = common::Body::new(body);
8519 if !parts.status.is_success() {
8520 let bytes = common::to_bytes(body).await.unwrap_or_default();
8521 let error = serde_json::from_str(&common::to_string(&bytes));
8522 let response = common::to_response(parts, bytes.into());
8523
8524 if let common::Retry::After(d) =
8525 dlg.http_failure(&response, error.as_ref().ok())
8526 {
8527 sleep(d).await;
8528 continue;
8529 }
8530
8531 dlg.finished(false);
8532
8533 return Err(match error {
8534 Ok(value) => common::Error::BadRequest(value),
8535 _ => common::Error::Failure(response),
8536 });
8537 }
8538 let response = {
8539 let bytes = common::to_bytes(body).await.unwrap_or_default();
8540 let encoded = common::to_string(&bytes);
8541 match serde_json::from_str(&encoded) {
8542 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8543 Err(error) => {
8544 dlg.response_json_decode_error(&encoded, &error);
8545 return Err(common::Error::JsonDecodeError(
8546 encoded.to_string(),
8547 error,
8548 ));
8549 }
8550 }
8551 };
8552
8553 dlg.finished(true);
8554 return Ok(response);
8555 }
8556 }
8557 }
8558 }
8559
8560 /// 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.
8561 ///
8562 /// Sets the *token* query property to the given value.
8563 pub fn token(mut self, new_value: &str) -> EventticketclasListCall<'a, C> {
8564 self._token = Some(new_value.to_string());
8565 self
8566 }
8567 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
8568 ///
8569 /// Sets the *max results* query property to the given value.
8570 pub fn max_results(mut self, new_value: i32) -> EventticketclasListCall<'a, C> {
8571 self._max_results = Some(new_value);
8572 self
8573 }
8574 /// The ID of the issuer authorized to list classes.
8575 ///
8576 /// Sets the *issuer id* query property to the given value.
8577 pub fn issuer_id(mut self, new_value: i64) -> EventticketclasListCall<'a, C> {
8578 self._issuer_id = Some(new_value);
8579 self
8580 }
8581 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8582 /// while executing the actual API request.
8583 ///
8584 /// ````text
8585 /// It should be used to handle progress information, and to implement a certain level of resilience.
8586 /// ````
8587 ///
8588 /// Sets the *delegate* property to the given value.
8589 pub fn delegate(
8590 mut self,
8591 new_value: &'a mut dyn common::Delegate,
8592 ) -> EventticketclasListCall<'a, C> {
8593 self._delegate = Some(new_value);
8594 self
8595 }
8596
8597 /// Set any additional parameter of the query string used in the request.
8598 /// It should be used to set parameters which are not yet available through their own
8599 /// setters.
8600 ///
8601 /// Please note that this method must not be used to set any of the known parameters
8602 /// which have their own setter method. If done anyway, the request will fail.
8603 ///
8604 /// # Additional Parameters
8605 ///
8606 /// * *$.xgafv* (query-string) - V1 error format.
8607 /// * *access_token* (query-string) - OAuth access token.
8608 /// * *alt* (query-string) - Data format for response.
8609 /// * *callback* (query-string) - JSONP
8610 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8611 /// * *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.
8612 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8613 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8614 /// * *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.
8615 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8616 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8617 pub fn param<T>(mut self, name: T, value: T) -> EventticketclasListCall<'a, C>
8618 where
8619 T: AsRef<str>,
8620 {
8621 self._additional_params
8622 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8623 self
8624 }
8625
8626 /// Identifies the authorization scope for the method you are building.
8627 ///
8628 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8629 /// [`Scope::WalletObjectIssuer`].
8630 ///
8631 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8632 /// tokens for more than one scope.
8633 ///
8634 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8635 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8636 /// sufficient, a read-write scope will do as well.
8637 pub fn add_scope<St>(mut self, scope: St) -> EventticketclasListCall<'a, C>
8638 where
8639 St: AsRef<str>,
8640 {
8641 self._scopes.insert(String::from(scope.as_ref()));
8642 self
8643 }
8644 /// Identifies the authorization scope(s) for the method you are building.
8645 ///
8646 /// See [`Self::add_scope()`] for details.
8647 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasListCall<'a, C>
8648 where
8649 I: IntoIterator<Item = St>,
8650 St: AsRef<str>,
8651 {
8652 self._scopes
8653 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8654 self
8655 }
8656
8657 /// Removes all scopes, and no default scope will be used either.
8658 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8659 /// for details).
8660 pub fn clear_scopes(mut self) -> EventticketclasListCall<'a, C> {
8661 self._scopes.clear();
8662 self
8663 }
8664}
8665
8666/// Updates the event ticket class referenced by the given class ID. This method supports patch semantics.
8667///
8668/// A builder for the *patch* method supported by a *eventticketclas* resource.
8669/// It is not used directly, but through a [`EventticketclasMethods`] instance.
8670///
8671/// # Example
8672///
8673/// Instantiate a resource method builder
8674///
8675/// ```test_harness,no_run
8676/// # extern crate hyper;
8677/// # extern crate hyper_rustls;
8678/// # extern crate google_walletobjects1 as walletobjects1;
8679/// use walletobjects1::api::EventTicketClass;
8680/// # async fn dox() {
8681/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8682///
8683/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8684/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8685/// # secret,
8686/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8687/// # ).build().await.unwrap();
8688///
8689/// # let client = hyper_util::client::legacy::Client::builder(
8690/// # hyper_util::rt::TokioExecutor::new()
8691/// # )
8692/// # .build(
8693/// # hyper_rustls::HttpsConnectorBuilder::new()
8694/// # .with_native_roots()
8695/// # .unwrap()
8696/// # .https_or_http()
8697/// # .enable_http1()
8698/// # .build()
8699/// # );
8700/// # let mut hub = Walletobjects::new(client, auth);
8701/// // As the method needs a request, you would usually fill it with the desired information
8702/// // into the respective structure. Some of the parts shown here might not be applicable !
8703/// // Values shown here are possibly random and not representative !
8704/// let mut req = EventTicketClass::default();
8705///
8706/// // You can configure optional parameters by calling the respective setters at will, and
8707/// // execute the final call using `doit()`.
8708/// // Values shown here are possibly random and not representative !
8709/// let result = hub.eventticketclass().patch(req, "resourceId")
8710/// .doit().await;
8711/// # }
8712/// ```
8713pub struct EventticketclasPatchCall<'a, C>
8714where
8715 C: 'a,
8716{
8717 hub: &'a Walletobjects<C>,
8718 _request: EventTicketClass,
8719 _resource_id: String,
8720 _delegate: Option<&'a mut dyn common::Delegate>,
8721 _additional_params: HashMap<String, String>,
8722 _scopes: BTreeSet<String>,
8723}
8724
8725impl<'a, C> common::CallBuilder for EventticketclasPatchCall<'a, C> {}
8726
8727impl<'a, C> EventticketclasPatchCall<'a, C>
8728where
8729 C: common::Connector,
8730{
8731 /// Perform the operation you have build so far.
8732 pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketClass)> {
8733 use std::borrow::Cow;
8734 use std::io::{Read, Seek};
8735
8736 use common::{url::Params, ToParts};
8737 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8738
8739 let mut dd = common::DefaultDelegate;
8740 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8741 dlg.begin(common::MethodInfo {
8742 id: "walletobjects.eventticketclass.patch",
8743 http_method: hyper::Method::PATCH,
8744 });
8745
8746 for &field in ["alt", "resourceId"].iter() {
8747 if self._additional_params.contains_key(field) {
8748 dlg.finished(false);
8749 return Err(common::Error::FieldClash(field));
8750 }
8751 }
8752
8753 let mut params = Params::with_capacity(4 + self._additional_params.len());
8754 params.push("resourceId", self._resource_id);
8755
8756 params.extend(self._additional_params.iter());
8757
8758 params.push("alt", "json");
8759 let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass/{resourceId}";
8760 if self._scopes.is_empty() {
8761 self._scopes
8762 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
8763 }
8764
8765 #[allow(clippy::single_element_loop)]
8766 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
8767 url = params.uri_replacement(url, param_name, find_this, false);
8768 }
8769 {
8770 let to_remove = ["resourceId"];
8771 params.remove_params(&to_remove);
8772 }
8773
8774 let url = params.parse_with_url(&url);
8775
8776 let mut json_mime_type = mime::APPLICATION_JSON;
8777 let mut request_value_reader = {
8778 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8779 common::remove_json_null_values(&mut value);
8780 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8781 serde_json::to_writer(&mut dst, &value).unwrap();
8782 dst
8783 };
8784 let request_size = request_value_reader
8785 .seek(std::io::SeekFrom::End(0))
8786 .unwrap();
8787 request_value_reader
8788 .seek(std::io::SeekFrom::Start(0))
8789 .unwrap();
8790
8791 loop {
8792 let token = match self
8793 .hub
8794 .auth
8795 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8796 .await
8797 {
8798 Ok(token) => token,
8799 Err(e) => match dlg.token(e) {
8800 Ok(token) => token,
8801 Err(e) => {
8802 dlg.finished(false);
8803 return Err(common::Error::MissingToken(e));
8804 }
8805 },
8806 };
8807 request_value_reader
8808 .seek(std::io::SeekFrom::Start(0))
8809 .unwrap();
8810 let mut req_result = {
8811 let client = &self.hub.client;
8812 dlg.pre_request();
8813 let mut req_builder = hyper::Request::builder()
8814 .method(hyper::Method::PATCH)
8815 .uri(url.as_str())
8816 .header(USER_AGENT, self.hub._user_agent.clone());
8817
8818 if let Some(token) = token.as_ref() {
8819 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8820 }
8821
8822 let request = req_builder
8823 .header(CONTENT_TYPE, json_mime_type.to_string())
8824 .header(CONTENT_LENGTH, request_size as u64)
8825 .body(common::to_body(
8826 request_value_reader.get_ref().clone().into(),
8827 ));
8828
8829 client.request(request.unwrap()).await
8830 };
8831
8832 match req_result {
8833 Err(err) => {
8834 if let common::Retry::After(d) = dlg.http_error(&err) {
8835 sleep(d).await;
8836 continue;
8837 }
8838 dlg.finished(false);
8839 return Err(common::Error::HttpError(err));
8840 }
8841 Ok(res) => {
8842 let (mut parts, body) = res.into_parts();
8843 let mut body = common::Body::new(body);
8844 if !parts.status.is_success() {
8845 let bytes = common::to_bytes(body).await.unwrap_or_default();
8846 let error = serde_json::from_str(&common::to_string(&bytes));
8847 let response = common::to_response(parts, bytes.into());
8848
8849 if let common::Retry::After(d) =
8850 dlg.http_failure(&response, error.as_ref().ok())
8851 {
8852 sleep(d).await;
8853 continue;
8854 }
8855
8856 dlg.finished(false);
8857
8858 return Err(match error {
8859 Ok(value) => common::Error::BadRequest(value),
8860 _ => common::Error::Failure(response),
8861 });
8862 }
8863 let response = {
8864 let bytes = common::to_bytes(body).await.unwrap_or_default();
8865 let encoded = common::to_string(&bytes);
8866 match serde_json::from_str(&encoded) {
8867 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8868 Err(error) => {
8869 dlg.response_json_decode_error(&encoded, &error);
8870 return Err(common::Error::JsonDecodeError(
8871 encoded.to_string(),
8872 error,
8873 ));
8874 }
8875 }
8876 };
8877
8878 dlg.finished(true);
8879 return Ok(response);
8880 }
8881 }
8882 }
8883 }
8884
8885 ///
8886 /// Sets the *request* property to the given value.
8887 ///
8888 /// Even though the property as already been set when instantiating this call,
8889 /// we provide this method for API completeness.
8890 pub fn request(mut self, new_value: EventTicketClass) -> EventticketclasPatchCall<'a, C> {
8891 self._request = new_value;
8892 self
8893 }
8894 /// 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 '-'.
8895 ///
8896 /// Sets the *resource id* path property to the given value.
8897 ///
8898 /// Even though the property as already been set when instantiating this call,
8899 /// we provide this method for API completeness.
8900 pub fn resource_id(mut self, new_value: &str) -> EventticketclasPatchCall<'a, C> {
8901 self._resource_id = new_value.to_string();
8902 self
8903 }
8904 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8905 /// while executing the actual API request.
8906 ///
8907 /// ````text
8908 /// It should be used to handle progress information, and to implement a certain level of resilience.
8909 /// ````
8910 ///
8911 /// Sets the *delegate* property to the given value.
8912 pub fn delegate(
8913 mut self,
8914 new_value: &'a mut dyn common::Delegate,
8915 ) -> EventticketclasPatchCall<'a, C> {
8916 self._delegate = Some(new_value);
8917 self
8918 }
8919
8920 /// Set any additional parameter of the query string used in the request.
8921 /// It should be used to set parameters which are not yet available through their own
8922 /// setters.
8923 ///
8924 /// Please note that this method must not be used to set any of the known parameters
8925 /// which have their own setter method. If done anyway, the request will fail.
8926 ///
8927 /// # Additional Parameters
8928 ///
8929 /// * *$.xgafv* (query-string) - V1 error format.
8930 /// * *access_token* (query-string) - OAuth access token.
8931 /// * *alt* (query-string) - Data format for response.
8932 /// * *callback* (query-string) - JSONP
8933 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8934 /// * *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.
8935 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8936 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8937 /// * *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.
8938 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8939 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8940 pub fn param<T>(mut self, name: T, value: T) -> EventticketclasPatchCall<'a, C>
8941 where
8942 T: AsRef<str>,
8943 {
8944 self._additional_params
8945 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8946 self
8947 }
8948
8949 /// Identifies the authorization scope for the method you are building.
8950 ///
8951 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8952 /// [`Scope::WalletObjectIssuer`].
8953 ///
8954 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8955 /// tokens for more than one scope.
8956 ///
8957 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8958 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8959 /// sufficient, a read-write scope will do as well.
8960 pub fn add_scope<St>(mut self, scope: St) -> EventticketclasPatchCall<'a, C>
8961 where
8962 St: AsRef<str>,
8963 {
8964 self._scopes.insert(String::from(scope.as_ref()));
8965 self
8966 }
8967 /// Identifies the authorization scope(s) for the method you are building.
8968 ///
8969 /// See [`Self::add_scope()`] for details.
8970 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasPatchCall<'a, C>
8971 where
8972 I: IntoIterator<Item = St>,
8973 St: AsRef<str>,
8974 {
8975 self._scopes
8976 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8977 self
8978 }
8979
8980 /// Removes all scopes, and no default scope will be used either.
8981 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8982 /// for details).
8983 pub fn clear_scopes(mut self) -> EventticketclasPatchCall<'a, C> {
8984 self._scopes.clear();
8985 self
8986 }
8987}
8988
8989/// Updates the event ticket class referenced by the given class ID.
8990///
8991/// A builder for the *update* method supported by a *eventticketclas* resource.
8992/// It is not used directly, but through a [`EventticketclasMethods`] instance.
8993///
8994/// # Example
8995///
8996/// Instantiate a resource method builder
8997///
8998/// ```test_harness,no_run
8999/// # extern crate hyper;
9000/// # extern crate hyper_rustls;
9001/// # extern crate google_walletobjects1 as walletobjects1;
9002/// use walletobjects1::api::EventTicketClass;
9003/// # async fn dox() {
9004/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9005///
9006/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9007/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9008/// # secret,
9009/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9010/// # ).build().await.unwrap();
9011///
9012/// # let client = hyper_util::client::legacy::Client::builder(
9013/// # hyper_util::rt::TokioExecutor::new()
9014/// # )
9015/// # .build(
9016/// # hyper_rustls::HttpsConnectorBuilder::new()
9017/// # .with_native_roots()
9018/// # .unwrap()
9019/// # .https_or_http()
9020/// # .enable_http1()
9021/// # .build()
9022/// # );
9023/// # let mut hub = Walletobjects::new(client, auth);
9024/// // As the method needs a request, you would usually fill it with the desired information
9025/// // into the respective structure. Some of the parts shown here might not be applicable !
9026/// // Values shown here are possibly random and not representative !
9027/// let mut req = EventTicketClass::default();
9028///
9029/// // You can configure optional parameters by calling the respective setters at will, and
9030/// // execute the final call using `doit()`.
9031/// // Values shown here are possibly random and not representative !
9032/// let result = hub.eventticketclass().update(req, "resourceId")
9033/// .doit().await;
9034/// # }
9035/// ```
9036pub struct EventticketclasUpdateCall<'a, C>
9037where
9038 C: 'a,
9039{
9040 hub: &'a Walletobjects<C>,
9041 _request: EventTicketClass,
9042 _resource_id: String,
9043 _delegate: Option<&'a mut dyn common::Delegate>,
9044 _additional_params: HashMap<String, String>,
9045 _scopes: BTreeSet<String>,
9046}
9047
9048impl<'a, C> common::CallBuilder for EventticketclasUpdateCall<'a, C> {}
9049
9050impl<'a, C> EventticketclasUpdateCall<'a, C>
9051where
9052 C: common::Connector,
9053{
9054 /// Perform the operation you have build so far.
9055 pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketClass)> {
9056 use std::borrow::Cow;
9057 use std::io::{Read, Seek};
9058
9059 use common::{url::Params, ToParts};
9060 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9061
9062 let mut dd = common::DefaultDelegate;
9063 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9064 dlg.begin(common::MethodInfo {
9065 id: "walletobjects.eventticketclass.update",
9066 http_method: hyper::Method::PUT,
9067 });
9068
9069 for &field in ["alt", "resourceId"].iter() {
9070 if self._additional_params.contains_key(field) {
9071 dlg.finished(false);
9072 return Err(common::Error::FieldClash(field));
9073 }
9074 }
9075
9076 let mut params = Params::with_capacity(4 + self._additional_params.len());
9077 params.push("resourceId", self._resource_id);
9078
9079 params.extend(self._additional_params.iter());
9080
9081 params.push("alt", "json");
9082 let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketClass/{resourceId}";
9083 if self._scopes.is_empty() {
9084 self._scopes
9085 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
9086 }
9087
9088 #[allow(clippy::single_element_loop)]
9089 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
9090 url = params.uri_replacement(url, param_name, find_this, false);
9091 }
9092 {
9093 let to_remove = ["resourceId"];
9094 params.remove_params(&to_remove);
9095 }
9096
9097 let url = params.parse_with_url(&url);
9098
9099 let mut json_mime_type = mime::APPLICATION_JSON;
9100 let mut request_value_reader = {
9101 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9102 common::remove_json_null_values(&mut value);
9103 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9104 serde_json::to_writer(&mut dst, &value).unwrap();
9105 dst
9106 };
9107 let request_size = request_value_reader
9108 .seek(std::io::SeekFrom::End(0))
9109 .unwrap();
9110 request_value_reader
9111 .seek(std::io::SeekFrom::Start(0))
9112 .unwrap();
9113
9114 loop {
9115 let token = match self
9116 .hub
9117 .auth
9118 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9119 .await
9120 {
9121 Ok(token) => token,
9122 Err(e) => match dlg.token(e) {
9123 Ok(token) => token,
9124 Err(e) => {
9125 dlg.finished(false);
9126 return Err(common::Error::MissingToken(e));
9127 }
9128 },
9129 };
9130 request_value_reader
9131 .seek(std::io::SeekFrom::Start(0))
9132 .unwrap();
9133 let mut req_result = {
9134 let client = &self.hub.client;
9135 dlg.pre_request();
9136 let mut req_builder = hyper::Request::builder()
9137 .method(hyper::Method::PUT)
9138 .uri(url.as_str())
9139 .header(USER_AGENT, self.hub._user_agent.clone());
9140
9141 if let Some(token) = token.as_ref() {
9142 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9143 }
9144
9145 let request = req_builder
9146 .header(CONTENT_TYPE, json_mime_type.to_string())
9147 .header(CONTENT_LENGTH, request_size as u64)
9148 .body(common::to_body(
9149 request_value_reader.get_ref().clone().into(),
9150 ));
9151
9152 client.request(request.unwrap()).await
9153 };
9154
9155 match req_result {
9156 Err(err) => {
9157 if let common::Retry::After(d) = dlg.http_error(&err) {
9158 sleep(d).await;
9159 continue;
9160 }
9161 dlg.finished(false);
9162 return Err(common::Error::HttpError(err));
9163 }
9164 Ok(res) => {
9165 let (mut parts, body) = res.into_parts();
9166 let mut body = common::Body::new(body);
9167 if !parts.status.is_success() {
9168 let bytes = common::to_bytes(body).await.unwrap_or_default();
9169 let error = serde_json::from_str(&common::to_string(&bytes));
9170 let response = common::to_response(parts, bytes.into());
9171
9172 if let common::Retry::After(d) =
9173 dlg.http_failure(&response, error.as_ref().ok())
9174 {
9175 sleep(d).await;
9176 continue;
9177 }
9178
9179 dlg.finished(false);
9180
9181 return Err(match error {
9182 Ok(value) => common::Error::BadRequest(value),
9183 _ => common::Error::Failure(response),
9184 });
9185 }
9186 let response = {
9187 let bytes = common::to_bytes(body).await.unwrap_or_default();
9188 let encoded = common::to_string(&bytes);
9189 match serde_json::from_str(&encoded) {
9190 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9191 Err(error) => {
9192 dlg.response_json_decode_error(&encoded, &error);
9193 return Err(common::Error::JsonDecodeError(
9194 encoded.to_string(),
9195 error,
9196 ));
9197 }
9198 }
9199 };
9200
9201 dlg.finished(true);
9202 return Ok(response);
9203 }
9204 }
9205 }
9206 }
9207
9208 ///
9209 /// Sets the *request* property to the given value.
9210 ///
9211 /// Even though the property as already been set when instantiating this call,
9212 /// we provide this method for API completeness.
9213 pub fn request(mut self, new_value: EventTicketClass) -> EventticketclasUpdateCall<'a, C> {
9214 self._request = new_value;
9215 self
9216 }
9217 /// 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 '-'.
9218 ///
9219 /// Sets the *resource id* path property to the given value.
9220 ///
9221 /// Even though the property as already been set when instantiating this call,
9222 /// we provide this method for API completeness.
9223 pub fn resource_id(mut self, new_value: &str) -> EventticketclasUpdateCall<'a, C> {
9224 self._resource_id = new_value.to_string();
9225 self
9226 }
9227 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9228 /// while executing the actual API request.
9229 ///
9230 /// ````text
9231 /// It should be used to handle progress information, and to implement a certain level of resilience.
9232 /// ````
9233 ///
9234 /// Sets the *delegate* property to the given value.
9235 pub fn delegate(
9236 mut self,
9237 new_value: &'a mut dyn common::Delegate,
9238 ) -> EventticketclasUpdateCall<'a, C> {
9239 self._delegate = Some(new_value);
9240 self
9241 }
9242
9243 /// Set any additional parameter of the query string used in the request.
9244 /// It should be used to set parameters which are not yet available through their own
9245 /// setters.
9246 ///
9247 /// Please note that this method must not be used to set any of the known parameters
9248 /// which have their own setter method. If done anyway, the request will fail.
9249 ///
9250 /// # Additional Parameters
9251 ///
9252 /// * *$.xgafv* (query-string) - V1 error format.
9253 /// * *access_token* (query-string) - OAuth access token.
9254 /// * *alt* (query-string) - Data format for response.
9255 /// * *callback* (query-string) - JSONP
9256 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9257 /// * *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.
9258 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9259 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9260 /// * *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.
9261 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9262 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9263 pub fn param<T>(mut self, name: T, value: T) -> EventticketclasUpdateCall<'a, C>
9264 where
9265 T: AsRef<str>,
9266 {
9267 self._additional_params
9268 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9269 self
9270 }
9271
9272 /// Identifies the authorization scope for the method you are building.
9273 ///
9274 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9275 /// [`Scope::WalletObjectIssuer`].
9276 ///
9277 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9278 /// tokens for more than one scope.
9279 ///
9280 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9281 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9282 /// sufficient, a read-write scope will do as well.
9283 pub fn add_scope<St>(mut self, scope: St) -> EventticketclasUpdateCall<'a, C>
9284 where
9285 St: AsRef<str>,
9286 {
9287 self._scopes.insert(String::from(scope.as_ref()));
9288 self
9289 }
9290 /// Identifies the authorization scope(s) for the method you are building.
9291 ///
9292 /// See [`Self::add_scope()`] for details.
9293 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketclasUpdateCall<'a, C>
9294 where
9295 I: IntoIterator<Item = St>,
9296 St: AsRef<str>,
9297 {
9298 self._scopes
9299 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9300 self
9301 }
9302
9303 /// Removes all scopes, and no default scope will be used either.
9304 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9305 /// for details).
9306 pub fn clear_scopes(mut self) -> EventticketclasUpdateCall<'a, C> {
9307 self._scopes.clear();
9308 self
9309 }
9310}
9311
9312/// Adds a message to the event ticket object referenced by the given object ID.
9313///
9314/// A builder for the *addmessage* method supported by a *eventticketobject* resource.
9315/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
9316///
9317/// # Example
9318///
9319/// Instantiate a resource method builder
9320///
9321/// ```test_harness,no_run
9322/// # extern crate hyper;
9323/// # extern crate hyper_rustls;
9324/// # extern crate google_walletobjects1 as walletobjects1;
9325/// use walletobjects1::api::AddMessageRequest;
9326/// # async fn dox() {
9327/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9328///
9329/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9330/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9331/// # secret,
9332/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9333/// # ).build().await.unwrap();
9334///
9335/// # let client = hyper_util::client::legacy::Client::builder(
9336/// # hyper_util::rt::TokioExecutor::new()
9337/// # )
9338/// # .build(
9339/// # hyper_rustls::HttpsConnectorBuilder::new()
9340/// # .with_native_roots()
9341/// # .unwrap()
9342/// # .https_or_http()
9343/// # .enable_http1()
9344/// # .build()
9345/// # );
9346/// # let mut hub = Walletobjects::new(client, auth);
9347/// // As the method needs a request, you would usually fill it with the desired information
9348/// // into the respective structure. Some of the parts shown here might not be applicable !
9349/// // Values shown here are possibly random and not representative !
9350/// let mut req = AddMessageRequest::default();
9351///
9352/// // You can configure optional parameters by calling the respective setters at will, and
9353/// // execute the final call using `doit()`.
9354/// // Values shown here are possibly random and not representative !
9355/// let result = hub.eventticketobject().addmessage(req, "resourceId")
9356/// .doit().await;
9357/// # }
9358/// ```
9359pub struct EventticketobjectAddmessageCall<'a, C>
9360where
9361 C: 'a,
9362{
9363 hub: &'a Walletobjects<C>,
9364 _request: AddMessageRequest,
9365 _resource_id: String,
9366 _delegate: Option<&'a mut dyn common::Delegate>,
9367 _additional_params: HashMap<String, String>,
9368 _scopes: BTreeSet<String>,
9369}
9370
9371impl<'a, C> common::CallBuilder for EventticketobjectAddmessageCall<'a, C> {}
9372
9373impl<'a, C> EventticketobjectAddmessageCall<'a, C>
9374where
9375 C: common::Connector,
9376{
9377 /// Perform the operation you have build so far.
9378 pub async fn doit(
9379 mut self,
9380 ) -> common::Result<(common::Response, EventTicketObjectAddMessageResponse)> {
9381 use std::borrow::Cow;
9382 use std::io::{Read, Seek};
9383
9384 use common::{url::Params, ToParts};
9385 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9386
9387 let mut dd = common::DefaultDelegate;
9388 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9389 dlg.begin(common::MethodInfo {
9390 id: "walletobjects.eventticketobject.addmessage",
9391 http_method: hyper::Method::POST,
9392 });
9393
9394 for &field in ["alt", "resourceId"].iter() {
9395 if self._additional_params.contains_key(field) {
9396 dlg.finished(false);
9397 return Err(common::Error::FieldClash(field));
9398 }
9399 }
9400
9401 let mut params = Params::with_capacity(4 + self._additional_params.len());
9402 params.push("resourceId", self._resource_id);
9403
9404 params.extend(self._additional_params.iter());
9405
9406 params.push("alt", "json");
9407 let mut url = self.hub._base_url.clone()
9408 + "walletobjects/v1/eventTicketObject/{resourceId}/addMessage";
9409 if self._scopes.is_empty() {
9410 self._scopes
9411 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
9412 }
9413
9414 #[allow(clippy::single_element_loop)]
9415 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
9416 url = params.uri_replacement(url, param_name, find_this, false);
9417 }
9418 {
9419 let to_remove = ["resourceId"];
9420 params.remove_params(&to_remove);
9421 }
9422
9423 let url = params.parse_with_url(&url);
9424
9425 let mut json_mime_type = mime::APPLICATION_JSON;
9426 let mut request_value_reader = {
9427 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9428 common::remove_json_null_values(&mut value);
9429 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9430 serde_json::to_writer(&mut dst, &value).unwrap();
9431 dst
9432 };
9433 let request_size = request_value_reader
9434 .seek(std::io::SeekFrom::End(0))
9435 .unwrap();
9436 request_value_reader
9437 .seek(std::io::SeekFrom::Start(0))
9438 .unwrap();
9439
9440 loop {
9441 let token = match self
9442 .hub
9443 .auth
9444 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9445 .await
9446 {
9447 Ok(token) => token,
9448 Err(e) => match dlg.token(e) {
9449 Ok(token) => token,
9450 Err(e) => {
9451 dlg.finished(false);
9452 return Err(common::Error::MissingToken(e));
9453 }
9454 },
9455 };
9456 request_value_reader
9457 .seek(std::io::SeekFrom::Start(0))
9458 .unwrap();
9459 let mut req_result = {
9460 let client = &self.hub.client;
9461 dlg.pre_request();
9462 let mut req_builder = hyper::Request::builder()
9463 .method(hyper::Method::POST)
9464 .uri(url.as_str())
9465 .header(USER_AGENT, self.hub._user_agent.clone());
9466
9467 if let Some(token) = token.as_ref() {
9468 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9469 }
9470
9471 let request = req_builder
9472 .header(CONTENT_TYPE, json_mime_type.to_string())
9473 .header(CONTENT_LENGTH, request_size as u64)
9474 .body(common::to_body(
9475 request_value_reader.get_ref().clone().into(),
9476 ));
9477
9478 client.request(request.unwrap()).await
9479 };
9480
9481 match req_result {
9482 Err(err) => {
9483 if let common::Retry::After(d) = dlg.http_error(&err) {
9484 sleep(d).await;
9485 continue;
9486 }
9487 dlg.finished(false);
9488 return Err(common::Error::HttpError(err));
9489 }
9490 Ok(res) => {
9491 let (mut parts, body) = res.into_parts();
9492 let mut body = common::Body::new(body);
9493 if !parts.status.is_success() {
9494 let bytes = common::to_bytes(body).await.unwrap_or_default();
9495 let error = serde_json::from_str(&common::to_string(&bytes));
9496 let response = common::to_response(parts, bytes.into());
9497
9498 if let common::Retry::After(d) =
9499 dlg.http_failure(&response, error.as_ref().ok())
9500 {
9501 sleep(d).await;
9502 continue;
9503 }
9504
9505 dlg.finished(false);
9506
9507 return Err(match error {
9508 Ok(value) => common::Error::BadRequest(value),
9509 _ => common::Error::Failure(response),
9510 });
9511 }
9512 let response = {
9513 let bytes = common::to_bytes(body).await.unwrap_or_default();
9514 let encoded = common::to_string(&bytes);
9515 match serde_json::from_str(&encoded) {
9516 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9517 Err(error) => {
9518 dlg.response_json_decode_error(&encoded, &error);
9519 return Err(common::Error::JsonDecodeError(
9520 encoded.to_string(),
9521 error,
9522 ));
9523 }
9524 }
9525 };
9526
9527 dlg.finished(true);
9528 return Ok(response);
9529 }
9530 }
9531 }
9532 }
9533
9534 ///
9535 /// Sets the *request* property to the given value.
9536 ///
9537 /// Even though the property as already been set when instantiating this call,
9538 /// we provide this method for API completeness.
9539 pub fn request(
9540 mut self,
9541 new_value: AddMessageRequest,
9542 ) -> EventticketobjectAddmessageCall<'a, C> {
9543 self._request = new_value;
9544 self
9545 }
9546 /// 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 '-'.
9547 ///
9548 /// Sets the *resource id* path property to the given value.
9549 ///
9550 /// Even though the property as already been set when instantiating this call,
9551 /// we provide this method for API completeness.
9552 pub fn resource_id(mut self, new_value: &str) -> EventticketobjectAddmessageCall<'a, C> {
9553 self._resource_id = new_value.to_string();
9554 self
9555 }
9556 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9557 /// while executing the actual API request.
9558 ///
9559 /// ````text
9560 /// It should be used to handle progress information, and to implement a certain level of resilience.
9561 /// ````
9562 ///
9563 /// Sets the *delegate* property to the given value.
9564 pub fn delegate(
9565 mut self,
9566 new_value: &'a mut dyn common::Delegate,
9567 ) -> EventticketobjectAddmessageCall<'a, C> {
9568 self._delegate = Some(new_value);
9569 self
9570 }
9571
9572 /// Set any additional parameter of the query string used in the request.
9573 /// It should be used to set parameters which are not yet available through their own
9574 /// setters.
9575 ///
9576 /// Please note that this method must not be used to set any of the known parameters
9577 /// which have their own setter method. If done anyway, the request will fail.
9578 ///
9579 /// # Additional Parameters
9580 ///
9581 /// * *$.xgafv* (query-string) - V1 error format.
9582 /// * *access_token* (query-string) - OAuth access token.
9583 /// * *alt* (query-string) - Data format for response.
9584 /// * *callback* (query-string) - JSONP
9585 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9586 /// * *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.
9587 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9588 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9589 /// * *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.
9590 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9591 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9592 pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectAddmessageCall<'a, C>
9593 where
9594 T: AsRef<str>,
9595 {
9596 self._additional_params
9597 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9598 self
9599 }
9600
9601 /// Identifies the authorization scope for the method you are building.
9602 ///
9603 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9604 /// [`Scope::WalletObjectIssuer`].
9605 ///
9606 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9607 /// tokens for more than one scope.
9608 ///
9609 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9610 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9611 /// sufficient, a read-write scope will do as well.
9612 pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectAddmessageCall<'a, C>
9613 where
9614 St: AsRef<str>,
9615 {
9616 self._scopes.insert(String::from(scope.as_ref()));
9617 self
9618 }
9619 /// Identifies the authorization scope(s) for the method you are building.
9620 ///
9621 /// See [`Self::add_scope()`] for details.
9622 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectAddmessageCall<'a, C>
9623 where
9624 I: IntoIterator<Item = St>,
9625 St: AsRef<str>,
9626 {
9627 self._scopes
9628 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9629 self
9630 }
9631
9632 /// Removes all scopes, and no default scope will be used either.
9633 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9634 /// for details).
9635 pub fn clear_scopes(mut self) -> EventticketobjectAddmessageCall<'a, C> {
9636 self._scopes.clear();
9637 self
9638 }
9639}
9640
9641/// Returns the event ticket object with the given object ID.
9642///
9643/// A builder for the *get* method supported by a *eventticketobject* resource.
9644/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
9645///
9646/// # Example
9647///
9648/// Instantiate a resource method builder
9649///
9650/// ```test_harness,no_run
9651/// # extern crate hyper;
9652/// # extern crate hyper_rustls;
9653/// # extern crate google_walletobjects1 as walletobjects1;
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 auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9659/// # secret,
9660/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9661/// # ).build().await.unwrap();
9662///
9663/// # let client = hyper_util::client::legacy::Client::builder(
9664/// # hyper_util::rt::TokioExecutor::new()
9665/// # )
9666/// # .build(
9667/// # hyper_rustls::HttpsConnectorBuilder::new()
9668/// # .with_native_roots()
9669/// # .unwrap()
9670/// # .https_or_http()
9671/// # .enable_http1()
9672/// # .build()
9673/// # );
9674/// # let mut hub = Walletobjects::new(client, auth);
9675/// // You can configure optional parameters by calling the respective setters at will, and
9676/// // execute the final call using `doit()`.
9677/// // Values shown here are possibly random and not representative !
9678/// let result = hub.eventticketobject().get("resourceId")
9679/// .doit().await;
9680/// # }
9681/// ```
9682pub struct EventticketobjectGetCall<'a, C>
9683where
9684 C: 'a,
9685{
9686 hub: &'a Walletobjects<C>,
9687 _resource_id: String,
9688 _delegate: Option<&'a mut dyn common::Delegate>,
9689 _additional_params: HashMap<String, String>,
9690 _scopes: BTreeSet<String>,
9691}
9692
9693impl<'a, C> common::CallBuilder for EventticketobjectGetCall<'a, C> {}
9694
9695impl<'a, C> EventticketobjectGetCall<'a, C>
9696where
9697 C: common::Connector,
9698{
9699 /// Perform the operation you have build so far.
9700 pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
9701 use std::borrow::Cow;
9702 use std::io::{Read, Seek};
9703
9704 use common::{url::Params, ToParts};
9705 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9706
9707 let mut dd = common::DefaultDelegate;
9708 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9709 dlg.begin(common::MethodInfo {
9710 id: "walletobjects.eventticketobject.get",
9711 http_method: hyper::Method::GET,
9712 });
9713
9714 for &field in ["alt", "resourceId"].iter() {
9715 if self._additional_params.contains_key(field) {
9716 dlg.finished(false);
9717 return Err(common::Error::FieldClash(field));
9718 }
9719 }
9720
9721 let mut params = Params::with_capacity(3 + self._additional_params.len());
9722 params.push("resourceId", self._resource_id);
9723
9724 params.extend(self._additional_params.iter());
9725
9726 params.push("alt", "json");
9727 let mut url =
9728 self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject/{resourceId}";
9729 if self._scopes.is_empty() {
9730 self._scopes
9731 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
9732 }
9733
9734 #[allow(clippy::single_element_loop)]
9735 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
9736 url = params.uri_replacement(url, param_name, find_this, false);
9737 }
9738 {
9739 let to_remove = ["resourceId"];
9740 params.remove_params(&to_remove);
9741 }
9742
9743 let url = params.parse_with_url(&url);
9744
9745 loop {
9746 let token = match self
9747 .hub
9748 .auth
9749 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9750 .await
9751 {
9752 Ok(token) => token,
9753 Err(e) => match dlg.token(e) {
9754 Ok(token) => token,
9755 Err(e) => {
9756 dlg.finished(false);
9757 return Err(common::Error::MissingToken(e));
9758 }
9759 },
9760 };
9761 let mut req_result = {
9762 let client = &self.hub.client;
9763 dlg.pre_request();
9764 let mut req_builder = hyper::Request::builder()
9765 .method(hyper::Method::GET)
9766 .uri(url.as_str())
9767 .header(USER_AGENT, self.hub._user_agent.clone());
9768
9769 if let Some(token) = token.as_ref() {
9770 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9771 }
9772
9773 let request = req_builder
9774 .header(CONTENT_LENGTH, 0_u64)
9775 .body(common::to_body::<String>(None));
9776
9777 client.request(request.unwrap()).await
9778 };
9779
9780 match req_result {
9781 Err(err) => {
9782 if let common::Retry::After(d) = dlg.http_error(&err) {
9783 sleep(d).await;
9784 continue;
9785 }
9786 dlg.finished(false);
9787 return Err(common::Error::HttpError(err));
9788 }
9789 Ok(res) => {
9790 let (mut parts, body) = res.into_parts();
9791 let mut body = common::Body::new(body);
9792 if !parts.status.is_success() {
9793 let bytes = common::to_bytes(body).await.unwrap_or_default();
9794 let error = serde_json::from_str(&common::to_string(&bytes));
9795 let response = common::to_response(parts, bytes.into());
9796
9797 if let common::Retry::After(d) =
9798 dlg.http_failure(&response, error.as_ref().ok())
9799 {
9800 sleep(d).await;
9801 continue;
9802 }
9803
9804 dlg.finished(false);
9805
9806 return Err(match error {
9807 Ok(value) => common::Error::BadRequest(value),
9808 _ => common::Error::Failure(response),
9809 });
9810 }
9811 let response = {
9812 let bytes = common::to_bytes(body).await.unwrap_or_default();
9813 let encoded = common::to_string(&bytes);
9814 match serde_json::from_str(&encoded) {
9815 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9816 Err(error) => {
9817 dlg.response_json_decode_error(&encoded, &error);
9818 return Err(common::Error::JsonDecodeError(
9819 encoded.to_string(),
9820 error,
9821 ));
9822 }
9823 }
9824 };
9825
9826 dlg.finished(true);
9827 return Ok(response);
9828 }
9829 }
9830 }
9831 }
9832
9833 /// 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 '-'.
9834 ///
9835 /// Sets the *resource id* path property to the given value.
9836 ///
9837 /// Even though the property as already been set when instantiating this call,
9838 /// we provide this method for API completeness.
9839 pub fn resource_id(mut self, new_value: &str) -> EventticketobjectGetCall<'a, C> {
9840 self._resource_id = new_value.to_string();
9841 self
9842 }
9843 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9844 /// while executing the actual API request.
9845 ///
9846 /// ````text
9847 /// It should be used to handle progress information, and to implement a certain level of resilience.
9848 /// ````
9849 ///
9850 /// Sets the *delegate* property to the given value.
9851 pub fn delegate(
9852 mut self,
9853 new_value: &'a mut dyn common::Delegate,
9854 ) -> EventticketobjectGetCall<'a, C> {
9855 self._delegate = Some(new_value);
9856 self
9857 }
9858
9859 /// Set any additional parameter of the query string used in the request.
9860 /// It should be used to set parameters which are not yet available through their own
9861 /// setters.
9862 ///
9863 /// Please note that this method must not be used to set any of the known parameters
9864 /// which have their own setter method. If done anyway, the request will fail.
9865 ///
9866 /// # Additional Parameters
9867 ///
9868 /// * *$.xgafv* (query-string) - V1 error format.
9869 /// * *access_token* (query-string) - OAuth access token.
9870 /// * *alt* (query-string) - Data format for response.
9871 /// * *callback* (query-string) - JSONP
9872 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9873 /// * *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.
9874 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9875 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9876 /// * *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.
9877 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9878 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9879 pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectGetCall<'a, C>
9880 where
9881 T: AsRef<str>,
9882 {
9883 self._additional_params
9884 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9885 self
9886 }
9887
9888 /// Identifies the authorization scope for the method you are building.
9889 ///
9890 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9891 /// [`Scope::WalletObjectIssuer`].
9892 ///
9893 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9894 /// tokens for more than one scope.
9895 ///
9896 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9897 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9898 /// sufficient, a read-write scope will do as well.
9899 pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectGetCall<'a, C>
9900 where
9901 St: AsRef<str>,
9902 {
9903 self._scopes.insert(String::from(scope.as_ref()));
9904 self
9905 }
9906 /// Identifies the authorization scope(s) for the method you are building.
9907 ///
9908 /// See [`Self::add_scope()`] for details.
9909 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectGetCall<'a, C>
9910 where
9911 I: IntoIterator<Item = St>,
9912 St: AsRef<str>,
9913 {
9914 self._scopes
9915 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9916 self
9917 }
9918
9919 /// Removes all scopes, and no default scope will be used either.
9920 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9921 /// for details).
9922 pub fn clear_scopes(mut self) -> EventticketobjectGetCall<'a, C> {
9923 self._scopes.clear();
9924 self
9925 }
9926}
9927
9928/// Inserts an event ticket object with the given ID and properties.
9929///
9930/// A builder for the *insert* method supported by a *eventticketobject* resource.
9931/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
9932///
9933/// # Example
9934///
9935/// Instantiate a resource method builder
9936///
9937/// ```test_harness,no_run
9938/// # extern crate hyper;
9939/// # extern crate hyper_rustls;
9940/// # extern crate google_walletobjects1 as walletobjects1;
9941/// use walletobjects1::api::EventTicketObject;
9942/// # async fn dox() {
9943/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9944///
9945/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9946/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9947/// # secret,
9948/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9949/// # ).build().await.unwrap();
9950///
9951/// # let client = hyper_util::client::legacy::Client::builder(
9952/// # hyper_util::rt::TokioExecutor::new()
9953/// # )
9954/// # .build(
9955/// # hyper_rustls::HttpsConnectorBuilder::new()
9956/// # .with_native_roots()
9957/// # .unwrap()
9958/// # .https_or_http()
9959/// # .enable_http1()
9960/// # .build()
9961/// # );
9962/// # let mut hub = Walletobjects::new(client, auth);
9963/// // As the method needs a request, you would usually fill it with the desired information
9964/// // into the respective structure. Some of the parts shown here might not be applicable !
9965/// // Values shown here are possibly random and not representative !
9966/// let mut req = EventTicketObject::default();
9967///
9968/// // You can configure optional parameters by calling the respective setters at will, and
9969/// // execute the final call using `doit()`.
9970/// // Values shown here are possibly random and not representative !
9971/// let result = hub.eventticketobject().insert(req)
9972/// .doit().await;
9973/// # }
9974/// ```
9975pub struct EventticketobjectInsertCall<'a, C>
9976where
9977 C: 'a,
9978{
9979 hub: &'a Walletobjects<C>,
9980 _request: EventTicketObject,
9981 _delegate: Option<&'a mut dyn common::Delegate>,
9982 _additional_params: HashMap<String, String>,
9983 _scopes: BTreeSet<String>,
9984}
9985
9986impl<'a, C> common::CallBuilder for EventticketobjectInsertCall<'a, C> {}
9987
9988impl<'a, C> EventticketobjectInsertCall<'a, C>
9989where
9990 C: common::Connector,
9991{
9992 /// Perform the operation you have build so far.
9993 pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
9994 use std::borrow::Cow;
9995 use std::io::{Read, Seek};
9996
9997 use common::{url::Params, ToParts};
9998 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9999
10000 let mut dd = common::DefaultDelegate;
10001 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10002 dlg.begin(common::MethodInfo {
10003 id: "walletobjects.eventticketobject.insert",
10004 http_method: hyper::Method::POST,
10005 });
10006
10007 for &field in ["alt"].iter() {
10008 if self._additional_params.contains_key(field) {
10009 dlg.finished(false);
10010 return Err(common::Error::FieldClash(field));
10011 }
10012 }
10013
10014 let mut params = Params::with_capacity(3 + self._additional_params.len());
10015
10016 params.extend(self._additional_params.iter());
10017
10018 params.push("alt", "json");
10019 let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject";
10020 if self._scopes.is_empty() {
10021 self._scopes
10022 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
10023 }
10024
10025 let url = params.parse_with_url(&url);
10026
10027 let mut json_mime_type = mime::APPLICATION_JSON;
10028 let mut request_value_reader = {
10029 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10030 common::remove_json_null_values(&mut value);
10031 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10032 serde_json::to_writer(&mut dst, &value).unwrap();
10033 dst
10034 };
10035 let request_size = request_value_reader
10036 .seek(std::io::SeekFrom::End(0))
10037 .unwrap();
10038 request_value_reader
10039 .seek(std::io::SeekFrom::Start(0))
10040 .unwrap();
10041
10042 loop {
10043 let token = match self
10044 .hub
10045 .auth
10046 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10047 .await
10048 {
10049 Ok(token) => token,
10050 Err(e) => match dlg.token(e) {
10051 Ok(token) => token,
10052 Err(e) => {
10053 dlg.finished(false);
10054 return Err(common::Error::MissingToken(e));
10055 }
10056 },
10057 };
10058 request_value_reader
10059 .seek(std::io::SeekFrom::Start(0))
10060 .unwrap();
10061 let mut req_result = {
10062 let client = &self.hub.client;
10063 dlg.pre_request();
10064 let mut req_builder = hyper::Request::builder()
10065 .method(hyper::Method::POST)
10066 .uri(url.as_str())
10067 .header(USER_AGENT, self.hub._user_agent.clone());
10068
10069 if let Some(token) = token.as_ref() {
10070 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10071 }
10072
10073 let request = req_builder
10074 .header(CONTENT_TYPE, json_mime_type.to_string())
10075 .header(CONTENT_LENGTH, request_size as u64)
10076 .body(common::to_body(
10077 request_value_reader.get_ref().clone().into(),
10078 ));
10079
10080 client.request(request.unwrap()).await
10081 };
10082
10083 match req_result {
10084 Err(err) => {
10085 if let common::Retry::After(d) = dlg.http_error(&err) {
10086 sleep(d).await;
10087 continue;
10088 }
10089 dlg.finished(false);
10090 return Err(common::Error::HttpError(err));
10091 }
10092 Ok(res) => {
10093 let (mut parts, body) = res.into_parts();
10094 let mut body = common::Body::new(body);
10095 if !parts.status.is_success() {
10096 let bytes = common::to_bytes(body).await.unwrap_or_default();
10097 let error = serde_json::from_str(&common::to_string(&bytes));
10098 let response = common::to_response(parts, bytes.into());
10099
10100 if let common::Retry::After(d) =
10101 dlg.http_failure(&response, error.as_ref().ok())
10102 {
10103 sleep(d).await;
10104 continue;
10105 }
10106
10107 dlg.finished(false);
10108
10109 return Err(match error {
10110 Ok(value) => common::Error::BadRequest(value),
10111 _ => common::Error::Failure(response),
10112 });
10113 }
10114 let response = {
10115 let bytes = common::to_bytes(body).await.unwrap_or_default();
10116 let encoded = common::to_string(&bytes);
10117 match serde_json::from_str(&encoded) {
10118 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10119 Err(error) => {
10120 dlg.response_json_decode_error(&encoded, &error);
10121 return Err(common::Error::JsonDecodeError(
10122 encoded.to_string(),
10123 error,
10124 ));
10125 }
10126 }
10127 };
10128
10129 dlg.finished(true);
10130 return Ok(response);
10131 }
10132 }
10133 }
10134 }
10135
10136 ///
10137 /// Sets the *request* property to the given value.
10138 ///
10139 /// Even though the property as already been set when instantiating this call,
10140 /// we provide this method for API completeness.
10141 pub fn request(mut self, new_value: EventTicketObject) -> EventticketobjectInsertCall<'a, C> {
10142 self._request = new_value;
10143 self
10144 }
10145 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10146 /// while executing the actual API request.
10147 ///
10148 /// ````text
10149 /// It should be used to handle progress information, and to implement a certain level of resilience.
10150 /// ````
10151 ///
10152 /// Sets the *delegate* property to the given value.
10153 pub fn delegate(
10154 mut self,
10155 new_value: &'a mut dyn common::Delegate,
10156 ) -> EventticketobjectInsertCall<'a, C> {
10157 self._delegate = Some(new_value);
10158 self
10159 }
10160
10161 /// Set any additional parameter of the query string used in the request.
10162 /// It should be used to set parameters which are not yet available through their own
10163 /// setters.
10164 ///
10165 /// Please note that this method must not be used to set any of the known parameters
10166 /// which have their own setter method. If done anyway, the request will fail.
10167 ///
10168 /// # Additional Parameters
10169 ///
10170 /// * *$.xgafv* (query-string) - V1 error format.
10171 /// * *access_token* (query-string) - OAuth access token.
10172 /// * *alt* (query-string) - Data format for response.
10173 /// * *callback* (query-string) - JSONP
10174 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10175 /// * *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.
10176 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10177 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10178 /// * *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.
10179 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10180 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10181 pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectInsertCall<'a, C>
10182 where
10183 T: AsRef<str>,
10184 {
10185 self._additional_params
10186 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10187 self
10188 }
10189
10190 /// Identifies the authorization scope for the method you are building.
10191 ///
10192 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10193 /// [`Scope::WalletObjectIssuer`].
10194 ///
10195 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10196 /// tokens for more than one scope.
10197 ///
10198 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10199 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10200 /// sufficient, a read-write scope will do as well.
10201 pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectInsertCall<'a, C>
10202 where
10203 St: AsRef<str>,
10204 {
10205 self._scopes.insert(String::from(scope.as_ref()));
10206 self
10207 }
10208 /// Identifies the authorization scope(s) for the method you are building.
10209 ///
10210 /// See [`Self::add_scope()`] for details.
10211 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectInsertCall<'a, C>
10212 where
10213 I: IntoIterator<Item = St>,
10214 St: AsRef<str>,
10215 {
10216 self._scopes
10217 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10218 self
10219 }
10220
10221 /// Removes all scopes, and no default scope will be used either.
10222 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10223 /// for details).
10224 pub fn clear_scopes(mut self) -> EventticketobjectInsertCall<'a, C> {
10225 self._scopes.clear();
10226 self
10227 }
10228}
10229
10230/// Returns a list of all event ticket objects for a given issuer ID.
10231///
10232/// A builder for the *list* method supported by a *eventticketobject* resource.
10233/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
10234///
10235/// # Example
10236///
10237/// Instantiate a resource method builder
10238///
10239/// ```test_harness,no_run
10240/// # extern crate hyper;
10241/// # extern crate hyper_rustls;
10242/// # extern crate google_walletobjects1 as walletobjects1;
10243/// # async fn dox() {
10244/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10245///
10246/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10247/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10248/// # secret,
10249/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10250/// # ).build().await.unwrap();
10251///
10252/// # let client = hyper_util::client::legacy::Client::builder(
10253/// # hyper_util::rt::TokioExecutor::new()
10254/// # )
10255/// # .build(
10256/// # hyper_rustls::HttpsConnectorBuilder::new()
10257/// # .with_native_roots()
10258/// # .unwrap()
10259/// # .https_or_http()
10260/// # .enable_http1()
10261/// # .build()
10262/// # );
10263/// # let mut hub = Walletobjects::new(client, auth);
10264/// // You can configure optional parameters by calling the respective setters at will, and
10265/// // execute the final call using `doit()`.
10266/// // Values shown here are possibly random and not representative !
10267/// let result = hub.eventticketobject().list()
10268/// .token("ipsum")
10269/// .max_results(-62)
10270/// .class_id("Lorem")
10271/// .doit().await;
10272/// # }
10273/// ```
10274pub struct EventticketobjectListCall<'a, C>
10275where
10276 C: 'a,
10277{
10278 hub: &'a Walletobjects<C>,
10279 _token: Option<String>,
10280 _max_results: Option<i32>,
10281 _class_id: Option<String>,
10282 _delegate: Option<&'a mut dyn common::Delegate>,
10283 _additional_params: HashMap<String, String>,
10284 _scopes: BTreeSet<String>,
10285}
10286
10287impl<'a, C> common::CallBuilder for EventticketobjectListCall<'a, C> {}
10288
10289impl<'a, C> EventticketobjectListCall<'a, C>
10290where
10291 C: common::Connector,
10292{
10293 /// Perform the operation you have build so far.
10294 pub async fn doit(
10295 mut self,
10296 ) -> common::Result<(common::Response, EventTicketObjectListResponse)> {
10297 use std::borrow::Cow;
10298 use std::io::{Read, Seek};
10299
10300 use common::{url::Params, ToParts};
10301 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10302
10303 let mut dd = common::DefaultDelegate;
10304 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10305 dlg.begin(common::MethodInfo {
10306 id: "walletobjects.eventticketobject.list",
10307 http_method: hyper::Method::GET,
10308 });
10309
10310 for &field in ["alt", "token", "maxResults", "classId"].iter() {
10311 if self._additional_params.contains_key(field) {
10312 dlg.finished(false);
10313 return Err(common::Error::FieldClash(field));
10314 }
10315 }
10316
10317 let mut params = Params::with_capacity(5 + self._additional_params.len());
10318 if let Some(value) = self._token.as_ref() {
10319 params.push("token", value);
10320 }
10321 if let Some(value) = self._max_results.as_ref() {
10322 params.push("maxResults", value.to_string());
10323 }
10324 if let Some(value) = self._class_id.as_ref() {
10325 params.push("classId", value);
10326 }
10327
10328 params.extend(self._additional_params.iter());
10329
10330 params.push("alt", "json");
10331 let mut url = self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject";
10332 if self._scopes.is_empty() {
10333 self._scopes
10334 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
10335 }
10336
10337 let url = params.parse_with_url(&url);
10338
10339 loop {
10340 let token = match self
10341 .hub
10342 .auth
10343 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10344 .await
10345 {
10346 Ok(token) => token,
10347 Err(e) => match dlg.token(e) {
10348 Ok(token) => token,
10349 Err(e) => {
10350 dlg.finished(false);
10351 return Err(common::Error::MissingToken(e));
10352 }
10353 },
10354 };
10355 let mut req_result = {
10356 let client = &self.hub.client;
10357 dlg.pre_request();
10358 let mut req_builder = hyper::Request::builder()
10359 .method(hyper::Method::GET)
10360 .uri(url.as_str())
10361 .header(USER_AGENT, self.hub._user_agent.clone());
10362
10363 if let Some(token) = token.as_ref() {
10364 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10365 }
10366
10367 let request = req_builder
10368 .header(CONTENT_LENGTH, 0_u64)
10369 .body(common::to_body::<String>(None));
10370
10371 client.request(request.unwrap()).await
10372 };
10373
10374 match req_result {
10375 Err(err) => {
10376 if let common::Retry::After(d) = dlg.http_error(&err) {
10377 sleep(d).await;
10378 continue;
10379 }
10380 dlg.finished(false);
10381 return Err(common::Error::HttpError(err));
10382 }
10383 Ok(res) => {
10384 let (mut parts, body) = res.into_parts();
10385 let mut body = common::Body::new(body);
10386 if !parts.status.is_success() {
10387 let bytes = common::to_bytes(body).await.unwrap_or_default();
10388 let error = serde_json::from_str(&common::to_string(&bytes));
10389 let response = common::to_response(parts, bytes.into());
10390
10391 if let common::Retry::After(d) =
10392 dlg.http_failure(&response, error.as_ref().ok())
10393 {
10394 sleep(d).await;
10395 continue;
10396 }
10397
10398 dlg.finished(false);
10399
10400 return Err(match error {
10401 Ok(value) => common::Error::BadRequest(value),
10402 _ => common::Error::Failure(response),
10403 });
10404 }
10405 let response = {
10406 let bytes = common::to_bytes(body).await.unwrap_or_default();
10407 let encoded = common::to_string(&bytes);
10408 match serde_json::from_str(&encoded) {
10409 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10410 Err(error) => {
10411 dlg.response_json_decode_error(&encoded, &error);
10412 return Err(common::Error::JsonDecodeError(
10413 encoded.to_string(),
10414 error,
10415 ));
10416 }
10417 }
10418 };
10419
10420 dlg.finished(true);
10421 return Ok(response);
10422 }
10423 }
10424 }
10425 }
10426
10427 /// 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.
10428 ///
10429 /// Sets the *token* query property to the given value.
10430 pub fn token(mut self, new_value: &str) -> EventticketobjectListCall<'a, C> {
10431 self._token = Some(new_value.to_string());
10432 self
10433 }
10434 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
10435 ///
10436 /// Sets the *max results* query property to the given value.
10437 pub fn max_results(mut self, new_value: i32) -> EventticketobjectListCall<'a, C> {
10438 self._max_results = Some(new_value);
10439 self
10440 }
10441 /// The ID of the class whose objects will be listed.
10442 ///
10443 /// Sets the *class id* query property to the given value.
10444 pub fn class_id(mut self, new_value: &str) -> EventticketobjectListCall<'a, C> {
10445 self._class_id = Some(new_value.to_string());
10446 self
10447 }
10448 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10449 /// while executing the actual API request.
10450 ///
10451 /// ````text
10452 /// It should be used to handle progress information, and to implement a certain level of resilience.
10453 /// ````
10454 ///
10455 /// Sets the *delegate* property to the given value.
10456 pub fn delegate(
10457 mut self,
10458 new_value: &'a mut dyn common::Delegate,
10459 ) -> EventticketobjectListCall<'a, C> {
10460 self._delegate = Some(new_value);
10461 self
10462 }
10463
10464 /// Set any additional parameter of the query string used in the request.
10465 /// It should be used to set parameters which are not yet available through their own
10466 /// setters.
10467 ///
10468 /// Please note that this method must not be used to set any of the known parameters
10469 /// which have their own setter method. If done anyway, the request will fail.
10470 ///
10471 /// # Additional Parameters
10472 ///
10473 /// * *$.xgafv* (query-string) - V1 error format.
10474 /// * *access_token* (query-string) - OAuth access token.
10475 /// * *alt* (query-string) - Data format for response.
10476 /// * *callback* (query-string) - JSONP
10477 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10478 /// * *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.
10479 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10480 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10481 /// * *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.
10482 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10483 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10484 pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectListCall<'a, C>
10485 where
10486 T: AsRef<str>,
10487 {
10488 self._additional_params
10489 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10490 self
10491 }
10492
10493 /// Identifies the authorization scope for the method you are building.
10494 ///
10495 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10496 /// [`Scope::WalletObjectIssuer`].
10497 ///
10498 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10499 /// tokens for more than one scope.
10500 ///
10501 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10502 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10503 /// sufficient, a read-write scope will do as well.
10504 pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectListCall<'a, C>
10505 where
10506 St: AsRef<str>,
10507 {
10508 self._scopes.insert(String::from(scope.as_ref()));
10509 self
10510 }
10511 /// Identifies the authorization scope(s) for the method you are building.
10512 ///
10513 /// See [`Self::add_scope()`] for details.
10514 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectListCall<'a, C>
10515 where
10516 I: IntoIterator<Item = St>,
10517 St: AsRef<str>,
10518 {
10519 self._scopes
10520 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10521 self
10522 }
10523
10524 /// Removes all scopes, and no default scope will be used either.
10525 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10526 /// for details).
10527 pub fn clear_scopes(mut self) -> EventticketobjectListCall<'a, C> {
10528 self._scopes.clear();
10529 self
10530 }
10531}
10532
10533/// Modifies linked offer objects for the event ticket object with the given ID.
10534///
10535/// A builder for the *modifylinkedofferobjects* method supported by a *eventticketobject* resource.
10536/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
10537///
10538/// # Example
10539///
10540/// Instantiate a resource method builder
10541///
10542/// ```test_harness,no_run
10543/// # extern crate hyper;
10544/// # extern crate hyper_rustls;
10545/// # extern crate google_walletobjects1 as walletobjects1;
10546/// use walletobjects1::api::ModifyLinkedOfferObjectsRequest;
10547/// # async fn dox() {
10548/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10549///
10550/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10551/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10552/// # secret,
10553/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10554/// # ).build().await.unwrap();
10555///
10556/// # let client = hyper_util::client::legacy::Client::builder(
10557/// # hyper_util::rt::TokioExecutor::new()
10558/// # )
10559/// # .build(
10560/// # hyper_rustls::HttpsConnectorBuilder::new()
10561/// # .with_native_roots()
10562/// # .unwrap()
10563/// # .https_or_http()
10564/// # .enable_http1()
10565/// # .build()
10566/// # );
10567/// # let mut hub = Walletobjects::new(client, auth);
10568/// // As the method needs a request, you would usually fill it with the desired information
10569/// // into the respective structure. Some of the parts shown here might not be applicable !
10570/// // Values shown here are possibly random and not representative !
10571/// let mut req = ModifyLinkedOfferObjectsRequest::default();
10572///
10573/// // You can configure optional parameters by calling the respective setters at will, and
10574/// // execute the final call using `doit()`.
10575/// // Values shown here are possibly random and not representative !
10576/// let result = hub.eventticketobject().modifylinkedofferobjects(req, "resourceId")
10577/// .doit().await;
10578/// # }
10579/// ```
10580pub struct EventticketobjectModifylinkedofferobjectCall<'a, C>
10581where
10582 C: 'a,
10583{
10584 hub: &'a Walletobjects<C>,
10585 _request: ModifyLinkedOfferObjectsRequest,
10586 _resource_id: String,
10587 _delegate: Option<&'a mut dyn common::Delegate>,
10588 _additional_params: HashMap<String, String>,
10589 _scopes: BTreeSet<String>,
10590}
10591
10592impl<'a, C> common::CallBuilder for EventticketobjectModifylinkedofferobjectCall<'a, C> {}
10593
10594impl<'a, C> EventticketobjectModifylinkedofferobjectCall<'a, C>
10595where
10596 C: common::Connector,
10597{
10598 /// Perform the operation you have build so far.
10599 pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
10600 use std::borrow::Cow;
10601 use std::io::{Read, Seek};
10602
10603 use common::{url::Params, ToParts};
10604 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10605
10606 let mut dd = common::DefaultDelegate;
10607 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10608 dlg.begin(common::MethodInfo {
10609 id: "walletobjects.eventticketobject.modifylinkedofferobjects",
10610 http_method: hyper::Method::POST,
10611 });
10612
10613 for &field in ["alt", "resourceId"].iter() {
10614 if self._additional_params.contains_key(field) {
10615 dlg.finished(false);
10616 return Err(common::Error::FieldClash(field));
10617 }
10618 }
10619
10620 let mut params = Params::with_capacity(4 + self._additional_params.len());
10621 params.push("resourceId", self._resource_id);
10622
10623 params.extend(self._additional_params.iter());
10624
10625 params.push("alt", "json");
10626 let mut url = self.hub._base_url.clone()
10627 + "walletobjects/v1/eventTicketObject/{resourceId}/modifyLinkedOfferObjects";
10628 if self._scopes.is_empty() {
10629 self._scopes
10630 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
10631 }
10632
10633 #[allow(clippy::single_element_loop)]
10634 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
10635 url = params.uri_replacement(url, param_name, find_this, false);
10636 }
10637 {
10638 let to_remove = ["resourceId"];
10639 params.remove_params(&to_remove);
10640 }
10641
10642 let url = params.parse_with_url(&url);
10643
10644 let mut json_mime_type = mime::APPLICATION_JSON;
10645 let mut request_value_reader = {
10646 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10647 common::remove_json_null_values(&mut value);
10648 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10649 serde_json::to_writer(&mut dst, &value).unwrap();
10650 dst
10651 };
10652 let request_size = request_value_reader
10653 .seek(std::io::SeekFrom::End(0))
10654 .unwrap();
10655 request_value_reader
10656 .seek(std::io::SeekFrom::Start(0))
10657 .unwrap();
10658
10659 loop {
10660 let token = match self
10661 .hub
10662 .auth
10663 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10664 .await
10665 {
10666 Ok(token) => token,
10667 Err(e) => match dlg.token(e) {
10668 Ok(token) => token,
10669 Err(e) => {
10670 dlg.finished(false);
10671 return Err(common::Error::MissingToken(e));
10672 }
10673 },
10674 };
10675 request_value_reader
10676 .seek(std::io::SeekFrom::Start(0))
10677 .unwrap();
10678 let mut req_result = {
10679 let client = &self.hub.client;
10680 dlg.pre_request();
10681 let mut req_builder = hyper::Request::builder()
10682 .method(hyper::Method::POST)
10683 .uri(url.as_str())
10684 .header(USER_AGENT, self.hub._user_agent.clone());
10685
10686 if let Some(token) = token.as_ref() {
10687 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10688 }
10689
10690 let request = req_builder
10691 .header(CONTENT_TYPE, json_mime_type.to_string())
10692 .header(CONTENT_LENGTH, request_size as u64)
10693 .body(common::to_body(
10694 request_value_reader.get_ref().clone().into(),
10695 ));
10696
10697 client.request(request.unwrap()).await
10698 };
10699
10700 match req_result {
10701 Err(err) => {
10702 if let common::Retry::After(d) = dlg.http_error(&err) {
10703 sleep(d).await;
10704 continue;
10705 }
10706 dlg.finished(false);
10707 return Err(common::Error::HttpError(err));
10708 }
10709 Ok(res) => {
10710 let (mut parts, body) = res.into_parts();
10711 let mut body = common::Body::new(body);
10712 if !parts.status.is_success() {
10713 let bytes = common::to_bytes(body).await.unwrap_or_default();
10714 let error = serde_json::from_str(&common::to_string(&bytes));
10715 let response = common::to_response(parts, bytes.into());
10716
10717 if let common::Retry::After(d) =
10718 dlg.http_failure(&response, error.as_ref().ok())
10719 {
10720 sleep(d).await;
10721 continue;
10722 }
10723
10724 dlg.finished(false);
10725
10726 return Err(match error {
10727 Ok(value) => common::Error::BadRequest(value),
10728 _ => common::Error::Failure(response),
10729 });
10730 }
10731 let response = {
10732 let bytes = common::to_bytes(body).await.unwrap_or_default();
10733 let encoded = common::to_string(&bytes);
10734 match serde_json::from_str(&encoded) {
10735 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10736 Err(error) => {
10737 dlg.response_json_decode_error(&encoded, &error);
10738 return Err(common::Error::JsonDecodeError(
10739 encoded.to_string(),
10740 error,
10741 ));
10742 }
10743 }
10744 };
10745
10746 dlg.finished(true);
10747 return Ok(response);
10748 }
10749 }
10750 }
10751 }
10752
10753 ///
10754 /// Sets the *request* property to the given value.
10755 ///
10756 /// Even though the property as already been set when instantiating this call,
10757 /// we provide this method for API completeness.
10758 pub fn request(
10759 mut self,
10760 new_value: ModifyLinkedOfferObjectsRequest,
10761 ) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
10762 self._request = new_value;
10763 self
10764 }
10765 /// 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 '-'.
10766 ///
10767 /// Sets the *resource id* path property to the given value.
10768 ///
10769 /// Even though the property as already been set when instantiating this call,
10770 /// we provide this method for API completeness.
10771 pub fn resource_id(
10772 mut self,
10773 new_value: &str,
10774 ) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
10775 self._resource_id = new_value.to_string();
10776 self
10777 }
10778 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10779 /// while executing the actual API request.
10780 ///
10781 /// ````text
10782 /// It should be used to handle progress information, and to implement a certain level of resilience.
10783 /// ````
10784 ///
10785 /// Sets the *delegate* property to the given value.
10786 pub fn delegate(
10787 mut self,
10788 new_value: &'a mut dyn common::Delegate,
10789 ) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
10790 self._delegate = Some(new_value);
10791 self
10792 }
10793
10794 /// Set any additional parameter of the query string used in the request.
10795 /// It should be used to set parameters which are not yet available through their own
10796 /// setters.
10797 ///
10798 /// Please note that this method must not be used to set any of the known parameters
10799 /// which have their own setter method. If done anyway, the request will fail.
10800 ///
10801 /// # Additional Parameters
10802 ///
10803 /// * *$.xgafv* (query-string) - V1 error format.
10804 /// * *access_token* (query-string) - OAuth access token.
10805 /// * *alt* (query-string) - Data format for response.
10806 /// * *callback* (query-string) - JSONP
10807 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10808 /// * *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.
10809 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10810 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10811 /// * *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.
10812 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10813 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10814 pub fn param<T>(
10815 mut self,
10816 name: T,
10817 value: T,
10818 ) -> EventticketobjectModifylinkedofferobjectCall<'a, C>
10819 where
10820 T: AsRef<str>,
10821 {
10822 self._additional_params
10823 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10824 self
10825 }
10826
10827 /// Identifies the authorization scope for the method you are building.
10828 ///
10829 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10830 /// [`Scope::WalletObjectIssuer`].
10831 ///
10832 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10833 /// tokens for more than one scope.
10834 ///
10835 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10836 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10837 /// sufficient, a read-write scope will do as well.
10838 pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectModifylinkedofferobjectCall<'a, C>
10839 where
10840 St: AsRef<str>,
10841 {
10842 self._scopes.insert(String::from(scope.as_ref()));
10843 self
10844 }
10845 /// Identifies the authorization scope(s) for the method you are building.
10846 ///
10847 /// See [`Self::add_scope()`] for details.
10848 pub fn add_scopes<I, St>(
10849 mut self,
10850 scopes: I,
10851 ) -> EventticketobjectModifylinkedofferobjectCall<'a, C>
10852 where
10853 I: IntoIterator<Item = St>,
10854 St: AsRef<str>,
10855 {
10856 self._scopes
10857 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10858 self
10859 }
10860
10861 /// Removes all scopes, and no default scope will be used either.
10862 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10863 /// for details).
10864 pub fn clear_scopes(mut self) -> EventticketobjectModifylinkedofferobjectCall<'a, C> {
10865 self._scopes.clear();
10866 self
10867 }
10868}
10869
10870/// Updates the event ticket object referenced by the given object ID. This method supports patch semantics.
10871///
10872/// A builder for the *patch* method supported by a *eventticketobject* resource.
10873/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
10874///
10875/// # Example
10876///
10877/// Instantiate a resource method builder
10878///
10879/// ```test_harness,no_run
10880/// # extern crate hyper;
10881/// # extern crate hyper_rustls;
10882/// # extern crate google_walletobjects1 as walletobjects1;
10883/// use walletobjects1::api::EventTicketObject;
10884/// # async fn dox() {
10885/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10886///
10887/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10888/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10889/// # secret,
10890/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10891/// # ).build().await.unwrap();
10892///
10893/// # let client = hyper_util::client::legacy::Client::builder(
10894/// # hyper_util::rt::TokioExecutor::new()
10895/// # )
10896/// # .build(
10897/// # hyper_rustls::HttpsConnectorBuilder::new()
10898/// # .with_native_roots()
10899/// # .unwrap()
10900/// # .https_or_http()
10901/// # .enable_http1()
10902/// # .build()
10903/// # );
10904/// # let mut hub = Walletobjects::new(client, auth);
10905/// // As the method needs a request, you would usually fill it with the desired information
10906/// // into the respective structure. Some of the parts shown here might not be applicable !
10907/// // Values shown here are possibly random and not representative !
10908/// let mut req = EventTicketObject::default();
10909///
10910/// // You can configure optional parameters by calling the respective setters at will, and
10911/// // execute the final call using `doit()`.
10912/// // Values shown here are possibly random and not representative !
10913/// let result = hub.eventticketobject().patch(req, "resourceId")
10914/// .doit().await;
10915/// # }
10916/// ```
10917pub struct EventticketobjectPatchCall<'a, C>
10918where
10919 C: 'a,
10920{
10921 hub: &'a Walletobjects<C>,
10922 _request: EventTicketObject,
10923 _resource_id: String,
10924 _delegate: Option<&'a mut dyn common::Delegate>,
10925 _additional_params: HashMap<String, String>,
10926 _scopes: BTreeSet<String>,
10927}
10928
10929impl<'a, C> common::CallBuilder for EventticketobjectPatchCall<'a, C> {}
10930
10931impl<'a, C> EventticketobjectPatchCall<'a, C>
10932where
10933 C: common::Connector,
10934{
10935 /// Perform the operation you have build so far.
10936 pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
10937 use std::borrow::Cow;
10938 use std::io::{Read, Seek};
10939
10940 use common::{url::Params, ToParts};
10941 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10942
10943 let mut dd = common::DefaultDelegate;
10944 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10945 dlg.begin(common::MethodInfo {
10946 id: "walletobjects.eventticketobject.patch",
10947 http_method: hyper::Method::PATCH,
10948 });
10949
10950 for &field in ["alt", "resourceId"].iter() {
10951 if self._additional_params.contains_key(field) {
10952 dlg.finished(false);
10953 return Err(common::Error::FieldClash(field));
10954 }
10955 }
10956
10957 let mut params = Params::with_capacity(4 + self._additional_params.len());
10958 params.push("resourceId", self._resource_id);
10959
10960 params.extend(self._additional_params.iter());
10961
10962 params.push("alt", "json");
10963 let mut url =
10964 self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject/{resourceId}";
10965 if self._scopes.is_empty() {
10966 self._scopes
10967 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
10968 }
10969
10970 #[allow(clippy::single_element_loop)]
10971 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
10972 url = params.uri_replacement(url, param_name, find_this, false);
10973 }
10974 {
10975 let to_remove = ["resourceId"];
10976 params.remove_params(&to_remove);
10977 }
10978
10979 let url = params.parse_with_url(&url);
10980
10981 let mut json_mime_type = mime::APPLICATION_JSON;
10982 let mut request_value_reader = {
10983 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10984 common::remove_json_null_values(&mut value);
10985 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10986 serde_json::to_writer(&mut dst, &value).unwrap();
10987 dst
10988 };
10989 let request_size = request_value_reader
10990 .seek(std::io::SeekFrom::End(0))
10991 .unwrap();
10992 request_value_reader
10993 .seek(std::io::SeekFrom::Start(0))
10994 .unwrap();
10995
10996 loop {
10997 let token = match self
10998 .hub
10999 .auth
11000 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11001 .await
11002 {
11003 Ok(token) => token,
11004 Err(e) => match dlg.token(e) {
11005 Ok(token) => token,
11006 Err(e) => {
11007 dlg.finished(false);
11008 return Err(common::Error::MissingToken(e));
11009 }
11010 },
11011 };
11012 request_value_reader
11013 .seek(std::io::SeekFrom::Start(0))
11014 .unwrap();
11015 let mut req_result = {
11016 let client = &self.hub.client;
11017 dlg.pre_request();
11018 let mut req_builder = hyper::Request::builder()
11019 .method(hyper::Method::PATCH)
11020 .uri(url.as_str())
11021 .header(USER_AGENT, self.hub._user_agent.clone());
11022
11023 if let Some(token) = token.as_ref() {
11024 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11025 }
11026
11027 let request = req_builder
11028 .header(CONTENT_TYPE, json_mime_type.to_string())
11029 .header(CONTENT_LENGTH, request_size as u64)
11030 .body(common::to_body(
11031 request_value_reader.get_ref().clone().into(),
11032 ));
11033
11034 client.request(request.unwrap()).await
11035 };
11036
11037 match req_result {
11038 Err(err) => {
11039 if let common::Retry::After(d) = dlg.http_error(&err) {
11040 sleep(d).await;
11041 continue;
11042 }
11043 dlg.finished(false);
11044 return Err(common::Error::HttpError(err));
11045 }
11046 Ok(res) => {
11047 let (mut parts, body) = res.into_parts();
11048 let mut body = common::Body::new(body);
11049 if !parts.status.is_success() {
11050 let bytes = common::to_bytes(body).await.unwrap_or_default();
11051 let error = serde_json::from_str(&common::to_string(&bytes));
11052 let response = common::to_response(parts, bytes.into());
11053
11054 if let common::Retry::After(d) =
11055 dlg.http_failure(&response, error.as_ref().ok())
11056 {
11057 sleep(d).await;
11058 continue;
11059 }
11060
11061 dlg.finished(false);
11062
11063 return Err(match error {
11064 Ok(value) => common::Error::BadRequest(value),
11065 _ => common::Error::Failure(response),
11066 });
11067 }
11068 let response = {
11069 let bytes = common::to_bytes(body).await.unwrap_or_default();
11070 let encoded = common::to_string(&bytes);
11071 match serde_json::from_str(&encoded) {
11072 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11073 Err(error) => {
11074 dlg.response_json_decode_error(&encoded, &error);
11075 return Err(common::Error::JsonDecodeError(
11076 encoded.to_string(),
11077 error,
11078 ));
11079 }
11080 }
11081 };
11082
11083 dlg.finished(true);
11084 return Ok(response);
11085 }
11086 }
11087 }
11088 }
11089
11090 ///
11091 /// Sets the *request* property to the given value.
11092 ///
11093 /// Even though the property as already been set when instantiating this call,
11094 /// we provide this method for API completeness.
11095 pub fn request(mut self, new_value: EventTicketObject) -> EventticketobjectPatchCall<'a, C> {
11096 self._request = new_value;
11097 self
11098 }
11099 /// 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 '-'.
11100 ///
11101 /// Sets the *resource id* path property to the given value.
11102 ///
11103 /// Even though the property as already been set when instantiating this call,
11104 /// we provide this method for API completeness.
11105 pub fn resource_id(mut self, new_value: &str) -> EventticketobjectPatchCall<'a, C> {
11106 self._resource_id = new_value.to_string();
11107 self
11108 }
11109 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11110 /// while executing the actual API request.
11111 ///
11112 /// ````text
11113 /// It should be used to handle progress information, and to implement a certain level of resilience.
11114 /// ````
11115 ///
11116 /// Sets the *delegate* property to the given value.
11117 pub fn delegate(
11118 mut self,
11119 new_value: &'a mut dyn common::Delegate,
11120 ) -> EventticketobjectPatchCall<'a, C> {
11121 self._delegate = Some(new_value);
11122 self
11123 }
11124
11125 /// Set any additional parameter of the query string used in the request.
11126 /// It should be used to set parameters which are not yet available through their own
11127 /// setters.
11128 ///
11129 /// Please note that this method must not be used to set any of the known parameters
11130 /// which have their own setter method. If done anyway, the request will fail.
11131 ///
11132 /// # Additional Parameters
11133 ///
11134 /// * *$.xgafv* (query-string) - V1 error format.
11135 /// * *access_token* (query-string) - OAuth access token.
11136 /// * *alt* (query-string) - Data format for response.
11137 /// * *callback* (query-string) - JSONP
11138 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11139 /// * *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.
11140 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11141 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11142 /// * *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.
11143 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11144 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11145 pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectPatchCall<'a, C>
11146 where
11147 T: AsRef<str>,
11148 {
11149 self._additional_params
11150 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11151 self
11152 }
11153
11154 /// Identifies the authorization scope for the method you are building.
11155 ///
11156 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11157 /// [`Scope::WalletObjectIssuer`].
11158 ///
11159 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11160 /// tokens for more than one scope.
11161 ///
11162 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11163 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11164 /// sufficient, a read-write scope will do as well.
11165 pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectPatchCall<'a, C>
11166 where
11167 St: AsRef<str>,
11168 {
11169 self._scopes.insert(String::from(scope.as_ref()));
11170 self
11171 }
11172 /// Identifies the authorization scope(s) for the method you are building.
11173 ///
11174 /// See [`Self::add_scope()`] for details.
11175 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectPatchCall<'a, C>
11176 where
11177 I: IntoIterator<Item = St>,
11178 St: AsRef<str>,
11179 {
11180 self._scopes
11181 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11182 self
11183 }
11184
11185 /// Removes all scopes, and no default scope will be used either.
11186 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11187 /// for details).
11188 pub fn clear_scopes(mut self) -> EventticketobjectPatchCall<'a, C> {
11189 self._scopes.clear();
11190 self
11191 }
11192}
11193
11194/// Updates the event ticket object referenced by the given object ID.
11195///
11196/// A builder for the *update* method supported by a *eventticketobject* resource.
11197/// It is not used directly, but through a [`EventticketobjectMethods`] instance.
11198///
11199/// # Example
11200///
11201/// Instantiate a resource method builder
11202///
11203/// ```test_harness,no_run
11204/// # extern crate hyper;
11205/// # extern crate hyper_rustls;
11206/// # extern crate google_walletobjects1 as walletobjects1;
11207/// use walletobjects1::api::EventTicketObject;
11208/// # async fn dox() {
11209/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11210///
11211/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11212/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11213/// # secret,
11214/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11215/// # ).build().await.unwrap();
11216///
11217/// # let client = hyper_util::client::legacy::Client::builder(
11218/// # hyper_util::rt::TokioExecutor::new()
11219/// # )
11220/// # .build(
11221/// # hyper_rustls::HttpsConnectorBuilder::new()
11222/// # .with_native_roots()
11223/// # .unwrap()
11224/// # .https_or_http()
11225/// # .enable_http1()
11226/// # .build()
11227/// # );
11228/// # let mut hub = Walletobjects::new(client, auth);
11229/// // As the method needs a request, you would usually fill it with the desired information
11230/// // into the respective structure. Some of the parts shown here might not be applicable !
11231/// // Values shown here are possibly random and not representative !
11232/// let mut req = EventTicketObject::default();
11233///
11234/// // You can configure optional parameters by calling the respective setters at will, and
11235/// // execute the final call using `doit()`.
11236/// // Values shown here are possibly random and not representative !
11237/// let result = hub.eventticketobject().update(req, "resourceId")
11238/// .doit().await;
11239/// # }
11240/// ```
11241pub struct EventticketobjectUpdateCall<'a, C>
11242where
11243 C: 'a,
11244{
11245 hub: &'a Walletobjects<C>,
11246 _request: EventTicketObject,
11247 _resource_id: String,
11248 _delegate: Option<&'a mut dyn common::Delegate>,
11249 _additional_params: HashMap<String, String>,
11250 _scopes: BTreeSet<String>,
11251}
11252
11253impl<'a, C> common::CallBuilder for EventticketobjectUpdateCall<'a, C> {}
11254
11255impl<'a, C> EventticketobjectUpdateCall<'a, C>
11256where
11257 C: common::Connector,
11258{
11259 /// Perform the operation you have build so far.
11260 pub async fn doit(mut self) -> common::Result<(common::Response, EventTicketObject)> {
11261 use std::borrow::Cow;
11262 use std::io::{Read, Seek};
11263
11264 use common::{url::Params, ToParts};
11265 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11266
11267 let mut dd = common::DefaultDelegate;
11268 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11269 dlg.begin(common::MethodInfo {
11270 id: "walletobjects.eventticketobject.update",
11271 http_method: hyper::Method::PUT,
11272 });
11273
11274 for &field in ["alt", "resourceId"].iter() {
11275 if self._additional_params.contains_key(field) {
11276 dlg.finished(false);
11277 return Err(common::Error::FieldClash(field));
11278 }
11279 }
11280
11281 let mut params = Params::with_capacity(4 + self._additional_params.len());
11282 params.push("resourceId", self._resource_id);
11283
11284 params.extend(self._additional_params.iter());
11285
11286 params.push("alt", "json");
11287 let mut url =
11288 self.hub._base_url.clone() + "walletobjects/v1/eventTicketObject/{resourceId}";
11289 if self._scopes.is_empty() {
11290 self._scopes
11291 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
11292 }
11293
11294 #[allow(clippy::single_element_loop)]
11295 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
11296 url = params.uri_replacement(url, param_name, find_this, false);
11297 }
11298 {
11299 let to_remove = ["resourceId"];
11300 params.remove_params(&to_remove);
11301 }
11302
11303 let url = params.parse_with_url(&url);
11304
11305 let mut json_mime_type = mime::APPLICATION_JSON;
11306 let mut request_value_reader = {
11307 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11308 common::remove_json_null_values(&mut value);
11309 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11310 serde_json::to_writer(&mut dst, &value).unwrap();
11311 dst
11312 };
11313 let request_size = request_value_reader
11314 .seek(std::io::SeekFrom::End(0))
11315 .unwrap();
11316 request_value_reader
11317 .seek(std::io::SeekFrom::Start(0))
11318 .unwrap();
11319
11320 loop {
11321 let token = match self
11322 .hub
11323 .auth
11324 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11325 .await
11326 {
11327 Ok(token) => token,
11328 Err(e) => match dlg.token(e) {
11329 Ok(token) => token,
11330 Err(e) => {
11331 dlg.finished(false);
11332 return Err(common::Error::MissingToken(e));
11333 }
11334 },
11335 };
11336 request_value_reader
11337 .seek(std::io::SeekFrom::Start(0))
11338 .unwrap();
11339 let mut req_result = {
11340 let client = &self.hub.client;
11341 dlg.pre_request();
11342 let mut req_builder = hyper::Request::builder()
11343 .method(hyper::Method::PUT)
11344 .uri(url.as_str())
11345 .header(USER_AGENT, self.hub._user_agent.clone());
11346
11347 if let Some(token) = token.as_ref() {
11348 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11349 }
11350
11351 let request = req_builder
11352 .header(CONTENT_TYPE, json_mime_type.to_string())
11353 .header(CONTENT_LENGTH, request_size as u64)
11354 .body(common::to_body(
11355 request_value_reader.get_ref().clone().into(),
11356 ));
11357
11358 client.request(request.unwrap()).await
11359 };
11360
11361 match req_result {
11362 Err(err) => {
11363 if let common::Retry::After(d) = dlg.http_error(&err) {
11364 sleep(d).await;
11365 continue;
11366 }
11367 dlg.finished(false);
11368 return Err(common::Error::HttpError(err));
11369 }
11370 Ok(res) => {
11371 let (mut parts, body) = res.into_parts();
11372 let mut body = common::Body::new(body);
11373 if !parts.status.is_success() {
11374 let bytes = common::to_bytes(body).await.unwrap_or_default();
11375 let error = serde_json::from_str(&common::to_string(&bytes));
11376 let response = common::to_response(parts, bytes.into());
11377
11378 if let common::Retry::After(d) =
11379 dlg.http_failure(&response, error.as_ref().ok())
11380 {
11381 sleep(d).await;
11382 continue;
11383 }
11384
11385 dlg.finished(false);
11386
11387 return Err(match error {
11388 Ok(value) => common::Error::BadRequest(value),
11389 _ => common::Error::Failure(response),
11390 });
11391 }
11392 let response = {
11393 let bytes = common::to_bytes(body).await.unwrap_or_default();
11394 let encoded = common::to_string(&bytes);
11395 match serde_json::from_str(&encoded) {
11396 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11397 Err(error) => {
11398 dlg.response_json_decode_error(&encoded, &error);
11399 return Err(common::Error::JsonDecodeError(
11400 encoded.to_string(),
11401 error,
11402 ));
11403 }
11404 }
11405 };
11406
11407 dlg.finished(true);
11408 return Ok(response);
11409 }
11410 }
11411 }
11412 }
11413
11414 ///
11415 /// Sets the *request* property to the given value.
11416 ///
11417 /// Even though the property as already been set when instantiating this call,
11418 /// we provide this method for API completeness.
11419 pub fn request(mut self, new_value: EventTicketObject) -> EventticketobjectUpdateCall<'a, C> {
11420 self._request = new_value;
11421 self
11422 }
11423 /// 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 '-'.
11424 ///
11425 /// Sets the *resource id* path property to the given value.
11426 ///
11427 /// Even though the property as already been set when instantiating this call,
11428 /// we provide this method for API completeness.
11429 pub fn resource_id(mut self, new_value: &str) -> EventticketobjectUpdateCall<'a, C> {
11430 self._resource_id = new_value.to_string();
11431 self
11432 }
11433 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11434 /// while executing the actual API request.
11435 ///
11436 /// ````text
11437 /// It should be used to handle progress information, and to implement a certain level of resilience.
11438 /// ````
11439 ///
11440 /// Sets the *delegate* property to the given value.
11441 pub fn delegate(
11442 mut self,
11443 new_value: &'a mut dyn common::Delegate,
11444 ) -> EventticketobjectUpdateCall<'a, C> {
11445 self._delegate = Some(new_value);
11446 self
11447 }
11448
11449 /// Set any additional parameter of the query string used in the request.
11450 /// It should be used to set parameters which are not yet available through their own
11451 /// setters.
11452 ///
11453 /// Please note that this method must not be used to set any of the known parameters
11454 /// which have their own setter method. If done anyway, the request will fail.
11455 ///
11456 /// # Additional Parameters
11457 ///
11458 /// * *$.xgafv* (query-string) - V1 error format.
11459 /// * *access_token* (query-string) - OAuth access token.
11460 /// * *alt* (query-string) - Data format for response.
11461 /// * *callback* (query-string) - JSONP
11462 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11463 /// * *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.
11464 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11465 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11466 /// * *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.
11467 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11468 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11469 pub fn param<T>(mut self, name: T, value: T) -> EventticketobjectUpdateCall<'a, C>
11470 where
11471 T: AsRef<str>,
11472 {
11473 self._additional_params
11474 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11475 self
11476 }
11477
11478 /// Identifies the authorization scope for the method you are building.
11479 ///
11480 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11481 /// [`Scope::WalletObjectIssuer`].
11482 ///
11483 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11484 /// tokens for more than one scope.
11485 ///
11486 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11487 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11488 /// sufficient, a read-write scope will do as well.
11489 pub fn add_scope<St>(mut self, scope: St) -> EventticketobjectUpdateCall<'a, C>
11490 where
11491 St: AsRef<str>,
11492 {
11493 self._scopes.insert(String::from(scope.as_ref()));
11494 self
11495 }
11496 /// Identifies the authorization scope(s) for the method you are building.
11497 ///
11498 /// See [`Self::add_scope()`] for details.
11499 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventticketobjectUpdateCall<'a, C>
11500 where
11501 I: IntoIterator<Item = St>,
11502 St: AsRef<str>,
11503 {
11504 self._scopes
11505 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11506 self
11507 }
11508
11509 /// Removes all scopes, and no default scope will be used either.
11510 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11511 /// for details).
11512 pub fn clear_scopes(mut self) -> EventticketobjectUpdateCall<'a, C> {
11513 self._scopes.clear();
11514 self
11515 }
11516}
11517
11518/// Adds a message to the flight class referenced by the given class ID.
11519///
11520/// A builder for the *addmessage* method supported by a *flightclas* resource.
11521/// It is not used directly, but through a [`FlightclasMethods`] instance.
11522///
11523/// # Example
11524///
11525/// Instantiate a resource method builder
11526///
11527/// ```test_harness,no_run
11528/// # extern crate hyper;
11529/// # extern crate hyper_rustls;
11530/// # extern crate google_walletobjects1 as walletobjects1;
11531/// use walletobjects1::api::AddMessageRequest;
11532/// # async fn dox() {
11533/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11534///
11535/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11536/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11537/// # secret,
11538/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11539/// # ).build().await.unwrap();
11540///
11541/// # let client = hyper_util::client::legacy::Client::builder(
11542/// # hyper_util::rt::TokioExecutor::new()
11543/// # )
11544/// # .build(
11545/// # hyper_rustls::HttpsConnectorBuilder::new()
11546/// # .with_native_roots()
11547/// # .unwrap()
11548/// # .https_or_http()
11549/// # .enable_http1()
11550/// # .build()
11551/// # );
11552/// # let mut hub = Walletobjects::new(client, auth);
11553/// // As the method needs a request, you would usually fill it with the desired information
11554/// // into the respective structure. Some of the parts shown here might not be applicable !
11555/// // Values shown here are possibly random and not representative !
11556/// let mut req = AddMessageRequest::default();
11557///
11558/// // You can configure optional parameters by calling the respective setters at will, and
11559/// // execute the final call using `doit()`.
11560/// // Values shown here are possibly random and not representative !
11561/// let result = hub.flightclass().addmessage(req, "resourceId")
11562/// .doit().await;
11563/// # }
11564/// ```
11565pub struct FlightclasAddmessageCall<'a, C>
11566where
11567 C: 'a,
11568{
11569 hub: &'a Walletobjects<C>,
11570 _request: AddMessageRequest,
11571 _resource_id: String,
11572 _delegate: Option<&'a mut dyn common::Delegate>,
11573 _additional_params: HashMap<String, String>,
11574 _scopes: BTreeSet<String>,
11575}
11576
11577impl<'a, C> common::CallBuilder for FlightclasAddmessageCall<'a, C> {}
11578
11579impl<'a, C> FlightclasAddmessageCall<'a, C>
11580where
11581 C: common::Connector,
11582{
11583 /// Perform the operation you have build so far.
11584 pub async fn doit(
11585 mut self,
11586 ) -> common::Result<(common::Response, FlightClassAddMessageResponse)> {
11587 use std::borrow::Cow;
11588 use std::io::{Read, Seek};
11589
11590 use common::{url::Params, ToParts};
11591 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11592
11593 let mut dd = common::DefaultDelegate;
11594 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11595 dlg.begin(common::MethodInfo {
11596 id: "walletobjects.flightclass.addmessage",
11597 http_method: hyper::Method::POST,
11598 });
11599
11600 for &field in ["alt", "resourceId"].iter() {
11601 if self._additional_params.contains_key(field) {
11602 dlg.finished(false);
11603 return Err(common::Error::FieldClash(field));
11604 }
11605 }
11606
11607 let mut params = Params::with_capacity(4 + self._additional_params.len());
11608 params.push("resourceId", self._resource_id);
11609
11610 params.extend(self._additional_params.iter());
11611
11612 params.push("alt", "json");
11613 let mut url =
11614 self.hub._base_url.clone() + "walletobjects/v1/flightClass/{resourceId}/addMessage";
11615 if self._scopes.is_empty() {
11616 self._scopes
11617 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
11618 }
11619
11620 #[allow(clippy::single_element_loop)]
11621 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
11622 url = params.uri_replacement(url, param_name, find_this, false);
11623 }
11624 {
11625 let to_remove = ["resourceId"];
11626 params.remove_params(&to_remove);
11627 }
11628
11629 let url = params.parse_with_url(&url);
11630
11631 let mut json_mime_type = mime::APPLICATION_JSON;
11632 let mut request_value_reader = {
11633 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11634 common::remove_json_null_values(&mut value);
11635 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11636 serde_json::to_writer(&mut dst, &value).unwrap();
11637 dst
11638 };
11639 let request_size = request_value_reader
11640 .seek(std::io::SeekFrom::End(0))
11641 .unwrap();
11642 request_value_reader
11643 .seek(std::io::SeekFrom::Start(0))
11644 .unwrap();
11645
11646 loop {
11647 let token = match self
11648 .hub
11649 .auth
11650 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11651 .await
11652 {
11653 Ok(token) => token,
11654 Err(e) => match dlg.token(e) {
11655 Ok(token) => token,
11656 Err(e) => {
11657 dlg.finished(false);
11658 return Err(common::Error::MissingToken(e));
11659 }
11660 },
11661 };
11662 request_value_reader
11663 .seek(std::io::SeekFrom::Start(0))
11664 .unwrap();
11665 let mut req_result = {
11666 let client = &self.hub.client;
11667 dlg.pre_request();
11668 let mut req_builder = hyper::Request::builder()
11669 .method(hyper::Method::POST)
11670 .uri(url.as_str())
11671 .header(USER_AGENT, self.hub._user_agent.clone());
11672
11673 if let Some(token) = token.as_ref() {
11674 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11675 }
11676
11677 let request = req_builder
11678 .header(CONTENT_TYPE, json_mime_type.to_string())
11679 .header(CONTENT_LENGTH, request_size as u64)
11680 .body(common::to_body(
11681 request_value_reader.get_ref().clone().into(),
11682 ));
11683
11684 client.request(request.unwrap()).await
11685 };
11686
11687 match req_result {
11688 Err(err) => {
11689 if let common::Retry::After(d) = dlg.http_error(&err) {
11690 sleep(d).await;
11691 continue;
11692 }
11693 dlg.finished(false);
11694 return Err(common::Error::HttpError(err));
11695 }
11696 Ok(res) => {
11697 let (mut parts, body) = res.into_parts();
11698 let mut body = common::Body::new(body);
11699 if !parts.status.is_success() {
11700 let bytes = common::to_bytes(body).await.unwrap_or_default();
11701 let error = serde_json::from_str(&common::to_string(&bytes));
11702 let response = common::to_response(parts, bytes.into());
11703
11704 if let common::Retry::After(d) =
11705 dlg.http_failure(&response, error.as_ref().ok())
11706 {
11707 sleep(d).await;
11708 continue;
11709 }
11710
11711 dlg.finished(false);
11712
11713 return Err(match error {
11714 Ok(value) => common::Error::BadRequest(value),
11715 _ => common::Error::Failure(response),
11716 });
11717 }
11718 let response = {
11719 let bytes = common::to_bytes(body).await.unwrap_or_default();
11720 let encoded = common::to_string(&bytes);
11721 match serde_json::from_str(&encoded) {
11722 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11723 Err(error) => {
11724 dlg.response_json_decode_error(&encoded, &error);
11725 return Err(common::Error::JsonDecodeError(
11726 encoded.to_string(),
11727 error,
11728 ));
11729 }
11730 }
11731 };
11732
11733 dlg.finished(true);
11734 return Ok(response);
11735 }
11736 }
11737 }
11738 }
11739
11740 ///
11741 /// Sets the *request* property to the given value.
11742 ///
11743 /// Even though the property as already been set when instantiating this call,
11744 /// we provide this method for API completeness.
11745 pub fn request(mut self, new_value: AddMessageRequest) -> FlightclasAddmessageCall<'a, C> {
11746 self._request = new_value;
11747 self
11748 }
11749 /// 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 '-'.
11750 ///
11751 /// Sets the *resource id* path property to the given value.
11752 ///
11753 /// Even though the property as already been set when instantiating this call,
11754 /// we provide this method for API completeness.
11755 pub fn resource_id(mut self, new_value: &str) -> FlightclasAddmessageCall<'a, C> {
11756 self._resource_id = new_value.to_string();
11757 self
11758 }
11759 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11760 /// while executing the actual API request.
11761 ///
11762 /// ````text
11763 /// It should be used to handle progress information, and to implement a certain level of resilience.
11764 /// ````
11765 ///
11766 /// Sets the *delegate* property to the given value.
11767 pub fn delegate(
11768 mut self,
11769 new_value: &'a mut dyn common::Delegate,
11770 ) -> FlightclasAddmessageCall<'a, C> {
11771 self._delegate = Some(new_value);
11772 self
11773 }
11774
11775 /// Set any additional parameter of the query string used in the request.
11776 /// It should be used to set parameters which are not yet available through their own
11777 /// setters.
11778 ///
11779 /// Please note that this method must not be used to set any of the known parameters
11780 /// which have their own setter method. If done anyway, the request will fail.
11781 ///
11782 /// # Additional Parameters
11783 ///
11784 /// * *$.xgafv* (query-string) - V1 error format.
11785 /// * *access_token* (query-string) - OAuth access token.
11786 /// * *alt* (query-string) - Data format for response.
11787 /// * *callback* (query-string) - JSONP
11788 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11789 /// * *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.
11790 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11791 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11792 /// * *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.
11793 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11794 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11795 pub fn param<T>(mut self, name: T, value: T) -> FlightclasAddmessageCall<'a, C>
11796 where
11797 T: AsRef<str>,
11798 {
11799 self._additional_params
11800 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11801 self
11802 }
11803
11804 /// Identifies the authorization scope for the method you are building.
11805 ///
11806 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11807 /// [`Scope::WalletObjectIssuer`].
11808 ///
11809 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11810 /// tokens for more than one scope.
11811 ///
11812 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11813 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11814 /// sufficient, a read-write scope will do as well.
11815 pub fn add_scope<St>(mut self, scope: St) -> FlightclasAddmessageCall<'a, C>
11816 where
11817 St: AsRef<str>,
11818 {
11819 self._scopes.insert(String::from(scope.as_ref()));
11820 self
11821 }
11822 /// Identifies the authorization scope(s) for the method you are building.
11823 ///
11824 /// See [`Self::add_scope()`] for details.
11825 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasAddmessageCall<'a, C>
11826 where
11827 I: IntoIterator<Item = St>,
11828 St: AsRef<str>,
11829 {
11830 self._scopes
11831 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11832 self
11833 }
11834
11835 /// Removes all scopes, and no default scope will be used either.
11836 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11837 /// for details).
11838 pub fn clear_scopes(mut self) -> FlightclasAddmessageCall<'a, C> {
11839 self._scopes.clear();
11840 self
11841 }
11842}
11843
11844/// Returns the flight class with the given class ID.
11845///
11846/// A builder for the *get* method supported by a *flightclas* resource.
11847/// It is not used directly, but through a [`FlightclasMethods`] instance.
11848///
11849/// # Example
11850///
11851/// Instantiate a resource method builder
11852///
11853/// ```test_harness,no_run
11854/// # extern crate hyper;
11855/// # extern crate hyper_rustls;
11856/// # extern crate google_walletobjects1 as walletobjects1;
11857/// # async fn dox() {
11858/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11859///
11860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11861/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11862/// # secret,
11863/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11864/// # ).build().await.unwrap();
11865///
11866/// # let client = hyper_util::client::legacy::Client::builder(
11867/// # hyper_util::rt::TokioExecutor::new()
11868/// # )
11869/// # .build(
11870/// # hyper_rustls::HttpsConnectorBuilder::new()
11871/// # .with_native_roots()
11872/// # .unwrap()
11873/// # .https_or_http()
11874/// # .enable_http1()
11875/// # .build()
11876/// # );
11877/// # let mut hub = Walletobjects::new(client, auth);
11878/// // You can configure optional parameters by calling the respective setters at will, and
11879/// // execute the final call using `doit()`.
11880/// // Values shown here are possibly random and not representative !
11881/// let result = hub.flightclass().get("resourceId")
11882/// .doit().await;
11883/// # }
11884/// ```
11885pub struct FlightclasGetCall<'a, C>
11886where
11887 C: 'a,
11888{
11889 hub: &'a Walletobjects<C>,
11890 _resource_id: String,
11891 _delegate: Option<&'a mut dyn common::Delegate>,
11892 _additional_params: HashMap<String, String>,
11893 _scopes: BTreeSet<String>,
11894}
11895
11896impl<'a, C> common::CallBuilder for FlightclasGetCall<'a, C> {}
11897
11898impl<'a, C> FlightclasGetCall<'a, C>
11899where
11900 C: common::Connector,
11901{
11902 /// Perform the operation you have build so far.
11903 pub async fn doit(mut self) -> common::Result<(common::Response, FlightClass)> {
11904 use std::borrow::Cow;
11905 use std::io::{Read, Seek};
11906
11907 use common::{url::Params, ToParts};
11908 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11909
11910 let mut dd = common::DefaultDelegate;
11911 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11912 dlg.begin(common::MethodInfo {
11913 id: "walletobjects.flightclass.get",
11914 http_method: hyper::Method::GET,
11915 });
11916
11917 for &field in ["alt", "resourceId"].iter() {
11918 if self._additional_params.contains_key(field) {
11919 dlg.finished(false);
11920 return Err(common::Error::FieldClash(field));
11921 }
11922 }
11923
11924 let mut params = Params::with_capacity(3 + self._additional_params.len());
11925 params.push("resourceId", self._resource_id);
11926
11927 params.extend(self._additional_params.iter());
11928
11929 params.push("alt", "json");
11930 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass/{resourceId}";
11931 if self._scopes.is_empty() {
11932 self._scopes
11933 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
11934 }
11935
11936 #[allow(clippy::single_element_loop)]
11937 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
11938 url = params.uri_replacement(url, param_name, find_this, false);
11939 }
11940 {
11941 let to_remove = ["resourceId"];
11942 params.remove_params(&to_remove);
11943 }
11944
11945 let url = params.parse_with_url(&url);
11946
11947 loop {
11948 let token = match self
11949 .hub
11950 .auth
11951 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11952 .await
11953 {
11954 Ok(token) => token,
11955 Err(e) => match dlg.token(e) {
11956 Ok(token) => token,
11957 Err(e) => {
11958 dlg.finished(false);
11959 return Err(common::Error::MissingToken(e));
11960 }
11961 },
11962 };
11963 let mut req_result = {
11964 let client = &self.hub.client;
11965 dlg.pre_request();
11966 let mut req_builder = hyper::Request::builder()
11967 .method(hyper::Method::GET)
11968 .uri(url.as_str())
11969 .header(USER_AGENT, self.hub._user_agent.clone());
11970
11971 if let Some(token) = token.as_ref() {
11972 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11973 }
11974
11975 let request = req_builder
11976 .header(CONTENT_LENGTH, 0_u64)
11977 .body(common::to_body::<String>(None));
11978
11979 client.request(request.unwrap()).await
11980 };
11981
11982 match req_result {
11983 Err(err) => {
11984 if let common::Retry::After(d) = dlg.http_error(&err) {
11985 sleep(d).await;
11986 continue;
11987 }
11988 dlg.finished(false);
11989 return Err(common::Error::HttpError(err));
11990 }
11991 Ok(res) => {
11992 let (mut parts, body) = res.into_parts();
11993 let mut body = common::Body::new(body);
11994 if !parts.status.is_success() {
11995 let bytes = common::to_bytes(body).await.unwrap_or_default();
11996 let error = serde_json::from_str(&common::to_string(&bytes));
11997 let response = common::to_response(parts, bytes.into());
11998
11999 if let common::Retry::After(d) =
12000 dlg.http_failure(&response, error.as_ref().ok())
12001 {
12002 sleep(d).await;
12003 continue;
12004 }
12005
12006 dlg.finished(false);
12007
12008 return Err(match error {
12009 Ok(value) => common::Error::BadRequest(value),
12010 _ => common::Error::Failure(response),
12011 });
12012 }
12013 let response = {
12014 let bytes = common::to_bytes(body).await.unwrap_or_default();
12015 let encoded = common::to_string(&bytes);
12016 match serde_json::from_str(&encoded) {
12017 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12018 Err(error) => {
12019 dlg.response_json_decode_error(&encoded, &error);
12020 return Err(common::Error::JsonDecodeError(
12021 encoded.to_string(),
12022 error,
12023 ));
12024 }
12025 }
12026 };
12027
12028 dlg.finished(true);
12029 return Ok(response);
12030 }
12031 }
12032 }
12033 }
12034
12035 /// 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 '-'.
12036 ///
12037 /// Sets the *resource id* path property to the given value.
12038 ///
12039 /// Even though the property as already been set when instantiating this call,
12040 /// we provide this method for API completeness.
12041 pub fn resource_id(mut self, new_value: &str) -> FlightclasGetCall<'a, C> {
12042 self._resource_id = new_value.to_string();
12043 self
12044 }
12045 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12046 /// while executing the actual API request.
12047 ///
12048 /// ````text
12049 /// It should be used to handle progress information, and to implement a certain level of resilience.
12050 /// ````
12051 ///
12052 /// Sets the *delegate* property to the given value.
12053 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FlightclasGetCall<'a, C> {
12054 self._delegate = Some(new_value);
12055 self
12056 }
12057
12058 /// Set any additional parameter of the query string used in the request.
12059 /// It should be used to set parameters which are not yet available through their own
12060 /// setters.
12061 ///
12062 /// Please note that this method must not be used to set any of the known parameters
12063 /// which have their own setter method. If done anyway, the request will fail.
12064 ///
12065 /// # Additional Parameters
12066 ///
12067 /// * *$.xgafv* (query-string) - V1 error format.
12068 /// * *access_token* (query-string) - OAuth access token.
12069 /// * *alt* (query-string) - Data format for response.
12070 /// * *callback* (query-string) - JSONP
12071 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12072 /// * *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.
12073 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12074 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12075 /// * *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.
12076 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12077 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12078 pub fn param<T>(mut self, name: T, value: T) -> FlightclasGetCall<'a, C>
12079 where
12080 T: AsRef<str>,
12081 {
12082 self._additional_params
12083 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12084 self
12085 }
12086
12087 /// Identifies the authorization scope for the method you are building.
12088 ///
12089 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12090 /// [`Scope::WalletObjectIssuer`].
12091 ///
12092 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12093 /// tokens for more than one scope.
12094 ///
12095 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12096 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12097 /// sufficient, a read-write scope will do as well.
12098 pub fn add_scope<St>(mut self, scope: St) -> FlightclasGetCall<'a, C>
12099 where
12100 St: AsRef<str>,
12101 {
12102 self._scopes.insert(String::from(scope.as_ref()));
12103 self
12104 }
12105 /// Identifies the authorization scope(s) for the method you are building.
12106 ///
12107 /// See [`Self::add_scope()`] for details.
12108 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasGetCall<'a, C>
12109 where
12110 I: IntoIterator<Item = St>,
12111 St: AsRef<str>,
12112 {
12113 self._scopes
12114 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12115 self
12116 }
12117
12118 /// Removes all scopes, and no default scope will be used either.
12119 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12120 /// for details).
12121 pub fn clear_scopes(mut self) -> FlightclasGetCall<'a, C> {
12122 self._scopes.clear();
12123 self
12124 }
12125}
12126
12127/// Inserts an flight class with the given ID and properties.
12128///
12129/// A builder for the *insert* method supported by a *flightclas* resource.
12130/// It is not used directly, but through a [`FlightclasMethods`] instance.
12131///
12132/// # Example
12133///
12134/// Instantiate a resource method builder
12135///
12136/// ```test_harness,no_run
12137/// # extern crate hyper;
12138/// # extern crate hyper_rustls;
12139/// # extern crate google_walletobjects1 as walletobjects1;
12140/// use walletobjects1::api::FlightClass;
12141/// # async fn dox() {
12142/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12143///
12144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12145/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12146/// # secret,
12147/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12148/// # ).build().await.unwrap();
12149///
12150/// # let client = hyper_util::client::legacy::Client::builder(
12151/// # hyper_util::rt::TokioExecutor::new()
12152/// # )
12153/// # .build(
12154/// # hyper_rustls::HttpsConnectorBuilder::new()
12155/// # .with_native_roots()
12156/// # .unwrap()
12157/// # .https_or_http()
12158/// # .enable_http1()
12159/// # .build()
12160/// # );
12161/// # let mut hub = Walletobjects::new(client, auth);
12162/// // As the method needs a request, you would usually fill it with the desired information
12163/// // into the respective structure. Some of the parts shown here might not be applicable !
12164/// // Values shown here are possibly random and not representative !
12165/// let mut req = FlightClass::default();
12166///
12167/// // You can configure optional parameters by calling the respective setters at will, and
12168/// // execute the final call using `doit()`.
12169/// // Values shown here are possibly random and not representative !
12170/// let result = hub.flightclass().insert(req)
12171/// .doit().await;
12172/// # }
12173/// ```
12174pub struct FlightclasInsertCall<'a, C>
12175where
12176 C: 'a,
12177{
12178 hub: &'a Walletobjects<C>,
12179 _request: FlightClass,
12180 _delegate: Option<&'a mut dyn common::Delegate>,
12181 _additional_params: HashMap<String, String>,
12182 _scopes: BTreeSet<String>,
12183}
12184
12185impl<'a, C> common::CallBuilder for FlightclasInsertCall<'a, C> {}
12186
12187impl<'a, C> FlightclasInsertCall<'a, C>
12188where
12189 C: common::Connector,
12190{
12191 /// Perform the operation you have build so far.
12192 pub async fn doit(mut self) -> common::Result<(common::Response, FlightClass)> {
12193 use std::borrow::Cow;
12194 use std::io::{Read, Seek};
12195
12196 use common::{url::Params, ToParts};
12197 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12198
12199 let mut dd = common::DefaultDelegate;
12200 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12201 dlg.begin(common::MethodInfo {
12202 id: "walletobjects.flightclass.insert",
12203 http_method: hyper::Method::POST,
12204 });
12205
12206 for &field in ["alt"].iter() {
12207 if self._additional_params.contains_key(field) {
12208 dlg.finished(false);
12209 return Err(common::Error::FieldClash(field));
12210 }
12211 }
12212
12213 let mut params = Params::with_capacity(3 + self._additional_params.len());
12214
12215 params.extend(self._additional_params.iter());
12216
12217 params.push("alt", "json");
12218 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass";
12219 if self._scopes.is_empty() {
12220 self._scopes
12221 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
12222 }
12223
12224 let url = params.parse_with_url(&url);
12225
12226 let mut json_mime_type = mime::APPLICATION_JSON;
12227 let mut request_value_reader = {
12228 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12229 common::remove_json_null_values(&mut value);
12230 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12231 serde_json::to_writer(&mut dst, &value).unwrap();
12232 dst
12233 };
12234 let request_size = request_value_reader
12235 .seek(std::io::SeekFrom::End(0))
12236 .unwrap();
12237 request_value_reader
12238 .seek(std::io::SeekFrom::Start(0))
12239 .unwrap();
12240
12241 loop {
12242 let token = match self
12243 .hub
12244 .auth
12245 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12246 .await
12247 {
12248 Ok(token) => token,
12249 Err(e) => match dlg.token(e) {
12250 Ok(token) => token,
12251 Err(e) => {
12252 dlg.finished(false);
12253 return Err(common::Error::MissingToken(e));
12254 }
12255 },
12256 };
12257 request_value_reader
12258 .seek(std::io::SeekFrom::Start(0))
12259 .unwrap();
12260 let mut req_result = {
12261 let client = &self.hub.client;
12262 dlg.pre_request();
12263 let mut req_builder = hyper::Request::builder()
12264 .method(hyper::Method::POST)
12265 .uri(url.as_str())
12266 .header(USER_AGENT, self.hub._user_agent.clone());
12267
12268 if let Some(token) = token.as_ref() {
12269 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12270 }
12271
12272 let request = req_builder
12273 .header(CONTENT_TYPE, json_mime_type.to_string())
12274 .header(CONTENT_LENGTH, request_size as u64)
12275 .body(common::to_body(
12276 request_value_reader.get_ref().clone().into(),
12277 ));
12278
12279 client.request(request.unwrap()).await
12280 };
12281
12282 match req_result {
12283 Err(err) => {
12284 if let common::Retry::After(d) = dlg.http_error(&err) {
12285 sleep(d).await;
12286 continue;
12287 }
12288 dlg.finished(false);
12289 return Err(common::Error::HttpError(err));
12290 }
12291 Ok(res) => {
12292 let (mut parts, body) = res.into_parts();
12293 let mut body = common::Body::new(body);
12294 if !parts.status.is_success() {
12295 let bytes = common::to_bytes(body).await.unwrap_or_default();
12296 let error = serde_json::from_str(&common::to_string(&bytes));
12297 let response = common::to_response(parts, bytes.into());
12298
12299 if let common::Retry::After(d) =
12300 dlg.http_failure(&response, error.as_ref().ok())
12301 {
12302 sleep(d).await;
12303 continue;
12304 }
12305
12306 dlg.finished(false);
12307
12308 return Err(match error {
12309 Ok(value) => common::Error::BadRequest(value),
12310 _ => common::Error::Failure(response),
12311 });
12312 }
12313 let response = {
12314 let bytes = common::to_bytes(body).await.unwrap_or_default();
12315 let encoded = common::to_string(&bytes);
12316 match serde_json::from_str(&encoded) {
12317 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12318 Err(error) => {
12319 dlg.response_json_decode_error(&encoded, &error);
12320 return Err(common::Error::JsonDecodeError(
12321 encoded.to_string(),
12322 error,
12323 ));
12324 }
12325 }
12326 };
12327
12328 dlg.finished(true);
12329 return Ok(response);
12330 }
12331 }
12332 }
12333 }
12334
12335 ///
12336 /// Sets the *request* property to the given value.
12337 ///
12338 /// Even though the property as already been set when instantiating this call,
12339 /// we provide this method for API completeness.
12340 pub fn request(mut self, new_value: FlightClass) -> FlightclasInsertCall<'a, C> {
12341 self._request = new_value;
12342 self
12343 }
12344 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12345 /// while executing the actual API request.
12346 ///
12347 /// ````text
12348 /// It should be used to handle progress information, and to implement a certain level of resilience.
12349 /// ````
12350 ///
12351 /// Sets the *delegate* property to the given value.
12352 pub fn delegate(
12353 mut self,
12354 new_value: &'a mut dyn common::Delegate,
12355 ) -> FlightclasInsertCall<'a, C> {
12356 self._delegate = Some(new_value);
12357 self
12358 }
12359
12360 /// Set any additional parameter of the query string used in the request.
12361 /// It should be used to set parameters which are not yet available through their own
12362 /// setters.
12363 ///
12364 /// Please note that this method must not be used to set any of the known parameters
12365 /// which have their own setter method. If done anyway, the request will fail.
12366 ///
12367 /// # Additional Parameters
12368 ///
12369 /// * *$.xgafv* (query-string) - V1 error format.
12370 /// * *access_token* (query-string) - OAuth access token.
12371 /// * *alt* (query-string) - Data format for response.
12372 /// * *callback* (query-string) - JSONP
12373 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12374 /// * *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.
12375 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12376 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12377 /// * *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.
12378 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12379 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12380 pub fn param<T>(mut self, name: T, value: T) -> FlightclasInsertCall<'a, C>
12381 where
12382 T: AsRef<str>,
12383 {
12384 self._additional_params
12385 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12386 self
12387 }
12388
12389 /// Identifies the authorization scope for the method you are building.
12390 ///
12391 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12392 /// [`Scope::WalletObjectIssuer`].
12393 ///
12394 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12395 /// tokens for more than one scope.
12396 ///
12397 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12398 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12399 /// sufficient, a read-write scope will do as well.
12400 pub fn add_scope<St>(mut self, scope: St) -> FlightclasInsertCall<'a, C>
12401 where
12402 St: AsRef<str>,
12403 {
12404 self._scopes.insert(String::from(scope.as_ref()));
12405 self
12406 }
12407 /// Identifies the authorization scope(s) for the method you are building.
12408 ///
12409 /// See [`Self::add_scope()`] for details.
12410 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasInsertCall<'a, C>
12411 where
12412 I: IntoIterator<Item = St>,
12413 St: AsRef<str>,
12414 {
12415 self._scopes
12416 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12417 self
12418 }
12419
12420 /// Removes all scopes, and no default scope will be used either.
12421 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12422 /// for details).
12423 pub fn clear_scopes(mut self) -> FlightclasInsertCall<'a, C> {
12424 self._scopes.clear();
12425 self
12426 }
12427}
12428
12429/// Returns a list of all flight classes for a given issuer ID.
12430///
12431/// A builder for the *list* method supported by a *flightclas* resource.
12432/// It is not used directly, but through a [`FlightclasMethods`] instance.
12433///
12434/// # Example
12435///
12436/// Instantiate a resource method builder
12437///
12438/// ```test_harness,no_run
12439/// # extern crate hyper;
12440/// # extern crate hyper_rustls;
12441/// # extern crate google_walletobjects1 as walletobjects1;
12442/// # async fn dox() {
12443/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12444///
12445/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12446/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12447/// # secret,
12448/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12449/// # ).build().await.unwrap();
12450///
12451/// # let client = hyper_util::client::legacy::Client::builder(
12452/// # hyper_util::rt::TokioExecutor::new()
12453/// # )
12454/// # .build(
12455/// # hyper_rustls::HttpsConnectorBuilder::new()
12456/// # .with_native_roots()
12457/// # .unwrap()
12458/// # .https_or_http()
12459/// # .enable_http1()
12460/// # .build()
12461/// # );
12462/// # let mut hub = Walletobjects::new(client, auth);
12463/// // You can configure optional parameters by calling the respective setters at will, and
12464/// // execute the final call using `doit()`.
12465/// // Values shown here are possibly random and not representative !
12466/// let result = hub.flightclass().list()
12467/// .token("invidunt")
12468/// .max_results(-47)
12469/// .issuer_id(-20)
12470/// .doit().await;
12471/// # }
12472/// ```
12473pub struct FlightclasListCall<'a, C>
12474where
12475 C: 'a,
12476{
12477 hub: &'a Walletobjects<C>,
12478 _token: Option<String>,
12479 _max_results: Option<i32>,
12480 _issuer_id: Option<i64>,
12481 _delegate: Option<&'a mut dyn common::Delegate>,
12482 _additional_params: HashMap<String, String>,
12483 _scopes: BTreeSet<String>,
12484}
12485
12486impl<'a, C> common::CallBuilder for FlightclasListCall<'a, C> {}
12487
12488impl<'a, C> FlightclasListCall<'a, C>
12489where
12490 C: common::Connector,
12491{
12492 /// Perform the operation you have build so far.
12493 pub async fn doit(mut self) -> common::Result<(common::Response, FlightClassListResponse)> {
12494 use std::borrow::Cow;
12495 use std::io::{Read, Seek};
12496
12497 use common::{url::Params, ToParts};
12498 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12499
12500 let mut dd = common::DefaultDelegate;
12501 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12502 dlg.begin(common::MethodInfo {
12503 id: "walletobjects.flightclass.list",
12504 http_method: hyper::Method::GET,
12505 });
12506
12507 for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
12508 if self._additional_params.contains_key(field) {
12509 dlg.finished(false);
12510 return Err(common::Error::FieldClash(field));
12511 }
12512 }
12513
12514 let mut params = Params::with_capacity(5 + self._additional_params.len());
12515 if let Some(value) = self._token.as_ref() {
12516 params.push("token", value);
12517 }
12518 if let Some(value) = self._max_results.as_ref() {
12519 params.push("maxResults", value.to_string());
12520 }
12521 if let Some(value) = self._issuer_id.as_ref() {
12522 params.push("issuerId", value.to_string());
12523 }
12524
12525 params.extend(self._additional_params.iter());
12526
12527 params.push("alt", "json");
12528 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass";
12529 if self._scopes.is_empty() {
12530 self._scopes
12531 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
12532 }
12533
12534 let url = params.parse_with_url(&url);
12535
12536 loop {
12537 let token = match self
12538 .hub
12539 .auth
12540 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12541 .await
12542 {
12543 Ok(token) => token,
12544 Err(e) => match dlg.token(e) {
12545 Ok(token) => token,
12546 Err(e) => {
12547 dlg.finished(false);
12548 return Err(common::Error::MissingToken(e));
12549 }
12550 },
12551 };
12552 let mut req_result = {
12553 let client = &self.hub.client;
12554 dlg.pre_request();
12555 let mut req_builder = hyper::Request::builder()
12556 .method(hyper::Method::GET)
12557 .uri(url.as_str())
12558 .header(USER_AGENT, self.hub._user_agent.clone());
12559
12560 if let Some(token) = token.as_ref() {
12561 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12562 }
12563
12564 let request = req_builder
12565 .header(CONTENT_LENGTH, 0_u64)
12566 .body(common::to_body::<String>(None));
12567
12568 client.request(request.unwrap()).await
12569 };
12570
12571 match req_result {
12572 Err(err) => {
12573 if let common::Retry::After(d) = dlg.http_error(&err) {
12574 sleep(d).await;
12575 continue;
12576 }
12577 dlg.finished(false);
12578 return Err(common::Error::HttpError(err));
12579 }
12580 Ok(res) => {
12581 let (mut parts, body) = res.into_parts();
12582 let mut body = common::Body::new(body);
12583 if !parts.status.is_success() {
12584 let bytes = common::to_bytes(body).await.unwrap_or_default();
12585 let error = serde_json::from_str(&common::to_string(&bytes));
12586 let response = common::to_response(parts, bytes.into());
12587
12588 if let common::Retry::After(d) =
12589 dlg.http_failure(&response, error.as_ref().ok())
12590 {
12591 sleep(d).await;
12592 continue;
12593 }
12594
12595 dlg.finished(false);
12596
12597 return Err(match error {
12598 Ok(value) => common::Error::BadRequest(value),
12599 _ => common::Error::Failure(response),
12600 });
12601 }
12602 let response = {
12603 let bytes = common::to_bytes(body).await.unwrap_or_default();
12604 let encoded = common::to_string(&bytes);
12605 match serde_json::from_str(&encoded) {
12606 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12607 Err(error) => {
12608 dlg.response_json_decode_error(&encoded, &error);
12609 return Err(common::Error::JsonDecodeError(
12610 encoded.to_string(),
12611 error,
12612 ));
12613 }
12614 }
12615 };
12616
12617 dlg.finished(true);
12618 return Ok(response);
12619 }
12620 }
12621 }
12622 }
12623
12624 /// 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.
12625 ///
12626 /// Sets the *token* query property to the given value.
12627 pub fn token(mut self, new_value: &str) -> FlightclasListCall<'a, C> {
12628 self._token = Some(new_value.to_string());
12629 self
12630 }
12631 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
12632 ///
12633 /// Sets the *max results* query property to the given value.
12634 pub fn max_results(mut self, new_value: i32) -> FlightclasListCall<'a, C> {
12635 self._max_results = Some(new_value);
12636 self
12637 }
12638 /// The ID of the issuer authorized to list classes.
12639 ///
12640 /// Sets the *issuer id* query property to the given value.
12641 pub fn issuer_id(mut self, new_value: i64) -> FlightclasListCall<'a, C> {
12642 self._issuer_id = Some(new_value);
12643 self
12644 }
12645 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12646 /// while executing the actual API request.
12647 ///
12648 /// ````text
12649 /// It should be used to handle progress information, and to implement a certain level of resilience.
12650 /// ````
12651 ///
12652 /// Sets the *delegate* property to the given value.
12653 pub fn delegate(
12654 mut self,
12655 new_value: &'a mut dyn common::Delegate,
12656 ) -> FlightclasListCall<'a, C> {
12657 self._delegate = Some(new_value);
12658 self
12659 }
12660
12661 /// Set any additional parameter of the query string used in the request.
12662 /// It should be used to set parameters which are not yet available through their own
12663 /// setters.
12664 ///
12665 /// Please note that this method must not be used to set any of the known parameters
12666 /// which have their own setter method. If done anyway, the request will fail.
12667 ///
12668 /// # Additional Parameters
12669 ///
12670 /// * *$.xgafv* (query-string) - V1 error format.
12671 /// * *access_token* (query-string) - OAuth access token.
12672 /// * *alt* (query-string) - Data format for response.
12673 /// * *callback* (query-string) - JSONP
12674 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12675 /// * *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.
12676 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12677 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12678 /// * *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.
12679 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12680 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12681 pub fn param<T>(mut self, name: T, value: T) -> FlightclasListCall<'a, C>
12682 where
12683 T: AsRef<str>,
12684 {
12685 self._additional_params
12686 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12687 self
12688 }
12689
12690 /// Identifies the authorization scope for the method you are building.
12691 ///
12692 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12693 /// [`Scope::WalletObjectIssuer`].
12694 ///
12695 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12696 /// tokens for more than one scope.
12697 ///
12698 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12699 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12700 /// sufficient, a read-write scope will do as well.
12701 pub fn add_scope<St>(mut self, scope: St) -> FlightclasListCall<'a, C>
12702 where
12703 St: AsRef<str>,
12704 {
12705 self._scopes.insert(String::from(scope.as_ref()));
12706 self
12707 }
12708 /// Identifies the authorization scope(s) for the method you are building.
12709 ///
12710 /// See [`Self::add_scope()`] for details.
12711 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasListCall<'a, C>
12712 where
12713 I: IntoIterator<Item = St>,
12714 St: AsRef<str>,
12715 {
12716 self._scopes
12717 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12718 self
12719 }
12720
12721 /// Removes all scopes, and no default scope will be used either.
12722 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12723 /// for details).
12724 pub fn clear_scopes(mut self) -> FlightclasListCall<'a, C> {
12725 self._scopes.clear();
12726 self
12727 }
12728}
12729
12730/// Updates the flight class referenced by the given class ID. This method supports patch semantics.
12731///
12732/// A builder for the *patch* method supported by a *flightclas* resource.
12733/// It is not used directly, but through a [`FlightclasMethods`] instance.
12734///
12735/// # Example
12736///
12737/// Instantiate a resource method builder
12738///
12739/// ```test_harness,no_run
12740/// # extern crate hyper;
12741/// # extern crate hyper_rustls;
12742/// # extern crate google_walletobjects1 as walletobjects1;
12743/// use walletobjects1::api::FlightClass;
12744/// # async fn dox() {
12745/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12746///
12747/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12748/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12749/// # secret,
12750/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12751/// # ).build().await.unwrap();
12752///
12753/// # let client = hyper_util::client::legacy::Client::builder(
12754/// # hyper_util::rt::TokioExecutor::new()
12755/// # )
12756/// # .build(
12757/// # hyper_rustls::HttpsConnectorBuilder::new()
12758/// # .with_native_roots()
12759/// # .unwrap()
12760/// # .https_or_http()
12761/// # .enable_http1()
12762/// # .build()
12763/// # );
12764/// # let mut hub = Walletobjects::new(client, auth);
12765/// // As the method needs a request, you would usually fill it with the desired information
12766/// // into the respective structure. Some of the parts shown here might not be applicable !
12767/// // Values shown here are possibly random and not representative !
12768/// let mut req = FlightClass::default();
12769///
12770/// // You can configure optional parameters by calling the respective setters at will, and
12771/// // execute the final call using `doit()`.
12772/// // Values shown here are possibly random and not representative !
12773/// let result = hub.flightclass().patch(req, "resourceId")
12774/// .doit().await;
12775/// # }
12776/// ```
12777pub struct FlightclasPatchCall<'a, C>
12778where
12779 C: 'a,
12780{
12781 hub: &'a Walletobjects<C>,
12782 _request: FlightClass,
12783 _resource_id: String,
12784 _delegate: Option<&'a mut dyn common::Delegate>,
12785 _additional_params: HashMap<String, String>,
12786 _scopes: BTreeSet<String>,
12787}
12788
12789impl<'a, C> common::CallBuilder for FlightclasPatchCall<'a, C> {}
12790
12791impl<'a, C> FlightclasPatchCall<'a, C>
12792where
12793 C: common::Connector,
12794{
12795 /// Perform the operation you have build so far.
12796 pub async fn doit(mut self) -> common::Result<(common::Response, FlightClass)> {
12797 use std::borrow::Cow;
12798 use std::io::{Read, Seek};
12799
12800 use common::{url::Params, ToParts};
12801 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12802
12803 let mut dd = common::DefaultDelegate;
12804 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12805 dlg.begin(common::MethodInfo {
12806 id: "walletobjects.flightclass.patch",
12807 http_method: hyper::Method::PATCH,
12808 });
12809
12810 for &field in ["alt", "resourceId"].iter() {
12811 if self._additional_params.contains_key(field) {
12812 dlg.finished(false);
12813 return Err(common::Error::FieldClash(field));
12814 }
12815 }
12816
12817 let mut params = Params::with_capacity(4 + self._additional_params.len());
12818 params.push("resourceId", self._resource_id);
12819
12820 params.extend(self._additional_params.iter());
12821
12822 params.push("alt", "json");
12823 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass/{resourceId}";
12824 if self._scopes.is_empty() {
12825 self._scopes
12826 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
12827 }
12828
12829 #[allow(clippy::single_element_loop)]
12830 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
12831 url = params.uri_replacement(url, param_name, find_this, false);
12832 }
12833 {
12834 let to_remove = ["resourceId"];
12835 params.remove_params(&to_remove);
12836 }
12837
12838 let url = params.parse_with_url(&url);
12839
12840 let mut json_mime_type = mime::APPLICATION_JSON;
12841 let mut request_value_reader = {
12842 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12843 common::remove_json_null_values(&mut value);
12844 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12845 serde_json::to_writer(&mut dst, &value).unwrap();
12846 dst
12847 };
12848 let request_size = request_value_reader
12849 .seek(std::io::SeekFrom::End(0))
12850 .unwrap();
12851 request_value_reader
12852 .seek(std::io::SeekFrom::Start(0))
12853 .unwrap();
12854
12855 loop {
12856 let token = match self
12857 .hub
12858 .auth
12859 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12860 .await
12861 {
12862 Ok(token) => token,
12863 Err(e) => match dlg.token(e) {
12864 Ok(token) => token,
12865 Err(e) => {
12866 dlg.finished(false);
12867 return Err(common::Error::MissingToken(e));
12868 }
12869 },
12870 };
12871 request_value_reader
12872 .seek(std::io::SeekFrom::Start(0))
12873 .unwrap();
12874 let mut req_result = {
12875 let client = &self.hub.client;
12876 dlg.pre_request();
12877 let mut req_builder = hyper::Request::builder()
12878 .method(hyper::Method::PATCH)
12879 .uri(url.as_str())
12880 .header(USER_AGENT, self.hub._user_agent.clone());
12881
12882 if let Some(token) = token.as_ref() {
12883 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12884 }
12885
12886 let request = req_builder
12887 .header(CONTENT_TYPE, json_mime_type.to_string())
12888 .header(CONTENT_LENGTH, request_size as u64)
12889 .body(common::to_body(
12890 request_value_reader.get_ref().clone().into(),
12891 ));
12892
12893 client.request(request.unwrap()).await
12894 };
12895
12896 match req_result {
12897 Err(err) => {
12898 if let common::Retry::After(d) = dlg.http_error(&err) {
12899 sleep(d).await;
12900 continue;
12901 }
12902 dlg.finished(false);
12903 return Err(common::Error::HttpError(err));
12904 }
12905 Ok(res) => {
12906 let (mut parts, body) = res.into_parts();
12907 let mut body = common::Body::new(body);
12908 if !parts.status.is_success() {
12909 let bytes = common::to_bytes(body).await.unwrap_or_default();
12910 let error = serde_json::from_str(&common::to_string(&bytes));
12911 let response = common::to_response(parts, bytes.into());
12912
12913 if let common::Retry::After(d) =
12914 dlg.http_failure(&response, error.as_ref().ok())
12915 {
12916 sleep(d).await;
12917 continue;
12918 }
12919
12920 dlg.finished(false);
12921
12922 return Err(match error {
12923 Ok(value) => common::Error::BadRequest(value),
12924 _ => common::Error::Failure(response),
12925 });
12926 }
12927 let response = {
12928 let bytes = common::to_bytes(body).await.unwrap_or_default();
12929 let encoded = common::to_string(&bytes);
12930 match serde_json::from_str(&encoded) {
12931 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12932 Err(error) => {
12933 dlg.response_json_decode_error(&encoded, &error);
12934 return Err(common::Error::JsonDecodeError(
12935 encoded.to_string(),
12936 error,
12937 ));
12938 }
12939 }
12940 };
12941
12942 dlg.finished(true);
12943 return Ok(response);
12944 }
12945 }
12946 }
12947 }
12948
12949 ///
12950 /// Sets the *request* property to the given value.
12951 ///
12952 /// Even though the property as already been set when instantiating this call,
12953 /// we provide this method for API completeness.
12954 pub fn request(mut self, new_value: FlightClass) -> FlightclasPatchCall<'a, C> {
12955 self._request = new_value;
12956 self
12957 }
12958 /// 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 '-'.
12959 ///
12960 /// Sets the *resource id* path property to the given value.
12961 ///
12962 /// Even though the property as already been set when instantiating this call,
12963 /// we provide this method for API completeness.
12964 pub fn resource_id(mut self, new_value: &str) -> FlightclasPatchCall<'a, C> {
12965 self._resource_id = new_value.to_string();
12966 self
12967 }
12968 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12969 /// while executing the actual API request.
12970 ///
12971 /// ````text
12972 /// It should be used to handle progress information, and to implement a certain level of resilience.
12973 /// ````
12974 ///
12975 /// Sets the *delegate* property to the given value.
12976 pub fn delegate(
12977 mut self,
12978 new_value: &'a mut dyn common::Delegate,
12979 ) -> FlightclasPatchCall<'a, C> {
12980 self._delegate = Some(new_value);
12981 self
12982 }
12983
12984 /// Set any additional parameter of the query string used in the request.
12985 /// It should be used to set parameters which are not yet available through their own
12986 /// setters.
12987 ///
12988 /// Please note that this method must not be used to set any of the known parameters
12989 /// which have their own setter method. If done anyway, the request will fail.
12990 ///
12991 /// # Additional Parameters
12992 ///
12993 /// * *$.xgafv* (query-string) - V1 error format.
12994 /// * *access_token* (query-string) - OAuth access token.
12995 /// * *alt* (query-string) - Data format for response.
12996 /// * *callback* (query-string) - JSONP
12997 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12998 /// * *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.
12999 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13000 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13001 /// * *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.
13002 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13003 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13004 pub fn param<T>(mut self, name: T, value: T) -> FlightclasPatchCall<'a, C>
13005 where
13006 T: AsRef<str>,
13007 {
13008 self._additional_params
13009 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13010 self
13011 }
13012
13013 /// Identifies the authorization scope for the method you are building.
13014 ///
13015 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13016 /// [`Scope::WalletObjectIssuer`].
13017 ///
13018 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13019 /// tokens for more than one scope.
13020 ///
13021 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13022 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13023 /// sufficient, a read-write scope will do as well.
13024 pub fn add_scope<St>(mut self, scope: St) -> FlightclasPatchCall<'a, C>
13025 where
13026 St: AsRef<str>,
13027 {
13028 self._scopes.insert(String::from(scope.as_ref()));
13029 self
13030 }
13031 /// Identifies the authorization scope(s) for the method you are building.
13032 ///
13033 /// See [`Self::add_scope()`] for details.
13034 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasPatchCall<'a, C>
13035 where
13036 I: IntoIterator<Item = St>,
13037 St: AsRef<str>,
13038 {
13039 self._scopes
13040 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13041 self
13042 }
13043
13044 /// Removes all scopes, and no default scope will be used either.
13045 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13046 /// for details).
13047 pub fn clear_scopes(mut self) -> FlightclasPatchCall<'a, C> {
13048 self._scopes.clear();
13049 self
13050 }
13051}
13052
13053/// Updates the flight class referenced by the given class ID.
13054///
13055/// A builder for the *update* method supported by a *flightclas* resource.
13056/// It is not used directly, but through a [`FlightclasMethods`] instance.
13057///
13058/// # Example
13059///
13060/// Instantiate a resource method builder
13061///
13062/// ```test_harness,no_run
13063/// # extern crate hyper;
13064/// # extern crate hyper_rustls;
13065/// # extern crate google_walletobjects1 as walletobjects1;
13066/// use walletobjects1::api::FlightClass;
13067/// # async fn dox() {
13068/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13069///
13070/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13071/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13072/// # secret,
13073/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13074/// # ).build().await.unwrap();
13075///
13076/// # let client = hyper_util::client::legacy::Client::builder(
13077/// # hyper_util::rt::TokioExecutor::new()
13078/// # )
13079/// # .build(
13080/// # hyper_rustls::HttpsConnectorBuilder::new()
13081/// # .with_native_roots()
13082/// # .unwrap()
13083/// # .https_or_http()
13084/// # .enable_http1()
13085/// # .build()
13086/// # );
13087/// # let mut hub = Walletobjects::new(client, auth);
13088/// // As the method needs a request, you would usually fill it with the desired information
13089/// // into the respective structure. Some of the parts shown here might not be applicable !
13090/// // Values shown here are possibly random and not representative !
13091/// let mut req = FlightClass::default();
13092///
13093/// // You can configure optional parameters by calling the respective setters at will, and
13094/// // execute the final call using `doit()`.
13095/// // Values shown here are possibly random and not representative !
13096/// let result = hub.flightclass().update(req, "resourceId")
13097/// .doit().await;
13098/// # }
13099/// ```
13100pub struct FlightclasUpdateCall<'a, C>
13101where
13102 C: 'a,
13103{
13104 hub: &'a Walletobjects<C>,
13105 _request: FlightClass,
13106 _resource_id: String,
13107 _delegate: Option<&'a mut dyn common::Delegate>,
13108 _additional_params: HashMap<String, String>,
13109 _scopes: BTreeSet<String>,
13110}
13111
13112impl<'a, C> common::CallBuilder for FlightclasUpdateCall<'a, C> {}
13113
13114impl<'a, C> FlightclasUpdateCall<'a, C>
13115where
13116 C: common::Connector,
13117{
13118 /// Perform the operation you have build so far.
13119 pub async fn doit(mut self) -> common::Result<(common::Response, FlightClass)> {
13120 use std::borrow::Cow;
13121 use std::io::{Read, Seek};
13122
13123 use common::{url::Params, ToParts};
13124 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13125
13126 let mut dd = common::DefaultDelegate;
13127 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13128 dlg.begin(common::MethodInfo {
13129 id: "walletobjects.flightclass.update",
13130 http_method: hyper::Method::PUT,
13131 });
13132
13133 for &field in ["alt", "resourceId"].iter() {
13134 if self._additional_params.contains_key(field) {
13135 dlg.finished(false);
13136 return Err(common::Error::FieldClash(field));
13137 }
13138 }
13139
13140 let mut params = Params::with_capacity(4 + self._additional_params.len());
13141 params.push("resourceId", self._resource_id);
13142
13143 params.extend(self._additional_params.iter());
13144
13145 params.push("alt", "json");
13146 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightClass/{resourceId}";
13147 if self._scopes.is_empty() {
13148 self._scopes
13149 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
13150 }
13151
13152 #[allow(clippy::single_element_loop)]
13153 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
13154 url = params.uri_replacement(url, param_name, find_this, false);
13155 }
13156 {
13157 let to_remove = ["resourceId"];
13158 params.remove_params(&to_remove);
13159 }
13160
13161 let url = params.parse_with_url(&url);
13162
13163 let mut json_mime_type = mime::APPLICATION_JSON;
13164 let mut request_value_reader = {
13165 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13166 common::remove_json_null_values(&mut value);
13167 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13168 serde_json::to_writer(&mut dst, &value).unwrap();
13169 dst
13170 };
13171 let request_size = request_value_reader
13172 .seek(std::io::SeekFrom::End(0))
13173 .unwrap();
13174 request_value_reader
13175 .seek(std::io::SeekFrom::Start(0))
13176 .unwrap();
13177
13178 loop {
13179 let token = match self
13180 .hub
13181 .auth
13182 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13183 .await
13184 {
13185 Ok(token) => token,
13186 Err(e) => match dlg.token(e) {
13187 Ok(token) => token,
13188 Err(e) => {
13189 dlg.finished(false);
13190 return Err(common::Error::MissingToken(e));
13191 }
13192 },
13193 };
13194 request_value_reader
13195 .seek(std::io::SeekFrom::Start(0))
13196 .unwrap();
13197 let mut req_result = {
13198 let client = &self.hub.client;
13199 dlg.pre_request();
13200 let mut req_builder = hyper::Request::builder()
13201 .method(hyper::Method::PUT)
13202 .uri(url.as_str())
13203 .header(USER_AGENT, self.hub._user_agent.clone());
13204
13205 if let Some(token) = token.as_ref() {
13206 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13207 }
13208
13209 let request = req_builder
13210 .header(CONTENT_TYPE, json_mime_type.to_string())
13211 .header(CONTENT_LENGTH, request_size as u64)
13212 .body(common::to_body(
13213 request_value_reader.get_ref().clone().into(),
13214 ));
13215
13216 client.request(request.unwrap()).await
13217 };
13218
13219 match req_result {
13220 Err(err) => {
13221 if let common::Retry::After(d) = dlg.http_error(&err) {
13222 sleep(d).await;
13223 continue;
13224 }
13225 dlg.finished(false);
13226 return Err(common::Error::HttpError(err));
13227 }
13228 Ok(res) => {
13229 let (mut parts, body) = res.into_parts();
13230 let mut body = common::Body::new(body);
13231 if !parts.status.is_success() {
13232 let bytes = common::to_bytes(body).await.unwrap_or_default();
13233 let error = serde_json::from_str(&common::to_string(&bytes));
13234 let response = common::to_response(parts, bytes.into());
13235
13236 if let common::Retry::After(d) =
13237 dlg.http_failure(&response, error.as_ref().ok())
13238 {
13239 sleep(d).await;
13240 continue;
13241 }
13242
13243 dlg.finished(false);
13244
13245 return Err(match error {
13246 Ok(value) => common::Error::BadRequest(value),
13247 _ => common::Error::Failure(response),
13248 });
13249 }
13250 let response = {
13251 let bytes = common::to_bytes(body).await.unwrap_or_default();
13252 let encoded = common::to_string(&bytes);
13253 match serde_json::from_str(&encoded) {
13254 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13255 Err(error) => {
13256 dlg.response_json_decode_error(&encoded, &error);
13257 return Err(common::Error::JsonDecodeError(
13258 encoded.to_string(),
13259 error,
13260 ));
13261 }
13262 }
13263 };
13264
13265 dlg.finished(true);
13266 return Ok(response);
13267 }
13268 }
13269 }
13270 }
13271
13272 ///
13273 /// Sets the *request* property to the given value.
13274 ///
13275 /// Even though the property as already been set when instantiating this call,
13276 /// we provide this method for API completeness.
13277 pub fn request(mut self, new_value: FlightClass) -> FlightclasUpdateCall<'a, C> {
13278 self._request = new_value;
13279 self
13280 }
13281 /// 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 '-'.
13282 ///
13283 /// Sets the *resource id* path property to the given value.
13284 ///
13285 /// Even though the property as already been set when instantiating this call,
13286 /// we provide this method for API completeness.
13287 pub fn resource_id(mut self, new_value: &str) -> FlightclasUpdateCall<'a, C> {
13288 self._resource_id = new_value.to_string();
13289 self
13290 }
13291 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13292 /// while executing the actual API request.
13293 ///
13294 /// ````text
13295 /// It should be used to handle progress information, and to implement a certain level of resilience.
13296 /// ````
13297 ///
13298 /// Sets the *delegate* property to the given value.
13299 pub fn delegate(
13300 mut self,
13301 new_value: &'a mut dyn common::Delegate,
13302 ) -> FlightclasUpdateCall<'a, C> {
13303 self._delegate = Some(new_value);
13304 self
13305 }
13306
13307 /// Set any additional parameter of the query string used in the request.
13308 /// It should be used to set parameters which are not yet available through their own
13309 /// setters.
13310 ///
13311 /// Please note that this method must not be used to set any of the known parameters
13312 /// which have their own setter method. If done anyway, the request will fail.
13313 ///
13314 /// # Additional Parameters
13315 ///
13316 /// * *$.xgafv* (query-string) - V1 error format.
13317 /// * *access_token* (query-string) - OAuth access token.
13318 /// * *alt* (query-string) - Data format for response.
13319 /// * *callback* (query-string) - JSONP
13320 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13321 /// * *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.
13322 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13323 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13324 /// * *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.
13325 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13326 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13327 pub fn param<T>(mut self, name: T, value: T) -> FlightclasUpdateCall<'a, C>
13328 where
13329 T: AsRef<str>,
13330 {
13331 self._additional_params
13332 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13333 self
13334 }
13335
13336 /// Identifies the authorization scope for the method you are building.
13337 ///
13338 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13339 /// [`Scope::WalletObjectIssuer`].
13340 ///
13341 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13342 /// tokens for more than one scope.
13343 ///
13344 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13345 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13346 /// sufficient, a read-write scope will do as well.
13347 pub fn add_scope<St>(mut self, scope: St) -> FlightclasUpdateCall<'a, C>
13348 where
13349 St: AsRef<str>,
13350 {
13351 self._scopes.insert(String::from(scope.as_ref()));
13352 self
13353 }
13354 /// Identifies the authorization scope(s) for the method you are building.
13355 ///
13356 /// See [`Self::add_scope()`] for details.
13357 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightclasUpdateCall<'a, C>
13358 where
13359 I: IntoIterator<Item = St>,
13360 St: AsRef<str>,
13361 {
13362 self._scopes
13363 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13364 self
13365 }
13366
13367 /// Removes all scopes, and no default scope will be used either.
13368 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13369 /// for details).
13370 pub fn clear_scopes(mut self) -> FlightclasUpdateCall<'a, C> {
13371 self._scopes.clear();
13372 self
13373 }
13374}
13375
13376/// Adds a message to the flight object referenced by the given object ID.
13377///
13378/// A builder for the *addmessage* method supported by a *flightobject* resource.
13379/// It is not used directly, but through a [`FlightobjectMethods`] instance.
13380///
13381/// # Example
13382///
13383/// Instantiate a resource method builder
13384///
13385/// ```test_harness,no_run
13386/// # extern crate hyper;
13387/// # extern crate hyper_rustls;
13388/// # extern crate google_walletobjects1 as walletobjects1;
13389/// use walletobjects1::api::AddMessageRequest;
13390/// # async fn dox() {
13391/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13392///
13393/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13394/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13395/// # secret,
13396/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13397/// # ).build().await.unwrap();
13398///
13399/// # let client = hyper_util::client::legacy::Client::builder(
13400/// # hyper_util::rt::TokioExecutor::new()
13401/// # )
13402/// # .build(
13403/// # hyper_rustls::HttpsConnectorBuilder::new()
13404/// # .with_native_roots()
13405/// # .unwrap()
13406/// # .https_or_http()
13407/// # .enable_http1()
13408/// # .build()
13409/// # );
13410/// # let mut hub = Walletobjects::new(client, auth);
13411/// // As the method needs a request, you would usually fill it with the desired information
13412/// // into the respective structure. Some of the parts shown here might not be applicable !
13413/// // Values shown here are possibly random and not representative !
13414/// let mut req = AddMessageRequest::default();
13415///
13416/// // You can configure optional parameters by calling the respective setters at will, and
13417/// // execute the final call using `doit()`.
13418/// // Values shown here are possibly random and not representative !
13419/// let result = hub.flightobject().addmessage(req, "resourceId")
13420/// .doit().await;
13421/// # }
13422/// ```
13423pub struct FlightobjectAddmessageCall<'a, C>
13424where
13425 C: 'a,
13426{
13427 hub: &'a Walletobjects<C>,
13428 _request: AddMessageRequest,
13429 _resource_id: String,
13430 _delegate: Option<&'a mut dyn common::Delegate>,
13431 _additional_params: HashMap<String, String>,
13432 _scopes: BTreeSet<String>,
13433}
13434
13435impl<'a, C> common::CallBuilder for FlightobjectAddmessageCall<'a, C> {}
13436
13437impl<'a, C> FlightobjectAddmessageCall<'a, C>
13438where
13439 C: common::Connector,
13440{
13441 /// Perform the operation you have build so far.
13442 pub async fn doit(
13443 mut self,
13444 ) -> common::Result<(common::Response, FlightObjectAddMessageResponse)> {
13445 use std::borrow::Cow;
13446 use std::io::{Read, Seek};
13447
13448 use common::{url::Params, ToParts};
13449 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13450
13451 let mut dd = common::DefaultDelegate;
13452 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13453 dlg.begin(common::MethodInfo {
13454 id: "walletobjects.flightobject.addmessage",
13455 http_method: hyper::Method::POST,
13456 });
13457
13458 for &field in ["alt", "resourceId"].iter() {
13459 if self._additional_params.contains_key(field) {
13460 dlg.finished(false);
13461 return Err(common::Error::FieldClash(field));
13462 }
13463 }
13464
13465 let mut params = Params::with_capacity(4 + self._additional_params.len());
13466 params.push("resourceId", self._resource_id);
13467
13468 params.extend(self._additional_params.iter());
13469
13470 params.push("alt", "json");
13471 let mut url =
13472 self.hub._base_url.clone() + "walletobjects/v1/flightObject/{resourceId}/addMessage";
13473 if self._scopes.is_empty() {
13474 self._scopes
13475 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
13476 }
13477
13478 #[allow(clippy::single_element_loop)]
13479 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
13480 url = params.uri_replacement(url, param_name, find_this, false);
13481 }
13482 {
13483 let to_remove = ["resourceId"];
13484 params.remove_params(&to_remove);
13485 }
13486
13487 let url = params.parse_with_url(&url);
13488
13489 let mut json_mime_type = mime::APPLICATION_JSON;
13490 let mut request_value_reader = {
13491 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13492 common::remove_json_null_values(&mut value);
13493 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13494 serde_json::to_writer(&mut dst, &value).unwrap();
13495 dst
13496 };
13497 let request_size = request_value_reader
13498 .seek(std::io::SeekFrom::End(0))
13499 .unwrap();
13500 request_value_reader
13501 .seek(std::io::SeekFrom::Start(0))
13502 .unwrap();
13503
13504 loop {
13505 let token = match self
13506 .hub
13507 .auth
13508 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13509 .await
13510 {
13511 Ok(token) => token,
13512 Err(e) => match dlg.token(e) {
13513 Ok(token) => token,
13514 Err(e) => {
13515 dlg.finished(false);
13516 return Err(common::Error::MissingToken(e));
13517 }
13518 },
13519 };
13520 request_value_reader
13521 .seek(std::io::SeekFrom::Start(0))
13522 .unwrap();
13523 let mut req_result = {
13524 let client = &self.hub.client;
13525 dlg.pre_request();
13526 let mut req_builder = hyper::Request::builder()
13527 .method(hyper::Method::POST)
13528 .uri(url.as_str())
13529 .header(USER_AGENT, self.hub._user_agent.clone());
13530
13531 if let Some(token) = token.as_ref() {
13532 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13533 }
13534
13535 let request = req_builder
13536 .header(CONTENT_TYPE, json_mime_type.to_string())
13537 .header(CONTENT_LENGTH, request_size as u64)
13538 .body(common::to_body(
13539 request_value_reader.get_ref().clone().into(),
13540 ));
13541
13542 client.request(request.unwrap()).await
13543 };
13544
13545 match req_result {
13546 Err(err) => {
13547 if let common::Retry::After(d) = dlg.http_error(&err) {
13548 sleep(d).await;
13549 continue;
13550 }
13551 dlg.finished(false);
13552 return Err(common::Error::HttpError(err));
13553 }
13554 Ok(res) => {
13555 let (mut parts, body) = res.into_parts();
13556 let mut body = common::Body::new(body);
13557 if !parts.status.is_success() {
13558 let bytes = common::to_bytes(body).await.unwrap_or_default();
13559 let error = serde_json::from_str(&common::to_string(&bytes));
13560 let response = common::to_response(parts, bytes.into());
13561
13562 if let common::Retry::After(d) =
13563 dlg.http_failure(&response, error.as_ref().ok())
13564 {
13565 sleep(d).await;
13566 continue;
13567 }
13568
13569 dlg.finished(false);
13570
13571 return Err(match error {
13572 Ok(value) => common::Error::BadRequest(value),
13573 _ => common::Error::Failure(response),
13574 });
13575 }
13576 let response = {
13577 let bytes = common::to_bytes(body).await.unwrap_or_default();
13578 let encoded = common::to_string(&bytes);
13579 match serde_json::from_str(&encoded) {
13580 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13581 Err(error) => {
13582 dlg.response_json_decode_error(&encoded, &error);
13583 return Err(common::Error::JsonDecodeError(
13584 encoded.to_string(),
13585 error,
13586 ));
13587 }
13588 }
13589 };
13590
13591 dlg.finished(true);
13592 return Ok(response);
13593 }
13594 }
13595 }
13596 }
13597
13598 ///
13599 /// Sets the *request* property to the given value.
13600 ///
13601 /// Even though the property as already been set when instantiating this call,
13602 /// we provide this method for API completeness.
13603 pub fn request(mut self, new_value: AddMessageRequest) -> FlightobjectAddmessageCall<'a, C> {
13604 self._request = new_value;
13605 self
13606 }
13607 /// 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 '-'.
13608 ///
13609 /// Sets the *resource id* path property to the given value.
13610 ///
13611 /// Even though the property as already been set when instantiating this call,
13612 /// we provide this method for API completeness.
13613 pub fn resource_id(mut self, new_value: &str) -> FlightobjectAddmessageCall<'a, C> {
13614 self._resource_id = new_value.to_string();
13615 self
13616 }
13617 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13618 /// while executing the actual API request.
13619 ///
13620 /// ````text
13621 /// It should be used to handle progress information, and to implement a certain level of resilience.
13622 /// ````
13623 ///
13624 /// Sets the *delegate* property to the given value.
13625 pub fn delegate(
13626 mut self,
13627 new_value: &'a mut dyn common::Delegate,
13628 ) -> FlightobjectAddmessageCall<'a, C> {
13629 self._delegate = Some(new_value);
13630 self
13631 }
13632
13633 /// Set any additional parameter of the query string used in the request.
13634 /// It should be used to set parameters which are not yet available through their own
13635 /// setters.
13636 ///
13637 /// Please note that this method must not be used to set any of the known parameters
13638 /// which have their own setter method. If done anyway, the request will fail.
13639 ///
13640 /// # Additional Parameters
13641 ///
13642 /// * *$.xgafv* (query-string) - V1 error format.
13643 /// * *access_token* (query-string) - OAuth access token.
13644 /// * *alt* (query-string) - Data format for response.
13645 /// * *callback* (query-string) - JSONP
13646 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13647 /// * *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.
13648 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13649 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13650 /// * *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.
13651 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13652 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13653 pub fn param<T>(mut self, name: T, value: T) -> FlightobjectAddmessageCall<'a, C>
13654 where
13655 T: AsRef<str>,
13656 {
13657 self._additional_params
13658 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13659 self
13660 }
13661
13662 /// Identifies the authorization scope for the method you are building.
13663 ///
13664 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13665 /// [`Scope::WalletObjectIssuer`].
13666 ///
13667 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13668 /// tokens for more than one scope.
13669 ///
13670 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13671 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13672 /// sufficient, a read-write scope will do as well.
13673 pub fn add_scope<St>(mut self, scope: St) -> FlightobjectAddmessageCall<'a, C>
13674 where
13675 St: AsRef<str>,
13676 {
13677 self._scopes.insert(String::from(scope.as_ref()));
13678 self
13679 }
13680 /// Identifies the authorization scope(s) for the method you are building.
13681 ///
13682 /// See [`Self::add_scope()`] for details.
13683 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectAddmessageCall<'a, C>
13684 where
13685 I: IntoIterator<Item = St>,
13686 St: AsRef<str>,
13687 {
13688 self._scopes
13689 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13690 self
13691 }
13692
13693 /// Removes all scopes, and no default scope will be used either.
13694 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13695 /// for details).
13696 pub fn clear_scopes(mut self) -> FlightobjectAddmessageCall<'a, C> {
13697 self._scopes.clear();
13698 self
13699 }
13700}
13701
13702/// Returns the flight object with the given object ID.
13703///
13704/// A builder for the *get* method supported by a *flightobject* resource.
13705/// It is not used directly, but through a [`FlightobjectMethods`] instance.
13706///
13707/// # Example
13708///
13709/// Instantiate a resource method builder
13710///
13711/// ```test_harness,no_run
13712/// # extern crate hyper;
13713/// # extern crate hyper_rustls;
13714/// # extern crate google_walletobjects1 as walletobjects1;
13715/// # async fn dox() {
13716/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13717///
13718/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13719/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13720/// # secret,
13721/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13722/// # ).build().await.unwrap();
13723///
13724/// # let client = hyper_util::client::legacy::Client::builder(
13725/// # hyper_util::rt::TokioExecutor::new()
13726/// # )
13727/// # .build(
13728/// # hyper_rustls::HttpsConnectorBuilder::new()
13729/// # .with_native_roots()
13730/// # .unwrap()
13731/// # .https_or_http()
13732/// # .enable_http1()
13733/// # .build()
13734/// # );
13735/// # let mut hub = Walletobjects::new(client, auth);
13736/// // You can configure optional parameters by calling the respective setters at will, and
13737/// // execute the final call using `doit()`.
13738/// // Values shown here are possibly random and not representative !
13739/// let result = hub.flightobject().get("resourceId")
13740/// .doit().await;
13741/// # }
13742/// ```
13743pub struct FlightobjectGetCall<'a, C>
13744where
13745 C: 'a,
13746{
13747 hub: &'a Walletobjects<C>,
13748 _resource_id: String,
13749 _delegate: Option<&'a mut dyn common::Delegate>,
13750 _additional_params: HashMap<String, String>,
13751 _scopes: BTreeSet<String>,
13752}
13753
13754impl<'a, C> common::CallBuilder for FlightobjectGetCall<'a, C> {}
13755
13756impl<'a, C> FlightobjectGetCall<'a, C>
13757where
13758 C: common::Connector,
13759{
13760 /// Perform the operation you have build so far.
13761 pub async fn doit(mut self) -> common::Result<(common::Response, FlightObject)> {
13762 use std::borrow::Cow;
13763 use std::io::{Read, Seek};
13764
13765 use common::{url::Params, ToParts};
13766 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13767
13768 let mut dd = common::DefaultDelegate;
13769 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13770 dlg.begin(common::MethodInfo {
13771 id: "walletobjects.flightobject.get",
13772 http_method: hyper::Method::GET,
13773 });
13774
13775 for &field in ["alt", "resourceId"].iter() {
13776 if self._additional_params.contains_key(field) {
13777 dlg.finished(false);
13778 return Err(common::Error::FieldClash(field));
13779 }
13780 }
13781
13782 let mut params = Params::with_capacity(3 + self._additional_params.len());
13783 params.push("resourceId", self._resource_id);
13784
13785 params.extend(self._additional_params.iter());
13786
13787 params.push("alt", "json");
13788 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject/{resourceId}";
13789 if self._scopes.is_empty() {
13790 self._scopes
13791 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
13792 }
13793
13794 #[allow(clippy::single_element_loop)]
13795 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
13796 url = params.uri_replacement(url, param_name, find_this, false);
13797 }
13798 {
13799 let to_remove = ["resourceId"];
13800 params.remove_params(&to_remove);
13801 }
13802
13803 let url = params.parse_with_url(&url);
13804
13805 loop {
13806 let token = match self
13807 .hub
13808 .auth
13809 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13810 .await
13811 {
13812 Ok(token) => token,
13813 Err(e) => match dlg.token(e) {
13814 Ok(token) => token,
13815 Err(e) => {
13816 dlg.finished(false);
13817 return Err(common::Error::MissingToken(e));
13818 }
13819 },
13820 };
13821 let mut req_result = {
13822 let client = &self.hub.client;
13823 dlg.pre_request();
13824 let mut req_builder = hyper::Request::builder()
13825 .method(hyper::Method::GET)
13826 .uri(url.as_str())
13827 .header(USER_AGENT, self.hub._user_agent.clone());
13828
13829 if let Some(token) = token.as_ref() {
13830 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13831 }
13832
13833 let request = req_builder
13834 .header(CONTENT_LENGTH, 0_u64)
13835 .body(common::to_body::<String>(None));
13836
13837 client.request(request.unwrap()).await
13838 };
13839
13840 match req_result {
13841 Err(err) => {
13842 if let common::Retry::After(d) = dlg.http_error(&err) {
13843 sleep(d).await;
13844 continue;
13845 }
13846 dlg.finished(false);
13847 return Err(common::Error::HttpError(err));
13848 }
13849 Ok(res) => {
13850 let (mut parts, body) = res.into_parts();
13851 let mut body = common::Body::new(body);
13852 if !parts.status.is_success() {
13853 let bytes = common::to_bytes(body).await.unwrap_or_default();
13854 let error = serde_json::from_str(&common::to_string(&bytes));
13855 let response = common::to_response(parts, bytes.into());
13856
13857 if let common::Retry::After(d) =
13858 dlg.http_failure(&response, error.as_ref().ok())
13859 {
13860 sleep(d).await;
13861 continue;
13862 }
13863
13864 dlg.finished(false);
13865
13866 return Err(match error {
13867 Ok(value) => common::Error::BadRequest(value),
13868 _ => common::Error::Failure(response),
13869 });
13870 }
13871 let response = {
13872 let bytes = common::to_bytes(body).await.unwrap_or_default();
13873 let encoded = common::to_string(&bytes);
13874 match serde_json::from_str(&encoded) {
13875 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13876 Err(error) => {
13877 dlg.response_json_decode_error(&encoded, &error);
13878 return Err(common::Error::JsonDecodeError(
13879 encoded.to_string(),
13880 error,
13881 ));
13882 }
13883 }
13884 };
13885
13886 dlg.finished(true);
13887 return Ok(response);
13888 }
13889 }
13890 }
13891 }
13892
13893 /// 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 '-'.
13894 ///
13895 /// Sets the *resource id* path property to the given value.
13896 ///
13897 /// Even though the property as already been set when instantiating this call,
13898 /// we provide this method for API completeness.
13899 pub fn resource_id(mut self, new_value: &str) -> FlightobjectGetCall<'a, C> {
13900 self._resource_id = new_value.to_string();
13901 self
13902 }
13903 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13904 /// while executing the actual API request.
13905 ///
13906 /// ````text
13907 /// It should be used to handle progress information, and to implement a certain level of resilience.
13908 /// ````
13909 ///
13910 /// Sets the *delegate* property to the given value.
13911 pub fn delegate(
13912 mut self,
13913 new_value: &'a mut dyn common::Delegate,
13914 ) -> FlightobjectGetCall<'a, C> {
13915 self._delegate = Some(new_value);
13916 self
13917 }
13918
13919 /// Set any additional parameter of the query string used in the request.
13920 /// It should be used to set parameters which are not yet available through their own
13921 /// setters.
13922 ///
13923 /// Please note that this method must not be used to set any of the known parameters
13924 /// which have their own setter method. If done anyway, the request will fail.
13925 ///
13926 /// # Additional Parameters
13927 ///
13928 /// * *$.xgafv* (query-string) - V1 error format.
13929 /// * *access_token* (query-string) - OAuth access token.
13930 /// * *alt* (query-string) - Data format for response.
13931 /// * *callback* (query-string) - JSONP
13932 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13933 /// * *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.
13934 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13935 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13936 /// * *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.
13937 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13938 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13939 pub fn param<T>(mut self, name: T, value: T) -> FlightobjectGetCall<'a, C>
13940 where
13941 T: AsRef<str>,
13942 {
13943 self._additional_params
13944 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13945 self
13946 }
13947
13948 /// Identifies the authorization scope for the method you are building.
13949 ///
13950 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13951 /// [`Scope::WalletObjectIssuer`].
13952 ///
13953 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13954 /// tokens for more than one scope.
13955 ///
13956 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13957 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13958 /// sufficient, a read-write scope will do as well.
13959 pub fn add_scope<St>(mut self, scope: St) -> FlightobjectGetCall<'a, C>
13960 where
13961 St: AsRef<str>,
13962 {
13963 self._scopes.insert(String::from(scope.as_ref()));
13964 self
13965 }
13966 /// Identifies the authorization scope(s) for the method you are building.
13967 ///
13968 /// See [`Self::add_scope()`] for details.
13969 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectGetCall<'a, C>
13970 where
13971 I: IntoIterator<Item = St>,
13972 St: AsRef<str>,
13973 {
13974 self._scopes
13975 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13976 self
13977 }
13978
13979 /// Removes all scopes, and no default scope will be used either.
13980 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13981 /// for details).
13982 pub fn clear_scopes(mut self) -> FlightobjectGetCall<'a, C> {
13983 self._scopes.clear();
13984 self
13985 }
13986}
13987
13988/// Inserts an flight object with the given ID and properties.
13989///
13990/// A builder for the *insert* method supported by a *flightobject* resource.
13991/// It is not used directly, but through a [`FlightobjectMethods`] instance.
13992///
13993/// # Example
13994///
13995/// Instantiate a resource method builder
13996///
13997/// ```test_harness,no_run
13998/// # extern crate hyper;
13999/// # extern crate hyper_rustls;
14000/// # extern crate google_walletobjects1 as walletobjects1;
14001/// use walletobjects1::api::FlightObject;
14002/// # async fn dox() {
14003/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14004///
14005/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14006/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14007/// # secret,
14008/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14009/// # ).build().await.unwrap();
14010///
14011/// # let client = hyper_util::client::legacy::Client::builder(
14012/// # hyper_util::rt::TokioExecutor::new()
14013/// # )
14014/// # .build(
14015/// # hyper_rustls::HttpsConnectorBuilder::new()
14016/// # .with_native_roots()
14017/// # .unwrap()
14018/// # .https_or_http()
14019/// # .enable_http1()
14020/// # .build()
14021/// # );
14022/// # let mut hub = Walletobjects::new(client, auth);
14023/// // As the method needs a request, you would usually fill it with the desired information
14024/// // into the respective structure. Some of the parts shown here might not be applicable !
14025/// // Values shown here are possibly random and not representative !
14026/// let mut req = FlightObject::default();
14027///
14028/// // You can configure optional parameters by calling the respective setters at will, and
14029/// // execute the final call using `doit()`.
14030/// // Values shown here are possibly random and not representative !
14031/// let result = hub.flightobject().insert(req)
14032/// .doit().await;
14033/// # }
14034/// ```
14035pub struct FlightobjectInsertCall<'a, C>
14036where
14037 C: 'a,
14038{
14039 hub: &'a Walletobjects<C>,
14040 _request: FlightObject,
14041 _delegate: Option<&'a mut dyn common::Delegate>,
14042 _additional_params: HashMap<String, String>,
14043 _scopes: BTreeSet<String>,
14044}
14045
14046impl<'a, C> common::CallBuilder for FlightobjectInsertCall<'a, C> {}
14047
14048impl<'a, C> FlightobjectInsertCall<'a, C>
14049where
14050 C: common::Connector,
14051{
14052 /// Perform the operation you have build so far.
14053 pub async fn doit(mut self) -> common::Result<(common::Response, FlightObject)> {
14054 use std::borrow::Cow;
14055 use std::io::{Read, Seek};
14056
14057 use common::{url::Params, ToParts};
14058 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14059
14060 let mut dd = common::DefaultDelegate;
14061 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14062 dlg.begin(common::MethodInfo {
14063 id: "walletobjects.flightobject.insert",
14064 http_method: hyper::Method::POST,
14065 });
14066
14067 for &field in ["alt"].iter() {
14068 if self._additional_params.contains_key(field) {
14069 dlg.finished(false);
14070 return Err(common::Error::FieldClash(field));
14071 }
14072 }
14073
14074 let mut params = Params::with_capacity(3 + self._additional_params.len());
14075
14076 params.extend(self._additional_params.iter());
14077
14078 params.push("alt", "json");
14079 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject";
14080 if self._scopes.is_empty() {
14081 self._scopes
14082 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
14083 }
14084
14085 let url = params.parse_with_url(&url);
14086
14087 let mut json_mime_type = mime::APPLICATION_JSON;
14088 let mut request_value_reader = {
14089 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14090 common::remove_json_null_values(&mut value);
14091 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14092 serde_json::to_writer(&mut dst, &value).unwrap();
14093 dst
14094 };
14095 let request_size = request_value_reader
14096 .seek(std::io::SeekFrom::End(0))
14097 .unwrap();
14098 request_value_reader
14099 .seek(std::io::SeekFrom::Start(0))
14100 .unwrap();
14101
14102 loop {
14103 let token = match self
14104 .hub
14105 .auth
14106 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14107 .await
14108 {
14109 Ok(token) => token,
14110 Err(e) => match dlg.token(e) {
14111 Ok(token) => token,
14112 Err(e) => {
14113 dlg.finished(false);
14114 return Err(common::Error::MissingToken(e));
14115 }
14116 },
14117 };
14118 request_value_reader
14119 .seek(std::io::SeekFrom::Start(0))
14120 .unwrap();
14121 let mut req_result = {
14122 let client = &self.hub.client;
14123 dlg.pre_request();
14124 let mut req_builder = hyper::Request::builder()
14125 .method(hyper::Method::POST)
14126 .uri(url.as_str())
14127 .header(USER_AGENT, self.hub._user_agent.clone());
14128
14129 if let Some(token) = token.as_ref() {
14130 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14131 }
14132
14133 let request = req_builder
14134 .header(CONTENT_TYPE, json_mime_type.to_string())
14135 .header(CONTENT_LENGTH, request_size as u64)
14136 .body(common::to_body(
14137 request_value_reader.get_ref().clone().into(),
14138 ));
14139
14140 client.request(request.unwrap()).await
14141 };
14142
14143 match req_result {
14144 Err(err) => {
14145 if let common::Retry::After(d) = dlg.http_error(&err) {
14146 sleep(d).await;
14147 continue;
14148 }
14149 dlg.finished(false);
14150 return Err(common::Error::HttpError(err));
14151 }
14152 Ok(res) => {
14153 let (mut parts, body) = res.into_parts();
14154 let mut body = common::Body::new(body);
14155 if !parts.status.is_success() {
14156 let bytes = common::to_bytes(body).await.unwrap_or_default();
14157 let error = serde_json::from_str(&common::to_string(&bytes));
14158 let response = common::to_response(parts, bytes.into());
14159
14160 if let common::Retry::After(d) =
14161 dlg.http_failure(&response, error.as_ref().ok())
14162 {
14163 sleep(d).await;
14164 continue;
14165 }
14166
14167 dlg.finished(false);
14168
14169 return Err(match error {
14170 Ok(value) => common::Error::BadRequest(value),
14171 _ => common::Error::Failure(response),
14172 });
14173 }
14174 let response = {
14175 let bytes = common::to_bytes(body).await.unwrap_or_default();
14176 let encoded = common::to_string(&bytes);
14177 match serde_json::from_str(&encoded) {
14178 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14179 Err(error) => {
14180 dlg.response_json_decode_error(&encoded, &error);
14181 return Err(common::Error::JsonDecodeError(
14182 encoded.to_string(),
14183 error,
14184 ));
14185 }
14186 }
14187 };
14188
14189 dlg.finished(true);
14190 return Ok(response);
14191 }
14192 }
14193 }
14194 }
14195
14196 ///
14197 /// Sets the *request* property to the given value.
14198 ///
14199 /// Even though the property as already been set when instantiating this call,
14200 /// we provide this method for API completeness.
14201 pub fn request(mut self, new_value: FlightObject) -> FlightobjectInsertCall<'a, C> {
14202 self._request = new_value;
14203 self
14204 }
14205 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14206 /// while executing the actual API request.
14207 ///
14208 /// ````text
14209 /// It should be used to handle progress information, and to implement a certain level of resilience.
14210 /// ````
14211 ///
14212 /// Sets the *delegate* property to the given value.
14213 pub fn delegate(
14214 mut self,
14215 new_value: &'a mut dyn common::Delegate,
14216 ) -> FlightobjectInsertCall<'a, C> {
14217 self._delegate = Some(new_value);
14218 self
14219 }
14220
14221 /// Set any additional parameter of the query string used in the request.
14222 /// It should be used to set parameters which are not yet available through their own
14223 /// setters.
14224 ///
14225 /// Please note that this method must not be used to set any of the known parameters
14226 /// which have their own setter method. If done anyway, the request will fail.
14227 ///
14228 /// # Additional Parameters
14229 ///
14230 /// * *$.xgafv* (query-string) - V1 error format.
14231 /// * *access_token* (query-string) - OAuth access token.
14232 /// * *alt* (query-string) - Data format for response.
14233 /// * *callback* (query-string) - JSONP
14234 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14235 /// * *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.
14236 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14237 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14238 /// * *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.
14239 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14240 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14241 pub fn param<T>(mut self, name: T, value: T) -> FlightobjectInsertCall<'a, C>
14242 where
14243 T: AsRef<str>,
14244 {
14245 self._additional_params
14246 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14247 self
14248 }
14249
14250 /// Identifies the authorization scope for the method you are building.
14251 ///
14252 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14253 /// [`Scope::WalletObjectIssuer`].
14254 ///
14255 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14256 /// tokens for more than one scope.
14257 ///
14258 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14259 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14260 /// sufficient, a read-write scope will do as well.
14261 pub fn add_scope<St>(mut self, scope: St) -> FlightobjectInsertCall<'a, C>
14262 where
14263 St: AsRef<str>,
14264 {
14265 self._scopes.insert(String::from(scope.as_ref()));
14266 self
14267 }
14268 /// Identifies the authorization scope(s) for the method you are building.
14269 ///
14270 /// See [`Self::add_scope()`] for details.
14271 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectInsertCall<'a, C>
14272 where
14273 I: IntoIterator<Item = St>,
14274 St: AsRef<str>,
14275 {
14276 self._scopes
14277 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14278 self
14279 }
14280
14281 /// Removes all scopes, and no default scope will be used either.
14282 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14283 /// for details).
14284 pub fn clear_scopes(mut self) -> FlightobjectInsertCall<'a, C> {
14285 self._scopes.clear();
14286 self
14287 }
14288}
14289
14290/// Returns a list of all flight objects for a given issuer ID.
14291///
14292/// A builder for the *list* method supported by a *flightobject* resource.
14293/// It is not used directly, but through a [`FlightobjectMethods`] instance.
14294///
14295/// # Example
14296///
14297/// Instantiate a resource method builder
14298///
14299/// ```test_harness,no_run
14300/// # extern crate hyper;
14301/// # extern crate hyper_rustls;
14302/// # extern crate google_walletobjects1 as walletobjects1;
14303/// # async fn dox() {
14304/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14305///
14306/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14307/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14308/// # secret,
14309/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14310/// # ).build().await.unwrap();
14311///
14312/// # let client = hyper_util::client::legacy::Client::builder(
14313/// # hyper_util::rt::TokioExecutor::new()
14314/// # )
14315/// # .build(
14316/// # hyper_rustls::HttpsConnectorBuilder::new()
14317/// # .with_native_roots()
14318/// # .unwrap()
14319/// # .https_or_http()
14320/// # .enable_http1()
14321/// # .build()
14322/// # );
14323/// # let mut hub = Walletobjects::new(client, auth);
14324/// // You can configure optional parameters by calling the respective setters at will, and
14325/// // execute the final call using `doit()`.
14326/// // Values shown here are possibly random and not representative !
14327/// let result = hub.flightobject().list()
14328/// .token("rebum.")
14329/// .max_results(-57)
14330/// .class_id("ipsum")
14331/// .doit().await;
14332/// # }
14333/// ```
14334pub struct FlightobjectListCall<'a, C>
14335where
14336 C: 'a,
14337{
14338 hub: &'a Walletobjects<C>,
14339 _token: Option<String>,
14340 _max_results: Option<i32>,
14341 _class_id: Option<String>,
14342 _delegate: Option<&'a mut dyn common::Delegate>,
14343 _additional_params: HashMap<String, String>,
14344 _scopes: BTreeSet<String>,
14345}
14346
14347impl<'a, C> common::CallBuilder for FlightobjectListCall<'a, C> {}
14348
14349impl<'a, C> FlightobjectListCall<'a, C>
14350where
14351 C: common::Connector,
14352{
14353 /// Perform the operation you have build so far.
14354 pub async fn doit(mut self) -> common::Result<(common::Response, FlightObjectListResponse)> {
14355 use std::borrow::Cow;
14356 use std::io::{Read, Seek};
14357
14358 use common::{url::Params, ToParts};
14359 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14360
14361 let mut dd = common::DefaultDelegate;
14362 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14363 dlg.begin(common::MethodInfo {
14364 id: "walletobjects.flightobject.list",
14365 http_method: hyper::Method::GET,
14366 });
14367
14368 for &field in ["alt", "token", "maxResults", "classId"].iter() {
14369 if self._additional_params.contains_key(field) {
14370 dlg.finished(false);
14371 return Err(common::Error::FieldClash(field));
14372 }
14373 }
14374
14375 let mut params = Params::with_capacity(5 + self._additional_params.len());
14376 if let Some(value) = self._token.as_ref() {
14377 params.push("token", value);
14378 }
14379 if let Some(value) = self._max_results.as_ref() {
14380 params.push("maxResults", value.to_string());
14381 }
14382 if let Some(value) = self._class_id.as_ref() {
14383 params.push("classId", value);
14384 }
14385
14386 params.extend(self._additional_params.iter());
14387
14388 params.push("alt", "json");
14389 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject";
14390 if self._scopes.is_empty() {
14391 self._scopes
14392 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
14393 }
14394
14395 let url = params.parse_with_url(&url);
14396
14397 loop {
14398 let token = match self
14399 .hub
14400 .auth
14401 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14402 .await
14403 {
14404 Ok(token) => token,
14405 Err(e) => match dlg.token(e) {
14406 Ok(token) => token,
14407 Err(e) => {
14408 dlg.finished(false);
14409 return Err(common::Error::MissingToken(e));
14410 }
14411 },
14412 };
14413 let mut req_result = {
14414 let client = &self.hub.client;
14415 dlg.pre_request();
14416 let mut req_builder = hyper::Request::builder()
14417 .method(hyper::Method::GET)
14418 .uri(url.as_str())
14419 .header(USER_AGENT, self.hub._user_agent.clone());
14420
14421 if let Some(token) = token.as_ref() {
14422 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14423 }
14424
14425 let request = req_builder
14426 .header(CONTENT_LENGTH, 0_u64)
14427 .body(common::to_body::<String>(None));
14428
14429 client.request(request.unwrap()).await
14430 };
14431
14432 match req_result {
14433 Err(err) => {
14434 if let common::Retry::After(d) = dlg.http_error(&err) {
14435 sleep(d).await;
14436 continue;
14437 }
14438 dlg.finished(false);
14439 return Err(common::Error::HttpError(err));
14440 }
14441 Ok(res) => {
14442 let (mut parts, body) = res.into_parts();
14443 let mut body = common::Body::new(body);
14444 if !parts.status.is_success() {
14445 let bytes = common::to_bytes(body).await.unwrap_or_default();
14446 let error = serde_json::from_str(&common::to_string(&bytes));
14447 let response = common::to_response(parts, bytes.into());
14448
14449 if let common::Retry::After(d) =
14450 dlg.http_failure(&response, error.as_ref().ok())
14451 {
14452 sleep(d).await;
14453 continue;
14454 }
14455
14456 dlg.finished(false);
14457
14458 return Err(match error {
14459 Ok(value) => common::Error::BadRequest(value),
14460 _ => common::Error::Failure(response),
14461 });
14462 }
14463 let response = {
14464 let bytes = common::to_bytes(body).await.unwrap_or_default();
14465 let encoded = common::to_string(&bytes);
14466 match serde_json::from_str(&encoded) {
14467 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14468 Err(error) => {
14469 dlg.response_json_decode_error(&encoded, &error);
14470 return Err(common::Error::JsonDecodeError(
14471 encoded.to_string(),
14472 error,
14473 ));
14474 }
14475 }
14476 };
14477
14478 dlg.finished(true);
14479 return Ok(response);
14480 }
14481 }
14482 }
14483 }
14484
14485 /// 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.
14486 ///
14487 /// Sets the *token* query property to the given value.
14488 pub fn token(mut self, new_value: &str) -> FlightobjectListCall<'a, C> {
14489 self._token = Some(new_value.to_string());
14490 self
14491 }
14492 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
14493 ///
14494 /// Sets the *max results* query property to the given value.
14495 pub fn max_results(mut self, new_value: i32) -> FlightobjectListCall<'a, C> {
14496 self._max_results = Some(new_value);
14497 self
14498 }
14499 /// The ID of the class whose objects will be listed.
14500 ///
14501 /// Sets the *class id* query property to the given value.
14502 pub fn class_id(mut self, new_value: &str) -> FlightobjectListCall<'a, C> {
14503 self._class_id = Some(new_value.to_string());
14504 self
14505 }
14506 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14507 /// while executing the actual API request.
14508 ///
14509 /// ````text
14510 /// It should be used to handle progress information, and to implement a certain level of resilience.
14511 /// ````
14512 ///
14513 /// Sets the *delegate* property to the given value.
14514 pub fn delegate(
14515 mut self,
14516 new_value: &'a mut dyn common::Delegate,
14517 ) -> FlightobjectListCall<'a, C> {
14518 self._delegate = Some(new_value);
14519 self
14520 }
14521
14522 /// Set any additional parameter of the query string used in the request.
14523 /// It should be used to set parameters which are not yet available through their own
14524 /// setters.
14525 ///
14526 /// Please note that this method must not be used to set any of the known parameters
14527 /// which have their own setter method. If done anyway, the request will fail.
14528 ///
14529 /// # Additional Parameters
14530 ///
14531 /// * *$.xgafv* (query-string) - V1 error format.
14532 /// * *access_token* (query-string) - OAuth access token.
14533 /// * *alt* (query-string) - Data format for response.
14534 /// * *callback* (query-string) - JSONP
14535 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14536 /// * *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.
14537 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14538 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14539 /// * *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.
14540 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14541 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14542 pub fn param<T>(mut self, name: T, value: T) -> FlightobjectListCall<'a, C>
14543 where
14544 T: AsRef<str>,
14545 {
14546 self._additional_params
14547 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14548 self
14549 }
14550
14551 /// Identifies the authorization scope for the method you are building.
14552 ///
14553 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14554 /// [`Scope::WalletObjectIssuer`].
14555 ///
14556 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14557 /// tokens for more than one scope.
14558 ///
14559 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14560 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14561 /// sufficient, a read-write scope will do as well.
14562 pub fn add_scope<St>(mut self, scope: St) -> FlightobjectListCall<'a, C>
14563 where
14564 St: AsRef<str>,
14565 {
14566 self._scopes.insert(String::from(scope.as_ref()));
14567 self
14568 }
14569 /// Identifies the authorization scope(s) for the method you are building.
14570 ///
14571 /// See [`Self::add_scope()`] for details.
14572 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectListCall<'a, C>
14573 where
14574 I: IntoIterator<Item = St>,
14575 St: AsRef<str>,
14576 {
14577 self._scopes
14578 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14579 self
14580 }
14581
14582 /// Removes all scopes, and no default scope will be used either.
14583 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14584 /// for details).
14585 pub fn clear_scopes(mut self) -> FlightobjectListCall<'a, C> {
14586 self._scopes.clear();
14587 self
14588 }
14589}
14590
14591/// Updates the flight object referenced by the given object ID. This method supports patch semantics.
14592///
14593/// A builder for the *patch* method supported by a *flightobject* resource.
14594/// It is not used directly, but through a [`FlightobjectMethods`] instance.
14595///
14596/// # Example
14597///
14598/// Instantiate a resource method builder
14599///
14600/// ```test_harness,no_run
14601/// # extern crate hyper;
14602/// # extern crate hyper_rustls;
14603/// # extern crate google_walletobjects1 as walletobjects1;
14604/// use walletobjects1::api::FlightObject;
14605/// # async fn dox() {
14606/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14607///
14608/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14609/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14610/// # secret,
14611/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14612/// # ).build().await.unwrap();
14613///
14614/// # let client = hyper_util::client::legacy::Client::builder(
14615/// # hyper_util::rt::TokioExecutor::new()
14616/// # )
14617/// # .build(
14618/// # hyper_rustls::HttpsConnectorBuilder::new()
14619/// # .with_native_roots()
14620/// # .unwrap()
14621/// # .https_or_http()
14622/// # .enable_http1()
14623/// # .build()
14624/// # );
14625/// # let mut hub = Walletobjects::new(client, auth);
14626/// // As the method needs a request, you would usually fill it with the desired information
14627/// // into the respective structure. Some of the parts shown here might not be applicable !
14628/// // Values shown here are possibly random and not representative !
14629/// let mut req = FlightObject::default();
14630///
14631/// // You can configure optional parameters by calling the respective setters at will, and
14632/// // execute the final call using `doit()`.
14633/// // Values shown here are possibly random and not representative !
14634/// let result = hub.flightobject().patch(req, "resourceId")
14635/// .doit().await;
14636/// # }
14637/// ```
14638pub struct FlightobjectPatchCall<'a, C>
14639where
14640 C: 'a,
14641{
14642 hub: &'a Walletobjects<C>,
14643 _request: FlightObject,
14644 _resource_id: String,
14645 _delegate: Option<&'a mut dyn common::Delegate>,
14646 _additional_params: HashMap<String, String>,
14647 _scopes: BTreeSet<String>,
14648}
14649
14650impl<'a, C> common::CallBuilder for FlightobjectPatchCall<'a, C> {}
14651
14652impl<'a, C> FlightobjectPatchCall<'a, C>
14653where
14654 C: common::Connector,
14655{
14656 /// Perform the operation you have build so far.
14657 pub async fn doit(mut self) -> common::Result<(common::Response, FlightObject)> {
14658 use std::borrow::Cow;
14659 use std::io::{Read, Seek};
14660
14661 use common::{url::Params, ToParts};
14662 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14663
14664 let mut dd = common::DefaultDelegate;
14665 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14666 dlg.begin(common::MethodInfo {
14667 id: "walletobjects.flightobject.patch",
14668 http_method: hyper::Method::PATCH,
14669 });
14670
14671 for &field in ["alt", "resourceId"].iter() {
14672 if self._additional_params.contains_key(field) {
14673 dlg.finished(false);
14674 return Err(common::Error::FieldClash(field));
14675 }
14676 }
14677
14678 let mut params = Params::with_capacity(4 + self._additional_params.len());
14679 params.push("resourceId", self._resource_id);
14680
14681 params.extend(self._additional_params.iter());
14682
14683 params.push("alt", "json");
14684 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject/{resourceId}";
14685 if self._scopes.is_empty() {
14686 self._scopes
14687 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
14688 }
14689
14690 #[allow(clippy::single_element_loop)]
14691 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
14692 url = params.uri_replacement(url, param_name, find_this, false);
14693 }
14694 {
14695 let to_remove = ["resourceId"];
14696 params.remove_params(&to_remove);
14697 }
14698
14699 let url = params.parse_with_url(&url);
14700
14701 let mut json_mime_type = mime::APPLICATION_JSON;
14702 let mut request_value_reader = {
14703 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14704 common::remove_json_null_values(&mut value);
14705 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14706 serde_json::to_writer(&mut dst, &value).unwrap();
14707 dst
14708 };
14709 let request_size = request_value_reader
14710 .seek(std::io::SeekFrom::End(0))
14711 .unwrap();
14712 request_value_reader
14713 .seek(std::io::SeekFrom::Start(0))
14714 .unwrap();
14715
14716 loop {
14717 let token = match self
14718 .hub
14719 .auth
14720 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14721 .await
14722 {
14723 Ok(token) => token,
14724 Err(e) => match dlg.token(e) {
14725 Ok(token) => token,
14726 Err(e) => {
14727 dlg.finished(false);
14728 return Err(common::Error::MissingToken(e));
14729 }
14730 },
14731 };
14732 request_value_reader
14733 .seek(std::io::SeekFrom::Start(0))
14734 .unwrap();
14735 let mut req_result = {
14736 let client = &self.hub.client;
14737 dlg.pre_request();
14738 let mut req_builder = hyper::Request::builder()
14739 .method(hyper::Method::PATCH)
14740 .uri(url.as_str())
14741 .header(USER_AGENT, self.hub._user_agent.clone());
14742
14743 if let Some(token) = token.as_ref() {
14744 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14745 }
14746
14747 let request = req_builder
14748 .header(CONTENT_TYPE, json_mime_type.to_string())
14749 .header(CONTENT_LENGTH, request_size as u64)
14750 .body(common::to_body(
14751 request_value_reader.get_ref().clone().into(),
14752 ));
14753
14754 client.request(request.unwrap()).await
14755 };
14756
14757 match req_result {
14758 Err(err) => {
14759 if let common::Retry::After(d) = dlg.http_error(&err) {
14760 sleep(d).await;
14761 continue;
14762 }
14763 dlg.finished(false);
14764 return Err(common::Error::HttpError(err));
14765 }
14766 Ok(res) => {
14767 let (mut parts, body) = res.into_parts();
14768 let mut body = common::Body::new(body);
14769 if !parts.status.is_success() {
14770 let bytes = common::to_bytes(body).await.unwrap_or_default();
14771 let error = serde_json::from_str(&common::to_string(&bytes));
14772 let response = common::to_response(parts, bytes.into());
14773
14774 if let common::Retry::After(d) =
14775 dlg.http_failure(&response, error.as_ref().ok())
14776 {
14777 sleep(d).await;
14778 continue;
14779 }
14780
14781 dlg.finished(false);
14782
14783 return Err(match error {
14784 Ok(value) => common::Error::BadRequest(value),
14785 _ => common::Error::Failure(response),
14786 });
14787 }
14788 let response = {
14789 let bytes = common::to_bytes(body).await.unwrap_or_default();
14790 let encoded = common::to_string(&bytes);
14791 match serde_json::from_str(&encoded) {
14792 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14793 Err(error) => {
14794 dlg.response_json_decode_error(&encoded, &error);
14795 return Err(common::Error::JsonDecodeError(
14796 encoded.to_string(),
14797 error,
14798 ));
14799 }
14800 }
14801 };
14802
14803 dlg.finished(true);
14804 return Ok(response);
14805 }
14806 }
14807 }
14808 }
14809
14810 ///
14811 /// Sets the *request* property to the given value.
14812 ///
14813 /// Even though the property as already been set when instantiating this call,
14814 /// we provide this method for API completeness.
14815 pub fn request(mut self, new_value: FlightObject) -> FlightobjectPatchCall<'a, C> {
14816 self._request = new_value;
14817 self
14818 }
14819 /// 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 '-'.
14820 ///
14821 /// Sets the *resource id* path property to the given value.
14822 ///
14823 /// Even though the property as already been set when instantiating this call,
14824 /// we provide this method for API completeness.
14825 pub fn resource_id(mut self, new_value: &str) -> FlightobjectPatchCall<'a, C> {
14826 self._resource_id = new_value.to_string();
14827 self
14828 }
14829 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14830 /// while executing the actual API request.
14831 ///
14832 /// ````text
14833 /// It should be used to handle progress information, and to implement a certain level of resilience.
14834 /// ````
14835 ///
14836 /// Sets the *delegate* property to the given value.
14837 pub fn delegate(
14838 mut self,
14839 new_value: &'a mut dyn common::Delegate,
14840 ) -> FlightobjectPatchCall<'a, C> {
14841 self._delegate = Some(new_value);
14842 self
14843 }
14844
14845 /// Set any additional parameter of the query string used in the request.
14846 /// It should be used to set parameters which are not yet available through their own
14847 /// setters.
14848 ///
14849 /// Please note that this method must not be used to set any of the known parameters
14850 /// which have their own setter method. If done anyway, the request will fail.
14851 ///
14852 /// # Additional Parameters
14853 ///
14854 /// * *$.xgafv* (query-string) - V1 error format.
14855 /// * *access_token* (query-string) - OAuth access token.
14856 /// * *alt* (query-string) - Data format for response.
14857 /// * *callback* (query-string) - JSONP
14858 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14859 /// * *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.
14860 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14861 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14862 /// * *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.
14863 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14864 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14865 pub fn param<T>(mut self, name: T, value: T) -> FlightobjectPatchCall<'a, C>
14866 where
14867 T: AsRef<str>,
14868 {
14869 self._additional_params
14870 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14871 self
14872 }
14873
14874 /// Identifies the authorization scope for the method you are building.
14875 ///
14876 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14877 /// [`Scope::WalletObjectIssuer`].
14878 ///
14879 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14880 /// tokens for more than one scope.
14881 ///
14882 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14883 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14884 /// sufficient, a read-write scope will do as well.
14885 pub fn add_scope<St>(mut self, scope: St) -> FlightobjectPatchCall<'a, C>
14886 where
14887 St: AsRef<str>,
14888 {
14889 self._scopes.insert(String::from(scope.as_ref()));
14890 self
14891 }
14892 /// Identifies the authorization scope(s) for the method you are building.
14893 ///
14894 /// See [`Self::add_scope()`] for details.
14895 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectPatchCall<'a, C>
14896 where
14897 I: IntoIterator<Item = St>,
14898 St: AsRef<str>,
14899 {
14900 self._scopes
14901 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14902 self
14903 }
14904
14905 /// Removes all scopes, and no default scope will be used either.
14906 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14907 /// for details).
14908 pub fn clear_scopes(mut self) -> FlightobjectPatchCall<'a, C> {
14909 self._scopes.clear();
14910 self
14911 }
14912}
14913
14914/// Updates the flight object referenced by the given object ID.
14915///
14916/// A builder for the *update* method supported by a *flightobject* resource.
14917/// It is not used directly, but through a [`FlightobjectMethods`] instance.
14918///
14919/// # Example
14920///
14921/// Instantiate a resource method builder
14922///
14923/// ```test_harness,no_run
14924/// # extern crate hyper;
14925/// # extern crate hyper_rustls;
14926/// # extern crate google_walletobjects1 as walletobjects1;
14927/// use walletobjects1::api::FlightObject;
14928/// # async fn dox() {
14929/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14930///
14931/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14932/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14933/// # secret,
14934/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14935/// # ).build().await.unwrap();
14936///
14937/// # let client = hyper_util::client::legacy::Client::builder(
14938/// # hyper_util::rt::TokioExecutor::new()
14939/// # )
14940/// # .build(
14941/// # hyper_rustls::HttpsConnectorBuilder::new()
14942/// # .with_native_roots()
14943/// # .unwrap()
14944/// # .https_or_http()
14945/// # .enable_http1()
14946/// # .build()
14947/// # );
14948/// # let mut hub = Walletobjects::new(client, auth);
14949/// // As the method needs a request, you would usually fill it with the desired information
14950/// // into the respective structure. Some of the parts shown here might not be applicable !
14951/// // Values shown here are possibly random and not representative !
14952/// let mut req = FlightObject::default();
14953///
14954/// // You can configure optional parameters by calling the respective setters at will, and
14955/// // execute the final call using `doit()`.
14956/// // Values shown here are possibly random and not representative !
14957/// let result = hub.flightobject().update(req, "resourceId")
14958/// .doit().await;
14959/// # }
14960/// ```
14961pub struct FlightobjectUpdateCall<'a, C>
14962where
14963 C: 'a,
14964{
14965 hub: &'a Walletobjects<C>,
14966 _request: FlightObject,
14967 _resource_id: String,
14968 _delegate: Option<&'a mut dyn common::Delegate>,
14969 _additional_params: HashMap<String, String>,
14970 _scopes: BTreeSet<String>,
14971}
14972
14973impl<'a, C> common::CallBuilder for FlightobjectUpdateCall<'a, C> {}
14974
14975impl<'a, C> FlightobjectUpdateCall<'a, C>
14976where
14977 C: common::Connector,
14978{
14979 /// Perform the operation you have build so far.
14980 pub async fn doit(mut self) -> common::Result<(common::Response, FlightObject)> {
14981 use std::borrow::Cow;
14982 use std::io::{Read, Seek};
14983
14984 use common::{url::Params, ToParts};
14985 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14986
14987 let mut dd = common::DefaultDelegate;
14988 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14989 dlg.begin(common::MethodInfo {
14990 id: "walletobjects.flightobject.update",
14991 http_method: hyper::Method::PUT,
14992 });
14993
14994 for &field in ["alt", "resourceId"].iter() {
14995 if self._additional_params.contains_key(field) {
14996 dlg.finished(false);
14997 return Err(common::Error::FieldClash(field));
14998 }
14999 }
15000
15001 let mut params = Params::with_capacity(4 + self._additional_params.len());
15002 params.push("resourceId", self._resource_id);
15003
15004 params.extend(self._additional_params.iter());
15005
15006 params.push("alt", "json");
15007 let mut url = self.hub._base_url.clone() + "walletobjects/v1/flightObject/{resourceId}";
15008 if self._scopes.is_empty() {
15009 self._scopes
15010 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
15011 }
15012
15013 #[allow(clippy::single_element_loop)]
15014 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
15015 url = params.uri_replacement(url, param_name, find_this, false);
15016 }
15017 {
15018 let to_remove = ["resourceId"];
15019 params.remove_params(&to_remove);
15020 }
15021
15022 let url = params.parse_with_url(&url);
15023
15024 let mut json_mime_type = mime::APPLICATION_JSON;
15025 let mut request_value_reader = {
15026 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15027 common::remove_json_null_values(&mut value);
15028 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15029 serde_json::to_writer(&mut dst, &value).unwrap();
15030 dst
15031 };
15032 let request_size = request_value_reader
15033 .seek(std::io::SeekFrom::End(0))
15034 .unwrap();
15035 request_value_reader
15036 .seek(std::io::SeekFrom::Start(0))
15037 .unwrap();
15038
15039 loop {
15040 let token = match self
15041 .hub
15042 .auth
15043 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15044 .await
15045 {
15046 Ok(token) => token,
15047 Err(e) => match dlg.token(e) {
15048 Ok(token) => token,
15049 Err(e) => {
15050 dlg.finished(false);
15051 return Err(common::Error::MissingToken(e));
15052 }
15053 },
15054 };
15055 request_value_reader
15056 .seek(std::io::SeekFrom::Start(0))
15057 .unwrap();
15058 let mut req_result = {
15059 let client = &self.hub.client;
15060 dlg.pre_request();
15061 let mut req_builder = hyper::Request::builder()
15062 .method(hyper::Method::PUT)
15063 .uri(url.as_str())
15064 .header(USER_AGENT, self.hub._user_agent.clone());
15065
15066 if let Some(token) = token.as_ref() {
15067 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15068 }
15069
15070 let request = req_builder
15071 .header(CONTENT_TYPE, json_mime_type.to_string())
15072 .header(CONTENT_LENGTH, request_size as u64)
15073 .body(common::to_body(
15074 request_value_reader.get_ref().clone().into(),
15075 ));
15076
15077 client.request(request.unwrap()).await
15078 };
15079
15080 match req_result {
15081 Err(err) => {
15082 if let common::Retry::After(d) = dlg.http_error(&err) {
15083 sleep(d).await;
15084 continue;
15085 }
15086 dlg.finished(false);
15087 return Err(common::Error::HttpError(err));
15088 }
15089 Ok(res) => {
15090 let (mut parts, body) = res.into_parts();
15091 let mut body = common::Body::new(body);
15092 if !parts.status.is_success() {
15093 let bytes = common::to_bytes(body).await.unwrap_or_default();
15094 let error = serde_json::from_str(&common::to_string(&bytes));
15095 let response = common::to_response(parts, bytes.into());
15096
15097 if let common::Retry::After(d) =
15098 dlg.http_failure(&response, error.as_ref().ok())
15099 {
15100 sleep(d).await;
15101 continue;
15102 }
15103
15104 dlg.finished(false);
15105
15106 return Err(match error {
15107 Ok(value) => common::Error::BadRequest(value),
15108 _ => common::Error::Failure(response),
15109 });
15110 }
15111 let response = {
15112 let bytes = common::to_bytes(body).await.unwrap_or_default();
15113 let encoded = common::to_string(&bytes);
15114 match serde_json::from_str(&encoded) {
15115 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15116 Err(error) => {
15117 dlg.response_json_decode_error(&encoded, &error);
15118 return Err(common::Error::JsonDecodeError(
15119 encoded.to_string(),
15120 error,
15121 ));
15122 }
15123 }
15124 };
15125
15126 dlg.finished(true);
15127 return Ok(response);
15128 }
15129 }
15130 }
15131 }
15132
15133 ///
15134 /// Sets the *request* property to the given value.
15135 ///
15136 /// Even though the property as already been set when instantiating this call,
15137 /// we provide this method for API completeness.
15138 pub fn request(mut self, new_value: FlightObject) -> FlightobjectUpdateCall<'a, C> {
15139 self._request = new_value;
15140 self
15141 }
15142 /// 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 '-'.
15143 ///
15144 /// Sets the *resource id* path property to the given value.
15145 ///
15146 /// Even though the property as already been set when instantiating this call,
15147 /// we provide this method for API completeness.
15148 pub fn resource_id(mut self, new_value: &str) -> FlightobjectUpdateCall<'a, C> {
15149 self._resource_id = new_value.to_string();
15150 self
15151 }
15152 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15153 /// while executing the actual API request.
15154 ///
15155 /// ````text
15156 /// It should be used to handle progress information, and to implement a certain level of resilience.
15157 /// ````
15158 ///
15159 /// Sets the *delegate* property to the given value.
15160 pub fn delegate(
15161 mut self,
15162 new_value: &'a mut dyn common::Delegate,
15163 ) -> FlightobjectUpdateCall<'a, C> {
15164 self._delegate = Some(new_value);
15165 self
15166 }
15167
15168 /// Set any additional parameter of the query string used in the request.
15169 /// It should be used to set parameters which are not yet available through their own
15170 /// setters.
15171 ///
15172 /// Please note that this method must not be used to set any of the known parameters
15173 /// which have their own setter method. If done anyway, the request will fail.
15174 ///
15175 /// # Additional Parameters
15176 ///
15177 /// * *$.xgafv* (query-string) - V1 error format.
15178 /// * *access_token* (query-string) - OAuth access token.
15179 /// * *alt* (query-string) - Data format for response.
15180 /// * *callback* (query-string) - JSONP
15181 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15182 /// * *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.
15183 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15184 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15185 /// * *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.
15186 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15187 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15188 pub fn param<T>(mut self, name: T, value: T) -> FlightobjectUpdateCall<'a, C>
15189 where
15190 T: AsRef<str>,
15191 {
15192 self._additional_params
15193 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15194 self
15195 }
15196
15197 /// Identifies the authorization scope for the method you are building.
15198 ///
15199 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15200 /// [`Scope::WalletObjectIssuer`].
15201 ///
15202 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15203 /// tokens for more than one scope.
15204 ///
15205 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15206 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15207 /// sufficient, a read-write scope will do as well.
15208 pub fn add_scope<St>(mut self, scope: St) -> FlightobjectUpdateCall<'a, C>
15209 where
15210 St: AsRef<str>,
15211 {
15212 self._scopes.insert(String::from(scope.as_ref()));
15213 self
15214 }
15215 /// Identifies the authorization scope(s) for the method you are building.
15216 ///
15217 /// See [`Self::add_scope()`] for details.
15218 pub fn add_scopes<I, St>(mut self, scopes: I) -> FlightobjectUpdateCall<'a, C>
15219 where
15220 I: IntoIterator<Item = St>,
15221 St: AsRef<str>,
15222 {
15223 self._scopes
15224 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15225 self
15226 }
15227
15228 /// Removes all scopes, and no default scope will be used either.
15229 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15230 /// for details).
15231 pub fn clear_scopes(mut self) -> FlightobjectUpdateCall<'a, C> {
15232 self._scopes.clear();
15233 self
15234 }
15235}
15236
15237/// Adds a message to the generic class referenced by the given class ID.
15238///
15239/// A builder for the *addmessage* method supported by a *genericclas* resource.
15240/// It is not used directly, but through a [`GenericclasMethods`] instance.
15241///
15242/// # Example
15243///
15244/// Instantiate a resource method builder
15245///
15246/// ```test_harness,no_run
15247/// # extern crate hyper;
15248/// # extern crate hyper_rustls;
15249/// # extern crate google_walletobjects1 as walletobjects1;
15250/// use walletobjects1::api::AddMessageRequest;
15251/// # async fn dox() {
15252/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15253///
15254/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15255/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15256/// # secret,
15257/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15258/// # ).build().await.unwrap();
15259///
15260/// # let client = hyper_util::client::legacy::Client::builder(
15261/// # hyper_util::rt::TokioExecutor::new()
15262/// # )
15263/// # .build(
15264/// # hyper_rustls::HttpsConnectorBuilder::new()
15265/// # .with_native_roots()
15266/// # .unwrap()
15267/// # .https_or_http()
15268/// # .enable_http1()
15269/// # .build()
15270/// # );
15271/// # let mut hub = Walletobjects::new(client, auth);
15272/// // As the method needs a request, you would usually fill it with the desired information
15273/// // into the respective structure. Some of the parts shown here might not be applicable !
15274/// // Values shown here are possibly random and not representative !
15275/// let mut req = AddMessageRequest::default();
15276///
15277/// // You can configure optional parameters by calling the respective setters at will, and
15278/// // execute the final call using `doit()`.
15279/// // Values shown here are possibly random and not representative !
15280/// let result = hub.genericclass().addmessage(req, "resourceId")
15281/// .doit().await;
15282/// # }
15283/// ```
15284pub struct GenericclasAddmessageCall<'a, C>
15285where
15286 C: 'a,
15287{
15288 hub: &'a Walletobjects<C>,
15289 _request: AddMessageRequest,
15290 _resource_id: String,
15291 _delegate: Option<&'a mut dyn common::Delegate>,
15292 _additional_params: HashMap<String, String>,
15293 _scopes: BTreeSet<String>,
15294}
15295
15296impl<'a, C> common::CallBuilder for GenericclasAddmessageCall<'a, C> {}
15297
15298impl<'a, C> GenericclasAddmessageCall<'a, C>
15299where
15300 C: common::Connector,
15301{
15302 /// Perform the operation you have build so far.
15303 pub async fn doit(
15304 mut self,
15305 ) -> common::Result<(common::Response, GenericClassAddMessageResponse)> {
15306 use std::borrow::Cow;
15307 use std::io::{Read, Seek};
15308
15309 use common::{url::Params, ToParts};
15310 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15311
15312 let mut dd = common::DefaultDelegate;
15313 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15314 dlg.begin(common::MethodInfo {
15315 id: "walletobjects.genericclass.addmessage",
15316 http_method: hyper::Method::POST,
15317 });
15318
15319 for &field in ["alt", "resourceId"].iter() {
15320 if self._additional_params.contains_key(field) {
15321 dlg.finished(false);
15322 return Err(common::Error::FieldClash(field));
15323 }
15324 }
15325
15326 let mut params = Params::with_capacity(4 + self._additional_params.len());
15327 params.push("resourceId", self._resource_id);
15328
15329 params.extend(self._additional_params.iter());
15330
15331 params.push("alt", "json");
15332 let mut url =
15333 self.hub._base_url.clone() + "walletobjects/v1/genericClass/{resourceId}/addMessage";
15334 if self._scopes.is_empty() {
15335 self._scopes
15336 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
15337 }
15338
15339 #[allow(clippy::single_element_loop)]
15340 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
15341 url = params.uri_replacement(url, param_name, find_this, false);
15342 }
15343 {
15344 let to_remove = ["resourceId"];
15345 params.remove_params(&to_remove);
15346 }
15347
15348 let url = params.parse_with_url(&url);
15349
15350 let mut json_mime_type = mime::APPLICATION_JSON;
15351 let mut request_value_reader = {
15352 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15353 common::remove_json_null_values(&mut value);
15354 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15355 serde_json::to_writer(&mut dst, &value).unwrap();
15356 dst
15357 };
15358 let request_size = request_value_reader
15359 .seek(std::io::SeekFrom::End(0))
15360 .unwrap();
15361 request_value_reader
15362 .seek(std::io::SeekFrom::Start(0))
15363 .unwrap();
15364
15365 loop {
15366 let token = match self
15367 .hub
15368 .auth
15369 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15370 .await
15371 {
15372 Ok(token) => token,
15373 Err(e) => match dlg.token(e) {
15374 Ok(token) => token,
15375 Err(e) => {
15376 dlg.finished(false);
15377 return Err(common::Error::MissingToken(e));
15378 }
15379 },
15380 };
15381 request_value_reader
15382 .seek(std::io::SeekFrom::Start(0))
15383 .unwrap();
15384 let mut req_result = {
15385 let client = &self.hub.client;
15386 dlg.pre_request();
15387 let mut req_builder = hyper::Request::builder()
15388 .method(hyper::Method::POST)
15389 .uri(url.as_str())
15390 .header(USER_AGENT, self.hub._user_agent.clone());
15391
15392 if let Some(token) = token.as_ref() {
15393 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15394 }
15395
15396 let request = req_builder
15397 .header(CONTENT_TYPE, json_mime_type.to_string())
15398 .header(CONTENT_LENGTH, request_size as u64)
15399 .body(common::to_body(
15400 request_value_reader.get_ref().clone().into(),
15401 ));
15402
15403 client.request(request.unwrap()).await
15404 };
15405
15406 match req_result {
15407 Err(err) => {
15408 if let common::Retry::After(d) = dlg.http_error(&err) {
15409 sleep(d).await;
15410 continue;
15411 }
15412 dlg.finished(false);
15413 return Err(common::Error::HttpError(err));
15414 }
15415 Ok(res) => {
15416 let (mut parts, body) = res.into_parts();
15417 let mut body = common::Body::new(body);
15418 if !parts.status.is_success() {
15419 let bytes = common::to_bytes(body).await.unwrap_or_default();
15420 let error = serde_json::from_str(&common::to_string(&bytes));
15421 let response = common::to_response(parts, bytes.into());
15422
15423 if let common::Retry::After(d) =
15424 dlg.http_failure(&response, error.as_ref().ok())
15425 {
15426 sleep(d).await;
15427 continue;
15428 }
15429
15430 dlg.finished(false);
15431
15432 return Err(match error {
15433 Ok(value) => common::Error::BadRequest(value),
15434 _ => common::Error::Failure(response),
15435 });
15436 }
15437 let response = {
15438 let bytes = common::to_bytes(body).await.unwrap_or_default();
15439 let encoded = common::to_string(&bytes);
15440 match serde_json::from_str(&encoded) {
15441 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15442 Err(error) => {
15443 dlg.response_json_decode_error(&encoded, &error);
15444 return Err(common::Error::JsonDecodeError(
15445 encoded.to_string(),
15446 error,
15447 ));
15448 }
15449 }
15450 };
15451
15452 dlg.finished(true);
15453 return Ok(response);
15454 }
15455 }
15456 }
15457 }
15458
15459 ///
15460 /// Sets the *request* property to the given value.
15461 ///
15462 /// Even though the property as already been set when instantiating this call,
15463 /// we provide this method for API completeness.
15464 pub fn request(mut self, new_value: AddMessageRequest) -> GenericclasAddmessageCall<'a, C> {
15465 self._request = new_value;
15466 self
15467 }
15468 /// 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 '-'.
15469 ///
15470 /// Sets the *resource id* path property to the given value.
15471 ///
15472 /// Even though the property as already been set when instantiating this call,
15473 /// we provide this method for API completeness.
15474 pub fn resource_id(mut self, new_value: &str) -> GenericclasAddmessageCall<'a, C> {
15475 self._resource_id = new_value.to_string();
15476 self
15477 }
15478 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15479 /// while executing the actual API request.
15480 ///
15481 /// ````text
15482 /// It should be used to handle progress information, and to implement a certain level of resilience.
15483 /// ````
15484 ///
15485 /// Sets the *delegate* property to the given value.
15486 pub fn delegate(
15487 mut self,
15488 new_value: &'a mut dyn common::Delegate,
15489 ) -> GenericclasAddmessageCall<'a, C> {
15490 self._delegate = Some(new_value);
15491 self
15492 }
15493
15494 /// Set any additional parameter of the query string used in the request.
15495 /// It should be used to set parameters which are not yet available through their own
15496 /// setters.
15497 ///
15498 /// Please note that this method must not be used to set any of the known parameters
15499 /// which have their own setter method. If done anyway, the request will fail.
15500 ///
15501 /// # Additional Parameters
15502 ///
15503 /// * *$.xgafv* (query-string) - V1 error format.
15504 /// * *access_token* (query-string) - OAuth access token.
15505 /// * *alt* (query-string) - Data format for response.
15506 /// * *callback* (query-string) - JSONP
15507 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15508 /// * *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.
15509 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15510 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15511 /// * *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.
15512 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15513 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15514 pub fn param<T>(mut self, name: T, value: T) -> GenericclasAddmessageCall<'a, C>
15515 where
15516 T: AsRef<str>,
15517 {
15518 self._additional_params
15519 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15520 self
15521 }
15522
15523 /// Identifies the authorization scope for the method you are building.
15524 ///
15525 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15526 /// [`Scope::WalletObjectIssuer`].
15527 ///
15528 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15529 /// tokens for more than one scope.
15530 ///
15531 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15532 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15533 /// sufficient, a read-write scope will do as well.
15534 pub fn add_scope<St>(mut self, scope: St) -> GenericclasAddmessageCall<'a, C>
15535 where
15536 St: AsRef<str>,
15537 {
15538 self._scopes.insert(String::from(scope.as_ref()));
15539 self
15540 }
15541 /// Identifies the authorization scope(s) for the method you are building.
15542 ///
15543 /// See [`Self::add_scope()`] for details.
15544 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasAddmessageCall<'a, C>
15545 where
15546 I: IntoIterator<Item = St>,
15547 St: AsRef<str>,
15548 {
15549 self._scopes
15550 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15551 self
15552 }
15553
15554 /// Removes all scopes, and no default scope will be used either.
15555 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15556 /// for details).
15557 pub fn clear_scopes(mut self) -> GenericclasAddmessageCall<'a, C> {
15558 self._scopes.clear();
15559 self
15560 }
15561}
15562
15563/// Returns the generic class with the given class ID.
15564///
15565/// A builder for the *get* method supported by a *genericclas* resource.
15566/// It is not used directly, but through a [`GenericclasMethods`] instance.
15567///
15568/// # Example
15569///
15570/// Instantiate a resource method builder
15571///
15572/// ```test_harness,no_run
15573/// # extern crate hyper;
15574/// # extern crate hyper_rustls;
15575/// # extern crate google_walletobjects1 as walletobjects1;
15576/// # async fn dox() {
15577/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15578///
15579/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15580/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15581/// # secret,
15582/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15583/// # ).build().await.unwrap();
15584///
15585/// # let client = hyper_util::client::legacy::Client::builder(
15586/// # hyper_util::rt::TokioExecutor::new()
15587/// # )
15588/// # .build(
15589/// # hyper_rustls::HttpsConnectorBuilder::new()
15590/// # .with_native_roots()
15591/// # .unwrap()
15592/// # .https_or_http()
15593/// # .enable_http1()
15594/// # .build()
15595/// # );
15596/// # let mut hub = Walletobjects::new(client, auth);
15597/// // You can configure optional parameters by calling the respective setters at will, and
15598/// // execute the final call using `doit()`.
15599/// // Values shown here are possibly random and not representative !
15600/// let result = hub.genericclass().get("resourceId")
15601/// .doit().await;
15602/// # }
15603/// ```
15604pub struct GenericclasGetCall<'a, C>
15605where
15606 C: 'a,
15607{
15608 hub: &'a Walletobjects<C>,
15609 _resource_id: String,
15610 _delegate: Option<&'a mut dyn common::Delegate>,
15611 _additional_params: HashMap<String, String>,
15612 _scopes: BTreeSet<String>,
15613}
15614
15615impl<'a, C> common::CallBuilder for GenericclasGetCall<'a, C> {}
15616
15617impl<'a, C> GenericclasGetCall<'a, C>
15618where
15619 C: common::Connector,
15620{
15621 /// Perform the operation you have build so far.
15622 pub async fn doit(mut self) -> common::Result<(common::Response, GenericClass)> {
15623 use std::borrow::Cow;
15624 use std::io::{Read, Seek};
15625
15626 use common::{url::Params, ToParts};
15627 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15628
15629 let mut dd = common::DefaultDelegate;
15630 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15631 dlg.begin(common::MethodInfo {
15632 id: "walletobjects.genericclass.get",
15633 http_method: hyper::Method::GET,
15634 });
15635
15636 for &field in ["alt", "resourceId"].iter() {
15637 if self._additional_params.contains_key(field) {
15638 dlg.finished(false);
15639 return Err(common::Error::FieldClash(field));
15640 }
15641 }
15642
15643 let mut params = Params::with_capacity(3 + self._additional_params.len());
15644 params.push("resourceId", self._resource_id);
15645
15646 params.extend(self._additional_params.iter());
15647
15648 params.push("alt", "json");
15649 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass/{resourceId}";
15650 if self._scopes.is_empty() {
15651 self._scopes
15652 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
15653 }
15654
15655 #[allow(clippy::single_element_loop)]
15656 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
15657 url = params.uri_replacement(url, param_name, find_this, false);
15658 }
15659 {
15660 let to_remove = ["resourceId"];
15661 params.remove_params(&to_remove);
15662 }
15663
15664 let url = params.parse_with_url(&url);
15665
15666 loop {
15667 let token = match self
15668 .hub
15669 .auth
15670 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15671 .await
15672 {
15673 Ok(token) => token,
15674 Err(e) => match dlg.token(e) {
15675 Ok(token) => token,
15676 Err(e) => {
15677 dlg.finished(false);
15678 return Err(common::Error::MissingToken(e));
15679 }
15680 },
15681 };
15682 let mut req_result = {
15683 let client = &self.hub.client;
15684 dlg.pre_request();
15685 let mut req_builder = hyper::Request::builder()
15686 .method(hyper::Method::GET)
15687 .uri(url.as_str())
15688 .header(USER_AGENT, self.hub._user_agent.clone());
15689
15690 if let Some(token) = token.as_ref() {
15691 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15692 }
15693
15694 let request = req_builder
15695 .header(CONTENT_LENGTH, 0_u64)
15696 .body(common::to_body::<String>(None));
15697
15698 client.request(request.unwrap()).await
15699 };
15700
15701 match req_result {
15702 Err(err) => {
15703 if let common::Retry::After(d) = dlg.http_error(&err) {
15704 sleep(d).await;
15705 continue;
15706 }
15707 dlg.finished(false);
15708 return Err(common::Error::HttpError(err));
15709 }
15710 Ok(res) => {
15711 let (mut parts, body) = res.into_parts();
15712 let mut body = common::Body::new(body);
15713 if !parts.status.is_success() {
15714 let bytes = common::to_bytes(body).await.unwrap_or_default();
15715 let error = serde_json::from_str(&common::to_string(&bytes));
15716 let response = common::to_response(parts, bytes.into());
15717
15718 if let common::Retry::After(d) =
15719 dlg.http_failure(&response, error.as_ref().ok())
15720 {
15721 sleep(d).await;
15722 continue;
15723 }
15724
15725 dlg.finished(false);
15726
15727 return Err(match error {
15728 Ok(value) => common::Error::BadRequest(value),
15729 _ => common::Error::Failure(response),
15730 });
15731 }
15732 let response = {
15733 let bytes = common::to_bytes(body).await.unwrap_or_default();
15734 let encoded = common::to_string(&bytes);
15735 match serde_json::from_str(&encoded) {
15736 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15737 Err(error) => {
15738 dlg.response_json_decode_error(&encoded, &error);
15739 return Err(common::Error::JsonDecodeError(
15740 encoded.to_string(),
15741 error,
15742 ));
15743 }
15744 }
15745 };
15746
15747 dlg.finished(true);
15748 return Ok(response);
15749 }
15750 }
15751 }
15752 }
15753
15754 /// 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 `-`.
15755 ///
15756 /// Sets the *resource id* path property to the given value.
15757 ///
15758 /// Even though the property as already been set when instantiating this call,
15759 /// we provide this method for API completeness.
15760 pub fn resource_id(mut self, new_value: &str) -> GenericclasGetCall<'a, C> {
15761 self._resource_id = new_value.to_string();
15762 self
15763 }
15764 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15765 /// while executing the actual API request.
15766 ///
15767 /// ````text
15768 /// It should be used to handle progress information, and to implement a certain level of resilience.
15769 /// ````
15770 ///
15771 /// Sets the *delegate* property to the given value.
15772 pub fn delegate(
15773 mut self,
15774 new_value: &'a mut dyn common::Delegate,
15775 ) -> GenericclasGetCall<'a, C> {
15776 self._delegate = Some(new_value);
15777 self
15778 }
15779
15780 /// Set any additional parameter of the query string used in the request.
15781 /// It should be used to set parameters which are not yet available through their own
15782 /// setters.
15783 ///
15784 /// Please note that this method must not be used to set any of the known parameters
15785 /// which have their own setter method. If done anyway, the request will fail.
15786 ///
15787 /// # Additional Parameters
15788 ///
15789 /// * *$.xgafv* (query-string) - V1 error format.
15790 /// * *access_token* (query-string) - OAuth access token.
15791 /// * *alt* (query-string) - Data format for response.
15792 /// * *callback* (query-string) - JSONP
15793 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15794 /// * *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.
15795 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15796 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15797 /// * *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.
15798 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15799 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15800 pub fn param<T>(mut self, name: T, value: T) -> GenericclasGetCall<'a, C>
15801 where
15802 T: AsRef<str>,
15803 {
15804 self._additional_params
15805 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15806 self
15807 }
15808
15809 /// Identifies the authorization scope for the method you are building.
15810 ///
15811 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15812 /// [`Scope::WalletObjectIssuer`].
15813 ///
15814 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15815 /// tokens for more than one scope.
15816 ///
15817 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15818 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15819 /// sufficient, a read-write scope will do as well.
15820 pub fn add_scope<St>(mut self, scope: St) -> GenericclasGetCall<'a, C>
15821 where
15822 St: AsRef<str>,
15823 {
15824 self._scopes.insert(String::from(scope.as_ref()));
15825 self
15826 }
15827 /// Identifies the authorization scope(s) for the method you are building.
15828 ///
15829 /// See [`Self::add_scope()`] for details.
15830 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasGetCall<'a, C>
15831 where
15832 I: IntoIterator<Item = St>,
15833 St: AsRef<str>,
15834 {
15835 self._scopes
15836 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15837 self
15838 }
15839
15840 /// Removes all scopes, and no default scope will be used either.
15841 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15842 /// for details).
15843 pub fn clear_scopes(mut self) -> GenericclasGetCall<'a, C> {
15844 self._scopes.clear();
15845 self
15846 }
15847}
15848
15849/// Inserts a generic class with the given ID and properties.
15850///
15851/// A builder for the *insert* method supported by a *genericclas* resource.
15852/// It is not used directly, but through a [`GenericclasMethods`] instance.
15853///
15854/// # Example
15855///
15856/// Instantiate a resource method builder
15857///
15858/// ```test_harness,no_run
15859/// # extern crate hyper;
15860/// # extern crate hyper_rustls;
15861/// # extern crate google_walletobjects1 as walletobjects1;
15862/// use walletobjects1::api::GenericClass;
15863/// # async fn dox() {
15864/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15865///
15866/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15867/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15868/// # secret,
15869/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15870/// # ).build().await.unwrap();
15871///
15872/// # let client = hyper_util::client::legacy::Client::builder(
15873/// # hyper_util::rt::TokioExecutor::new()
15874/// # )
15875/// # .build(
15876/// # hyper_rustls::HttpsConnectorBuilder::new()
15877/// # .with_native_roots()
15878/// # .unwrap()
15879/// # .https_or_http()
15880/// # .enable_http1()
15881/// # .build()
15882/// # );
15883/// # let mut hub = Walletobjects::new(client, auth);
15884/// // As the method needs a request, you would usually fill it with the desired information
15885/// // into the respective structure. Some of the parts shown here might not be applicable !
15886/// // Values shown here are possibly random and not representative !
15887/// let mut req = GenericClass::default();
15888///
15889/// // You can configure optional parameters by calling the respective setters at will, and
15890/// // execute the final call using `doit()`.
15891/// // Values shown here are possibly random and not representative !
15892/// let result = hub.genericclass().insert(req)
15893/// .doit().await;
15894/// # }
15895/// ```
15896pub struct GenericclasInsertCall<'a, C>
15897where
15898 C: 'a,
15899{
15900 hub: &'a Walletobjects<C>,
15901 _request: GenericClass,
15902 _delegate: Option<&'a mut dyn common::Delegate>,
15903 _additional_params: HashMap<String, String>,
15904 _scopes: BTreeSet<String>,
15905}
15906
15907impl<'a, C> common::CallBuilder for GenericclasInsertCall<'a, C> {}
15908
15909impl<'a, C> GenericclasInsertCall<'a, C>
15910where
15911 C: common::Connector,
15912{
15913 /// Perform the operation you have build so far.
15914 pub async fn doit(mut self) -> common::Result<(common::Response, GenericClass)> {
15915 use std::borrow::Cow;
15916 use std::io::{Read, Seek};
15917
15918 use common::{url::Params, ToParts};
15919 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15920
15921 let mut dd = common::DefaultDelegate;
15922 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15923 dlg.begin(common::MethodInfo {
15924 id: "walletobjects.genericclass.insert",
15925 http_method: hyper::Method::POST,
15926 });
15927
15928 for &field in ["alt"].iter() {
15929 if self._additional_params.contains_key(field) {
15930 dlg.finished(false);
15931 return Err(common::Error::FieldClash(field));
15932 }
15933 }
15934
15935 let mut params = Params::with_capacity(3 + self._additional_params.len());
15936
15937 params.extend(self._additional_params.iter());
15938
15939 params.push("alt", "json");
15940 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass";
15941 if self._scopes.is_empty() {
15942 self._scopes
15943 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
15944 }
15945
15946 let url = params.parse_with_url(&url);
15947
15948 let mut json_mime_type = mime::APPLICATION_JSON;
15949 let mut request_value_reader = {
15950 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15951 common::remove_json_null_values(&mut value);
15952 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15953 serde_json::to_writer(&mut dst, &value).unwrap();
15954 dst
15955 };
15956 let request_size = request_value_reader
15957 .seek(std::io::SeekFrom::End(0))
15958 .unwrap();
15959 request_value_reader
15960 .seek(std::io::SeekFrom::Start(0))
15961 .unwrap();
15962
15963 loop {
15964 let token = match self
15965 .hub
15966 .auth
15967 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15968 .await
15969 {
15970 Ok(token) => token,
15971 Err(e) => match dlg.token(e) {
15972 Ok(token) => token,
15973 Err(e) => {
15974 dlg.finished(false);
15975 return Err(common::Error::MissingToken(e));
15976 }
15977 },
15978 };
15979 request_value_reader
15980 .seek(std::io::SeekFrom::Start(0))
15981 .unwrap();
15982 let mut req_result = {
15983 let client = &self.hub.client;
15984 dlg.pre_request();
15985 let mut req_builder = hyper::Request::builder()
15986 .method(hyper::Method::POST)
15987 .uri(url.as_str())
15988 .header(USER_AGENT, self.hub._user_agent.clone());
15989
15990 if let Some(token) = token.as_ref() {
15991 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15992 }
15993
15994 let request = req_builder
15995 .header(CONTENT_TYPE, json_mime_type.to_string())
15996 .header(CONTENT_LENGTH, request_size as u64)
15997 .body(common::to_body(
15998 request_value_reader.get_ref().clone().into(),
15999 ));
16000
16001 client.request(request.unwrap()).await
16002 };
16003
16004 match req_result {
16005 Err(err) => {
16006 if let common::Retry::After(d) = dlg.http_error(&err) {
16007 sleep(d).await;
16008 continue;
16009 }
16010 dlg.finished(false);
16011 return Err(common::Error::HttpError(err));
16012 }
16013 Ok(res) => {
16014 let (mut parts, body) = res.into_parts();
16015 let mut body = common::Body::new(body);
16016 if !parts.status.is_success() {
16017 let bytes = common::to_bytes(body).await.unwrap_or_default();
16018 let error = serde_json::from_str(&common::to_string(&bytes));
16019 let response = common::to_response(parts, bytes.into());
16020
16021 if let common::Retry::After(d) =
16022 dlg.http_failure(&response, error.as_ref().ok())
16023 {
16024 sleep(d).await;
16025 continue;
16026 }
16027
16028 dlg.finished(false);
16029
16030 return Err(match error {
16031 Ok(value) => common::Error::BadRequest(value),
16032 _ => common::Error::Failure(response),
16033 });
16034 }
16035 let response = {
16036 let bytes = common::to_bytes(body).await.unwrap_or_default();
16037 let encoded = common::to_string(&bytes);
16038 match serde_json::from_str(&encoded) {
16039 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16040 Err(error) => {
16041 dlg.response_json_decode_error(&encoded, &error);
16042 return Err(common::Error::JsonDecodeError(
16043 encoded.to_string(),
16044 error,
16045 ));
16046 }
16047 }
16048 };
16049
16050 dlg.finished(true);
16051 return Ok(response);
16052 }
16053 }
16054 }
16055 }
16056
16057 ///
16058 /// Sets the *request* property to the given value.
16059 ///
16060 /// Even though the property as already been set when instantiating this call,
16061 /// we provide this method for API completeness.
16062 pub fn request(mut self, new_value: GenericClass) -> GenericclasInsertCall<'a, C> {
16063 self._request = new_value;
16064 self
16065 }
16066 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16067 /// while executing the actual API request.
16068 ///
16069 /// ````text
16070 /// It should be used to handle progress information, and to implement a certain level of resilience.
16071 /// ````
16072 ///
16073 /// Sets the *delegate* property to the given value.
16074 pub fn delegate(
16075 mut self,
16076 new_value: &'a mut dyn common::Delegate,
16077 ) -> GenericclasInsertCall<'a, C> {
16078 self._delegate = Some(new_value);
16079 self
16080 }
16081
16082 /// Set any additional parameter of the query string used in the request.
16083 /// It should be used to set parameters which are not yet available through their own
16084 /// setters.
16085 ///
16086 /// Please note that this method must not be used to set any of the known parameters
16087 /// which have their own setter method. If done anyway, the request will fail.
16088 ///
16089 /// # Additional Parameters
16090 ///
16091 /// * *$.xgafv* (query-string) - V1 error format.
16092 /// * *access_token* (query-string) - OAuth access token.
16093 /// * *alt* (query-string) - Data format for response.
16094 /// * *callback* (query-string) - JSONP
16095 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16096 /// * *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.
16097 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16098 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16099 /// * *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.
16100 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16101 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16102 pub fn param<T>(mut self, name: T, value: T) -> GenericclasInsertCall<'a, C>
16103 where
16104 T: AsRef<str>,
16105 {
16106 self._additional_params
16107 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16108 self
16109 }
16110
16111 /// Identifies the authorization scope for the method you are building.
16112 ///
16113 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16114 /// [`Scope::WalletObjectIssuer`].
16115 ///
16116 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16117 /// tokens for more than one scope.
16118 ///
16119 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16120 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16121 /// sufficient, a read-write scope will do as well.
16122 pub fn add_scope<St>(mut self, scope: St) -> GenericclasInsertCall<'a, C>
16123 where
16124 St: AsRef<str>,
16125 {
16126 self._scopes.insert(String::from(scope.as_ref()));
16127 self
16128 }
16129 /// Identifies the authorization scope(s) for the method you are building.
16130 ///
16131 /// See [`Self::add_scope()`] for details.
16132 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasInsertCall<'a, C>
16133 where
16134 I: IntoIterator<Item = St>,
16135 St: AsRef<str>,
16136 {
16137 self._scopes
16138 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16139 self
16140 }
16141
16142 /// Removes all scopes, and no default scope will be used either.
16143 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16144 /// for details).
16145 pub fn clear_scopes(mut self) -> GenericclasInsertCall<'a, C> {
16146 self._scopes.clear();
16147 self
16148 }
16149}
16150
16151/// Returns a list of all generic classes for a given issuer ID.
16152///
16153/// A builder for the *list* method supported by a *genericclas* resource.
16154/// It is not used directly, but through a [`GenericclasMethods`] instance.
16155///
16156/// # Example
16157///
16158/// Instantiate a resource method builder
16159///
16160/// ```test_harness,no_run
16161/// # extern crate hyper;
16162/// # extern crate hyper_rustls;
16163/// # extern crate google_walletobjects1 as walletobjects1;
16164/// # async fn dox() {
16165/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16166///
16167/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16168/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16169/// # secret,
16170/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16171/// # ).build().await.unwrap();
16172///
16173/// # let client = hyper_util::client::legacy::Client::builder(
16174/// # hyper_util::rt::TokioExecutor::new()
16175/// # )
16176/// # .build(
16177/// # hyper_rustls::HttpsConnectorBuilder::new()
16178/// # .with_native_roots()
16179/// # .unwrap()
16180/// # .https_or_http()
16181/// # .enable_http1()
16182/// # .build()
16183/// # );
16184/// # let mut hub = Walletobjects::new(client, auth);
16185/// // You can configure optional parameters by calling the respective setters at will, and
16186/// // execute the final call using `doit()`.
16187/// // Values shown here are possibly random and not representative !
16188/// let result = hub.genericclass().list()
16189/// .token("dolor")
16190/// .max_results(-56)
16191/// .issuer_id(-25)
16192/// .doit().await;
16193/// # }
16194/// ```
16195pub struct GenericclasListCall<'a, C>
16196where
16197 C: 'a,
16198{
16199 hub: &'a Walletobjects<C>,
16200 _token: Option<String>,
16201 _max_results: Option<i32>,
16202 _issuer_id: Option<i64>,
16203 _delegate: Option<&'a mut dyn common::Delegate>,
16204 _additional_params: HashMap<String, String>,
16205 _scopes: BTreeSet<String>,
16206}
16207
16208impl<'a, C> common::CallBuilder for GenericclasListCall<'a, C> {}
16209
16210impl<'a, C> GenericclasListCall<'a, C>
16211where
16212 C: common::Connector,
16213{
16214 /// Perform the operation you have build so far.
16215 pub async fn doit(mut self) -> common::Result<(common::Response, GenericClassListResponse)> {
16216 use std::borrow::Cow;
16217 use std::io::{Read, Seek};
16218
16219 use common::{url::Params, ToParts};
16220 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16221
16222 let mut dd = common::DefaultDelegate;
16223 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16224 dlg.begin(common::MethodInfo {
16225 id: "walletobjects.genericclass.list",
16226 http_method: hyper::Method::GET,
16227 });
16228
16229 for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
16230 if self._additional_params.contains_key(field) {
16231 dlg.finished(false);
16232 return Err(common::Error::FieldClash(field));
16233 }
16234 }
16235
16236 let mut params = Params::with_capacity(5 + self._additional_params.len());
16237 if let Some(value) = self._token.as_ref() {
16238 params.push("token", value);
16239 }
16240 if let Some(value) = self._max_results.as_ref() {
16241 params.push("maxResults", value.to_string());
16242 }
16243 if let Some(value) = self._issuer_id.as_ref() {
16244 params.push("issuerId", value.to_string());
16245 }
16246
16247 params.extend(self._additional_params.iter());
16248
16249 params.push("alt", "json");
16250 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass";
16251 if self._scopes.is_empty() {
16252 self._scopes
16253 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
16254 }
16255
16256 let url = params.parse_with_url(&url);
16257
16258 loop {
16259 let token = match self
16260 .hub
16261 .auth
16262 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16263 .await
16264 {
16265 Ok(token) => token,
16266 Err(e) => match dlg.token(e) {
16267 Ok(token) => token,
16268 Err(e) => {
16269 dlg.finished(false);
16270 return Err(common::Error::MissingToken(e));
16271 }
16272 },
16273 };
16274 let mut req_result = {
16275 let client = &self.hub.client;
16276 dlg.pre_request();
16277 let mut req_builder = hyper::Request::builder()
16278 .method(hyper::Method::GET)
16279 .uri(url.as_str())
16280 .header(USER_AGENT, self.hub._user_agent.clone());
16281
16282 if let Some(token) = token.as_ref() {
16283 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16284 }
16285
16286 let request = req_builder
16287 .header(CONTENT_LENGTH, 0_u64)
16288 .body(common::to_body::<String>(None));
16289
16290 client.request(request.unwrap()).await
16291 };
16292
16293 match req_result {
16294 Err(err) => {
16295 if let common::Retry::After(d) = dlg.http_error(&err) {
16296 sleep(d).await;
16297 continue;
16298 }
16299 dlg.finished(false);
16300 return Err(common::Error::HttpError(err));
16301 }
16302 Ok(res) => {
16303 let (mut parts, body) = res.into_parts();
16304 let mut body = common::Body::new(body);
16305 if !parts.status.is_success() {
16306 let bytes = common::to_bytes(body).await.unwrap_or_default();
16307 let error = serde_json::from_str(&common::to_string(&bytes));
16308 let response = common::to_response(parts, bytes.into());
16309
16310 if let common::Retry::After(d) =
16311 dlg.http_failure(&response, error.as_ref().ok())
16312 {
16313 sleep(d).await;
16314 continue;
16315 }
16316
16317 dlg.finished(false);
16318
16319 return Err(match error {
16320 Ok(value) => common::Error::BadRequest(value),
16321 _ => common::Error::Failure(response),
16322 });
16323 }
16324 let response = {
16325 let bytes = common::to_bytes(body).await.unwrap_or_default();
16326 let encoded = common::to_string(&bytes);
16327 match serde_json::from_str(&encoded) {
16328 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16329 Err(error) => {
16330 dlg.response_json_decode_error(&encoded, &error);
16331 return Err(common::Error::JsonDecodeError(
16332 encoded.to_string(),
16333 error,
16334 ));
16335 }
16336 }
16337 };
16338
16339 dlg.finished(true);
16340 return Ok(response);
16341 }
16342 }
16343 }
16344 }
16345
16346 /// 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.
16347 ///
16348 /// Sets the *token* query property to the given value.
16349 pub fn token(mut self, new_value: &str) -> GenericclasListCall<'a, C> {
16350 self._token = Some(new_value.to_string());
16351 self
16352 }
16353 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
16354 ///
16355 /// Sets the *max results* query property to the given value.
16356 pub fn max_results(mut self, new_value: i32) -> GenericclasListCall<'a, C> {
16357 self._max_results = Some(new_value);
16358 self
16359 }
16360 /// The ID of the issuer authorized to list classes.
16361 ///
16362 /// Sets the *issuer id* query property to the given value.
16363 pub fn issuer_id(mut self, new_value: i64) -> GenericclasListCall<'a, C> {
16364 self._issuer_id = Some(new_value);
16365 self
16366 }
16367 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16368 /// while executing the actual API request.
16369 ///
16370 /// ````text
16371 /// It should be used to handle progress information, and to implement a certain level of resilience.
16372 /// ````
16373 ///
16374 /// Sets the *delegate* property to the given value.
16375 pub fn delegate(
16376 mut self,
16377 new_value: &'a mut dyn common::Delegate,
16378 ) -> GenericclasListCall<'a, C> {
16379 self._delegate = Some(new_value);
16380 self
16381 }
16382
16383 /// Set any additional parameter of the query string used in the request.
16384 /// It should be used to set parameters which are not yet available through their own
16385 /// setters.
16386 ///
16387 /// Please note that this method must not be used to set any of the known parameters
16388 /// which have their own setter method. If done anyway, the request will fail.
16389 ///
16390 /// # Additional Parameters
16391 ///
16392 /// * *$.xgafv* (query-string) - V1 error format.
16393 /// * *access_token* (query-string) - OAuth access token.
16394 /// * *alt* (query-string) - Data format for response.
16395 /// * *callback* (query-string) - JSONP
16396 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16397 /// * *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.
16398 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16399 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16400 /// * *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.
16401 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16402 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16403 pub fn param<T>(mut self, name: T, value: T) -> GenericclasListCall<'a, C>
16404 where
16405 T: AsRef<str>,
16406 {
16407 self._additional_params
16408 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16409 self
16410 }
16411
16412 /// Identifies the authorization scope for the method you are building.
16413 ///
16414 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16415 /// [`Scope::WalletObjectIssuer`].
16416 ///
16417 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16418 /// tokens for more than one scope.
16419 ///
16420 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16421 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16422 /// sufficient, a read-write scope will do as well.
16423 pub fn add_scope<St>(mut self, scope: St) -> GenericclasListCall<'a, C>
16424 where
16425 St: AsRef<str>,
16426 {
16427 self._scopes.insert(String::from(scope.as_ref()));
16428 self
16429 }
16430 /// Identifies the authorization scope(s) for the method you are building.
16431 ///
16432 /// See [`Self::add_scope()`] for details.
16433 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasListCall<'a, C>
16434 where
16435 I: IntoIterator<Item = St>,
16436 St: AsRef<str>,
16437 {
16438 self._scopes
16439 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16440 self
16441 }
16442
16443 /// Removes all scopes, and no default scope will be used either.
16444 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16445 /// for details).
16446 pub fn clear_scopes(mut self) -> GenericclasListCall<'a, C> {
16447 self._scopes.clear();
16448 self
16449 }
16450}
16451
16452/// Updates the generic class referenced by the given class ID. This method supports patch semantics.
16453///
16454/// A builder for the *patch* method supported by a *genericclas* resource.
16455/// It is not used directly, but through a [`GenericclasMethods`] instance.
16456///
16457/// # Example
16458///
16459/// Instantiate a resource method builder
16460///
16461/// ```test_harness,no_run
16462/// # extern crate hyper;
16463/// # extern crate hyper_rustls;
16464/// # extern crate google_walletobjects1 as walletobjects1;
16465/// use walletobjects1::api::GenericClass;
16466/// # async fn dox() {
16467/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16468///
16469/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16470/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16471/// # secret,
16472/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16473/// # ).build().await.unwrap();
16474///
16475/// # let client = hyper_util::client::legacy::Client::builder(
16476/// # hyper_util::rt::TokioExecutor::new()
16477/// # )
16478/// # .build(
16479/// # hyper_rustls::HttpsConnectorBuilder::new()
16480/// # .with_native_roots()
16481/// # .unwrap()
16482/// # .https_or_http()
16483/// # .enable_http1()
16484/// # .build()
16485/// # );
16486/// # let mut hub = Walletobjects::new(client, auth);
16487/// // As the method needs a request, you would usually fill it with the desired information
16488/// // into the respective structure. Some of the parts shown here might not be applicable !
16489/// // Values shown here are possibly random and not representative !
16490/// let mut req = GenericClass::default();
16491///
16492/// // You can configure optional parameters by calling the respective setters at will, and
16493/// // execute the final call using `doit()`.
16494/// // Values shown here are possibly random and not representative !
16495/// let result = hub.genericclass().patch(req, "resourceId")
16496/// .doit().await;
16497/// # }
16498/// ```
16499pub struct GenericclasPatchCall<'a, C>
16500where
16501 C: 'a,
16502{
16503 hub: &'a Walletobjects<C>,
16504 _request: GenericClass,
16505 _resource_id: String,
16506 _delegate: Option<&'a mut dyn common::Delegate>,
16507 _additional_params: HashMap<String, String>,
16508 _scopes: BTreeSet<String>,
16509}
16510
16511impl<'a, C> common::CallBuilder for GenericclasPatchCall<'a, C> {}
16512
16513impl<'a, C> GenericclasPatchCall<'a, C>
16514where
16515 C: common::Connector,
16516{
16517 /// Perform the operation you have build so far.
16518 pub async fn doit(mut self) -> common::Result<(common::Response, GenericClass)> {
16519 use std::borrow::Cow;
16520 use std::io::{Read, Seek};
16521
16522 use common::{url::Params, ToParts};
16523 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16524
16525 let mut dd = common::DefaultDelegate;
16526 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16527 dlg.begin(common::MethodInfo {
16528 id: "walletobjects.genericclass.patch",
16529 http_method: hyper::Method::PATCH,
16530 });
16531
16532 for &field in ["alt", "resourceId"].iter() {
16533 if self._additional_params.contains_key(field) {
16534 dlg.finished(false);
16535 return Err(common::Error::FieldClash(field));
16536 }
16537 }
16538
16539 let mut params = Params::with_capacity(4 + self._additional_params.len());
16540 params.push("resourceId", self._resource_id);
16541
16542 params.extend(self._additional_params.iter());
16543
16544 params.push("alt", "json");
16545 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass/{resourceId}";
16546 if self._scopes.is_empty() {
16547 self._scopes
16548 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
16549 }
16550
16551 #[allow(clippy::single_element_loop)]
16552 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
16553 url = params.uri_replacement(url, param_name, find_this, false);
16554 }
16555 {
16556 let to_remove = ["resourceId"];
16557 params.remove_params(&to_remove);
16558 }
16559
16560 let url = params.parse_with_url(&url);
16561
16562 let mut json_mime_type = mime::APPLICATION_JSON;
16563 let mut request_value_reader = {
16564 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16565 common::remove_json_null_values(&mut value);
16566 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16567 serde_json::to_writer(&mut dst, &value).unwrap();
16568 dst
16569 };
16570 let request_size = request_value_reader
16571 .seek(std::io::SeekFrom::End(0))
16572 .unwrap();
16573 request_value_reader
16574 .seek(std::io::SeekFrom::Start(0))
16575 .unwrap();
16576
16577 loop {
16578 let token = match self
16579 .hub
16580 .auth
16581 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16582 .await
16583 {
16584 Ok(token) => token,
16585 Err(e) => match dlg.token(e) {
16586 Ok(token) => token,
16587 Err(e) => {
16588 dlg.finished(false);
16589 return Err(common::Error::MissingToken(e));
16590 }
16591 },
16592 };
16593 request_value_reader
16594 .seek(std::io::SeekFrom::Start(0))
16595 .unwrap();
16596 let mut req_result = {
16597 let client = &self.hub.client;
16598 dlg.pre_request();
16599 let mut req_builder = hyper::Request::builder()
16600 .method(hyper::Method::PATCH)
16601 .uri(url.as_str())
16602 .header(USER_AGENT, self.hub._user_agent.clone());
16603
16604 if let Some(token) = token.as_ref() {
16605 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16606 }
16607
16608 let request = req_builder
16609 .header(CONTENT_TYPE, json_mime_type.to_string())
16610 .header(CONTENT_LENGTH, request_size as u64)
16611 .body(common::to_body(
16612 request_value_reader.get_ref().clone().into(),
16613 ));
16614
16615 client.request(request.unwrap()).await
16616 };
16617
16618 match req_result {
16619 Err(err) => {
16620 if let common::Retry::After(d) = dlg.http_error(&err) {
16621 sleep(d).await;
16622 continue;
16623 }
16624 dlg.finished(false);
16625 return Err(common::Error::HttpError(err));
16626 }
16627 Ok(res) => {
16628 let (mut parts, body) = res.into_parts();
16629 let mut body = common::Body::new(body);
16630 if !parts.status.is_success() {
16631 let bytes = common::to_bytes(body).await.unwrap_or_default();
16632 let error = serde_json::from_str(&common::to_string(&bytes));
16633 let response = common::to_response(parts, bytes.into());
16634
16635 if let common::Retry::After(d) =
16636 dlg.http_failure(&response, error.as_ref().ok())
16637 {
16638 sleep(d).await;
16639 continue;
16640 }
16641
16642 dlg.finished(false);
16643
16644 return Err(match error {
16645 Ok(value) => common::Error::BadRequest(value),
16646 _ => common::Error::Failure(response),
16647 });
16648 }
16649 let response = {
16650 let bytes = common::to_bytes(body).await.unwrap_or_default();
16651 let encoded = common::to_string(&bytes);
16652 match serde_json::from_str(&encoded) {
16653 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16654 Err(error) => {
16655 dlg.response_json_decode_error(&encoded, &error);
16656 return Err(common::Error::JsonDecodeError(
16657 encoded.to_string(),
16658 error,
16659 ));
16660 }
16661 }
16662 };
16663
16664 dlg.finished(true);
16665 return Ok(response);
16666 }
16667 }
16668 }
16669 }
16670
16671 ///
16672 /// Sets the *request* property to the given value.
16673 ///
16674 /// Even though the property as already been set when instantiating this call,
16675 /// we provide this method for API completeness.
16676 pub fn request(mut self, new_value: GenericClass) -> GenericclasPatchCall<'a, C> {
16677 self._request = new_value;
16678 self
16679 }
16680 /// 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 `-`.
16681 ///
16682 /// Sets the *resource id* path property to the given value.
16683 ///
16684 /// Even though the property as already been set when instantiating this call,
16685 /// we provide this method for API completeness.
16686 pub fn resource_id(mut self, new_value: &str) -> GenericclasPatchCall<'a, C> {
16687 self._resource_id = new_value.to_string();
16688 self
16689 }
16690 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16691 /// while executing the actual API request.
16692 ///
16693 /// ````text
16694 /// It should be used to handle progress information, and to implement a certain level of resilience.
16695 /// ````
16696 ///
16697 /// Sets the *delegate* property to the given value.
16698 pub fn delegate(
16699 mut self,
16700 new_value: &'a mut dyn common::Delegate,
16701 ) -> GenericclasPatchCall<'a, C> {
16702 self._delegate = Some(new_value);
16703 self
16704 }
16705
16706 /// Set any additional parameter of the query string used in the request.
16707 /// It should be used to set parameters which are not yet available through their own
16708 /// setters.
16709 ///
16710 /// Please note that this method must not be used to set any of the known parameters
16711 /// which have their own setter method. If done anyway, the request will fail.
16712 ///
16713 /// # Additional Parameters
16714 ///
16715 /// * *$.xgafv* (query-string) - V1 error format.
16716 /// * *access_token* (query-string) - OAuth access token.
16717 /// * *alt* (query-string) - Data format for response.
16718 /// * *callback* (query-string) - JSONP
16719 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16720 /// * *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.
16721 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16722 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16723 /// * *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.
16724 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16725 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16726 pub fn param<T>(mut self, name: T, value: T) -> GenericclasPatchCall<'a, C>
16727 where
16728 T: AsRef<str>,
16729 {
16730 self._additional_params
16731 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16732 self
16733 }
16734
16735 /// Identifies the authorization scope for the method you are building.
16736 ///
16737 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16738 /// [`Scope::WalletObjectIssuer`].
16739 ///
16740 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16741 /// tokens for more than one scope.
16742 ///
16743 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16744 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16745 /// sufficient, a read-write scope will do as well.
16746 pub fn add_scope<St>(mut self, scope: St) -> GenericclasPatchCall<'a, C>
16747 where
16748 St: AsRef<str>,
16749 {
16750 self._scopes.insert(String::from(scope.as_ref()));
16751 self
16752 }
16753 /// Identifies the authorization scope(s) for the method you are building.
16754 ///
16755 /// See [`Self::add_scope()`] for details.
16756 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasPatchCall<'a, C>
16757 where
16758 I: IntoIterator<Item = St>,
16759 St: AsRef<str>,
16760 {
16761 self._scopes
16762 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16763 self
16764 }
16765
16766 /// Removes all scopes, and no default scope will be used either.
16767 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16768 /// for details).
16769 pub fn clear_scopes(mut self) -> GenericclasPatchCall<'a, C> {
16770 self._scopes.clear();
16771 self
16772 }
16773}
16774
16775/// Updates the Generic class referenced by the given class ID.
16776///
16777/// A builder for the *update* method supported by a *genericclas* resource.
16778/// It is not used directly, but through a [`GenericclasMethods`] instance.
16779///
16780/// # Example
16781///
16782/// Instantiate a resource method builder
16783///
16784/// ```test_harness,no_run
16785/// # extern crate hyper;
16786/// # extern crate hyper_rustls;
16787/// # extern crate google_walletobjects1 as walletobjects1;
16788/// use walletobjects1::api::GenericClass;
16789/// # async fn dox() {
16790/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16791///
16792/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16793/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16794/// # secret,
16795/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16796/// # ).build().await.unwrap();
16797///
16798/// # let client = hyper_util::client::legacy::Client::builder(
16799/// # hyper_util::rt::TokioExecutor::new()
16800/// # )
16801/// # .build(
16802/// # hyper_rustls::HttpsConnectorBuilder::new()
16803/// # .with_native_roots()
16804/// # .unwrap()
16805/// # .https_or_http()
16806/// # .enable_http1()
16807/// # .build()
16808/// # );
16809/// # let mut hub = Walletobjects::new(client, auth);
16810/// // As the method needs a request, you would usually fill it with the desired information
16811/// // into the respective structure. Some of the parts shown here might not be applicable !
16812/// // Values shown here are possibly random and not representative !
16813/// let mut req = GenericClass::default();
16814///
16815/// // You can configure optional parameters by calling the respective setters at will, and
16816/// // execute the final call using `doit()`.
16817/// // Values shown here are possibly random and not representative !
16818/// let result = hub.genericclass().update(req, "resourceId")
16819/// .doit().await;
16820/// # }
16821/// ```
16822pub struct GenericclasUpdateCall<'a, C>
16823where
16824 C: 'a,
16825{
16826 hub: &'a Walletobjects<C>,
16827 _request: GenericClass,
16828 _resource_id: String,
16829 _delegate: Option<&'a mut dyn common::Delegate>,
16830 _additional_params: HashMap<String, String>,
16831 _scopes: BTreeSet<String>,
16832}
16833
16834impl<'a, C> common::CallBuilder for GenericclasUpdateCall<'a, C> {}
16835
16836impl<'a, C> GenericclasUpdateCall<'a, C>
16837where
16838 C: common::Connector,
16839{
16840 /// Perform the operation you have build so far.
16841 pub async fn doit(mut self) -> common::Result<(common::Response, GenericClass)> {
16842 use std::borrow::Cow;
16843 use std::io::{Read, Seek};
16844
16845 use common::{url::Params, ToParts};
16846 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16847
16848 let mut dd = common::DefaultDelegate;
16849 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16850 dlg.begin(common::MethodInfo {
16851 id: "walletobjects.genericclass.update",
16852 http_method: hyper::Method::PUT,
16853 });
16854
16855 for &field in ["alt", "resourceId"].iter() {
16856 if self._additional_params.contains_key(field) {
16857 dlg.finished(false);
16858 return Err(common::Error::FieldClash(field));
16859 }
16860 }
16861
16862 let mut params = Params::with_capacity(4 + self._additional_params.len());
16863 params.push("resourceId", self._resource_id);
16864
16865 params.extend(self._additional_params.iter());
16866
16867 params.push("alt", "json");
16868 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericClass/{resourceId}";
16869 if self._scopes.is_empty() {
16870 self._scopes
16871 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
16872 }
16873
16874 #[allow(clippy::single_element_loop)]
16875 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
16876 url = params.uri_replacement(url, param_name, find_this, false);
16877 }
16878 {
16879 let to_remove = ["resourceId"];
16880 params.remove_params(&to_remove);
16881 }
16882
16883 let url = params.parse_with_url(&url);
16884
16885 let mut json_mime_type = mime::APPLICATION_JSON;
16886 let mut request_value_reader = {
16887 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16888 common::remove_json_null_values(&mut value);
16889 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16890 serde_json::to_writer(&mut dst, &value).unwrap();
16891 dst
16892 };
16893 let request_size = request_value_reader
16894 .seek(std::io::SeekFrom::End(0))
16895 .unwrap();
16896 request_value_reader
16897 .seek(std::io::SeekFrom::Start(0))
16898 .unwrap();
16899
16900 loop {
16901 let token = match self
16902 .hub
16903 .auth
16904 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16905 .await
16906 {
16907 Ok(token) => token,
16908 Err(e) => match dlg.token(e) {
16909 Ok(token) => token,
16910 Err(e) => {
16911 dlg.finished(false);
16912 return Err(common::Error::MissingToken(e));
16913 }
16914 },
16915 };
16916 request_value_reader
16917 .seek(std::io::SeekFrom::Start(0))
16918 .unwrap();
16919 let mut req_result = {
16920 let client = &self.hub.client;
16921 dlg.pre_request();
16922 let mut req_builder = hyper::Request::builder()
16923 .method(hyper::Method::PUT)
16924 .uri(url.as_str())
16925 .header(USER_AGENT, self.hub._user_agent.clone());
16926
16927 if let Some(token) = token.as_ref() {
16928 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16929 }
16930
16931 let request = req_builder
16932 .header(CONTENT_TYPE, json_mime_type.to_string())
16933 .header(CONTENT_LENGTH, request_size as u64)
16934 .body(common::to_body(
16935 request_value_reader.get_ref().clone().into(),
16936 ));
16937
16938 client.request(request.unwrap()).await
16939 };
16940
16941 match req_result {
16942 Err(err) => {
16943 if let common::Retry::After(d) = dlg.http_error(&err) {
16944 sleep(d).await;
16945 continue;
16946 }
16947 dlg.finished(false);
16948 return Err(common::Error::HttpError(err));
16949 }
16950 Ok(res) => {
16951 let (mut parts, body) = res.into_parts();
16952 let mut body = common::Body::new(body);
16953 if !parts.status.is_success() {
16954 let bytes = common::to_bytes(body).await.unwrap_or_default();
16955 let error = serde_json::from_str(&common::to_string(&bytes));
16956 let response = common::to_response(parts, bytes.into());
16957
16958 if let common::Retry::After(d) =
16959 dlg.http_failure(&response, error.as_ref().ok())
16960 {
16961 sleep(d).await;
16962 continue;
16963 }
16964
16965 dlg.finished(false);
16966
16967 return Err(match error {
16968 Ok(value) => common::Error::BadRequest(value),
16969 _ => common::Error::Failure(response),
16970 });
16971 }
16972 let response = {
16973 let bytes = common::to_bytes(body).await.unwrap_or_default();
16974 let encoded = common::to_string(&bytes);
16975 match serde_json::from_str(&encoded) {
16976 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16977 Err(error) => {
16978 dlg.response_json_decode_error(&encoded, &error);
16979 return Err(common::Error::JsonDecodeError(
16980 encoded.to_string(),
16981 error,
16982 ));
16983 }
16984 }
16985 };
16986
16987 dlg.finished(true);
16988 return Ok(response);
16989 }
16990 }
16991 }
16992 }
16993
16994 ///
16995 /// Sets the *request* property to the given value.
16996 ///
16997 /// Even though the property as already been set when instantiating this call,
16998 /// we provide this method for API completeness.
16999 pub fn request(mut self, new_value: GenericClass) -> GenericclasUpdateCall<'a, C> {
17000 self._request = new_value;
17001 self
17002 }
17003 /// 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 `-`.
17004 ///
17005 /// Sets the *resource id* path property to the given value.
17006 ///
17007 /// Even though the property as already been set when instantiating this call,
17008 /// we provide this method for API completeness.
17009 pub fn resource_id(mut self, new_value: &str) -> GenericclasUpdateCall<'a, C> {
17010 self._resource_id = new_value.to_string();
17011 self
17012 }
17013 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17014 /// while executing the actual API request.
17015 ///
17016 /// ````text
17017 /// It should be used to handle progress information, and to implement a certain level of resilience.
17018 /// ````
17019 ///
17020 /// Sets the *delegate* property to the given value.
17021 pub fn delegate(
17022 mut self,
17023 new_value: &'a mut dyn common::Delegate,
17024 ) -> GenericclasUpdateCall<'a, C> {
17025 self._delegate = Some(new_value);
17026 self
17027 }
17028
17029 /// Set any additional parameter of the query string used in the request.
17030 /// It should be used to set parameters which are not yet available through their own
17031 /// setters.
17032 ///
17033 /// Please note that this method must not be used to set any of the known parameters
17034 /// which have their own setter method. If done anyway, the request will fail.
17035 ///
17036 /// # Additional Parameters
17037 ///
17038 /// * *$.xgafv* (query-string) - V1 error format.
17039 /// * *access_token* (query-string) - OAuth access token.
17040 /// * *alt* (query-string) - Data format for response.
17041 /// * *callback* (query-string) - JSONP
17042 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17043 /// * *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.
17044 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17045 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17046 /// * *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.
17047 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17048 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17049 pub fn param<T>(mut self, name: T, value: T) -> GenericclasUpdateCall<'a, C>
17050 where
17051 T: AsRef<str>,
17052 {
17053 self._additional_params
17054 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17055 self
17056 }
17057
17058 /// Identifies the authorization scope for the method you are building.
17059 ///
17060 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17061 /// [`Scope::WalletObjectIssuer`].
17062 ///
17063 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17064 /// tokens for more than one scope.
17065 ///
17066 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17067 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17068 /// sufficient, a read-write scope will do as well.
17069 pub fn add_scope<St>(mut self, scope: St) -> GenericclasUpdateCall<'a, C>
17070 where
17071 St: AsRef<str>,
17072 {
17073 self._scopes.insert(String::from(scope.as_ref()));
17074 self
17075 }
17076 /// Identifies the authorization scope(s) for the method you are building.
17077 ///
17078 /// See [`Self::add_scope()`] for details.
17079 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericclasUpdateCall<'a, C>
17080 where
17081 I: IntoIterator<Item = St>,
17082 St: AsRef<str>,
17083 {
17084 self._scopes
17085 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17086 self
17087 }
17088
17089 /// Removes all scopes, and no default scope will be used either.
17090 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17091 /// for details).
17092 pub fn clear_scopes(mut self) -> GenericclasUpdateCall<'a, C> {
17093 self._scopes.clear();
17094 self
17095 }
17096}
17097
17098/// Adds a message to the generic object referenced by the given object ID.
17099///
17100/// A builder for the *addmessage* method supported by a *genericobject* resource.
17101/// It is not used directly, but through a [`GenericobjectMethods`] instance.
17102///
17103/// # Example
17104///
17105/// Instantiate a resource method builder
17106///
17107/// ```test_harness,no_run
17108/// # extern crate hyper;
17109/// # extern crate hyper_rustls;
17110/// # extern crate google_walletobjects1 as walletobjects1;
17111/// use walletobjects1::api::AddMessageRequest;
17112/// # async fn dox() {
17113/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17114///
17115/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17116/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17117/// # secret,
17118/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17119/// # ).build().await.unwrap();
17120///
17121/// # let client = hyper_util::client::legacy::Client::builder(
17122/// # hyper_util::rt::TokioExecutor::new()
17123/// # )
17124/// # .build(
17125/// # hyper_rustls::HttpsConnectorBuilder::new()
17126/// # .with_native_roots()
17127/// # .unwrap()
17128/// # .https_or_http()
17129/// # .enable_http1()
17130/// # .build()
17131/// # );
17132/// # let mut hub = Walletobjects::new(client, auth);
17133/// // As the method needs a request, you would usually fill it with the desired information
17134/// // into the respective structure. Some of the parts shown here might not be applicable !
17135/// // Values shown here are possibly random and not representative !
17136/// let mut req = AddMessageRequest::default();
17137///
17138/// // You can configure optional parameters by calling the respective setters at will, and
17139/// // execute the final call using `doit()`.
17140/// // Values shown here are possibly random and not representative !
17141/// let result = hub.genericobject().addmessage(req, "resourceId")
17142/// .doit().await;
17143/// # }
17144/// ```
17145pub struct GenericobjectAddmessageCall<'a, C>
17146where
17147 C: 'a,
17148{
17149 hub: &'a Walletobjects<C>,
17150 _request: AddMessageRequest,
17151 _resource_id: String,
17152 _delegate: Option<&'a mut dyn common::Delegate>,
17153 _additional_params: HashMap<String, String>,
17154 _scopes: BTreeSet<String>,
17155}
17156
17157impl<'a, C> common::CallBuilder for GenericobjectAddmessageCall<'a, C> {}
17158
17159impl<'a, C> GenericobjectAddmessageCall<'a, C>
17160where
17161 C: common::Connector,
17162{
17163 /// Perform the operation you have build so far.
17164 pub async fn doit(
17165 mut self,
17166 ) -> common::Result<(common::Response, GenericObjectAddMessageResponse)> {
17167 use std::borrow::Cow;
17168 use std::io::{Read, Seek};
17169
17170 use common::{url::Params, ToParts};
17171 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17172
17173 let mut dd = common::DefaultDelegate;
17174 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17175 dlg.begin(common::MethodInfo {
17176 id: "walletobjects.genericobject.addmessage",
17177 http_method: hyper::Method::POST,
17178 });
17179
17180 for &field in ["alt", "resourceId"].iter() {
17181 if self._additional_params.contains_key(field) {
17182 dlg.finished(false);
17183 return Err(common::Error::FieldClash(field));
17184 }
17185 }
17186
17187 let mut params = Params::with_capacity(4 + self._additional_params.len());
17188 params.push("resourceId", self._resource_id);
17189
17190 params.extend(self._additional_params.iter());
17191
17192 params.push("alt", "json");
17193 let mut url =
17194 self.hub._base_url.clone() + "walletobjects/v1/genericObject/{resourceId}/addMessage";
17195 if self._scopes.is_empty() {
17196 self._scopes
17197 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
17198 }
17199
17200 #[allow(clippy::single_element_loop)]
17201 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
17202 url = params.uri_replacement(url, param_name, find_this, false);
17203 }
17204 {
17205 let to_remove = ["resourceId"];
17206 params.remove_params(&to_remove);
17207 }
17208
17209 let url = params.parse_with_url(&url);
17210
17211 let mut json_mime_type = mime::APPLICATION_JSON;
17212 let mut request_value_reader = {
17213 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17214 common::remove_json_null_values(&mut value);
17215 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17216 serde_json::to_writer(&mut dst, &value).unwrap();
17217 dst
17218 };
17219 let request_size = request_value_reader
17220 .seek(std::io::SeekFrom::End(0))
17221 .unwrap();
17222 request_value_reader
17223 .seek(std::io::SeekFrom::Start(0))
17224 .unwrap();
17225
17226 loop {
17227 let token = match self
17228 .hub
17229 .auth
17230 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17231 .await
17232 {
17233 Ok(token) => token,
17234 Err(e) => match dlg.token(e) {
17235 Ok(token) => token,
17236 Err(e) => {
17237 dlg.finished(false);
17238 return Err(common::Error::MissingToken(e));
17239 }
17240 },
17241 };
17242 request_value_reader
17243 .seek(std::io::SeekFrom::Start(0))
17244 .unwrap();
17245 let mut req_result = {
17246 let client = &self.hub.client;
17247 dlg.pre_request();
17248 let mut req_builder = hyper::Request::builder()
17249 .method(hyper::Method::POST)
17250 .uri(url.as_str())
17251 .header(USER_AGENT, self.hub._user_agent.clone());
17252
17253 if let Some(token) = token.as_ref() {
17254 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17255 }
17256
17257 let request = req_builder
17258 .header(CONTENT_TYPE, json_mime_type.to_string())
17259 .header(CONTENT_LENGTH, request_size as u64)
17260 .body(common::to_body(
17261 request_value_reader.get_ref().clone().into(),
17262 ));
17263
17264 client.request(request.unwrap()).await
17265 };
17266
17267 match req_result {
17268 Err(err) => {
17269 if let common::Retry::After(d) = dlg.http_error(&err) {
17270 sleep(d).await;
17271 continue;
17272 }
17273 dlg.finished(false);
17274 return Err(common::Error::HttpError(err));
17275 }
17276 Ok(res) => {
17277 let (mut parts, body) = res.into_parts();
17278 let mut body = common::Body::new(body);
17279 if !parts.status.is_success() {
17280 let bytes = common::to_bytes(body).await.unwrap_or_default();
17281 let error = serde_json::from_str(&common::to_string(&bytes));
17282 let response = common::to_response(parts, bytes.into());
17283
17284 if let common::Retry::After(d) =
17285 dlg.http_failure(&response, error.as_ref().ok())
17286 {
17287 sleep(d).await;
17288 continue;
17289 }
17290
17291 dlg.finished(false);
17292
17293 return Err(match error {
17294 Ok(value) => common::Error::BadRequest(value),
17295 _ => common::Error::Failure(response),
17296 });
17297 }
17298 let response = {
17299 let bytes = common::to_bytes(body).await.unwrap_or_default();
17300 let encoded = common::to_string(&bytes);
17301 match serde_json::from_str(&encoded) {
17302 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17303 Err(error) => {
17304 dlg.response_json_decode_error(&encoded, &error);
17305 return Err(common::Error::JsonDecodeError(
17306 encoded.to_string(),
17307 error,
17308 ));
17309 }
17310 }
17311 };
17312
17313 dlg.finished(true);
17314 return Ok(response);
17315 }
17316 }
17317 }
17318 }
17319
17320 ///
17321 /// Sets the *request* property to the given value.
17322 ///
17323 /// Even though the property as already been set when instantiating this call,
17324 /// we provide this method for API completeness.
17325 pub fn request(mut self, new_value: AddMessageRequest) -> GenericobjectAddmessageCall<'a, C> {
17326 self._request = new_value;
17327 self
17328 }
17329 /// 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 '-'.
17330 ///
17331 /// Sets the *resource id* path property to the given value.
17332 ///
17333 /// Even though the property as already been set when instantiating this call,
17334 /// we provide this method for API completeness.
17335 pub fn resource_id(mut self, new_value: &str) -> GenericobjectAddmessageCall<'a, C> {
17336 self._resource_id = new_value.to_string();
17337 self
17338 }
17339 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17340 /// while executing the actual API request.
17341 ///
17342 /// ````text
17343 /// It should be used to handle progress information, and to implement a certain level of resilience.
17344 /// ````
17345 ///
17346 /// Sets the *delegate* property to the given value.
17347 pub fn delegate(
17348 mut self,
17349 new_value: &'a mut dyn common::Delegate,
17350 ) -> GenericobjectAddmessageCall<'a, C> {
17351 self._delegate = Some(new_value);
17352 self
17353 }
17354
17355 /// Set any additional parameter of the query string used in the request.
17356 /// It should be used to set parameters which are not yet available through their own
17357 /// setters.
17358 ///
17359 /// Please note that this method must not be used to set any of the known parameters
17360 /// which have their own setter method. If done anyway, the request will fail.
17361 ///
17362 /// # Additional Parameters
17363 ///
17364 /// * *$.xgafv* (query-string) - V1 error format.
17365 /// * *access_token* (query-string) - OAuth access token.
17366 /// * *alt* (query-string) - Data format for response.
17367 /// * *callback* (query-string) - JSONP
17368 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17369 /// * *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.
17370 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17371 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17372 /// * *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.
17373 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17374 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17375 pub fn param<T>(mut self, name: T, value: T) -> GenericobjectAddmessageCall<'a, C>
17376 where
17377 T: AsRef<str>,
17378 {
17379 self._additional_params
17380 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17381 self
17382 }
17383
17384 /// Identifies the authorization scope for the method you are building.
17385 ///
17386 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17387 /// [`Scope::WalletObjectIssuer`].
17388 ///
17389 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17390 /// tokens for more than one scope.
17391 ///
17392 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17393 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17394 /// sufficient, a read-write scope will do as well.
17395 pub fn add_scope<St>(mut self, scope: St) -> GenericobjectAddmessageCall<'a, C>
17396 where
17397 St: AsRef<str>,
17398 {
17399 self._scopes.insert(String::from(scope.as_ref()));
17400 self
17401 }
17402 /// Identifies the authorization scope(s) for the method you are building.
17403 ///
17404 /// See [`Self::add_scope()`] for details.
17405 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectAddmessageCall<'a, C>
17406 where
17407 I: IntoIterator<Item = St>,
17408 St: AsRef<str>,
17409 {
17410 self._scopes
17411 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17412 self
17413 }
17414
17415 /// Removes all scopes, and no default scope will be used either.
17416 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17417 /// for details).
17418 pub fn clear_scopes(mut self) -> GenericobjectAddmessageCall<'a, C> {
17419 self._scopes.clear();
17420 self
17421 }
17422}
17423
17424/// Returns the generic object with the given object ID.
17425///
17426/// A builder for the *get* method supported by a *genericobject* resource.
17427/// It is not used directly, but through a [`GenericobjectMethods`] instance.
17428///
17429/// # Example
17430///
17431/// Instantiate a resource method builder
17432///
17433/// ```test_harness,no_run
17434/// # extern crate hyper;
17435/// # extern crate hyper_rustls;
17436/// # extern crate google_walletobjects1 as walletobjects1;
17437/// # async fn dox() {
17438/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17439///
17440/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17441/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17442/// # secret,
17443/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17444/// # ).build().await.unwrap();
17445///
17446/// # let client = hyper_util::client::legacy::Client::builder(
17447/// # hyper_util::rt::TokioExecutor::new()
17448/// # )
17449/// # .build(
17450/// # hyper_rustls::HttpsConnectorBuilder::new()
17451/// # .with_native_roots()
17452/// # .unwrap()
17453/// # .https_or_http()
17454/// # .enable_http1()
17455/// # .build()
17456/// # );
17457/// # let mut hub = Walletobjects::new(client, auth);
17458/// // You can configure optional parameters by calling the respective setters at will, and
17459/// // execute the final call using `doit()`.
17460/// // Values shown here are possibly random and not representative !
17461/// let result = hub.genericobject().get("resourceId")
17462/// .doit().await;
17463/// # }
17464/// ```
17465pub struct GenericobjectGetCall<'a, C>
17466where
17467 C: 'a,
17468{
17469 hub: &'a Walletobjects<C>,
17470 _resource_id: String,
17471 _delegate: Option<&'a mut dyn common::Delegate>,
17472 _additional_params: HashMap<String, String>,
17473 _scopes: BTreeSet<String>,
17474}
17475
17476impl<'a, C> common::CallBuilder for GenericobjectGetCall<'a, C> {}
17477
17478impl<'a, C> GenericobjectGetCall<'a, C>
17479where
17480 C: common::Connector,
17481{
17482 /// Perform the operation you have build so far.
17483 pub async fn doit(mut self) -> common::Result<(common::Response, GenericObject)> {
17484 use std::borrow::Cow;
17485 use std::io::{Read, Seek};
17486
17487 use common::{url::Params, ToParts};
17488 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17489
17490 let mut dd = common::DefaultDelegate;
17491 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17492 dlg.begin(common::MethodInfo {
17493 id: "walletobjects.genericobject.get",
17494 http_method: hyper::Method::GET,
17495 });
17496
17497 for &field in ["alt", "resourceId"].iter() {
17498 if self._additional_params.contains_key(field) {
17499 dlg.finished(false);
17500 return Err(common::Error::FieldClash(field));
17501 }
17502 }
17503
17504 let mut params = Params::with_capacity(3 + self._additional_params.len());
17505 params.push("resourceId", self._resource_id);
17506
17507 params.extend(self._additional_params.iter());
17508
17509 params.push("alt", "json");
17510 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject/{resourceId}";
17511 if self._scopes.is_empty() {
17512 self._scopes
17513 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
17514 }
17515
17516 #[allow(clippy::single_element_loop)]
17517 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
17518 url = params.uri_replacement(url, param_name, find_this, false);
17519 }
17520 {
17521 let to_remove = ["resourceId"];
17522 params.remove_params(&to_remove);
17523 }
17524
17525 let url = params.parse_with_url(&url);
17526
17527 loop {
17528 let token = match self
17529 .hub
17530 .auth
17531 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17532 .await
17533 {
17534 Ok(token) => token,
17535 Err(e) => match dlg.token(e) {
17536 Ok(token) => token,
17537 Err(e) => {
17538 dlg.finished(false);
17539 return Err(common::Error::MissingToken(e));
17540 }
17541 },
17542 };
17543 let mut req_result = {
17544 let client = &self.hub.client;
17545 dlg.pre_request();
17546 let mut req_builder = hyper::Request::builder()
17547 .method(hyper::Method::GET)
17548 .uri(url.as_str())
17549 .header(USER_AGENT, self.hub._user_agent.clone());
17550
17551 if let Some(token) = token.as_ref() {
17552 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17553 }
17554
17555 let request = req_builder
17556 .header(CONTENT_LENGTH, 0_u64)
17557 .body(common::to_body::<String>(None));
17558
17559 client.request(request.unwrap()).await
17560 };
17561
17562 match req_result {
17563 Err(err) => {
17564 if let common::Retry::After(d) = dlg.http_error(&err) {
17565 sleep(d).await;
17566 continue;
17567 }
17568 dlg.finished(false);
17569 return Err(common::Error::HttpError(err));
17570 }
17571 Ok(res) => {
17572 let (mut parts, body) = res.into_parts();
17573 let mut body = common::Body::new(body);
17574 if !parts.status.is_success() {
17575 let bytes = common::to_bytes(body).await.unwrap_or_default();
17576 let error = serde_json::from_str(&common::to_string(&bytes));
17577 let response = common::to_response(parts, bytes.into());
17578
17579 if let common::Retry::After(d) =
17580 dlg.http_failure(&response, error.as_ref().ok())
17581 {
17582 sleep(d).await;
17583 continue;
17584 }
17585
17586 dlg.finished(false);
17587
17588 return Err(match error {
17589 Ok(value) => common::Error::BadRequest(value),
17590 _ => common::Error::Failure(response),
17591 });
17592 }
17593 let response = {
17594 let bytes = common::to_bytes(body).await.unwrap_or_default();
17595 let encoded = common::to_string(&bytes);
17596 match serde_json::from_str(&encoded) {
17597 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17598 Err(error) => {
17599 dlg.response_json_decode_error(&encoded, &error);
17600 return Err(common::Error::JsonDecodeError(
17601 encoded.to_string(),
17602 error,
17603 ));
17604 }
17605 }
17606 };
17607
17608 dlg.finished(true);
17609 return Ok(response);
17610 }
17611 }
17612 }
17613 }
17614
17615 /// 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 `-`.
17616 ///
17617 /// Sets the *resource id* path property to the given value.
17618 ///
17619 /// Even though the property as already been set when instantiating this call,
17620 /// we provide this method for API completeness.
17621 pub fn resource_id(mut self, new_value: &str) -> GenericobjectGetCall<'a, C> {
17622 self._resource_id = new_value.to_string();
17623 self
17624 }
17625 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17626 /// while executing the actual API request.
17627 ///
17628 /// ````text
17629 /// It should be used to handle progress information, and to implement a certain level of resilience.
17630 /// ````
17631 ///
17632 /// Sets the *delegate* property to the given value.
17633 pub fn delegate(
17634 mut self,
17635 new_value: &'a mut dyn common::Delegate,
17636 ) -> GenericobjectGetCall<'a, C> {
17637 self._delegate = Some(new_value);
17638 self
17639 }
17640
17641 /// Set any additional parameter of the query string used in the request.
17642 /// It should be used to set parameters which are not yet available through their own
17643 /// setters.
17644 ///
17645 /// Please note that this method must not be used to set any of the known parameters
17646 /// which have their own setter method. If done anyway, the request will fail.
17647 ///
17648 /// # Additional Parameters
17649 ///
17650 /// * *$.xgafv* (query-string) - V1 error format.
17651 /// * *access_token* (query-string) - OAuth access token.
17652 /// * *alt* (query-string) - Data format for response.
17653 /// * *callback* (query-string) - JSONP
17654 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17655 /// * *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.
17656 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17657 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17658 /// * *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.
17659 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17660 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17661 pub fn param<T>(mut self, name: T, value: T) -> GenericobjectGetCall<'a, C>
17662 where
17663 T: AsRef<str>,
17664 {
17665 self._additional_params
17666 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17667 self
17668 }
17669
17670 /// Identifies the authorization scope for the method you are building.
17671 ///
17672 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17673 /// [`Scope::WalletObjectIssuer`].
17674 ///
17675 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17676 /// tokens for more than one scope.
17677 ///
17678 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17679 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17680 /// sufficient, a read-write scope will do as well.
17681 pub fn add_scope<St>(mut self, scope: St) -> GenericobjectGetCall<'a, C>
17682 where
17683 St: AsRef<str>,
17684 {
17685 self._scopes.insert(String::from(scope.as_ref()));
17686 self
17687 }
17688 /// Identifies the authorization scope(s) for the method you are building.
17689 ///
17690 /// See [`Self::add_scope()`] for details.
17691 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectGetCall<'a, C>
17692 where
17693 I: IntoIterator<Item = St>,
17694 St: AsRef<str>,
17695 {
17696 self._scopes
17697 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17698 self
17699 }
17700
17701 /// Removes all scopes, and no default scope will be used either.
17702 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17703 /// for details).
17704 pub fn clear_scopes(mut self) -> GenericobjectGetCall<'a, C> {
17705 self._scopes.clear();
17706 self
17707 }
17708}
17709
17710/// Inserts a generic object with the given ID and properties.
17711///
17712/// A builder for the *insert* method supported by a *genericobject* resource.
17713/// It is not used directly, but through a [`GenericobjectMethods`] instance.
17714///
17715/// # Example
17716///
17717/// Instantiate a resource method builder
17718///
17719/// ```test_harness,no_run
17720/// # extern crate hyper;
17721/// # extern crate hyper_rustls;
17722/// # extern crate google_walletobjects1 as walletobjects1;
17723/// use walletobjects1::api::GenericObject;
17724/// # async fn dox() {
17725/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17726///
17727/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17728/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17729/// # secret,
17730/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17731/// # ).build().await.unwrap();
17732///
17733/// # let client = hyper_util::client::legacy::Client::builder(
17734/// # hyper_util::rt::TokioExecutor::new()
17735/// # )
17736/// # .build(
17737/// # hyper_rustls::HttpsConnectorBuilder::new()
17738/// # .with_native_roots()
17739/// # .unwrap()
17740/// # .https_or_http()
17741/// # .enable_http1()
17742/// # .build()
17743/// # );
17744/// # let mut hub = Walletobjects::new(client, auth);
17745/// // As the method needs a request, you would usually fill it with the desired information
17746/// // into the respective structure. Some of the parts shown here might not be applicable !
17747/// // Values shown here are possibly random and not representative !
17748/// let mut req = GenericObject::default();
17749///
17750/// // You can configure optional parameters by calling the respective setters at will, and
17751/// // execute the final call using `doit()`.
17752/// // Values shown here are possibly random and not representative !
17753/// let result = hub.genericobject().insert(req)
17754/// .doit().await;
17755/// # }
17756/// ```
17757pub struct GenericobjectInsertCall<'a, C>
17758where
17759 C: 'a,
17760{
17761 hub: &'a Walletobjects<C>,
17762 _request: GenericObject,
17763 _delegate: Option<&'a mut dyn common::Delegate>,
17764 _additional_params: HashMap<String, String>,
17765 _scopes: BTreeSet<String>,
17766}
17767
17768impl<'a, C> common::CallBuilder for GenericobjectInsertCall<'a, C> {}
17769
17770impl<'a, C> GenericobjectInsertCall<'a, C>
17771where
17772 C: common::Connector,
17773{
17774 /// Perform the operation you have build so far.
17775 pub async fn doit(mut self) -> common::Result<(common::Response, GenericObject)> {
17776 use std::borrow::Cow;
17777 use std::io::{Read, Seek};
17778
17779 use common::{url::Params, ToParts};
17780 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17781
17782 let mut dd = common::DefaultDelegate;
17783 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17784 dlg.begin(common::MethodInfo {
17785 id: "walletobjects.genericobject.insert",
17786 http_method: hyper::Method::POST,
17787 });
17788
17789 for &field in ["alt"].iter() {
17790 if self._additional_params.contains_key(field) {
17791 dlg.finished(false);
17792 return Err(common::Error::FieldClash(field));
17793 }
17794 }
17795
17796 let mut params = Params::with_capacity(3 + self._additional_params.len());
17797
17798 params.extend(self._additional_params.iter());
17799
17800 params.push("alt", "json");
17801 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject";
17802 if self._scopes.is_empty() {
17803 self._scopes
17804 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
17805 }
17806
17807 let url = params.parse_with_url(&url);
17808
17809 let mut json_mime_type = mime::APPLICATION_JSON;
17810 let mut request_value_reader = {
17811 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17812 common::remove_json_null_values(&mut value);
17813 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17814 serde_json::to_writer(&mut dst, &value).unwrap();
17815 dst
17816 };
17817 let request_size = request_value_reader
17818 .seek(std::io::SeekFrom::End(0))
17819 .unwrap();
17820 request_value_reader
17821 .seek(std::io::SeekFrom::Start(0))
17822 .unwrap();
17823
17824 loop {
17825 let token = match self
17826 .hub
17827 .auth
17828 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17829 .await
17830 {
17831 Ok(token) => token,
17832 Err(e) => match dlg.token(e) {
17833 Ok(token) => token,
17834 Err(e) => {
17835 dlg.finished(false);
17836 return Err(common::Error::MissingToken(e));
17837 }
17838 },
17839 };
17840 request_value_reader
17841 .seek(std::io::SeekFrom::Start(0))
17842 .unwrap();
17843 let mut req_result = {
17844 let client = &self.hub.client;
17845 dlg.pre_request();
17846 let mut req_builder = hyper::Request::builder()
17847 .method(hyper::Method::POST)
17848 .uri(url.as_str())
17849 .header(USER_AGENT, self.hub._user_agent.clone());
17850
17851 if let Some(token) = token.as_ref() {
17852 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17853 }
17854
17855 let request = req_builder
17856 .header(CONTENT_TYPE, json_mime_type.to_string())
17857 .header(CONTENT_LENGTH, request_size as u64)
17858 .body(common::to_body(
17859 request_value_reader.get_ref().clone().into(),
17860 ));
17861
17862 client.request(request.unwrap()).await
17863 };
17864
17865 match req_result {
17866 Err(err) => {
17867 if let common::Retry::After(d) = dlg.http_error(&err) {
17868 sleep(d).await;
17869 continue;
17870 }
17871 dlg.finished(false);
17872 return Err(common::Error::HttpError(err));
17873 }
17874 Ok(res) => {
17875 let (mut parts, body) = res.into_parts();
17876 let mut body = common::Body::new(body);
17877 if !parts.status.is_success() {
17878 let bytes = common::to_bytes(body).await.unwrap_or_default();
17879 let error = serde_json::from_str(&common::to_string(&bytes));
17880 let response = common::to_response(parts, bytes.into());
17881
17882 if let common::Retry::After(d) =
17883 dlg.http_failure(&response, error.as_ref().ok())
17884 {
17885 sleep(d).await;
17886 continue;
17887 }
17888
17889 dlg.finished(false);
17890
17891 return Err(match error {
17892 Ok(value) => common::Error::BadRequest(value),
17893 _ => common::Error::Failure(response),
17894 });
17895 }
17896 let response = {
17897 let bytes = common::to_bytes(body).await.unwrap_or_default();
17898 let encoded = common::to_string(&bytes);
17899 match serde_json::from_str(&encoded) {
17900 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17901 Err(error) => {
17902 dlg.response_json_decode_error(&encoded, &error);
17903 return Err(common::Error::JsonDecodeError(
17904 encoded.to_string(),
17905 error,
17906 ));
17907 }
17908 }
17909 };
17910
17911 dlg.finished(true);
17912 return Ok(response);
17913 }
17914 }
17915 }
17916 }
17917
17918 ///
17919 /// Sets the *request* property to the given value.
17920 ///
17921 /// Even though the property as already been set when instantiating this call,
17922 /// we provide this method for API completeness.
17923 pub fn request(mut self, new_value: GenericObject) -> GenericobjectInsertCall<'a, C> {
17924 self._request = new_value;
17925 self
17926 }
17927 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17928 /// while executing the actual API request.
17929 ///
17930 /// ````text
17931 /// It should be used to handle progress information, and to implement a certain level of resilience.
17932 /// ````
17933 ///
17934 /// Sets the *delegate* property to the given value.
17935 pub fn delegate(
17936 mut self,
17937 new_value: &'a mut dyn common::Delegate,
17938 ) -> GenericobjectInsertCall<'a, C> {
17939 self._delegate = Some(new_value);
17940 self
17941 }
17942
17943 /// Set any additional parameter of the query string used in the request.
17944 /// It should be used to set parameters which are not yet available through their own
17945 /// setters.
17946 ///
17947 /// Please note that this method must not be used to set any of the known parameters
17948 /// which have their own setter method. If done anyway, the request will fail.
17949 ///
17950 /// # Additional Parameters
17951 ///
17952 /// * *$.xgafv* (query-string) - V1 error format.
17953 /// * *access_token* (query-string) - OAuth access token.
17954 /// * *alt* (query-string) - Data format for response.
17955 /// * *callback* (query-string) - JSONP
17956 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17957 /// * *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.
17958 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17959 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17960 /// * *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.
17961 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17962 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17963 pub fn param<T>(mut self, name: T, value: T) -> GenericobjectInsertCall<'a, C>
17964 where
17965 T: AsRef<str>,
17966 {
17967 self._additional_params
17968 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17969 self
17970 }
17971
17972 /// Identifies the authorization scope for the method you are building.
17973 ///
17974 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17975 /// [`Scope::WalletObjectIssuer`].
17976 ///
17977 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17978 /// tokens for more than one scope.
17979 ///
17980 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17981 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17982 /// sufficient, a read-write scope will do as well.
17983 pub fn add_scope<St>(mut self, scope: St) -> GenericobjectInsertCall<'a, C>
17984 where
17985 St: AsRef<str>,
17986 {
17987 self._scopes.insert(String::from(scope.as_ref()));
17988 self
17989 }
17990 /// Identifies the authorization scope(s) for the method you are building.
17991 ///
17992 /// See [`Self::add_scope()`] for details.
17993 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectInsertCall<'a, C>
17994 where
17995 I: IntoIterator<Item = St>,
17996 St: AsRef<str>,
17997 {
17998 self._scopes
17999 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18000 self
18001 }
18002
18003 /// Removes all scopes, and no default scope will be used either.
18004 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18005 /// for details).
18006 pub fn clear_scopes(mut self) -> GenericobjectInsertCall<'a, C> {
18007 self._scopes.clear();
18008 self
18009 }
18010}
18011
18012/// Returns a list of all generic objects for a given issuer ID.
18013///
18014/// A builder for the *list* method supported by a *genericobject* resource.
18015/// It is not used directly, but through a [`GenericobjectMethods`] instance.
18016///
18017/// # Example
18018///
18019/// Instantiate a resource method builder
18020///
18021/// ```test_harness,no_run
18022/// # extern crate hyper;
18023/// # extern crate hyper_rustls;
18024/// # extern crate google_walletobjects1 as walletobjects1;
18025/// # async fn dox() {
18026/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18027///
18028/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18029/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18030/// # secret,
18031/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18032/// # ).build().await.unwrap();
18033///
18034/// # let client = hyper_util::client::legacy::Client::builder(
18035/// # hyper_util::rt::TokioExecutor::new()
18036/// # )
18037/// # .build(
18038/// # hyper_rustls::HttpsConnectorBuilder::new()
18039/// # .with_native_roots()
18040/// # .unwrap()
18041/// # .https_or_http()
18042/// # .enable_http1()
18043/// # .build()
18044/// # );
18045/// # let mut hub = Walletobjects::new(client, auth);
18046/// // You can configure optional parameters by calling the respective setters at will, and
18047/// // execute the final call using `doit()`.
18048/// // Values shown here are possibly random and not representative !
18049/// let result = hub.genericobject().list()
18050/// .token("no")
18051/// .max_results(-15)
18052/// .class_id("kasd")
18053/// .doit().await;
18054/// # }
18055/// ```
18056pub struct GenericobjectListCall<'a, C>
18057where
18058 C: 'a,
18059{
18060 hub: &'a Walletobjects<C>,
18061 _token: Option<String>,
18062 _max_results: Option<i32>,
18063 _class_id: Option<String>,
18064 _delegate: Option<&'a mut dyn common::Delegate>,
18065 _additional_params: HashMap<String, String>,
18066 _scopes: BTreeSet<String>,
18067}
18068
18069impl<'a, C> common::CallBuilder for GenericobjectListCall<'a, C> {}
18070
18071impl<'a, C> GenericobjectListCall<'a, C>
18072where
18073 C: common::Connector,
18074{
18075 /// Perform the operation you have build so far.
18076 pub async fn doit(mut self) -> common::Result<(common::Response, GenericObjectListResponse)> {
18077 use std::borrow::Cow;
18078 use std::io::{Read, Seek};
18079
18080 use common::{url::Params, ToParts};
18081 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18082
18083 let mut dd = common::DefaultDelegate;
18084 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18085 dlg.begin(common::MethodInfo {
18086 id: "walletobjects.genericobject.list",
18087 http_method: hyper::Method::GET,
18088 });
18089
18090 for &field in ["alt", "token", "maxResults", "classId"].iter() {
18091 if self._additional_params.contains_key(field) {
18092 dlg.finished(false);
18093 return Err(common::Error::FieldClash(field));
18094 }
18095 }
18096
18097 let mut params = Params::with_capacity(5 + self._additional_params.len());
18098 if let Some(value) = self._token.as_ref() {
18099 params.push("token", value);
18100 }
18101 if let Some(value) = self._max_results.as_ref() {
18102 params.push("maxResults", value.to_string());
18103 }
18104 if let Some(value) = self._class_id.as_ref() {
18105 params.push("classId", value);
18106 }
18107
18108 params.extend(self._additional_params.iter());
18109
18110 params.push("alt", "json");
18111 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject";
18112 if self._scopes.is_empty() {
18113 self._scopes
18114 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
18115 }
18116
18117 let url = params.parse_with_url(&url);
18118
18119 loop {
18120 let token = match self
18121 .hub
18122 .auth
18123 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18124 .await
18125 {
18126 Ok(token) => token,
18127 Err(e) => match dlg.token(e) {
18128 Ok(token) => token,
18129 Err(e) => {
18130 dlg.finished(false);
18131 return Err(common::Error::MissingToken(e));
18132 }
18133 },
18134 };
18135 let mut req_result = {
18136 let client = &self.hub.client;
18137 dlg.pre_request();
18138 let mut req_builder = hyper::Request::builder()
18139 .method(hyper::Method::GET)
18140 .uri(url.as_str())
18141 .header(USER_AGENT, self.hub._user_agent.clone());
18142
18143 if let Some(token) = token.as_ref() {
18144 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18145 }
18146
18147 let request = req_builder
18148 .header(CONTENT_LENGTH, 0_u64)
18149 .body(common::to_body::<String>(None));
18150
18151 client.request(request.unwrap()).await
18152 };
18153
18154 match req_result {
18155 Err(err) => {
18156 if let common::Retry::After(d) = dlg.http_error(&err) {
18157 sleep(d).await;
18158 continue;
18159 }
18160 dlg.finished(false);
18161 return Err(common::Error::HttpError(err));
18162 }
18163 Ok(res) => {
18164 let (mut parts, body) = res.into_parts();
18165 let mut body = common::Body::new(body);
18166 if !parts.status.is_success() {
18167 let bytes = common::to_bytes(body).await.unwrap_or_default();
18168 let error = serde_json::from_str(&common::to_string(&bytes));
18169 let response = common::to_response(parts, bytes.into());
18170
18171 if let common::Retry::After(d) =
18172 dlg.http_failure(&response, error.as_ref().ok())
18173 {
18174 sleep(d).await;
18175 continue;
18176 }
18177
18178 dlg.finished(false);
18179
18180 return Err(match error {
18181 Ok(value) => common::Error::BadRequest(value),
18182 _ => common::Error::Failure(response),
18183 });
18184 }
18185 let response = {
18186 let bytes = common::to_bytes(body).await.unwrap_or_default();
18187 let encoded = common::to_string(&bytes);
18188 match serde_json::from_str(&encoded) {
18189 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18190 Err(error) => {
18191 dlg.response_json_decode_error(&encoded, &error);
18192 return Err(common::Error::JsonDecodeError(
18193 encoded.to_string(),
18194 error,
18195 ));
18196 }
18197 }
18198 };
18199
18200 dlg.finished(true);
18201 return Ok(response);
18202 }
18203 }
18204 }
18205 }
18206
18207 /// 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.
18208 ///
18209 /// Sets the *token* query property to the given value.
18210 pub fn token(mut self, new_value: &str) -> GenericobjectListCall<'a, C> {
18211 self._token = Some(new_value.to_string());
18212 self
18213 }
18214 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
18215 ///
18216 /// Sets the *max results* query property to the given value.
18217 pub fn max_results(mut self, new_value: i32) -> GenericobjectListCall<'a, C> {
18218 self._max_results = Some(new_value);
18219 self
18220 }
18221 /// The ID of the class whose objects will be listed.
18222 ///
18223 /// Sets the *class id* query property to the given value.
18224 pub fn class_id(mut self, new_value: &str) -> GenericobjectListCall<'a, C> {
18225 self._class_id = Some(new_value.to_string());
18226 self
18227 }
18228 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18229 /// while executing the actual API request.
18230 ///
18231 /// ````text
18232 /// It should be used to handle progress information, and to implement a certain level of resilience.
18233 /// ````
18234 ///
18235 /// Sets the *delegate* property to the given value.
18236 pub fn delegate(
18237 mut self,
18238 new_value: &'a mut dyn common::Delegate,
18239 ) -> GenericobjectListCall<'a, C> {
18240 self._delegate = Some(new_value);
18241 self
18242 }
18243
18244 /// Set any additional parameter of the query string used in the request.
18245 /// It should be used to set parameters which are not yet available through their own
18246 /// setters.
18247 ///
18248 /// Please note that this method must not be used to set any of the known parameters
18249 /// which have their own setter method. If done anyway, the request will fail.
18250 ///
18251 /// # Additional Parameters
18252 ///
18253 /// * *$.xgafv* (query-string) - V1 error format.
18254 /// * *access_token* (query-string) - OAuth access token.
18255 /// * *alt* (query-string) - Data format for response.
18256 /// * *callback* (query-string) - JSONP
18257 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18258 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18259 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18260 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18261 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18262 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18263 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18264 pub fn param<T>(mut self, name: T, value: T) -> GenericobjectListCall<'a, C>
18265 where
18266 T: AsRef<str>,
18267 {
18268 self._additional_params
18269 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18270 self
18271 }
18272
18273 /// Identifies the authorization scope for the method you are building.
18274 ///
18275 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18276 /// [`Scope::WalletObjectIssuer`].
18277 ///
18278 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18279 /// tokens for more than one scope.
18280 ///
18281 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18282 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18283 /// sufficient, a read-write scope will do as well.
18284 pub fn add_scope<St>(mut self, scope: St) -> GenericobjectListCall<'a, C>
18285 where
18286 St: AsRef<str>,
18287 {
18288 self._scopes.insert(String::from(scope.as_ref()));
18289 self
18290 }
18291 /// Identifies the authorization scope(s) for the method you are building.
18292 ///
18293 /// See [`Self::add_scope()`] for details.
18294 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectListCall<'a, C>
18295 where
18296 I: IntoIterator<Item = St>,
18297 St: AsRef<str>,
18298 {
18299 self._scopes
18300 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18301 self
18302 }
18303
18304 /// Removes all scopes, and no default scope will be used either.
18305 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18306 /// for details).
18307 pub fn clear_scopes(mut self) -> GenericobjectListCall<'a, C> {
18308 self._scopes.clear();
18309 self
18310 }
18311}
18312
18313/// Updates the generic object referenced by the given object ID. This method supports patch semantics.
18314///
18315/// A builder for the *patch* method supported by a *genericobject* resource.
18316/// It is not used directly, but through a [`GenericobjectMethods`] instance.
18317///
18318/// # Example
18319///
18320/// Instantiate a resource method builder
18321///
18322/// ```test_harness,no_run
18323/// # extern crate hyper;
18324/// # extern crate hyper_rustls;
18325/// # extern crate google_walletobjects1 as walletobjects1;
18326/// use walletobjects1::api::GenericObject;
18327/// # async fn dox() {
18328/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18329///
18330/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18331/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18332/// # secret,
18333/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18334/// # ).build().await.unwrap();
18335///
18336/// # let client = hyper_util::client::legacy::Client::builder(
18337/// # hyper_util::rt::TokioExecutor::new()
18338/// # )
18339/// # .build(
18340/// # hyper_rustls::HttpsConnectorBuilder::new()
18341/// # .with_native_roots()
18342/// # .unwrap()
18343/// # .https_or_http()
18344/// # .enable_http1()
18345/// # .build()
18346/// # );
18347/// # let mut hub = Walletobjects::new(client, auth);
18348/// // As the method needs a request, you would usually fill it with the desired information
18349/// // into the respective structure. Some of the parts shown here might not be applicable !
18350/// // Values shown here are possibly random and not representative !
18351/// let mut req = GenericObject::default();
18352///
18353/// // You can configure optional parameters by calling the respective setters at will, and
18354/// // execute the final call using `doit()`.
18355/// // Values shown here are possibly random and not representative !
18356/// let result = hub.genericobject().patch(req, "resourceId")
18357/// .doit().await;
18358/// # }
18359/// ```
18360pub struct GenericobjectPatchCall<'a, C>
18361where
18362 C: 'a,
18363{
18364 hub: &'a Walletobjects<C>,
18365 _request: GenericObject,
18366 _resource_id: String,
18367 _delegate: Option<&'a mut dyn common::Delegate>,
18368 _additional_params: HashMap<String, String>,
18369 _scopes: BTreeSet<String>,
18370}
18371
18372impl<'a, C> common::CallBuilder for GenericobjectPatchCall<'a, C> {}
18373
18374impl<'a, C> GenericobjectPatchCall<'a, C>
18375where
18376 C: common::Connector,
18377{
18378 /// Perform the operation you have build so far.
18379 pub async fn doit(mut self) -> common::Result<(common::Response, GenericObject)> {
18380 use std::borrow::Cow;
18381 use std::io::{Read, Seek};
18382
18383 use common::{url::Params, ToParts};
18384 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18385
18386 let mut dd = common::DefaultDelegate;
18387 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18388 dlg.begin(common::MethodInfo {
18389 id: "walletobjects.genericobject.patch",
18390 http_method: hyper::Method::PATCH,
18391 });
18392
18393 for &field in ["alt", "resourceId"].iter() {
18394 if self._additional_params.contains_key(field) {
18395 dlg.finished(false);
18396 return Err(common::Error::FieldClash(field));
18397 }
18398 }
18399
18400 let mut params = Params::with_capacity(4 + self._additional_params.len());
18401 params.push("resourceId", self._resource_id);
18402
18403 params.extend(self._additional_params.iter());
18404
18405 params.push("alt", "json");
18406 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject/{resourceId}";
18407 if self._scopes.is_empty() {
18408 self._scopes
18409 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
18410 }
18411
18412 #[allow(clippy::single_element_loop)]
18413 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
18414 url = params.uri_replacement(url, param_name, find_this, false);
18415 }
18416 {
18417 let to_remove = ["resourceId"];
18418 params.remove_params(&to_remove);
18419 }
18420
18421 let url = params.parse_with_url(&url);
18422
18423 let mut json_mime_type = mime::APPLICATION_JSON;
18424 let mut request_value_reader = {
18425 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18426 common::remove_json_null_values(&mut value);
18427 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18428 serde_json::to_writer(&mut dst, &value).unwrap();
18429 dst
18430 };
18431 let request_size = request_value_reader
18432 .seek(std::io::SeekFrom::End(0))
18433 .unwrap();
18434 request_value_reader
18435 .seek(std::io::SeekFrom::Start(0))
18436 .unwrap();
18437
18438 loop {
18439 let token = match self
18440 .hub
18441 .auth
18442 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18443 .await
18444 {
18445 Ok(token) => token,
18446 Err(e) => match dlg.token(e) {
18447 Ok(token) => token,
18448 Err(e) => {
18449 dlg.finished(false);
18450 return Err(common::Error::MissingToken(e));
18451 }
18452 },
18453 };
18454 request_value_reader
18455 .seek(std::io::SeekFrom::Start(0))
18456 .unwrap();
18457 let mut req_result = {
18458 let client = &self.hub.client;
18459 dlg.pre_request();
18460 let mut req_builder = hyper::Request::builder()
18461 .method(hyper::Method::PATCH)
18462 .uri(url.as_str())
18463 .header(USER_AGENT, self.hub._user_agent.clone());
18464
18465 if let Some(token) = token.as_ref() {
18466 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18467 }
18468
18469 let request = req_builder
18470 .header(CONTENT_TYPE, json_mime_type.to_string())
18471 .header(CONTENT_LENGTH, request_size as u64)
18472 .body(common::to_body(
18473 request_value_reader.get_ref().clone().into(),
18474 ));
18475
18476 client.request(request.unwrap()).await
18477 };
18478
18479 match req_result {
18480 Err(err) => {
18481 if let common::Retry::After(d) = dlg.http_error(&err) {
18482 sleep(d).await;
18483 continue;
18484 }
18485 dlg.finished(false);
18486 return Err(common::Error::HttpError(err));
18487 }
18488 Ok(res) => {
18489 let (mut parts, body) = res.into_parts();
18490 let mut body = common::Body::new(body);
18491 if !parts.status.is_success() {
18492 let bytes = common::to_bytes(body).await.unwrap_or_default();
18493 let error = serde_json::from_str(&common::to_string(&bytes));
18494 let response = common::to_response(parts, bytes.into());
18495
18496 if let common::Retry::After(d) =
18497 dlg.http_failure(&response, error.as_ref().ok())
18498 {
18499 sleep(d).await;
18500 continue;
18501 }
18502
18503 dlg.finished(false);
18504
18505 return Err(match error {
18506 Ok(value) => common::Error::BadRequest(value),
18507 _ => common::Error::Failure(response),
18508 });
18509 }
18510 let response = {
18511 let bytes = common::to_bytes(body).await.unwrap_or_default();
18512 let encoded = common::to_string(&bytes);
18513 match serde_json::from_str(&encoded) {
18514 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18515 Err(error) => {
18516 dlg.response_json_decode_error(&encoded, &error);
18517 return Err(common::Error::JsonDecodeError(
18518 encoded.to_string(),
18519 error,
18520 ));
18521 }
18522 }
18523 };
18524
18525 dlg.finished(true);
18526 return Ok(response);
18527 }
18528 }
18529 }
18530 }
18531
18532 ///
18533 /// Sets the *request* property to the given value.
18534 ///
18535 /// Even though the property as already been set when instantiating this call,
18536 /// we provide this method for API completeness.
18537 pub fn request(mut self, new_value: GenericObject) -> GenericobjectPatchCall<'a, C> {
18538 self._request = new_value;
18539 self
18540 }
18541 /// 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 `-`.
18542 ///
18543 /// Sets the *resource id* path property to the given value.
18544 ///
18545 /// Even though the property as already been set when instantiating this call,
18546 /// we provide this method for API completeness.
18547 pub fn resource_id(mut self, new_value: &str) -> GenericobjectPatchCall<'a, C> {
18548 self._resource_id = new_value.to_string();
18549 self
18550 }
18551 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18552 /// while executing the actual API request.
18553 ///
18554 /// ````text
18555 /// It should be used to handle progress information, and to implement a certain level of resilience.
18556 /// ````
18557 ///
18558 /// Sets the *delegate* property to the given value.
18559 pub fn delegate(
18560 mut self,
18561 new_value: &'a mut dyn common::Delegate,
18562 ) -> GenericobjectPatchCall<'a, C> {
18563 self._delegate = Some(new_value);
18564 self
18565 }
18566
18567 /// Set any additional parameter of the query string used in the request.
18568 /// It should be used to set parameters which are not yet available through their own
18569 /// setters.
18570 ///
18571 /// Please note that this method must not be used to set any of the known parameters
18572 /// which have their own setter method. If done anyway, the request will fail.
18573 ///
18574 /// # Additional Parameters
18575 ///
18576 /// * *$.xgafv* (query-string) - V1 error format.
18577 /// * *access_token* (query-string) - OAuth access token.
18578 /// * *alt* (query-string) - Data format for response.
18579 /// * *callback* (query-string) - JSONP
18580 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18581 /// * *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.
18582 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18583 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18584 /// * *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.
18585 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18586 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18587 pub fn param<T>(mut self, name: T, value: T) -> GenericobjectPatchCall<'a, C>
18588 where
18589 T: AsRef<str>,
18590 {
18591 self._additional_params
18592 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18593 self
18594 }
18595
18596 /// Identifies the authorization scope for the method you are building.
18597 ///
18598 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18599 /// [`Scope::WalletObjectIssuer`].
18600 ///
18601 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18602 /// tokens for more than one scope.
18603 ///
18604 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18605 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18606 /// sufficient, a read-write scope will do as well.
18607 pub fn add_scope<St>(mut self, scope: St) -> GenericobjectPatchCall<'a, C>
18608 where
18609 St: AsRef<str>,
18610 {
18611 self._scopes.insert(String::from(scope.as_ref()));
18612 self
18613 }
18614 /// Identifies the authorization scope(s) for the method you are building.
18615 ///
18616 /// See [`Self::add_scope()`] for details.
18617 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectPatchCall<'a, C>
18618 where
18619 I: IntoIterator<Item = St>,
18620 St: AsRef<str>,
18621 {
18622 self._scopes
18623 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18624 self
18625 }
18626
18627 /// Removes all scopes, and no default scope will be used either.
18628 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18629 /// for details).
18630 pub fn clear_scopes(mut self) -> GenericobjectPatchCall<'a, C> {
18631 self._scopes.clear();
18632 self
18633 }
18634}
18635
18636/// Updates the generic object referenced by the given object ID.
18637///
18638/// A builder for the *update* method supported by a *genericobject* resource.
18639/// It is not used directly, but through a [`GenericobjectMethods`] instance.
18640///
18641/// # Example
18642///
18643/// Instantiate a resource method builder
18644///
18645/// ```test_harness,no_run
18646/// # extern crate hyper;
18647/// # extern crate hyper_rustls;
18648/// # extern crate google_walletobjects1 as walletobjects1;
18649/// use walletobjects1::api::GenericObject;
18650/// # async fn dox() {
18651/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18652///
18653/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18654/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18655/// # secret,
18656/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18657/// # ).build().await.unwrap();
18658///
18659/// # let client = hyper_util::client::legacy::Client::builder(
18660/// # hyper_util::rt::TokioExecutor::new()
18661/// # )
18662/// # .build(
18663/// # hyper_rustls::HttpsConnectorBuilder::new()
18664/// # .with_native_roots()
18665/// # .unwrap()
18666/// # .https_or_http()
18667/// # .enable_http1()
18668/// # .build()
18669/// # );
18670/// # let mut hub = Walletobjects::new(client, auth);
18671/// // As the method needs a request, you would usually fill it with the desired information
18672/// // into the respective structure. Some of the parts shown here might not be applicable !
18673/// // Values shown here are possibly random and not representative !
18674/// let mut req = GenericObject::default();
18675///
18676/// // You can configure optional parameters by calling the respective setters at will, and
18677/// // execute the final call using `doit()`.
18678/// // Values shown here are possibly random and not representative !
18679/// let result = hub.genericobject().update(req, "resourceId")
18680/// .doit().await;
18681/// # }
18682/// ```
18683pub struct GenericobjectUpdateCall<'a, C>
18684where
18685 C: 'a,
18686{
18687 hub: &'a Walletobjects<C>,
18688 _request: GenericObject,
18689 _resource_id: String,
18690 _delegate: Option<&'a mut dyn common::Delegate>,
18691 _additional_params: HashMap<String, String>,
18692 _scopes: BTreeSet<String>,
18693}
18694
18695impl<'a, C> common::CallBuilder for GenericobjectUpdateCall<'a, C> {}
18696
18697impl<'a, C> GenericobjectUpdateCall<'a, C>
18698where
18699 C: common::Connector,
18700{
18701 /// Perform the operation you have build so far.
18702 pub async fn doit(mut self) -> common::Result<(common::Response, GenericObject)> {
18703 use std::borrow::Cow;
18704 use std::io::{Read, Seek};
18705
18706 use common::{url::Params, ToParts};
18707 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18708
18709 let mut dd = common::DefaultDelegate;
18710 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18711 dlg.begin(common::MethodInfo {
18712 id: "walletobjects.genericobject.update",
18713 http_method: hyper::Method::PUT,
18714 });
18715
18716 for &field in ["alt", "resourceId"].iter() {
18717 if self._additional_params.contains_key(field) {
18718 dlg.finished(false);
18719 return Err(common::Error::FieldClash(field));
18720 }
18721 }
18722
18723 let mut params = Params::with_capacity(4 + self._additional_params.len());
18724 params.push("resourceId", self._resource_id);
18725
18726 params.extend(self._additional_params.iter());
18727
18728 params.push("alt", "json");
18729 let mut url = self.hub._base_url.clone() + "walletobjects/v1/genericObject/{resourceId}";
18730 if self._scopes.is_empty() {
18731 self._scopes
18732 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
18733 }
18734
18735 #[allow(clippy::single_element_loop)]
18736 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
18737 url = params.uri_replacement(url, param_name, find_this, false);
18738 }
18739 {
18740 let to_remove = ["resourceId"];
18741 params.remove_params(&to_remove);
18742 }
18743
18744 let url = params.parse_with_url(&url);
18745
18746 let mut json_mime_type = mime::APPLICATION_JSON;
18747 let mut request_value_reader = {
18748 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18749 common::remove_json_null_values(&mut value);
18750 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18751 serde_json::to_writer(&mut dst, &value).unwrap();
18752 dst
18753 };
18754 let request_size = request_value_reader
18755 .seek(std::io::SeekFrom::End(0))
18756 .unwrap();
18757 request_value_reader
18758 .seek(std::io::SeekFrom::Start(0))
18759 .unwrap();
18760
18761 loop {
18762 let token = match self
18763 .hub
18764 .auth
18765 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18766 .await
18767 {
18768 Ok(token) => token,
18769 Err(e) => match dlg.token(e) {
18770 Ok(token) => token,
18771 Err(e) => {
18772 dlg.finished(false);
18773 return Err(common::Error::MissingToken(e));
18774 }
18775 },
18776 };
18777 request_value_reader
18778 .seek(std::io::SeekFrom::Start(0))
18779 .unwrap();
18780 let mut req_result = {
18781 let client = &self.hub.client;
18782 dlg.pre_request();
18783 let mut req_builder = hyper::Request::builder()
18784 .method(hyper::Method::PUT)
18785 .uri(url.as_str())
18786 .header(USER_AGENT, self.hub._user_agent.clone());
18787
18788 if let Some(token) = token.as_ref() {
18789 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18790 }
18791
18792 let request = req_builder
18793 .header(CONTENT_TYPE, json_mime_type.to_string())
18794 .header(CONTENT_LENGTH, request_size as u64)
18795 .body(common::to_body(
18796 request_value_reader.get_ref().clone().into(),
18797 ));
18798
18799 client.request(request.unwrap()).await
18800 };
18801
18802 match req_result {
18803 Err(err) => {
18804 if let common::Retry::After(d) = dlg.http_error(&err) {
18805 sleep(d).await;
18806 continue;
18807 }
18808 dlg.finished(false);
18809 return Err(common::Error::HttpError(err));
18810 }
18811 Ok(res) => {
18812 let (mut parts, body) = res.into_parts();
18813 let mut body = common::Body::new(body);
18814 if !parts.status.is_success() {
18815 let bytes = common::to_bytes(body).await.unwrap_or_default();
18816 let error = serde_json::from_str(&common::to_string(&bytes));
18817 let response = common::to_response(parts, bytes.into());
18818
18819 if let common::Retry::After(d) =
18820 dlg.http_failure(&response, error.as_ref().ok())
18821 {
18822 sleep(d).await;
18823 continue;
18824 }
18825
18826 dlg.finished(false);
18827
18828 return Err(match error {
18829 Ok(value) => common::Error::BadRequest(value),
18830 _ => common::Error::Failure(response),
18831 });
18832 }
18833 let response = {
18834 let bytes = common::to_bytes(body).await.unwrap_or_default();
18835 let encoded = common::to_string(&bytes);
18836 match serde_json::from_str(&encoded) {
18837 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18838 Err(error) => {
18839 dlg.response_json_decode_error(&encoded, &error);
18840 return Err(common::Error::JsonDecodeError(
18841 encoded.to_string(),
18842 error,
18843 ));
18844 }
18845 }
18846 };
18847
18848 dlg.finished(true);
18849 return Ok(response);
18850 }
18851 }
18852 }
18853 }
18854
18855 ///
18856 /// Sets the *request* property to the given value.
18857 ///
18858 /// Even though the property as already been set when instantiating this call,
18859 /// we provide this method for API completeness.
18860 pub fn request(mut self, new_value: GenericObject) -> GenericobjectUpdateCall<'a, C> {
18861 self._request = new_value;
18862 self
18863 }
18864 /// 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 `-`.
18865 ///
18866 /// Sets the *resource id* path property to the given value.
18867 ///
18868 /// Even though the property as already been set when instantiating this call,
18869 /// we provide this method for API completeness.
18870 pub fn resource_id(mut self, new_value: &str) -> GenericobjectUpdateCall<'a, C> {
18871 self._resource_id = new_value.to_string();
18872 self
18873 }
18874 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18875 /// while executing the actual API request.
18876 ///
18877 /// ````text
18878 /// It should be used to handle progress information, and to implement a certain level of resilience.
18879 /// ````
18880 ///
18881 /// Sets the *delegate* property to the given value.
18882 pub fn delegate(
18883 mut self,
18884 new_value: &'a mut dyn common::Delegate,
18885 ) -> GenericobjectUpdateCall<'a, C> {
18886 self._delegate = Some(new_value);
18887 self
18888 }
18889
18890 /// Set any additional parameter of the query string used in the request.
18891 /// It should be used to set parameters which are not yet available through their own
18892 /// setters.
18893 ///
18894 /// Please note that this method must not be used to set any of the known parameters
18895 /// which have their own setter method. If done anyway, the request will fail.
18896 ///
18897 /// # Additional Parameters
18898 ///
18899 /// * *$.xgafv* (query-string) - V1 error format.
18900 /// * *access_token* (query-string) - OAuth access token.
18901 /// * *alt* (query-string) - Data format for response.
18902 /// * *callback* (query-string) - JSONP
18903 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18904 /// * *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.
18905 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18906 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18907 /// * *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.
18908 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18909 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18910 pub fn param<T>(mut self, name: T, value: T) -> GenericobjectUpdateCall<'a, C>
18911 where
18912 T: AsRef<str>,
18913 {
18914 self._additional_params
18915 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18916 self
18917 }
18918
18919 /// Identifies the authorization scope for the method you are building.
18920 ///
18921 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18922 /// [`Scope::WalletObjectIssuer`].
18923 ///
18924 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18925 /// tokens for more than one scope.
18926 ///
18927 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18928 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18929 /// sufficient, a read-write scope will do as well.
18930 pub fn add_scope<St>(mut self, scope: St) -> GenericobjectUpdateCall<'a, C>
18931 where
18932 St: AsRef<str>,
18933 {
18934 self._scopes.insert(String::from(scope.as_ref()));
18935 self
18936 }
18937 /// Identifies the authorization scope(s) for the method you are building.
18938 ///
18939 /// See [`Self::add_scope()`] for details.
18940 pub fn add_scopes<I, St>(mut self, scopes: I) -> GenericobjectUpdateCall<'a, C>
18941 where
18942 I: IntoIterator<Item = St>,
18943 St: AsRef<str>,
18944 {
18945 self._scopes
18946 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18947 self
18948 }
18949
18950 /// Removes all scopes, and no default scope will be used either.
18951 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18952 /// for details).
18953 pub fn clear_scopes(mut self) -> GenericobjectUpdateCall<'a, C> {
18954 self._scopes.clear();
18955 self
18956 }
18957}
18958
18959/// Adds a message to the gift card class referenced by the given class ID.
18960///
18961/// A builder for the *addmessage* method supported by a *giftcardclas* resource.
18962/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
18963///
18964/// # Example
18965///
18966/// Instantiate a resource method builder
18967///
18968/// ```test_harness,no_run
18969/// # extern crate hyper;
18970/// # extern crate hyper_rustls;
18971/// # extern crate google_walletobjects1 as walletobjects1;
18972/// use walletobjects1::api::AddMessageRequest;
18973/// # async fn dox() {
18974/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18975///
18976/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18977/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18978/// # secret,
18979/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18980/// # ).build().await.unwrap();
18981///
18982/// # let client = hyper_util::client::legacy::Client::builder(
18983/// # hyper_util::rt::TokioExecutor::new()
18984/// # )
18985/// # .build(
18986/// # hyper_rustls::HttpsConnectorBuilder::new()
18987/// # .with_native_roots()
18988/// # .unwrap()
18989/// # .https_or_http()
18990/// # .enable_http1()
18991/// # .build()
18992/// # );
18993/// # let mut hub = Walletobjects::new(client, auth);
18994/// // As the method needs a request, you would usually fill it with the desired information
18995/// // into the respective structure. Some of the parts shown here might not be applicable !
18996/// // Values shown here are possibly random and not representative !
18997/// let mut req = AddMessageRequest::default();
18998///
18999/// // You can configure optional parameters by calling the respective setters at will, and
19000/// // execute the final call using `doit()`.
19001/// // Values shown here are possibly random and not representative !
19002/// let result = hub.giftcardclass().addmessage(req, "resourceId")
19003/// .doit().await;
19004/// # }
19005/// ```
19006pub struct GiftcardclasAddmessageCall<'a, C>
19007where
19008 C: 'a,
19009{
19010 hub: &'a Walletobjects<C>,
19011 _request: AddMessageRequest,
19012 _resource_id: String,
19013 _delegate: Option<&'a mut dyn common::Delegate>,
19014 _additional_params: HashMap<String, String>,
19015 _scopes: BTreeSet<String>,
19016}
19017
19018impl<'a, C> common::CallBuilder for GiftcardclasAddmessageCall<'a, C> {}
19019
19020impl<'a, C> GiftcardclasAddmessageCall<'a, C>
19021where
19022 C: common::Connector,
19023{
19024 /// Perform the operation you have build so far.
19025 pub async fn doit(
19026 mut self,
19027 ) -> common::Result<(common::Response, GiftCardClassAddMessageResponse)> {
19028 use std::borrow::Cow;
19029 use std::io::{Read, Seek};
19030
19031 use common::{url::Params, ToParts};
19032 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19033
19034 let mut dd = common::DefaultDelegate;
19035 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19036 dlg.begin(common::MethodInfo {
19037 id: "walletobjects.giftcardclass.addmessage",
19038 http_method: hyper::Method::POST,
19039 });
19040
19041 for &field in ["alt", "resourceId"].iter() {
19042 if self._additional_params.contains_key(field) {
19043 dlg.finished(false);
19044 return Err(common::Error::FieldClash(field));
19045 }
19046 }
19047
19048 let mut params = Params::with_capacity(4 + self._additional_params.len());
19049 params.push("resourceId", self._resource_id);
19050
19051 params.extend(self._additional_params.iter());
19052
19053 params.push("alt", "json");
19054 let mut url =
19055 self.hub._base_url.clone() + "walletobjects/v1/giftCardClass/{resourceId}/addMessage";
19056 if self._scopes.is_empty() {
19057 self._scopes
19058 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
19059 }
19060
19061 #[allow(clippy::single_element_loop)]
19062 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
19063 url = params.uri_replacement(url, param_name, find_this, false);
19064 }
19065 {
19066 let to_remove = ["resourceId"];
19067 params.remove_params(&to_remove);
19068 }
19069
19070 let url = params.parse_with_url(&url);
19071
19072 let mut json_mime_type = mime::APPLICATION_JSON;
19073 let mut request_value_reader = {
19074 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19075 common::remove_json_null_values(&mut value);
19076 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19077 serde_json::to_writer(&mut dst, &value).unwrap();
19078 dst
19079 };
19080 let request_size = request_value_reader
19081 .seek(std::io::SeekFrom::End(0))
19082 .unwrap();
19083 request_value_reader
19084 .seek(std::io::SeekFrom::Start(0))
19085 .unwrap();
19086
19087 loop {
19088 let token = match self
19089 .hub
19090 .auth
19091 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19092 .await
19093 {
19094 Ok(token) => token,
19095 Err(e) => match dlg.token(e) {
19096 Ok(token) => token,
19097 Err(e) => {
19098 dlg.finished(false);
19099 return Err(common::Error::MissingToken(e));
19100 }
19101 },
19102 };
19103 request_value_reader
19104 .seek(std::io::SeekFrom::Start(0))
19105 .unwrap();
19106 let mut req_result = {
19107 let client = &self.hub.client;
19108 dlg.pre_request();
19109 let mut req_builder = hyper::Request::builder()
19110 .method(hyper::Method::POST)
19111 .uri(url.as_str())
19112 .header(USER_AGENT, self.hub._user_agent.clone());
19113
19114 if let Some(token) = token.as_ref() {
19115 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19116 }
19117
19118 let request = req_builder
19119 .header(CONTENT_TYPE, json_mime_type.to_string())
19120 .header(CONTENT_LENGTH, request_size as u64)
19121 .body(common::to_body(
19122 request_value_reader.get_ref().clone().into(),
19123 ));
19124
19125 client.request(request.unwrap()).await
19126 };
19127
19128 match req_result {
19129 Err(err) => {
19130 if let common::Retry::After(d) = dlg.http_error(&err) {
19131 sleep(d).await;
19132 continue;
19133 }
19134 dlg.finished(false);
19135 return Err(common::Error::HttpError(err));
19136 }
19137 Ok(res) => {
19138 let (mut parts, body) = res.into_parts();
19139 let mut body = common::Body::new(body);
19140 if !parts.status.is_success() {
19141 let bytes = common::to_bytes(body).await.unwrap_or_default();
19142 let error = serde_json::from_str(&common::to_string(&bytes));
19143 let response = common::to_response(parts, bytes.into());
19144
19145 if let common::Retry::After(d) =
19146 dlg.http_failure(&response, error.as_ref().ok())
19147 {
19148 sleep(d).await;
19149 continue;
19150 }
19151
19152 dlg.finished(false);
19153
19154 return Err(match error {
19155 Ok(value) => common::Error::BadRequest(value),
19156 _ => common::Error::Failure(response),
19157 });
19158 }
19159 let response = {
19160 let bytes = common::to_bytes(body).await.unwrap_or_default();
19161 let encoded = common::to_string(&bytes);
19162 match serde_json::from_str(&encoded) {
19163 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19164 Err(error) => {
19165 dlg.response_json_decode_error(&encoded, &error);
19166 return Err(common::Error::JsonDecodeError(
19167 encoded.to_string(),
19168 error,
19169 ));
19170 }
19171 }
19172 };
19173
19174 dlg.finished(true);
19175 return Ok(response);
19176 }
19177 }
19178 }
19179 }
19180
19181 ///
19182 /// Sets the *request* property to the given value.
19183 ///
19184 /// Even though the property as already been set when instantiating this call,
19185 /// we provide this method for API completeness.
19186 pub fn request(mut self, new_value: AddMessageRequest) -> GiftcardclasAddmessageCall<'a, C> {
19187 self._request = new_value;
19188 self
19189 }
19190 /// 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 '-'.
19191 ///
19192 /// Sets the *resource id* path property to the given value.
19193 ///
19194 /// Even though the property as already been set when instantiating this call,
19195 /// we provide this method for API completeness.
19196 pub fn resource_id(mut self, new_value: &str) -> GiftcardclasAddmessageCall<'a, C> {
19197 self._resource_id = new_value.to_string();
19198 self
19199 }
19200 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19201 /// while executing the actual API request.
19202 ///
19203 /// ````text
19204 /// It should be used to handle progress information, and to implement a certain level of resilience.
19205 /// ````
19206 ///
19207 /// Sets the *delegate* property to the given value.
19208 pub fn delegate(
19209 mut self,
19210 new_value: &'a mut dyn common::Delegate,
19211 ) -> GiftcardclasAddmessageCall<'a, C> {
19212 self._delegate = Some(new_value);
19213 self
19214 }
19215
19216 /// Set any additional parameter of the query string used in the request.
19217 /// It should be used to set parameters which are not yet available through their own
19218 /// setters.
19219 ///
19220 /// Please note that this method must not be used to set any of the known parameters
19221 /// which have their own setter method. If done anyway, the request will fail.
19222 ///
19223 /// # Additional Parameters
19224 ///
19225 /// * *$.xgafv* (query-string) - V1 error format.
19226 /// * *access_token* (query-string) - OAuth access token.
19227 /// * *alt* (query-string) - Data format for response.
19228 /// * *callback* (query-string) - JSONP
19229 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19230 /// * *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.
19231 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19232 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19233 /// * *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.
19234 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19235 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19236 pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasAddmessageCall<'a, C>
19237 where
19238 T: AsRef<str>,
19239 {
19240 self._additional_params
19241 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19242 self
19243 }
19244
19245 /// Identifies the authorization scope for the method you are building.
19246 ///
19247 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19248 /// [`Scope::WalletObjectIssuer`].
19249 ///
19250 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19251 /// tokens for more than one scope.
19252 ///
19253 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19254 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19255 /// sufficient, a read-write scope will do as well.
19256 pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasAddmessageCall<'a, C>
19257 where
19258 St: AsRef<str>,
19259 {
19260 self._scopes.insert(String::from(scope.as_ref()));
19261 self
19262 }
19263 /// Identifies the authorization scope(s) for the method you are building.
19264 ///
19265 /// See [`Self::add_scope()`] for details.
19266 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasAddmessageCall<'a, C>
19267 where
19268 I: IntoIterator<Item = St>,
19269 St: AsRef<str>,
19270 {
19271 self._scopes
19272 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19273 self
19274 }
19275
19276 /// Removes all scopes, and no default scope will be used either.
19277 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19278 /// for details).
19279 pub fn clear_scopes(mut self) -> GiftcardclasAddmessageCall<'a, C> {
19280 self._scopes.clear();
19281 self
19282 }
19283}
19284
19285/// Returns the gift card class with the given class ID.
19286///
19287/// A builder for the *get* method supported by a *giftcardclas* resource.
19288/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
19289///
19290/// # Example
19291///
19292/// Instantiate a resource method builder
19293///
19294/// ```test_harness,no_run
19295/// # extern crate hyper;
19296/// # extern crate hyper_rustls;
19297/// # extern crate google_walletobjects1 as walletobjects1;
19298/// # async fn dox() {
19299/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19300///
19301/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19302/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19303/// # secret,
19304/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19305/// # ).build().await.unwrap();
19306///
19307/// # let client = hyper_util::client::legacy::Client::builder(
19308/// # hyper_util::rt::TokioExecutor::new()
19309/// # )
19310/// # .build(
19311/// # hyper_rustls::HttpsConnectorBuilder::new()
19312/// # .with_native_roots()
19313/// # .unwrap()
19314/// # .https_or_http()
19315/// # .enable_http1()
19316/// # .build()
19317/// # );
19318/// # let mut hub = Walletobjects::new(client, auth);
19319/// // You can configure optional parameters by calling the respective setters at will, and
19320/// // execute the final call using `doit()`.
19321/// // Values shown here are possibly random and not representative !
19322/// let result = hub.giftcardclass().get("resourceId")
19323/// .doit().await;
19324/// # }
19325/// ```
19326pub struct GiftcardclasGetCall<'a, C>
19327where
19328 C: 'a,
19329{
19330 hub: &'a Walletobjects<C>,
19331 _resource_id: String,
19332 _delegate: Option<&'a mut dyn common::Delegate>,
19333 _additional_params: HashMap<String, String>,
19334 _scopes: BTreeSet<String>,
19335}
19336
19337impl<'a, C> common::CallBuilder for GiftcardclasGetCall<'a, C> {}
19338
19339impl<'a, C> GiftcardclasGetCall<'a, C>
19340where
19341 C: common::Connector,
19342{
19343 /// Perform the operation you have build so far.
19344 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClass)> {
19345 use std::borrow::Cow;
19346 use std::io::{Read, Seek};
19347
19348 use common::{url::Params, ToParts};
19349 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19350
19351 let mut dd = common::DefaultDelegate;
19352 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19353 dlg.begin(common::MethodInfo {
19354 id: "walletobjects.giftcardclass.get",
19355 http_method: hyper::Method::GET,
19356 });
19357
19358 for &field in ["alt", "resourceId"].iter() {
19359 if self._additional_params.contains_key(field) {
19360 dlg.finished(false);
19361 return Err(common::Error::FieldClash(field));
19362 }
19363 }
19364
19365 let mut params = Params::with_capacity(3 + self._additional_params.len());
19366 params.push("resourceId", self._resource_id);
19367
19368 params.extend(self._additional_params.iter());
19369
19370 params.push("alt", "json");
19371 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass/{resourceId}";
19372 if self._scopes.is_empty() {
19373 self._scopes
19374 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
19375 }
19376
19377 #[allow(clippy::single_element_loop)]
19378 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
19379 url = params.uri_replacement(url, param_name, find_this, false);
19380 }
19381 {
19382 let to_remove = ["resourceId"];
19383 params.remove_params(&to_remove);
19384 }
19385
19386 let url = params.parse_with_url(&url);
19387
19388 loop {
19389 let token = match self
19390 .hub
19391 .auth
19392 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19393 .await
19394 {
19395 Ok(token) => token,
19396 Err(e) => match dlg.token(e) {
19397 Ok(token) => token,
19398 Err(e) => {
19399 dlg.finished(false);
19400 return Err(common::Error::MissingToken(e));
19401 }
19402 },
19403 };
19404 let mut req_result = {
19405 let client = &self.hub.client;
19406 dlg.pre_request();
19407 let mut req_builder = hyper::Request::builder()
19408 .method(hyper::Method::GET)
19409 .uri(url.as_str())
19410 .header(USER_AGENT, self.hub._user_agent.clone());
19411
19412 if let Some(token) = token.as_ref() {
19413 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19414 }
19415
19416 let request = req_builder
19417 .header(CONTENT_LENGTH, 0_u64)
19418 .body(common::to_body::<String>(None));
19419
19420 client.request(request.unwrap()).await
19421 };
19422
19423 match req_result {
19424 Err(err) => {
19425 if let common::Retry::After(d) = dlg.http_error(&err) {
19426 sleep(d).await;
19427 continue;
19428 }
19429 dlg.finished(false);
19430 return Err(common::Error::HttpError(err));
19431 }
19432 Ok(res) => {
19433 let (mut parts, body) = res.into_parts();
19434 let mut body = common::Body::new(body);
19435 if !parts.status.is_success() {
19436 let bytes = common::to_bytes(body).await.unwrap_or_default();
19437 let error = serde_json::from_str(&common::to_string(&bytes));
19438 let response = common::to_response(parts, bytes.into());
19439
19440 if let common::Retry::After(d) =
19441 dlg.http_failure(&response, error.as_ref().ok())
19442 {
19443 sleep(d).await;
19444 continue;
19445 }
19446
19447 dlg.finished(false);
19448
19449 return Err(match error {
19450 Ok(value) => common::Error::BadRequest(value),
19451 _ => common::Error::Failure(response),
19452 });
19453 }
19454 let response = {
19455 let bytes = common::to_bytes(body).await.unwrap_or_default();
19456 let encoded = common::to_string(&bytes);
19457 match serde_json::from_str(&encoded) {
19458 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19459 Err(error) => {
19460 dlg.response_json_decode_error(&encoded, &error);
19461 return Err(common::Error::JsonDecodeError(
19462 encoded.to_string(),
19463 error,
19464 ));
19465 }
19466 }
19467 };
19468
19469 dlg.finished(true);
19470 return Ok(response);
19471 }
19472 }
19473 }
19474 }
19475
19476 /// 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 '-'.
19477 ///
19478 /// Sets the *resource id* path property to the given value.
19479 ///
19480 /// Even though the property as already been set when instantiating this call,
19481 /// we provide this method for API completeness.
19482 pub fn resource_id(mut self, new_value: &str) -> GiftcardclasGetCall<'a, C> {
19483 self._resource_id = new_value.to_string();
19484 self
19485 }
19486 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19487 /// while executing the actual API request.
19488 ///
19489 /// ````text
19490 /// It should be used to handle progress information, and to implement a certain level of resilience.
19491 /// ````
19492 ///
19493 /// Sets the *delegate* property to the given value.
19494 pub fn delegate(
19495 mut self,
19496 new_value: &'a mut dyn common::Delegate,
19497 ) -> GiftcardclasGetCall<'a, C> {
19498 self._delegate = Some(new_value);
19499 self
19500 }
19501
19502 /// Set any additional parameter of the query string used in the request.
19503 /// It should be used to set parameters which are not yet available through their own
19504 /// setters.
19505 ///
19506 /// Please note that this method must not be used to set any of the known parameters
19507 /// which have their own setter method. If done anyway, the request will fail.
19508 ///
19509 /// # Additional Parameters
19510 ///
19511 /// * *$.xgafv* (query-string) - V1 error format.
19512 /// * *access_token* (query-string) - OAuth access token.
19513 /// * *alt* (query-string) - Data format for response.
19514 /// * *callback* (query-string) - JSONP
19515 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19516 /// * *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.
19517 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19518 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19519 /// * *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.
19520 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19521 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19522 pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasGetCall<'a, C>
19523 where
19524 T: AsRef<str>,
19525 {
19526 self._additional_params
19527 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19528 self
19529 }
19530
19531 /// Identifies the authorization scope for the method you are building.
19532 ///
19533 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19534 /// [`Scope::WalletObjectIssuer`].
19535 ///
19536 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19537 /// tokens for more than one scope.
19538 ///
19539 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19540 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19541 /// sufficient, a read-write scope will do as well.
19542 pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasGetCall<'a, C>
19543 where
19544 St: AsRef<str>,
19545 {
19546 self._scopes.insert(String::from(scope.as_ref()));
19547 self
19548 }
19549 /// Identifies the authorization scope(s) for the method you are building.
19550 ///
19551 /// See [`Self::add_scope()`] for details.
19552 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasGetCall<'a, C>
19553 where
19554 I: IntoIterator<Item = St>,
19555 St: AsRef<str>,
19556 {
19557 self._scopes
19558 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19559 self
19560 }
19561
19562 /// Removes all scopes, and no default scope will be used either.
19563 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19564 /// for details).
19565 pub fn clear_scopes(mut self) -> GiftcardclasGetCall<'a, C> {
19566 self._scopes.clear();
19567 self
19568 }
19569}
19570
19571/// Inserts an gift card class with the given ID and properties.
19572///
19573/// A builder for the *insert* method supported by a *giftcardclas* resource.
19574/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
19575///
19576/// # Example
19577///
19578/// Instantiate a resource method builder
19579///
19580/// ```test_harness,no_run
19581/// # extern crate hyper;
19582/// # extern crate hyper_rustls;
19583/// # extern crate google_walletobjects1 as walletobjects1;
19584/// use walletobjects1::api::GiftCardClass;
19585/// # async fn dox() {
19586/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19587///
19588/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19589/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19590/// # secret,
19591/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19592/// # ).build().await.unwrap();
19593///
19594/// # let client = hyper_util::client::legacy::Client::builder(
19595/// # hyper_util::rt::TokioExecutor::new()
19596/// # )
19597/// # .build(
19598/// # hyper_rustls::HttpsConnectorBuilder::new()
19599/// # .with_native_roots()
19600/// # .unwrap()
19601/// # .https_or_http()
19602/// # .enable_http1()
19603/// # .build()
19604/// # );
19605/// # let mut hub = Walletobjects::new(client, auth);
19606/// // As the method needs a request, you would usually fill it with the desired information
19607/// // into the respective structure. Some of the parts shown here might not be applicable !
19608/// // Values shown here are possibly random and not representative !
19609/// let mut req = GiftCardClass::default();
19610///
19611/// // You can configure optional parameters by calling the respective setters at will, and
19612/// // execute the final call using `doit()`.
19613/// // Values shown here are possibly random and not representative !
19614/// let result = hub.giftcardclass().insert(req)
19615/// .doit().await;
19616/// # }
19617/// ```
19618pub struct GiftcardclasInsertCall<'a, C>
19619where
19620 C: 'a,
19621{
19622 hub: &'a Walletobjects<C>,
19623 _request: GiftCardClass,
19624 _delegate: Option<&'a mut dyn common::Delegate>,
19625 _additional_params: HashMap<String, String>,
19626 _scopes: BTreeSet<String>,
19627}
19628
19629impl<'a, C> common::CallBuilder for GiftcardclasInsertCall<'a, C> {}
19630
19631impl<'a, C> GiftcardclasInsertCall<'a, C>
19632where
19633 C: common::Connector,
19634{
19635 /// Perform the operation you have build so far.
19636 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClass)> {
19637 use std::borrow::Cow;
19638 use std::io::{Read, Seek};
19639
19640 use common::{url::Params, ToParts};
19641 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19642
19643 let mut dd = common::DefaultDelegate;
19644 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19645 dlg.begin(common::MethodInfo {
19646 id: "walletobjects.giftcardclass.insert",
19647 http_method: hyper::Method::POST,
19648 });
19649
19650 for &field in ["alt"].iter() {
19651 if self._additional_params.contains_key(field) {
19652 dlg.finished(false);
19653 return Err(common::Error::FieldClash(field));
19654 }
19655 }
19656
19657 let mut params = Params::with_capacity(3 + self._additional_params.len());
19658
19659 params.extend(self._additional_params.iter());
19660
19661 params.push("alt", "json");
19662 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass";
19663 if self._scopes.is_empty() {
19664 self._scopes
19665 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
19666 }
19667
19668 let url = params.parse_with_url(&url);
19669
19670 let mut json_mime_type = mime::APPLICATION_JSON;
19671 let mut request_value_reader = {
19672 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19673 common::remove_json_null_values(&mut value);
19674 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19675 serde_json::to_writer(&mut dst, &value).unwrap();
19676 dst
19677 };
19678 let request_size = request_value_reader
19679 .seek(std::io::SeekFrom::End(0))
19680 .unwrap();
19681 request_value_reader
19682 .seek(std::io::SeekFrom::Start(0))
19683 .unwrap();
19684
19685 loop {
19686 let token = match self
19687 .hub
19688 .auth
19689 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19690 .await
19691 {
19692 Ok(token) => token,
19693 Err(e) => match dlg.token(e) {
19694 Ok(token) => token,
19695 Err(e) => {
19696 dlg.finished(false);
19697 return Err(common::Error::MissingToken(e));
19698 }
19699 },
19700 };
19701 request_value_reader
19702 .seek(std::io::SeekFrom::Start(0))
19703 .unwrap();
19704 let mut req_result = {
19705 let client = &self.hub.client;
19706 dlg.pre_request();
19707 let mut req_builder = hyper::Request::builder()
19708 .method(hyper::Method::POST)
19709 .uri(url.as_str())
19710 .header(USER_AGENT, self.hub._user_agent.clone());
19711
19712 if let Some(token) = token.as_ref() {
19713 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19714 }
19715
19716 let request = req_builder
19717 .header(CONTENT_TYPE, json_mime_type.to_string())
19718 .header(CONTENT_LENGTH, request_size as u64)
19719 .body(common::to_body(
19720 request_value_reader.get_ref().clone().into(),
19721 ));
19722
19723 client.request(request.unwrap()).await
19724 };
19725
19726 match req_result {
19727 Err(err) => {
19728 if let common::Retry::After(d) = dlg.http_error(&err) {
19729 sleep(d).await;
19730 continue;
19731 }
19732 dlg.finished(false);
19733 return Err(common::Error::HttpError(err));
19734 }
19735 Ok(res) => {
19736 let (mut parts, body) = res.into_parts();
19737 let mut body = common::Body::new(body);
19738 if !parts.status.is_success() {
19739 let bytes = common::to_bytes(body).await.unwrap_or_default();
19740 let error = serde_json::from_str(&common::to_string(&bytes));
19741 let response = common::to_response(parts, bytes.into());
19742
19743 if let common::Retry::After(d) =
19744 dlg.http_failure(&response, error.as_ref().ok())
19745 {
19746 sleep(d).await;
19747 continue;
19748 }
19749
19750 dlg.finished(false);
19751
19752 return Err(match error {
19753 Ok(value) => common::Error::BadRequest(value),
19754 _ => common::Error::Failure(response),
19755 });
19756 }
19757 let response = {
19758 let bytes = common::to_bytes(body).await.unwrap_or_default();
19759 let encoded = common::to_string(&bytes);
19760 match serde_json::from_str(&encoded) {
19761 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19762 Err(error) => {
19763 dlg.response_json_decode_error(&encoded, &error);
19764 return Err(common::Error::JsonDecodeError(
19765 encoded.to_string(),
19766 error,
19767 ));
19768 }
19769 }
19770 };
19771
19772 dlg.finished(true);
19773 return Ok(response);
19774 }
19775 }
19776 }
19777 }
19778
19779 ///
19780 /// Sets the *request* property to the given value.
19781 ///
19782 /// Even though the property as already been set when instantiating this call,
19783 /// we provide this method for API completeness.
19784 pub fn request(mut self, new_value: GiftCardClass) -> GiftcardclasInsertCall<'a, C> {
19785 self._request = new_value;
19786 self
19787 }
19788 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19789 /// while executing the actual API request.
19790 ///
19791 /// ````text
19792 /// It should be used to handle progress information, and to implement a certain level of resilience.
19793 /// ````
19794 ///
19795 /// Sets the *delegate* property to the given value.
19796 pub fn delegate(
19797 mut self,
19798 new_value: &'a mut dyn common::Delegate,
19799 ) -> GiftcardclasInsertCall<'a, C> {
19800 self._delegate = Some(new_value);
19801 self
19802 }
19803
19804 /// Set any additional parameter of the query string used in the request.
19805 /// It should be used to set parameters which are not yet available through their own
19806 /// setters.
19807 ///
19808 /// Please note that this method must not be used to set any of the known parameters
19809 /// which have their own setter method. If done anyway, the request will fail.
19810 ///
19811 /// # Additional Parameters
19812 ///
19813 /// * *$.xgafv* (query-string) - V1 error format.
19814 /// * *access_token* (query-string) - OAuth access token.
19815 /// * *alt* (query-string) - Data format for response.
19816 /// * *callback* (query-string) - JSONP
19817 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19818 /// * *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.
19819 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19820 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19821 /// * *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.
19822 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19823 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19824 pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasInsertCall<'a, C>
19825 where
19826 T: AsRef<str>,
19827 {
19828 self._additional_params
19829 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19830 self
19831 }
19832
19833 /// Identifies the authorization scope for the method you are building.
19834 ///
19835 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19836 /// [`Scope::WalletObjectIssuer`].
19837 ///
19838 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19839 /// tokens for more than one scope.
19840 ///
19841 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19842 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19843 /// sufficient, a read-write scope will do as well.
19844 pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasInsertCall<'a, C>
19845 where
19846 St: AsRef<str>,
19847 {
19848 self._scopes.insert(String::from(scope.as_ref()));
19849 self
19850 }
19851 /// Identifies the authorization scope(s) for the method you are building.
19852 ///
19853 /// See [`Self::add_scope()`] for details.
19854 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasInsertCall<'a, C>
19855 where
19856 I: IntoIterator<Item = St>,
19857 St: AsRef<str>,
19858 {
19859 self._scopes
19860 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19861 self
19862 }
19863
19864 /// Removes all scopes, and no default scope will be used either.
19865 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19866 /// for details).
19867 pub fn clear_scopes(mut self) -> GiftcardclasInsertCall<'a, C> {
19868 self._scopes.clear();
19869 self
19870 }
19871}
19872
19873/// Returns a list of all gift card classes for a given issuer ID.
19874///
19875/// A builder for the *list* method supported by a *giftcardclas* resource.
19876/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
19877///
19878/// # Example
19879///
19880/// Instantiate a resource method builder
19881///
19882/// ```test_harness,no_run
19883/// # extern crate hyper;
19884/// # extern crate hyper_rustls;
19885/// # extern crate google_walletobjects1 as walletobjects1;
19886/// # async fn dox() {
19887/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19888///
19889/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19890/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19891/// # secret,
19892/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19893/// # ).build().await.unwrap();
19894///
19895/// # let client = hyper_util::client::legacy::Client::builder(
19896/// # hyper_util::rt::TokioExecutor::new()
19897/// # )
19898/// # .build(
19899/// # hyper_rustls::HttpsConnectorBuilder::new()
19900/// # .with_native_roots()
19901/// # .unwrap()
19902/// # .https_or_http()
19903/// # .enable_http1()
19904/// # .build()
19905/// # );
19906/// # let mut hub = Walletobjects::new(client, auth);
19907/// // You can configure optional parameters by calling the respective setters at will, and
19908/// // execute the final call using `doit()`.
19909/// // Values shown here are possibly random and not representative !
19910/// let result = hub.giftcardclass().list()
19911/// .token("vero")
19912/// .max_results(-31)
19913/// .issuer_id(-93)
19914/// .doit().await;
19915/// # }
19916/// ```
19917pub struct GiftcardclasListCall<'a, C>
19918where
19919 C: 'a,
19920{
19921 hub: &'a Walletobjects<C>,
19922 _token: Option<String>,
19923 _max_results: Option<i32>,
19924 _issuer_id: Option<i64>,
19925 _delegate: Option<&'a mut dyn common::Delegate>,
19926 _additional_params: HashMap<String, String>,
19927 _scopes: BTreeSet<String>,
19928}
19929
19930impl<'a, C> common::CallBuilder for GiftcardclasListCall<'a, C> {}
19931
19932impl<'a, C> GiftcardclasListCall<'a, C>
19933where
19934 C: common::Connector,
19935{
19936 /// Perform the operation you have build so far.
19937 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClassListResponse)> {
19938 use std::borrow::Cow;
19939 use std::io::{Read, Seek};
19940
19941 use common::{url::Params, ToParts};
19942 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19943
19944 let mut dd = common::DefaultDelegate;
19945 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19946 dlg.begin(common::MethodInfo {
19947 id: "walletobjects.giftcardclass.list",
19948 http_method: hyper::Method::GET,
19949 });
19950
19951 for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
19952 if self._additional_params.contains_key(field) {
19953 dlg.finished(false);
19954 return Err(common::Error::FieldClash(field));
19955 }
19956 }
19957
19958 let mut params = Params::with_capacity(5 + self._additional_params.len());
19959 if let Some(value) = self._token.as_ref() {
19960 params.push("token", value);
19961 }
19962 if let Some(value) = self._max_results.as_ref() {
19963 params.push("maxResults", value.to_string());
19964 }
19965 if let Some(value) = self._issuer_id.as_ref() {
19966 params.push("issuerId", value.to_string());
19967 }
19968
19969 params.extend(self._additional_params.iter());
19970
19971 params.push("alt", "json");
19972 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass";
19973 if self._scopes.is_empty() {
19974 self._scopes
19975 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
19976 }
19977
19978 let url = params.parse_with_url(&url);
19979
19980 loop {
19981 let token = match self
19982 .hub
19983 .auth
19984 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19985 .await
19986 {
19987 Ok(token) => token,
19988 Err(e) => match dlg.token(e) {
19989 Ok(token) => token,
19990 Err(e) => {
19991 dlg.finished(false);
19992 return Err(common::Error::MissingToken(e));
19993 }
19994 },
19995 };
19996 let mut req_result = {
19997 let client = &self.hub.client;
19998 dlg.pre_request();
19999 let mut req_builder = hyper::Request::builder()
20000 .method(hyper::Method::GET)
20001 .uri(url.as_str())
20002 .header(USER_AGENT, self.hub._user_agent.clone());
20003
20004 if let Some(token) = token.as_ref() {
20005 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20006 }
20007
20008 let request = req_builder
20009 .header(CONTENT_LENGTH, 0_u64)
20010 .body(common::to_body::<String>(None));
20011
20012 client.request(request.unwrap()).await
20013 };
20014
20015 match req_result {
20016 Err(err) => {
20017 if let common::Retry::After(d) = dlg.http_error(&err) {
20018 sleep(d).await;
20019 continue;
20020 }
20021 dlg.finished(false);
20022 return Err(common::Error::HttpError(err));
20023 }
20024 Ok(res) => {
20025 let (mut parts, body) = res.into_parts();
20026 let mut body = common::Body::new(body);
20027 if !parts.status.is_success() {
20028 let bytes = common::to_bytes(body).await.unwrap_or_default();
20029 let error = serde_json::from_str(&common::to_string(&bytes));
20030 let response = common::to_response(parts, bytes.into());
20031
20032 if let common::Retry::After(d) =
20033 dlg.http_failure(&response, error.as_ref().ok())
20034 {
20035 sleep(d).await;
20036 continue;
20037 }
20038
20039 dlg.finished(false);
20040
20041 return Err(match error {
20042 Ok(value) => common::Error::BadRequest(value),
20043 _ => common::Error::Failure(response),
20044 });
20045 }
20046 let response = {
20047 let bytes = common::to_bytes(body).await.unwrap_or_default();
20048 let encoded = common::to_string(&bytes);
20049 match serde_json::from_str(&encoded) {
20050 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20051 Err(error) => {
20052 dlg.response_json_decode_error(&encoded, &error);
20053 return Err(common::Error::JsonDecodeError(
20054 encoded.to_string(),
20055 error,
20056 ));
20057 }
20058 }
20059 };
20060
20061 dlg.finished(true);
20062 return Ok(response);
20063 }
20064 }
20065 }
20066 }
20067
20068 /// 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.
20069 ///
20070 /// Sets the *token* query property to the given value.
20071 pub fn token(mut self, new_value: &str) -> GiftcardclasListCall<'a, C> {
20072 self._token = Some(new_value.to_string());
20073 self
20074 }
20075 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
20076 ///
20077 /// Sets the *max results* query property to the given value.
20078 pub fn max_results(mut self, new_value: i32) -> GiftcardclasListCall<'a, C> {
20079 self._max_results = Some(new_value);
20080 self
20081 }
20082 /// The ID of the issuer authorized to list classes.
20083 ///
20084 /// Sets the *issuer id* query property to the given value.
20085 pub fn issuer_id(mut self, new_value: i64) -> GiftcardclasListCall<'a, C> {
20086 self._issuer_id = Some(new_value);
20087 self
20088 }
20089 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20090 /// while executing the actual API request.
20091 ///
20092 /// ````text
20093 /// It should be used to handle progress information, and to implement a certain level of resilience.
20094 /// ````
20095 ///
20096 /// Sets the *delegate* property to the given value.
20097 pub fn delegate(
20098 mut self,
20099 new_value: &'a mut dyn common::Delegate,
20100 ) -> GiftcardclasListCall<'a, C> {
20101 self._delegate = Some(new_value);
20102 self
20103 }
20104
20105 /// Set any additional parameter of the query string used in the request.
20106 /// It should be used to set parameters which are not yet available through their own
20107 /// setters.
20108 ///
20109 /// Please note that this method must not be used to set any of the known parameters
20110 /// which have their own setter method. If done anyway, the request will fail.
20111 ///
20112 /// # Additional Parameters
20113 ///
20114 /// * *$.xgafv* (query-string) - V1 error format.
20115 /// * *access_token* (query-string) - OAuth access token.
20116 /// * *alt* (query-string) - Data format for response.
20117 /// * *callback* (query-string) - JSONP
20118 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20119 /// * *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.
20120 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20121 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20122 /// * *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.
20123 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20124 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20125 pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasListCall<'a, C>
20126 where
20127 T: AsRef<str>,
20128 {
20129 self._additional_params
20130 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20131 self
20132 }
20133
20134 /// Identifies the authorization scope for the method you are building.
20135 ///
20136 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20137 /// [`Scope::WalletObjectIssuer`].
20138 ///
20139 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20140 /// tokens for more than one scope.
20141 ///
20142 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20143 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20144 /// sufficient, a read-write scope will do as well.
20145 pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasListCall<'a, C>
20146 where
20147 St: AsRef<str>,
20148 {
20149 self._scopes.insert(String::from(scope.as_ref()));
20150 self
20151 }
20152 /// Identifies the authorization scope(s) for the method you are building.
20153 ///
20154 /// See [`Self::add_scope()`] for details.
20155 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasListCall<'a, C>
20156 where
20157 I: IntoIterator<Item = St>,
20158 St: AsRef<str>,
20159 {
20160 self._scopes
20161 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20162 self
20163 }
20164
20165 /// Removes all scopes, and no default scope will be used either.
20166 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20167 /// for details).
20168 pub fn clear_scopes(mut self) -> GiftcardclasListCall<'a, C> {
20169 self._scopes.clear();
20170 self
20171 }
20172}
20173
20174/// Updates the gift card class referenced by the given class ID. This method supports patch semantics.
20175///
20176/// A builder for the *patch* method supported by a *giftcardclas* resource.
20177/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
20178///
20179/// # Example
20180///
20181/// Instantiate a resource method builder
20182///
20183/// ```test_harness,no_run
20184/// # extern crate hyper;
20185/// # extern crate hyper_rustls;
20186/// # extern crate google_walletobjects1 as walletobjects1;
20187/// use walletobjects1::api::GiftCardClass;
20188/// # async fn dox() {
20189/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20190///
20191/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20192/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20193/// # secret,
20194/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20195/// # ).build().await.unwrap();
20196///
20197/// # let client = hyper_util::client::legacy::Client::builder(
20198/// # hyper_util::rt::TokioExecutor::new()
20199/// # )
20200/// # .build(
20201/// # hyper_rustls::HttpsConnectorBuilder::new()
20202/// # .with_native_roots()
20203/// # .unwrap()
20204/// # .https_or_http()
20205/// # .enable_http1()
20206/// # .build()
20207/// # );
20208/// # let mut hub = Walletobjects::new(client, auth);
20209/// // As the method needs a request, you would usually fill it with the desired information
20210/// // into the respective structure. Some of the parts shown here might not be applicable !
20211/// // Values shown here are possibly random and not representative !
20212/// let mut req = GiftCardClass::default();
20213///
20214/// // You can configure optional parameters by calling the respective setters at will, and
20215/// // execute the final call using `doit()`.
20216/// // Values shown here are possibly random and not representative !
20217/// let result = hub.giftcardclass().patch(req, "resourceId")
20218/// .doit().await;
20219/// # }
20220/// ```
20221pub struct GiftcardclasPatchCall<'a, C>
20222where
20223 C: 'a,
20224{
20225 hub: &'a Walletobjects<C>,
20226 _request: GiftCardClass,
20227 _resource_id: String,
20228 _delegate: Option<&'a mut dyn common::Delegate>,
20229 _additional_params: HashMap<String, String>,
20230 _scopes: BTreeSet<String>,
20231}
20232
20233impl<'a, C> common::CallBuilder for GiftcardclasPatchCall<'a, C> {}
20234
20235impl<'a, C> GiftcardclasPatchCall<'a, C>
20236where
20237 C: common::Connector,
20238{
20239 /// Perform the operation you have build so far.
20240 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClass)> {
20241 use std::borrow::Cow;
20242 use std::io::{Read, Seek};
20243
20244 use common::{url::Params, ToParts};
20245 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20246
20247 let mut dd = common::DefaultDelegate;
20248 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20249 dlg.begin(common::MethodInfo {
20250 id: "walletobjects.giftcardclass.patch",
20251 http_method: hyper::Method::PATCH,
20252 });
20253
20254 for &field in ["alt", "resourceId"].iter() {
20255 if self._additional_params.contains_key(field) {
20256 dlg.finished(false);
20257 return Err(common::Error::FieldClash(field));
20258 }
20259 }
20260
20261 let mut params = Params::with_capacity(4 + self._additional_params.len());
20262 params.push("resourceId", self._resource_id);
20263
20264 params.extend(self._additional_params.iter());
20265
20266 params.push("alt", "json");
20267 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass/{resourceId}";
20268 if self._scopes.is_empty() {
20269 self._scopes
20270 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
20271 }
20272
20273 #[allow(clippy::single_element_loop)]
20274 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
20275 url = params.uri_replacement(url, param_name, find_this, false);
20276 }
20277 {
20278 let to_remove = ["resourceId"];
20279 params.remove_params(&to_remove);
20280 }
20281
20282 let url = params.parse_with_url(&url);
20283
20284 let mut json_mime_type = mime::APPLICATION_JSON;
20285 let mut request_value_reader = {
20286 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20287 common::remove_json_null_values(&mut value);
20288 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20289 serde_json::to_writer(&mut dst, &value).unwrap();
20290 dst
20291 };
20292 let request_size = request_value_reader
20293 .seek(std::io::SeekFrom::End(0))
20294 .unwrap();
20295 request_value_reader
20296 .seek(std::io::SeekFrom::Start(0))
20297 .unwrap();
20298
20299 loop {
20300 let token = match self
20301 .hub
20302 .auth
20303 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20304 .await
20305 {
20306 Ok(token) => token,
20307 Err(e) => match dlg.token(e) {
20308 Ok(token) => token,
20309 Err(e) => {
20310 dlg.finished(false);
20311 return Err(common::Error::MissingToken(e));
20312 }
20313 },
20314 };
20315 request_value_reader
20316 .seek(std::io::SeekFrom::Start(0))
20317 .unwrap();
20318 let mut req_result = {
20319 let client = &self.hub.client;
20320 dlg.pre_request();
20321 let mut req_builder = hyper::Request::builder()
20322 .method(hyper::Method::PATCH)
20323 .uri(url.as_str())
20324 .header(USER_AGENT, self.hub._user_agent.clone());
20325
20326 if let Some(token) = token.as_ref() {
20327 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20328 }
20329
20330 let request = req_builder
20331 .header(CONTENT_TYPE, json_mime_type.to_string())
20332 .header(CONTENT_LENGTH, request_size as u64)
20333 .body(common::to_body(
20334 request_value_reader.get_ref().clone().into(),
20335 ));
20336
20337 client.request(request.unwrap()).await
20338 };
20339
20340 match req_result {
20341 Err(err) => {
20342 if let common::Retry::After(d) = dlg.http_error(&err) {
20343 sleep(d).await;
20344 continue;
20345 }
20346 dlg.finished(false);
20347 return Err(common::Error::HttpError(err));
20348 }
20349 Ok(res) => {
20350 let (mut parts, body) = res.into_parts();
20351 let mut body = common::Body::new(body);
20352 if !parts.status.is_success() {
20353 let bytes = common::to_bytes(body).await.unwrap_or_default();
20354 let error = serde_json::from_str(&common::to_string(&bytes));
20355 let response = common::to_response(parts, bytes.into());
20356
20357 if let common::Retry::After(d) =
20358 dlg.http_failure(&response, error.as_ref().ok())
20359 {
20360 sleep(d).await;
20361 continue;
20362 }
20363
20364 dlg.finished(false);
20365
20366 return Err(match error {
20367 Ok(value) => common::Error::BadRequest(value),
20368 _ => common::Error::Failure(response),
20369 });
20370 }
20371 let response = {
20372 let bytes = common::to_bytes(body).await.unwrap_or_default();
20373 let encoded = common::to_string(&bytes);
20374 match serde_json::from_str(&encoded) {
20375 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20376 Err(error) => {
20377 dlg.response_json_decode_error(&encoded, &error);
20378 return Err(common::Error::JsonDecodeError(
20379 encoded.to_string(),
20380 error,
20381 ));
20382 }
20383 }
20384 };
20385
20386 dlg.finished(true);
20387 return Ok(response);
20388 }
20389 }
20390 }
20391 }
20392
20393 ///
20394 /// Sets the *request* property to the given value.
20395 ///
20396 /// Even though the property as already been set when instantiating this call,
20397 /// we provide this method for API completeness.
20398 pub fn request(mut self, new_value: GiftCardClass) -> GiftcardclasPatchCall<'a, C> {
20399 self._request = new_value;
20400 self
20401 }
20402 /// 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 '-'.
20403 ///
20404 /// Sets the *resource id* path property to the given value.
20405 ///
20406 /// Even though the property as already been set when instantiating this call,
20407 /// we provide this method for API completeness.
20408 pub fn resource_id(mut self, new_value: &str) -> GiftcardclasPatchCall<'a, C> {
20409 self._resource_id = new_value.to_string();
20410 self
20411 }
20412 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20413 /// while executing the actual API request.
20414 ///
20415 /// ````text
20416 /// It should be used to handle progress information, and to implement a certain level of resilience.
20417 /// ````
20418 ///
20419 /// Sets the *delegate* property to the given value.
20420 pub fn delegate(
20421 mut self,
20422 new_value: &'a mut dyn common::Delegate,
20423 ) -> GiftcardclasPatchCall<'a, C> {
20424 self._delegate = Some(new_value);
20425 self
20426 }
20427
20428 /// Set any additional parameter of the query string used in the request.
20429 /// It should be used to set parameters which are not yet available through their own
20430 /// setters.
20431 ///
20432 /// Please note that this method must not be used to set any of the known parameters
20433 /// which have their own setter method. If done anyway, the request will fail.
20434 ///
20435 /// # Additional Parameters
20436 ///
20437 /// * *$.xgafv* (query-string) - V1 error format.
20438 /// * *access_token* (query-string) - OAuth access token.
20439 /// * *alt* (query-string) - Data format for response.
20440 /// * *callback* (query-string) - JSONP
20441 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20442 /// * *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.
20443 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20444 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20445 /// * *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.
20446 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20447 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20448 pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasPatchCall<'a, C>
20449 where
20450 T: AsRef<str>,
20451 {
20452 self._additional_params
20453 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20454 self
20455 }
20456
20457 /// Identifies the authorization scope for the method you are building.
20458 ///
20459 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20460 /// [`Scope::WalletObjectIssuer`].
20461 ///
20462 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20463 /// tokens for more than one scope.
20464 ///
20465 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20466 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20467 /// sufficient, a read-write scope will do as well.
20468 pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasPatchCall<'a, C>
20469 where
20470 St: AsRef<str>,
20471 {
20472 self._scopes.insert(String::from(scope.as_ref()));
20473 self
20474 }
20475 /// Identifies the authorization scope(s) for the method you are building.
20476 ///
20477 /// See [`Self::add_scope()`] for details.
20478 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasPatchCall<'a, C>
20479 where
20480 I: IntoIterator<Item = St>,
20481 St: AsRef<str>,
20482 {
20483 self._scopes
20484 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20485 self
20486 }
20487
20488 /// Removes all scopes, and no default scope will be used either.
20489 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20490 /// for details).
20491 pub fn clear_scopes(mut self) -> GiftcardclasPatchCall<'a, C> {
20492 self._scopes.clear();
20493 self
20494 }
20495}
20496
20497/// Updates the gift card class referenced by the given class ID.
20498///
20499/// A builder for the *update* method supported by a *giftcardclas* resource.
20500/// It is not used directly, but through a [`GiftcardclasMethods`] instance.
20501///
20502/// # Example
20503///
20504/// Instantiate a resource method builder
20505///
20506/// ```test_harness,no_run
20507/// # extern crate hyper;
20508/// # extern crate hyper_rustls;
20509/// # extern crate google_walletobjects1 as walletobjects1;
20510/// use walletobjects1::api::GiftCardClass;
20511/// # async fn dox() {
20512/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20513///
20514/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20515/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20516/// # secret,
20517/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20518/// # ).build().await.unwrap();
20519///
20520/// # let client = hyper_util::client::legacy::Client::builder(
20521/// # hyper_util::rt::TokioExecutor::new()
20522/// # )
20523/// # .build(
20524/// # hyper_rustls::HttpsConnectorBuilder::new()
20525/// # .with_native_roots()
20526/// # .unwrap()
20527/// # .https_or_http()
20528/// # .enable_http1()
20529/// # .build()
20530/// # );
20531/// # let mut hub = Walletobjects::new(client, auth);
20532/// // As the method needs a request, you would usually fill it with the desired information
20533/// // into the respective structure. Some of the parts shown here might not be applicable !
20534/// // Values shown here are possibly random and not representative !
20535/// let mut req = GiftCardClass::default();
20536///
20537/// // You can configure optional parameters by calling the respective setters at will, and
20538/// // execute the final call using `doit()`.
20539/// // Values shown here are possibly random and not representative !
20540/// let result = hub.giftcardclass().update(req, "resourceId")
20541/// .doit().await;
20542/// # }
20543/// ```
20544pub struct GiftcardclasUpdateCall<'a, C>
20545where
20546 C: 'a,
20547{
20548 hub: &'a Walletobjects<C>,
20549 _request: GiftCardClass,
20550 _resource_id: String,
20551 _delegate: Option<&'a mut dyn common::Delegate>,
20552 _additional_params: HashMap<String, String>,
20553 _scopes: BTreeSet<String>,
20554}
20555
20556impl<'a, C> common::CallBuilder for GiftcardclasUpdateCall<'a, C> {}
20557
20558impl<'a, C> GiftcardclasUpdateCall<'a, C>
20559where
20560 C: common::Connector,
20561{
20562 /// Perform the operation you have build so far.
20563 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardClass)> {
20564 use std::borrow::Cow;
20565 use std::io::{Read, Seek};
20566
20567 use common::{url::Params, ToParts};
20568 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20569
20570 let mut dd = common::DefaultDelegate;
20571 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20572 dlg.begin(common::MethodInfo {
20573 id: "walletobjects.giftcardclass.update",
20574 http_method: hyper::Method::PUT,
20575 });
20576
20577 for &field in ["alt", "resourceId"].iter() {
20578 if self._additional_params.contains_key(field) {
20579 dlg.finished(false);
20580 return Err(common::Error::FieldClash(field));
20581 }
20582 }
20583
20584 let mut params = Params::with_capacity(4 + self._additional_params.len());
20585 params.push("resourceId", self._resource_id);
20586
20587 params.extend(self._additional_params.iter());
20588
20589 params.push("alt", "json");
20590 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardClass/{resourceId}";
20591 if self._scopes.is_empty() {
20592 self._scopes
20593 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
20594 }
20595
20596 #[allow(clippy::single_element_loop)]
20597 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
20598 url = params.uri_replacement(url, param_name, find_this, false);
20599 }
20600 {
20601 let to_remove = ["resourceId"];
20602 params.remove_params(&to_remove);
20603 }
20604
20605 let url = params.parse_with_url(&url);
20606
20607 let mut json_mime_type = mime::APPLICATION_JSON;
20608 let mut request_value_reader = {
20609 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20610 common::remove_json_null_values(&mut value);
20611 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20612 serde_json::to_writer(&mut dst, &value).unwrap();
20613 dst
20614 };
20615 let request_size = request_value_reader
20616 .seek(std::io::SeekFrom::End(0))
20617 .unwrap();
20618 request_value_reader
20619 .seek(std::io::SeekFrom::Start(0))
20620 .unwrap();
20621
20622 loop {
20623 let token = match self
20624 .hub
20625 .auth
20626 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20627 .await
20628 {
20629 Ok(token) => token,
20630 Err(e) => match dlg.token(e) {
20631 Ok(token) => token,
20632 Err(e) => {
20633 dlg.finished(false);
20634 return Err(common::Error::MissingToken(e));
20635 }
20636 },
20637 };
20638 request_value_reader
20639 .seek(std::io::SeekFrom::Start(0))
20640 .unwrap();
20641 let mut req_result = {
20642 let client = &self.hub.client;
20643 dlg.pre_request();
20644 let mut req_builder = hyper::Request::builder()
20645 .method(hyper::Method::PUT)
20646 .uri(url.as_str())
20647 .header(USER_AGENT, self.hub._user_agent.clone());
20648
20649 if let Some(token) = token.as_ref() {
20650 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20651 }
20652
20653 let request = req_builder
20654 .header(CONTENT_TYPE, json_mime_type.to_string())
20655 .header(CONTENT_LENGTH, request_size as u64)
20656 .body(common::to_body(
20657 request_value_reader.get_ref().clone().into(),
20658 ));
20659
20660 client.request(request.unwrap()).await
20661 };
20662
20663 match req_result {
20664 Err(err) => {
20665 if let common::Retry::After(d) = dlg.http_error(&err) {
20666 sleep(d).await;
20667 continue;
20668 }
20669 dlg.finished(false);
20670 return Err(common::Error::HttpError(err));
20671 }
20672 Ok(res) => {
20673 let (mut parts, body) = res.into_parts();
20674 let mut body = common::Body::new(body);
20675 if !parts.status.is_success() {
20676 let bytes = common::to_bytes(body).await.unwrap_or_default();
20677 let error = serde_json::from_str(&common::to_string(&bytes));
20678 let response = common::to_response(parts, bytes.into());
20679
20680 if let common::Retry::After(d) =
20681 dlg.http_failure(&response, error.as_ref().ok())
20682 {
20683 sleep(d).await;
20684 continue;
20685 }
20686
20687 dlg.finished(false);
20688
20689 return Err(match error {
20690 Ok(value) => common::Error::BadRequest(value),
20691 _ => common::Error::Failure(response),
20692 });
20693 }
20694 let response = {
20695 let bytes = common::to_bytes(body).await.unwrap_or_default();
20696 let encoded = common::to_string(&bytes);
20697 match serde_json::from_str(&encoded) {
20698 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20699 Err(error) => {
20700 dlg.response_json_decode_error(&encoded, &error);
20701 return Err(common::Error::JsonDecodeError(
20702 encoded.to_string(),
20703 error,
20704 ));
20705 }
20706 }
20707 };
20708
20709 dlg.finished(true);
20710 return Ok(response);
20711 }
20712 }
20713 }
20714 }
20715
20716 ///
20717 /// Sets the *request* property to the given value.
20718 ///
20719 /// Even though the property as already been set when instantiating this call,
20720 /// we provide this method for API completeness.
20721 pub fn request(mut self, new_value: GiftCardClass) -> GiftcardclasUpdateCall<'a, C> {
20722 self._request = new_value;
20723 self
20724 }
20725 /// 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 '-'.
20726 ///
20727 /// Sets the *resource id* path property to the given value.
20728 ///
20729 /// Even though the property as already been set when instantiating this call,
20730 /// we provide this method for API completeness.
20731 pub fn resource_id(mut self, new_value: &str) -> GiftcardclasUpdateCall<'a, C> {
20732 self._resource_id = new_value.to_string();
20733 self
20734 }
20735 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20736 /// while executing the actual API request.
20737 ///
20738 /// ````text
20739 /// It should be used to handle progress information, and to implement a certain level of resilience.
20740 /// ````
20741 ///
20742 /// Sets the *delegate* property to the given value.
20743 pub fn delegate(
20744 mut self,
20745 new_value: &'a mut dyn common::Delegate,
20746 ) -> GiftcardclasUpdateCall<'a, C> {
20747 self._delegate = Some(new_value);
20748 self
20749 }
20750
20751 /// Set any additional parameter of the query string used in the request.
20752 /// It should be used to set parameters which are not yet available through their own
20753 /// setters.
20754 ///
20755 /// Please note that this method must not be used to set any of the known parameters
20756 /// which have their own setter method. If done anyway, the request will fail.
20757 ///
20758 /// # Additional Parameters
20759 ///
20760 /// * *$.xgafv* (query-string) - V1 error format.
20761 /// * *access_token* (query-string) - OAuth access token.
20762 /// * *alt* (query-string) - Data format for response.
20763 /// * *callback* (query-string) - JSONP
20764 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20765 /// * *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.
20766 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20767 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20768 /// * *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.
20769 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20770 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20771 pub fn param<T>(mut self, name: T, value: T) -> GiftcardclasUpdateCall<'a, C>
20772 where
20773 T: AsRef<str>,
20774 {
20775 self._additional_params
20776 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20777 self
20778 }
20779
20780 /// Identifies the authorization scope for the method you are building.
20781 ///
20782 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20783 /// [`Scope::WalletObjectIssuer`].
20784 ///
20785 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20786 /// tokens for more than one scope.
20787 ///
20788 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20789 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20790 /// sufficient, a read-write scope will do as well.
20791 pub fn add_scope<St>(mut self, scope: St) -> GiftcardclasUpdateCall<'a, C>
20792 where
20793 St: AsRef<str>,
20794 {
20795 self._scopes.insert(String::from(scope.as_ref()));
20796 self
20797 }
20798 /// Identifies the authorization scope(s) for the method you are building.
20799 ///
20800 /// See [`Self::add_scope()`] for details.
20801 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardclasUpdateCall<'a, C>
20802 where
20803 I: IntoIterator<Item = St>,
20804 St: AsRef<str>,
20805 {
20806 self._scopes
20807 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20808 self
20809 }
20810
20811 /// Removes all scopes, and no default scope will be used either.
20812 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20813 /// for details).
20814 pub fn clear_scopes(mut self) -> GiftcardclasUpdateCall<'a, C> {
20815 self._scopes.clear();
20816 self
20817 }
20818}
20819
20820/// Adds a message to the gift card object referenced by the given object ID.
20821///
20822/// A builder for the *addmessage* method supported by a *giftcardobject* resource.
20823/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
20824///
20825/// # Example
20826///
20827/// Instantiate a resource method builder
20828///
20829/// ```test_harness,no_run
20830/// # extern crate hyper;
20831/// # extern crate hyper_rustls;
20832/// # extern crate google_walletobjects1 as walletobjects1;
20833/// use walletobjects1::api::AddMessageRequest;
20834/// # async fn dox() {
20835/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20836///
20837/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20838/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20839/// # secret,
20840/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20841/// # ).build().await.unwrap();
20842///
20843/// # let client = hyper_util::client::legacy::Client::builder(
20844/// # hyper_util::rt::TokioExecutor::new()
20845/// # )
20846/// # .build(
20847/// # hyper_rustls::HttpsConnectorBuilder::new()
20848/// # .with_native_roots()
20849/// # .unwrap()
20850/// # .https_or_http()
20851/// # .enable_http1()
20852/// # .build()
20853/// # );
20854/// # let mut hub = Walletobjects::new(client, auth);
20855/// // As the method needs a request, you would usually fill it with the desired information
20856/// // into the respective structure. Some of the parts shown here might not be applicable !
20857/// // Values shown here are possibly random and not representative !
20858/// let mut req = AddMessageRequest::default();
20859///
20860/// // You can configure optional parameters by calling the respective setters at will, and
20861/// // execute the final call using `doit()`.
20862/// // Values shown here are possibly random and not representative !
20863/// let result = hub.giftcardobject().addmessage(req, "resourceId")
20864/// .doit().await;
20865/// # }
20866/// ```
20867pub struct GiftcardobjectAddmessageCall<'a, C>
20868where
20869 C: 'a,
20870{
20871 hub: &'a Walletobjects<C>,
20872 _request: AddMessageRequest,
20873 _resource_id: String,
20874 _delegate: Option<&'a mut dyn common::Delegate>,
20875 _additional_params: HashMap<String, String>,
20876 _scopes: BTreeSet<String>,
20877}
20878
20879impl<'a, C> common::CallBuilder for GiftcardobjectAddmessageCall<'a, C> {}
20880
20881impl<'a, C> GiftcardobjectAddmessageCall<'a, C>
20882where
20883 C: common::Connector,
20884{
20885 /// Perform the operation you have build so far.
20886 pub async fn doit(
20887 mut self,
20888 ) -> common::Result<(common::Response, GiftCardObjectAddMessageResponse)> {
20889 use std::borrow::Cow;
20890 use std::io::{Read, Seek};
20891
20892 use common::{url::Params, ToParts};
20893 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20894
20895 let mut dd = common::DefaultDelegate;
20896 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20897 dlg.begin(common::MethodInfo {
20898 id: "walletobjects.giftcardobject.addmessage",
20899 http_method: hyper::Method::POST,
20900 });
20901
20902 for &field in ["alt", "resourceId"].iter() {
20903 if self._additional_params.contains_key(field) {
20904 dlg.finished(false);
20905 return Err(common::Error::FieldClash(field));
20906 }
20907 }
20908
20909 let mut params = Params::with_capacity(4 + self._additional_params.len());
20910 params.push("resourceId", self._resource_id);
20911
20912 params.extend(self._additional_params.iter());
20913
20914 params.push("alt", "json");
20915 let mut url =
20916 self.hub._base_url.clone() + "walletobjects/v1/giftCardObject/{resourceId}/addMessage";
20917 if self._scopes.is_empty() {
20918 self._scopes
20919 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
20920 }
20921
20922 #[allow(clippy::single_element_loop)]
20923 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
20924 url = params.uri_replacement(url, param_name, find_this, false);
20925 }
20926 {
20927 let to_remove = ["resourceId"];
20928 params.remove_params(&to_remove);
20929 }
20930
20931 let url = params.parse_with_url(&url);
20932
20933 let mut json_mime_type = mime::APPLICATION_JSON;
20934 let mut request_value_reader = {
20935 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20936 common::remove_json_null_values(&mut value);
20937 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20938 serde_json::to_writer(&mut dst, &value).unwrap();
20939 dst
20940 };
20941 let request_size = request_value_reader
20942 .seek(std::io::SeekFrom::End(0))
20943 .unwrap();
20944 request_value_reader
20945 .seek(std::io::SeekFrom::Start(0))
20946 .unwrap();
20947
20948 loop {
20949 let token = match self
20950 .hub
20951 .auth
20952 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20953 .await
20954 {
20955 Ok(token) => token,
20956 Err(e) => match dlg.token(e) {
20957 Ok(token) => token,
20958 Err(e) => {
20959 dlg.finished(false);
20960 return Err(common::Error::MissingToken(e));
20961 }
20962 },
20963 };
20964 request_value_reader
20965 .seek(std::io::SeekFrom::Start(0))
20966 .unwrap();
20967 let mut req_result = {
20968 let client = &self.hub.client;
20969 dlg.pre_request();
20970 let mut req_builder = hyper::Request::builder()
20971 .method(hyper::Method::POST)
20972 .uri(url.as_str())
20973 .header(USER_AGENT, self.hub._user_agent.clone());
20974
20975 if let Some(token) = token.as_ref() {
20976 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20977 }
20978
20979 let request = req_builder
20980 .header(CONTENT_TYPE, json_mime_type.to_string())
20981 .header(CONTENT_LENGTH, request_size as u64)
20982 .body(common::to_body(
20983 request_value_reader.get_ref().clone().into(),
20984 ));
20985
20986 client.request(request.unwrap()).await
20987 };
20988
20989 match req_result {
20990 Err(err) => {
20991 if let common::Retry::After(d) = dlg.http_error(&err) {
20992 sleep(d).await;
20993 continue;
20994 }
20995 dlg.finished(false);
20996 return Err(common::Error::HttpError(err));
20997 }
20998 Ok(res) => {
20999 let (mut parts, body) = res.into_parts();
21000 let mut body = common::Body::new(body);
21001 if !parts.status.is_success() {
21002 let bytes = common::to_bytes(body).await.unwrap_or_default();
21003 let error = serde_json::from_str(&common::to_string(&bytes));
21004 let response = common::to_response(parts, bytes.into());
21005
21006 if let common::Retry::After(d) =
21007 dlg.http_failure(&response, error.as_ref().ok())
21008 {
21009 sleep(d).await;
21010 continue;
21011 }
21012
21013 dlg.finished(false);
21014
21015 return Err(match error {
21016 Ok(value) => common::Error::BadRequest(value),
21017 _ => common::Error::Failure(response),
21018 });
21019 }
21020 let response = {
21021 let bytes = common::to_bytes(body).await.unwrap_or_default();
21022 let encoded = common::to_string(&bytes);
21023 match serde_json::from_str(&encoded) {
21024 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21025 Err(error) => {
21026 dlg.response_json_decode_error(&encoded, &error);
21027 return Err(common::Error::JsonDecodeError(
21028 encoded.to_string(),
21029 error,
21030 ));
21031 }
21032 }
21033 };
21034
21035 dlg.finished(true);
21036 return Ok(response);
21037 }
21038 }
21039 }
21040 }
21041
21042 ///
21043 /// Sets the *request* property to the given value.
21044 ///
21045 /// Even though the property as already been set when instantiating this call,
21046 /// we provide this method for API completeness.
21047 pub fn request(mut self, new_value: AddMessageRequest) -> GiftcardobjectAddmessageCall<'a, C> {
21048 self._request = new_value;
21049 self
21050 }
21051 /// 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 '-'.
21052 ///
21053 /// Sets the *resource id* path property to the given value.
21054 ///
21055 /// Even though the property as already been set when instantiating this call,
21056 /// we provide this method for API completeness.
21057 pub fn resource_id(mut self, new_value: &str) -> GiftcardobjectAddmessageCall<'a, C> {
21058 self._resource_id = new_value.to_string();
21059 self
21060 }
21061 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21062 /// while executing the actual API request.
21063 ///
21064 /// ````text
21065 /// It should be used to handle progress information, and to implement a certain level of resilience.
21066 /// ````
21067 ///
21068 /// Sets the *delegate* property to the given value.
21069 pub fn delegate(
21070 mut self,
21071 new_value: &'a mut dyn common::Delegate,
21072 ) -> GiftcardobjectAddmessageCall<'a, C> {
21073 self._delegate = Some(new_value);
21074 self
21075 }
21076
21077 /// Set any additional parameter of the query string used in the request.
21078 /// It should be used to set parameters which are not yet available through their own
21079 /// setters.
21080 ///
21081 /// Please note that this method must not be used to set any of the known parameters
21082 /// which have their own setter method. If done anyway, the request will fail.
21083 ///
21084 /// # Additional Parameters
21085 ///
21086 /// * *$.xgafv* (query-string) - V1 error format.
21087 /// * *access_token* (query-string) - OAuth access token.
21088 /// * *alt* (query-string) - Data format for response.
21089 /// * *callback* (query-string) - JSONP
21090 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21091 /// * *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.
21092 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21093 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21094 /// * *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.
21095 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21096 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21097 pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectAddmessageCall<'a, C>
21098 where
21099 T: AsRef<str>,
21100 {
21101 self._additional_params
21102 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21103 self
21104 }
21105
21106 /// Identifies the authorization scope for the method you are building.
21107 ///
21108 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21109 /// [`Scope::WalletObjectIssuer`].
21110 ///
21111 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21112 /// tokens for more than one scope.
21113 ///
21114 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21115 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21116 /// sufficient, a read-write scope will do as well.
21117 pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectAddmessageCall<'a, C>
21118 where
21119 St: AsRef<str>,
21120 {
21121 self._scopes.insert(String::from(scope.as_ref()));
21122 self
21123 }
21124 /// Identifies the authorization scope(s) for the method you are building.
21125 ///
21126 /// See [`Self::add_scope()`] for details.
21127 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectAddmessageCall<'a, C>
21128 where
21129 I: IntoIterator<Item = St>,
21130 St: AsRef<str>,
21131 {
21132 self._scopes
21133 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21134 self
21135 }
21136
21137 /// Removes all scopes, and no default scope will be used either.
21138 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21139 /// for details).
21140 pub fn clear_scopes(mut self) -> GiftcardobjectAddmessageCall<'a, C> {
21141 self._scopes.clear();
21142 self
21143 }
21144}
21145
21146/// Returns the gift card object with the given object ID.
21147///
21148/// A builder for the *get* method supported by a *giftcardobject* resource.
21149/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
21150///
21151/// # Example
21152///
21153/// Instantiate a resource method builder
21154///
21155/// ```test_harness,no_run
21156/// # extern crate hyper;
21157/// # extern crate hyper_rustls;
21158/// # extern crate google_walletobjects1 as walletobjects1;
21159/// # async fn dox() {
21160/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21161///
21162/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21163/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21164/// # secret,
21165/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21166/// # ).build().await.unwrap();
21167///
21168/// # let client = hyper_util::client::legacy::Client::builder(
21169/// # hyper_util::rt::TokioExecutor::new()
21170/// # )
21171/// # .build(
21172/// # hyper_rustls::HttpsConnectorBuilder::new()
21173/// # .with_native_roots()
21174/// # .unwrap()
21175/// # .https_or_http()
21176/// # .enable_http1()
21177/// # .build()
21178/// # );
21179/// # let mut hub = Walletobjects::new(client, auth);
21180/// // You can configure optional parameters by calling the respective setters at will, and
21181/// // execute the final call using `doit()`.
21182/// // Values shown here are possibly random and not representative !
21183/// let result = hub.giftcardobject().get("resourceId")
21184/// .doit().await;
21185/// # }
21186/// ```
21187pub struct GiftcardobjectGetCall<'a, C>
21188where
21189 C: 'a,
21190{
21191 hub: &'a Walletobjects<C>,
21192 _resource_id: String,
21193 _delegate: Option<&'a mut dyn common::Delegate>,
21194 _additional_params: HashMap<String, String>,
21195 _scopes: BTreeSet<String>,
21196}
21197
21198impl<'a, C> common::CallBuilder for GiftcardobjectGetCall<'a, C> {}
21199
21200impl<'a, C> GiftcardobjectGetCall<'a, C>
21201where
21202 C: common::Connector,
21203{
21204 /// Perform the operation you have build so far.
21205 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObject)> {
21206 use std::borrow::Cow;
21207 use std::io::{Read, Seek};
21208
21209 use common::{url::Params, ToParts};
21210 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21211
21212 let mut dd = common::DefaultDelegate;
21213 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21214 dlg.begin(common::MethodInfo {
21215 id: "walletobjects.giftcardobject.get",
21216 http_method: hyper::Method::GET,
21217 });
21218
21219 for &field in ["alt", "resourceId"].iter() {
21220 if self._additional_params.contains_key(field) {
21221 dlg.finished(false);
21222 return Err(common::Error::FieldClash(field));
21223 }
21224 }
21225
21226 let mut params = Params::with_capacity(3 + self._additional_params.len());
21227 params.push("resourceId", self._resource_id);
21228
21229 params.extend(self._additional_params.iter());
21230
21231 params.push("alt", "json");
21232 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject/{resourceId}";
21233 if self._scopes.is_empty() {
21234 self._scopes
21235 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
21236 }
21237
21238 #[allow(clippy::single_element_loop)]
21239 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
21240 url = params.uri_replacement(url, param_name, find_this, false);
21241 }
21242 {
21243 let to_remove = ["resourceId"];
21244 params.remove_params(&to_remove);
21245 }
21246
21247 let url = params.parse_with_url(&url);
21248
21249 loop {
21250 let token = match self
21251 .hub
21252 .auth
21253 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21254 .await
21255 {
21256 Ok(token) => token,
21257 Err(e) => match dlg.token(e) {
21258 Ok(token) => token,
21259 Err(e) => {
21260 dlg.finished(false);
21261 return Err(common::Error::MissingToken(e));
21262 }
21263 },
21264 };
21265 let mut req_result = {
21266 let client = &self.hub.client;
21267 dlg.pre_request();
21268 let mut req_builder = hyper::Request::builder()
21269 .method(hyper::Method::GET)
21270 .uri(url.as_str())
21271 .header(USER_AGENT, self.hub._user_agent.clone());
21272
21273 if let Some(token) = token.as_ref() {
21274 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21275 }
21276
21277 let request = req_builder
21278 .header(CONTENT_LENGTH, 0_u64)
21279 .body(common::to_body::<String>(None));
21280
21281 client.request(request.unwrap()).await
21282 };
21283
21284 match req_result {
21285 Err(err) => {
21286 if let common::Retry::After(d) = dlg.http_error(&err) {
21287 sleep(d).await;
21288 continue;
21289 }
21290 dlg.finished(false);
21291 return Err(common::Error::HttpError(err));
21292 }
21293 Ok(res) => {
21294 let (mut parts, body) = res.into_parts();
21295 let mut body = common::Body::new(body);
21296 if !parts.status.is_success() {
21297 let bytes = common::to_bytes(body).await.unwrap_or_default();
21298 let error = serde_json::from_str(&common::to_string(&bytes));
21299 let response = common::to_response(parts, bytes.into());
21300
21301 if let common::Retry::After(d) =
21302 dlg.http_failure(&response, error.as_ref().ok())
21303 {
21304 sleep(d).await;
21305 continue;
21306 }
21307
21308 dlg.finished(false);
21309
21310 return Err(match error {
21311 Ok(value) => common::Error::BadRequest(value),
21312 _ => common::Error::Failure(response),
21313 });
21314 }
21315 let response = {
21316 let bytes = common::to_bytes(body).await.unwrap_or_default();
21317 let encoded = common::to_string(&bytes);
21318 match serde_json::from_str(&encoded) {
21319 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21320 Err(error) => {
21321 dlg.response_json_decode_error(&encoded, &error);
21322 return Err(common::Error::JsonDecodeError(
21323 encoded.to_string(),
21324 error,
21325 ));
21326 }
21327 }
21328 };
21329
21330 dlg.finished(true);
21331 return Ok(response);
21332 }
21333 }
21334 }
21335 }
21336
21337 /// 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 '-'.
21338 ///
21339 /// Sets the *resource id* path property to the given value.
21340 ///
21341 /// Even though the property as already been set when instantiating this call,
21342 /// we provide this method for API completeness.
21343 pub fn resource_id(mut self, new_value: &str) -> GiftcardobjectGetCall<'a, C> {
21344 self._resource_id = new_value.to_string();
21345 self
21346 }
21347 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21348 /// while executing the actual API request.
21349 ///
21350 /// ````text
21351 /// It should be used to handle progress information, and to implement a certain level of resilience.
21352 /// ````
21353 ///
21354 /// Sets the *delegate* property to the given value.
21355 pub fn delegate(
21356 mut self,
21357 new_value: &'a mut dyn common::Delegate,
21358 ) -> GiftcardobjectGetCall<'a, C> {
21359 self._delegate = Some(new_value);
21360 self
21361 }
21362
21363 /// Set any additional parameter of the query string used in the request.
21364 /// It should be used to set parameters which are not yet available through their own
21365 /// setters.
21366 ///
21367 /// Please note that this method must not be used to set any of the known parameters
21368 /// which have their own setter method. If done anyway, the request will fail.
21369 ///
21370 /// # Additional Parameters
21371 ///
21372 /// * *$.xgafv* (query-string) - V1 error format.
21373 /// * *access_token* (query-string) - OAuth access token.
21374 /// * *alt* (query-string) - Data format for response.
21375 /// * *callback* (query-string) - JSONP
21376 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21377 /// * *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.
21378 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21379 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21380 /// * *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.
21381 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21382 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21383 pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectGetCall<'a, C>
21384 where
21385 T: AsRef<str>,
21386 {
21387 self._additional_params
21388 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21389 self
21390 }
21391
21392 /// Identifies the authorization scope for the method you are building.
21393 ///
21394 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21395 /// [`Scope::WalletObjectIssuer`].
21396 ///
21397 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21398 /// tokens for more than one scope.
21399 ///
21400 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21401 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21402 /// sufficient, a read-write scope will do as well.
21403 pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectGetCall<'a, C>
21404 where
21405 St: AsRef<str>,
21406 {
21407 self._scopes.insert(String::from(scope.as_ref()));
21408 self
21409 }
21410 /// Identifies the authorization scope(s) for the method you are building.
21411 ///
21412 /// See [`Self::add_scope()`] for details.
21413 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectGetCall<'a, C>
21414 where
21415 I: IntoIterator<Item = St>,
21416 St: AsRef<str>,
21417 {
21418 self._scopes
21419 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21420 self
21421 }
21422
21423 /// Removes all scopes, and no default scope will be used either.
21424 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21425 /// for details).
21426 pub fn clear_scopes(mut self) -> GiftcardobjectGetCall<'a, C> {
21427 self._scopes.clear();
21428 self
21429 }
21430}
21431
21432/// Inserts an gift card object with the given ID and properties.
21433///
21434/// A builder for the *insert* method supported by a *giftcardobject* resource.
21435/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
21436///
21437/// # Example
21438///
21439/// Instantiate a resource method builder
21440///
21441/// ```test_harness,no_run
21442/// # extern crate hyper;
21443/// # extern crate hyper_rustls;
21444/// # extern crate google_walletobjects1 as walletobjects1;
21445/// use walletobjects1::api::GiftCardObject;
21446/// # async fn dox() {
21447/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21448///
21449/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21450/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21451/// # secret,
21452/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21453/// # ).build().await.unwrap();
21454///
21455/// # let client = hyper_util::client::legacy::Client::builder(
21456/// # hyper_util::rt::TokioExecutor::new()
21457/// # )
21458/// # .build(
21459/// # hyper_rustls::HttpsConnectorBuilder::new()
21460/// # .with_native_roots()
21461/// # .unwrap()
21462/// # .https_or_http()
21463/// # .enable_http1()
21464/// # .build()
21465/// # );
21466/// # let mut hub = Walletobjects::new(client, auth);
21467/// // As the method needs a request, you would usually fill it with the desired information
21468/// // into the respective structure. Some of the parts shown here might not be applicable !
21469/// // Values shown here are possibly random and not representative !
21470/// let mut req = GiftCardObject::default();
21471///
21472/// // You can configure optional parameters by calling the respective setters at will, and
21473/// // execute the final call using `doit()`.
21474/// // Values shown here are possibly random and not representative !
21475/// let result = hub.giftcardobject().insert(req)
21476/// .doit().await;
21477/// # }
21478/// ```
21479pub struct GiftcardobjectInsertCall<'a, C>
21480where
21481 C: 'a,
21482{
21483 hub: &'a Walletobjects<C>,
21484 _request: GiftCardObject,
21485 _delegate: Option<&'a mut dyn common::Delegate>,
21486 _additional_params: HashMap<String, String>,
21487 _scopes: BTreeSet<String>,
21488}
21489
21490impl<'a, C> common::CallBuilder for GiftcardobjectInsertCall<'a, C> {}
21491
21492impl<'a, C> GiftcardobjectInsertCall<'a, C>
21493where
21494 C: common::Connector,
21495{
21496 /// Perform the operation you have build so far.
21497 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObject)> {
21498 use std::borrow::Cow;
21499 use std::io::{Read, Seek};
21500
21501 use common::{url::Params, ToParts};
21502 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21503
21504 let mut dd = common::DefaultDelegate;
21505 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21506 dlg.begin(common::MethodInfo {
21507 id: "walletobjects.giftcardobject.insert",
21508 http_method: hyper::Method::POST,
21509 });
21510
21511 for &field in ["alt"].iter() {
21512 if self._additional_params.contains_key(field) {
21513 dlg.finished(false);
21514 return Err(common::Error::FieldClash(field));
21515 }
21516 }
21517
21518 let mut params = Params::with_capacity(3 + self._additional_params.len());
21519
21520 params.extend(self._additional_params.iter());
21521
21522 params.push("alt", "json");
21523 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject";
21524 if self._scopes.is_empty() {
21525 self._scopes
21526 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
21527 }
21528
21529 let url = params.parse_with_url(&url);
21530
21531 let mut json_mime_type = mime::APPLICATION_JSON;
21532 let mut request_value_reader = {
21533 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21534 common::remove_json_null_values(&mut value);
21535 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21536 serde_json::to_writer(&mut dst, &value).unwrap();
21537 dst
21538 };
21539 let request_size = request_value_reader
21540 .seek(std::io::SeekFrom::End(0))
21541 .unwrap();
21542 request_value_reader
21543 .seek(std::io::SeekFrom::Start(0))
21544 .unwrap();
21545
21546 loop {
21547 let token = match self
21548 .hub
21549 .auth
21550 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21551 .await
21552 {
21553 Ok(token) => token,
21554 Err(e) => match dlg.token(e) {
21555 Ok(token) => token,
21556 Err(e) => {
21557 dlg.finished(false);
21558 return Err(common::Error::MissingToken(e));
21559 }
21560 },
21561 };
21562 request_value_reader
21563 .seek(std::io::SeekFrom::Start(0))
21564 .unwrap();
21565 let mut req_result = {
21566 let client = &self.hub.client;
21567 dlg.pre_request();
21568 let mut req_builder = hyper::Request::builder()
21569 .method(hyper::Method::POST)
21570 .uri(url.as_str())
21571 .header(USER_AGENT, self.hub._user_agent.clone());
21572
21573 if let Some(token) = token.as_ref() {
21574 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21575 }
21576
21577 let request = req_builder
21578 .header(CONTENT_TYPE, json_mime_type.to_string())
21579 .header(CONTENT_LENGTH, request_size as u64)
21580 .body(common::to_body(
21581 request_value_reader.get_ref().clone().into(),
21582 ));
21583
21584 client.request(request.unwrap()).await
21585 };
21586
21587 match req_result {
21588 Err(err) => {
21589 if let common::Retry::After(d) = dlg.http_error(&err) {
21590 sleep(d).await;
21591 continue;
21592 }
21593 dlg.finished(false);
21594 return Err(common::Error::HttpError(err));
21595 }
21596 Ok(res) => {
21597 let (mut parts, body) = res.into_parts();
21598 let mut body = common::Body::new(body);
21599 if !parts.status.is_success() {
21600 let bytes = common::to_bytes(body).await.unwrap_or_default();
21601 let error = serde_json::from_str(&common::to_string(&bytes));
21602 let response = common::to_response(parts, bytes.into());
21603
21604 if let common::Retry::After(d) =
21605 dlg.http_failure(&response, error.as_ref().ok())
21606 {
21607 sleep(d).await;
21608 continue;
21609 }
21610
21611 dlg.finished(false);
21612
21613 return Err(match error {
21614 Ok(value) => common::Error::BadRequest(value),
21615 _ => common::Error::Failure(response),
21616 });
21617 }
21618 let response = {
21619 let bytes = common::to_bytes(body).await.unwrap_or_default();
21620 let encoded = common::to_string(&bytes);
21621 match serde_json::from_str(&encoded) {
21622 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21623 Err(error) => {
21624 dlg.response_json_decode_error(&encoded, &error);
21625 return Err(common::Error::JsonDecodeError(
21626 encoded.to_string(),
21627 error,
21628 ));
21629 }
21630 }
21631 };
21632
21633 dlg.finished(true);
21634 return Ok(response);
21635 }
21636 }
21637 }
21638 }
21639
21640 ///
21641 /// Sets the *request* property to the given value.
21642 ///
21643 /// Even though the property as already been set when instantiating this call,
21644 /// we provide this method for API completeness.
21645 pub fn request(mut self, new_value: GiftCardObject) -> GiftcardobjectInsertCall<'a, C> {
21646 self._request = new_value;
21647 self
21648 }
21649 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21650 /// while executing the actual API request.
21651 ///
21652 /// ````text
21653 /// It should be used to handle progress information, and to implement a certain level of resilience.
21654 /// ````
21655 ///
21656 /// Sets the *delegate* property to the given value.
21657 pub fn delegate(
21658 mut self,
21659 new_value: &'a mut dyn common::Delegate,
21660 ) -> GiftcardobjectInsertCall<'a, C> {
21661 self._delegate = Some(new_value);
21662 self
21663 }
21664
21665 /// Set any additional parameter of the query string used in the request.
21666 /// It should be used to set parameters which are not yet available through their own
21667 /// setters.
21668 ///
21669 /// Please note that this method must not be used to set any of the known parameters
21670 /// which have their own setter method. If done anyway, the request will fail.
21671 ///
21672 /// # Additional Parameters
21673 ///
21674 /// * *$.xgafv* (query-string) - V1 error format.
21675 /// * *access_token* (query-string) - OAuth access token.
21676 /// * *alt* (query-string) - Data format for response.
21677 /// * *callback* (query-string) - JSONP
21678 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21679 /// * *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.
21680 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21681 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21682 /// * *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.
21683 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21684 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21685 pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectInsertCall<'a, C>
21686 where
21687 T: AsRef<str>,
21688 {
21689 self._additional_params
21690 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21691 self
21692 }
21693
21694 /// Identifies the authorization scope for the method you are building.
21695 ///
21696 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21697 /// [`Scope::WalletObjectIssuer`].
21698 ///
21699 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21700 /// tokens for more than one scope.
21701 ///
21702 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21703 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21704 /// sufficient, a read-write scope will do as well.
21705 pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectInsertCall<'a, C>
21706 where
21707 St: AsRef<str>,
21708 {
21709 self._scopes.insert(String::from(scope.as_ref()));
21710 self
21711 }
21712 /// Identifies the authorization scope(s) for the method you are building.
21713 ///
21714 /// See [`Self::add_scope()`] for details.
21715 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectInsertCall<'a, C>
21716 where
21717 I: IntoIterator<Item = St>,
21718 St: AsRef<str>,
21719 {
21720 self._scopes
21721 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21722 self
21723 }
21724
21725 /// Removes all scopes, and no default scope will be used either.
21726 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21727 /// for details).
21728 pub fn clear_scopes(mut self) -> GiftcardobjectInsertCall<'a, C> {
21729 self._scopes.clear();
21730 self
21731 }
21732}
21733
21734/// Returns a list of all gift card objects for a given issuer ID.
21735///
21736/// A builder for the *list* method supported by a *giftcardobject* resource.
21737/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
21738///
21739/// # Example
21740///
21741/// Instantiate a resource method builder
21742///
21743/// ```test_harness,no_run
21744/// # extern crate hyper;
21745/// # extern crate hyper_rustls;
21746/// # extern crate google_walletobjects1 as walletobjects1;
21747/// # async fn dox() {
21748/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21749///
21750/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21751/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21752/// # secret,
21753/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21754/// # ).build().await.unwrap();
21755///
21756/// # let client = hyper_util::client::legacy::Client::builder(
21757/// # hyper_util::rt::TokioExecutor::new()
21758/// # )
21759/// # .build(
21760/// # hyper_rustls::HttpsConnectorBuilder::new()
21761/// # .with_native_roots()
21762/// # .unwrap()
21763/// # .https_or_http()
21764/// # .enable_http1()
21765/// # .build()
21766/// # );
21767/// # let mut hub = Walletobjects::new(client, auth);
21768/// // You can configure optional parameters by calling the respective setters at will, and
21769/// // execute the final call using `doit()`.
21770/// // Values shown here are possibly random and not representative !
21771/// let result = hub.giftcardobject().list()
21772/// .token("amet.")
21773/// .max_results(-96)
21774/// .class_id("diam")
21775/// .doit().await;
21776/// # }
21777/// ```
21778pub struct GiftcardobjectListCall<'a, C>
21779where
21780 C: 'a,
21781{
21782 hub: &'a Walletobjects<C>,
21783 _token: Option<String>,
21784 _max_results: Option<i32>,
21785 _class_id: Option<String>,
21786 _delegate: Option<&'a mut dyn common::Delegate>,
21787 _additional_params: HashMap<String, String>,
21788 _scopes: BTreeSet<String>,
21789}
21790
21791impl<'a, C> common::CallBuilder for GiftcardobjectListCall<'a, C> {}
21792
21793impl<'a, C> GiftcardobjectListCall<'a, C>
21794where
21795 C: common::Connector,
21796{
21797 /// Perform the operation you have build so far.
21798 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObjectListResponse)> {
21799 use std::borrow::Cow;
21800 use std::io::{Read, Seek};
21801
21802 use common::{url::Params, ToParts};
21803 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21804
21805 let mut dd = common::DefaultDelegate;
21806 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21807 dlg.begin(common::MethodInfo {
21808 id: "walletobjects.giftcardobject.list",
21809 http_method: hyper::Method::GET,
21810 });
21811
21812 for &field in ["alt", "token", "maxResults", "classId"].iter() {
21813 if self._additional_params.contains_key(field) {
21814 dlg.finished(false);
21815 return Err(common::Error::FieldClash(field));
21816 }
21817 }
21818
21819 let mut params = Params::with_capacity(5 + self._additional_params.len());
21820 if let Some(value) = self._token.as_ref() {
21821 params.push("token", value);
21822 }
21823 if let Some(value) = self._max_results.as_ref() {
21824 params.push("maxResults", value.to_string());
21825 }
21826 if let Some(value) = self._class_id.as_ref() {
21827 params.push("classId", value);
21828 }
21829
21830 params.extend(self._additional_params.iter());
21831
21832 params.push("alt", "json");
21833 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject";
21834 if self._scopes.is_empty() {
21835 self._scopes
21836 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
21837 }
21838
21839 let url = params.parse_with_url(&url);
21840
21841 loop {
21842 let token = match self
21843 .hub
21844 .auth
21845 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21846 .await
21847 {
21848 Ok(token) => token,
21849 Err(e) => match dlg.token(e) {
21850 Ok(token) => token,
21851 Err(e) => {
21852 dlg.finished(false);
21853 return Err(common::Error::MissingToken(e));
21854 }
21855 },
21856 };
21857 let mut req_result = {
21858 let client = &self.hub.client;
21859 dlg.pre_request();
21860 let mut req_builder = hyper::Request::builder()
21861 .method(hyper::Method::GET)
21862 .uri(url.as_str())
21863 .header(USER_AGENT, self.hub._user_agent.clone());
21864
21865 if let Some(token) = token.as_ref() {
21866 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21867 }
21868
21869 let request = req_builder
21870 .header(CONTENT_LENGTH, 0_u64)
21871 .body(common::to_body::<String>(None));
21872
21873 client.request(request.unwrap()).await
21874 };
21875
21876 match req_result {
21877 Err(err) => {
21878 if let common::Retry::After(d) = dlg.http_error(&err) {
21879 sleep(d).await;
21880 continue;
21881 }
21882 dlg.finished(false);
21883 return Err(common::Error::HttpError(err));
21884 }
21885 Ok(res) => {
21886 let (mut parts, body) = res.into_parts();
21887 let mut body = common::Body::new(body);
21888 if !parts.status.is_success() {
21889 let bytes = common::to_bytes(body).await.unwrap_or_default();
21890 let error = serde_json::from_str(&common::to_string(&bytes));
21891 let response = common::to_response(parts, bytes.into());
21892
21893 if let common::Retry::After(d) =
21894 dlg.http_failure(&response, error.as_ref().ok())
21895 {
21896 sleep(d).await;
21897 continue;
21898 }
21899
21900 dlg.finished(false);
21901
21902 return Err(match error {
21903 Ok(value) => common::Error::BadRequest(value),
21904 _ => common::Error::Failure(response),
21905 });
21906 }
21907 let response = {
21908 let bytes = common::to_bytes(body).await.unwrap_or_default();
21909 let encoded = common::to_string(&bytes);
21910 match serde_json::from_str(&encoded) {
21911 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21912 Err(error) => {
21913 dlg.response_json_decode_error(&encoded, &error);
21914 return Err(common::Error::JsonDecodeError(
21915 encoded.to_string(),
21916 error,
21917 ));
21918 }
21919 }
21920 };
21921
21922 dlg.finished(true);
21923 return Ok(response);
21924 }
21925 }
21926 }
21927 }
21928
21929 /// 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.
21930 ///
21931 /// Sets the *token* query property to the given value.
21932 pub fn token(mut self, new_value: &str) -> GiftcardobjectListCall<'a, C> {
21933 self._token = Some(new_value.to_string());
21934 self
21935 }
21936 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
21937 ///
21938 /// Sets the *max results* query property to the given value.
21939 pub fn max_results(mut self, new_value: i32) -> GiftcardobjectListCall<'a, C> {
21940 self._max_results = Some(new_value);
21941 self
21942 }
21943 /// The ID of the class whose objects will be listed.
21944 ///
21945 /// Sets the *class id* query property to the given value.
21946 pub fn class_id(mut self, new_value: &str) -> GiftcardobjectListCall<'a, C> {
21947 self._class_id = Some(new_value.to_string());
21948 self
21949 }
21950 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21951 /// while executing the actual API request.
21952 ///
21953 /// ````text
21954 /// It should be used to handle progress information, and to implement a certain level of resilience.
21955 /// ````
21956 ///
21957 /// Sets the *delegate* property to the given value.
21958 pub fn delegate(
21959 mut self,
21960 new_value: &'a mut dyn common::Delegate,
21961 ) -> GiftcardobjectListCall<'a, C> {
21962 self._delegate = Some(new_value);
21963 self
21964 }
21965
21966 /// Set any additional parameter of the query string used in the request.
21967 /// It should be used to set parameters which are not yet available through their own
21968 /// setters.
21969 ///
21970 /// Please note that this method must not be used to set any of the known parameters
21971 /// which have their own setter method. If done anyway, the request will fail.
21972 ///
21973 /// # Additional Parameters
21974 ///
21975 /// * *$.xgafv* (query-string) - V1 error format.
21976 /// * *access_token* (query-string) - OAuth access token.
21977 /// * *alt* (query-string) - Data format for response.
21978 /// * *callback* (query-string) - JSONP
21979 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21980 /// * *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.
21981 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21982 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21983 /// * *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.
21984 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21985 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21986 pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectListCall<'a, C>
21987 where
21988 T: AsRef<str>,
21989 {
21990 self._additional_params
21991 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21992 self
21993 }
21994
21995 /// Identifies the authorization scope for the method you are building.
21996 ///
21997 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21998 /// [`Scope::WalletObjectIssuer`].
21999 ///
22000 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22001 /// tokens for more than one scope.
22002 ///
22003 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22004 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22005 /// sufficient, a read-write scope will do as well.
22006 pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectListCall<'a, C>
22007 where
22008 St: AsRef<str>,
22009 {
22010 self._scopes.insert(String::from(scope.as_ref()));
22011 self
22012 }
22013 /// Identifies the authorization scope(s) for the method you are building.
22014 ///
22015 /// See [`Self::add_scope()`] for details.
22016 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectListCall<'a, C>
22017 where
22018 I: IntoIterator<Item = St>,
22019 St: AsRef<str>,
22020 {
22021 self._scopes
22022 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22023 self
22024 }
22025
22026 /// Removes all scopes, and no default scope will be used either.
22027 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22028 /// for details).
22029 pub fn clear_scopes(mut self) -> GiftcardobjectListCall<'a, C> {
22030 self._scopes.clear();
22031 self
22032 }
22033}
22034
22035/// Updates the gift card object referenced by the given object ID. This method supports patch semantics.
22036///
22037/// A builder for the *patch* method supported by a *giftcardobject* resource.
22038/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
22039///
22040/// # Example
22041///
22042/// Instantiate a resource method builder
22043///
22044/// ```test_harness,no_run
22045/// # extern crate hyper;
22046/// # extern crate hyper_rustls;
22047/// # extern crate google_walletobjects1 as walletobjects1;
22048/// use walletobjects1::api::GiftCardObject;
22049/// # async fn dox() {
22050/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22051///
22052/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22053/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22054/// # secret,
22055/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22056/// # ).build().await.unwrap();
22057///
22058/// # let client = hyper_util::client::legacy::Client::builder(
22059/// # hyper_util::rt::TokioExecutor::new()
22060/// # )
22061/// # .build(
22062/// # hyper_rustls::HttpsConnectorBuilder::new()
22063/// # .with_native_roots()
22064/// # .unwrap()
22065/// # .https_or_http()
22066/// # .enable_http1()
22067/// # .build()
22068/// # );
22069/// # let mut hub = Walletobjects::new(client, auth);
22070/// // As the method needs a request, you would usually fill it with the desired information
22071/// // into the respective structure. Some of the parts shown here might not be applicable !
22072/// // Values shown here are possibly random and not representative !
22073/// let mut req = GiftCardObject::default();
22074///
22075/// // You can configure optional parameters by calling the respective setters at will, and
22076/// // execute the final call using `doit()`.
22077/// // Values shown here are possibly random and not representative !
22078/// let result = hub.giftcardobject().patch(req, "resourceId")
22079/// .doit().await;
22080/// # }
22081/// ```
22082pub struct GiftcardobjectPatchCall<'a, C>
22083where
22084 C: 'a,
22085{
22086 hub: &'a Walletobjects<C>,
22087 _request: GiftCardObject,
22088 _resource_id: String,
22089 _delegate: Option<&'a mut dyn common::Delegate>,
22090 _additional_params: HashMap<String, String>,
22091 _scopes: BTreeSet<String>,
22092}
22093
22094impl<'a, C> common::CallBuilder for GiftcardobjectPatchCall<'a, C> {}
22095
22096impl<'a, C> GiftcardobjectPatchCall<'a, C>
22097where
22098 C: common::Connector,
22099{
22100 /// Perform the operation you have build so far.
22101 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObject)> {
22102 use std::borrow::Cow;
22103 use std::io::{Read, Seek};
22104
22105 use common::{url::Params, ToParts};
22106 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22107
22108 let mut dd = common::DefaultDelegate;
22109 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22110 dlg.begin(common::MethodInfo {
22111 id: "walletobjects.giftcardobject.patch",
22112 http_method: hyper::Method::PATCH,
22113 });
22114
22115 for &field in ["alt", "resourceId"].iter() {
22116 if self._additional_params.contains_key(field) {
22117 dlg.finished(false);
22118 return Err(common::Error::FieldClash(field));
22119 }
22120 }
22121
22122 let mut params = Params::with_capacity(4 + self._additional_params.len());
22123 params.push("resourceId", self._resource_id);
22124
22125 params.extend(self._additional_params.iter());
22126
22127 params.push("alt", "json");
22128 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject/{resourceId}";
22129 if self._scopes.is_empty() {
22130 self._scopes
22131 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
22132 }
22133
22134 #[allow(clippy::single_element_loop)]
22135 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
22136 url = params.uri_replacement(url, param_name, find_this, false);
22137 }
22138 {
22139 let to_remove = ["resourceId"];
22140 params.remove_params(&to_remove);
22141 }
22142
22143 let url = params.parse_with_url(&url);
22144
22145 let mut json_mime_type = mime::APPLICATION_JSON;
22146 let mut request_value_reader = {
22147 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22148 common::remove_json_null_values(&mut value);
22149 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22150 serde_json::to_writer(&mut dst, &value).unwrap();
22151 dst
22152 };
22153 let request_size = request_value_reader
22154 .seek(std::io::SeekFrom::End(0))
22155 .unwrap();
22156 request_value_reader
22157 .seek(std::io::SeekFrom::Start(0))
22158 .unwrap();
22159
22160 loop {
22161 let token = match self
22162 .hub
22163 .auth
22164 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22165 .await
22166 {
22167 Ok(token) => token,
22168 Err(e) => match dlg.token(e) {
22169 Ok(token) => token,
22170 Err(e) => {
22171 dlg.finished(false);
22172 return Err(common::Error::MissingToken(e));
22173 }
22174 },
22175 };
22176 request_value_reader
22177 .seek(std::io::SeekFrom::Start(0))
22178 .unwrap();
22179 let mut req_result = {
22180 let client = &self.hub.client;
22181 dlg.pre_request();
22182 let mut req_builder = hyper::Request::builder()
22183 .method(hyper::Method::PATCH)
22184 .uri(url.as_str())
22185 .header(USER_AGENT, self.hub._user_agent.clone());
22186
22187 if let Some(token) = token.as_ref() {
22188 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22189 }
22190
22191 let request = req_builder
22192 .header(CONTENT_TYPE, json_mime_type.to_string())
22193 .header(CONTENT_LENGTH, request_size as u64)
22194 .body(common::to_body(
22195 request_value_reader.get_ref().clone().into(),
22196 ));
22197
22198 client.request(request.unwrap()).await
22199 };
22200
22201 match req_result {
22202 Err(err) => {
22203 if let common::Retry::After(d) = dlg.http_error(&err) {
22204 sleep(d).await;
22205 continue;
22206 }
22207 dlg.finished(false);
22208 return Err(common::Error::HttpError(err));
22209 }
22210 Ok(res) => {
22211 let (mut parts, body) = res.into_parts();
22212 let mut body = common::Body::new(body);
22213 if !parts.status.is_success() {
22214 let bytes = common::to_bytes(body).await.unwrap_or_default();
22215 let error = serde_json::from_str(&common::to_string(&bytes));
22216 let response = common::to_response(parts, bytes.into());
22217
22218 if let common::Retry::After(d) =
22219 dlg.http_failure(&response, error.as_ref().ok())
22220 {
22221 sleep(d).await;
22222 continue;
22223 }
22224
22225 dlg.finished(false);
22226
22227 return Err(match error {
22228 Ok(value) => common::Error::BadRequest(value),
22229 _ => common::Error::Failure(response),
22230 });
22231 }
22232 let response = {
22233 let bytes = common::to_bytes(body).await.unwrap_or_default();
22234 let encoded = common::to_string(&bytes);
22235 match serde_json::from_str(&encoded) {
22236 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22237 Err(error) => {
22238 dlg.response_json_decode_error(&encoded, &error);
22239 return Err(common::Error::JsonDecodeError(
22240 encoded.to_string(),
22241 error,
22242 ));
22243 }
22244 }
22245 };
22246
22247 dlg.finished(true);
22248 return Ok(response);
22249 }
22250 }
22251 }
22252 }
22253
22254 ///
22255 /// Sets the *request* property to the given value.
22256 ///
22257 /// Even though the property as already been set when instantiating this call,
22258 /// we provide this method for API completeness.
22259 pub fn request(mut self, new_value: GiftCardObject) -> GiftcardobjectPatchCall<'a, C> {
22260 self._request = new_value;
22261 self
22262 }
22263 /// 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 '-'.
22264 ///
22265 /// Sets the *resource id* path property to the given value.
22266 ///
22267 /// Even though the property as already been set when instantiating this call,
22268 /// we provide this method for API completeness.
22269 pub fn resource_id(mut self, new_value: &str) -> GiftcardobjectPatchCall<'a, C> {
22270 self._resource_id = new_value.to_string();
22271 self
22272 }
22273 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22274 /// while executing the actual API request.
22275 ///
22276 /// ````text
22277 /// It should be used to handle progress information, and to implement a certain level of resilience.
22278 /// ````
22279 ///
22280 /// Sets the *delegate* property to the given value.
22281 pub fn delegate(
22282 mut self,
22283 new_value: &'a mut dyn common::Delegate,
22284 ) -> GiftcardobjectPatchCall<'a, C> {
22285 self._delegate = Some(new_value);
22286 self
22287 }
22288
22289 /// Set any additional parameter of the query string used in the request.
22290 /// It should be used to set parameters which are not yet available through their own
22291 /// setters.
22292 ///
22293 /// Please note that this method must not be used to set any of the known parameters
22294 /// which have their own setter method. If done anyway, the request will fail.
22295 ///
22296 /// # Additional Parameters
22297 ///
22298 /// * *$.xgafv* (query-string) - V1 error format.
22299 /// * *access_token* (query-string) - OAuth access token.
22300 /// * *alt* (query-string) - Data format for response.
22301 /// * *callback* (query-string) - JSONP
22302 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22303 /// * *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.
22304 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22305 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22306 /// * *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.
22307 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22308 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22309 pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectPatchCall<'a, C>
22310 where
22311 T: AsRef<str>,
22312 {
22313 self._additional_params
22314 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22315 self
22316 }
22317
22318 /// Identifies the authorization scope for the method you are building.
22319 ///
22320 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22321 /// [`Scope::WalletObjectIssuer`].
22322 ///
22323 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22324 /// tokens for more than one scope.
22325 ///
22326 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22327 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22328 /// sufficient, a read-write scope will do as well.
22329 pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectPatchCall<'a, C>
22330 where
22331 St: AsRef<str>,
22332 {
22333 self._scopes.insert(String::from(scope.as_ref()));
22334 self
22335 }
22336 /// Identifies the authorization scope(s) for the method you are building.
22337 ///
22338 /// See [`Self::add_scope()`] for details.
22339 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectPatchCall<'a, C>
22340 where
22341 I: IntoIterator<Item = St>,
22342 St: AsRef<str>,
22343 {
22344 self._scopes
22345 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22346 self
22347 }
22348
22349 /// Removes all scopes, and no default scope will be used either.
22350 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22351 /// for details).
22352 pub fn clear_scopes(mut self) -> GiftcardobjectPatchCall<'a, C> {
22353 self._scopes.clear();
22354 self
22355 }
22356}
22357
22358/// Updates the gift card object referenced by the given object ID.
22359///
22360/// A builder for the *update* method supported by a *giftcardobject* resource.
22361/// It is not used directly, but through a [`GiftcardobjectMethods`] instance.
22362///
22363/// # Example
22364///
22365/// Instantiate a resource method builder
22366///
22367/// ```test_harness,no_run
22368/// # extern crate hyper;
22369/// # extern crate hyper_rustls;
22370/// # extern crate google_walletobjects1 as walletobjects1;
22371/// use walletobjects1::api::GiftCardObject;
22372/// # async fn dox() {
22373/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22374///
22375/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22376/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22377/// # secret,
22378/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22379/// # ).build().await.unwrap();
22380///
22381/// # let client = hyper_util::client::legacy::Client::builder(
22382/// # hyper_util::rt::TokioExecutor::new()
22383/// # )
22384/// # .build(
22385/// # hyper_rustls::HttpsConnectorBuilder::new()
22386/// # .with_native_roots()
22387/// # .unwrap()
22388/// # .https_or_http()
22389/// # .enable_http1()
22390/// # .build()
22391/// # );
22392/// # let mut hub = Walletobjects::new(client, auth);
22393/// // As the method needs a request, you would usually fill it with the desired information
22394/// // into the respective structure. Some of the parts shown here might not be applicable !
22395/// // Values shown here are possibly random and not representative !
22396/// let mut req = GiftCardObject::default();
22397///
22398/// // You can configure optional parameters by calling the respective setters at will, and
22399/// // execute the final call using `doit()`.
22400/// // Values shown here are possibly random and not representative !
22401/// let result = hub.giftcardobject().update(req, "resourceId")
22402/// .doit().await;
22403/// # }
22404/// ```
22405pub struct GiftcardobjectUpdateCall<'a, C>
22406where
22407 C: 'a,
22408{
22409 hub: &'a Walletobjects<C>,
22410 _request: GiftCardObject,
22411 _resource_id: String,
22412 _delegate: Option<&'a mut dyn common::Delegate>,
22413 _additional_params: HashMap<String, String>,
22414 _scopes: BTreeSet<String>,
22415}
22416
22417impl<'a, C> common::CallBuilder for GiftcardobjectUpdateCall<'a, C> {}
22418
22419impl<'a, C> GiftcardobjectUpdateCall<'a, C>
22420where
22421 C: common::Connector,
22422{
22423 /// Perform the operation you have build so far.
22424 pub async fn doit(mut self) -> common::Result<(common::Response, GiftCardObject)> {
22425 use std::borrow::Cow;
22426 use std::io::{Read, Seek};
22427
22428 use common::{url::Params, ToParts};
22429 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22430
22431 let mut dd = common::DefaultDelegate;
22432 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22433 dlg.begin(common::MethodInfo {
22434 id: "walletobjects.giftcardobject.update",
22435 http_method: hyper::Method::PUT,
22436 });
22437
22438 for &field in ["alt", "resourceId"].iter() {
22439 if self._additional_params.contains_key(field) {
22440 dlg.finished(false);
22441 return Err(common::Error::FieldClash(field));
22442 }
22443 }
22444
22445 let mut params = Params::with_capacity(4 + self._additional_params.len());
22446 params.push("resourceId", self._resource_id);
22447
22448 params.extend(self._additional_params.iter());
22449
22450 params.push("alt", "json");
22451 let mut url = self.hub._base_url.clone() + "walletobjects/v1/giftCardObject/{resourceId}";
22452 if self._scopes.is_empty() {
22453 self._scopes
22454 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
22455 }
22456
22457 #[allow(clippy::single_element_loop)]
22458 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
22459 url = params.uri_replacement(url, param_name, find_this, false);
22460 }
22461 {
22462 let to_remove = ["resourceId"];
22463 params.remove_params(&to_remove);
22464 }
22465
22466 let url = params.parse_with_url(&url);
22467
22468 let mut json_mime_type = mime::APPLICATION_JSON;
22469 let mut request_value_reader = {
22470 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22471 common::remove_json_null_values(&mut value);
22472 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22473 serde_json::to_writer(&mut dst, &value).unwrap();
22474 dst
22475 };
22476 let request_size = request_value_reader
22477 .seek(std::io::SeekFrom::End(0))
22478 .unwrap();
22479 request_value_reader
22480 .seek(std::io::SeekFrom::Start(0))
22481 .unwrap();
22482
22483 loop {
22484 let token = match self
22485 .hub
22486 .auth
22487 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22488 .await
22489 {
22490 Ok(token) => token,
22491 Err(e) => match dlg.token(e) {
22492 Ok(token) => token,
22493 Err(e) => {
22494 dlg.finished(false);
22495 return Err(common::Error::MissingToken(e));
22496 }
22497 },
22498 };
22499 request_value_reader
22500 .seek(std::io::SeekFrom::Start(0))
22501 .unwrap();
22502 let mut req_result = {
22503 let client = &self.hub.client;
22504 dlg.pre_request();
22505 let mut req_builder = hyper::Request::builder()
22506 .method(hyper::Method::PUT)
22507 .uri(url.as_str())
22508 .header(USER_AGENT, self.hub._user_agent.clone());
22509
22510 if let Some(token) = token.as_ref() {
22511 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22512 }
22513
22514 let request = req_builder
22515 .header(CONTENT_TYPE, json_mime_type.to_string())
22516 .header(CONTENT_LENGTH, request_size as u64)
22517 .body(common::to_body(
22518 request_value_reader.get_ref().clone().into(),
22519 ));
22520
22521 client.request(request.unwrap()).await
22522 };
22523
22524 match req_result {
22525 Err(err) => {
22526 if let common::Retry::After(d) = dlg.http_error(&err) {
22527 sleep(d).await;
22528 continue;
22529 }
22530 dlg.finished(false);
22531 return Err(common::Error::HttpError(err));
22532 }
22533 Ok(res) => {
22534 let (mut parts, body) = res.into_parts();
22535 let mut body = common::Body::new(body);
22536 if !parts.status.is_success() {
22537 let bytes = common::to_bytes(body).await.unwrap_or_default();
22538 let error = serde_json::from_str(&common::to_string(&bytes));
22539 let response = common::to_response(parts, bytes.into());
22540
22541 if let common::Retry::After(d) =
22542 dlg.http_failure(&response, error.as_ref().ok())
22543 {
22544 sleep(d).await;
22545 continue;
22546 }
22547
22548 dlg.finished(false);
22549
22550 return Err(match error {
22551 Ok(value) => common::Error::BadRequest(value),
22552 _ => common::Error::Failure(response),
22553 });
22554 }
22555 let response = {
22556 let bytes = common::to_bytes(body).await.unwrap_or_default();
22557 let encoded = common::to_string(&bytes);
22558 match serde_json::from_str(&encoded) {
22559 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22560 Err(error) => {
22561 dlg.response_json_decode_error(&encoded, &error);
22562 return Err(common::Error::JsonDecodeError(
22563 encoded.to_string(),
22564 error,
22565 ));
22566 }
22567 }
22568 };
22569
22570 dlg.finished(true);
22571 return Ok(response);
22572 }
22573 }
22574 }
22575 }
22576
22577 ///
22578 /// Sets the *request* property to the given value.
22579 ///
22580 /// Even though the property as already been set when instantiating this call,
22581 /// we provide this method for API completeness.
22582 pub fn request(mut self, new_value: GiftCardObject) -> GiftcardobjectUpdateCall<'a, C> {
22583 self._request = new_value;
22584 self
22585 }
22586 /// 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 '-'.
22587 ///
22588 /// Sets the *resource id* path property to the given value.
22589 ///
22590 /// Even though the property as already been set when instantiating this call,
22591 /// we provide this method for API completeness.
22592 pub fn resource_id(mut self, new_value: &str) -> GiftcardobjectUpdateCall<'a, C> {
22593 self._resource_id = new_value.to_string();
22594 self
22595 }
22596 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22597 /// while executing the actual API request.
22598 ///
22599 /// ````text
22600 /// It should be used to handle progress information, and to implement a certain level of resilience.
22601 /// ````
22602 ///
22603 /// Sets the *delegate* property to the given value.
22604 pub fn delegate(
22605 mut self,
22606 new_value: &'a mut dyn common::Delegate,
22607 ) -> GiftcardobjectUpdateCall<'a, C> {
22608 self._delegate = Some(new_value);
22609 self
22610 }
22611
22612 /// Set any additional parameter of the query string used in the request.
22613 /// It should be used to set parameters which are not yet available through their own
22614 /// setters.
22615 ///
22616 /// Please note that this method must not be used to set any of the known parameters
22617 /// which have their own setter method. If done anyway, the request will fail.
22618 ///
22619 /// # Additional Parameters
22620 ///
22621 /// * *$.xgafv* (query-string) - V1 error format.
22622 /// * *access_token* (query-string) - OAuth access token.
22623 /// * *alt* (query-string) - Data format for response.
22624 /// * *callback* (query-string) - JSONP
22625 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22626 /// * *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.
22627 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22628 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22629 /// * *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.
22630 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22631 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22632 pub fn param<T>(mut self, name: T, value: T) -> GiftcardobjectUpdateCall<'a, C>
22633 where
22634 T: AsRef<str>,
22635 {
22636 self._additional_params
22637 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22638 self
22639 }
22640
22641 /// Identifies the authorization scope for the method you are building.
22642 ///
22643 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22644 /// [`Scope::WalletObjectIssuer`].
22645 ///
22646 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22647 /// tokens for more than one scope.
22648 ///
22649 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22650 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22651 /// sufficient, a read-write scope will do as well.
22652 pub fn add_scope<St>(mut self, scope: St) -> GiftcardobjectUpdateCall<'a, C>
22653 where
22654 St: AsRef<str>,
22655 {
22656 self._scopes.insert(String::from(scope.as_ref()));
22657 self
22658 }
22659 /// Identifies the authorization scope(s) for the method you are building.
22660 ///
22661 /// See [`Self::add_scope()`] for details.
22662 pub fn add_scopes<I, St>(mut self, scopes: I) -> GiftcardobjectUpdateCall<'a, C>
22663 where
22664 I: IntoIterator<Item = St>,
22665 St: AsRef<str>,
22666 {
22667 self._scopes
22668 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22669 self
22670 }
22671
22672 /// Removes all scopes, and no default scope will be used either.
22673 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22674 /// for details).
22675 pub fn clear_scopes(mut self) -> GiftcardobjectUpdateCall<'a, C> {
22676 self._scopes.clear();
22677 self
22678 }
22679}
22680
22681/// Returns the issuer with the given issuer ID.
22682///
22683/// A builder for the *get* method supported by a *issuer* resource.
22684/// It is not used directly, but through a [`IssuerMethods`] instance.
22685///
22686/// # Example
22687///
22688/// Instantiate a resource method builder
22689///
22690/// ```test_harness,no_run
22691/// # extern crate hyper;
22692/// # extern crate hyper_rustls;
22693/// # extern crate google_walletobjects1 as walletobjects1;
22694/// # async fn dox() {
22695/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22696///
22697/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22698/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22699/// # secret,
22700/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22701/// # ).build().await.unwrap();
22702///
22703/// # let client = hyper_util::client::legacy::Client::builder(
22704/// # hyper_util::rt::TokioExecutor::new()
22705/// # )
22706/// # .build(
22707/// # hyper_rustls::HttpsConnectorBuilder::new()
22708/// # .with_native_roots()
22709/// # .unwrap()
22710/// # .https_or_http()
22711/// # .enable_http1()
22712/// # .build()
22713/// # );
22714/// # let mut hub = Walletobjects::new(client, auth);
22715/// // You can configure optional parameters by calling the respective setters at will, and
22716/// // execute the final call using `doit()`.
22717/// // Values shown here are possibly random and not representative !
22718/// let result = hub.issuer().get(-22)
22719/// .doit().await;
22720/// # }
22721/// ```
22722pub struct IssuerGetCall<'a, C>
22723where
22724 C: 'a,
22725{
22726 hub: &'a Walletobjects<C>,
22727 _resource_id: i64,
22728 _delegate: Option<&'a mut dyn common::Delegate>,
22729 _additional_params: HashMap<String, String>,
22730 _scopes: BTreeSet<String>,
22731}
22732
22733impl<'a, C> common::CallBuilder for IssuerGetCall<'a, C> {}
22734
22735impl<'a, C> IssuerGetCall<'a, C>
22736where
22737 C: common::Connector,
22738{
22739 /// Perform the operation you have build so far.
22740 pub async fn doit(mut self) -> common::Result<(common::Response, Issuer)> {
22741 use std::borrow::Cow;
22742 use std::io::{Read, Seek};
22743
22744 use common::{url::Params, ToParts};
22745 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22746
22747 let mut dd = common::DefaultDelegate;
22748 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22749 dlg.begin(common::MethodInfo {
22750 id: "walletobjects.issuer.get",
22751 http_method: hyper::Method::GET,
22752 });
22753
22754 for &field in ["alt", "resourceId"].iter() {
22755 if self._additional_params.contains_key(field) {
22756 dlg.finished(false);
22757 return Err(common::Error::FieldClash(field));
22758 }
22759 }
22760
22761 let mut params = Params::with_capacity(3 + self._additional_params.len());
22762 params.push("resourceId", self._resource_id.to_string());
22763
22764 params.extend(self._additional_params.iter());
22765
22766 params.push("alt", "json");
22767 let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer/{resourceId}";
22768 if self._scopes.is_empty() {
22769 self._scopes
22770 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
22771 }
22772
22773 #[allow(clippy::single_element_loop)]
22774 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
22775 url = params.uri_replacement(url, param_name, find_this, false);
22776 }
22777 {
22778 let to_remove = ["resourceId"];
22779 params.remove_params(&to_remove);
22780 }
22781
22782 let url = params.parse_with_url(&url);
22783
22784 loop {
22785 let token = match self
22786 .hub
22787 .auth
22788 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22789 .await
22790 {
22791 Ok(token) => token,
22792 Err(e) => match dlg.token(e) {
22793 Ok(token) => token,
22794 Err(e) => {
22795 dlg.finished(false);
22796 return Err(common::Error::MissingToken(e));
22797 }
22798 },
22799 };
22800 let mut req_result = {
22801 let client = &self.hub.client;
22802 dlg.pre_request();
22803 let mut req_builder = hyper::Request::builder()
22804 .method(hyper::Method::GET)
22805 .uri(url.as_str())
22806 .header(USER_AGENT, self.hub._user_agent.clone());
22807
22808 if let Some(token) = token.as_ref() {
22809 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22810 }
22811
22812 let request = req_builder
22813 .header(CONTENT_LENGTH, 0_u64)
22814 .body(common::to_body::<String>(None));
22815
22816 client.request(request.unwrap()).await
22817 };
22818
22819 match req_result {
22820 Err(err) => {
22821 if let common::Retry::After(d) = dlg.http_error(&err) {
22822 sleep(d).await;
22823 continue;
22824 }
22825 dlg.finished(false);
22826 return Err(common::Error::HttpError(err));
22827 }
22828 Ok(res) => {
22829 let (mut parts, body) = res.into_parts();
22830 let mut body = common::Body::new(body);
22831 if !parts.status.is_success() {
22832 let bytes = common::to_bytes(body).await.unwrap_or_default();
22833 let error = serde_json::from_str(&common::to_string(&bytes));
22834 let response = common::to_response(parts, bytes.into());
22835
22836 if let common::Retry::After(d) =
22837 dlg.http_failure(&response, error.as_ref().ok())
22838 {
22839 sleep(d).await;
22840 continue;
22841 }
22842
22843 dlg.finished(false);
22844
22845 return Err(match error {
22846 Ok(value) => common::Error::BadRequest(value),
22847 _ => common::Error::Failure(response),
22848 });
22849 }
22850 let response = {
22851 let bytes = common::to_bytes(body).await.unwrap_or_default();
22852 let encoded = common::to_string(&bytes);
22853 match serde_json::from_str(&encoded) {
22854 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22855 Err(error) => {
22856 dlg.response_json_decode_error(&encoded, &error);
22857 return Err(common::Error::JsonDecodeError(
22858 encoded.to_string(),
22859 error,
22860 ));
22861 }
22862 }
22863 };
22864
22865 dlg.finished(true);
22866 return Ok(response);
22867 }
22868 }
22869 }
22870 }
22871
22872 /// The unique identifier for an issuer.
22873 ///
22874 /// Sets the *resource id* path property to the given value.
22875 ///
22876 /// Even though the property as already been set when instantiating this call,
22877 /// we provide this method for API completeness.
22878 pub fn resource_id(mut self, new_value: i64) -> IssuerGetCall<'a, C> {
22879 self._resource_id = new_value;
22880 self
22881 }
22882 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22883 /// while executing the actual API request.
22884 ///
22885 /// ````text
22886 /// It should be used to handle progress information, and to implement a certain level of resilience.
22887 /// ````
22888 ///
22889 /// Sets the *delegate* property to the given value.
22890 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerGetCall<'a, C> {
22891 self._delegate = Some(new_value);
22892 self
22893 }
22894
22895 /// Set any additional parameter of the query string used in the request.
22896 /// It should be used to set parameters which are not yet available through their own
22897 /// setters.
22898 ///
22899 /// Please note that this method must not be used to set any of the known parameters
22900 /// which have their own setter method. If done anyway, the request will fail.
22901 ///
22902 /// # Additional Parameters
22903 ///
22904 /// * *$.xgafv* (query-string) - V1 error format.
22905 /// * *access_token* (query-string) - OAuth access token.
22906 /// * *alt* (query-string) - Data format for response.
22907 /// * *callback* (query-string) - JSONP
22908 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22909 /// * *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.
22910 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22911 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22912 /// * *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.
22913 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22914 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22915 pub fn param<T>(mut self, name: T, value: T) -> IssuerGetCall<'a, C>
22916 where
22917 T: AsRef<str>,
22918 {
22919 self._additional_params
22920 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22921 self
22922 }
22923
22924 /// Identifies the authorization scope for the method you are building.
22925 ///
22926 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22927 /// [`Scope::WalletObjectIssuer`].
22928 ///
22929 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22930 /// tokens for more than one scope.
22931 ///
22932 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22933 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22934 /// sufficient, a read-write scope will do as well.
22935 pub fn add_scope<St>(mut self, scope: St) -> IssuerGetCall<'a, C>
22936 where
22937 St: AsRef<str>,
22938 {
22939 self._scopes.insert(String::from(scope.as_ref()));
22940 self
22941 }
22942 /// Identifies the authorization scope(s) for the method you are building.
22943 ///
22944 /// See [`Self::add_scope()`] for details.
22945 pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerGetCall<'a, C>
22946 where
22947 I: IntoIterator<Item = St>,
22948 St: AsRef<str>,
22949 {
22950 self._scopes
22951 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22952 self
22953 }
22954
22955 /// Removes all scopes, and no default scope will be used either.
22956 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22957 /// for details).
22958 pub fn clear_scopes(mut self) -> IssuerGetCall<'a, C> {
22959 self._scopes.clear();
22960 self
22961 }
22962}
22963
22964/// Inserts an issuer with the given ID and properties.
22965///
22966/// A builder for the *insert* method supported by a *issuer* resource.
22967/// It is not used directly, but through a [`IssuerMethods`] instance.
22968///
22969/// # Example
22970///
22971/// Instantiate a resource method builder
22972///
22973/// ```test_harness,no_run
22974/// # extern crate hyper;
22975/// # extern crate hyper_rustls;
22976/// # extern crate google_walletobjects1 as walletobjects1;
22977/// use walletobjects1::api::Issuer;
22978/// # async fn dox() {
22979/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22980///
22981/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22982/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22983/// # secret,
22984/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22985/// # ).build().await.unwrap();
22986///
22987/// # let client = hyper_util::client::legacy::Client::builder(
22988/// # hyper_util::rt::TokioExecutor::new()
22989/// # )
22990/// # .build(
22991/// # hyper_rustls::HttpsConnectorBuilder::new()
22992/// # .with_native_roots()
22993/// # .unwrap()
22994/// # .https_or_http()
22995/// # .enable_http1()
22996/// # .build()
22997/// # );
22998/// # let mut hub = Walletobjects::new(client, auth);
22999/// // As the method needs a request, you would usually fill it with the desired information
23000/// // into the respective structure. Some of the parts shown here might not be applicable !
23001/// // Values shown here are possibly random and not representative !
23002/// let mut req = Issuer::default();
23003///
23004/// // You can configure optional parameters by calling the respective setters at will, and
23005/// // execute the final call using `doit()`.
23006/// // Values shown here are possibly random and not representative !
23007/// let result = hub.issuer().insert(req)
23008/// .doit().await;
23009/// # }
23010/// ```
23011pub struct IssuerInsertCall<'a, C>
23012where
23013 C: 'a,
23014{
23015 hub: &'a Walletobjects<C>,
23016 _request: Issuer,
23017 _delegate: Option<&'a mut dyn common::Delegate>,
23018 _additional_params: HashMap<String, String>,
23019 _scopes: BTreeSet<String>,
23020}
23021
23022impl<'a, C> common::CallBuilder for IssuerInsertCall<'a, C> {}
23023
23024impl<'a, C> IssuerInsertCall<'a, C>
23025where
23026 C: common::Connector,
23027{
23028 /// Perform the operation you have build so far.
23029 pub async fn doit(mut self) -> common::Result<(common::Response, Issuer)> {
23030 use std::borrow::Cow;
23031 use std::io::{Read, Seek};
23032
23033 use common::{url::Params, ToParts};
23034 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23035
23036 let mut dd = common::DefaultDelegate;
23037 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23038 dlg.begin(common::MethodInfo {
23039 id: "walletobjects.issuer.insert",
23040 http_method: hyper::Method::POST,
23041 });
23042
23043 for &field in ["alt"].iter() {
23044 if self._additional_params.contains_key(field) {
23045 dlg.finished(false);
23046 return Err(common::Error::FieldClash(field));
23047 }
23048 }
23049
23050 let mut params = Params::with_capacity(3 + self._additional_params.len());
23051
23052 params.extend(self._additional_params.iter());
23053
23054 params.push("alt", "json");
23055 let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer";
23056 if self._scopes.is_empty() {
23057 self._scopes
23058 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
23059 }
23060
23061 let url = params.parse_with_url(&url);
23062
23063 let mut json_mime_type = mime::APPLICATION_JSON;
23064 let mut request_value_reader = {
23065 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23066 common::remove_json_null_values(&mut value);
23067 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23068 serde_json::to_writer(&mut dst, &value).unwrap();
23069 dst
23070 };
23071 let request_size = request_value_reader
23072 .seek(std::io::SeekFrom::End(0))
23073 .unwrap();
23074 request_value_reader
23075 .seek(std::io::SeekFrom::Start(0))
23076 .unwrap();
23077
23078 loop {
23079 let token = match self
23080 .hub
23081 .auth
23082 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23083 .await
23084 {
23085 Ok(token) => token,
23086 Err(e) => match dlg.token(e) {
23087 Ok(token) => token,
23088 Err(e) => {
23089 dlg.finished(false);
23090 return Err(common::Error::MissingToken(e));
23091 }
23092 },
23093 };
23094 request_value_reader
23095 .seek(std::io::SeekFrom::Start(0))
23096 .unwrap();
23097 let mut req_result = {
23098 let client = &self.hub.client;
23099 dlg.pre_request();
23100 let mut req_builder = hyper::Request::builder()
23101 .method(hyper::Method::POST)
23102 .uri(url.as_str())
23103 .header(USER_AGENT, self.hub._user_agent.clone());
23104
23105 if let Some(token) = token.as_ref() {
23106 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23107 }
23108
23109 let request = req_builder
23110 .header(CONTENT_TYPE, json_mime_type.to_string())
23111 .header(CONTENT_LENGTH, request_size as u64)
23112 .body(common::to_body(
23113 request_value_reader.get_ref().clone().into(),
23114 ));
23115
23116 client.request(request.unwrap()).await
23117 };
23118
23119 match req_result {
23120 Err(err) => {
23121 if let common::Retry::After(d) = dlg.http_error(&err) {
23122 sleep(d).await;
23123 continue;
23124 }
23125 dlg.finished(false);
23126 return Err(common::Error::HttpError(err));
23127 }
23128 Ok(res) => {
23129 let (mut parts, body) = res.into_parts();
23130 let mut body = common::Body::new(body);
23131 if !parts.status.is_success() {
23132 let bytes = common::to_bytes(body).await.unwrap_or_default();
23133 let error = serde_json::from_str(&common::to_string(&bytes));
23134 let response = common::to_response(parts, bytes.into());
23135
23136 if let common::Retry::After(d) =
23137 dlg.http_failure(&response, error.as_ref().ok())
23138 {
23139 sleep(d).await;
23140 continue;
23141 }
23142
23143 dlg.finished(false);
23144
23145 return Err(match error {
23146 Ok(value) => common::Error::BadRequest(value),
23147 _ => common::Error::Failure(response),
23148 });
23149 }
23150 let response = {
23151 let bytes = common::to_bytes(body).await.unwrap_or_default();
23152 let encoded = common::to_string(&bytes);
23153 match serde_json::from_str(&encoded) {
23154 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23155 Err(error) => {
23156 dlg.response_json_decode_error(&encoded, &error);
23157 return Err(common::Error::JsonDecodeError(
23158 encoded.to_string(),
23159 error,
23160 ));
23161 }
23162 }
23163 };
23164
23165 dlg.finished(true);
23166 return Ok(response);
23167 }
23168 }
23169 }
23170 }
23171
23172 ///
23173 /// Sets the *request* property to the given value.
23174 ///
23175 /// Even though the property as already been set when instantiating this call,
23176 /// we provide this method for API completeness.
23177 pub fn request(mut self, new_value: Issuer) -> IssuerInsertCall<'a, C> {
23178 self._request = new_value;
23179 self
23180 }
23181 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23182 /// while executing the actual API request.
23183 ///
23184 /// ````text
23185 /// It should be used to handle progress information, and to implement a certain level of resilience.
23186 /// ````
23187 ///
23188 /// Sets the *delegate* property to the given value.
23189 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerInsertCall<'a, C> {
23190 self._delegate = Some(new_value);
23191 self
23192 }
23193
23194 /// Set any additional parameter of the query string used in the request.
23195 /// It should be used to set parameters which are not yet available through their own
23196 /// setters.
23197 ///
23198 /// Please note that this method must not be used to set any of the known parameters
23199 /// which have their own setter method. If done anyway, the request will fail.
23200 ///
23201 /// # Additional Parameters
23202 ///
23203 /// * *$.xgafv* (query-string) - V1 error format.
23204 /// * *access_token* (query-string) - OAuth access token.
23205 /// * *alt* (query-string) - Data format for response.
23206 /// * *callback* (query-string) - JSONP
23207 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23208 /// * *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.
23209 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23210 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23211 /// * *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.
23212 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23213 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23214 pub fn param<T>(mut self, name: T, value: T) -> IssuerInsertCall<'a, C>
23215 where
23216 T: AsRef<str>,
23217 {
23218 self._additional_params
23219 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23220 self
23221 }
23222
23223 /// Identifies the authorization scope for the method you are building.
23224 ///
23225 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23226 /// [`Scope::WalletObjectIssuer`].
23227 ///
23228 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23229 /// tokens for more than one scope.
23230 ///
23231 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23232 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23233 /// sufficient, a read-write scope will do as well.
23234 pub fn add_scope<St>(mut self, scope: St) -> IssuerInsertCall<'a, C>
23235 where
23236 St: AsRef<str>,
23237 {
23238 self._scopes.insert(String::from(scope.as_ref()));
23239 self
23240 }
23241 /// Identifies the authorization scope(s) for the method you are building.
23242 ///
23243 /// See [`Self::add_scope()`] for details.
23244 pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerInsertCall<'a, C>
23245 where
23246 I: IntoIterator<Item = St>,
23247 St: AsRef<str>,
23248 {
23249 self._scopes
23250 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23251 self
23252 }
23253
23254 /// Removes all scopes, and no default scope will be used either.
23255 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23256 /// for details).
23257 pub fn clear_scopes(mut self) -> IssuerInsertCall<'a, C> {
23258 self._scopes.clear();
23259 self
23260 }
23261}
23262
23263/// Returns a list of all issuers shared to the caller.
23264///
23265/// A builder for the *list* method supported by a *issuer* resource.
23266/// It is not used directly, but through a [`IssuerMethods`] instance.
23267///
23268/// # Example
23269///
23270/// Instantiate a resource method builder
23271///
23272/// ```test_harness,no_run
23273/// # extern crate hyper;
23274/// # extern crate hyper_rustls;
23275/// # extern crate google_walletobjects1 as walletobjects1;
23276/// # async fn dox() {
23277/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23278///
23279/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23280/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23281/// # secret,
23282/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23283/// # ).build().await.unwrap();
23284///
23285/// # let client = hyper_util::client::legacy::Client::builder(
23286/// # hyper_util::rt::TokioExecutor::new()
23287/// # )
23288/// # .build(
23289/// # hyper_rustls::HttpsConnectorBuilder::new()
23290/// # .with_native_roots()
23291/// # .unwrap()
23292/// # .https_or_http()
23293/// # .enable_http1()
23294/// # .build()
23295/// # );
23296/// # let mut hub = Walletobjects::new(client, auth);
23297/// // You can configure optional parameters by calling the respective setters at will, and
23298/// // execute the final call using `doit()`.
23299/// // Values shown here are possibly random and not representative !
23300/// let result = hub.issuer().list()
23301/// .doit().await;
23302/// # }
23303/// ```
23304pub struct IssuerListCall<'a, C>
23305where
23306 C: 'a,
23307{
23308 hub: &'a Walletobjects<C>,
23309 _delegate: Option<&'a mut dyn common::Delegate>,
23310 _additional_params: HashMap<String, String>,
23311 _scopes: BTreeSet<String>,
23312}
23313
23314impl<'a, C> common::CallBuilder for IssuerListCall<'a, C> {}
23315
23316impl<'a, C> IssuerListCall<'a, C>
23317where
23318 C: common::Connector,
23319{
23320 /// Perform the operation you have build so far.
23321 pub async fn doit(mut self) -> common::Result<(common::Response, IssuerListResponse)> {
23322 use std::borrow::Cow;
23323 use std::io::{Read, Seek};
23324
23325 use common::{url::Params, ToParts};
23326 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23327
23328 let mut dd = common::DefaultDelegate;
23329 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23330 dlg.begin(common::MethodInfo {
23331 id: "walletobjects.issuer.list",
23332 http_method: hyper::Method::GET,
23333 });
23334
23335 for &field in ["alt"].iter() {
23336 if self._additional_params.contains_key(field) {
23337 dlg.finished(false);
23338 return Err(common::Error::FieldClash(field));
23339 }
23340 }
23341
23342 let mut params = Params::with_capacity(2 + self._additional_params.len());
23343
23344 params.extend(self._additional_params.iter());
23345
23346 params.push("alt", "json");
23347 let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer";
23348 if self._scopes.is_empty() {
23349 self._scopes
23350 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
23351 }
23352
23353 let url = params.parse_with_url(&url);
23354
23355 loop {
23356 let token = match self
23357 .hub
23358 .auth
23359 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23360 .await
23361 {
23362 Ok(token) => token,
23363 Err(e) => match dlg.token(e) {
23364 Ok(token) => token,
23365 Err(e) => {
23366 dlg.finished(false);
23367 return Err(common::Error::MissingToken(e));
23368 }
23369 },
23370 };
23371 let mut req_result = {
23372 let client = &self.hub.client;
23373 dlg.pre_request();
23374 let mut req_builder = hyper::Request::builder()
23375 .method(hyper::Method::GET)
23376 .uri(url.as_str())
23377 .header(USER_AGENT, self.hub._user_agent.clone());
23378
23379 if let Some(token) = token.as_ref() {
23380 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23381 }
23382
23383 let request = req_builder
23384 .header(CONTENT_LENGTH, 0_u64)
23385 .body(common::to_body::<String>(None));
23386
23387 client.request(request.unwrap()).await
23388 };
23389
23390 match req_result {
23391 Err(err) => {
23392 if let common::Retry::After(d) = dlg.http_error(&err) {
23393 sleep(d).await;
23394 continue;
23395 }
23396 dlg.finished(false);
23397 return Err(common::Error::HttpError(err));
23398 }
23399 Ok(res) => {
23400 let (mut parts, body) = res.into_parts();
23401 let mut body = common::Body::new(body);
23402 if !parts.status.is_success() {
23403 let bytes = common::to_bytes(body).await.unwrap_or_default();
23404 let error = serde_json::from_str(&common::to_string(&bytes));
23405 let response = common::to_response(parts, bytes.into());
23406
23407 if let common::Retry::After(d) =
23408 dlg.http_failure(&response, error.as_ref().ok())
23409 {
23410 sleep(d).await;
23411 continue;
23412 }
23413
23414 dlg.finished(false);
23415
23416 return Err(match error {
23417 Ok(value) => common::Error::BadRequest(value),
23418 _ => common::Error::Failure(response),
23419 });
23420 }
23421 let response = {
23422 let bytes = common::to_bytes(body).await.unwrap_or_default();
23423 let encoded = common::to_string(&bytes);
23424 match serde_json::from_str(&encoded) {
23425 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23426 Err(error) => {
23427 dlg.response_json_decode_error(&encoded, &error);
23428 return Err(common::Error::JsonDecodeError(
23429 encoded.to_string(),
23430 error,
23431 ));
23432 }
23433 }
23434 };
23435
23436 dlg.finished(true);
23437 return Ok(response);
23438 }
23439 }
23440 }
23441 }
23442
23443 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23444 /// while executing the actual API request.
23445 ///
23446 /// ````text
23447 /// It should be used to handle progress information, and to implement a certain level of resilience.
23448 /// ````
23449 ///
23450 /// Sets the *delegate* property to the given value.
23451 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerListCall<'a, C> {
23452 self._delegate = Some(new_value);
23453 self
23454 }
23455
23456 /// Set any additional parameter of the query string used in the request.
23457 /// It should be used to set parameters which are not yet available through their own
23458 /// setters.
23459 ///
23460 /// Please note that this method must not be used to set any of the known parameters
23461 /// which have their own setter method. If done anyway, the request will fail.
23462 ///
23463 /// # Additional Parameters
23464 ///
23465 /// * *$.xgafv* (query-string) - V1 error format.
23466 /// * *access_token* (query-string) - OAuth access token.
23467 /// * *alt* (query-string) - Data format for response.
23468 /// * *callback* (query-string) - JSONP
23469 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23470 /// * *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.
23471 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23472 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23473 /// * *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.
23474 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23475 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23476 pub fn param<T>(mut self, name: T, value: T) -> IssuerListCall<'a, C>
23477 where
23478 T: AsRef<str>,
23479 {
23480 self._additional_params
23481 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23482 self
23483 }
23484
23485 /// Identifies the authorization scope for the method you are building.
23486 ///
23487 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23488 /// [`Scope::WalletObjectIssuer`].
23489 ///
23490 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23491 /// tokens for more than one scope.
23492 ///
23493 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23494 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23495 /// sufficient, a read-write scope will do as well.
23496 pub fn add_scope<St>(mut self, scope: St) -> IssuerListCall<'a, C>
23497 where
23498 St: AsRef<str>,
23499 {
23500 self._scopes.insert(String::from(scope.as_ref()));
23501 self
23502 }
23503 /// Identifies the authorization scope(s) for the method you are building.
23504 ///
23505 /// See [`Self::add_scope()`] for details.
23506 pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerListCall<'a, C>
23507 where
23508 I: IntoIterator<Item = St>,
23509 St: AsRef<str>,
23510 {
23511 self._scopes
23512 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23513 self
23514 }
23515
23516 /// Removes all scopes, and no default scope will be used either.
23517 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23518 /// for details).
23519 pub fn clear_scopes(mut self) -> IssuerListCall<'a, C> {
23520 self._scopes.clear();
23521 self
23522 }
23523}
23524
23525/// Updates the issuer referenced by the given issuer ID. This method supports patch semantics.
23526///
23527/// A builder for the *patch* method supported by a *issuer* resource.
23528/// It is not used directly, but through a [`IssuerMethods`] instance.
23529///
23530/// # Example
23531///
23532/// Instantiate a resource method builder
23533///
23534/// ```test_harness,no_run
23535/// # extern crate hyper;
23536/// # extern crate hyper_rustls;
23537/// # extern crate google_walletobjects1 as walletobjects1;
23538/// use walletobjects1::api::Issuer;
23539/// # async fn dox() {
23540/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23541///
23542/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23543/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23544/// # secret,
23545/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23546/// # ).build().await.unwrap();
23547///
23548/// # let client = hyper_util::client::legacy::Client::builder(
23549/// # hyper_util::rt::TokioExecutor::new()
23550/// # )
23551/// # .build(
23552/// # hyper_rustls::HttpsConnectorBuilder::new()
23553/// # .with_native_roots()
23554/// # .unwrap()
23555/// # .https_or_http()
23556/// # .enable_http1()
23557/// # .build()
23558/// # );
23559/// # let mut hub = Walletobjects::new(client, auth);
23560/// // As the method needs a request, you would usually fill it with the desired information
23561/// // into the respective structure. Some of the parts shown here might not be applicable !
23562/// // Values shown here are possibly random and not representative !
23563/// let mut req = Issuer::default();
23564///
23565/// // You can configure optional parameters by calling the respective setters at will, and
23566/// // execute the final call using `doit()`.
23567/// // Values shown here are possibly random and not representative !
23568/// let result = hub.issuer().patch(req, -95)
23569/// .doit().await;
23570/// # }
23571/// ```
23572pub struct IssuerPatchCall<'a, C>
23573where
23574 C: 'a,
23575{
23576 hub: &'a Walletobjects<C>,
23577 _request: Issuer,
23578 _resource_id: i64,
23579 _delegate: Option<&'a mut dyn common::Delegate>,
23580 _additional_params: HashMap<String, String>,
23581 _scopes: BTreeSet<String>,
23582}
23583
23584impl<'a, C> common::CallBuilder for IssuerPatchCall<'a, C> {}
23585
23586impl<'a, C> IssuerPatchCall<'a, C>
23587where
23588 C: common::Connector,
23589{
23590 /// Perform the operation you have build so far.
23591 pub async fn doit(mut self) -> common::Result<(common::Response, Issuer)> {
23592 use std::borrow::Cow;
23593 use std::io::{Read, Seek};
23594
23595 use common::{url::Params, ToParts};
23596 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23597
23598 let mut dd = common::DefaultDelegate;
23599 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23600 dlg.begin(common::MethodInfo {
23601 id: "walletobjects.issuer.patch",
23602 http_method: hyper::Method::PATCH,
23603 });
23604
23605 for &field in ["alt", "resourceId"].iter() {
23606 if self._additional_params.contains_key(field) {
23607 dlg.finished(false);
23608 return Err(common::Error::FieldClash(field));
23609 }
23610 }
23611
23612 let mut params = Params::with_capacity(4 + self._additional_params.len());
23613 params.push("resourceId", self._resource_id.to_string());
23614
23615 params.extend(self._additional_params.iter());
23616
23617 params.push("alt", "json");
23618 let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer/{resourceId}";
23619 if self._scopes.is_empty() {
23620 self._scopes
23621 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
23622 }
23623
23624 #[allow(clippy::single_element_loop)]
23625 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
23626 url = params.uri_replacement(url, param_name, find_this, false);
23627 }
23628 {
23629 let to_remove = ["resourceId"];
23630 params.remove_params(&to_remove);
23631 }
23632
23633 let url = params.parse_with_url(&url);
23634
23635 let mut json_mime_type = mime::APPLICATION_JSON;
23636 let mut request_value_reader = {
23637 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23638 common::remove_json_null_values(&mut value);
23639 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23640 serde_json::to_writer(&mut dst, &value).unwrap();
23641 dst
23642 };
23643 let request_size = request_value_reader
23644 .seek(std::io::SeekFrom::End(0))
23645 .unwrap();
23646 request_value_reader
23647 .seek(std::io::SeekFrom::Start(0))
23648 .unwrap();
23649
23650 loop {
23651 let token = match self
23652 .hub
23653 .auth
23654 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23655 .await
23656 {
23657 Ok(token) => token,
23658 Err(e) => match dlg.token(e) {
23659 Ok(token) => token,
23660 Err(e) => {
23661 dlg.finished(false);
23662 return Err(common::Error::MissingToken(e));
23663 }
23664 },
23665 };
23666 request_value_reader
23667 .seek(std::io::SeekFrom::Start(0))
23668 .unwrap();
23669 let mut req_result = {
23670 let client = &self.hub.client;
23671 dlg.pre_request();
23672 let mut req_builder = hyper::Request::builder()
23673 .method(hyper::Method::PATCH)
23674 .uri(url.as_str())
23675 .header(USER_AGENT, self.hub._user_agent.clone());
23676
23677 if let Some(token) = token.as_ref() {
23678 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23679 }
23680
23681 let request = req_builder
23682 .header(CONTENT_TYPE, json_mime_type.to_string())
23683 .header(CONTENT_LENGTH, request_size as u64)
23684 .body(common::to_body(
23685 request_value_reader.get_ref().clone().into(),
23686 ));
23687
23688 client.request(request.unwrap()).await
23689 };
23690
23691 match req_result {
23692 Err(err) => {
23693 if let common::Retry::After(d) = dlg.http_error(&err) {
23694 sleep(d).await;
23695 continue;
23696 }
23697 dlg.finished(false);
23698 return Err(common::Error::HttpError(err));
23699 }
23700 Ok(res) => {
23701 let (mut parts, body) = res.into_parts();
23702 let mut body = common::Body::new(body);
23703 if !parts.status.is_success() {
23704 let bytes = common::to_bytes(body).await.unwrap_or_default();
23705 let error = serde_json::from_str(&common::to_string(&bytes));
23706 let response = common::to_response(parts, bytes.into());
23707
23708 if let common::Retry::After(d) =
23709 dlg.http_failure(&response, error.as_ref().ok())
23710 {
23711 sleep(d).await;
23712 continue;
23713 }
23714
23715 dlg.finished(false);
23716
23717 return Err(match error {
23718 Ok(value) => common::Error::BadRequest(value),
23719 _ => common::Error::Failure(response),
23720 });
23721 }
23722 let response = {
23723 let bytes = common::to_bytes(body).await.unwrap_or_default();
23724 let encoded = common::to_string(&bytes);
23725 match serde_json::from_str(&encoded) {
23726 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23727 Err(error) => {
23728 dlg.response_json_decode_error(&encoded, &error);
23729 return Err(common::Error::JsonDecodeError(
23730 encoded.to_string(),
23731 error,
23732 ));
23733 }
23734 }
23735 };
23736
23737 dlg.finished(true);
23738 return Ok(response);
23739 }
23740 }
23741 }
23742 }
23743
23744 ///
23745 /// Sets the *request* property to the given value.
23746 ///
23747 /// Even though the property as already been set when instantiating this call,
23748 /// we provide this method for API completeness.
23749 pub fn request(mut self, new_value: Issuer) -> IssuerPatchCall<'a, C> {
23750 self._request = new_value;
23751 self
23752 }
23753 /// The unique identifier for an issuer.
23754 ///
23755 /// Sets the *resource id* path property to the given value.
23756 ///
23757 /// Even though the property as already been set when instantiating this call,
23758 /// we provide this method for API completeness.
23759 pub fn resource_id(mut self, new_value: i64) -> IssuerPatchCall<'a, C> {
23760 self._resource_id = new_value;
23761 self
23762 }
23763 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23764 /// while executing the actual API request.
23765 ///
23766 /// ````text
23767 /// It should be used to handle progress information, and to implement a certain level of resilience.
23768 /// ````
23769 ///
23770 /// Sets the *delegate* property to the given value.
23771 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerPatchCall<'a, C> {
23772 self._delegate = Some(new_value);
23773 self
23774 }
23775
23776 /// Set any additional parameter of the query string used in the request.
23777 /// It should be used to set parameters which are not yet available through their own
23778 /// setters.
23779 ///
23780 /// Please note that this method must not be used to set any of the known parameters
23781 /// which have their own setter method. If done anyway, the request will fail.
23782 ///
23783 /// # Additional Parameters
23784 ///
23785 /// * *$.xgafv* (query-string) - V1 error format.
23786 /// * *access_token* (query-string) - OAuth access token.
23787 /// * *alt* (query-string) - Data format for response.
23788 /// * *callback* (query-string) - JSONP
23789 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23790 /// * *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.
23791 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23792 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23793 /// * *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.
23794 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23795 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23796 pub fn param<T>(mut self, name: T, value: T) -> IssuerPatchCall<'a, C>
23797 where
23798 T: AsRef<str>,
23799 {
23800 self._additional_params
23801 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23802 self
23803 }
23804
23805 /// Identifies the authorization scope for the method you are building.
23806 ///
23807 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23808 /// [`Scope::WalletObjectIssuer`].
23809 ///
23810 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23811 /// tokens for more than one scope.
23812 ///
23813 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23814 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23815 /// sufficient, a read-write scope will do as well.
23816 pub fn add_scope<St>(mut self, scope: St) -> IssuerPatchCall<'a, C>
23817 where
23818 St: AsRef<str>,
23819 {
23820 self._scopes.insert(String::from(scope.as_ref()));
23821 self
23822 }
23823 /// Identifies the authorization scope(s) for the method you are building.
23824 ///
23825 /// See [`Self::add_scope()`] for details.
23826 pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerPatchCall<'a, C>
23827 where
23828 I: IntoIterator<Item = St>,
23829 St: AsRef<str>,
23830 {
23831 self._scopes
23832 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23833 self
23834 }
23835
23836 /// Removes all scopes, and no default scope will be used either.
23837 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23838 /// for details).
23839 pub fn clear_scopes(mut self) -> IssuerPatchCall<'a, C> {
23840 self._scopes.clear();
23841 self
23842 }
23843}
23844
23845/// Updates the issuer referenced by the given issuer ID.
23846///
23847/// A builder for the *update* method supported by a *issuer* resource.
23848/// It is not used directly, but through a [`IssuerMethods`] instance.
23849///
23850/// # Example
23851///
23852/// Instantiate a resource method builder
23853///
23854/// ```test_harness,no_run
23855/// # extern crate hyper;
23856/// # extern crate hyper_rustls;
23857/// # extern crate google_walletobjects1 as walletobjects1;
23858/// use walletobjects1::api::Issuer;
23859/// # async fn dox() {
23860/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23861///
23862/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23863/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23864/// # secret,
23865/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23866/// # ).build().await.unwrap();
23867///
23868/// # let client = hyper_util::client::legacy::Client::builder(
23869/// # hyper_util::rt::TokioExecutor::new()
23870/// # )
23871/// # .build(
23872/// # hyper_rustls::HttpsConnectorBuilder::new()
23873/// # .with_native_roots()
23874/// # .unwrap()
23875/// # .https_or_http()
23876/// # .enable_http1()
23877/// # .build()
23878/// # );
23879/// # let mut hub = Walletobjects::new(client, auth);
23880/// // As the method needs a request, you would usually fill it with the desired information
23881/// // into the respective structure. Some of the parts shown here might not be applicable !
23882/// // Values shown here are possibly random and not representative !
23883/// let mut req = Issuer::default();
23884///
23885/// // You can configure optional parameters by calling the respective setters at will, and
23886/// // execute the final call using `doit()`.
23887/// // Values shown here are possibly random and not representative !
23888/// let result = hub.issuer().update(req, -15)
23889/// .doit().await;
23890/// # }
23891/// ```
23892pub struct IssuerUpdateCall<'a, C>
23893where
23894 C: 'a,
23895{
23896 hub: &'a Walletobjects<C>,
23897 _request: Issuer,
23898 _resource_id: i64,
23899 _delegate: Option<&'a mut dyn common::Delegate>,
23900 _additional_params: HashMap<String, String>,
23901 _scopes: BTreeSet<String>,
23902}
23903
23904impl<'a, C> common::CallBuilder for IssuerUpdateCall<'a, C> {}
23905
23906impl<'a, C> IssuerUpdateCall<'a, C>
23907where
23908 C: common::Connector,
23909{
23910 /// Perform the operation you have build so far.
23911 pub async fn doit(mut self) -> common::Result<(common::Response, Issuer)> {
23912 use std::borrow::Cow;
23913 use std::io::{Read, Seek};
23914
23915 use common::{url::Params, ToParts};
23916 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23917
23918 let mut dd = common::DefaultDelegate;
23919 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23920 dlg.begin(common::MethodInfo {
23921 id: "walletobjects.issuer.update",
23922 http_method: hyper::Method::PUT,
23923 });
23924
23925 for &field in ["alt", "resourceId"].iter() {
23926 if self._additional_params.contains_key(field) {
23927 dlg.finished(false);
23928 return Err(common::Error::FieldClash(field));
23929 }
23930 }
23931
23932 let mut params = Params::with_capacity(4 + self._additional_params.len());
23933 params.push("resourceId", self._resource_id.to_string());
23934
23935 params.extend(self._additional_params.iter());
23936
23937 params.push("alt", "json");
23938 let mut url = self.hub._base_url.clone() + "walletobjects/v1/issuer/{resourceId}";
23939 if self._scopes.is_empty() {
23940 self._scopes
23941 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
23942 }
23943
23944 #[allow(clippy::single_element_loop)]
23945 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
23946 url = params.uri_replacement(url, param_name, find_this, false);
23947 }
23948 {
23949 let to_remove = ["resourceId"];
23950 params.remove_params(&to_remove);
23951 }
23952
23953 let url = params.parse_with_url(&url);
23954
23955 let mut json_mime_type = mime::APPLICATION_JSON;
23956 let mut request_value_reader = {
23957 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23958 common::remove_json_null_values(&mut value);
23959 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23960 serde_json::to_writer(&mut dst, &value).unwrap();
23961 dst
23962 };
23963 let request_size = request_value_reader
23964 .seek(std::io::SeekFrom::End(0))
23965 .unwrap();
23966 request_value_reader
23967 .seek(std::io::SeekFrom::Start(0))
23968 .unwrap();
23969
23970 loop {
23971 let token = match self
23972 .hub
23973 .auth
23974 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23975 .await
23976 {
23977 Ok(token) => token,
23978 Err(e) => match dlg.token(e) {
23979 Ok(token) => token,
23980 Err(e) => {
23981 dlg.finished(false);
23982 return Err(common::Error::MissingToken(e));
23983 }
23984 },
23985 };
23986 request_value_reader
23987 .seek(std::io::SeekFrom::Start(0))
23988 .unwrap();
23989 let mut req_result = {
23990 let client = &self.hub.client;
23991 dlg.pre_request();
23992 let mut req_builder = hyper::Request::builder()
23993 .method(hyper::Method::PUT)
23994 .uri(url.as_str())
23995 .header(USER_AGENT, self.hub._user_agent.clone());
23996
23997 if let Some(token) = token.as_ref() {
23998 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23999 }
24000
24001 let request = req_builder
24002 .header(CONTENT_TYPE, json_mime_type.to_string())
24003 .header(CONTENT_LENGTH, request_size as u64)
24004 .body(common::to_body(
24005 request_value_reader.get_ref().clone().into(),
24006 ));
24007
24008 client.request(request.unwrap()).await
24009 };
24010
24011 match req_result {
24012 Err(err) => {
24013 if let common::Retry::After(d) = dlg.http_error(&err) {
24014 sleep(d).await;
24015 continue;
24016 }
24017 dlg.finished(false);
24018 return Err(common::Error::HttpError(err));
24019 }
24020 Ok(res) => {
24021 let (mut parts, body) = res.into_parts();
24022 let mut body = common::Body::new(body);
24023 if !parts.status.is_success() {
24024 let bytes = common::to_bytes(body).await.unwrap_or_default();
24025 let error = serde_json::from_str(&common::to_string(&bytes));
24026 let response = common::to_response(parts, bytes.into());
24027
24028 if let common::Retry::After(d) =
24029 dlg.http_failure(&response, error.as_ref().ok())
24030 {
24031 sleep(d).await;
24032 continue;
24033 }
24034
24035 dlg.finished(false);
24036
24037 return Err(match error {
24038 Ok(value) => common::Error::BadRequest(value),
24039 _ => common::Error::Failure(response),
24040 });
24041 }
24042 let response = {
24043 let bytes = common::to_bytes(body).await.unwrap_or_default();
24044 let encoded = common::to_string(&bytes);
24045 match serde_json::from_str(&encoded) {
24046 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24047 Err(error) => {
24048 dlg.response_json_decode_error(&encoded, &error);
24049 return Err(common::Error::JsonDecodeError(
24050 encoded.to_string(),
24051 error,
24052 ));
24053 }
24054 }
24055 };
24056
24057 dlg.finished(true);
24058 return Ok(response);
24059 }
24060 }
24061 }
24062 }
24063
24064 ///
24065 /// Sets the *request* property to the given value.
24066 ///
24067 /// Even though the property as already been set when instantiating this call,
24068 /// we provide this method for API completeness.
24069 pub fn request(mut self, new_value: Issuer) -> IssuerUpdateCall<'a, C> {
24070 self._request = new_value;
24071 self
24072 }
24073 /// The unique identifier for an issuer.
24074 ///
24075 /// Sets the *resource id* path property to the given value.
24076 ///
24077 /// Even though the property as already been set when instantiating this call,
24078 /// we provide this method for API completeness.
24079 pub fn resource_id(mut self, new_value: i64) -> IssuerUpdateCall<'a, C> {
24080 self._resource_id = new_value;
24081 self
24082 }
24083 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24084 /// while executing the actual API request.
24085 ///
24086 /// ````text
24087 /// It should be used to handle progress information, and to implement a certain level of resilience.
24088 /// ````
24089 ///
24090 /// Sets the *delegate* property to the given value.
24091 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> IssuerUpdateCall<'a, C> {
24092 self._delegate = Some(new_value);
24093 self
24094 }
24095
24096 /// Set any additional parameter of the query string used in the request.
24097 /// It should be used to set parameters which are not yet available through their own
24098 /// setters.
24099 ///
24100 /// Please note that this method must not be used to set any of the known parameters
24101 /// which have their own setter method. If done anyway, the request will fail.
24102 ///
24103 /// # Additional Parameters
24104 ///
24105 /// * *$.xgafv* (query-string) - V1 error format.
24106 /// * *access_token* (query-string) - OAuth access token.
24107 /// * *alt* (query-string) - Data format for response.
24108 /// * *callback* (query-string) - JSONP
24109 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24110 /// * *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.
24111 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24112 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24113 /// * *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.
24114 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24115 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24116 pub fn param<T>(mut self, name: T, value: T) -> IssuerUpdateCall<'a, C>
24117 where
24118 T: AsRef<str>,
24119 {
24120 self._additional_params
24121 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24122 self
24123 }
24124
24125 /// Identifies the authorization scope for the method you are building.
24126 ///
24127 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24128 /// [`Scope::WalletObjectIssuer`].
24129 ///
24130 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24131 /// tokens for more than one scope.
24132 ///
24133 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24134 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24135 /// sufficient, a read-write scope will do as well.
24136 pub fn add_scope<St>(mut self, scope: St) -> IssuerUpdateCall<'a, C>
24137 where
24138 St: AsRef<str>,
24139 {
24140 self._scopes.insert(String::from(scope.as_ref()));
24141 self
24142 }
24143 /// Identifies the authorization scope(s) for the method you are building.
24144 ///
24145 /// See [`Self::add_scope()`] for details.
24146 pub fn add_scopes<I, St>(mut self, scopes: I) -> IssuerUpdateCall<'a, C>
24147 where
24148 I: IntoIterator<Item = St>,
24149 St: AsRef<str>,
24150 {
24151 self._scopes
24152 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24153 self
24154 }
24155
24156 /// Removes all scopes, and no default scope will be used either.
24157 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24158 /// for details).
24159 pub fn clear_scopes(mut self) -> IssuerUpdateCall<'a, C> {
24160 self._scopes.clear();
24161 self
24162 }
24163}
24164
24165/// Inserts the resources in the JWT.
24166///
24167/// A builder for the *insert* method supported by a *jwt* resource.
24168/// It is not used directly, but through a [`JwtMethods`] instance.
24169///
24170/// # Example
24171///
24172/// Instantiate a resource method builder
24173///
24174/// ```test_harness,no_run
24175/// # extern crate hyper;
24176/// # extern crate hyper_rustls;
24177/// # extern crate google_walletobjects1 as walletobjects1;
24178/// use walletobjects1::api::JwtResource;
24179/// # async fn dox() {
24180/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24181///
24182/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24183/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24184/// # secret,
24185/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24186/// # ).build().await.unwrap();
24187///
24188/// # let client = hyper_util::client::legacy::Client::builder(
24189/// # hyper_util::rt::TokioExecutor::new()
24190/// # )
24191/// # .build(
24192/// # hyper_rustls::HttpsConnectorBuilder::new()
24193/// # .with_native_roots()
24194/// # .unwrap()
24195/// # .https_or_http()
24196/// # .enable_http1()
24197/// # .build()
24198/// # );
24199/// # let mut hub = Walletobjects::new(client, auth);
24200/// // As the method needs a request, you would usually fill it with the desired information
24201/// // into the respective structure. Some of the parts shown here might not be applicable !
24202/// // Values shown here are possibly random and not representative !
24203/// let mut req = JwtResource::default();
24204///
24205/// // You can configure optional parameters by calling the respective setters at will, and
24206/// // execute the final call using `doit()`.
24207/// // Values shown here are possibly random and not representative !
24208/// let result = hub.jwt().insert(req)
24209/// .doit().await;
24210/// # }
24211/// ```
24212pub struct JwtInsertCall<'a, C>
24213where
24214 C: 'a,
24215{
24216 hub: &'a Walletobjects<C>,
24217 _request: JwtResource,
24218 _delegate: Option<&'a mut dyn common::Delegate>,
24219 _additional_params: HashMap<String, String>,
24220 _scopes: BTreeSet<String>,
24221}
24222
24223impl<'a, C> common::CallBuilder for JwtInsertCall<'a, C> {}
24224
24225impl<'a, C> JwtInsertCall<'a, C>
24226where
24227 C: common::Connector,
24228{
24229 /// Perform the operation you have build so far.
24230 pub async fn doit(mut self) -> common::Result<(common::Response, JwtInsertResponse)> {
24231 use std::borrow::Cow;
24232 use std::io::{Read, Seek};
24233
24234 use common::{url::Params, ToParts};
24235 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24236
24237 let mut dd = common::DefaultDelegate;
24238 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24239 dlg.begin(common::MethodInfo {
24240 id: "walletobjects.jwt.insert",
24241 http_method: hyper::Method::POST,
24242 });
24243
24244 for &field in ["alt"].iter() {
24245 if self._additional_params.contains_key(field) {
24246 dlg.finished(false);
24247 return Err(common::Error::FieldClash(field));
24248 }
24249 }
24250
24251 let mut params = Params::with_capacity(3 + self._additional_params.len());
24252
24253 params.extend(self._additional_params.iter());
24254
24255 params.push("alt", "json");
24256 let mut url = self.hub._base_url.clone() + "walletobjects/v1/jwt";
24257 if self._scopes.is_empty() {
24258 self._scopes
24259 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
24260 }
24261
24262 let url = params.parse_with_url(&url);
24263
24264 let mut json_mime_type = mime::APPLICATION_JSON;
24265 let mut request_value_reader = {
24266 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24267 common::remove_json_null_values(&mut value);
24268 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24269 serde_json::to_writer(&mut dst, &value).unwrap();
24270 dst
24271 };
24272 let request_size = request_value_reader
24273 .seek(std::io::SeekFrom::End(0))
24274 .unwrap();
24275 request_value_reader
24276 .seek(std::io::SeekFrom::Start(0))
24277 .unwrap();
24278
24279 loop {
24280 let token = match self
24281 .hub
24282 .auth
24283 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24284 .await
24285 {
24286 Ok(token) => token,
24287 Err(e) => match dlg.token(e) {
24288 Ok(token) => token,
24289 Err(e) => {
24290 dlg.finished(false);
24291 return Err(common::Error::MissingToken(e));
24292 }
24293 },
24294 };
24295 request_value_reader
24296 .seek(std::io::SeekFrom::Start(0))
24297 .unwrap();
24298 let mut req_result = {
24299 let client = &self.hub.client;
24300 dlg.pre_request();
24301 let mut req_builder = hyper::Request::builder()
24302 .method(hyper::Method::POST)
24303 .uri(url.as_str())
24304 .header(USER_AGENT, self.hub._user_agent.clone());
24305
24306 if let Some(token) = token.as_ref() {
24307 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24308 }
24309
24310 let request = req_builder
24311 .header(CONTENT_TYPE, json_mime_type.to_string())
24312 .header(CONTENT_LENGTH, request_size as u64)
24313 .body(common::to_body(
24314 request_value_reader.get_ref().clone().into(),
24315 ));
24316
24317 client.request(request.unwrap()).await
24318 };
24319
24320 match req_result {
24321 Err(err) => {
24322 if let common::Retry::After(d) = dlg.http_error(&err) {
24323 sleep(d).await;
24324 continue;
24325 }
24326 dlg.finished(false);
24327 return Err(common::Error::HttpError(err));
24328 }
24329 Ok(res) => {
24330 let (mut parts, body) = res.into_parts();
24331 let mut body = common::Body::new(body);
24332 if !parts.status.is_success() {
24333 let bytes = common::to_bytes(body).await.unwrap_or_default();
24334 let error = serde_json::from_str(&common::to_string(&bytes));
24335 let response = common::to_response(parts, bytes.into());
24336
24337 if let common::Retry::After(d) =
24338 dlg.http_failure(&response, error.as_ref().ok())
24339 {
24340 sleep(d).await;
24341 continue;
24342 }
24343
24344 dlg.finished(false);
24345
24346 return Err(match error {
24347 Ok(value) => common::Error::BadRequest(value),
24348 _ => common::Error::Failure(response),
24349 });
24350 }
24351 let response = {
24352 let bytes = common::to_bytes(body).await.unwrap_or_default();
24353 let encoded = common::to_string(&bytes);
24354 match serde_json::from_str(&encoded) {
24355 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24356 Err(error) => {
24357 dlg.response_json_decode_error(&encoded, &error);
24358 return Err(common::Error::JsonDecodeError(
24359 encoded.to_string(),
24360 error,
24361 ));
24362 }
24363 }
24364 };
24365
24366 dlg.finished(true);
24367 return Ok(response);
24368 }
24369 }
24370 }
24371 }
24372
24373 ///
24374 /// Sets the *request* property to the given value.
24375 ///
24376 /// Even though the property as already been set when instantiating this call,
24377 /// we provide this method for API completeness.
24378 pub fn request(mut self, new_value: JwtResource) -> JwtInsertCall<'a, C> {
24379 self._request = new_value;
24380 self
24381 }
24382 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24383 /// while executing the actual API request.
24384 ///
24385 /// ````text
24386 /// It should be used to handle progress information, and to implement a certain level of resilience.
24387 /// ````
24388 ///
24389 /// Sets the *delegate* property to the given value.
24390 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JwtInsertCall<'a, C> {
24391 self._delegate = Some(new_value);
24392 self
24393 }
24394
24395 /// Set any additional parameter of the query string used in the request.
24396 /// It should be used to set parameters which are not yet available through their own
24397 /// setters.
24398 ///
24399 /// Please note that this method must not be used to set any of the known parameters
24400 /// which have their own setter method. If done anyway, the request will fail.
24401 ///
24402 /// # Additional Parameters
24403 ///
24404 /// * *$.xgafv* (query-string) - V1 error format.
24405 /// * *access_token* (query-string) - OAuth access token.
24406 /// * *alt* (query-string) - Data format for response.
24407 /// * *callback* (query-string) - JSONP
24408 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24409 /// * *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.
24410 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24411 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24412 /// * *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.
24413 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24414 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24415 pub fn param<T>(mut self, name: T, value: T) -> JwtInsertCall<'a, C>
24416 where
24417 T: AsRef<str>,
24418 {
24419 self._additional_params
24420 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24421 self
24422 }
24423
24424 /// Identifies the authorization scope for the method you are building.
24425 ///
24426 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24427 /// [`Scope::WalletObjectIssuer`].
24428 ///
24429 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24430 /// tokens for more than one scope.
24431 ///
24432 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24433 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24434 /// sufficient, a read-write scope will do as well.
24435 pub fn add_scope<St>(mut self, scope: St) -> JwtInsertCall<'a, C>
24436 where
24437 St: AsRef<str>,
24438 {
24439 self._scopes.insert(String::from(scope.as_ref()));
24440 self
24441 }
24442 /// Identifies the authorization scope(s) for the method you are building.
24443 ///
24444 /// See [`Self::add_scope()`] for details.
24445 pub fn add_scopes<I, St>(mut self, scopes: I) -> JwtInsertCall<'a, C>
24446 where
24447 I: IntoIterator<Item = St>,
24448 St: AsRef<str>,
24449 {
24450 self._scopes
24451 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24452 self
24453 }
24454
24455 /// Removes all scopes, and no default scope will be used either.
24456 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24457 /// for details).
24458 pub fn clear_scopes(mut self) -> JwtInsertCall<'a, C> {
24459 self._scopes.clear();
24460 self
24461 }
24462}
24463
24464/// Adds a message to the loyalty class referenced by the given class ID.
24465///
24466/// A builder for the *addmessage* method supported by a *loyaltyclas* resource.
24467/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
24468///
24469/// # Example
24470///
24471/// Instantiate a resource method builder
24472///
24473/// ```test_harness,no_run
24474/// # extern crate hyper;
24475/// # extern crate hyper_rustls;
24476/// # extern crate google_walletobjects1 as walletobjects1;
24477/// use walletobjects1::api::AddMessageRequest;
24478/// # async fn dox() {
24479/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24480///
24481/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24482/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24483/// # secret,
24484/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24485/// # ).build().await.unwrap();
24486///
24487/// # let client = hyper_util::client::legacy::Client::builder(
24488/// # hyper_util::rt::TokioExecutor::new()
24489/// # )
24490/// # .build(
24491/// # hyper_rustls::HttpsConnectorBuilder::new()
24492/// # .with_native_roots()
24493/// # .unwrap()
24494/// # .https_or_http()
24495/// # .enable_http1()
24496/// # .build()
24497/// # );
24498/// # let mut hub = Walletobjects::new(client, auth);
24499/// // As the method needs a request, you would usually fill it with the desired information
24500/// // into the respective structure. Some of the parts shown here might not be applicable !
24501/// // Values shown here are possibly random and not representative !
24502/// let mut req = AddMessageRequest::default();
24503///
24504/// // You can configure optional parameters by calling the respective setters at will, and
24505/// // execute the final call using `doit()`.
24506/// // Values shown here are possibly random and not representative !
24507/// let result = hub.loyaltyclass().addmessage(req, "resourceId")
24508/// .doit().await;
24509/// # }
24510/// ```
24511pub struct LoyaltyclasAddmessageCall<'a, C>
24512where
24513 C: 'a,
24514{
24515 hub: &'a Walletobjects<C>,
24516 _request: AddMessageRequest,
24517 _resource_id: String,
24518 _delegate: Option<&'a mut dyn common::Delegate>,
24519 _additional_params: HashMap<String, String>,
24520 _scopes: BTreeSet<String>,
24521}
24522
24523impl<'a, C> common::CallBuilder for LoyaltyclasAddmessageCall<'a, C> {}
24524
24525impl<'a, C> LoyaltyclasAddmessageCall<'a, C>
24526where
24527 C: common::Connector,
24528{
24529 /// Perform the operation you have build so far.
24530 pub async fn doit(
24531 mut self,
24532 ) -> common::Result<(common::Response, LoyaltyClassAddMessageResponse)> {
24533 use std::borrow::Cow;
24534 use std::io::{Read, Seek};
24535
24536 use common::{url::Params, ToParts};
24537 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24538
24539 let mut dd = common::DefaultDelegate;
24540 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24541 dlg.begin(common::MethodInfo {
24542 id: "walletobjects.loyaltyclass.addmessage",
24543 http_method: hyper::Method::POST,
24544 });
24545
24546 for &field in ["alt", "resourceId"].iter() {
24547 if self._additional_params.contains_key(field) {
24548 dlg.finished(false);
24549 return Err(common::Error::FieldClash(field));
24550 }
24551 }
24552
24553 let mut params = Params::with_capacity(4 + self._additional_params.len());
24554 params.push("resourceId", self._resource_id);
24555
24556 params.extend(self._additional_params.iter());
24557
24558 params.push("alt", "json");
24559 let mut url =
24560 self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass/{resourceId}/addMessage";
24561 if self._scopes.is_empty() {
24562 self._scopes
24563 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
24564 }
24565
24566 #[allow(clippy::single_element_loop)]
24567 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
24568 url = params.uri_replacement(url, param_name, find_this, false);
24569 }
24570 {
24571 let to_remove = ["resourceId"];
24572 params.remove_params(&to_remove);
24573 }
24574
24575 let url = params.parse_with_url(&url);
24576
24577 let mut json_mime_type = mime::APPLICATION_JSON;
24578 let mut request_value_reader = {
24579 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24580 common::remove_json_null_values(&mut value);
24581 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24582 serde_json::to_writer(&mut dst, &value).unwrap();
24583 dst
24584 };
24585 let request_size = request_value_reader
24586 .seek(std::io::SeekFrom::End(0))
24587 .unwrap();
24588 request_value_reader
24589 .seek(std::io::SeekFrom::Start(0))
24590 .unwrap();
24591
24592 loop {
24593 let token = match self
24594 .hub
24595 .auth
24596 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24597 .await
24598 {
24599 Ok(token) => token,
24600 Err(e) => match dlg.token(e) {
24601 Ok(token) => token,
24602 Err(e) => {
24603 dlg.finished(false);
24604 return Err(common::Error::MissingToken(e));
24605 }
24606 },
24607 };
24608 request_value_reader
24609 .seek(std::io::SeekFrom::Start(0))
24610 .unwrap();
24611 let mut req_result = {
24612 let client = &self.hub.client;
24613 dlg.pre_request();
24614 let mut req_builder = hyper::Request::builder()
24615 .method(hyper::Method::POST)
24616 .uri(url.as_str())
24617 .header(USER_AGENT, self.hub._user_agent.clone());
24618
24619 if let Some(token) = token.as_ref() {
24620 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24621 }
24622
24623 let request = req_builder
24624 .header(CONTENT_TYPE, json_mime_type.to_string())
24625 .header(CONTENT_LENGTH, request_size as u64)
24626 .body(common::to_body(
24627 request_value_reader.get_ref().clone().into(),
24628 ));
24629
24630 client.request(request.unwrap()).await
24631 };
24632
24633 match req_result {
24634 Err(err) => {
24635 if let common::Retry::After(d) = dlg.http_error(&err) {
24636 sleep(d).await;
24637 continue;
24638 }
24639 dlg.finished(false);
24640 return Err(common::Error::HttpError(err));
24641 }
24642 Ok(res) => {
24643 let (mut parts, body) = res.into_parts();
24644 let mut body = common::Body::new(body);
24645 if !parts.status.is_success() {
24646 let bytes = common::to_bytes(body).await.unwrap_or_default();
24647 let error = serde_json::from_str(&common::to_string(&bytes));
24648 let response = common::to_response(parts, bytes.into());
24649
24650 if let common::Retry::After(d) =
24651 dlg.http_failure(&response, error.as_ref().ok())
24652 {
24653 sleep(d).await;
24654 continue;
24655 }
24656
24657 dlg.finished(false);
24658
24659 return Err(match error {
24660 Ok(value) => common::Error::BadRequest(value),
24661 _ => common::Error::Failure(response),
24662 });
24663 }
24664 let response = {
24665 let bytes = common::to_bytes(body).await.unwrap_or_default();
24666 let encoded = common::to_string(&bytes);
24667 match serde_json::from_str(&encoded) {
24668 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24669 Err(error) => {
24670 dlg.response_json_decode_error(&encoded, &error);
24671 return Err(common::Error::JsonDecodeError(
24672 encoded.to_string(),
24673 error,
24674 ));
24675 }
24676 }
24677 };
24678
24679 dlg.finished(true);
24680 return Ok(response);
24681 }
24682 }
24683 }
24684 }
24685
24686 ///
24687 /// Sets the *request* property to the given value.
24688 ///
24689 /// Even though the property as already been set when instantiating this call,
24690 /// we provide this method for API completeness.
24691 pub fn request(mut self, new_value: AddMessageRequest) -> LoyaltyclasAddmessageCall<'a, C> {
24692 self._request = new_value;
24693 self
24694 }
24695 /// 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 '-'.
24696 ///
24697 /// Sets the *resource id* path property to the given value.
24698 ///
24699 /// Even though the property as already been set when instantiating this call,
24700 /// we provide this method for API completeness.
24701 pub fn resource_id(mut self, new_value: &str) -> LoyaltyclasAddmessageCall<'a, C> {
24702 self._resource_id = new_value.to_string();
24703 self
24704 }
24705 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24706 /// while executing the actual API request.
24707 ///
24708 /// ````text
24709 /// It should be used to handle progress information, and to implement a certain level of resilience.
24710 /// ````
24711 ///
24712 /// Sets the *delegate* property to the given value.
24713 pub fn delegate(
24714 mut self,
24715 new_value: &'a mut dyn common::Delegate,
24716 ) -> LoyaltyclasAddmessageCall<'a, C> {
24717 self._delegate = Some(new_value);
24718 self
24719 }
24720
24721 /// Set any additional parameter of the query string used in the request.
24722 /// It should be used to set parameters which are not yet available through their own
24723 /// setters.
24724 ///
24725 /// Please note that this method must not be used to set any of the known parameters
24726 /// which have their own setter method. If done anyway, the request will fail.
24727 ///
24728 /// # Additional Parameters
24729 ///
24730 /// * *$.xgafv* (query-string) - V1 error format.
24731 /// * *access_token* (query-string) - OAuth access token.
24732 /// * *alt* (query-string) - Data format for response.
24733 /// * *callback* (query-string) - JSONP
24734 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24735 /// * *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.
24736 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24737 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24738 /// * *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.
24739 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24740 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24741 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasAddmessageCall<'a, C>
24742 where
24743 T: AsRef<str>,
24744 {
24745 self._additional_params
24746 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24747 self
24748 }
24749
24750 /// Identifies the authorization scope for the method you are building.
24751 ///
24752 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24753 /// [`Scope::WalletObjectIssuer`].
24754 ///
24755 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24756 /// tokens for more than one scope.
24757 ///
24758 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24759 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24760 /// sufficient, a read-write scope will do as well.
24761 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasAddmessageCall<'a, C>
24762 where
24763 St: AsRef<str>,
24764 {
24765 self._scopes.insert(String::from(scope.as_ref()));
24766 self
24767 }
24768 /// Identifies the authorization scope(s) for the method you are building.
24769 ///
24770 /// See [`Self::add_scope()`] for details.
24771 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasAddmessageCall<'a, C>
24772 where
24773 I: IntoIterator<Item = St>,
24774 St: AsRef<str>,
24775 {
24776 self._scopes
24777 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24778 self
24779 }
24780
24781 /// Removes all scopes, and no default scope will be used either.
24782 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24783 /// for details).
24784 pub fn clear_scopes(mut self) -> LoyaltyclasAddmessageCall<'a, C> {
24785 self._scopes.clear();
24786 self
24787 }
24788}
24789
24790/// Returns the loyalty class with the given class ID.
24791///
24792/// A builder for the *get* method supported by a *loyaltyclas* resource.
24793/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
24794///
24795/// # Example
24796///
24797/// Instantiate a resource method builder
24798///
24799/// ```test_harness,no_run
24800/// # extern crate hyper;
24801/// # extern crate hyper_rustls;
24802/// # extern crate google_walletobjects1 as walletobjects1;
24803/// # async fn dox() {
24804/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24805///
24806/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24807/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24808/// # secret,
24809/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24810/// # ).build().await.unwrap();
24811///
24812/// # let client = hyper_util::client::legacy::Client::builder(
24813/// # hyper_util::rt::TokioExecutor::new()
24814/// # )
24815/// # .build(
24816/// # hyper_rustls::HttpsConnectorBuilder::new()
24817/// # .with_native_roots()
24818/// # .unwrap()
24819/// # .https_or_http()
24820/// # .enable_http1()
24821/// # .build()
24822/// # );
24823/// # let mut hub = Walletobjects::new(client, auth);
24824/// // You can configure optional parameters by calling the respective setters at will, and
24825/// // execute the final call using `doit()`.
24826/// // Values shown here are possibly random and not representative !
24827/// let result = hub.loyaltyclass().get("resourceId")
24828/// .doit().await;
24829/// # }
24830/// ```
24831pub struct LoyaltyclasGetCall<'a, C>
24832where
24833 C: 'a,
24834{
24835 hub: &'a Walletobjects<C>,
24836 _resource_id: String,
24837 _delegate: Option<&'a mut dyn common::Delegate>,
24838 _additional_params: HashMap<String, String>,
24839 _scopes: BTreeSet<String>,
24840}
24841
24842impl<'a, C> common::CallBuilder for LoyaltyclasGetCall<'a, C> {}
24843
24844impl<'a, C> LoyaltyclasGetCall<'a, C>
24845where
24846 C: common::Connector,
24847{
24848 /// Perform the operation you have build so far.
24849 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClass)> {
24850 use std::borrow::Cow;
24851 use std::io::{Read, Seek};
24852
24853 use common::{url::Params, ToParts};
24854 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24855
24856 let mut dd = common::DefaultDelegate;
24857 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24858 dlg.begin(common::MethodInfo {
24859 id: "walletobjects.loyaltyclass.get",
24860 http_method: hyper::Method::GET,
24861 });
24862
24863 for &field in ["alt", "resourceId"].iter() {
24864 if self._additional_params.contains_key(field) {
24865 dlg.finished(false);
24866 return Err(common::Error::FieldClash(field));
24867 }
24868 }
24869
24870 let mut params = Params::with_capacity(3 + self._additional_params.len());
24871 params.push("resourceId", self._resource_id);
24872
24873 params.extend(self._additional_params.iter());
24874
24875 params.push("alt", "json");
24876 let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass/{resourceId}";
24877 if self._scopes.is_empty() {
24878 self._scopes
24879 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
24880 }
24881
24882 #[allow(clippy::single_element_loop)]
24883 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
24884 url = params.uri_replacement(url, param_name, find_this, false);
24885 }
24886 {
24887 let to_remove = ["resourceId"];
24888 params.remove_params(&to_remove);
24889 }
24890
24891 let url = params.parse_with_url(&url);
24892
24893 loop {
24894 let token = match self
24895 .hub
24896 .auth
24897 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24898 .await
24899 {
24900 Ok(token) => token,
24901 Err(e) => match dlg.token(e) {
24902 Ok(token) => token,
24903 Err(e) => {
24904 dlg.finished(false);
24905 return Err(common::Error::MissingToken(e));
24906 }
24907 },
24908 };
24909 let mut req_result = {
24910 let client = &self.hub.client;
24911 dlg.pre_request();
24912 let mut req_builder = hyper::Request::builder()
24913 .method(hyper::Method::GET)
24914 .uri(url.as_str())
24915 .header(USER_AGENT, self.hub._user_agent.clone());
24916
24917 if let Some(token) = token.as_ref() {
24918 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24919 }
24920
24921 let request = req_builder
24922 .header(CONTENT_LENGTH, 0_u64)
24923 .body(common::to_body::<String>(None));
24924
24925 client.request(request.unwrap()).await
24926 };
24927
24928 match req_result {
24929 Err(err) => {
24930 if let common::Retry::After(d) = dlg.http_error(&err) {
24931 sleep(d).await;
24932 continue;
24933 }
24934 dlg.finished(false);
24935 return Err(common::Error::HttpError(err));
24936 }
24937 Ok(res) => {
24938 let (mut parts, body) = res.into_parts();
24939 let mut body = common::Body::new(body);
24940 if !parts.status.is_success() {
24941 let bytes = common::to_bytes(body).await.unwrap_or_default();
24942 let error = serde_json::from_str(&common::to_string(&bytes));
24943 let response = common::to_response(parts, bytes.into());
24944
24945 if let common::Retry::After(d) =
24946 dlg.http_failure(&response, error.as_ref().ok())
24947 {
24948 sleep(d).await;
24949 continue;
24950 }
24951
24952 dlg.finished(false);
24953
24954 return Err(match error {
24955 Ok(value) => common::Error::BadRequest(value),
24956 _ => common::Error::Failure(response),
24957 });
24958 }
24959 let response = {
24960 let bytes = common::to_bytes(body).await.unwrap_or_default();
24961 let encoded = common::to_string(&bytes);
24962 match serde_json::from_str(&encoded) {
24963 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24964 Err(error) => {
24965 dlg.response_json_decode_error(&encoded, &error);
24966 return Err(common::Error::JsonDecodeError(
24967 encoded.to_string(),
24968 error,
24969 ));
24970 }
24971 }
24972 };
24973
24974 dlg.finished(true);
24975 return Ok(response);
24976 }
24977 }
24978 }
24979 }
24980
24981 /// 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 '-'.
24982 ///
24983 /// Sets the *resource id* path property to the given value.
24984 ///
24985 /// Even though the property as already been set when instantiating this call,
24986 /// we provide this method for API completeness.
24987 pub fn resource_id(mut self, new_value: &str) -> LoyaltyclasGetCall<'a, C> {
24988 self._resource_id = new_value.to_string();
24989 self
24990 }
24991 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24992 /// while executing the actual API request.
24993 ///
24994 /// ````text
24995 /// It should be used to handle progress information, and to implement a certain level of resilience.
24996 /// ````
24997 ///
24998 /// Sets the *delegate* property to the given value.
24999 pub fn delegate(
25000 mut self,
25001 new_value: &'a mut dyn common::Delegate,
25002 ) -> LoyaltyclasGetCall<'a, C> {
25003 self._delegate = Some(new_value);
25004 self
25005 }
25006
25007 /// Set any additional parameter of the query string used in the request.
25008 /// It should be used to set parameters which are not yet available through their own
25009 /// setters.
25010 ///
25011 /// Please note that this method must not be used to set any of the known parameters
25012 /// which have their own setter method. If done anyway, the request will fail.
25013 ///
25014 /// # Additional Parameters
25015 ///
25016 /// * *$.xgafv* (query-string) - V1 error format.
25017 /// * *access_token* (query-string) - OAuth access token.
25018 /// * *alt* (query-string) - Data format for response.
25019 /// * *callback* (query-string) - JSONP
25020 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25021 /// * *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.
25022 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25023 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25024 /// * *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.
25025 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25026 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25027 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasGetCall<'a, C>
25028 where
25029 T: AsRef<str>,
25030 {
25031 self._additional_params
25032 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25033 self
25034 }
25035
25036 /// Identifies the authorization scope for the method you are building.
25037 ///
25038 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25039 /// [`Scope::WalletObjectIssuer`].
25040 ///
25041 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25042 /// tokens for more than one scope.
25043 ///
25044 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25045 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25046 /// sufficient, a read-write scope will do as well.
25047 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasGetCall<'a, C>
25048 where
25049 St: AsRef<str>,
25050 {
25051 self._scopes.insert(String::from(scope.as_ref()));
25052 self
25053 }
25054 /// Identifies the authorization scope(s) for the method you are building.
25055 ///
25056 /// See [`Self::add_scope()`] for details.
25057 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasGetCall<'a, C>
25058 where
25059 I: IntoIterator<Item = St>,
25060 St: AsRef<str>,
25061 {
25062 self._scopes
25063 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25064 self
25065 }
25066
25067 /// Removes all scopes, and no default scope will be used either.
25068 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25069 /// for details).
25070 pub fn clear_scopes(mut self) -> LoyaltyclasGetCall<'a, C> {
25071 self._scopes.clear();
25072 self
25073 }
25074}
25075
25076/// Inserts an loyalty class with the given ID and properties.
25077///
25078/// A builder for the *insert* method supported by a *loyaltyclas* resource.
25079/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
25080///
25081/// # Example
25082///
25083/// Instantiate a resource method builder
25084///
25085/// ```test_harness,no_run
25086/// # extern crate hyper;
25087/// # extern crate hyper_rustls;
25088/// # extern crate google_walletobjects1 as walletobjects1;
25089/// use walletobjects1::api::LoyaltyClass;
25090/// # async fn dox() {
25091/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25092///
25093/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25094/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25095/// # secret,
25096/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25097/// # ).build().await.unwrap();
25098///
25099/// # let client = hyper_util::client::legacy::Client::builder(
25100/// # hyper_util::rt::TokioExecutor::new()
25101/// # )
25102/// # .build(
25103/// # hyper_rustls::HttpsConnectorBuilder::new()
25104/// # .with_native_roots()
25105/// # .unwrap()
25106/// # .https_or_http()
25107/// # .enable_http1()
25108/// # .build()
25109/// # );
25110/// # let mut hub = Walletobjects::new(client, auth);
25111/// // As the method needs a request, you would usually fill it with the desired information
25112/// // into the respective structure. Some of the parts shown here might not be applicable !
25113/// // Values shown here are possibly random and not representative !
25114/// let mut req = LoyaltyClass::default();
25115///
25116/// // You can configure optional parameters by calling the respective setters at will, and
25117/// // execute the final call using `doit()`.
25118/// // Values shown here are possibly random and not representative !
25119/// let result = hub.loyaltyclass().insert(req)
25120/// .doit().await;
25121/// # }
25122/// ```
25123pub struct LoyaltyclasInsertCall<'a, C>
25124where
25125 C: 'a,
25126{
25127 hub: &'a Walletobjects<C>,
25128 _request: LoyaltyClass,
25129 _delegate: Option<&'a mut dyn common::Delegate>,
25130 _additional_params: HashMap<String, String>,
25131 _scopes: BTreeSet<String>,
25132}
25133
25134impl<'a, C> common::CallBuilder for LoyaltyclasInsertCall<'a, C> {}
25135
25136impl<'a, C> LoyaltyclasInsertCall<'a, C>
25137where
25138 C: common::Connector,
25139{
25140 /// Perform the operation you have build so far.
25141 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClass)> {
25142 use std::borrow::Cow;
25143 use std::io::{Read, Seek};
25144
25145 use common::{url::Params, ToParts};
25146 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25147
25148 let mut dd = common::DefaultDelegate;
25149 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25150 dlg.begin(common::MethodInfo {
25151 id: "walletobjects.loyaltyclass.insert",
25152 http_method: hyper::Method::POST,
25153 });
25154
25155 for &field in ["alt"].iter() {
25156 if self._additional_params.contains_key(field) {
25157 dlg.finished(false);
25158 return Err(common::Error::FieldClash(field));
25159 }
25160 }
25161
25162 let mut params = Params::with_capacity(3 + self._additional_params.len());
25163
25164 params.extend(self._additional_params.iter());
25165
25166 params.push("alt", "json");
25167 let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass";
25168 if self._scopes.is_empty() {
25169 self._scopes
25170 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
25171 }
25172
25173 let url = params.parse_with_url(&url);
25174
25175 let mut json_mime_type = mime::APPLICATION_JSON;
25176 let mut request_value_reader = {
25177 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25178 common::remove_json_null_values(&mut value);
25179 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25180 serde_json::to_writer(&mut dst, &value).unwrap();
25181 dst
25182 };
25183 let request_size = request_value_reader
25184 .seek(std::io::SeekFrom::End(0))
25185 .unwrap();
25186 request_value_reader
25187 .seek(std::io::SeekFrom::Start(0))
25188 .unwrap();
25189
25190 loop {
25191 let token = match self
25192 .hub
25193 .auth
25194 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25195 .await
25196 {
25197 Ok(token) => token,
25198 Err(e) => match dlg.token(e) {
25199 Ok(token) => token,
25200 Err(e) => {
25201 dlg.finished(false);
25202 return Err(common::Error::MissingToken(e));
25203 }
25204 },
25205 };
25206 request_value_reader
25207 .seek(std::io::SeekFrom::Start(0))
25208 .unwrap();
25209 let mut req_result = {
25210 let client = &self.hub.client;
25211 dlg.pre_request();
25212 let mut req_builder = hyper::Request::builder()
25213 .method(hyper::Method::POST)
25214 .uri(url.as_str())
25215 .header(USER_AGENT, self.hub._user_agent.clone());
25216
25217 if let Some(token) = token.as_ref() {
25218 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25219 }
25220
25221 let request = req_builder
25222 .header(CONTENT_TYPE, json_mime_type.to_string())
25223 .header(CONTENT_LENGTH, request_size as u64)
25224 .body(common::to_body(
25225 request_value_reader.get_ref().clone().into(),
25226 ));
25227
25228 client.request(request.unwrap()).await
25229 };
25230
25231 match req_result {
25232 Err(err) => {
25233 if let common::Retry::After(d) = dlg.http_error(&err) {
25234 sleep(d).await;
25235 continue;
25236 }
25237 dlg.finished(false);
25238 return Err(common::Error::HttpError(err));
25239 }
25240 Ok(res) => {
25241 let (mut parts, body) = res.into_parts();
25242 let mut body = common::Body::new(body);
25243 if !parts.status.is_success() {
25244 let bytes = common::to_bytes(body).await.unwrap_or_default();
25245 let error = serde_json::from_str(&common::to_string(&bytes));
25246 let response = common::to_response(parts, bytes.into());
25247
25248 if let common::Retry::After(d) =
25249 dlg.http_failure(&response, error.as_ref().ok())
25250 {
25251 sleep(d).await;
25252 continue;
25253 }
25254
25255 dlg.finished(false);
25256
25257 return Err(match error {
25258 Ok(value) => common::Error::BadRequest(value),
25259 _ => common::Error::Failure(response),
25260 });
25261 }
25262 let response = {
25263 let bytes = common::to_bytes(body).await.unwrap_or_default();
25264 let encoded = common::to_string(&bytes);
25265 match serde_json::from_str(&encoded) {
25266 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25267 Err(error) => {
25268 dlg.response_json_decode_error(&encoded, &error);
25269 return Err(common::Error::JsonDecodeError(
25270 encoded.to_string(),
25271 error,
25272 ));
25273 }
25274 }
25275 };
25276
25277 dlg.finished(true);
25278 return Ok(response);
25279 }
25280 }
25281 }
25282 }
25283
25284 ///
25285 /// Sets the *request* property to the given value.
25286 ///
25287 /// Even though the property as already been set when instantiating this call,
25288 /// we provide this method for API completeness.
25289 pub fn request(mut self, new_value: LoyaltyClass) -> LoyaltyclasInsertCall<'a, C> {
25290 self._request = new_value;
25291 self
25292 }
25293 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25294 /// while executing the actual API request.
25295 ///
25296 /// ````text
25297 /// It should be used to handle progress information, and to implement a certain level of resilience.
25298 /// ````
25299 ///
25300 /// Sets the *delegate* property to the given value.
25301 pub fn delegate(
25302 mut self,
25303 new_value: &'a mut dyn common::Delegate,
25304 ) -> LoyaltyclasInsertCall<'a, C> {
25305 self._delegate = Some(new_value);
25306 self
25307 }
25308
25309 /// Set any additional parameter of the query string used in the request.
25310 /// It should be used to set parameters which are not yet available through their own
25311 /// setters.
25312 ///
25313 /// Please note that this method must not be used to set any of the known parameters
25314 /// which have their own setter method. If done anyway, the request will fail.
25315 ///
25316 /// # Additional Parameters
25317 ///
25318 /// * *$.xgafv* (query-string) - V1 error format.
25319 /// * *access_token* (query-string) - OAuth access token.
25320 /// * *alt* (query-string) - Data format for response.
25321 /// * *callback* (query-string) - JSONP
25322 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25323 /// * *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.
25324 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25325 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25326 /// * *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.
25327 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25328 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25329 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasInsertCall<'a, C>
25330 where
25331 T: AsRef<str>,
25332 {
25333 self._additional_params
25334 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25335 self
25336 }
25337
25338 /// Identifies the authorization scope for the method you are building.
25339 ///
25340 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25341 /// [`Scope::WalletObjectIssuer`].
25342 ///
25343 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25344 /// tokens for more than one scope.
25345 ///
25346 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25347 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25348 /// sufficient, a read-write scope will do as well.
25349 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasInsertCall<'a, C>
25350 where
25351 St: AsRef<str>,
25352 {
25353 self._scopes.insert(String::from(scope.as_ref()));
25354 self
25355 }
25356 /// Identifies the authorization scope(s) for the method you are building.
25357 ///
25358 /// See [`Self::add_scope()`] for details.
25359 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasInsertCall<'a, C>
25360 where
25361 I: IntoIterator<Item = St>,
25362 St: AsRef<str>,
25363 {
25364 self._scopes
25365 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25366 self
25367 }
25368
25369 /// Removes all scopes, and no default scope will be used either.
25370 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25371 /// for details).
25372 pub fn clear_scopes(mut self) -> LoyaltyclasInsertCall<'a, C> {
25373 self._scopes.clear();
25374 self
25375 }
25376}
25377
25378/// Returns a list of all loyalty classes for a given issuer ID.
25379///
25380/// A builder for the *list* method supported by a *loyaltyclas* resource.
25381/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
25382///
25383/// # Example
25384///
25385/// Instantiate a resource method builder
25386///
25387/// ```test_harness,no_run
25388/// # extern crate hyper;
25389/// # extern crate hyper_rustls;
25390/// # extern crate google_walletobjects1 as walletobjects1;
25391/// # async fn dox() {
25392/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25393///
25394/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25395/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25396/// # secret,
25397/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25398/// # ).build().await.unwrap();
25399///
25400/// # let client = hyper_util::client::legacy::Client::builder(
25401/// # hyper_util::rt::TokioExecutor::new()
25402/// # )
25403/// # .build(
25404/// # hyper_rustls::HttpsConnectorBuilder::new()
25405/// # .with_native_roots()
25406/// # .unwrap()
25407/// # .https_or_http()
25408/// # .enable_http1()
25409/// # .build()
25410/// # );
25411/// # let mut hub = Walletobjects::new(client, auth);
25412/// // You can configure optional parameters by calling the respective setters at will, and
25413/// // execute the final call using `doit()`.
25414/// // Values shown here are possibly random and not representative !
25415/// let result = hub.loyaltyclass().list()
25416/// .token("vero")
25417/// .max_results(-76)
25418/// .issuer_id(-88)
25419/// .doit().await;
25420/// # }
25421/// ```
25422pub struct LoyaltyclasListCall<'a, C>
25423where
25424 C: 'a,
25425{
25426 hub: &'a Walletobjects<C>,
25427 _token: Option<String>,
25428 _max_results: Option<i32>,
25429 _issuer_id: Option<i64>,
25430 _delegate: Option<&'a mut dyn common::Delegate>,
25431 _additional_params: HashMap<String, String>,
25432 _scopes: BTreeSet<String>,
25433}
25434
25435impl<'a, C> common::CallBuilder for LoyaltyclasListCall<'a, C> {}
25436
25437impl<'a, C> LoyaltyclasListCall<'a, C>
25438where
25439 C: common::Connector,
25440{
25441 /// Perform the operation you have build so far.
25442 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClassListResponse)> {
25443 use std::borrow::Cow;
25444 use std::io::{Read, Seek};
25445
25446 use common::{url::Params, ToParts};
25447 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25448
25449 let mut dd = common::DefaultDelegate;
25450 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25451 dlg.begin(common::MethodInfo {
25452 id: "walletobjects.loyaltyclass.list",
25453 http_method: hyper::Method::GET,
25454 });
25455
25456 for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
25457 if self._additional_params.contains_key(field) {
25458 dlg.finished(false);
25459 return Err(common::Error::FieldClash(field));
25460 }
25461 }
25462
25463 let mut params = Params::with_capacity(5 + self._additional_params.len());
25464 if let Some(value) = self._token.as_ref() {
25465 params.push("token", value);
25466 }
25467 if let Some(value) = self._max_results.as_ref() {
25468 params.push("maxResults", value.to_string());
25469 }
25470 if let Some(value) = self._issuer_id.as_ref() {
25471 params.push("issuerId", value.to_string());
25472 }
25473
25474 params.extend(self._additional_params.iter());
25475
25476 params.push("alt", "json");
25477 let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass";
25478 if self._scopes.is_empty() {
25479 self._scopes
25480 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
25481 }
25482
25483 let url = params.parse_with_url(&url);
25484
25485 loop {
25486 let token = match self
25487 .hub
25488 .auth
25489 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25490 .await
25491 {
25492 Ok(token) => token,
25493 Err(e) => match dlg.token(e) {
25494 Ok(token) => token,
25495 Err(e) => {
25496 dlg.finished(false);
25497 return Err(common::Error::MissingToken(e));
25498 }
25499 },
25500 };
25501 let mut req_result = {
25502 let client = &self.hub.client;
25503 dlg.pre_request();
25504 let mut req_builder = hyper::Request::builder()
25505 .method(hyper::Method::GET)
25506 .uri(url.as_str())
25507 .header(USER_AGENT, self.hub._user_agent.clone());
25508
25509 if let Some(token) = token.as_ref() {
25510 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25511 }
25512
25513 let request = req_builder
25514 .header(CONTENT_LENGTH, 0_u64)
25515 .body(common::to_body::<String>(None));
25516
25517 client.request(request.unwrap()).await
25518 };
25519
25520 match req_result {
25521 Err(err) => {
25522 if let common::Retry::After(d) = dlg.http_error(&err) {
25523 sleep(d).await;
25524 continue;
25525 }
25526 dlg.finished(false);
25527 return Err(common::Error::HttpError(err));
25528 }
25529 Ok(res) => {
25530 let (mut parts, body) = res.into_parts();
25531 let mut body = common::Body::new(body);
25532 if !parts.status.is_success() {
25533 let bytes = common::to_bytes(body).await.unwrap_or_default();
25534 let error = serde_json::from_str(&common::to_string(&bytes));
25535 let response = common::to_response(parts, bytes.into());
25536
25537 if let common::Retry::After(d) =
25538 dlg.http_failure(&response, error.as_ref().ok())
25539 {
25540 sleep(d).await;
25541 continue;
25542 }
25543
25544 dlg.finished(false);
25545
25546 return Err(match error {
25547 Ok(value) => common::Error::BadRequest(value),
25548 _ => common::Error::Failure(response),
25549 });
25550 }
25551 let response = {
25552 let bytes = common::to_bytes(body).await.unwrap_or_default();
25553 let encoded = common::to_string(&bytes);
25554 match serde_json::from_str(&encoded) {
25555 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25556 Err(error) => {
25557 dlg.response_json_decode_error(&encoded, &error);
25558 return Err(common::Error::JsonDecodeError(
25559 encoded.to_string(),
25560 error,
25561 ));
25562 }
25563 }
25564 };
25565
25566 dlg.finished(true);
25567 return Ok(response);
25568 }
25569 }
25570 }
25571 }
25572
25573 /// 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.
25574 ///
25575 /// Sets the *token* query property to the given value.
25576 pub fn token(mut self, new_value: &str) -> LoyaltyclasListCall<'a, C> {
25577 self._token = Some(new_value.to_string());
25578 self
25579 }
25580 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
25581 ///
25582 /// Sets the *max results* query property to the given value.
25583 pub fn max_results(mut self, new_value: i32) -> LoyaltyclasListCall<'a, C> {
25584 self._max_results = Some(new_value);
25585 self
25586 }
25587 /// The ID of the issuer authorized to list classes.
25588 ///
25589 /// Sets the *issuer id* query property to the given value.
25590 pub fn issuer_id(mut self, new_value: i64) -> LoyaltyclasListCall<'a, C> {
25591 self._issuer_id = Some(new_value);
25592 self
25593 }
25594 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25595 /// while executing the actual API request.
25596 ///
25597 /// ````text
25598 /// It should be used to handle progress information, and to implement a certain level of resilience.
25599 /// ````
25600 ///
25601 /// Sets the *delegate* property to the given value.
25602 pub fn delegate(
25603 mut self,
25604 new_value: &'a mut dyn common::Delegate,
25605 ) -> LoyaltyclasListCall<'a, C> {
25606 self._delegate = Some(new_value);
25607 self
25608 }
25609
25610 /// Set any additional parameter of the query string used in the request.
25611 /// It should be used to set parameters which are not yet available through their own
25612 /// setters.
25613 ///
25614 /// Please note that this method must not be used to set any of the known parameters
25615 /// which have their own setter method. If done anyway, the request will fail.
25616 ///
25617 /// # Additional Parameters
25618 ///
25619 /// * *$.xgafv* (query-string) - V1 error format.
25620 /// * *access_token* (query-string) - OAuth access token.
25621 /// * *alt* (query-string) - Data format for response.
25622 /// * *callback* (query-string) - JSONP
25623 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25624 /// * *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.
25625 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25626 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25627 /// * *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.
25628 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25629 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25630 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasListCall<'a, C>
25631 where
25632 T: AsRef<str>,
25633 {
25634 self._additional_params
25635 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25636 self
25637 }
25638
25639 /// Identifies the authorization scope for the method you are building.
25640 ///
25641 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25642 /// [`Scope::WalletObjectIssuer`].
25643 ///
25644 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25645 /// tokens for more than one scope.
25646 ///
25647 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25648 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25649 /// sufficient, a read-write scope will do as well.
25650 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasListCall<'a, C>
25651 where
25652 St: AsRef<str>,
25653 {
25654 self._scopes.insert(String::from(scope.as_ref()));
25655 self
25656 }
25657 /// Identifies the authorization scope(s) for the method you are building.
25658 ///
25659 /// See [`Self::add_scope()`] for details.
25660 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasListCall<'a, C>
25661 where
25662 I: IntoIterator<Item = St>,
25663 St: AsRef<str>,
25664 {
25665 self._scopes
25666 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25667 self
25668 }
25669
25670 /// Removes all scopes, and no default scope will be used either.
25671 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25672 /// for details).
25673 pub fn clear_scopes(mut self) -> LoyaltyclasListCall<'a, C> {
25674 self._scopes.clear();
25675 self
25676 }
25677}
25678
25679/// Updates the loyalty class referenced by the given class ID. This method supports patch semantics.
25680///
25681/// A builder for the *patch* method supported by a *loyaltyclas* resource.
25682/// It is not used directly, but through a [`LoyaltyclasMethods`] instance.
25683///
25684/// # Example
25685///
25686/// Instantiate a resource method builder
25687///
25688/// ```test_harness,no_run
25689/// # extern crate hyper;
25690/// # extern crate hyper_rustls;
25691/// # extern crate google_walletobjects1 as walletobjects1;
25692/// use walletobjects1::api::LoyaltyClass;
25693/// # async fn dox() {
25694/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25695///
25696/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25697/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25698/// # secret,
25699/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25700/// # ).build().await.unwrap();
25701///
25702/// # let client = hyper_util::client::legacy::Client::builder(
25703/// # hyper_util::rt::TokioExecutor::new()
25704/// # )
25705/// # .build(
25706/// # hyper_rustls::HttpsConnectorBuilder::new()
25707/// # .with_native_roots()
25708/// # .unwrap()
25709/// # .https_or_http()
25710/// # .enable_http1()
25711/// # .build()
25712/// # );
25713/// # let mut hub = Walletobjects::new(client, auth);
25714/// // As the method needs a request, you would usually fill it with the desired information
25715/// // into the respective structure. Some of the parts shown here might not be applicable !
25716/// // Values shown here are possibly random and not representative !
25717/// let mut req = LoyaltyClass::default();
25718///
25719/// // You can configure optional parameters by calling the respective setters at will, and
25720/// // execute the final call using `doit()`.
25721/// // Values shown here are possibly random and not representative !
25722/// let result = hub.loyaltyclass().patch(req, "resourceId")
25723/// .doit().await;
25724/// # }
25725/// ```
25726pub struct LoyaltyclasPatchCall<'a, C>
25727where
25728 C: 'a,
25729{
25730 hub: &'a Walletobjects<C>,
25731 _request: LoyaltyClass,
25732 _resource_id: String,
25733 _delegate: Option<&'a mut dyn common::Delegate>,
25734 _additional_params: HashMap<String, String>,
25735 _scopes: BTreeSet<String>,
25736}
25737
25738impl<'a, C> common::CallBuilder for LoyaltyclasPatchCall<'a, C> {}
25739
25740impl<'a, C> LoyaltyclasPatchCall<'a, C>
25741where
25742 C: common::Connector,
25743{
25744 /// Perform the operation you have build so far.
25745 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClass)> {
25746 use std::borrow::Cow;
25747 use std::io::{Read, Seek};
25748
25749 use common::{url::Params, ToParts};
25750 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25751
25752 let mut dd = common::DefaultDelegate;
25753 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25754 dlg.begin(common::MethodInfo {
25755 id: "walletobjects.loyaltyclass.patch",
25756 http_method: hyper::Method::PATCH,
25757 });
25758
25759 for &field in ["alt", "resourceId"].iter() {
25760 if self._additional_params.contains_key(field) {
25761 dlg.finished(false);
25762 return Err(common::Error::FieldClash(field));
25763 }
25764 }
25765
25766 let mut params = Params::with_capacity(4 + self._additional_params.len());
25767 params.push("resourceId", self._resource_id);
25768
25769 params.extend(self._additional_params.iter());
25770
25771 params.push("alt", "json");
25772 let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass/{resourceId}";
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::PATCH)
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: LoyaltyClass) -> LoyaltyclasPatchCall<'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) -> LoyaltyclasPatchCall<'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 ) -> LoyaltyclasPatchCall<'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) -> LoyaltyclasPatchCall<'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) -> LoyaltyclasPatchCall<'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) -> LoyaltyclasPatchCall<'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) -> LoyaltyclasPatchCall<'a, C> {
25997 self._scopes.clear();
25998 self
25999 }
26000}
26001
26002/// Updates the loyalty class referenced by the given class ID.
26003///
26004/// A builder for the *update* 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/// use walletobjects1::api::LoyaltyClass;
26016/// # async fn dox() {
26017/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26018///
26019/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26020/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26021/// # secret,
26022/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26023/// # ).build().await.unwrap();
26024///
26025/// # let client = hyper_util::client::legacy::Client::builder(
26026/// # hyper_util::rt::TokioExecutor::new()
26027/// # )
26028/// # .build(
26029/// # hyper_rustls::HttpsConnectorBuilder::new()
26030/// # .with_native_roots()
26031/// # .unwrap()
26032/// # .https_or_http()
26033/// # .enable_http1()
26034/// # .build()
26035/// # );
26036/// # let mut hub = Walletobjects::new(client, auth);
26037/// // As the method needs a request, you would usually fill it with the desired information
26038/// // into the respective structure. Some of the parts shown here might not be applicable !
26039/// // Values shown here are possibly random and not representative !
26040/// let mut req = LoyaltyClass::default();
26041///
26042/// // You can configure optional parameters by calling the respective setters at will, and
26043/// // execute the final call using `doit()`.
26044/// // Values shown here are possibly random and not representative !
26045/// let result = hub.loyaltyclass().update(req, "resourceId")
26046/// .doit().await;
26047/// # }
26048/// ```
26049pub struct LoyaltyclasUpdateCall<'a, C>
26050where
26051 C: 'a,
26052{
26053 hub: &'a Walletobjects<C>,
26054 _request: LoyaltyClass,
26055 _resource_id: String,
26056 _delegate: Option<&'a mut dyn common::Delegate>,
26057 _additional_params: HashMap<String, String>,
26058 _scopes: BTreeSet<String>,
26059}
26060
26061impl<'a, C> common::CallBuilder for LoyaltyclasUpdateCall<'a, C> {}
26062
26063impl<'a, C> LoyaltyclasUpdateCall<'a, C>
26064where
26065 C: common::Connector,
26066{
26067 /// Perform the operation you have build so far.
26068 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyClass)> {
26069 use std::borrow::Cow;
26070 use std::io::{Read, Seek};
26071
26072 use common::{url::Params, ToParts};
26073 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26074
26075 let mut dd = common::DefaultDelegate;
26076 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26077 dlg.begin(common::MethodInfo {
26078 id: "walletobjects.loyaltyclass.update",
26079 http_method: hyper::Method::PUT,
26080 });
26081
26082 for &field in ["alt", "resourceId"].iter() {
26083 if self._additional_params.contains_key(field) {
26084 dlg.finished(false);
26085 return Err(common::Error::FieldClash(field));
26086 }
26087 }
26088
26089 let mut params = Params::with_capacity(4 + self._additional_params.len());
26090 params.push("resourceId", self._resource_id);
26091
26092 params.extend(self._additional_params.iter());
26093
26094 params.push("alt", "json");
26095 let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyClass/{resourceId}";
26096 if self._scopes.is_empty() {
26097 self._scopes
26098 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
26099 }
26100
26101 #[allow(clippy::single_element_loop)]
26102 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
26103 url = params.uri_replacement(url, param_name, find_this, false);
26104 }
26105 {
26106 let to_remove = ["resourceId"];
26107 params.remove_params(&to_remove);
26108 }
26109
26110 let url = params.parse_with_url(&url);
26111
26112 let mut json_mime_type = mime::APPLICATION_JSON;
26113 let mut request_value_reader = {
26114 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26115 common::remove_json_null_values(&mut value);
26116 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26117 serde_json::to_writer(&mut dst, &value).unwrap();
26118 dst
26119 };
26120 let request_size = request_value_reader
26121 .seek(std::io::SeekFrom::End(0))
26122 .unwrap();
26123 request_value_reader
26124 .seek(std::io::SeekFrom::Start(0))
26125 .unwrap();
26126
26127 loop {
26128 let token = match self
26129 .hub
26130 .auth
26131 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26132 .await
26133 {
26134 Ok(token) => token,
26135 Err(e) => match dlg.token(e) {
26136 Ok(token) => token,
26137 Err(e) => {
26138 dlg.finished(false);
26139 return Err(common::Error::MissingToken(e));
26140 }
26141 },
26142 };
26143 request_value_reader
26144 .seek(std::io::SeekFrom::Start(0))
26145 .unwrap();
26146 let mut req_result = {
26147 let client = &self.hub.client;
26148 dlg.pre_request();
26149 let mut req_builder = hyper::Request::builder()
26150 .method(hyper::Method::PUT)
26151 .uri(url.as_str())
26152 .header(USER_AGENT, self.hub._user_agent.clone());
26153
26154 if let Some(token) = token.as_ref() {
26155 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26156 }
26157
26158 let request = req_builder
26159 .header(CONTENT_TYPE, json_mime_type.to_string())
26160 .header(CONTENT_LENGTH, request_size as u64)
26161 .body(common::to_body(
26162 request_value_reader.get_ref().clone().into(),
26163 ));
26164
26165 client.request(request.unwrap()).await
26166 };
26167
26168 match req_result {
26169 Err(err) => {
26170 if let common::Retry::After(d) = dlg.http_error(&err) {
26171 sleep(d).await;
26172 continue;
26173 }
26174 dlg.finished(false);
26175 return Err(common::Error::HttpError(err));
26176 }
26177 Ok(res) => {
26178 let (mut parts, body) = res.into_parts();
26179 let mut body = common::Body::new(body);
26180 if !parts.status.is_success() {
26181 let bytes = common::to_bytes(body).await.unwrap_or_default();
26182 let error = serde_json::from_str(&common::to_string(&bytes));
26183 let response = common::to_response(parts, bytes.into());
26184
26185 if let common::Retry::After(d) =
26186 dlg.http_failure(&response, error.as_ref().ok())
26187 {
26188 sleep(d).await;
26189 continue;
26190 }
26191
26192 dlg.finished(false);
26193
26194 return Err(match error {
26195 Ok(value) => common::Error::BadRequest(value),
26196 _ => common::Error::Failure(response),
26197 });
26198 }
26199 let response = {
26200 let bytes = common::to_bytes(body).await.unwrap_or_default();
26201 let encoded = common::to_string(&bytes);
26202 match serde_json::from_str(&encoded) {
26203 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26204 Err(error) => {
26205 dlg.response_json_decode_error(&encoded, &error);
26206 return Err(common::Error::JsonDecodeError(
26207 encoded.to_string(),
26208 error,
26209 ));
26210 }
26211 }
26212 };
26213
26214 dlg.finished(true);
26215 return Ok(response);
26216 }
26217 }
26218 }
26219 }
26220
26221 ///
26222 /// Sets the *request* property to the given value.
26223 ///
26224 /// Even though the property as already been set when instantiating this call,
26225 /// we provide this method for API completeness.
26226 pub fn request(mut self, new_value: LoyaltyClass) -> LoyaltyclasUpdateCall<'a, C> {
26227 self._request = new_value;
26228 self
26229 }
26230 /// 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 '-'.
26231 ///
26232 /// Sets the *resource id* path property to the given value.
26233 ///
26234 /// Even though the property as already been set when instantiating this call,
26235 /// we provide this method for API completeness.
26236 pub fn resource_id(mut self, new_value: &str) -> LoyaltyclasUpdateCall<'a, C> {
26237 self._resource_id = new_value.to_string();
26238 self
26239 }
26240 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26241 /// while executing the actual API request.
26242 ///
26243 /// ````text
26244 /// It should be used to handle progress information, and to implement a certain level of resilience.
26245 /// ````
26246 ///
26247 /// Sets the *delegate* property to the given value.
26248 pub fn delegate(
26249 mut self,
26250 new_value: &'a mut dyn common::Delegate,
26251 ) -> LoyaltyclasUpdateCall<'a, C> {
26252 self._delegate = Some(new_value);
26253 self
26254 }
26255
26256 /// Set any additional parameter of the query string used in the request.
26257 /// It should be used to set parameters which are not yet available through their own
26258 /// setters.
26259 ///
26260 /// Please note that this method must not be used to set any of the known parameters
26261 /// which have their own setter method. If done anyway, the request will fail.
26262 ///
26263 /// # Additional Parameters
26264 ///
26265 /// * *$.xgafv* (query-string) - V1 error format.
26266 /// * *access_token* (query-string) - OAuth access token.
26267 /// * *alt* (query-string) - Data format for response.
26268 /// * *callback* (query-string) - JSONP
26269 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26270 /// * *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.
26271 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26272 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26273 /// * *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.
26274 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26275 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26276 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyclasUpdateCall<'a, C>
26277 where
26278 T: AsRef<str>,
26279 {
26280 self._additional_params
26281 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26282 self
26283 }
26284
26285 /// Identifies the authorization scope for the method you are building.
26286 ///
26287 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26288 /// [`Scope::WalletObjectIssuer`].
26289 ///
26290 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26291 /// tokens for more than one scope.
26292 ///
26293 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26294 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26295 /// sufficient, a read-write scope will do as well.
26296 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyclasUpdateCall<'a, C>
26297 where
26298 St: AsRef<str>,
26299 {
26300 self._scopes.insert(String::from(scope.as_ref()));
26301 self
26302 }
26303 /// Identifies the authorization scope(s) for the method you are building.
26304 ///
26305 /// See [`Self::add_scope()`] for details.
26306 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyclasUpdateCall<'a, C>
26307 where
26308 I: IntoIterator<Item = St>,
26309 St: AsRef<str>,
26310 {
26311 self._scopes
26312 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26313 self
26314 }
26315
26316 /// Removes all scopes, and no default scope will be used either.
26317 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26318 /// for details).
26319 pub fn clear_scopes(mut self) -> LoyaltyclasUpdateCall<'a, C> {
26320 self._scopes.clear();
26321 self
26322 }
26323}
26324
26325/// Adds a message to the loyalty object referenced by the given object ID.
26326///
26327/// A builder for the *addmessage* method supported by a *loyaltyobject* resource.
26328/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
26329///
26330/// # Example
26331///
26332/// Instantiate a resource method builder
26333///
26334/// ```test_harness,no_run
26335/// # extern crate hyper;
26336/// # extern crate hyper_rustls;
26337/// # extern crate google_walletobjects1 as walletobjects1;
26338/// use walletobjects1::api::AddMessageRequest;
26339/// # async fn dox() {
26340/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26341///
26342/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26343/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26344/// # secret,
26345/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26346/// # ).build().await.unwrap();
26347///
26348/// # let client = hyper_util::client::legacy::Client::builder(
26349/// # hyper_util::rt::TokioExecutor::new()
26350/// # )
26351/// # .build(
26352/// # hyper_rustls::HttpsConnectorBuilder::new()
26353/// # .with_native_roots()
26354/// # .unwrap()
26355/// # .https_or_http()
26356/// # .enable_http1()
26357/// # .build()
26358/// # );
26359/// # let mut hub = Walletobjects::new(client, auth);
26360/// // As the method needs a request, you would usually fill it with the desired information
26361/// // into the respective structure. Some of the parts shown here might not be applicable !
26362/// // Values shown here are possibly random and not representative !
26363/// let mut req = AddMessageRequest::default();
26364///
26365/// // You can configure optional parameters by calling the respective setters at will, and
26366/// // execute the final call using `doit()`.
26367/// // Values shown here are possibly random and not representative !
26368/// let result = hub.loyaltyobject().addmessage(req, "resourceId")
26369/// .doit().await;
26370/// # }
26371/// ```
26372pub struct LoyaltyobjectAddmessageCall<'a, C>
26373where
26374 C: 'a,
26375{
26376 hub: &'a Walletobjects<C>,
26377 _request: AddMessageRequest,
26378 _resource_id: String,
26379 _delegate: Option<&'a mut dyn common::Delegate>,
26380 _additional_params: HashMap<String, String>,
26381 _scopes: BTreeSet<String>,
26382}
26383
26384impl<'a, C> common::CallBuilder for LoyaltyobjectAddmessageCall<'a, C> {}
26385
26386impl<'a, C> LoyaltyobjectAddmessageCall<'a, C>
26387where
26388 C: common::Connector,
26389{
26390 /// Perform the operation you have build so far.
26391 pub async fn doit(
26392 mut self,
26393 ) -> common::Result<(common::Response, LoyaltyObjectAddMessageResponse)> {
26394 use std::borrow::Cow;
26395 use std::io::{Read, Seek};
26396
26397 use common::{url::Params, ToParts};
26398 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26399
26400 let mut dd = common::DefaultDelegate;
26401 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26402 dlg.begin(common::MethodInfo {
26403 id: "walletobjects.loyaltyobject.addmessage",
26404 http_method: hyper::Method::POST,
26405 });
26406
26407 for &field in ["alt", "resourceId"].iter() {
26408 if self._additional_params.contains_key(field) {
26409 dlg.finished(false);
26410 return Err(common::Error::FieldClash(field));
26411 }
26412 }
26413
26414 let mut params = Params::with_capacity(4 + self._additional_params.len());
26415 params.push("resourceId", self._resource_id);
26416
26417 params.extend(self._additional_params.iter());
26418
26419 params.push("alt", "json");
26420 let mut url =
26421 self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject/{resourceId}/addMessage";
26422 if self._scopes.is_empty() {
26423 self._scopes
26424 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
26425 }
26426
26427 #[allow(clippy::single_element_loop)]
26428 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
26429 url = params.uri_replacement(url, param_name, find_this, false);
26430 }
26431 {
26432 let to_remove = ["resourceId"];
26433 params.remove_params(&to_remove);
26434 }
26435
26436 let url = params.parse_with_url(&url);
26437
26438 let mut json_mime_type = mime::APPLICATION_JSON;
26439 let mut request_value_reader = {
26440 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26441 common::remove_json_null_values(&mut value);
26442 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26443 serde_json::to_writer(&mut dst, &value).unwrap();
26444 dst
26445 };
26446 let request_size = request_value_reader
26447 .seek(std::io::SeekFrom::End(0))
26448 .unwrap();
26449 request_value_reader
26450 .seek(std::io::SeekFrom::Start(0))
26451 .unwrap();
26452
26453 loop {
26454 let token = match self
26455 .hub
26456 .auth
26457 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26458 .await
26459 {
26460 Ok(token) => token,
26461 Err(e) => match dlg.token(e) {
26462 Ok(token) => token,
26463 Err(e) => {
26464 dlg.finished(false);
26465 return Err(common::Error::MissingToken(e));
26466 }
26467 },
26468 };
26469 request_value_reader
26470 .seek(std::io::SeekFrom::Start(0))
26471 .unwrap();
26472 let mut req_result = {
26473 let client = &self.hub.client;
26474 dlg.pre_request();
26475 let mut req_builder = hyper::Request::builder()
26476 .method(hyper::Method::POST)
26477 .uri(url.as_str())
26478 .header(USER_AGENT, self.hub._user_agent.clone());
26479
26480 if let Some(token) = token.as_ref() {
26481 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26482 }
26483
26484 let request = req_builder
26485 .header(CONTENT_TYPE, json_mime_type.to_string())
26486 .header(CONTENT_LENGTH, request_size as u64)
26487 .body(common::to_body(
26488 request_value_reader.get_ref().clone().into(),
26489 ));
26490
26491 client.request(request.unwrap()).await
26492 };
26493
26494 match req_result {
26495 Err(err) => {
26496 if let common::Retry::After(d) = dlg.http_error(&err) {
26497 sleep(d).await;
26498 continue;
26499 }
26500 dlg.finished(false);
26501 return Err(common::Error::HttpError(err));
26502 }
26503 Ok(res) => {
26504 let (mut parts, body) = res.into_parts();
26505 let mut body = common::Body::new(body);
26506 if !parts.status.is_success() {
26507 let bytes = common::to_bytes(body).await.unwrap_or_default();
26508 let error = serde_json::from_str(&common::to_string(&bytes));
26509 let response = common::to_response(parts, bytes.into());
26510
26511 if let common::Retry::After(d) =
26512 dlg.http_failure(&response, error.as_ref().ok())
26513 {
26514 sleep(d).await;
26515 continue;
26516 }
26517
26518 dlg.finished(false);
26519
26520 return Err(match error {
26521 Ok(value) => common::Error::BadRequest(value),
26522 _ => common::Error::Failure(response),
26523 });
26524 }
26525 let response = {
26526 let bytes = common::to_bytes(body).await.unwrap_or_default();
26527 let encoded = common::to_string(&bytes);
26528 match serde_json::from_str(&encoded) {
26529 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26530 Err(error) => {
26531 dlg.response_json_decode_error(&encoded, &error);
26532 return Err(common::Error::JsonDecodeError(
26533 encoded.to_string(),
26534 error,
26535 ));
26536 }
26537 }
26538 };
26539
26540 dlg.finished(true);
26541 return Ok(response);
26542 }
26543 }
26544 }
26545 }
26546
26547 ///
26548 /// Sets the *request* property to the given value.
26549 ///
26550 /// Even though the property as already been set when instantiating this call,
26551 /// we provide this method for API completeness.
26552 pub fn request(mut self, new_value: AddMessageRequest) -> LoyaltyobjectAddmessageCall<'a, C> {
26553 self._request = new_value;
26554 self
26555 }
26556 /// 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 '-'.
26557 ///
26558 /// Sets the *resource id* path property to the given value.
26559 ///
26560 /// Even though the property as already been set when instantiating this call,
26561 /// we provide this method for API completeness.
26562 pub fn resource_id(mut self, new_value: &str) -> LoyaltyobjectAddmessageCall<'a, C> {
26563 self._resource_id = new_value.to_string();
26564 self
26565 }
26566 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26567 /// while executing the actual API request.
26568 ///
26569 /// ````text
26570 /// It should be used to handle progress information, and to implement a certain level of resilience.
26571 /// ````
26572 ///
26573 /// Sets the *delegate* property to the given value.
26574 pub fn delegate(
26575 mut self,
26576 new_value: &'a mut dyn common::Delegate,
26577 ) -> LoyaltyobjectAddmessageCall<'a, C> {
26578 self._delegate = Some(new_value);
26579 self
26580 }
26581
26582 /// Set any additional parameter of the query string used in the request.
26583 /// It should be used to set parameters which are not yet available through their own
26584 /// setters.
26585 ///
26586 /// Please note that this method must not be used to set any of the known parameters
26587 /// which have their own setter method. If done anyway, the request will fail.
26588 ///
26589 /// # Additional Parameters
26590 ///
26591 /// * *$.xgafv* (query-string) - V1 error format.
26592 /// * *access_token* (query-string) - OAuth access token.
26593 /// * *alt* (query-string) - Data format for response.
26594 /// * *callback* (query-string) - JSONP
26595 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26596 /// * *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.
26597 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26598 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26599 /// * *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.
26600 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26601 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26602 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectAddmessageCall<'a, C>
26603 where
26604 T: AsRef<str>,
26605 {
26606 self._additional_params
26607 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26608 self
26609 }
26610
26611 /// Identifies the authorization scope for the method you are building.
26612 ///
26613 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26614 /// [`Scope::WalletObjectIssuer`].
26615 ///
26616 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26617 /// tokens for more than one scope.
26618 ///
26619 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26620 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26621 /// sufficient, a read-write scope will do as well.
26622 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectAddmessageCall<'a, C>
26623 where
26624 St: AsRef<str>,
26625 {
26626 self._scopes.insert(String::from(scope.as_ref()));
26627 self
26628 }
26629 /// Identifies the authorization scope(s) for the method you are building.
26630 ///
26631 /// See [`Self::add_scope()`] for details.
26632 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectAddmessageCall<'a, C>
26633 where
26634 I: IntoIterator<Item = St>,
26635 St: AsRef<str>,
26636 {
26637 self._scopes
26638 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26639 self
26640 }
26641
26642 /// Removes all scopes, and no default scope will be used either.
26643 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26644 /// for details).
26645 pub fn clear_scopes(mut self) -> LoyaltyobjectAddmessageCall<'a, C> {
26646 self._scopes.clear();
26647 self
26648 }
26649}
26650
26651/// Returns the loyalty object with the given object ID.
26652///
26653/// A builder for the *get* method supported by a *loyaltyobject* resource.
26654/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
26655///
26656/// # Example
26657///
26658/// Instantiate a resource method builder
26659///
26660/// ```test_harness,no_run
26661/// # extern crate hyper;
26662/// # extern crate hyper_rustls;
26663/// # extern crate google_walletobjects1 as walletobjects1;
26664/// # async fn dox() {
26665/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26666///
26667/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26668/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26669/// # secret,
26670/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26671/// # ).build().await.unwrap();
26672///
26673/// # let client = hyper_util::client::legacy::Client::builder(
26674/// # hyper_util::rt::TokioExecutor::new()
26675/// # )
26676/// # .build(
26677/// # hyper_rustls::HttpsConnectorBuilder::new()
26678/// # .with_native_roots()
26679/// # .unwrap()
26680/// # .https_or_http()
26681/// # .enable_http1()
26682/// # .build()
26683/// # );
26684/// # let mut hub = Walletobjects::new(client, auth);
26685/// // You can configure optional parameters by calling the respective setters at will, and
26686/// // execute the final call using `doit()`.
26687/// // Values shown here are possibly random and not representative !
26688/// let result = hub.loyaltyobject().get("resourceId")
26689/// .doit().await;
26690/// # }
26691/// ```
26692pub struct LoyaltyobjectGetCall<'a, C>
26693where
26694 C: 'a,
26695{
26696 hub: &'a Walletobjects<C>,
26697 _resource_id: String,
26698 _delegate: Option<&'a mut dyn common::Delegate>,
26699 _additional_params: HashMap<String, String>,
26700 _scopes: BTreeSet<String>,
26701}
26702
26703impl<'a, C> common::CallBuilder for LoyaltyobjectGetCall<'a, C> {}
26704
26705impl<'a, C> LoyaltyobjectGetCall<'a, C>
26706where
26707 C: common::Connector,
26708{
26709 /// Perform the operation you have build so far.
26710 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
26711 use std::borrow::Cow;
26712 use std::io::{Read, Seek};
26713
26714 use common::{url::Params, ToParts};
26715 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26716
26717 let mut dd = common::DefaultDelegate;
26718 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26719 dlg.begin(common::MethodInfo {
26720 id: "walletobjects.loyaltyobject.get",
26721 http_method: hyper::Method::GET,
26722 });
26723
26724 for &field in ["alt", "resourceId"].iter() {
26725 if self._additional_params.contains_key(field) {
26726 dlg.finished(false);
26727 return Err(common::Error::FieldClash(field));
26728 }
26729 }
26730
26731 let mut params = Params::with_capacity(3 + self._additional_params.len());
26732 params.push("resourceId", self._resource_id);
26733
26734 params.extend(self._additional_params.iter());
26735
26736 params.push("alt", "json");
26737 let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject/{resourceId}";
26738 if self._scopes.is_empty() {
26739 self._scopes
26740 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
26741 }
26742
26743 #[allow(clippy::single_element_loop)]
26744 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
26745 url = params.uri_replacement(url, param_name, find_this, false);
26746 }
26747 {
26748 let to_remove = ["resourceId"];
26749 params.remove_params(&to_remove);
26750 }
26751
26752 let url = params.parse_with_url(&url);
26753
26754 loop {
26755 let token = match self
26756 .hub
26757 .auth
26758 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26759 .await
26760 {
26761 Ok(token) => token,
26762 Err(e) => match dlg.token(e) {
26763 Ok(token) => token,
26764 Err(e) => {
26765 dlg.finished(false);
26766 return Err(common::Error::MissingToken(e));
26767 }
26768 },
26769 };
26770 let mut req_result = {
26771 let client = &self.hub.client;
26772 dlg.pre_request();
26773 let mut req_builder = hyper::Request::builder()
26774 .method(hyper::Method::GET)
26775 .uri(url.as_str())
26776 .header(USER_AGENT, self.hub._user_agent.clone());
26777
26778 if let Some(token) = token.as_ref() {
26779 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26780 }
26781
26782 let request = req_builder
26783 .header(CONTENT_LENGTH, 0_u64)
26784 .body(common::to_body::<String>(None));
26785
26786 client.request(request.unwrap()).await
26787 };
26788
26789 match req_result {
26790 Err(err) => {
26791 if let common::Retry::After(d) = dlg.http_error(&err) {
26792 sleep(d).await;
26793 continue;
26794 }
26795 dlg.finished(false);
26796 return Err(common::Error::HttpError(err));
26797 }
26798 Ok(res) => {
26799 let (mut parts, body) = res.into_parts();
26800 let mut body = common::Body::new(body);
26801 if !parts.status.is_success() {
26802 let bytes = common::to_bytes(body).await.unwrap_or_default();
26803 let error = serde_json::from_str(&common::to_string(&bytes));
26804 let response = common::to_response(parts, bytes.into());
26805
26806 if let common::Retry::After(d) =
26807 dlg.http_failure(&response, error.as_ref().ok())
26808 {
26809 sleep(d).await;
26810 continue;
26811 }
26812
26813 dlg.finished(false);
26814
26815 return Err(match error {
26816 Ok(value) => common::Error::BadRequest(value),
26817 _ => common::Error::Failure(response),
26818 });
26819 }
26820 let response = {
26821 let bytes = common::to_bytes(body).await.unwrap_or_default();
26822 let encoded = common::to_string(&bytes);
26823 match serde_json::from_str(&encoded) {
26824 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26825 Err(error) => {
26826 dlg.response_json_decode_error(&encoded, &error);
26827 return Err(common::Error::JsonDecodeError(
26828 encoded.to_string(),
26829 error,
26830 ));
26831 }
26832 }
26833 };
26834
26835 dlg.finished(true);
26836 return Ok(response);
26837 }
26838 }
26839 }
26840 }
26841
26842 /// 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 '-'.
26843 ///
26844 /// Sets the *resource id* path property to the given value.
26845 ///
26846 /// Even though the property as already been set when instantiating this call,
26847 /// we provide this method for API completeness.
26848 pub fn resource_id(mut self, new_value: &str) -> LoyaltyobjectGetCall<'a, C> {
26849 self._resource_id = new_value.to_string();
26850 self
26851 }
26852 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26853 /// while executing the actual API request.
26854 ///
26855 /// ````text
26856 /// It should be used to handle progress information, and to implement a certain level of resilience.
26857 /// ````
26858 ///
26859 /// Sets the *delegate* property to the given value.
26860 pub fn delegate(
26861 mut self,
26862 new_value: &'a mut dyn common::Delegate,
26863 ) -> LoyaltyobjectGetCall<'a, C> {
26864 self._delegate = Some(new_value);
26865 self
26866 }
26867
26868 /// Set any additional parameter of the query string used in the request.
26869 /// It should be used to set parameters which are not yet available through their own
26870 /// setters.
26871 ///
26872 /// Please note that this method must not be used to set any of the known parameters
26873 /// which have their own setter method. If done anyway, the request will fail.
26874 ///
26875 /// # Additional Parameters
26876 ///
26877 /// * *$.xgafv* (query-string) - V1 error format.
26878 /// * *access_token* (query-string) - OAuth access token.
26879 /// * *alt* (query-string) - Data format for response.
26880 /// * *callback* (query-string) - JSONP
26881 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26882 /// * *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.
26883 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26884 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26885 /// * *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.
26886 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26887 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26888 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectGetCall<'a, C>
26889 where
26890 T: AsRef<str>,
26891 {
26892 self._additional_params
26893 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26894 self
26895 }
26896
26897 /// Identifies the authorization scope for the method you are building.
26898 ///
26899 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26900 /// [`Scope::WalletObjectIssuer`].
26901 ///
26902 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26903 /// tokens for more than one scope.
26904 ///
26905 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26906 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26907 /// sufficient, a read-write scope will do as well.
26908 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectGetCall<'a, C>
26909 where
26910 St: AsRef<str>,
26911 {
26912 self._scopes.insert(String::from(scope.as_ref()));
26913 self
26914 }
26915 /// Identifies the authorization scope(s) for the method you are building.
26916 ///
26917 /// See [`Self::add_scope()`] for details.
26918 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectGetCall<'a, C>
26919 where
26920 I: IntoIterator<Item = St>,
26921 St: AsRef<str>,
26922 {
26923 self._scopes
26924 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26925 self
26926 }
26927
26928 /// Removes all scopes, and no default scope will be used either.
26929 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26930 /// for details).
26931 pub fn clear_scopes(mut self) -> LoyaltyobjectGetCall<'a, C> {
26932 self._scopes.clear();
26933 self
26934 }
26935}
26936
26937/// Inserts an loyalty object with the given ID and properties.
26938///
26939/// A builder for the *insert* method supported by a *loyaltyobject* resource.
26940/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
26941///
26942/// # Example
26943///
26944/// Instantiate a resource method builder
26945///
26946/// ```test_harness,no_run
26947/// # extern crate hyper;
26948/// # extern crate hyper_rustls;
26949/// # extern crate google_walletobjects1 as walletobjects1;
26950/// use walletobjects1::api::LoyaltyObject;
26951/// # async fn dox() {
26952/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26953///
26954/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26955/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26956/// # secret,
26957/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26958/// # ).build().await.unwrap();
26959///
26960/// # let client = hyper_util::client::legacy::Client::builder(
26961/// # hyper_util::rt::TokioExecutor::new()
26962/// # )
26963/// # .build(
26964/// # hyper_rustls::HttpsConnectorBuilder::new()
26965/// # .with_native_roots()
26966/// # .unwrap()
26967/// # .https_or_http()
26968/// # .enable_http1()
26969/// # .build()
26970/// # );
26971/// # let mut hub = Walletobjects::new(client, auth);
26972/// // As the method needs a request, you would usually fill it with the desired information
26973/// // into the respective structure. Some of the parts shown here might not be applicable !
26974/// // Values shown here are possibly random and not representative !
26975/// let mut req = LoyaltyObject::default();
26976///
26977/// // You can configure optional parameters by calling the respective setters at will, and
26978/// // execute the final call using `doit()`.
26979/// // Values shown here are possibly random and not representative !
26980/// let result = hub.loyaltyobject().insert(req)
26981/// .doit().await;
26982/// # }
26983/// ```
26984pub struct LoyaltyobjectInsertCall<'a, C>
26985where
26986 C: 'a,
26987{
26988 hub: &'a Walletobjects<C>,
26989 _request: LoyaltyObject,
26990 _delegate: Option<&'a mut dyn common::Delegate>,
26991 _additional_params: HashMap<String, String>,
26992 _scopes: BTreeSet<String>,
26993}
26994
26995impl<'a, C> common::CallBuilder for LoyaltyobjectInsertCall<'a, C> {}
26996
26997impl<'a, C> LoyaltyobjectInsertCall<'a, C>
26998where
26999 C: common::Connector,
27000{
27001 /// Perform the operation you have build so far.
27002 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
27003 use std::borrow::Cow;
27004 use std::io::{Read, Seek};
27005
27006 use common::{url::Params, ToParts};
27007 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27008
27009 let mut dd = common::DefaultDelegate;
27010 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27011 dlg.begin(common::MethodInfo {
27012 id: "walletobjects.loyaltyobject.insert",
27013 http_method: hyper::Method::POST,
27014 });
27015
27016 for &field in ["alt"].iter() {
27017 if self._additional_params.contains_key(field) {
27018 dlg.finished(false);
27019 return Err(common::Error::FieldClash(field));
27020 }
27021 }
27022
27023 let mut params = Params::with_capacity(3 + self._additional_params.len());
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/loyaltyObject";
27029 if self._scopes.is_empty() {
27030 self._scopes
27031 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
27032 }
27033
27034 let url = params.parse_with_url(&url);
27035
27036 let mut json_mime_type = mime::APPLICATION_JSON;
27037 let mut request_value_reader = {
27038 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27039 common::remove_json_null_values(&mut value);
27040 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27041 serde_json::to_writer(&mut dst, &value).unwrap();
27042 dst
27043 };
27044 let request_size = request_value_reader
27045 .seek(std::io::SeekFrom::End(0))
27046 .unwrap();
27047 request_value_reader
27048 .seek(std::io::SeekFrom::Start(0))
27049 .unwrap();
27050
27051 loop {
27052 let token = match self
27053 .hub
27054 .auth
27055 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27056 .await
27057 {
27058 Ok(token) => token,
27059 Err(e) => match dlg.token(e) {
27060 Ok(token) => token,
27061 Err(e) => {
27062 dlg.finished(false);
27063 return Err(common::Error::MissingToken(e));
27064 }
27065 },
27066 };
27067 request_value_reader
27068 .seek(std::io::SeekFrom::Start(0))
27069 .unwrap();
27070 let mut req_result = {
27071 let client = &self.hub.client;
27072 dlg.pre_request();
27073 let mut req_builder = hyper::Request::builder()
27074 .method(hyper::Method::POST)
27075 .uri(url.as_str())
27076 .header(USER_AGENT, self.hub._user_agent.clone());
27077
27078 if let Some(token) = token.as_ref() {
27079 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27080 }
27081
27082 let request = req_builder
27083 .header(CONTENT_TYPE, json_mime_type.to_string())
27084 .header(CONTENT_LENGTH, request_size as u64)
27085 .body(common::to_body(
27086 request_value_reader.get_ref().clone().into(),
27087 ));
27088
27089 client.request(request.unwrap()).await
27090 };
27091
27092 match req_result {
27093 Err(err) => {
27094 if let common::Retry::After(d) = dlg.http_error(&err) {
27095 sleep(d).await;
27096 continue;
27097 }
27098 dlg.finished(false);
27099 return Err(common::Error::HttpError(err));
27100 }
27101 Ok(res) => {
27102 let (mut parts, body) = res.into_parts();
27103 let mut body = common::Body::new(body);
27104 if !parts.status.is_success() {
27105 let bytes = common::to_bytes(body).await.unwrap_or_default();
27106 let error = serde_json::from_str(&common::to_string(&bytes));
27107 let response = common::to_response(parts, bytes.into());
27108
27109 if let common::Retry::After(d) =
27110 dlg.http_failure(&response, error.as_ref().ok())
27111 {
27112 sleep(d).await;
27113 continue;
27114 }
27115
27116 dlg.finished(false);
27117
27118 return Err(match error {
27119 Ok(value) => common::Error::BadRequest(value),
27120 _ => common::Error::Failure(response),
27121 });
27122 }
27123 let response = {
27124 let bytes = common::to_bytes(body).await.unwrap_or_default();
27125 let encoded = common::to_string(&bytes);
27126 match serde_json::from_str(&encoded) {
27127 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27128 Err(error) => {
27129 dlg.response_json_decode_error(&encoded, &error);
27130 return Err(common::Error::JsonDecodeError(
27131 encoded.to_string(),
27132 error,
27133 ));
27134 }
27135 }
27136 };
27137
27138 dlg.finished(true);
27139 return Ok(response);
27140 }
27141 }
27142 }
27143 }
27144
27145 ///
27146 /// Sets the *request* property to the given value.
27147 ///
27148 /// Even though the property as already been set when instantiating this call,
27149 /// we provide this method for API completeness.
27150 pub fn request(mut self, new_value: LoyaltyObject) -> LoyaltyobjectInsertCall<'a, C> {
27151 self._request = new_value;
27152 self
27153 }
27154 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27155 /// while executing the actual API request.
27156 ///
27157 /// ````text
27158 /// It should be used to handle progress information, and to implement a certain level of resilience.
27159 /// ````
27160 ///
27161 /// Sets the *delegate* property to the given value.
27162 pub fn delegate(
27163 mut self,
27164 new_value: &'a mut dyn common::Delegate,
27165 ) -> LoyaltyobjectInsertCall<'a, C> {
27166 self._delegate = Some(new_value);
27167 self
27168 }
27169
27170 /// Set any additional parameter of the query string used in the request.
27171 /// It should be used to set parameters which are not yet available through their own
27172 /// setters.
27173 ///
27174 /// Please note that this method must not be used to set any of the known parameters
27175 /// which have their own setter method. If done anyway, the request will fail.
27176 ///
27177 /// # Additional Parameters
27178 ///
27179 /// * *$.xgafv* (query-string) - V1 error format.
27180 /// * *access_token* (query-string) - OAuth access token.
27181 /// * *alt* (query-string) - Data format for response.
27182 /// * *callback* (query-string) - JSONP
27183 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27184 /// * *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.
27185 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27186 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27187 /// * *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.
27188 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27189 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27190 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectInsertCall<'a, C>
27191 where
27192 T: AsRef<str>,
27193 {
27194 self._additional_params
27195 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27196 self
27197 }
27198
27199 /// Identifies the authorization scope for the method you are building.
27200 ///
27201 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27202 /// [`Scope::WalletObjectIssuer`].
27203 ///
27204 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27205 /// tokens for more than one scope.
27206 ///
27207 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27208 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27209 /// sufficient, a read-write scope will do as well.
27210 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectInsertCall<'a, C>
27211 where
27212 St: AsRef<str>,
27213 {
27214 self._scopes.insert(String::from(scope.as_ref()));
27215 self
27216 }
27217 /// Identifies the authorization scope(s) for the method you are building.
27218 ///
27219 /// See [`Self::add_scope()`] for details.
27220 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectInsertCall<'a, C>
27221 where
27222 I: IntoIterator<Item = St>,
27223 St: AsRef<str>,
27224 {
27225 self._scopes
27226 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27227 self
27228 }
27229
27230 /// Removes all scopes, and no default scope will be used either.
27231 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27232 /// for details).
27233 pub fn clear_scopes(mut self) -> LoyaltyobjectInsertCall<'a, C> {
27234 self._scopes.clear();
27235 self
27236 }
27237}
27238
27239/// Returns a list of all loyalty objects for a given issuer ID.
27240///
27241/// A builder for the *list* method supported by a *loyaltyobject* resource.
27242/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
27243///
27244/// # Example
27245///
27246/// Instantiate a resource method builder
27247///
27248/// ```test_harness,no_run
27249/// # extern crate hyper;
27250/// # extern crate hyper_rustls;
27251/// # extern crate google_walletobjects1 as walletobjects1;
27252/// # async fn dox() {
27253/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27254///
27255/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27256/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27257/// # secret,
27258/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27259/// # ).build().await.unwrap();
27260///
27261/// # let client = hyper_util::client::legacy::Client::builder(
27262/// # hyper_util::rt::TokioExecutor::new()
27263/// # )
27264/// # .build(
27265/// # hyper_rustls::HttpsConnectorBuilder::new()
27266/// # .with_native_roots()
27267/// # .unwrap()
27268/// # .https_or_http()
27269/// # .enable_http1()
27270/// # .build()
27271/// # );
27272/// # let mut hub = Walletobjects::new(client, auth);
27273/// // You can configure optional parameters by calling the respective setters at will, and
27274/// // execute the final call using `doit()`.
27275/// // Values shown here are possibly random and not representative !
27276/// let result = hub.loyaltyobject().list()
27277/// .token("diam")
27278/// .max_results(-61)
27279/// .class_id("ipsum")
27280/// .doit().await;
27281/// # }
27282/// ```
27283pub struct LoyaltyobjectListCall<'a, C>
27284where
27285 C: 'a,
27286{
27287 hub: &'a Walletobjects<C>,
27288 _token: Option<String>,
27289 _max_results: Option<i32>,
27290 _class_id: Option<String>,
27291 _delegate: Option<&'a mut dyn common::Delegate>,
27292 _additional_params: HashMap<String, String>,
27293 _scopes: BTreeSet<String>,
27294}
27295
27296impl<'a, C> common::CallBuilder for LoyaltyobjectListCall<'a, C> {}
27297
27298impl<'a, C> LoyaltyobjectListCall<'a, C>
27299where
27300 C: common::Connector,
27301{
27302 /// Perform the operation you have build so far.
27303 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObjectListResponse)> {
27304 use std::borrow::Cow;
27305 use std::io::{Read, Seek};
27306
27307 use common::{url::Params, ToParts};
27308 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27309
27310 let mut dd = common::DefaultDelegate;
27311 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27312 dlg.begin(common::MethodInfo {
27313 id: "walletobjects.loyaltyobject.list",
27314 http_method: hyper::Method::GET,
27315 });
27316
27317 for &field in ["alt", "token", "maxResults", "classId"].iter() {
27318 if self._additional_params.contains_key(field) {
27319 dlg.finished(false);
27320 return Err(common::Error::FieldClash(field));
27321 }
27322 }
27323
27324 let mut params = Params::with_capacity(5 + self._additional_params.len());
27325 if let Some(value) = self._token.as_ref() {
27326 params.push("token", value);
27327 }
27328 if let Some(value) = self._max_results.as_ref() {
27329 params.push("maxResults", value.to_string());
27330 }
27331 if let Some(value) = self._class_id.as_ref() {
27332 params.push("classId", value);
27333 }
27334
27335 params.extend(self._additional_params.iter());
27336
27337 params.push("alt", "json");
27338 let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject";
27339 if self._scopes.is_empty() {
27340 self._scopes
27341 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
27342 }
27343
27344 let url = params.parse_with_url(&url);
27345
27346 loop {
27347 let token = match self
27348 .hub
27349 .auth
27350 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27351 .await
27352 {
27353 Ok(token) => token,
27354 Err(e) => match dlg.token(e) {
27355 Ok(token) => token,
27356 Err(e) => {
27357 dlg.finished(false);
27358 return Err(common::Error::MissingToken(e));
27359 }
27360 },
27361 };
27362 let mut req_result = {
27363 let client = &self.hub.client;
27364 dlg.pre_request();
27365 let mut req_builder = hyper::Request::builder()
27366 .method(hyper::Method::GET)
27367 .uri(url.as_str())
27368 .header(USER_AGENT, self.hub._user_agent.clone());
27369
27370 if let Some(token) = token.as_ref() {
27371 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27372 }
27373
27374 let request = req_builder
27375 .header(CONTENT_LENGTH, 0_u64)
27376 .body(common::to_body::<String>(None));
27377
27378 client.request(request.unwrap()).await
27379 };
27380
27381 match req_result {
27382 Err(err) => {
27383 if let common::Retry::After(d) = dlg.http_error(&err) {
27384 sleep(d).await;
27385 continue;
27386 }
27387 dlg.finished(false);
27388 return Err(common::Error::HttpError(err));
27389 }
27390 Ok(res) => {
27391 let (mut parts, body) = res.into_parts();
27392 let mut body = common::Body::new(body);
27393 if !parts.status.is_success() {
27394 let bytes = common::to_bytes(body).await.unwrap_or_default();
27395 let error = serde_json::from_str(&common::to_string(&bytes));
27396 let response = common::to_response(parts, bytes.into());
27397
27398 if let common::Retry::After(d) =
27399 dlg.http_failure(&response, error.as_ref().ok())
27400 {
27401 sleep(d).await;
27402 continue;
27403 }
27404
27405 dlg.finished(false);
27406
27407 return Err(match error {
27408 Ok(value) => common::Error::BadRequest(value),
27409 _ => common::Error::Failure(response),
27410 });
27411 }
27412 let response = {
27413 let bytes = common::to_bytes(body).await.unwrap_or_default();
27414 let encoded = common::to_string(&bytes);
27415 match serde_json::from_str(&encoded) {
27416 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27417 Err(error) => {
27418 dlg.response_json_decode_error(&encoded, &error);
27419 return Err(common::Error::JsonDecodeError(
27420 encoded.to_string(),
27421 error,
27422 ));
27423 }
27424 }
27425 };
27426
27427 dlg.finished(true);
27428 return Ok(response);
27429 }
27430 }
27431 }
27432 }
27433
27434 /// 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.
27435 ///
27436 /// Sets the *token* query property to the given value.
27437 pub fn token(mut self, new_value: &str) -> LoyaltyobjectListCall<'a, C> {
27438 self._token = Some(new_value.to_string());
27439 self
27440 }
27441 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
27442 ///
27443 /// Sets the *max results* query property to the given value.
27444 pub fn max_results(mut self, new_value: i32) -> LoyaltyobjectListCall<'a, C> {
27445 self._max_results = Some(new_value);
27446 self
27447 }
27448 /// The ID of the class whose objects will be listed.
27449 ///
27450 /// Sets the *class id* query property to the given value.
27451 pub fn class_id(mut self, new_value: &str) -> LoyaltyobjectListCall<'a, C> {
27452 self._class_id = Some(new_value.to_string());
27453 self
27454 }
27455 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27456 /// while executing the actual API request.
27457 ///
27458 /// ````text
27459 /// It should be used to handle progress information, and to implement a certain level of resilience.
27460 /// ````
27461 ///
27462 /// Sets the *delegate* property to the given value.
27463 pub fn delegate(
27464 mut self,
27465 new_value: &'a mut dyn common::Delegate,
27466 ) -> LoyaltyobjectListCall<'a, C> {
27467 self._delegate = Some(new_value);
27468 self
27469 }
27470
27471 /// Set any additional parameter of the query string used in the request.
27472 /// It should be used to set parameters which are not yet available through their own
27473 /// setters.
27474 ///
27475 /// Please note that this method must not be used to set any of the known parameters
27476 /// which have their own setter method. If done anyway, the request will fail.
27477 ///
27478 /// # Additional Parameters
27479 ///
27480 /// * *$.xgafv* (query-string) - V1 error format.
27481 /// * *access_token* (query-string) - OAuth access token.
27482 /// * *alt* (query-string) - Data format for response.
27483 /// * *callback* (query-string) - JSONP
27484 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27485 /// * *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.
27486 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27487 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27488 /// * *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.
27489 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27490 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27491 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectListCall<'a, C>
27492 where
27493 T: AsRef<str>,
27494 {
27495 self._additional_params
27496 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27497 self
27498 }
27499
27500 /// Identifies the authorization scope for the method you are building.
27501 ///
27502 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27503 /// [`Scope::WalletObjectIssuer`].
27504 ///
27505 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27506 /// tokens for more than one scope.
27507 ///
27508 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27509 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27510 /// sufficient, a read-write scope will do as well.
27511 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectListCall<'a, C>
27512 where
27513 St: AsRef<str>,
27514 {
27515 self._scopes.insert(String::from(scope.as_ref()));
27516 self
27517 }
27518 /// Identifies the authorization scope(s) for the method you are building.
27519 ///
27520 /// See [`Self::add_scope()`] for details.
27521 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectListCall<'a, C>
27522 where
27523 I: IntoIterator<Item = St>,
27524 St: AsRef<str>,
27525 {
27526 self._scopes
27527 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27528 self
27529 }
27530
27531 /// Removes all scopes, and no default scope will be used either.
27532 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27533 /// for details).
27534 pub fn clear_scopes(mut self) -> LoyaltyobjectListCall<'a, C> {
27535 self._scopes.clear();
27536 self
27537 }
27538}
27539
27540/// Modifies linked offer objects for the loyalty object with the given ID.
27541///
27542/// A builder for the *modifylinkedofferobjects* method supported by a *loyaltyobject* resource.
27543/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
27544///
27545/// # Example
27546///
27547/// Instantiate a resource method builder
27548///
27549/// ```test_harness,no_run
27550/// # extern crate hyper;
27551/// # extern crate hyper_rustls;
27552/// # extern crate google_walletobjects1 as walletobjects1;
27553/// use walletobjects1::api::ModifyLinkedOfferObjectsRequest;
27554/// # async fn dox() {
27555/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27556///
27557/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27558/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27559/// # secret,
27560/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27561/// # ).build().await.unwrap();
27562///
27563/// # let client = hyper_util::client::legacy::Client::builder(
27564/// # hyper_util::rt::TokioExecutor::new()
27565/// # )
27566/// # .build(
27567/// # hyper_rustls::HttpsConnectorBuilder::new()
27568/// # .with_native_roots()
27569/// # .unwrap()
27570/// # .https_or_http()
27571/// # .enable_http1()
27572/// # .build()
27573/// # );
27574/// # let mut hub = Walletobjects::new(client, auth);
27575/// // As the method needs a request, you would usually fill it with the desired information
27576/// // into the respective structure. Some of the parts shown here might not be applicable !
27577/// // Values shown here are possibly random and not representative !
27578/// let mut req = ModifyLinkedOfferObjectsRequest::default();
27579///
27580/// // You can configure optional parameters by calling the respective setters at will, and
27581/// // execute the final call using `doit()`.
27582/// // Values shown here are possibly random and not representative !
27583/// let result = hub.loyaltyobject().modifylinkedofferobjects(req, "resourceId")
27584/// .doit().await;
27585/// # }
27586/// ```
27587pub struct LoyaltyobjectModifylinkedofferobjectCall<'a, C>
27588where
27589 C: 'a,
27590{
27591 hub: &'a Walletobjects<C>,
27592 _request: ModifyLinkedOfferObjectsRequest,
27593 _resource_id: String,
27594 _delegate: Option<&'a mut dyn common::Delegate>,
27595 _additional_params: HashMap<String, String>,
27596 _scopes: BTreeSet<String>,
27597}
27598
27599impl<'a, C> common::CallBuilder for LoyaltyobjectModifylinkedofferobjectCall<'a, C> {}
27600
27601impl<'a, C> LoyaltyobjectModifylinkedofferobjectCall<'a, C>
27602where
27603 C: common::Connector,
27604{
27605 /// Perform the operation you have build so far.
27606 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
27607 use std::borrow::Cow;
27608 use std::io::{Read, Seek};
27609
27610 use common::{url::Params, ToParts};
27611 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27612
27613 let mut dd = common::DefaultDelegate;
27614 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27615 dlg.begin(common::MethodInfo {
27616 id: "walletobjects.loyaltyobject.modifylinkedofferobjects",
27617 http_method: hyper::Method::POST,
27618 });
27619
27620 for &field in ["alt", "resourceId"].iter() {
27621 if self._additional_params.contains_key(field) {
27622 dlg.finished(false);
27623 return Err(common::Error::FieldClash(field));
27624 }
27625 }
27626
27627 let mut params = Params::with_capacity(4 + self._additional_params.len());
27628 params.push("resourceId", self._resource_id);
27629
27630 params.extend(self._additional_params.iter());
27631
27632 params.push("alt", "json");
27633 let mut url = self.hub._base_url.clone()
27634 + "walletobjects/v1/loyaltyObject/{resourceId}/modifyLinkedOfferObjects";
27635 if self._scopes.is_empty() {
27636 self._scopes
27637 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
27638 }
27639
27640 #[allow(clippy::single_element_loop)]
27641 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
27642 url = params.uri_replacement(url, param_name, find_this, false);
27643 }
27644 {
27645 let to_remove = ["resourceId"];
27646 params.remove_params(&to_remove);
27647 }
27648
27649 let url = params.parse_with_url(&url);
27650
27651 let mut json_mime_type = mime::APPLICATION_JSON;
27652 let mut request_value_reader = {
27653 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27654 common::remove_json_null_values(&mut value);
27655 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27656 serde_json::to_writer(&mut dst, &value).unwrap();
27657 dst
27658 };
27659 let request_size = request_value_reader
27660 .seek(std::io::SeekFrom::End(0))
27661 .unwrap();
27662 request_value_reader
27663 .seek(std::io::SeekFrom::Start(0))
27664 .unwrap();
27665
27666 loop {
27667 let token = match self
27668 .hub
27669 .auth
27670 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27671 .await
27672 {
27673 Ok(token) => token,
27674 Err(e) => match dlg.token(e) {
27675 Ok(token) => token,
27676 Err(e) => {
27677 dlg.finished(false);
27678 return Err(common::Error::MissingToken(e));
27679 }
27680 },
27681 };
27682 request_value_reader
27683 .seek(std::io::SeekFrom::Start(0))
27684 .unwrap();
27685 let mut req_result = {
27686 let client = &self.hub.client;
27687 dlg.pre_request();
27688 let mut req_builder = hyper::Request::builder()
27689 .method(hyper::Method::POST)
27690 .uri(url.as_str())
27691 .header(USER_AGENT, self.hub._user_agent.clone());
27692
27693 if let Some(token) = token.as_ref() {
27694 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27695 }
27696
27697 let request = req_builder
27698 .header(CONTENT_TYPE, json_mime_type.to_string())
27699 .header(CONTENT_LENGTH, request_size as u64)
27700 .body(common::to_body(
27701 request_value_reader.get_ref().clone().into(),
27702 ));
27703
27704 client.request(request.unwrap()).await
27705 };
27706
27707 match req_result {
27708 Err(err) => {
27709 if let common::Retry::After(d) = dlg.http_error(&err) {
27710 sleep(d).await;
27711 continue;
27712 }
27713 dlg.finished(false);
27714 return Err(common::Error::HttpError(err));
27715 }
27716 Ok(res) => {
27717 let (mut parts, body) = res.into_parts();
27718 let mut body = common::Body::new(body);
27719 if !parts.status.is_success() {
27720 let bytes = common::to_bytes(body).await.unwrap_or_default();
27721 let error = serde_json::from_str(&common::to_string(&bytes));
27722 let response = common::to_response(parts, bytes.into());
27723
27724 if let common::Retry::After(d) =
27725 dlg.http_failure(&response, error.as_ref().ok())
27726 {
27727 sleep(d).await;
27728 continue;
27729 }
27730
27731 dlg.finished(false);
27732
27733 return Err(match error {
27734 Ok(value) => common::Error::BadRequest(value),
27735 _ => common::Error::Failure(response),
27736 });
27737 }
27738 let response = {
27739 let bytes = common::to_bytes(body).await.unwrap_or_default();
27740 let encoded = common::to_string(&bytes);
27741 match serde_json::from_str(&encoded) {
27742 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27743 Err(error) => {
27744 dlg.response_json_decode_error(&encoded, &error);
27745 return Err(common::Error::JsonDecodeError(
27746 encoded.to_string(),
27747 error,
27748 ));
27749 }
27750 }
27751 };
27752
27753 dlg.finished(true);
27754 return Ok(response);
27755 }
27756 }
27757 }
27758 }
27759
27760 ///
27761 /// Sets the *request* property to the given value.
27762 ///
27763 /// Even though the property as already been set when instantiating this call,
27764 /// we provide this method for API completeness.
27765 pub fn request(
27766 mut self,
27767 new_value: ModifyLinkedOfferObjectsRequest,
27768 ) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
27769 self._request = new_value;
27770 self
27771 }
27772 /// 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 '-'.
27773 ///
27774 /// Sets the *resource id* path property to the given value.
27775 ///
27776 /// Even though the property as already been set when instantiating this call,
27777 /// we provide this method for API completeness.
27778 pub fn resource_id(
27779 mut self,
27780 new_value: &str,
27781 ) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
27782 self._resource_id = new_value.to_string();
27783 self
27784 }
27785 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27786 /// while executing the actual API request.
27787 ///
27788 /// ````text
27789 /// It should be used to handle progress information, and to implement a certain level of resilience.
27790 /// ````
27791 ///
27792 /// Sets the *delegate* property to the given value.
27793 pub fn delegate(
27794 mut self,
27795 new_value: &'a mut dyn common::Delegate,
27796 ) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
27797 self._delegate = Some(new_value);
27798 self
27799 }
27800
27801 /// Set any additional parameter of the query string used in the request.
27802 /// It should be used to set parameters which are not yet available through their own
27803 /// setters.
27804 ///
27805 /// Please note that this method must not be used to set any of the known parameters
27806 /// which have their own setter method. If done anyway, the request will fail.
27807 ///
27808 /// # Additional Parameters
27809 ///
27810 /// * *$.xgafv* (query-string) - V1 error format.
27811 /// * *access_token* (query-string) - OAuth access token.
27812 /// * *alt* (query-string) - Data format for response.
27813 /// * *callback* (query-string) - JSONP
27814 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27815 /// * *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.
27816 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27817 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27818 /// * *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.
27819 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27820 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27821 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C>
27822 where
27823 T: AsRef<str>,
27824 {
27825 self._additional_params
27826 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27827 self
27828 }
27829
27830 /// Identifies the authorization scope for the method you are building.
27831 ///
27832 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27833 /// [`Scope::WalletObjectIssuer`].
27834 ///
27835 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27836 /// tokens for more than one scope.
27837 ///
27838 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27839 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27840 /// sufficient, a read-write scope will do as well.
27841 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C>
27842 where
27843 St: AsRef<str>,
27844 {
27845 self._scopes.insert(String::from(scope.as_ref()));
27846 self
27847 }
27848 /// Identifies the authorization scope(s) for the method you are building.
27849 ///
27850 /// See [`Self::add_scope()`] for details.
27851 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C>
27852 where
27853 I: IntoIterator<Item = St>,
27854 St: AsRef<str>,
27855 {
27856 self._scopes
27857 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27858 self
27859 }
27860
27861 /// Removes all scopes, and no default scope will be used either.
27862 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27863 /// for details).
27864 pub fn clear_scopes(mut self) -> LoyaltyobjectModifylinkedofferobjectCall<'a, C> {
27865 self._scopes.clear();
27866 self
27867 }
27868}
27869
27870/// Updates the loyalty object referenced by the given object ID. This method supports patch semantics.
27871///
27872/// A builder for the *patch* method supported by a *loyaltyobject* resource.
27873/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
27874///
27875/// # Example
27876///
27877/// Instantiate a resource method builder
27878///
27879/// ```test_harness,no_run
27880/// # extern crate hyper;
27881/// # extern crate hyper_rustls;
27882/// # extern crate google_walletobjects1 as walletobjects1;
27883/// use walletobjects1::api::LoyaltyObject;
27884/// # async fn dox() {
27885/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27886///
27887/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27888/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27889/// # secret,
27890/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27891/// # ).build().await.unwrap();
27892///
27893/// # let client = hyper_util::client::legacy::Client::builder(
27894/// # hyper_util::rt::TokioExecutor::new()
27895/// # )
27896/// # .build(
27897/// # hyper_rustls::HttpsConnectorBuilder::new()
27898/// # .with_native_roots()
27899/// # .unwrap()
27900/// # .https_or_http()
27901/// # .enable_http1()
27902/// # .build()
27903/// # );
27904/// # let mut hub = Walletobjects::new(client, auth);
27905/// // As the method needs a request, you would usually fill it with the desired information
27906/// // into the respective structure. Some of the parts shown here might not be applicable !
27907/// // Values shown here are possibly random and not representative !
27908/// let mut req = LoyaltyObject::default();
27909///
27910/// // You can configure optional parameters by calling the respective setters at will, and
27911/// // execute the final call using `doit()`.
27912/// // Values shown here are possibly random and not representative !
27913/// let result = hub.loyaltyobject().patch(req, "resourceId")
27914/// .doit().await;
27915/// # }
27916/// ```
27917pub struct LoyaltyobjectPatchCall<'a, C>
27918where
27919 C: 'a,
27920{
27921 hub: &'a Walletobjects<C>,
27922 _request: LoyaltyObject,
27923 _resource_id: String,
27924 _delegate: Option<&'a mut dyn common::Delegate>,
27925 _additional_params: HashMap<String, String>,
27926 _scopes: BTreeSet<String>,
27927}
27928
27929impl<'a, C> common::CallBuilder for LoyaltyobjectPatchCall<'a, C> {}
27930
27931impl<'a, C> LoyaltyobjectPatchCall<'a, C>
27932where
27933 C: common::Connector,
27934{
27935 /// Perform the operation you have build so far.
27936 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
27937 use std::borrow::Cow;
27938 use std::io::{Read, Seek};
27939
27940 use common::{url::Params, ToParts};
27941 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27942
27943 let mut dd = common::DefaultDelegate;
27944 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27945 dlg.begin(common::MethodInfo {
27946 id: "walletobjects.loyaltyobject.patch",
27947 http_method: hyper::Method::PATCH,
27948 });
27949
27950 for &field in ["alt", "resourceId"].iter() {
27951 if self._additional_params.contains_key(field) {
27952 dlg.finished(false);
27953 return Err(common::Error::FieldClash(field));
27954 }
27955 }
27956
27957 let mut params = Params::with_capacity(4 + self._additional_params.len());
27958 params.push("resourceId", self._resource_id);
27959
27960 params.extend(self._additional_params.iter());
27961
27962 params.push("alt", "json");
27963 let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject/{resourceId}";
27964 if self._scopes.is_empty() {
27965 self._scopes
27966 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
27967 }
27968
27969 #[allow(clippy::single_element_loop)]
27970 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
27971 url = params.uri_replacement(url, param_name, find_this, false);
27972 }
27973 {
27974 let to_remove = ["resourceId"];
27975 params.remove_params(&to_remove);
27976 }
27977
27978 let url = params.parse_with_url(&url);
27979
27980 let mut json_mime_type = mime::APPLICATION_JSON;
27981 let mut request_value_reader = {
27982 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27983 common::remove_json_null_values(&mut value);
27984 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27985 serde_json::to_writer(&mut dst, &value).unwrap();
27986 dst
27987 };
27988 let request_size = request_value_reader
27989 .seek(std::io::SeekFrom::End(0))
27990 .unwrap();
27991 request_value_reader
27992 .seek(std::io::SeekFrom::Start(0))
27993 .unwrap();
27994
27995 loop {
27996 let token = match self
27997 .hub
27998 .auth
27999 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28000 .await
28001 {
28002 Ok(token) => token,
28003 Err(e) => match dlg.token(e) {
28004 Ok(token) => token,
28005 Err(e) => {
28006 dlg.finished(false);
28007 return Err(common::Error::MissingToken(e));
28008 }
28009 },
28010 };
28011 request_value_reader
28012 .seek(std::io::SeekFrom::Start(0))
28013 .unwrap();
28014 let mut req_result = {
28015 let client = &self.hub.client;
28016 dlg.pre_request();
28017 let mut req_builder = hyper::Request::builder()
28018 .method(hyper::Method::PATCH)
28019 .uri(url.as_str())
28020 .header(USER_AGENT, self.hub._user_agent.clone());
28021
28022 if let Some(token) = token.as_ref() {
28023 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28024 }
28025
28026 let request = req_builder
28027 .header(CONTENT_TYPE, json_mime_type.to_string())
28028 .header(CONTENT_LENGTH, request_size as u64)
28029 .body(common::to_body(
28030 request_value_reader.get_ref().clone().into(),
28031 ));
28032
28033 client.request(request.unwrap()).await
28034 };
28035
28036 match req_result {
28037 Err(err) => {
28038 if let common::Retry::After(d) = dlg.http_error(&err) {
28039 sleep(d).await;
28040 continue;
28041 }
28042 dlg.finished(false);
28043 return Err(common::Error::HttpError(err));
28044 }
28045 Ok(res) => {
28046 let (mut parts, body) = res.into_parts();
28047 let mut body = common::Body::new(body);
28048 if !parts.status.is_success() {
28049 let bytes = common::to_bytes(body).await.unwrap_or_default();
28050 let error = serde_json::from_str(&common::to_string(&bytes));
28051 let response = common::to_response(parts, bytes.into());
28052
28053 if let common::Retry::After(d) =
28054 dlg.http_failure(&response, error.as_ref().ok())
28055 {
28056 sleep(d).await;
28057 continue;
28058 }
28059
28060 dlg.finished(false);
28061
28062 return Err(match error {
28063 Ok(value) => common::Error::BadRequest(value),
28064 _ => common::Error::Failure(response),
28065 });
28066 }
28067 let response = {
28068 let bytes = common::to_bytes(body).await.unwrap_or_default();
28069 let encoded = common::to_string(&bytes);
28070 match serde_json::from_str(&encoded) {
28071 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28072 Err(error) => {
28073 dlg.response_json_decode_error(&encoded, &error);
28074 return Err(common::Error::JsonDecodeError(
28075 encoded.to_string(),
28076 error,
28077 ));
28078 }
28079 }
28080 };
28081
28082 dlg.finished(true);
28083 return Ok(response);
28084 }
28085 }
28086 }
28087 }
28088
28089 ///
28090 /// Sets the *request* property to the given value.
28091 ///
28092 /// Even though the property as already been set when instantiating this call,
28093 /// we provide this method for API completeness.
28094 pub fn request(mut self, new_value: LoyaltyObject) -> LoyaltyobjectPatchCall<'a, C> {
28095 self._request = new_value;
28096 self
28097 }
28098 /// 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 '-'.
28099 ///
28100 /// Sets the *resource id* path property to the given value.
28101 ///
28102 /// Even though the property as already been set when instantiating this call,
28103 /// we provide this method for API completeness.
28104 pub fn resource_id(mut self, new_value: &str) -> LoyaltyobjectPatchCall<'a, C> {
28105 self._resource_id = new_value.to_string();
28106 self
28107 }
28108 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28109 /// while executing the actual API request.
28110 ///
28111 /// ````text
28112 /// It should be used to handle progress information, and to implement a certain level of resilience.
28113 /// ````
28114 ///
28115 /// Sets the *delegate* property to the given value.
28116 pub fn delegate(
28117 mut self,
28118 new_value: &'a mut dyn common::Delegate,
28119 ) -> LoyaltyobjectPatchCall<'a, C> {
28120 self._delegate = Some(new_value);
28121 self
28122 }
28123
28124 /// Set any additional parameter of the query string used in the request.
28125 /// It should be used to set parameters which are not yet available through their own
28126 /// setters.
28127 ///
28128 /// Please note that this method must not be used to set any of the known parameters
28129 /// which have their own setter method. If done anyway, the request will fail.
28130 ///
28131 /// # Additional Parameters
28132 ///
28133 /// * *$.xgafv* (query-string) - V1 error format.
28134 /// * *access_token* (query-string) - OAuth access token.
28135 /// * *alt* (query-string) - Data format for response.
28136 /// * *callback* (query-string) - JSONP
28137 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28138 /// * *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.
28139 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28140 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28141 /// * *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.
28142 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28143 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28144 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectPatchCall<'a, C>
28145 where
28146 T: AsRef<str>,
28147 {
28148 self._additional_params
28149 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28150 self
28151 }
28152
28153 /// Identifies the authorization scope for the method you are building.
28154 ///
28155 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28156 /// [`Scope::WalletObjectIssuer`].
28157 ///
28158 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28159 /// tokens for more than one scope.
28160 ///
28161 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28162 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28163 /// sufficient, a read-write scope will do as well.
28164 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectPatchCall<'a, C>
28165 where
28166 St: AsRef<str>,
28167 {
28168 self._scopes.insert(String::from(scope.as_ref()));
28169 self
28170 }
28171 /// Identifies the authorization scope(s) for the method you are building.
28172 ///
28173 /// See [`Self::add_scope()`] for details.
28174 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectPatchCall<'a, C>
28175 where
28176 I: IntoIterator<Item = St>,
28177 St: AsRef<str>,
28178 {
28179 self._scopes
28180 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28181 self
28182 }
28183
28184 /// Removes all scopes, and no default scope will be used either.
28185 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28186 /// for details).
28187 pub fn clear_scopes(mut self) -> LoyaltyobjectPatchCall<'a, C> {
28188 self._scopes.clear();
28189 self
28190 }
28191}
28192
28193/// Updates the loyalty object referenced by the given object ID.
28194///
28195/// A builder for the *update* method supported by a *loyaltyobject* resource.
28196/// It is not used directly, but through a [`LoyaltyobjectMethods`] instance.
28197///
28198/// # Example
28199///
28200/// Instantiate a resource method builder
28201///
28202/// ```test_harness,no_run
28203/// # extern crate hyper;
28204/// # extern crate hyper_rustls;
28205/// # extern crate google_walletobjects1 as walletobjects1;
28206/// use walletobjects1::api::LoyaltyObject;
28207/// # async fn dox() {
28208/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28209///
28210/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28211/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28212/// # secret,
28213/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28214/// # ).build().await.unwrap();
28215///
28216/// # let client = hyper_util::client::legacy::Client::builder(
28217/// # hyper_util::rt::TokioExecutor::new()
28218/// # )
28219/// # .build(
28220/// # hyper_rustls::HttpsConnectorBuilder::new()
28221/// # .with_native_roots()
28222/// # .unwrap()
28223/// # .https_or_http()
28224/// # .enable_http1()
28225/// # .build()
28226/// # );
28227/// # let mut hub = Walletobjects::new(client, auth);
28228/// // As the method needs a request, you would usually fill it with the desired information
28229/// // into the respective structure. Some of the parts shown here might not be applicable !
28230/// // Values shown here are possibly random and not representative !
28231/// let mut req = LoyaltyObject::default();
28232///
28233/// // You can configure optional parameters by calling the respective setters at will, and
28234/// // execute the final call using `doit()`.
28235/// // Values shown here are possibly random and not representative !
28236/// let result = hub.loyaltyobject().update(req, "resourceId")
28237/// .doit().await;
28238/// # }
28239/// ```
28240pub struct LoyaltyobjectUpdateCall<'a, C>
28241where
28242 C: 'a,
28243{
28244 hub: &'a Walletobjects<C>,
28245 _request: LoyaltyObject,
28246 _resource_id: String,
28247 _delegate: Option<&'a mut dyn common::Delegate>,
28248 _additional_params: HashMap<String, String>,
28249 _scopes: BTreeSet<String>,
28250}
28251
28252impl<'a, C> common::CallBuilder for LoyaltyobjectUpdateCall<'a, C> {}
28253
28254impl<'a, C> LoyaltyobjectUpdateCall<'a, C>
28255where
28256 C: common::Connector,
28257{
28258 /// Perform the operation you have build so far.
28259 pub async fn doit(mut self) -> common::Result<(common::Response, LoyaltyObject)> {
28260 use std::borrow::Cow;
28261 use std::io::{Read, Seek};
28262
28263 use common::{url::Params, ToParts};
28264 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28265
28266 let mut dd = common::DefaultDelegate;
28267 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28268 dlg.begin(common::MethodInfo {
28269 id: "walletobjects.loyaltyobject.update",
28270 http_method: hyper::Method::PUT,
28271 });
28272
28273 for &field in ["alt", "resourceId"].iter() {
28274 if self._additional_params.contains_key(field) {
28275 dlg.finished(false);
28276 return Err(common::Error::FieldClash(field));
28277 }
28278 }
28279
28280 let mut params = Params::with_capacity(4 + self._additional_params.len());
28281 params.push("resourceId", self._resource_id);
28282
28283 params.extend(self._additional_params.iter());
28284
28285 params.push("alt", "json");
28286 let mut url = self.hub._base_url.clone() + "walletobjects/v1/loyaltyObject/{resourceId}";
28287 if self._scopes.is_empty() {
28288 self._scopes
28289 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
28290 }
28291
28292 #[allow(clippy::single_element_loop)]
28293 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
28294 url = params.uri_replacement(url, param_name, find_this, false);
28295 }
28296 {
28297 let to_remove = ["resourceId"];
28298 params.remove_params(&to_remove);
28299 }
28300
28301 let url = params.parse_with_url(&url);
28302
28303 let mut json_mime_type = mime::APPLICATION_JSON;
28304 let mut request_value_reader = {
28305 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28306 common::remove_json_null_values(&mut value);
28307 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28308 serde_json::to_writer(&mut dst, &value).unwrap();
28309 dst
28310 };
28311 let request_size = request_value_reader
28312 .seek(std::io::SeekFrom::End(0))
28313 .unwrap();
28314 request_value_reader
28315 .seek(std::io::SeekFrom::Start(0))
28316 .unwrap();
28317
28318 loop {
28319 let token = match self
28320 .hub
28321 .auth
28322 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28323 .await
28324 {
28325 Ok(token) => token,
28326 Err(e) => match dlg.token(e) {
28327 Ok(token) => token,
28328 Err(e) => {
28329 dlg.finished(false);
28330 return Err(common::Error::MissingToken(e));
28331 }
28332 },
28333 };
28334 request_value_reader
28335 .seek(std::io::SeekFrom::Start(0))
28336 .unwrap();
28337 let mut req_result = {
28338 let client = &self.hub.client;
28339 dlg.pre_request();
28340 let mut req_builder = hyper::Request::builder()
28341 .method(hyper::Method::PUT)
28342 .uri(url.as_str())
28343 .header(USER_AGENT, self.hub._user_agent.clone());
28344
28345 if let Some(token) = token.as_ref() {
28346 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28347 }
28348
28349 let request = req_builder
28350 .header(CONTENT_TYPE, json_mime_type.to_string())
28351 .header(CONTENT_LENGTH, request_size as u64)
28352 .body(common::to_body(
28353 request_value_reader.get_ref().clone().into(),
28354 ));
28355
28356 client.request(request.unwrap()).await
28357 };
28358
28359 match req_result {
28360 Err(err) => {
28361 if let common::Retry::After(d) = dlg.http_error(&err) {
28362 sleep(d).await;
28363 continue;
28364 }
28365 dlg.finished(false);
28366 return Err(common::Error::HttpError(err));
28367 }
28368 Ok(res) => {
28369 let (mut parts, body) = res.into_parts();
28370 let mut body = common::Body::new(body);
28371 if !parts.status.is_success() {
28372 let bytes = common::to_bytes(body).await.unwrap_or_default();
28373 let error = serde_json::from_str(&common::to_string(&bytes));
28374 let response = common::to_response(parts, bytes.into());
28375
28376 if let common::Retry::After(d) =
28377 dlg.http_failure(&response, error.as_ref().ok())
28378 {
28379 sleep(d).await;
28380 continue;
28381 }
28382
28383 dlg.finished(false);
28384
28385 return Err(match error {
28386 Ok(value) => common::Error::BadRequest(value),
28387 _ => common::Error::Failure(response),
28388 });
28389 }
28390 let response = {
28391 let bytes = common::to_bytes(body).await.unwrap_or_default();
28392 let encoded = common::to_string(&bytes);
28393 match serde_json::from_str(&encoded) {
28394 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28395 Err(error) => {
28396 dlg.response_json_decode_error(&encoded, &error);
28397 return Err(common::Error::JsonDecodeError(
28398 encoded.to_string(),
28399 error,
28400 ));
28401 }
28402 }
28403 };
28404
28405 dlg.finished(true);
28406 return Ok(response);
28407 }
28408 }
28409 }
28410 }
28411
28412 ///
28413 /// Sets the *request* property to the given value.
28414 ///
28415 /// Even though the property as already been set when instantiating this call,
28416 /// we provide this method for API completeness.
28417 pub fn request(mut self, new_value: LoyaltyObject) -> LoyaltyobjectUpdateCall<'a, C> {
28418 self._request = new_value;
28419 self
28420 }
28421 /// 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 '-'.
28422 ///
28423 /// Sets the *resource id* path property to the given value.
28424 ///
28425 /// Even though the property as already been set when instantiating this call,
28426 /// we provide this method for API completeness.
28427 pub fn resource_id(mut self, new_value: &str) -> LoyaltyobjectUpdateCall<'a, C> {
28428 self._resource_id = new_value.to_string();
28429 self
28430 }
28431 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28432 /// while executing the actual API request.
28433 ///
28434 /// ````text
28435 /// It should be used to handle progress information, and to implement a certain level of resilience.
28436 /// ````
28437 ///
28438 /// Sets the *delegate* property to the given value.
28439 pub fn delegate(
28440 mut self,
28441 new_value: &'a mut dyn common::Delegate,
28442 ) -> LoyaltyobjectUpdateCall<'a, C> {
28443 self._delegate = Some(new_value);
28444 self
28445 }
28446
28447 /// Set any additional parameter of the query string used in the request.
28448 /// It should be used to set parameters which are not yet available through their own
28449 /// setters.
28450 ///
28451 /// Please note that this method must not be used to set any of the known parameters
28452 /// which have their own setter method. If done anyway, the request will fail.
28453 ///
28454 /// # Additional Parameters
28455 ///
28456 /// * *$.xgafv* (query-string) - V1 error format.
28457 /// * *access_token* (query-string) - OAuth access token.
28458 /// * *alt* (query-string) - Data format for response.
28459 /// * *callback* (query-string) - JSONP
28460 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28461 /// * *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.
28462 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28463 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28464 /// * *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.
28465 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28466 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28467 pub fn param<T>(mut self, name: T, value: T) -> LoyaltyobjectUpdateCall<'a, C>
28468 where
28469 T: AsRef<str>,
28470 {
28471 self._additional_params
28472 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28473 self
28474 }
28475
28476 /// Identifies the authorization scope for the method you are building.
28477 ///
28478 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28479 /// [`Scope::WalletObjectIssuer`].
28480 ///
28481 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28482 /// tokens for more than one scope.
28483 ///
28484 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28485 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28486 /// sufficient, a read-write scope will do as well.
28487 pub fn add_scope<St>(mut self, scope: St) -> LoyaltyobjectUpdateCall<'a, C>
28488 where
28489 St: AsRef<str>,
28490 {
28491 self._scopes.insert(String::from(scope.as_ref()));
28492 self
28493 }
28494 /// Identifies the authorization scope(s) for the method you are building.
28495 ///
28496 /// See [`Self::add_scope()`] for details.
28497 pub fn add_scopes<I, St>(mut self, scopes: I) -> LoyaltyobjectUpdateCall<'a, C>
28498 where
28499 I: IntoIterator<Item = St>,
28500 St: AsRef<str>,
28501 {
28502 self._scopes
28503 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28504 self
28505 }
28506
28507 /// Removes all scopes, and no default scope will be used either.
28508 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28509 /// for details).
28510 pub fn clear_scopes(mut self) -> LoyaltyobjectUpdateCall<'a, C> {
28511 self._scopes.clear();
28512 self
28513 }
28514}
28515
28516/// Downloads rotating barcode values for the transit object referenced by the given object ID.
28517///
28518/// This method supports **media download**. To enable it, adjust the builder like this:
28519/// `.param("alt", "media")`.
28520/// Please note that due to missing multi-part support on the server side, you will only receive the media,
28521/// but not the `Media` structure that you would usually get. The latter will be a default value.
28522///
28523/// A builder for the *download* method supported by a *media* resource.
28524/// It is not used directly, but through a [`MediaMethods`] instance.
28525///
28526/// # Example
28527///
28528/// Instantiate a resource method builder
28529///
28530/// ```test_harness,no_run
28531/// # extern crate hyper;
28532/// # extern crate hyper_rustls;
28533/// # extern crate google_walletobjects1 as walletobjects1;
28534/// # async fn dox() {
28535/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28536///
28537/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28538/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28539/// # secret,
28540/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28541/// # ).build().await.unwrap();
28542///
28543/// # let client = hyper_util::client::legacy::Client::builder(
28544/// # hyper_util::rt::TokioExecutor::new()
28545/// # )
28546/// # .build(
28547/// # hyper_rustls::HttpsConnectorBuilder::new()
28548/// # .with_native_roots()
28549/// # .unwrap()
28550/// # .https_or_http()
28551/// # .enable_http1()
28552/// # .build()
28553/// # );
28554/// # let mut hub = Walletobjects::new(client, auth);
28555/// // You can configure optional parameters by calling the respective setters at will, and
28556/// // execute the final call using `doit()`.
28557/// // Values shown here are possibly random and not representative !
28558/// let result = hub.media().download("resourceId")
28559/// .doit().await;
28560/// # }
28561/// ```
28562pub struct MediaDownloadCall<'a, C>
28563where
28564 C: 'a,
28565{
28566 hub: &'a Walletobjects<C>,
28567 _resource_id: String,
28568 _delegate: Option<&'a mut dyn common::Delegate>,
28569 _additional_params: HashMap<String, String>,
28570 _scopes: BTreeSet<String>,
28571}
28572
28573impl<'a, C> common::CallBuilder for MediaDownloadCall<'a, C> {}
28574
28575impl<'a, C> MediaDownloadCall<'a, C>
28576where
28577 C: common::Connector,
28578{
28579 /// Perform the operation you have build so far.
28580 pub async fn doit(mut self) -> common::Result<(common::Response, Media)> {
28581 use std::borrow::Cow;
28582 use std::io::{Read, Seek};
28583
28584 use common::{url::Params, ToParts};
28585 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28586
28587 let mut dd = common::DefaultDelegate;
28588 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28589 dlg.begin(common::MethodInfo {
28590 id: "walletobjects.media.download",
28591 http_method: hyper::Method::GET,
28592 });
28593
28594 for &field in ["resourceId"].iter() {
28595 if self._additional_params.contains_key(field) {
28596 dlg.finished(false);
28597 return Err(common::Error::FieldClash(field));
28598 }
28599 }
28600
28601 let mut params = Params::with_capacity(2 + self._additional_params.len());
28602 params.push("resourceId", self._resource_id);
28603
28604 params.extend(self._additional_params.iter());
28605
28606 let (alt_field_missing, enable_resource_parsing) = {
28607 if let Some(value) = params.get("alt") {
28608 (false, value == "json")
28609 } else {
28610 (true, true)
28611 }
28612 };
28613 if alt_field_missing {
28614 params.push("alt", "json");
28615 }
28616 let mut url = self.hub._base_url.clone()
28617 + "walletobjects/v1/transitObject/{resourceId}/downloadRotatingBarcodeValues";
28618 if self._scopes.is_empty() {
28619 self._scopes
28620 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
28621 }
28622
28623 #[allow(clippy::single_element_loop)]
28624 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
28625 url = params.uri_replacement(url, param_name, find_this, false);
28626 }
28627 {
28628 let to_remove = ["resourceId"];
28629 params.remove_params(&to_remove);
28630 }
28631
28632 let url = params.parse_with_url(&url);
28633
28634 loop {
28635 let token = match self
28636 .hub
28637 .auth
28638 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28639 .await
28640 {
28641 Ok(token) => token,
28642 Err(e) => match dlg.token(e) {
28643 Ok(token) => token,
28644 Err(e) => {
28645 dlg.finished(false);
28646 return Err(common::Error::MissingToken(e));
28647 }
28648 },
28649 };
28650 let mut req_result = {
28651 let client = &self.hub.client;
28652 dlg.pre_request();
28653 let mut req_builder = hyper::Request::builder()
28654 .method(hyper::Method::GET)
28655 .uri(url.as_str())
28656 .header(USER_AGENT, self.hub._user_agent.clone());
28657
28658 if let Some(token) = token.as_ref() {
28659 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28660 }
28661
28662 let request = req_builder
28663 .header(CONTENT_LENGTH, 0_u64)
28664 .body(common::to_body::<String>(None));
28665
28666 client.request(request.unwrap()).await
28667 };
28668
28669 match req_result {
28670 Err(err) => {
28671 if let common::Retry::After(d) = dlg.http_error(&err) {
28672 sleep(d).await;
28673 continue;
28674 }
28675 dlg.finished(false);
28676 return Err(common::Error::HttpError(err));
28677 }
28678 Ok(res) => {
28679 let (mut parts, body) = res.into_parts();
28680 let mut body = common::Body::new(body);
28681 if !parts.status.is_success() {
28682 let bytes = common::to_bytes(body).await.unwrap_or_default();
28683 let error = serde_json::from_str(&common::to_string(&bytes));
28684 let response = common::to_response(parts, bytes.into());
28685
28686 if let common::Retry::After(d) =
28687 dlg.http_failure(&response, error.as_ref().ok())
28688 {
28689 sleep(d).await;
28690 continue;
28691 }
28692
28693 dlg.finished(false);
28694
28695 return Err(match error {
28696 Ok(value) => common::Error::BadRequest(value),
28697 _ => common::Error::Failure(response),
28698 });
28699 }
28700 let response = if enable_resource_parsing {
28701 let bytes = common::to_bytes(body).await.unwrap_or_default();
28702 let encoded = common::to_string(&bytes);
28703 match serde_json::from_str(&encoded) {
28704 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28705 Err(error) => {
28706 dlg.response_json_decode_error(&encoded, &error);
28707 return Err(common::Error::JsonDecodeError(
28708 encoded.to_string(),
28709 error,
28710 ));
28711 }
28712 }
28713 } else {
28714 (
28715 common::Response::from_parts(parts, body),
28716 Default::default(),
28717 )
28718 };
28719
28720 dlg.finished(true);
28721 return Ok(response);
28722 }
28723 }
28724 }
28725 }
28726
28727 /// 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 '-'.
28728 ///
28729 /// Sets the *resource id* path property to the given value.
28730 ///
28731 /// Even though the property as already been set when instantiating this call,
28732 /// we provide this method for API completeness.
28733 pub fn resource_id(mut self, new_value: &str) -> MediaDownloadCall<'a, C> {
28734 self._resource_id = new_value.to_string();
28735 self
28736 }
28737 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28738 /// while executing the actual API request.
28739 ///
28740 /// ````text
28741 /// It should be used to handle progress information, and to implement a certain level of resilience.
28742 /// ````
28743 ///
28744 /// Sets the *delegate* property to the given value.
28745 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MediaDownloadCall<'a, C> {
28746 self._delegate = Some(new_value);
28747 self
28748 }
28749
28750 /// Set any additional parameter of the query string used in the request.
28751 /// It should be used to set parameters which are not yet available through their own
28752 /// setters.
28753 ///
28754 /// Please note that this method must not be used to set any of the known parameters
28755 /// which have their own setter method. If done anyway, the request will fail.
28756 ///
28757 /// # Additional Parameters
28758 ///
28759 /// * *$.xgafv* (query-string) - V1 error format.
28760 /// * *access_token* (query-string) - OAuth access token.
28761 /// * *alt* (query-string) - Data format for response.
28762 /// * *callback* (query-string) - JSONP
28763 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28764 /// * *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.
28765 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28766 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28767 /// * *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.
28768 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28769 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28770 pub fn param<T>(mut self, name: T, value: T) -> MediaDownloadCall<'a, C>
28771 where
28772 T: AsRef<str>,
28773 {
28774 self._additional_params
28775 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28776 self
28777 }
28778
28779 /// Identifies the authorization scope for the method you are building.
28780 ///
28781 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28782 /// [`Scope::WalletObjectIssuer`].
28783 ///
28784 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28785 /// tokens for more than one scope.
28786 ///
28787 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28788 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28789 /// sufficient, a read-write scope will do as well.
28790 pub fn add_scope<St>(mut self, scope: St) -> MediaDownloadCall<'a, C>
28791 where
28792 St: AsRef<str>,
28793 {
28794 self._scopes.insert(String::from(scope.as_ref()));
28795 self
28796 }
28797 /// Identifies the authorization scope(s) for the method you are building.
28798 ///
28799 /// See [`Self::add_scope()`] for details.
28800 pub fn add_scopes<I, St>(mut self, scopes: I) -> MediaDownloadCall<'a, C>
28801 where
28802 I: IntoIterator<Item = St>,
28803 St: AsRef<str>,
28804 {
28805 self._scopes
28806 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28807 self
28808 }
28809
28810 /// Removes all scopes, and no default scope will be used either.
28811 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28812 /// for details).
28813 pub fn clear_scopes(mut self) -> MediaDownloadCall<'a, C> {
28814 self._scopes.clear();
28815 self
28816 }
28817}
28818
28819/// 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.
28820///
28821/// A builder for the *upload* method supported by a *media* resource.
28822/// It is not used directly, but through a [`MediaMethods`] instance.
28823///
28824/// # Example
28825///
28826/// Instantiate a resource method builder
28827///
28828/// ```test_harness,no_run
28829/// # extern crate hyper;
28830/// # extern crate hyper_rustls;
28831/// # extern crate google_walletobjects1 as walletobjects1;
28832/// use walletobjects1::api::TransitObjectUploadRotatingBarcodeValuesRequest;
28833/// use std::fs;
28834/// # async fn dox() {
28835/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28836///
28837/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28838/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28839/// # secret,
28840/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28841/// # ).build().await.unwrap();
28842///
28843/// # let client = hyper_util::client::legacy::Client::builder(
28844/// # hyper_util::rt::TokioExecutor::new()
28845/// # )
28846/// # .build(
28847/// # hyper_rustls::HttpsConnectorBuilder::new()
28848/// # .with_native_roots()
28849/// # .unwrap()
28850/// # .https_or_http()
28851/// # .enable_http1()
28852/// # .build()
28853/// # );
28854/// # let mut hub = Walletobjects::new(client, auth);
28855/// // As the method needs a request, you would usually fill it with the desired information
28856/// // into the respective structure. Some of the parts shown here might not be applicable !
28857/// // Values shown here are possibly random and not representative !
28858/// let mut req = TransitObjectUploadRotatingBarcodeValuesRequest::default();
28859///
28860/// // You can configure optional parameters by calling the respective setters at will, and
28861/// // execute the final call using `upload(...)`.
28862/// // Values shown here are possibly random and not representative !
28863/// let result = hub.media().upload(req, "resourceId")
28864/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
28865/// # }
28866/// ```
28867pub struct MediaUploadCall<'a, C>
28868where
28869 C: 'a,
28870{
28871 hub: &'a Walletobjects<C>,
28872 _request: TransitObjectUploadRotatingBarcodeValuesRequest,
28873 _resource_id: String,
28874 _delegate: Option<&'a mut dyn common::Delegate>,
28875 _additional_params: HashMap<String, String>,
28876 _scopes: BTreeSet<String>,
28877}
28878
28879impl<'a, C> common::CallBuilder for MediaUploadCall<'a, C> {}
28880
28881impl<'a, C> MediaUploadCall<'a, C>
28882where
28883 C: common::Connector,
28884{
28885 /// Perform the operation you have build so far.
28886 async fn doit<RS>(
28887 mut self,
28888 mut reader: RS,
28889 reader_mime_type: mime::Mime,
28890 protocol: common::UploadProtocol,
28891 ) -> common::Result<(
28892 common::Response,
28893 TransitObjectUploadRotatingBarcodeValuesResponse,
28894 )>
28895 where
28896 RS: common::ReadSeek,
28897 {
28898 use std::borrow::Cow;
28899 use std::io::{Read, Seek};
28900
28901 use common::{url::Params, ToParts};
28902 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28903
28904 let mut dd = common::DefaultDelegate;
28905 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28906 dlg.begin(common::MethodInfo {
28907 id: "walletobjects.media.upload",
28908 http_method: hyper::Method::POST,
28909 });
28910
28911 for &field in ["alt", "resourceId"].iter() {
28912 if self._additional_params.contains_key(field) {
28913 dlg.finished(false);
28914 return Err(common::Error::FieldClash(field));
28915 }
28916 }
28917
28918 let mut params = Params::with_capacity(4 + self._additional_params.len());
28919 params.push("resourceId", self._resource_id);
28920
28921 params.extend(self._additional_params.iter());
28922
28923 params.push("alt", "json");
28924 let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
28925 (self.hub._root_url.clone() + "upload/walletobjects/v1/transitObject/{resourceId}/uploadRotatingBarcodeValues", "multipart")
28926 } else {
28927 unreachable!()
28928 };
28929 params.push("uploadType", upload_type);
28930 if self._scopes.is_empty() {
28931 self._scopes
28932 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
28933 }
28934
28935 #[allow(clippy::single_element_loop)]
28936 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
28937 url = params.uri_replacement(url, param_name, find_this, false);
28938 }
28939 {
28940 let to_remove = ["resourceId"];
28941 params.remove_params(&to_remove);
28942 }
28943
28944 let url = params.parse_with_url(&url);
28945
28946 let mut json_mime_type = mime::APPLICATION_JSON;
28947 let mut request_value_reader = {
28948 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28949 common::remove_json_null_values(&mut value);
28950 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28951 serde_json::to_writer(&mut dst, &value).unwrap();
28952 dst
28953 };
28954 let request_size = request_value_reader
28955 .seek(std::io::SeekFrom::End(0))
28956 .unwrap();
28957 request_value_reader
28958 .seek(std::io::SeekFrom::Start(0))
28959 .unwrap();
28960
28961 loop {
28962 let token = match self
28963 .hub
28964 .auth
28965 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28966 .await
28967 {
28968 Ok(token) => token,
28969 Err(e) => match dlg.token(e) {
28970 Ok(token) => token,
28971 Err(e) => {
28972 dlg.finished(false);
28973 return Err(common::Error::MissingToken(e));
28974 }
28975 },
28976 };
28977 request_value_reader
28978 .seek(std::io::SeekFrom::Start(0))
28979 .unwrap();
28980 let mut req_result = {
28981 let mut mp_reader: common::MultiPartReader = Default::default();
28982 let (mut body_reader, content_type) = match protocol {
28983 common::UploadProtocol::Simple => {
28984 mp_reader.reserve_exact(2);
28985 let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
28986 reader.seek(std::io::SeekFrom::Start(0)).unwrap();
28987
28988 mp_reader
28989 .add_part(
28990 &mut request_value_reader,
28991 request_size,
28992 json_mime_type.clone(),
28993 )
28994 .add_part(&mut reader, size, reader_mime_type.clone());
28995 (
28996 &mut mp_reader as &mut (dyn std::io::Read + Send),
28997 common::MultiPartReader::mime_type(),
28998 )
28999 }
29000 _ => (
29001 &mut request_value_reader as &mut (dyn std::io::Read + Send),
29002 json_mime_type.clone(),
29003 ),
29004 };
29005 let client = &self.hub.client;
29006 dlg.pre_request();
29007 let mut req_builder = hyper::Request::builder()
29008 .method(hyper::Method::POST)
29009 .uri(url.as_str())
29010 .header(USER_AGENT, self.hub._user_agent.clone());
29011
29012 if let Some(token) = token.as_ref() {
29013 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29014 }
29015
29016 let mut body_reader_bytes = vec![];
29017 body_reader.read_to_end(&mut body_reader_bytes).unwrap();
29018 let request = req_builder
29019 .header(CONTENT_TYPE, content_type.to_string())
29020 .body(common::to_body(body_reader_bytes.into()));
29021
29022 client.request(request.unwrap()).await
29023 };
29024
29025 match req_result {
29026 Err(err) => {
29027 if let common::Retry::After(d) = dlg.http_error(&err) {
29028 sleep(d).await;
29029 continue;
29030 }
29031 dlg.finished(false);
29032 return Err(common::Error::HttpError(err));
29033 }
29034 Ok(res) => {
29035 let (mut parts, body) = res.into_parts();
29036 let mut body = common::Body::new(body);
29037 if !parts.status.is_success() {
29038 let bytes = common::to_bytes(body).await.unwrap_or_default();
29039 let error = serde_json::from_str(&common::to_string(&bytes));
29040 let response = common::to_response(parts, bytes.into());
29041
29042 if let common::Retry::After(d) =
29043 dlg.http_failure(&response, error.as_ref().ok())
29044 {
29045 sleep(d).await;
29046 continue;
29047 }
29048
29049 dlg.finished(false);
29050
29051 return Err(match error {
29052 Ok(value) => common::Error::BadRequest(value),
29053 _ => common::Error::Failure(response),
29054 });
29055 }
29056 let response = {
29057 let bytes = common::to_bytes(body).await.unwrap_or_default();
29058 let encoded = common::to_string(&bytes);
29059 match serde_json::from_str(&encoded) {
29060 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29061 Err(error) => {
29062 dlg.response_json_decode_error(&encoded, &error);
29063 return Err(common::Error::JsonDecodeError(
29064 encoded.to_string(),
29065 error,
29066 ));
29067 }
29068 }
29069 };
29070
29071 dlg.finished(true);
29072 return Ok(response);
29073 }
29074 }
29075 }
29076 }
29077
29078 /// Upload media all at once.
29079 /// If the upload fails for whichever reason, all progress is lost.
29080 ///
29081 /// * *multipart*: yes
29082 /// * *max size*: 0kb
29083 /// * *valid mime types*: '*/*'
29084 pub async fn upload<RS>(
29085 self,
29086 stream: RS,
29087 mime_type: mime::Mime,
29088 ) -> common::Result<(
29089 common::Response,
29090 TransitObjectUploadRotatingBarcodeValuesResponse,
29091 )>
29092 where
29093 RS: common::ReadSeek,
29094 {
29095 self.doit(stream, mime_type, common::UploadProtocol::Simple)
29096 .await
29097 }
29098
29099 ///
29100 /// Sets the *request* property to the given value.
29101 ///
29102 /// Even though the property as already been set when instantiating this call,
29103 /// we provide this method for API completeness.
29104 pub fn request(
29105 mut self,
29106 new_value: TransitObjectUploadRotatingBarcodeValuesRequest,
29107 ) -> MediaUploadCall<'a, C> {
29108 self._request = new_value;
29109 self
29110 }
29111 /// 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 '-'.
29112 ///
29113 /// Sets the *resource id* path property to the given value.
29114 ///
29115 /// Even though the property as already been set when instantiating this call,
29116 /// we provide this method for API completeness.
29117 pub fn resource_id(mut self, new_value: &str) -> MediaUploadCall<'a, C> {
29118 self._resource_id = new_value.to_string();
29119 self
29120 }
29121 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29122 /// while executing the actual API request.
29123 ///
29124 /// ````text
29125 /// It should be used to handle progress information, and to implement a certain level of resilience.
29126 /// ````
29127 ///
29128 /// Sets the *delegate* property to the given value.
29129 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MediaUploadCall<'a, C> {
29130 self._delegate = Some(new_value);
29131 self
29132 }
29133
29134 /// Set any additional parameter of the query string used in the request.
29135 /// It should be used to set parameters which are not yet available through their own
29136 /// setters.
29137 ///
29138 /// Please note that this method must not be used to set any of the known parameters
29139 /// which have their own setter method. If done anyway, the request will fail.
29140 ///
29141 /// # Additional Parameters
29142 ///
29143 /// * *$.xgafv* (query-string) - V1 error format.
29144 /// * *access_token* (query-string) - OAuth access token.
29145 /// * *alt* (query-string) - Data format for response.
29146 /// * *callback* (query-string) - JSONP
29147 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29148 /// * *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.
29149 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29150 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29151 /// * *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.
29152 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29153 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29154 pub fn param<T>(mut self, name: T, value: T) -> MediaUploadCall<'a, C>
29155 where
29156 T: AsRef<str>,
29157 {
29158 self._additional_params
29159 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29160 self
29161 }
29162
29163 /// Identifies the authorization scope for the method you are building.
29164 ///
29165 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29166 /// [`Scope::WalletObjectIssuer`].
29167 ///
29168 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29169 /// tokens for more than one scope.
29170 ///
29171 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29172 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29173 /// sufficient, a read-write scope will do as well.
29174 pub fn add_scope<St>(mut self, scope: St) -> MediaUploadCall<'a, C>
29175 where
29176 St: AsRef<str>,
29177 {
29178 self._scopes.insert(String::from(scope.as_ref()));
29179 self
29180 }
29181 /// Identifies the authorization scope(s) for the method you are building.
29182 ///
29183 /// See [`Self::add_scope()`] for details.
29184 pub fn add_scopes<I, St>(mut self, scopes: I) -> MediaUploadCall<'a, C>
29185 where
29186 I: IntoIterator<Item = St>,
29187 St: AsRef<str>,
29188 {
29189 self._scopes
29190 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29191 self
29192 }
29193
29194 /// Removes all scopes, and no default scope will be used either.
29195 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29196 /// for details).
29197 pub fn clear_scopes(mut self) -> MediaUploadCall<'a, C> {
29198 self._scopes.clear();
29199 self
29200 }
29201}
29202
29203/// Adds a message to the offer class referenced by the given class ID.
29204///
29205/// A builder for the *addmessage* method supported by a *offerclas* resource.
29206/// It is not used directly, but through a [`OfferclasMethods`] instance.
29207///
29208/// # Example
29209///
29210/// Instantiate a resource method builder
29211///
29212/// ```test_harness,no_run
29213/// # extern crate hyper;
29214/// # extern crate hyper_rustls;
29215/// # extern crate google_walletobjects1 as walletobjects1;
29216/// use walletobjects1::api::AddMessageRequest;
29217/// # async fn dox() {
29218/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29219///
29220/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29221/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29222/// # secret,
29223/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
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_http1()
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 = AddMessageRequest::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.offerclass().addmessage(req, "resourceId")
29247/// .doit().await;
29248/// # }
29249/// ```
29250pub struct OfferclasAddmessageCall<'a, C>
29251where
29252 C: 'a,
29253{
29254 hub: &'a Walletobjects<C>,
29255 _request: AddMessageRequest,
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 OfferclasAddmessageCall<'a, C> {}
29263
29264impl<'a, C> OfferclasAddmessageCall<'a, C>
29265where
29266 C: common::Connector,
29267{
29268 /// Perform the operation you have build so far.
29269 pub async fn doit(
29270 mut self,
29271 ) -> common::Result<(common::Response, OfferClassAddMessageResponse)> {
29272 use std::borrow::Cow;
29273 use std::io::{Read, Seek};
29274
29275 use common::{url::Params, ToParts};
29276 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29277
29278 let mut dd = common::DefaultDelegate;
29279 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29280 dlg.begin(common::MethodInfo {
29281 id: "walletobjects.offerclass.addmessage",
29282 http_method: hyper::Method::POST,
29283 });
29284
29285 for &field in ["alt", "resourceId"].iter() {
29286 if self._additional_params.contains_key(field) {
29287 dlg.finished(false);
29288 return Err(common::Error::FieldClash(field));
29289 }
29290 }
29291
29292 let mut params = Params::with_capacity(4 + self._additional_params.len());
29293 params.push("resourceId", self._resource_id);
29294
29295 params.extend(self._additional_params.iter());
29296
29297 params.push("alt", "json");
29298 let mut url =
29299 self.hub._base_url.clone() + "walletobjects/v1/offerClass/{resourceId}/addMessage";
29300 if self._scopes.is_empty() {
29301 self._scopes
29302 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
29303 }
29304
29305 #[allow(clippy::single_element_loop)]
29306 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
29307 url = params.uri_replacement(url, param_name, find_this, false);
29308 }
29309 {
29310 let to_remove = ["resourceId"];
29311 params.remove_params(&to_remove);
29312 }
29313
29314 let url = params.parse_with_url(&url);
29315
29316 let mut json_mime_type = mime::APPLICATION_JSON;
29317 let mut request_value_reader = {
29318 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29319 common::remove_json_null_values(&mut value);
29320 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29321 serde_json::to_writer(&mut dst, &value).unwrap();
29322 dst
29323 };
29324 let request_size = request_value_reader
29325 .seek(std::io::SeekFrom::End(0))
29326 .unwrap();
29327 request_value_reader
29328 .seek(std::io::SeekFrom::Start(0))
29329 .unwrap();
29330
29331 loop {
29332 let token = match self
29333 .hub
29334 .auth
29335 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29336 .await
29337 {
29338 Ok(token) => token,
29339 Err(e) => match dlg.token(e) {
29340 Ok(token) => token,
29341 Err(e) => {
29342 dlg.finished(false);
29343 return Err(common::Error::MissingToken(e));
29344 }
29345 },
29346 };
29347 request_value_reader
29348 .seek(std::io::SeekFrom::Start(0))
29349 .unwrap();
29350 let mut req_result = {
29351 let client = &self.hub.client;
29352 dlg.pre_request();
29353 let mut req_builder = hyper::Request::builder()
29354 .method(hyper::Method::POST)
29355 .uri(url.as_str())
29356 .header(USER_AGENT, self.hub._user_agent.clone());
29357
29358 if let Some(token) = token.as_ref() {
29359 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29360 }
29361
29362 let request = req_builder
29363 .header(CONTENT_TYPE, json_mime_type.to_string())
29364 .header(CONTENT_LENGTH, request_size as u64)
29365 .body(common::to_body(
29366 request_value_reader.get_ref().clone().into(),
29367 ));
29368
29369 client.request(request.unwrap()).await
29370 };
29371
29372 match req_result {
29373 Err(err) => {
29374 if let common::Retry::After(d) = dlg.http_error(&err) {
29375 sleep(d).await;
29376 continue;
29377 }
29378 dlg.finished(false);
29379 return Err(common::Error::HttpError(err));
29380 }
29381 Ok(res) => {
29382 let (mut parts, body) = res.into_parts();
29383 let mut body = common::Body::new(body);
29384 if !parts.status.is_success() {
29385 let bytes = common::to_bytes(body).await.unwrap_or_default();
29386 let error = serde_json::from_str(&common::to_string(&bytes));
29387 let response = common::to_response(parts, bytes.into());
29388
29389 if let common::Retry::After(d) =
29390 dlg.http_failure(&response, error.as_ref().ok())
29391 {
29392 sleep(d).await;
29393 continue;
29394 }
29395
29396 dlg.finished(false);
29397
29398 return Err(match error {
29399 Ok(value) => common::Error::BadRequest(value),
29400 _ => common::Error::Failure(response),
29401 });
29402 }
29403 let response = {
29404 let bytes = common::to_bytes(body).await.unwrap_or_default();
29405 let encoded = common::to_string(&bytes);
29406 match serde_json::from_str(&encoded) {
29407 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29408 Err(error) => {
29409 dlg.response_json_decode_error(&encoded, &error);
29410 return Err(common::Error::JsonDecodeError(
29411 encoded.to_string(),
29412 error,
29413 ));
29414 }
29415 }
29416 };
29417
29418 dlg.finished(true);
29419 return Ok(response);
29420 }
29421 }
29422 }
29423 }
29424
29425 ///
29426 /// Sets the *request* property to the given value.
29427 ///
29428 /// Even though the property as already been set when instantiating this call,
29429 /// we provide this method for API completeness.
29430 pub fn request(mut self, new_value: AddMessageRequest) -> OfferclasAddmessageCall<'a, C> {
29431 self._request = new_value;
29432 self
29433 }
29434 /// 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 '-'.
29435 ///
29436 /// Sets the *resource id* path property to the given value.
29437 ///
29438 /// Even though the property as already been set when instantiating this call,
29439 /// we provide this method for API completeness.
29440 pub fn resource_id(mut self, new_value: &str) -> OfferclasAddmessageCall<'a, C> {
29441 self._resource_id = new_value.to_string();
29442 self
29443 }
29444 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29445 /// while executing the actual API request.
29446 ///
29447 /// ````text
29448 /// It should be used to handle progress information, and to implement a certain level of resilience.
29449 /// ````
29450 ///
29451 /// Sets the *delegate* property to the given value.
29452 pub fn delegate(
29453 mut self,
29454 new_value: &'a mut dyn common::Delegate,
29455 ) -> OfferclasAddmessageCall<'a, C> {
29456 self._delegate = Some(new_value);
29457 self
29458 }
29459
29460 /// Set any additional parameter of the query string used in the request.
29461 /// It should be used to set parameters which are not yet available through their own
29462 /// setters.
29463 ///
29464 /// Please note that this method must not be used to set any of the known parameters
29465 /// which have their own setter method. If done anyway, the request will fail.
29466 ///
29467 /// # Additional Parameters
29468 ///
29469 /// * *$.xgafv* (query-string) - V1 error format.
29470 /// * *access_token* (query-string) - OAuth access token.
29471 /// * *alt* (query-string) - Data format for response.
29472 /// * *callback* (query-string) - JSONP
29473 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29474 /// * *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.
29475 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29476 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29477 /// * *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.
29478 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29479 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29480 pub fn param<T>(mut self, name: T, value: T) -> OfferclasAddmessageCall<'a, C>
29481 where
29482 T: AsRef<str>,
29483 {
29484 self._additional_params
29485 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29486 self
29487 }
29488
29489 /// Identifies the authorization scope for the method you are building.
29490 ///
29491 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29492 /// [`Scope::WalletObjectIssuer`].
29493 ///
29494 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29495 /// tokens for more than one scope.
29496 ///
29497 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29498 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29499 /// sufficient, a read-write scope will do as well.
29500 pub fn add_scope<St>(mut self, scope: St) -> OfferclasAddmessageCall<'a, C>
29501 where
29502 St: AsRef<str>,
29503 {
29504 self._scopes.insert(String::from(scope.as_ref()));
29505 self
29506 }
29507 /// Identifies the authorization scope(s) for the method you are building.
29508 ///
29509 /// See [`Self::add_scope()`] for details.
29510 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasAddmessageCall<'a, C>
29511 where
29512 I: IntoIterator<Item = St>,
29513 St: AsRef<str>,
29514 {
29515 self._scopes
29516 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29517 self
29518 }
29519
29520 /// Removes all scopes, and no default scope will be used either.
29521 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29522 /// for details).
29523 pub fn clear_scopes(mut self) -> OfferclasAddmessageCall<'a, C> {
29524 self._scopes.clear();
29525 self
29526 }
29527}
29528
29529/// Returns the offer class with the given class ID.
29530///
29531/// A builder for the *get* method supported by a *offerclas* resource.
29532/// It is not used directly, but through a [`OfferclasMethods`] instance.
29533///
29534/// # Example
29535///
29536/// Instantiate a resource method builder
29537///
29538/// ```test_harness,no_run
29539/// # extern crate hyper;
29540/// # extern crate hyper_rustls;
29541/// # extern crate google_walletobjects1 as walletobjects1;
29542/// # async fn dox() {
29543/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29544///
29545/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29546/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29547/// # secret,
29548/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29549/// # ).build().await.unwrap();
29550///
29551/// # let client = hyper_util::client::legacy::Client::builder(
29552/// # hyper_util::rt::TokioExecutor::new()
29553/// # )
29554/// # .build(
29555/// # hyper_rustls::HttpsConnectorBuilder::new()
29556/// # .with_native_roots()
29557/// # .unwrap()
29558/// # .https_or_http()
29559/// # .enable_http1()
29560/// # .build()
29561/// # );
29562/// # let mut hub = Walletobjects::new(client, auth);
29563/// // You can configure optional parameters by calling the respective setters at will, and
29564/// // execute the final call using `doit()`.
29565/// // Values shown here are possibly random and not representative !
29566/// let result = hub.offerclass().get("resourceId")
29567/// .doit().await;
29568/// # }
29569/// ```
29570pub struct OfferclasGetCall<'a, C>
29571where
29572 C: 'a,
29573{
29574 hub: &'a Walletobjects<C>,
29575 _resource_id: String,
29576 _delegate: Option<&'a mut dyn common::Delegate>,
29577 _additional_params: HashMap<String, String>,
29578 _scopes: BTreeSet<String>,
29579}
29580
29581impl<'a, C> common::CallBuilder for OfferclasGetCall<'a, C> {}
29582
29583impl<'a, C> OfferclasGetCall<'a, C>
29584where
29585 C: common::Connector,
29586{
29587 /// Perform the operation you have build so far.
29588 pub async fn doit(mut self) -> common::Result<(common::Response, OfferClass)> {
29589 use std::borrow::Cow;
29590 use std::io::{Read, Seek};
29591
29592 use common::{url::Params, ToParts};
29593 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29594
29595 let mut dd = common::DefaultDelegate;
29596 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29597 dlg.begin(common::MethodInfo {
29598 id: "walletobjects.offerclass.get",
29599 http_method: hyper::Method::GET,
29600 });
29601
29602 for &field in ["alt", "resourceId"].iter() {
29603 if self._additional_params.contains_key(field) {
29604 dlg.finished(false);
29605 return Err(common::Error::FieldClash(field));
29606 }
29607 }
29608
29609 let mut params = Params::with_capacity(3 + self._additional_params.len());
29610 params.push("resourceId", self._resource_id);
29611
29612 params.extend(self._additional_params.iter());
29613
29614 params.push("alt", "json");
29615 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass/{resourceId}";
29616 if self._scopes.is_empty() {
29617 self._scopes
29618 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
29619 }
29620
29621 #[allow(clippy::single_element_loop)]
29622 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
29623 url = params.uri_replacement(url, param_name, find_this, false);
29624 }
29625 {
29626 let to_remove = ["resourceId"];
29627 params.remove_params(&to_remove);
29628 }
29629
29630 let url = params.parse_with_url(&url);
29631
29632 loop {
29633 let token = match self
29634 .hub
29635 .auth
29636 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29637 .await
29638 {
29639 Ok(token) => token,
29640 Err(e) => match dlg.token(e) {
29641 Ok(token) => token,
29642 Err(e) => {
29643 dlg.finished(false);
29644 return Err(common::Error::MissingToken(e));
29645 }
29646 },
29647 };
29648 let mut req_result = {
29649 let client = &self.hub.client;
29650 dlg.pre_request();
29651 let mut req_builder = hyper::Request::builder()
29652 .method(hyper::Method::GET)
29653 .uri(url.as_str())
29654 .header(USER_AGENT, self.hub._user_agent.clone());
29655
29656 if let Some(token) = token.as_ref() {
29657 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29658 }
29659
29660 let request = req_builder
29661 .header(CONTENT_LENGTH, 0_u64)
29662 .body(common::to_body::<String>(None));
29663
29664 client.request(request.unwrap()).await
29665 };
29666
29667 match req_result {
29668 Err(err) => {
29669 if let common::Retry::After(d) = dlg.http_error(&err) {
29670 sleep(d).await;
29671 continue;
29672 }
29673 dlg.finished(false);
29674 return Err(common::Error::HttpError(err));
29675 }
29676 Ok(res) => {
29677 let (mut parts, body) = res.into_parts();
29678 let mut body = common::Body::new(body);
29679 if !parts.status.is_success() {
29680 let bytes = common::to_bytes(body).await.unwrap_or_default();
29681 let error = serde_json::from_str(&common::to_string(&bytes));
29682 let response = common::to_response(parts, bytes.into());
29683
29684 if let common::Retry::After(d) =
29685 dlg.http_failure(&response, error.as_ref().ok())
29686 {
29687 sleep(d).await;
29688 continue;
29689 }
29690
29691 dlg.finished(false);
29692
29693 return Err(match error {
29694 Ok(value) => common::Error::BadRequest(value),
29695 _ => common::Error::Failure(response),
29696 });
29697 }
29698 let response = {
29699 let bytes = common::to_bytes(body).await.unwrap_or_default();
29700 let encoded = common::to_string(&bytes);
29701 match serde_json::from_str(&encoded) {
29702 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29703 Err(error) => {
29704 dlg.response_json_decode_error(&encoded, &error);
29705 return Err(common::Error::JsonDecodeError(
29706 encoded.to_string(),
29707 error,
29708 ));
29709 }
29710 }
29711 };
29712
29713 dlg.finished(true);
29714 return Ok(response);
29715 }
29716 }
29717 }
29718 }
29719
29720 /// 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 '-'.
29721 ///
29722 /// Sets the *resource id* path property to the given value.
29723 ///
29724 /// Even though the property as already been set when instantiating this call,
29725 /// we provide this method for API completeness.
29726 pub fn resource_id(mut self, new_value: &str) -> OfferclasGetCall<'a, C> {
29727 self._resource_id = new_value.to_string();
29728 self
29729 }
29730 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29731 /// while executing the actual API request.
29732 ///
29733 /// ````text
29734 /// It should be used to handle progress information, and to implement a certain level of resilience.
29735 /// ````
29736 ///
29737 /// Sets the *delegate* property to the given value.
29738 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OfferclasGetCall<'a, C> {
29739 self._delegate = Some(new_value);
29740 self
29741 }
29742
29743 /// Set any additional parameter of the query string used in the request.
29744 /// It should be used to set parameters which are not yet available through their own
29745 /// setters.
29746 ///
29747 /// Please note that this method must not be used to set any of the known parameters
29748 /// which have their own setter method. If done anyway, the request will fail.
29749 ///
29750 /// # Additional Parameters
29751 ///
29752 /// * *$.xgafv* (query-string) - V1 error format.
29753 /// * *access_token* (query-string) - OAuth access token.
29754 /// * *alt* (query-string) - Data format for response.
29755 /// * *callback* (query-string) - JSONP
29756 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29757 /// * *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.
29758 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29759 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29760 /// * *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.
29761 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29762 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29763 pub fn param<T>(mut self, name: T, value: T) -> OfferclasGetCall<'a, C>
29764 where
29765 T: AsRef<str>,
29766 {
29767 self._additional_params
29768 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29769 self
29770 }
29771
29772 /// Identifies the authorization scope for the method you are building.
29773 ///
29774 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29775 /// [`Scope::WalletObjectIssuer`].
29776 ///
29777 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29778 /// tokens for more than one scope.
29779 ///
29780 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29781 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29782 /// sufficient, a read-write scope will do as well.
29783 pub fn add_scope<St>(mut self, scope: St) -> OfferclasGetCall<'a, C>
29784 where
29785 St: AsRef<str>,
29786 {
29787 self._scopes.insert(String::from(scope.as_ref()));
29788 self
29789 }
29790 /// Identifies the authorization scope(s) for the method you are building.
29791 ///
29792 /// See [`Self::add_scope()`] for details.
29793 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasGetCall<'a, C>
29794 where
29795 I: IntoIterator<Item = St>,
29796 St: AsRef<str>,
29797 {
29798 self._scopes
29799 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29800 self
29801 }
29802
29803 /// Removes all scopes, and no default scope will be used either.
29804 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29805 /// for details).
29806 pub fn clear_scopes(mut self) -> OfferclasGetCall<'a, C> {
29807 self._scopes.clear();
29808 self
29809 }
29810}
29811
29812/// Inserts an offer class with the given ID and properties.
29813///
29814/// A builder for the *insert* method supported by a *offerclas* resource.
29815/// It is not used directly, but through a [`OfferclasMethods`] instance.
29816///
29817/// # Example
29818///
29819/// Instantiate a resource method builder
29820///
29821/// ```test_harness,no_run
29822/// # extern crate hyper;
29823/// # extern crate hyper_rustls;
29824/// # extern crate google_walletobjects1 as walletobjects1;
29825/// use walletobjects1::api::OfferClass;
29826/// # async fn dox() {
29827/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29828///
29829/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29830/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29831/// # secret,
29832/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29833/// # ).build().await.unwrap();
29834///
29835/// # let client = hyper_util::client::legacy::Client::builder(
29836/// # hyper_util::rt::TokioExecutor::new()
29837/// # )
29838/// # .build(
29839/// # hyper_rustls::HttpsConnectorBuilder::new()
29840/// # .with_native_roots()
29841/// # .unwrap()
29842/// # .https_or_http()
29843/// # .enable_http1()
29844/// # .build()
29845/// # );
29846/// # let mut hub = Walletobjects::new(client, auth);
29847/// // As the method needs a request, you would usually fill it with the desired information
29848/// // into the respective structure. Some of the parts shown here might not be applicable !
29849/// // Values shown here are possibly random and not representative !
29850/// let mut req = OfferClass::default();
29851///
29852/// // You can configure optional parameters by calling the respective setters at will, and
29853/// // execute the final call using `doit()`.
29854/// // Values shown here are possibly random and not representative !
29855/// let result = hub.offerclass().insert(req)
29856/// .doit().await;
29857/// # }
29858/// ```
29859pub struct OfferclasInsertCall<'a, C>
29860where
29861 C: 'a,
29862{
29863 hub: &'a Walletobjects<C>,
29864 _request: OfferClass,
29865 _delegate: Option<&'a mut dyn common::Delegate>,
29866 _additional_params: HashMap<String, String>,
29867 _scopes: BTreeSet<String>,
29868}
29869
29870impl<'a, C> common::CallBuilder for OfferclasInsertCall<'a, C> {}
29871
29872impl<'a, C> OfferclasInsertCall<'a, C>
29873where
29874 C: common::Connector,
29875{
29876 /// Perform the operation you have build so far.
29877 pub async fn doit(mut self) -> common::Result<(common::Response, OfferClass)> {
29878 use std::borrow::Cow;
29879 use std::io::{Read, Seek};
29880
29881 use common::{url::Params, ToParts};
29882 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29883
29884 let mut dd = common::DefaultDelegate;
29885 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29886 dlg.begin(common::MethodInfo {
29887 id: "walletobjects.offerclass.insert",
29888 http_method: hyper::Method::POST,
29889 });
29890
29891 for &field in ["alt"].iter() {
29892 if self._additional_params.contains_key(field) {
29893 dlg.finished(false);
29894 return Err(common::Error::FieldClash(field));
29895 }
29896 }
29897
29898 let mut params = Params::with_capacity(3 + self._additional_params.len());
29899
29900 params.extend(self._additional_params.iter());
29901
29902 params.push("alt", "json");
29903 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass";
29904 if self._scopes.is_empty() {
29905 self._scopes
29906 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
29907 }
29908
29909 let url = params.parse_with_url(&url);
29910
29911 let mut json_mime_type = mime::APPLICATION_JSON;
29912 let mut request_value_reader = {
29913 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29914 common::remove_json_null_values(&mut value);
29915 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29916 serde_json::to_writer(&mut dst, &value).unwrap();
29917 dst
29918 };
29919 let request_size = request_value_reader
29920 .seek(std::io::SeekFrom::End(0))
29921 .unwrap();
29922 request_value_reader
29923 .seek(std::io::SeekFrom::Start(0))
29924 .unwrap();
29925
29926 loop {
29927 let token = match self
29928 .hub
29929 .auth
29930 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29931 .await
29932 {
29933 Ok(token) => token,
29934 Err(e) => match dlg.token(e) {
29935 Ok(token) => token,
29936 Err(e) => {
29937 dlg.finished(false);
29938 return Err(common::Error::MissingToken(e));
29939 }
29940 },
29941 };
29942 request_value_reader
29943 .seek(std::io::SeekFrom::Start(0))
29944 .unwrap();
29945 let mut req_result = {
29946 let client = &self.hub.client;
29947 dlg.pre_request();
29948 let mut req_builder = hyper::Request::builder()
29949 .method(hyper::Method::POST)
29950 .uri(url.as_str())
29951 .header(USER_AGENT, self.hub._user_agent.clone());
29952
29953 if let Some(token) = token.as_ref() {
29954 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29955 }
29956
29957 let request = req_builder
29958 .header(CONTENT_TYPE, json_mime_type.to_string())
29959 .header(CONTENT_LENGTH, request_size as u64)
29960 .body(common::to_body(
29961 request_value_reader.get_ref().clone().into(),
29962 ));
29963
29964 client.request(request.unwrap()).await
29965 };
29966
29967 match req_result {
29968 Err(err) => {
29969 if let common::Retry::After(d) = dlg.http_error(&err) {
29970 sleep(d).await;
29971 continue;
29972 }
29973 dlg.finished(false);
29974 return Err(common::Error::HttpError(err));
29975 }
29976 Ok(res) => {
29977 let (mut parts, body) = res.into_parts();
29978 let mut body = common::Body::new(body);
29979 if !parts.status.is_success() {
29980 let bytes = common::to_bytes(body).await.unwrap_or_default();
29981 let error = serde_json::from_str(&common::to_string(&bytes));
29982 let response = common::to_response(parts, bytes.into());
29983
29984 if let common::Retry::After(d) =
29985 dlg.http_failure(&response, error.as_ref().ok())
29986 {
29987 sleep(d).await;
29988 continue;
29989 }
29990
29991 dlg.finished(false);
29992
29993 return Err(match error {
29994 Ok(value) => common::Error::BadRequest(value),
29995 _ => common::Error::Failure(response),
29996 });
29997 }
29998 let response = {
29999 let bytes = common::to_bytes(body).await.unwrap_or_default();
30000 let encoded = common::to_string(&bytes);
30001 match serde_json::from_str(&encoded) {
30002 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30003 Err(error) => {
30004 dlg.response_json_decode_error(&encoded, &error);
30005 return Err(common::Error::JsonDecodeError(
30006 encoded.to_string(),
30007 error,
30008 ));
30009 }
30010 }
30011 };
30012
30013 dlg.finished(true);
30014 return Ok(response);
30015 }
30016 }
30017 }
30018 }
30019
30020 ///
30021 /// Sets the *request* property to the given value.
30022 ///
30023 /// Even though the property as already been set when instantiating this call,
30024 /// we provide this method for API completeness.
30025 pub fn request(mut self, new_value: OfferClass) -> OfferclasInsertCall<'a, C> {
30026 self._request = new_value;
30027 self
30028 }
30029 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30030 /// while executing the actual API request.
30031 ///
30032 /// ````text
30033 /// It should be used to handle progress information, and to implement a certain level of resilience.
30034 /// ````
30035 ///
30036 /// Sets the *delegate* property to the given value.
30037 pub fn delegate(
30038 mut self,
30039 new_value: &'a mut dyn common::Delegate,
30040 ) -> OfferclasInsertCall<'a, C> {
30041 self._delegate = Some(new_value);
30042 self
30043 }
30044
30045 /// Set any additional parameter of the query string used in the request.
30046 /// It should be used to set parameters which are not yet available through their own
30047 /// setters.
30048 ///
30049 /// Please note that this method must not be used to set any of the known parameters
30050 /// which have their own setter method. If done anyway, the request will fail.
30051 ///
30052 /// # Additional Parameters
30053 ///
30054 /// * *$.xgafv* (query-string) - V1 error format.
30055 /// * *access_token* (query-string) - OAuth access token.
30056 /// * *alt* (query-string) - Data format for response.
30057 /// * *callback* (query-string) - JSONP
30058 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30059 /// * *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.
30060 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30061 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30062 /// * *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.
30063 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30064 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30065 pub fn param<T>(mut self, name: T, value: T) -> OfferclasInsertCall<'a, C>
30066 where
30067 T: AsRef<str>,
30068 {
30069 self._additional_params
30070 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30071 self
30072 }
30073
30074 /// Identifies the authorization scope for the method you are building.
30075 ///
30076 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30077 /// [`Scope::WalletObjectIssuer`].
30078 ///
30079 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30080 /// tokens for more than one scope.
30081 ///
30082 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30083 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30084 /// sufficient, a read-write scope will do as well.
30085 pub fn add_scope<St>(mut self, scope: St) -> OfferclasInsertCall<'a, C>
30086 where
30087 St: AsRef<str>,
30088 {
30089 self._scopes.insert(String::from(scope.as_ref()));
30090 self
30091 }
30092 /// Identifies the authorization scope(s) for the method you are building.
30093 ///
30094 /// See [`Self::add_scope()`] for details.
30095 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasInsertCall<'a, C>
30096 where
30097 I: IntoIterator<Item = St>,
30098 St: AsRef<str>,
30099 {
30100 self._scopes
30101 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30102 self
30103 }
30104
30105 /// Removes all scopes, and no default scope will be used either.
30106 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30107 /// for details).
30108 pub fn clear_scopes(mut self) -> OfferclasInsertCall<'a, C> {
30109 self._scopes.clear();
30110 self
30111 }
30112}
30113
30114/// Returns a list of all offer classes for a given issuer ID.
30115///
30116/// A builder for the *list* method supported by a *offerclas* resource.
30117/// It is not used directly, but through a [`OfferclasMethods`] instance.
30118///
30119/// # Example
30120///
30121/// Instantiate a resource method builder
30122///
30123/// ```test_harness,no_run
30124/// # extern crate hyper;
30125/// # extern crate hyper_rustls;
30126/// # extern crate google_walletobjects1 as walletobjects1;
30127/// # async fn dox() {
30128/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30129///
30130/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30131/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30132/// # secret,
30133/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30134/// # ).build().await.unwrap();
30135///
30136/// # let client = hyper_util::client::legacy::Client::builder(
30137/// # hyper_util::rt::TokioExecutor::new()
30138/// # )
30139/// # .build(
30140/// # hyper_rustls::HttpsConnectorBuilder::new()
30141/// # .with_native_roots()
30142/// # .unwrap()
30143/// # .https_or_http()
30144/// # .enable_http1()
30145/// # .build()
30146/// # );
30147/// # let mut hub = Walletobjects::new(client, auth);
30148/// // You can configure optional parameters by calling the respective setters at will, and
30149/// // execute the final call using `doit()`.
30150/// // Values shown here are possibly random and not representative !
30151/// let result = hub.offerclass().list()
30152/// .token("amet.")
30153/// .max_results(-30)
30154/// .issuer_id(-9)
30155/// .doit().await;
30156/// # }
30157/// ```
30158pub struct OfferclasListCall<'a, C>
30159where
30160 C: 'a,
30161{
30162 hub: &'a Walletobjects<C>,
30163 _token: Option<String>,
30164 _max_results: Option<i32>,
30165 _issuer_id: Option<i64>,
30166 _delegate: Option<&'a mut dyn common::Delegate>,
30167 _additional_params: HashMap<String, String>,
30168 _scopes: BTreeSet<String>,
30169}
30170
30171impl<'a, C> common::CallBuilder for OfferclasListCall<'a, C> {}
30172
30173impl<'a, C> OfferclasListCall<'a, C>
30174where
30175 C: common::Connector,
30176{
30177 /// Perform the operation you have build so far.
30178 pub async fn doit(mut self) -> common::Result<(common::Response, OfferClassListResponse)> {
30179 use std::borrow::Cow;
30180 use std::io::{Read, Seek};
30181
30182 use common::{url::Params, ToParts};
30183 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30184
30185 let mut dd = common::DefaultDelegate;
30186 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30187 dlg.begin(common::MethodInfo {
30188 id: "walletobjects.offerclass.list",
30189 http_method: hyper::Method::GET,
30190 });
30191
30192 for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
30193 if self._additional_params.contains_key(field) {
30194 dlg.finished(false);
30195 return Err(common::Error::FieldClash(field));
30196 }
30197 }
30198
30199 let mut params = Params::with_capacity(5 + self._additional_params.len());
30200 if let Some(value) = self._token.as_ref() {
30201 params.push("token", value);
30202 }
30203 if let Some(value) = self._max_results.as_ref() {
30204 params.push("maxResults", value.to_string());
30205 }
30206 if let Some(value) = self._issuer_id.as_ref() {
30207 params.push("issuerId", value.to_string());
30208 }
30209
30210 params.extend(self._additional_params.iter());
30211
30212 params.push("alt", "json");
30213 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass";
30214 if self._scopes.is_empty() {
30215 self._scopes
30216 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
30217 }
30218
30219 let url = params.parse_with_url(&url);
30220
30221 loop {
30222 let token = match self
30223 .hub
30224 .auth
30225 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30226 .await
30227 {
30228 Ok(token) => token,
30229 Err(e) => match dlg.token(e) {
30230 Ok(token) => token,
30231 Err(e) => {
30232 dlg.finished(false);
30233 return Err(common::Error::MissingToken(e));
30234 }
30235 },
30236 };
30237 let mut req_result = {
30238 let client = &self.hub.client;
30239 dlg.pre_request();
30240 let mut req_builder = hyper::Request::builder()
30241 .method(hyper::Method::GET)
30242 .uri(url.as_str())
30243 .header(USER_AGENT, self.hub._user_agent.clone());
30244
30245 if let Some(token) = token.as_ref() {
30246 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30247 }
30248
30249 let request = req_builder
30250 .header(CONTENT_LENGTH, 0_u64)
30251 .body(common::to_body::<String>(None));
30252
30253 client.request(request.unwrap()).await
30254 };
30255
30256 match req_result {
30257 Err(err) => {
30258 if let common::Retry::After(d) = dlg.http_error(&err) {
30259 sleep(d).await;
30260 continue;
30261 }
30262 dlg.finished(false);
30263 return Err(common::Error::HttpError(err));
30264 }
30265 Ok(res) => {
30266 let (mut parts, body) = res.into_parts();
30267 let mut body = common::Body::new(body);
30268 if !parts.status.is_success() {
30269 let bytes = common::to_bytes(body).await.unwrap_or_default();
30270 let error = serde_json::from_str(&common::to_string(&bytes));
30271 let response = common::to_response(parts, bytes.into());
30272
30273 if let common::Retry::After(d) =
30274 dlg.http_failure(&response, error.as_ref().ok())
30275 {
30276 sleep(d).await;
30277 continue;
30278 }
30279
30280 dlg.finished(false);
30281
30282 return Err(match error {
30283 Ok(value) => common::Error::BadRequest(value),
30284 _ => common::Error::Failure(response),
30285 });
30286 }
30287 let response = {
30288 let bytes = common::to_bytes(body).await.unwrap_or_default();
30289 let encoded = common::to_string(&bytes);
30290 match serde_json::from_str(&encoded) {
30291 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30292 Err(error) => {
30293 dlg.response_json_decode_error(&encoded, &error);
30294 return Err(common::Error::JsonDecodeError(
30295 encoded.to_string(),
30296 error,
30297 ));
30298 }
30299 }
30300 };
30301
30302 dlg.finished(true);
30303 return Ok(response);
30304 }
30305 }
30306 }
30307 }
30308
30309 /// 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.
30310 ///
30311 /// Sets the *token* query property to the given value.
30312 pub fn token(mut self, new_value: &str) -> OfferclasListCall<'a, C> {
30313 self._token = Some(new_value.to_string());
30314 self
30315 }
30316 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
30317 ///
30318 /// Sets the *max results* query property to the given value.
30319 pub fn max_results(mut self, new_value: i32) -> OfferclasListCall<'a, C> {
30320 self._max_results = Some(new_value);
30321 self
30322 }
30323 /// The ID of the issuer authorized to list classes.
30324 ///
30325 /// Sets the *issuer id* query property to the given value.
30326 pub fn issuer_id(mut self, new_value: i64) -> OfferclasListCall<'a, C> {
30327 self._issuer_id = Some(new_value);
30328 self
30329 }
30330 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30331 /// while executing the actual API request.
30332 ///
30333 /// ````text
30334 /// It should be used to handle progress information, and to implement a certain level of resilience.
30335 /// ````
30336 ///
30337 /// Sets the *delegate* property to the given value.
30338 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OfferclasListCall<'a, C> {
30339 self._delegate = Some(new_value);
30340 self
30341 }
30342
30343 /// Set any additional parameter of the query string used in the request.
30344 /// It should be used to set parameters which are not yet available through their own
30345 /// setters.
30346 ///
30347 /// Please note that this method must not be used to set any of the known parameters
30348 /// which have their own setter method. If done anyway, the request will fail.
30349 ///
30350 /// # Additional Parameters
30351 ///
30352 /// * *$.xgafv* (query-string) - V1 error format.
30353 /// * *access_token* (query-string) - OAuth access token.
30354 /// * *alt* (query-string) - Data format for response.
30355 /// * *callback* (query-string) - JSONP
30356 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30357 /// * *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.
30358 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30359 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30360 /// * *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.
30361 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30362 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30363 pub fn param<T>(mut self, name: T, value: T) -> OfferclasListCall<'a, C>
30364 where
30365 T: AsRef<str>,
30366 {
30367 self._additional_params
30368 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30369 self
30370 }
30371
30372 /// Identifies the authorization scope for the method you are building.
30373 ///
30374 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30375 /// [`Scope::WalletObjectIssuer`].
30376 ///
30377 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30378 /// tokens for more than one scope.
30379 ///
30380 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30381 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30382 /// sufficient, a read-write scope will do as well.
30383 pub fn add_scope<St>(mut self, scope: St) -> OfferclasListCall<'a, C>
30384 where
30385 St: AsRef<str>,
30386 {
30387 self._scopes.insert(String::from(scope.as_ref()));
30388 self
30389 }
30390 /// Identifies the authorization scope(s) for the method you are building.
30391 ///
30392 /// See [`Self::add_scope()`] for details.
30393 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasListCall<'a, C>
30394 where
30395 I: IntoIterator<Item = St>,
30396 St: AsRef<str>,
30397 {
30398 self._scopes
30399 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30400 self
30401 }
30402
30403 /// Removes all scopes, and no default scope will be used either.
30404 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30405 /// for details).
30406 pub fn clear_scopes(mut self) -> OfferclasListCall<'a, C> {
30407 self._scopes.clear();
30408 self
30409 }
30410}
30411
30412/// Updates the offer class referenced by the given class ID. This method supports patch semantics.
30413///
30414/// A builder for the *patch* method supported by a *offerclas* resource.
30415/// It is not used directly, but through a [`OfferclasMethods`] instance.
30416///
30417/// # Example
30418///
30419/// Instantiate a resource method builder
30420///
30421/// ```test_harness,no_run
30422/// # extern crate hyper;
30423/// # extern crate hyper_rustls;
30424/// # extern crate google_walletobjects1 as walletobjects1;
30425/// use walletobjects1::api::OfferClass;
30426/// # async fn dox() {
30427/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30428///
30429/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30430/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30431/// # secret,
30432/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30433/// # ).build().await.unwrap();
30434///
30435/// # let client = hyper_util::client::legacy::Client::builder(
30436/// # hyper_util::rt::TokioExecutor::new()
30437/// # )
30438/// # .build(
30439/// # hyper_rustls::HttpsConnectorBuilder::new()
30440/// # .with_native_roots()
30441/// # .unwrap()
30442/// # .https_or_http()
30443/// # .enable_http1()
30444/// # .build()
30445/// # );
30446/// # let mut hub = Walletobjects::new(client, auth);
30447/// // As the method needs a request, you would usually fill it with the desired information
30448/// // into the respective structure. Some of the parts shown here might not be applicable !
30449/// // Values shown here are possibly random and not representative !
30450/// let mut req = OfferClass::default();
30451///
30452/// // You can configure optional parameters by calling the respective setters at will, and
30453/// // execute the final call using `doit()`.
30454/// // Values shown here are possibly random and not representative !
30455/// let result = hub.offerclass().patch(req, "resourceId")
30456/// .doit().await;
30457/// # }
30458/// ```
30459pub struct OfferclasPatchCall<'a, C>
30460where
30461 C: 'a,
30462{
30463 hub: &'a Walletobjects<C>,
30464 _request: OfferClass,
30465 _resource_id: String,
30466 _delegate: Option<&'a mut dyn common::Delegate>,
30467 _additional_params: HashMap<String, String>,
30468 _scopes: BTreeSet<String>,
30469}
30470
30471impl<'a, C> common::CallBuilder for OfferclasPatchCall<'a, C> {}
30472
30473impl<'a, C> OfferclasPatchCall<'a, C>
30474where
30475 C: common::Connector,
30476{
30477 /// Perform the operation you have build so far.
30478 pub async fn doit(mut self) -> common::Result<(common::Response, OfferClass)> {
30479 use std::borrow::Cow;
30480 use std::io::{Read, Seek};
30481
30482 use common::{url::Params, ToParts};
30483 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30484
30485 let mut dd = common::DefaultDelegate;
30486 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30487 dlg.begin(common::MethodInfo {
30488 id: "walletobjects.offerclass.patch",
30489 http_method: hyper::Method::PATCH,
30490 });
30491
30492 for &field in ["alt", "resourceId"].iter() {
30493 if self._additional_params.contains_key(field) {
30494 dlg.finished(false);
30495 return Err(common::Error::FieldClash(field));
30496 }
30497 }
30498
30499 let mut params = Params::with_capacity(4 + self._additional_params.len());
30500 params.push("resourceId", self._resource_id);
30501
30502 params.extend(self._additional_params.iter());
30503
30504 params.push("alt", "json");
30505 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass/{resourceId}";
30506 if self._scopes.is_empty() {
30507 self._scopes
30508 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
30509 }
30510
30511 #[allow(clippy::single_element_loop)]
30512 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
30513 url = params.uri_replacement(url, param_name, find_this, false);
30514 }
30515 {
30516 let to_remove = ["resourceId"];
30517 params.remove_params(&to_remove);
30518 }
30519
30520 let url = params.parse_with_url(&url);
30521
30522 let mut json_mime_type = mime::APPLICATION_JSON;
30523 let mut request_value_reader = {
30524 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30525 common::remove_json_null_values(&mut value);
30526 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30527 serde_json::to_writer(&mut dst, &value).unwrap();
30528 dst
30529 };
30530 let request_size = request_value_reader
30531 .seek(std::io::SeekFrom::End(0))
30532 .unwrap();
30533 request_value_reader
30534 .seek(std::io::SeekFrom::Start(0))
30535 .unwrap();
30536
30537 loop {
30538 let token = match self
30539 .hub
30540 .auth
30541 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30542 .await
30543 {
30544 Ok(token) => token,
30545 Err(e) => match dlg.token(e) {
30546 Ok(token) => token,
30547 Err(e) => {
30548 dlg.finished(false);
30549 return Err(common::Error::MissingToken(e));
30550 }
30551 },
30552 };
30553 request_value_reader
30554 .seek(std::io::SeekFrom::Start(0))
30555 .unwrap();
30556 let mut req_result = {
30557 let client = &self.hub.client;
30558 dlg.pre_request();
30559 let mut req_builder = hyper::Request::builder()
30560 .method(hyper::Method::PATCH)
30561 .uri(url.as_str())
30562 .header(USER_AGENT, self.hub._user_agent.clone());
30563
30564 if let Some(token) = token.as_ref() {
30565 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30566 }
30567
30568 let request = req_builder
30569 .header(CONTENT_TYPE, json_mime_type.to_string())
30570 .header(CONTENT_LENGTH, request_size as u64)
30571 .body(common::to_body(
30572 request_value_reader.get_ref().clone().into(),
30573 ));
30574
30575 client.request(request.unwrap()).await
30576 };
30577
30578 match req_result {
30579 Err(err) => {
30580 if let common::Retry::After(d) = dlg.http_error(&err) {
30581 sleep(d).await;
30582 continue;
30583 }
30584 dlg.finished(false);
30585 return Err(common::Error::HttpError(err));
30586 }
30587 Ok(res) => {
30588 let (mut parts, body) = res.into_parts();
30589 let mut body = common::Body::new(body);
30590 if !parts.status.is_success() {
30591 let bytes = common::to_bytes(body).await.unwrap_or_default();
30592 let error = serde_json::from_str(&common::to_string(&bytes));
30593 let response = common::to_response(parts, bytes.into());
30594
30595 if let common::Retry::After(d) =
30596 dlg.http_failure(&response, error.as_ref().ok())
30597 {
30598 sleep(d).await;
30599 continue;
30600 }
30601
30602 dlg.finished(false);
30603
30604 return Err(match error {
30605 Ok(value) => common::Error::BadRequest(value),
30606 _ => common::Error::Failure(response),
30607 });
30608 }
30609 let response = {
30610 let bytes = common::to_bytes(body).await.unwrap_or_default();
30611 let encoded = common::to_string(&bytes);
30612 match serde_json::from_str(&encoded) {
30613 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30614 Err(error) => {
30615 dlg.response_json_decode_error(&encoded, &error);
30616 return Err(common::Error::JsonDecodeError(
30617 encoded.to_string(),
30618 error,
30619 ));
30620 }
30621 }
30622 };
30623
30624 dlg.finished(true);
30625 return Ok(response);
30626 }
30627 }
30628 }
30629 }
30630
30631 ///
30632 /// Sets the *request* property to the given value.
30633 ///
30634 /// Even though the property as already been set when instantiating this call,
30635 /// we provide this method for API completeness.
30636 pub fn request(mut self, new_value: OfferClass) -> OfferclasPatchCall<'a, C> {
30637 self._request = new_value;
30638 self
30639 }
30640 /// 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 '-'.
30641 ///
30642 /// Sets the *resource id* path property to the given value.
30643 ///
30644 /// Even though the property as already been set when instantiating this call,
30645 /// we provide this method for API completeness.
30646 pub fn resource_id(mut self, new_value: &str) -> OfferclasPatchCall<'a, C> {
30647 self._resource_id = new_value.to_string();
30648 self
30649 }
30650 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30651 /// while executing the actual API request.
30652 ///
30653 /// ````text
30654 /// It should be used to handle progress information, and to implement a certain level of resilience.
30655 /// ````
30656 ///
30657 /// Sets the *delegate* property to the given value.
30658 pub fn delegate(
30659 mut self,
30660 new_value: &'a mut dyn common::Delegate,
30661 ) -> OfferclasPatchCall<'a, C> {
30662 self._delegate = Some(new_value);
30663 self
30664 }
30665
30666 /// Set any additional parameter of the query string used in the request.
30667 /// It should be used to set parameters which are not yet available through their own
30668 /// setters.
30669 ///
30670 /// Please note that this method must not be used to set any of the known parameters
30671 /// which have their own setter method. If done anyway, the request will fail.
30672 ///
30673 /// # Additional Parameters
30674 ///
30675 /// * *$.xgafv* (query-string) - V1 error format.
30676 /// * *access_token* (query-string) - OAuth access token.
30677 /// * *alt* (query-string) - Data format for response.
30678 /// * *callback* (query-string) - JSONP
30679 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30680 /// * *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.
30681 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30682 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30683 /// * *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.
30684 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30685 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30686 pub fn param<T>(mut self, name: T, value: T) -> OfferclasPatchCall<'a, C>
30687 where
30688 T: AsRef<str>,
30689 {
30690 self._additional_params
30691 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30692 self
30693 }
30694
30695 /// Identifies the authorization scope for the method you are building.
30696 ///
30697 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30698 /// [`Scope::WalletObjectIssuer`].
30699 ///
30700 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30701 /// tokens for more than one scope.
30702 ///
30703 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30704 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30705 /// sufficient, a read-write scope will do as well.
30706 pub fn add_scope<St>(mut self, scope: St) -> OfferclasPatchCall<'a, C>
30707 where
30708 St: AsRef<str>,
30709 {
30710 self._scopes.insert(String::from(scope.as_ref()));
30711 self
30712 }
30713 /// Identifies the authorization scope(s) for the method you are building.
30714 ///
30715 /// See [`Self::add_scope()`] for details.
30716 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasPatchCall<'a, C>
30717 where
30718 I: IntoIterator<Item = St>,
30719 St: AsRef<str>,
30720 {
30721 self._scopes
30722 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30723 self
30724 }
30725
30726 /// Removes all scopes, and no default scope will be used either.
30727 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30728 /// for details).
30729 pub fn clear_scopes(mut self) -> OfferclasPatchCall<'a, C> {
30730 self._scopes.clear();
30731 self
30732 }
30733}
30734
30735/// Updates the offer class referenced by the given class ID.
30736///
30737/// A builder for the *update* method supported by a *offerclas* resource.
30738/// It is not used directly, but through a [`OfferclasMethods`] instance.
30739///
30740/// # Example
30741///
30742/// Instantiate a resource method builder
30743///
30744/// ```test_harness,no_run
30745/// # extern crate hyper;
30746/// # extern crate hyper_rustls;
30747/// # extern crate google_walletobjects1 as walletobjects1;
30748/// use walletobjects1::api::OfferClass;
30749/// # async fn dox() {
30750/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30751///
30752/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30753/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30754/// # secret,
30755/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30756/// # ).build().await.unwrap();
30757///
30758/// # let client = hyper_util::client::legacy::Client::builder(
30759/// # hyper_util::rt::TokioExecutor::new()
30760/// # )
30761/// # .build(
30762/// # hyper_rustls::HttpsConnectorBuilder::new()
30763/// # .with_native_roots()
30764/// # .unwrap()
30765/// # .https_or_http()
30766/// # .enable_http1()
30767/// # .build()
30768/// # );
30769/// # let mut hub = Walletobjects::new(client, auth);
30770/// // As the method needs a request, you would usually fill it with the desired information
30771/// // into the respective structure. Some of the parts shown here might not be applicable !
30772/// // Values shown here are possibly random and not representative !
30773/// let mut req = OfferClass::default();
30774///
30775/// // You can configure optional parameters by calling the respective setters at will, and
30776/// // execute the final call using `doit()`.
30777/// // Values shown here are possibly random and not representative !
30778/// let result = hub.offerclass().update(req, "resourceId")
30779/// .doit().await;
30780/// # }
30781/// ```
30782pub struct OfferclasUpdateCall<'a, C>
30783where
30784 C: 'a,
30785{
30786 hub: &'a Walletobjects<C>,
30787 _request: OfferClass,
30788 _resource_id: String,
30789 _delegate: Option<&'a mut dyn common::Delegate>,
30790 _additional_params: HashMap<String, String>,
30791 _scopes: BTreeSet<String>,
30792}
30793
30794impl<'a, C> common::CallBuilder for OfferclasUpdateCall<'a, C> {}
30795
30796impl<'a, C> OfferclasUpdateCall<'a, C>
30797where
30798 C: common::Connector,
30799{
30800 /// Perform the operation you have build so far.
30801 pub async fn doit(mut self) -> common::Result<(common::Response, OfferClass)> {
30802 use std::borrow::Cow;
30803 use std::io::{Read, Seek};
30804
30805 use common::{url::Params, ToParts};
30806 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30807
30808 let mut dd = common::DefaultDelegate;
30809 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30810 dlg.begin(common::MethodInfo {
30811 id: "walletobjects.offerclass.update",
30812 http_method: hyper::Method::PUT,
30813 });
30814
30815 for &field in ["alt", "resourceId"].iter() {
30816 if self._additional_params.contains_key(field) {
30817 dlg.finished(false);
30818 return Err(common::Error::FieldClash(field));
30819 }
30820 }
30821
30822 let mut params = Params::with_capacity(4 + self._additional_params.len());
30823 params.push("resourceId", self._resource_id);
30824
30825 params.extend(self._additional_params.iter());
30826
30827 params.push("alt", "json");
30828 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerClass/{resourceId}";
30829 if self._scopes.is_empty() {
30830 self._scopes
30831 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
30832 }
30833
30834 #[allow(clippy::single_element_loop)]
30835 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
30836 url = params.uri_replacement(url, param_name, find_this, false);
30837 }
30838 {
30839 let to_remove = ["resourceId"];
30840 params.remove_params(&to_remove);
30841 }
30842
30843 let url = params.parse_with_url(&url);
30844
30845 let mut json_mime_type = mime::APPLICATION_JSON;
30846 let mut request_value_reader = {
30847 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30848 common::remove_json_null_values(&mut value);
30849 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30850 serde_json::to_writer(&mut dst, &value).unwrap();
30851 dst
30852 };
30853 let request_size = request_value_reader
30854 .seek(std::io::SeekFrom::End(0))
30855 .unwrap();
30856 request_value_reader
30857 .seek(std::io::SeekFrom::Start(0))
30858 .unwrap();
30859
30860 loop {
30861 let token = match self
30862 .hub
30863 .auth
30864 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30865 .await
30866 {
30867 Ok(token) => token,
30868 Err(e) => match dlg.token(e) {
30869 Ok(token) => token,
30870 Err(e) => {
30871 dlg.finished(false);
30872 return Err(common::Error::MissingToken(e));
30873 }
30874 },
30875 };
30876 request_value_reader
30877 .seek(std::io::SeekFrom::Start(0))
30878 .unwrap();
30879 let mut req_result = {
30880 let client = &self.hub.client;
30881 dlg.pre_request();
30882 let mut req_builder = hyper::Request::builder()
30883 .method(hyper::Method::PUT)
30884 .uri(url.as_str())
30885 .header(USER_AGENT, self.hub._user_agent.clone());
30886
30887 if let Some(token) = token.as_ref() {
30888 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30889 }
30890
30891 let request = req_builder
30892 .header(CONTENT_TYPE, json_mime_type.to_string())
30893 .header(CONTENT_LENGTH, request_size as u64)
30894 .body(common::to_body(
30895 request_value_reader.get_ref().clone().into(),
30896 ));
30897
30898 client.request(request.unwrap()).await
30899 };
30900
30901 match req_result {
30902 Err(err) => {
30903 if let common::Retry::After(d) = dlg.http_error(&err) {
30904 sleep(d).await;
30905 continue;
30906 }
30907 dlg.finished(false);
30908 return Err(common::Error::HttpError(err));
30909 }
30910 Ok(res) => {
30911 let (mut parts, body) = res.into_parts();
30912 let mut body = common::Body::new(body);
30913 if !parts.status.is_success() {
30914 let bytes = common::to_bytes(body).await.unwrap_or_default();
30915 let error = serde_json::from_str(&common::to_string(&bytes));
30916 let response = common::to_response(parts, bytes.into());
30917
30918 if let common::Retry::After(d) =
30919 dlg.http_failure(&response, error.as_ref().ok())
30920 {
30921 sleep(d).await;
30922 continue;
30923 }
30924
30925 dlg.finished(false);
30926
30927 return Err(match error {
30928 Ok(value) => common::Error::BadRequest(value),
30929 _ => common::Error::Failure(response),
30930 });
30931 }
30932 let response = {
30933 let bytes = common::to_bytes(body).await.unwrap_or_default();
30934 let encoded = common::to_string(&bytes);
30935 match serde_json::from_str(&encoded) {
30936 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30937 Err(error) => {
30938 dlg.response_json_decode_error(&encoded, &error);
30939 return Err(common::Error::JsonDecodeError(
30940 encoded.to_string(),
30941 error,
30942 ));
30943 }
30944 }
30945 };
30946
30947 dlg.finished(true);
30948 return Ok(response);
30949 }
30950 }
30951 }
30952 }
30953
30954 ///
30955 /// Sets the *request* property to the given value.
30956 ///
30957 /// Even though the property as already been set when instantiating this call,
30958 /// we provide this method for API completeness.
30959 pub fn request(mut self, new_value: OfferClass) -> OfferclasUpdateCall<'a, C> {
30960 self._request = new_value;
30961 self
30962 }
30963 /// 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 '-'.
30964 ///
30965 /// Sets the *resource id* path property to the given value.
30966 ///
30967 /// Even though the property as already been set when instantiating this call,
30968 /// we provide this method for API completeness.
30969 pub fn resource_id(mut self, new_value: &str) -> OfferclasUpdateCall<'a, C> {
30970 self._resource_id = new_value.to_string();
30971 self
30972 }
30973 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30974 /// while executing the actual API request.
30975 ///
30976 /// ````text
30977 /// It should be used to handle progress information, and to implement a certain level of resilience.
30978 /// ````
30979 ///
30980 /// Sets the *delegate* property to the given value.
30981 pub fn delegate(
30982 mut self,
30983 new_value: &'a mut dyn common::Delegate,
30984 ) -> OfferclasUpdateCall<'a, C> {
30985 self._delegate = Some(new_value);
30986 self
30987 }
30988
30989 /// Set any additional parameter of the query string used in the request.
30990 /// It should be used to set parameters which are not yet available through their own
30991 /// setters.
30992 ///
30993 /// Please note that this method must not be used to set any of the known parameters
30994 /// which have their own setter method. If done anyway, the request will fail.
30995 ///
30996 /// # Additional Parameters
30997 ///
30998 /// * *$.xgafv* (query-string) - V1 error format.
30999 /// * *access_token* (query-string) - OAuth access token.
31000 /// * *alt* (query-string) - Data format for response.
31001 /// * *callback* (query-string) - JSONP
31002 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31003 /// * *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.
31004 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31005 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31006 /// * *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.
31007 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31008 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31009 pub fn param<T>(mut self, name: T, value: T) -> OfferclasUpdateCall<'a, C>
31010 where
31011 T: AsRef<str>,
31012 {
31013 self._additional_params
31014 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31015 self
31016 }
31017
31018 /// Identifies the authorization scope for the method you are building.
31019 ///
31020 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31021 /// [`Scope::WalletObjectIssuer`].
31022 ///
31023 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31024 /// tokens for more than one scope.
31025 ///
31026 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31027 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31028 /// sufficient, a read-write scope will do as well.
31029 pub fn add_scope<St>(mut self, scope: St) -> OfferclasUpdateCall<'a, C>
31030 where
31031 St: AsRef<str>,
31032 {
31033 self._scopes.insert(String::from(scope.as_ref()));
31034 self
31035 }
31036 /// Identifies the authorization scope(s) for the method you are building.
31037 ///
31038 /// See [`Self::add_scope()`] for details.
31039 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferclasUpdateCall<'a, C>
31040 where
31041 I: IntoIterator<Item = St>,
31042 St: AsRef<str>,
31043 {
31044 self._scopes
31045 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31046 self
31047 }
31048
31049 /// Removes all scopes, and no default scope will be used either.
31050 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31051 /// for details).
31052 pub fn clear_scopes(mut self) -> OfferclasUpdateCall<'a, C> {
31053 self._scopes.clear();
31054 self
31055 }
31056}
31057
31058/// Adds a message to the offer object referenced by the given object ID.
31059///
31060/// A builder for the *addmessage* method supported by a *offerobject* resource.
31061/// It is not used directly, but through a [`OfferobjectMethods`] instance.
31062///
31063/// # Example
31064///
31065/// Instantiate a resource method builder
31066///
31067/// ```test_harness,no_run
31068/// # extern crate hyper;
31069/// # extern crate hyper_rustls;
31070/// # extern crate google_walletobjects1 as walletobjects1;
31071/// use walletobjects1::api::AddMessageRequest;
31072/// # async fn dox() {
31073/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31074///
31075/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31076/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31077/// # secret,
31078/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31079/// # ).build().await.unwrap();
31080///
31081/// # let client = hyper_util::client::legacy::Client::builder(
31082/// # hyper_util::rt::TokioExecutor::new()
31083/// # )
31084/// # .build(
31085/// # hyper_rustls::HttpsConnectorBuilder::new()
31086/// # .with_native_roots()
31087/// # .unwrap()
31088/// # .https_or_http()
31089/// # .enable_http1()
31090/// # .build()
31091/// # );
31092/// # let mut hub = Walletobjects::new(client, auth);
31093/// // As the method needs a request, you would usually fill it with the desired information
31094/// // into the respective structure. Some of the parts shown here might not be applicable !
31095/// // Values shown here are possibly random and not representative !
31096/// let mut req = AddMessageRequest::default();
31097///
31098/// // You can configure optional parameters by calling the respective setters at will, and
31099/// // execute the final call using `doit()`.
31100/// // Values shown here are possibly random and not representative !
31101/// let result = hub.offerobject().addmessage(req, "resourceId")
31102/// .doit().await;
31103/// # }
31104/// ```
31105pub struct OfferobjectAddmessageCall<'a, C>
31106where
31107 C: 'a,
31108{
31109 hub: &'a Walletobjects<C>,
31110 _request: AddMessageRequest,
31111 _resource_id: String,
31112 _delegate: Option<&'a mut dyn common::Delegate>,
31113 _additional_params: HashMap<String, String>,
31114 _scopes: BTreeSet<String>,
31115}
31116
31117impl<'a, C> common::CallBuilder for OfferobjectAddmessageCall<'a, C> {}
31118
31119impl<'a, C> OfferobjectAddmessageCall<'a, C>
31120where
31121 C: common::Connector,
31122{
31123 /// Perform the operation you have build so far.
31124 pub async fn doit(
31125 mut self,
31126 ) -> common::Result<(common::Response, OfferObjectAddMessageResponse)> {
31127 use std::borrow::Cow;
31128 use std::io::{Read, Seek};
31129
31130 use common::{url::Params, ToParts};
31131 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31132
31133 let mut dd = common::DefaultDelegate;
31134 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31135 dlg.begin(common::MethodInfo {
31136 id: "walletobjects.offerobject.addmessage",
31137 http_method: hyper::Method::POST,
31138 });
31139
31140 for &field in ["alt", "resourceId"].iter() {
31141 if self._additional_params.contains_key(field) {
31142 dlg.finished(false);
31143 return Err(common::Error::FieldClash(field));
31144 }
31145 }
31146
31147 let mut params = Params::with_capacity(4 + self._additional_params.len());
31148 params.push("resourceId", self._resource_id);
31149
31150 params.extend(self._additional_params.iter());
31151
31152 params.push("alt", "json");
31153 let mut url =
31154 self.hub._base_url.clone() + "walletobjects/v1/offerObject/{resourceId}/addMessage";
31155 if self._scopes.is_empty() {
31156 self._scopes
31157 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
31158 }
31159
31160 #[allow(clippy::single_element_loop)]
31161 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
31162 url = params.uri_replacement(url, param_name, find_this, false);
31163 }
31164 {
31165 let to_remove = ["resourceId"];
31166 params.remove_params(&to_remove);
31167 }
31168
31169 let url = params.parse_with_url(&url);
31170
31171 let mut json_mime_type = mime::APPLICATION_JSON;
31172 let mut request_value_reader = {
31173 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31174 common::remove_json_null_values(&mut value);
31175 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31176 serde_json::to_writer(&mut dst, &value).unwrap();
31177 dst
31178 };
31179 let request_size = request_value_reader
31180 .seek(std::io::SeekFrom::End(0))
31181 .unwrap();
31182 request_value_reader
31183 .seek(std::io::SeekFrom::Start(0))
31184 .unwrap();
31185
31186 loop {
31187 let token = match self
31188 .hub
31189 .auth
31190 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31191 .await
31192 {
31193 Ok(token) => token,
31194 Err(e) => match dlg.token(e) {
31195 Ok(token) => token,
31196 Err(e) => {
31197 dlg.finished(false);
31198 return Err(common::Error::MissingToken(e));
31199 }
31200 },
31201 };
31202 request_value_reader
31203 .seek(std::io::SeekFrom::Start(0))
31204 .unwrap();
31205 let mut req_result = {
31206 let client = &self.hub.client;
31207 dlg.pre_request();
31208 let mut req_builder = hyper::Request::builder()
31209 .method(hyper::Method::POST)
31210 .uri(url.as_str())
31211 .header(USER_AGENT, self.hub._user_agent.clone());
31212
31213 if let Some(token) = token.as_ref() {
31214 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31215 }
31216
31217 let request = req_builder
31218 .header(CONTENT_TYPE, json_mime_type.to_string())
31219 .header(CONTENT_LENGTH, request_size as u64)
31220 .body(common::to_body(
31221 request_value_reader.get_ref().clone().into(),
31222 ));
31223
31224 client.request(request.unwrap()).await
31225 };
31226
31227 match req_result {
31228 Err(err) => {
31229 if let common::Retry::After(d) = dlg.http_error(&err) {
31230 sleep(d).await;
31231 continue;
31232 }
31233 dlg.finished(false);
31234 return Err(common::Error::HttpError(err));
31235 }
31236 Ok(res) => {
31237 let (mut parts, body) = res.into_parts();
31238 let mut body = common::Body::new(body);
31239 if !parts.status.is_success() {
31240 let bytes = common::to_bytes(body).await.unwrap_or_default();
31241 let error = serde_json::from_str(&common::to_string(&bytes));
31242 let response = common::to_response(parts, bytes.into());
31243
31244 if let common::Retry::After(d) =
31245 dlg.http_failure(&response, error.as_ref().ok())
31246 {
31247 sleep(d).await;
31248 continue;
31249 }
31250
31251 dlg.finished(false);
31252
31253 return Err(match error {
31254 Ok(value) => common::Error::BadRequest(value),
31255 _ => common::Error::Failure(response),
31256 });
31257 }
31258 let response = {
31259 let bytes = common::to_bytes(body).await.unwrap_or_default();
31260 let encoded = common::to_string(&bytes);
31261 match serde_json::from_str(&encoded) {
31262 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31263 Err(error) => {
31264 dlg.response_json_decode_error(&encoded, &error);
31265 return Err(common::Error::JsonDecodeError(
31266 encoded.to_string(),
31267 error,
31268 ));
31269 }
31270 }
31271 };
31272
31273 dlg.finished(true);
31274 return Ok(response);
31275 }
31276 }
31277 }
31278 }
31279
31280 ///
31281 /// Sets the *request* property to the given value.
31282 ///
31283 /// Even though the property as already been set when instantiating this call,
31284 /// we provide this method for API completeness.
31285 pub fn request(mut self, new_value: AddMessageRequest) -> OfferobjectAddmessageCall<'a, C> {
31286 self._request = new_value;
31287 self
31288 }
31289 /// 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 '-'.
31290 ///
31291 /// Sets the *resource id* path property to the given value.
31292 ///
31293 /// Even though the property as already been set when instantiating this call,
31294 /// we provide this method for API completeness.
31295 pub fn resource_id(mut self, new_value: &str) -> OfferobjectAddmessageCall<'a, C> {
31296 self._resource_id = new_value.to_string();
31297 self
31298 }
31299 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31300 /// while executing the actual API request.
31301 ///
31302 /// ````text
31303 /// It should be used to handle progress information, and to implement a certain level of resilience.
31304 /// ````
31305 ///
31306 /// Sets the *delegate* property to the given value.
31307 pub fn delegate(
31308 mut self,
31309 new_value: &'a mut dyn common::Delegate,
31310 ) -> OfferobjectAddmessageCall<'a, C> {
31311 self._delegate = Some(new_value);
31312 self
31313 }
31314
31315 /// Set any additional parameter of the query string used in the request.
31316 /// It should be used to set parameters which are not yet available through their own
31317 /// setters.
31318 ///
31319 /// Please note that this method must not be used to set any of the known parameters
31320 /// which have their own setter method. If done anyway, the request will fail.
31321 ///
31322 /// # Additional Parameters
31323 ///
31324 /// * *$.xgafv* (query-string) - V1 error format.
31325 /// * *access_token* (query-string) - OAuth access token.
31326 /// * *alt* (query-string) - Data format for response.
31327 /// * *callback* (query-string) - JSONP
31328 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31329 /// * *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.
31330 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31331 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31332 /// * *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.
31333 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31334 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31335 pub fn param<T>(mut self, name: T, value: T) -> OfferobjectAddmessageCall<'a, C>
31336 where
31337 T: AsRef<str>,
31338 {
31339 self._additional_params
31340 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31341 self
31342 }
31343
31344 /// Identifies the authorization scope for the method you are building.
31345 ///
31346 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31347 /// [`Scope::WalletObjectIssuer`].
31348 ///
31349 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31350 /// tokens for more than one scope.
31351 ///
31352 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31353 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31354 /// sufficient, a read-write scope will do as well.
31355 pub fn add_scope<St>(mut self, scope: St) -> OfferobjectAddmessageCall<'a, C>
31356 where
31357 St: AsRef<str>,
31358 {
31359 self._scopes.insert(String::from(scope.as_ref()));
31360 self
31361 }
31362 /// Identifies the authorization scope(s) for the method you are building.
31363 ///
31364 /// See [`Self::add_scope()`] for details.
31365 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectAddmessageCall<'a, C>
31366 where
31367 I: IntoIterator<Item = St>,
31368 St: AsRef<str>,
31369 {
31370 self._scopes
31371 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31372 self
31373 }
31374
31375 /// Removes all scopes, and no default scope will be used either.
31376 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31377 /// for details).
31378 pub fn clear_scopes(mut self) -> OfferobjectAddmessageCall<'a, C> {
31379 self._scopes.clear();
31380 self
31381 }
31382}
31383
31384/// Returns the offer object with the given object ID.
31385///
31386/// A builder for the *get* method supported by a *offerobject* resource.
31387/// It is not used directly, but through a [`OfferobjectMethods`] instance.
31388///
31389/// # Example
31390///
31391/// Instantiate a resource method builder
31392///
31393/// ```test_harness,no_run
31394/// # extern crate hyper;
31395/// # extern crate hyper_rustls;
31396/// # extern crate google_walletobjects1 as walletobjects1;
31397/// # async fn dox() {
31398/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31399///
31400/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31401/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31402/// # secret,
31403/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31404/// # ).build().await.unwrap();
31405///
31406/// # let client = hyper_util::client::legacy::Client::builder(
31407/// # hyper_util::rt::TokioExecutor::new()
31408/// # )
31409/// # .build(
31410/// # hyper_rustls::HttpsConnectorBuilder::new()
31411/// # .with_native_roots()
31412/// # .unwrap()
31413/// # .https_or_http()
31414/// # .enable_http1()
31415/// # .build()
31416/// # );
31417/// # let mut hub = Walletobjects::new(client, auth);
31418/// // You can configure optional parameters by calling the respective setters at will, and
31419/// // execute the final call using `doit()`.
31420/// // Values shown here are possibly random and not representative !
31421/// let result = hub.offerobject().get("resourceId")
31422/// .doit().await;
31423/// # }
31424/// ```
31425pub struct OfferobjectGetCall<'a, C>
31426where
31427 C: 'a,
31428{
31429 hub: &'a Walletobjects<C>,
31430 _resource_id: String,
31431 _delegate: Option<&'a mut dyn common::Delegate>,
31432 _additional_params: HashMap<String, String>,
31433 _scopes: BTreeSet<String>,
31434}
31435
31436impl<'a, C> common::CallBuilder for OfferobjectGetCall<'a, C> {}
31437
31438impl<'a, C> OfferobjectGetCall<'a, C>
31439where
31440 C: common::Connector,
31441{
31442 /// Perform the operation you have build so far.
31443 pub async fn doit(mut self) -> common::Result<(common::Response, OfferObject)> {
31444 use std::borrow::Cow;
31445 use std::io::{Read, Seek};
31446
31447 use common::{url::Params, ToParts};
31448 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31449
31450 let mut dd = common::DefaultDelegate;
31451 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31452 dlg.begin(common::MethodInfo {
31453 id: "walletobjects.offerobject.get",
31454 http_method: hyper::Method::GET,
31455 });
31456
31457 for &field in ["alt", "resourceId"].iter() {
31458 if self._additional_params.contains_key(field) {
31459 dlg.finished(false);
31460 return Err(common::Error::FieldClash(field));
31461 }
31462 }
31463
31464 let mut params = Params::with_capacity(3 + self._additional_params.len());
31465 params.push("resourceId", self._resource_id);
31466
31467 params.extend(self._additional_params.iter());
31468
31469 params.push("alt", "json");
31470 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject/{resourceId}";
31471 if self._scopes.is_empty() {
31472 self._scopes
31473 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
31474 }
31475
31476 #[allow(clippy::single_element_loop)]
31477 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
31478 url = params.uri_replacement(url, param_name, find_this, false);
31479 }
31480 {
31481 let to_remove = ["resourceId"];
31482 params.remove_params(&to_remove);
31483 }
31484
31485 let url = params.parse_with_url(&url);
31486
31487 loop {
31488 let token = match self
31489 .hub
31490 .auth
31491 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31492 .await
31493 {
31494 Ok(token) => token,
31495 Err(e) => match dlg.token(e) {
31496 Ok(token) => token,
31497 Err(e) => {
31498 dlg.finished(false);
31499 return Err(common::Error::MissingToken(e));
31500 }
31501 },
31502 };
31503 let mut req_result = {
31504 let client = &self.hub.client;
31505 dlg.pre_request();
31506 let mut req_builder = hyper::Request::builder()
31507 .method(hyper::Method::GET)
31508 .uri(url.as_str())
31509 .header(USER_AGENT, self.hub._user_agent.clone());
31510
31511 if let Some(token) = token.as_ref() {
31512 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31513 }
31514
31515 let request = req_builder
31516 .header(CONTENT_LENGTH, 0_u64)
31517 .body(common::to_body::<String>(None));
31518
31519 client.request(request.unwrap()).await
31520 };
31521
31522 match req_result {
31523 Err(err) => {
31524 if let common::Retry::After(d) = dlg.http_error(&err) {
31525 sleep(d).await;
31526 continue;
31527 }
31528 dlg.finished(false);
31529 return Err(common::Error::HttpError(err));
31530 }
31531 Ok(res) => {
31532 let (mut parts, body) = res.into_parts();
31533 let mut body = common::Body::new(body);
31534 if !parts.status.is_success() {
31535 let bytes = common::to_bytes(body).await.unwrap_or_default();
31536 let error = serde_json::from_str(&common::to_string(&bytes));
31537 let response = common::to_response(parts, bytes.into());
31538
31539 if let common::Retry::After(d) =
31540 dlg.http_failure(&response, error.as_ref().ok())
31541 {
31542 sleep(d).await;
31543 continue;
31544 }
31545
31546 dlg.finished(false);
31547
31548 return Err(match error {
31549 Ok(value) => common::Error::BadRequest(value),
31550 _ => common::Error::Failure(response),
31551 });
31552 }
31553 let response = {
31554 let bytes = common::to_bytes(body).await.unwrap_or_default();
31555 let encoded = common::to_string(&bytes);
31556 match serde_json::from_str(&encoded) {
31557 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31558 Err(error) => {
31559 dlg.response_json_decode_error(&encoded, &error);
31560 return Err(common::Error::JsonDecodeError(
31561 encoded.to_string(),
31562 error,
31563 ));
31564 }
31565 }
31566 };
31567
31568 dlg.finished(true);
31569 return Ok(response);
31570 }
31571 }
31572 }
31573 }
31574
31575 /// 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 '-'.
31576 ///
31577 /// Sets the *resource id* path property to the given value.
31578 ///
31579 /// Even though the property as already been set when instantiating this call,
31580 /// we provide this method for API completeness.
31581 pub fn resource_id(mut self, new_value: &str) -> OfferobjectGetCall<'a, C> {
31582 self._resource_id = new_value.to_string();
31583 self
31584 }
31585 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31586 /// while executing the actual API request.
31587 ///
31588 /// ````text
31589 /// It should be used to handle progress information, and to implement a certain level of resilience.
31590 /// ````
31591 ///
31592 /// Sets the *delegate* property to the given value.
31593 pub fn delegate(
31594 mut self,
31595 new_value: &'a mut dyn common::Delegate,
31596 ) -> OfferobjectGetCall<'a, C> {
31597 self._delegate = Some(new_value);
31598 self
31599 }
31600
31601 /// Set any additional parameter of the query string used in the request.
31602 /// It should be used to set parameters which are not yet available through their own
31603 /// setters.
31604 ///
31605 /// Please note that this method must not be used to set any of the known parameters
31606 /// which have their own setter method. If done anyway, the request will fail.
31607 ///
31608 /// # Additional Parameters
31609 ///
31610 /// * *$.xgafv* (query-string) - V1 error format.
31611 /// * *access_token* (query-string) - OAuth access token.
31612 /// * *alt* (query-string) - Data format for response.
31613 /// * *callback* (query-string) - JSONP
31614 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31615 /// * *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.
31616 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31617 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31618 /// * *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.
31619 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31620 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31621 pub fn param<T>(mut self, name: T, value: T) -> OfferobjectGetCall<'a, C>
31622 where
31623 T: AsRef<str>,
31624 {
31625 self._additional_params
31626 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31627 self
31628 }
31629
31630 /// Identifies the authorization scope for the method you are building.
31631 ///
31632 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31633 /// [`Scope::WalletObjectIssuer`].
31634 ///
31635 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31636 /// tokens for more than one scope.
31637 ///
31638 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31639 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31640 /// sufficient, a read-write scope will do as well.
31641 pub fn add_scope<St>(mut self, scope: St) -> OfferobjectGetCall<'a, C>
31642 where
31643 St: AsRef<str>,
31644 {
31645 self._scopes.insert(String::from(scope.as_ref()));
31646 self
31647 }
31648 /// Identifies the authorization scope(s) for the method you are building.
31649 ///
31650 /// See [`Self::add_scope()`] for details.
31651 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectGetCall<'a, C>
31652 where
31653 I: IntoIterator<Item = St>,
31654 St: AsRef<str>,
31655 {
31656 self._scopes
31657 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31658 self
31659 }
31660
31661 /// Removes all scopes, and no default scope will be used either.
31662 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31663 /// for details).
31664 pub fn clear_scopes(mut self) -> OfferobjectGetCall<'a, C> {
31665 self._scopes.clear();
31666 self
31667 }
31668}
31669
31670/// Inserts an offer object with the given ID and properties.
31671///
31672/// A builder for the *insert* method supported by a *offerobject* resource.
31673/// It is not used directly, but through a [`OfferobjectMethods`] instance.
31674///
31675/// # Example
31676///
31677/// Instantiate a resource method builder
31678///
31679/// ```test_harness,no_run
31680/// # extern crate hyper;
31681/// # extern crate hyper_rustls;
31682/// # extern crate google_walletobjects1 as walletobjects1;
31683/// use walletobjects1::api::OfferObject;
31684/// # async fn dox() {
31685/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31686///
31687/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31688/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31689/// # secret,
31690/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31691/// # ).build().await.unwrap();
31692///
31693/// # let client = hyper_util::client::legacy::Client::builder(
31694/// # hyper_util::rt::TokioExecutor::new()
31695/// # )
31696/// # .build(
31697/// # hyper_rustls::HttpsConnectorBuilder::new()
31698/// # .with_native_roots()
31699/// # .unwrap()
31700/// # .https_or_http()
31701/// # .enable_http1()
31702/// # .build()
31703/// # );
31704/// # let mut hub = Walletobjects::new(client, auth);
31705/// // As the method needs a request, you would usually fill it with the desired information
31706/// // into the respective structure. Some of the parts shown here might not be applicable !
31707/// // Values shown here are possibly random and not representative !
31708/// let mut req = OfferObject::default();
31709///
31710/// // You can configure optional parameters by calling the respective setters at will, and
31711/// // execute the final call using `doit()`.
31712/// // Values shown here are possibly random and not representative !
31713/// let result = hub.offerobject().insert(req)
31714/// .doit().await;
31715/// # }
31716/// ```
31717pub struct OfferobjectInsertCall<'a, C>
31718where
31719 C: 'a,
31720{
31721 hub: &'a Walletobjects<C>,
31722 _request: OfferObject,
31723 _delegate: Option<&'a mut dyn common::Delegate>,
31724 _additional_params: HashMap<String, String>,
31725 _scopes: BTreeSet<String>,
31726}
31727
31728impl<'a, C> common::CallBuilder for OfferobjectInsertCall<'a, C> {}
31729
31730impl<'a, C> OfferobjectInsertCall<'a, C>
31731where
31732 C: common::Connector,
31733{
31734 /// Perform the operation you have build so far.
31735 pub async fn doit(mut self) -> common::Result<(common::Response, OfferObject)> {
31736 use std::borrow::Cow;
31737 use std::io::{Read, Seek};
31738
31739 use common::{url::Params, ToParts};
31740 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31741
31742 let mut dd = common::DefaultDelegate;
31743 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31744 dlg.begin(common::MethodInfo {
31745 id: "walletobjects.offerobject.insert",
31746 http_method: hyper::Method::POST,
31747 });
31748
31749 for &field in ["alt"].iter() {
31750 if self._additional_params.contains_key(field) {
31751 dlg.finished(false);
31752 return Err(common::Error::FieldClash(field));
31753 }
31754 }
31755
31756 let mut params = Params::with_capacity(3 + self._additional_params.len());
31757
31758 params.extend(self._additional_params.iter());
31759
31760 params.push("alt", "json");
31761 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject";
31762 if self._scopes.is_empty() {
31763 self._scopes
31764 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
31765 }
31766
31767 let url = params.parse_with_url(&url);
31768
31769 let mut json_mime_type = mime::APPLICATION_JSON;
31770 let mut request_value_reader = {
31771 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31772 common::remove_json_null_values(&mut value);
31773 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31774 serde_json::to_writer(&mut dst, &value).unwrap();
31775 dst
31776 };
31777 let request_size = request_value_reader
31778 .seek(std::io::SeekFrom::End(0))
31779 .unwrap();
31780 request_value_reader
31781 .seek(std::io::SeekFrom::Start(0))
31782 .unwrap();
31783
31784 loop {
31785 let token = match self
31786 .hub
31787 .auth
31788 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31789 .await
31790 {
31791 Ok(token) => token,
31792 Err(e) => match dlg.token(e) {
31793 Ok(token) => token,
31794 Err(e) => {
31795 dlg.finished(false);
31796 return Err(common::Error::MissingToken(e));
31797 }
31798 },
31799 };
31800 request_value_reader
31801 .seek(std::io::SeekFrom::Start(0))
31802 .unwrap();
31803 let mut req_result = {
31804 let client = &self.hub.client;
31805 dlg.pre_request();
31806 let mut req_builder = hyper::Request::builder()
31807 .method(hyper::Method::POST)
31808 .uri(url.as_str())
31809 .header(USER_AGENT, self.hub._user_agent.clone());
31810
31811 if let Some(token) = token.as_ref() {
31812 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31813 }
31814
31815 let request = req_builder
31816 .header(CONTENT_TYPE, json_mime_type.to_string())
31817 .header(CONTENT_LENGTH, request_size as u64)
31818 .body(common::to_body(
31819 request_value_reader.get_ref().clone().into(),
31820 ));
31821
31822 client.request(request.unwrap()).await
31823 };
31824
31825 match req_result {
31826 Err(err) => {
31827 if let common::Retry::After(d) = dlg.http_error(&err) {
31828 sleep(d).await;
31829 continue;
31830 }
31831 dlg.finished(false);
31832 return Err(common::Error::HttpError(err));
31833 }
31834 Ok(res) => {
31835 let (mut parts, body) = res.into_parts();
31836 let mut body = common::Body::new(body);
31837 if !parts.status.is_success() {
31838 let bytes = common::to_bytes(body).await.unwrap_or_default();
31839 let error = serde_json::from_str(&common::to_string(&bytes));
31840 let response = common::to_response(parts, bytes.into());
31841
31842 if let common::Retry::After(d) =
31843 dlg.http_failure(&response, error.as_ref().ok())
31844 {
31845 sleep(d).await;
31846 continue;
31847 }
31848
31849 dlg.finished(false);
31850
31851 return Err(match error {
31852 Ok(value) => common::Error::BadRequest(value),
31853 _ => common::Error::Failure(response),
31854 });
31855 }
31856 let response = {
31857 let bytes = common::to_bytes(body).await.unwrap_or_default();
31858 let encoded = common::to_string(&bytes);
31859 match serde_json::from_str(&encoded) {
31860 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31861 Err(error) => {
31862 dlg.response_json_decode_error(&encoded, &error);
31863 return Err(common::Error::JsonDecodeError(
31864 encoded.to_string(),
31865 error,
31866 ));
31867 }
31868 }
31869 };
31870
31871 dlg.finished(true);
31872 return Ok(response);
31873 }
31874 }
31875 }
31876 }
31877
31878 ///
31879 /// Sets the *request* property to the given value.
31880 ///
31881 /// Even though the property as already been set when instantiating this call,
31882 /// we provide this method for API completeness.
31883 pub fn request(mut self, new_value: OfferObject) -> OfferobjectInsertCall<'a, C> {
31884 self._request = new_value;
31885 self
31886 }
31887 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31888 /// while executing the actual API request.
31889 ///
31890 /// ````text
31891 /// It should be used to handle progress information, and to implement a certain level of resilience.
31892 /// ````
31893 ///
31894 /// Sets the *delegate* property to the given value.
31895 pub fn delegate(
31896 mut self,
31897 new_value: &'a mut dyn common::Delegate,
31898 ) -> OfferobjectInsertCall<'a, C> {
31899 self._delegate = Some(new_value);
31900 self
31901 }
31902
31903 /// Set any additional parameter of the query string used in the request.
31904 /// It should be used to set parameters which are not yet available through their own
31905 /// setters.
31906 ///
31907 /// Please note that this method must not be used to set any of the known parameters
31908 /// which have their own setter method. If done anyway, the request will fail.
31909 ///
31910 /// # Additional Parameters
31911 ///
31912 /// * *$.xgafv* (query-string) - V1 error format.
31913 /// * *access_token* (query-string) - OAuth access token.
31914 /// * *alt* (query-string) - Data format for response.
31915 /// * *callback* (query-string) - JSONP
31916 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31917 /// * *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.
31918 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31919 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31920 /// * *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.
31921 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31922 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31923 pub fn param<T>(mut self, name: T, value: T) -> OfferobjectInsertCall<'a, C>
31924 where
31925 T: AsRef<str>,
31926 {
31927 self._additional_params
31928 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31929 self
31930 }
31931
31932 /// Identifies the authorization scope for the method you are building.
31933 ///
31934 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31935 /// [`Scope::WalletObjectIssuer`].
31936 ///
31937 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31938 /// tokens for more than one scope.
31939 ///
31940 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31941 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31942 /// sufficient, a read-write scope will do as well.
31943 pub fn add_scope<St>(mut self, scope: St) -> OfferobjectInsertCall<'a, C>
31944 where
31945 St: AsRef<str>,
31946 {
31947 self._scopes.insert(String::from(scope.as_ref()));
31948 self
31949 }
31950 /// Identifies the authorization scope(s) for the method you are building.
31951 ///
31952 /// See [`Self::add_scope()`] for details.
31953 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectInsertCall<'a, C>
31954 where
31955 I: IntoIterator<Item = St>,
31956 St: AsRef<str>,
31957 {
31958 self._scopes
31959 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31960 self
31961 }
31962
31963 /// Removes all scopes, and no default scope will be used either.
31964 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31965 /// for details).
31966 pub fn clear_scopes(mut self) -> OfferobjectInsertCall<'a, C> {
31967 self._scopes.clear();
31968 self
31969 }
31970}
31971
31972/// Returns a list of all offer objects for a given issuer ID.
31973///
31974/// A builder for the *list* method supported by a *offerobject* resource.
31975/// It is not used directly, but through a [`OfferobjectMethods`] instance.
31976///
31977/// # Example
31978///
31979/// Instantiate a resource method builder
31980///
31981/// ```test_harness,no_run
31982/// # extern crate hyper;
31983/// # extern crate hyper_rustls;
31984/// # extern crate google_walletobjects1 as walletobjects1;
31985/// # async fn dox() {
31986/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31987///
31988/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31989/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31990/// # secret,
31991/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31992/// # ).build().await.unwrap();
31993///
31994/// # let client = hyper_util::client::legacy::Client::builder(
31995/// # hyper_util::rt::TokioExecutor::new()
31996/// # )
31997/// # .build(
31998/// # hyper_rustls::HttpsConnectorBuilder::new()
31999/// # .with_native_roots()
32000/// # .unwrap()
32001/// # .https_or_http()
32002/// # .enable_http1()
32003/// # .build()
32004/// # );
32005/// # let mut hub = Walletobjects::new(client, auth);
32006/// // You can configure optional parameters by calling the respective setters at will, and
32007/// // execute the final call using `doit()`.
32008/// // Values shown here are possibly random and not representative !
32009/// let result = hub.offerobject().list()
32010/// .token("voluptua.")
32011/// .max_results(-34)
32012/// .class_id("dolore")
32013/// .doit().await;
32014/// # }
32015/// ```
32016pub struct OfferobjectListCall<'a, C>
32017where
32018 C: 'a,
32019{
32020 hub: &'a Walletobjects<C>,
32021 _token: Option<String>,
32022 _max_results: Option<i32>,
32023 _class_id: Option<String>,
32024 _delegate: Option<&'a mut dyn common::Delegate>,
32025 _additional_params: HashMap<String, String>,
32026 _scopes: BTreeSet<String>,
32027}
32028
32029impl<'a, C> common::CallBuilder for OfferobjectListCall<'a, C> {}
32030
32031impl<'a, C> OfferobjectListCall<'a, C>
32032where
32033 C: common::Connector,
32034{
32035 /// Perform the operation you have build so far.
32036 pub async fn doit(mut self) -> common::Result<(common::Response, OfferObjectListResponse)> {
32037 use std::borrow::Cow;
32038 use std::io::{Read, Seek};
32039
32040 use common::{url::Params, ToParts};
32041 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32042
32043 let mut dd = common::DefaultDelegate;
32044 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32045 dlg.begin(common::MethodInfo {
32046 id: "walletobjects.offerobject.list",
32047 http_method: hyper::Method::GET,
32048 });
32049
32050 for &field in ["alt", "token", "maxResults", "classId"].iter() {
32051 if self._additional_params.contains_key(field) {
32052 dlg.finished(false);
32053 return Err(common::Error::FieldClash(field));
32054 }
32055 }
32056
32057 let mut params = Params::with_capacity(5 + self._additional_params.len());
32058 if let Some(value) = self._token.as_ref() {
32059 params.push("token", value);
32060 }
32061 if let Some(value) = self._max_results.as_ref() {
32062 params.push("maxResults", value.to_string());
32063 }
32064 if let Some(value) = self._class_id.as_ref() {
32065 params.push("classId", value);
32066 }
32067
32068 params.extend(self._additional_params.iter());
32069
32070 params.push("alt", "json");
32071 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject";
32072 if self._scopes.is_empty() {
32073 self._scopes
32074 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
32075 }
32076
32077 let url = params.parse_with_url(&url);
32078
32079 loop {
32080 let token = match self
32081 .hub
32082 .auth
32083 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32084 .await
32085 {
32086 Ok(token) => token,
32087 Err(e) => match dlg.token(e) {
32088 Ok(token) => token,
32089 Err(e) => {
32090 dlg.finished(false);
32091 return Err(common::Error::MissingToken(e));
32092 }
32093 },
32094 };
32095 let mut req_result = {
32096 let client = &self.hub.client;
32097 dlg.pre_request();
32098 let mut req_builder = hyper::Request::builder()
32099 .method(hyper::Method::GET)
32100 .uri(url.as_str())
32101 .header(USER_AGENT, self.hub._user_agent.clone());
32102
32103 if let Some(token) = token.as_ref() {
32104 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32105 }
32106
32107 let request = req_builder
32108 .header(CONTENT_LENGTH, 0_u64)
32109 .body(common::to_body::<String>(None));
32110
32111 client.request(request.unwrap()).await
32112 };
32113
32114 match req_result {
32115 Err(err) => {
32116 if let common::Retry::After(d) = dlg.http_error(&err) {
32117 sleep(d).await;
32118 continue;
32119 }
32120 dlg.finished(false);
32121 return Err(common::Error::HttpError(err));
32122 }
32123 Ok(res) => {
32124 let (mut parts, body) = res.into_parts();
32125 let mut body = common::Body::new(body);
32126 if !parts.status.is_success() {
32127 let bytes = common::to_bytes(body).await.unwrap_or_default();
32128 let error = serde_json::from_str(&common::to_string(&bytes));
32129 let response = common::to_response(parts, bytes.into());
32130
32131 if let common::Retry::After(d) =
32132 dlg.http_failure(&response, error.as_ref().ok())
32133 {
32134 sleep(d).await;
32135 continue;
32136 }
32137
32138 dlg.finished(false);
32139
32140 return Err(match error {
32141 Ok(value) => common::Error::BadRequest(value),
32142 _ => common::Error::Failure(response),
32143 });
32144 }
32145 let response = {
32146 let bytes = common::to_bytes(body).await.unwrap_or_default();
32147 let encoded = common::to_string(&bytes);
32148 match serde_json::from_str(&encoded) {
32149 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32150 Err(error) => {
32151 dlg.response_json_decode_error(&encoded, &error);
32152 return Err(common::Error::JsonDecodeError(
32153 encoded.to_string(),
32154 error,
32155 ));
32156 }
32157 }
32158 };
32159
32160 dlg.finished(true);
32161 return Ok(response);
32162 }
32163 }
32164 }
32165 }
32166
32167 /// 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.
32168 ///
32169 /// Sets the *token* query property to the given value.
32170 pub fn token(mut self, new_value: &str) -> OfferobjectListCall<'a, C> {
32171 self._token = Some(new_value.to_string());
32172 self
32173 }
32174 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
32175 ///
32176 /// Sets the *max results* query property to the given value.
32177 pub fn max_results(mut self, new_value: i32) -> OfferobjectListCall<'a, C> {
32178 self._max_results = Some(new_value);
32179 self
32180 }
32181 /// The ID of the class whose objects will be listed.
32182 ///
32183 /// Sets the *class id* query property to the given value.
32184 pub fn class_id(mut self, new_value: &str) -> OfferobjectListCall<'a, C> {
32185 self._class_id = Some(new_value.to_string());
32186 self
32187 }
32188 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32189 /// while executing the actual API request.
32190 ///
32191 /// ````text
32192 /// It should be used to handle progress information, and to implement a certain level of resilience.
32193 /// ````
32194 ///
32195 /// Sets the *delegate* property to the given value.
32196 pub fn delegate(
32197 mut self,
32198 new_value: &'a mut dyn common::Delegate,
32199 ) -> OfferobjectListCall<'a, C> {
32200 self._delegate = Some(new_value);
32201 self
32202 }
32203
32204 /// Set any additional parameter of the query string used in the request.
32205 /// It should be used to set parameters which are not yet available through their own
32206 /// setters.
32207 ///
32208 /// Please note that this method must not be used to set any of the known parameters
32209 /// which have their own setter method. If done anyway, the request will fail.
32210 ///
32211 /// # Additional Parameters
32212 ///
32213 /// * *$.xgafv* (query-string) - V1 error format.
32214 /// * *access_token* (query-string) - OAuth access token.
32215 /// * *alt* (query-string) - Data format for response.
32216 /// * *callback* (query-string) - JSONP
32217 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32218 /// * *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.
32219 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32220 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32221 /// * *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.
32222 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32223 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32224 pub fn param<T>(mut self, name: T, value: T) -> OfferobjectListCall<'a, C>
32225 where
32226 T: AsRef<str>,
32227 {
32228 self._additional_params
32229 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32230 self
32231 }
32232
32233 /// Identifies the authorization scope for the method you are building.
32234 ///
32235 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32236 /// [`Scope::WalletObjectIssuer`].
32237 ///
32238 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32239 /// tokens for more than one scope.
32240 ///
32241 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32242 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32243 /// sufficient, a read-write scope will do as well.
32244 pub fn add_scope<St>(mut self, scope: St) -> OfferobjectListCall<'a, C>
32245 where
32246 St: AsRef<str>,
32247 {
32248 self._scopes.insert(String::from(scope.as_ref()));
32249 self
32250 }
32251 /// Identifies the authorization scope(s) for the method you are building.
32252 ///
32253 /// See [`Self::add_scope()`] for details.
32254 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectListCall<'a, C>
32255 where
32256 I: IntoIterator<Item = St>,
32257 St: AsRef<str>,
32258 {
32259 self._scopes
32260 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32261 self
32262 }
32263
32264 /// Removes all scopes, and no default scope will be used either.
32265 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32266 /// for details).
32267 pub fn clear_scopes(mut self) -> OfferobjectListCall<'a, C> {
32268 self._scopes.clear();
32269 self
32270 }
32271}
32272
32273/// Updates the offer object referenced by the given object ID. This method supports patch semantics.
32274///
32275/// A builder for the *patch* method supported by a *offerobject* resource.
32276/// It is not used directly, but through a [`OfferobjectMethods`] instance.
32277///
32278/// # Example
32279///
32280/// Instantiate a resource method builder
32281///
32282/// ```test_harness,no_run
32283/// # extern crate hyper;
32284/// # extern crate hyper_rustls;
32285/// # extern crate google_walletobjects1 as walletobjects1;
32286/// use walletobjects1::api::OfferObject;
32287/// # async fn dox() {
32288/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32289///
32290/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32291/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32292/// # secret,
32293/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32294/// # ).build().await.unwrap();
32295///
32296/// # let client = hyper_util::client::legacy::Client::builder(
32297/// # hyper_util::rt::TokioExecutor::new()
32298/// # )
32299/// # .build(
32300/// # hyper_rustls::HttpsConnectorBuilder::new()
32301/// # .with_native_roots()
32302/// # .unwrap()
32303/// # .https_or_http()
32304/// # .enable_http1()
32305/// # .build()
32306/// # );
32307/// # let mut hub = Walletobjects::new(client, auth);
32308/// // As the method needs a request, you would usually fill it with the desired information
32309/// // into the respective structure. Some of the parts shown here might not be applicable !
32310/// // Values shown here are possibly random and not representative !
32311/// let mut req = OfferObject::default();
32312///
32313/// // You can configure optional parameters by calling the respective setters at will, and
32314/// // execute the final call using `doit()`.
32315/// // Values shown here are possibly random and not representative !
32316/// let result = hub.offerobject().patch(req, "resourceId")
32317/// .doit().await;
32318/// # }
32319/// ```
32320pub struct OfferobjectPatchCall<'a, C>
32321where
32322 C: 'a,
32323{
32324 hub: &'a Walletobjects<C>,
32325 _request: OfferObject,
32326 _resource_id: String,
32327 _delegate: Option<&'a mut dyn common::Delegate>,
32328 _additional_params: HashMap<String, String>,
32329 _scopes: BTreeSet<String>,
32330}
32331
32332impl<'a, C> common::CallBuilder for OfferobjectPatchCall<'a, C> {}
32333
32334impl<'a, C> OfferobjectPatchCall<'a, C>
32335where
32336 C: common::Connector,
32337{
32338 /// Perform the operation you have build so far.
32339 pub async fn doit(mut self) -> common::Result<(common::Response, OfferObject)> {
32340 use std::borrow::Cow;
32341 use std::io::{Read, Seek};
32342
32343 use common::{url::Params, ToParts};
32344 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32345
32346 let mut dd = common::DefaultDelegate;
32347 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32348 dlg.begin(common::MethodInfo {
32349 id: "walletobjects.offerobject.patch",
32350 http_method: hyper::Method::PATCH,
32351 });
32352
32353 for &field in ["alt", "resourceId"].iter() {
32354 if self._additional_params.contains_key(field) {
32355 dlg.finished(false);
32356 return Err(common::Error::FieldClash(field));
32357 }
32358 }
32359
32360 let mut params = Params::with_capacity(4 + self._additional_params.len());
32361 params.push("resourceId", self._resource_id);
32362
32363 params.extend(self._additional_params.iter());
32364
32365 params.push("alt", "json");
32366 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject/{resourceId}";
32367 if self._scopes.is_empty() {
32368 self._scopes
32369 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
32370 }
32371
32372 #[allow(clippy::single_element_loop)]
32373 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
32374 url = params.uri_replacement(url, param_name, find_this, false);
32375 }
32376 {
32377 let to_remove = ["resourceId"];
32378 params.remove_params(&to_remove);
32379 }
32380
32381 let url = params.parse_with_url(&url);
32382
32383 let mut json_mime_type = mime::APPLICATION_JSON;
32384 let mut request_value_reader = {
32385 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32386 common::remove_json_null_values(&mut value);
32387 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32388 serde_json::to_writer(&mut dst, &value).unwrap();
32389 dst
32390 };
32391 let request_size = request_value_reader
32392 .seek(std::io::SeekFrom::End(0))
32393 .unwrap();
32394 request_value_reader
32395 .seek(std::io::SeekFrom::Start(0))
32396 .unwrap();
32397
32398 loop {
32399 let token = match self
32400 .hub
32401 .auth
32402 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32403 .await
32404 {
32405 Ok(token) => token,
32406 Err(e) => match dlg.token(e) {
32407 Ok(token) => token,
32408 Err(e) => {
32409 dlg.finished(false);
32410 return Err(common::Error::MissingToken(e));
32411 }
32412 },
32413 };
32414 request_value_reader
32415 .seek(std::io::SeekFrom::Start(0))
32416 .unwrap();
32417 let mut req_result = {
32418 let client = &self.hub.client;
32419 dlg.pre_request();
32420 let mut req_builder = hyper::Request::builder()
32421 .method(hyper::Method::PATCH)
32422 .uri(url.as_str())
32423 .header(USER_AGENT, self.hub._user_agent.clone());
32424
32425 if let Some(token) = token.as_ref() {
32426 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32427 }
32428
32429 let request = req_builder
32430 .header(CONTENT_TYPE, json_mime_type.to_string())
32431 .header(CONTENT_LENGTH, request_size as u64)
32432 .body(common::to_body(
32433 request_value_reader.get_ref().clone().into(),
32434 ));
32435
32436 client.request(request.unwrap()).await
32437 };
32438
32439 match req_result {
32440 Err(err) => {
32441 if let common::Retry::After(d) = dlg.http_error(&err) {
32442 sleep(d).await;
32443 continue;
32444 }
32445 dlg.finished(false);
32446 return Err(common::Error::HttpError(err));
32447 }
32448 Ok(res) => {
32449 let (mut parts, body) = res.into_parts();
32450 let mut body = common::Body::new(body);
32451 if !parts.status.is_success() {
32452 let bytes = common::to_bytes(body).await.unwrap_or_default();
32453 let error = serde_json::from_str(&common::to_string(&bytes));
32454 let response = common::to_response(parts, bytes.into());
32455
32456 if let common::Retry::After(d) =
32457 dlg.http_failure(&response, error.as_ref().ok())
32458 {
32459 sleep(d).await;
32460 continue;
32461 }
32462
32463 dlg.finished(false);
32464
32465 return Err(match error {
32466 Ok(value) => common::Error::BadRequest(value),
32467 _ => common::Error::Failure(response),
32468 });
32469 }
32470 let response = {
32471 let bytes = common::to_bytes(body).await.unwrap_or_default();
32472 let encoded = common::to_string(&bytes);
32473 match serde_json::from_str(&encoded) {
32474 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32475 Err(error) => {
32476 dlg.response_json_decode_error(&encoded, &error);
32477 return Err(common::Error::JsonDecodeError(
32478 encoded.to_string(),
32479 error,
32480 ));
32481 }
32482 }
32483 };
32484
32485 dlg.finished(true);
32486 return Ok(response);
32487 }
32488 }
32489 }
32490 }
32491
32492 ///
32493 /// Sets the *request* property to the given value.
32494 ///
32495 /// Even though the property as already been set when instantiating this call,
32496 /// we provide this method for API completeness.
32497 pub fn request(mut self, new_value: OfferObject) -> OfferobjectPatchCall<'a, C> {
32498 self._request = new_value;
32499 self
32500 }
32501 /// 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 '-'.
32502 ///
32503 /// Sets the *resource id* path property to the given value.
32504 ///
32505 /// Even though the property as already been set when instantiating this call,
32506 /// we provide this method for API completeness.
32507 pub fn resource_id(mut self, new_value: &str) -> OfferobjectPatchCall<'a, C> {
32508 self._resource_id = new_value.to_string();
32509 self
32510 }
32511 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32512 /// while executing the actual API request.
32513 ///
32514 /// ````text
32515 /// It should be used to handle progress information, and to implement a certain level of resilience.
32516 /// ````
32517 ///
32518 /// Sets the *delegate* property to the given value.
32519 pub fn delegate(
32520 mut self,
32521 new_value: &'a mut dyn common::Delegate,
32522 ) -> OfferobjectPatchCall<'a, C> {
32523 self._delegate = Some(new_value);
32524 self
32525 }
32526
32527 /// Set any additional parameter of the query string used in the request.
32528 /// It should be used to set parameters which are not yet available through their own
32529 /// setters.
32530 ///
32531 /// Please note that this method must not be used to set any of the known parameters
32532 /// which have their own setter method. If done anyway, the request will fail.
32533 ///
32534 /// # Additional Parameters
32535 ///
32536 /// * *$.xgafv* (query-string) - V1 error format.
32537 /// * *access_token* (query-string) - OAuth access token.
32538 /// * *alt* (query-string) - Data format for response.
32539 /// * *callback* (query-string) - JSONP
32540 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32541 /// * *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.
32542 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32543 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32544 /// * *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.
32545 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32546 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32547 pub fn param<T>(mut self, name: T, value: T) -> OfferobjectPatchCall<'a, C>
32548 where
32549 T: AsRef<str>,
32550 {
32551 self._additional_params
32552 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32553 self
32554 }
32555
32556 /// Identifies the authorization scope for the method you are building.
32557 ///
32558 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32559 /// [`Scope::WalletObjectIssuer`].
32560 ///
32561 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32562 /// tokens for more than one scope.
32563 ///
32564 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32565 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32566 /// sufficient, a read-write scope will do as well.
32567 pub fn add_scope<St>(mut self, scope: St) -> OfferobjectPatchCall<'a, C>
32568 where
32569 St: AsRef<str>,
32570 {
32571 self._scopes.insert(String::from(scope.as_ref()));
32572 self
32573 }
32574 /// Identifies the authorization scope(s) for the method you are building.
32575 ///
32576 /// See [`Self::add_scope()`] for details.
32577 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectPatchCall<'a, C>
32578 where
32579 I: IntoIterator<Item = St>,
32580 St: AsRef<str>,
32581 {
32582 self._scopes
32583 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32584 self
32585 }
32586
32587 /// Removes all scopes, and no default scope will be used either.
32588 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32589 /// for details).
32590 pub fn clear_scopes(mut self) -> OfferobjectPatchCall<'a, C> {
32591 self._scopes.clear();
32592 self
32593 }
32594}
32595
32596/// Updates the offer object referenced by the given object ID.
32597///
32598/// A builder for the *update* method supported by a *offerobject* resource.
32599/// It is not used directly, but through a [`OfferobjectMethods`] instance.
32600///
32601/// # Example
32602///
32603/// Instantiate a resource method builder
32604///
32605/// ```test_harness,no_run
32606/// # extern crate hyper;
32607/// # extern crate hyper_rustls;
32608/// # extern crate google_walletobjects1 as walletobjects1;
32609/// use walletobjects1::api::OfferObject;
32610/// # async fn dox() {
32611/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32612///
32613/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32614/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32615/// # secret,
32616/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32617/// # ).build().await.unwrap();
32618///
32619/// # let client = hyper_util::client::legacy::Client::builder(
32620/// # hyper_util::rt::TokioExecutor::new()
32621/// # )
32622/// # .build(
32623/// # hyper_rustls::HttpsConnectorBuilder::new()
32624/// # .with_native_roots()
32625/// # .unwrap()
32626/// # .https_or_http()
32627/// # .enable_http1()
32628/// # .build()
32629/// # );
32630/// # let mut hub = Walletobjects::new(client, auth);
32631/// // As the method needs a request, you would usually fill it with the desired information
32632/// // into the respective structure. Some of the parts shown here might not be applicable !
32633/// // Values shown here are possibly random and not representative !
32634/// let mut req = OfferObject::default();
32635///
32636/// // You can configure optional parameters by calling the respective setters at will, and
32637/// // execute the final call using `doit()`.
32638/// // Values shown here are possibly random and not representative !
32639/// let result = hub.offerobject().update(req, "resourceId")
32640/// .doit().await;
32641/// # }
32642/// ```
32643pub struct OfferobjectUpdateCall<'a, C>
32644where
32645 C: 'a,
32646{
32647 hub: &'a Walletobjects<C>,
32648 _request: OfferObject,
32649 _resource_id: String,
32650 _delegate: Option<&'a mut dyn common::Delegate>,
32651 _additional_params: HashMap<String, String>,
32652 _scopes: BTreeSet<String>,
32653}
32654
32655impl<'a, C> common::CallBuilder for OfferobjectUpdateCall<'a, C> {}
32656
32657impl<'a, C> OfferobjectUpdateCall<'a, C>
32658where
32659 C: common::Connector,
32660{
32661 /// Perform the operation you have build so far.
32662 pub async fn doit(mut self) -> common::Result<(common::Response, OfferObject)> {
32663 use std::borrow::Cow;
32664 use std::io::{Read, Seek};
32665
32666 use common::{url::Params, ToParts};
32667 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32668
32669 let mut dd = common::DefaultDelegate;
32670 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32671 dlg.begin(common::MethodInfo {
32672 id: "walletobjects.offerobject.update",
32673 http_method: hyper::Method::PUT,
32674 });
32675
32676 for &field in ["alt", "resourceId"].iter() {
32677 if self._additional_params.contains_key(field) {
32678 dlg.finished(false);
32679 return Err(common::Error::FieldClash(field));
32680 }
32681 }
32682
32683 let mut params = Params::with_capacity(4 + self._additional_params.len());
32684 params.push("resourceId", self._resource_id);
32685
32686 params.extend(self._additional_params.iter());
32687
32688 params.push("alt", "json");
32689 let mut url = self.hub._base_url.clone() + "walletobjects/v1/offerObject/{resourceId}";
32690 if self._scopes.is_empty() {
32691 self._scopes
32692 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
32693 }
32694
32695 #[allow(clippy::single_element_loop)]
32696 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
32697 url = params.uri_replacement(url, param_name, find_this, false);
32698 }
32699 {
32700 let to_remove = ["resourceId"];
32701 params.remove_params(&to_remove);
32702 }
32703
32704 let url = params.parse_with_url(&url);
32705
32706 let mut json_mime_type = mime::APPLICATION_JSON;
32707 let mut request_value_reader = {
32708 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32709 common::remove_json_null_values(&mut value);
32710 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32711 serde_json::to_writer(&mut dst, &value).unwrap();
32712 dst
32713 };
32714 let request_size = request_value_reader
32715 .seek(std::io::SeekFrom::End(0))
32716 .unwrap();
32717 request_value_reader
32718 .seek(std::io::SeekFrom::Start(0))
32719 .unwrap();
32720
32721 loop {
32722 let token = match self
32723 .hub
32724 .auth
32725 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32726 .await
32727 {
32728 Ok(token) => token,
32729 Err(e) => match dlg.token(e) {
32730 Ok(token) => token,
32731 Err(e) => {
32732 dlg.finished(false);
32733 return Err(common::Error::MissingToken(e));
32734 }
32735 },
32736 };
32737 request_value_reader
32738 .seek(std::io::SeekFrom::Start(0))
32739 .unwrap();
32740 let mut req_result = {
32741 let client = &self.hub.client;
32742 dlg.pre_request();
32743 let mut req_builder = hyper::Request::builder()
32744 .method(hyper::Method::PUT)
32745 .uri(url.as_str())
32746 .header(USER_AGENT, self.hub._user_agent.clone());
32747
32748 if let Some(token) = token.as_ref() {
32749 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32750 }
32751
32752 let request = req_builder
32753 .header(CONTENT_TYPE, json_mime_type.to_string())
32754 .header(CONTENT_LENGTH, request_size as u64)
32755 .body(common::to_body(
32756 request_value_reader.get_ref().clone().into(),
32757 ));
32758
32759 client.request(request.unwrap()).await
32760 };
32761
32762 match req_result {
32763 Err(err) => {
32764 if let common::Retry::After(d) = dlg.http_error(&err) {
32765 sleep(d).await;
32766 continue;
32767 }
32768 dlg.finished(false);
32769 return Err(common::Error::HttpError(err));
32770 }
32771 Ok(res) => {
32772 let (mut parts, body) = res.into_parts();
32773 let mut body = common::Body::new(body);
32774 if !parts.status.is_success() {
32775 let bytes = common::to_bytes(body).await.unwrap_or_default();
32776 let error = serde_json::from_str(&common::to_string(&bytes));
32777 let response = common::to_response(parts, bytes.into());
32778
32779 if let common::Retry::After(d) =
32780 dlg.http_failure(&response, error.as_ref().ok())
32781 {
32782 sleep(d).await;
32783 continue;
32784 }
32785
32786 dlg.finished(false);
32787
32788 return Err(match error {
32789 Ok(value) => common::Error::BadRequest(value),
32790 _ => common::Error::Failure(response),
32791 });
32792 }
32793 let response = {
32794 let bytes = common::to_bytes(body).await.unwrap_or_default();
32795 let encoded = common::to_string(&bytes);
32796 match serde_json::from_str(&encoded) {
32797 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32798 Err(error) => {
32799 dlg.response_json_decode_error(&encoded, &error);
32800 return Err(common::Error::JsonDecodeError(
32801 encoded.to_string(),
32802 error,
32803 ));
32804 }
32805 }
32806 };
32807
32808 dlg.finished(true);
32809 return Ok(response);
32810 }
32811 }
32812 }
32813 }
32814
32815 ///
32816 /// Sets the *request* property to the given value.
32817 ///
32818 /// Even though the property as already been set when instantiating this call,
32819 /// we provide this method for API completeness.
32820 pub fn request(mut self, new_value: OfferObject) -> OfferobjectUpdateCall<'a, C> {
32821 self._request = new_value;
32822 self
32823 }
32824 /// 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 '-'.
32825 ///
32826 /// Sets the *resource id* path property to the given value.
32827 ///
32828 /// Even though the property as already been set when instantiating this call,
32829 /// we provide this method for API completeness.
32830 pub fn resource_id(mut self, new_value: &str) -> OfferobjectUpdateCall<'a, C> {
32831 self._resource_id = new_value.to_string();
32832 self
32833 }
32834 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32835 /// while executing the actual API request.
32836 ///
32837 /// ````text
32838 /// It should be used to handle progress information, and to implement a certain level of resilience.
32839 /// ````
32840 ///
32841 /// Sets the *delegate* property to the given value.
32842 pub fn delegate(
32843 mut self,
32844 new_value: &'a mut dyn common::Delegate,
32845 ) -> OfferobjectUpdateCall<'a, C> {
32846 self._delegate = Some(new_value);
32847 self
32848 }
32849
32850 /// Set any additional parameter of the query string used in the request.
32851 /// It should be used to set parameters which are not yet available through their own
32852 /// setters.
32853 ///
32854 /// Please note that this method must not be used to set any of the known parameters
32855 /// which have their own setter method. If done anyway, the request will fail.
32856 ///
32857 /// # Additional Parameters
32858 ///
32859 /// * *$.xgafv* (query-string) - V1 error format.
32860 /// * *access_token* (query-string) - OAuth access token.
32861 /// * *alt* (query-string) - Data format for response.
32862 /// * *callback* (query-string) - JSONP
32863 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32864 /// * *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.
32865 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32866 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32867 /// * *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.
32868 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32869 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32870 pub fn param<T>(mut self, name: T, value: T) -> OfferobjectUpdateCall<'a, C>
32871 where
32872 T: AsRef<str>,
32873 {
32874 self._additional_params
32875 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32876 self
32877 }
32878
32879 /// Identifies the authorization scope for the method you are building.
32880 ///
32881 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32882 /// [`Scope::WalletObjectIssuer`].
32883 ///
32884 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32885 /// tokens for more than one scope.
32886 ///
32887 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32888 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32889 /// sufficient, a read-write scope will do as well.
32890 pub fn add_scope<St>(mut self, scope: St) -> OfferobjectUpdateCall<'a, C>
32891 where
32892 St: AsRef<str>,
32893 {
32894 self._scopes.insert(String::from(scope.as_ref()));
32895 self
32896 }
32897 /// Identifies the authorization scope(s) for the method you are building.
32898 ///
32899 /// See [`Self::add_scope()`] for details.
32900 pub fn add_scopes<I, St>(mut self, scopes: I) -> OfferobjectUpdateCall<'a, C>
32901 where
32902 I: IntoIterator<Item = St>,
32903 St: AsRef<str>,
32904 {
32905 self._scopes
32906 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32907 self
32908 }
32909
32910 /// Removes all scopes, and no default scope will be used either.
32911 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32912 /// for details).
32913 pub fn clear_scopes(mut self) -> OfferobjectUpdateCall<'a, C> {
32914 self._scopes.clear();
32915 self
32916 }
32917}
32918
32919/// Returns the permissions for the given issuer id.
32920///
32921/// A builder for the *get* method supported by a *permission* resource.
32922/// It is not used directly, but through a [`PermissionMethods`] instance.
32923///
32924/// # Example
32925///
32926/// Instantiate a resource method builder
32927///
32928/// ```test_harness,no_run
32929/// # extern crate hyper;
32930/// # extern crate hyper_rustls;
32931/// # extern crate google_walletobjects1 as walletobjects1;
32932/// # async fn dox() {
32933/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32934///
32935/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32936/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32937/// # secret,
32938/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32939/// # ).build().await.unwrap();
32940///
32941/// # let client = hyper_util::client::legacy::Client::builder(
32942/// # hyper_util::rt::TokioExecutor::new()
32943/// # )
32944/// # .build(
32945/// # hyper_rustls::HttpsConnectorBuilder::new()
32946/// # .with_native_roots()
32947/// # .unwrap()
32948/// # .https_or_http()
32949/// # .enable_http1()
32950/// # .build()
32951/// # );
32952/// # let mut hub = Walletobjects::new(client, auth);
32953/// // You can configure optional parameters by calling the respective setters at will, and
32954/// // execute the final call using `doit()`.
32955/// // Values shown here are possibly random and not representative !
32956/// let result = hub.permissions().get(-2)
32957/// .doit().await;
32958/// # }
32959/// ```
32960pub struct PermissionGetCall<'a, C>
32961where
32962 C: 'a,
32963{
32964 hub: &'a Walletobjects<C>,
32965 _resource_id: i64,
32966 _delegate: Option<&'a mut dyn common::Delegate>,
32967 _additional_params: HashMap<String, String>,
32968 _scopes: BTreeSet<String>,
32969}
32970
32971impl<'a, C> common::CallBuilder for PermissionGetCall<'a, C> {}
32972
32973impl<'a, C> PermissionGetCall<'a, C>
32974where
32975 C: common::Connector,
32976{
32977 /// Perform the operation you have build so far.
32978 pub async fn doit(mut self) -> common::Result<(common::Response, Permissions)> {
32979 use std::borrow::Cow;
32980 use std::io::{Read, Seek};
32981
32982 use common::{url::Params, ToParts};
32983 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32984
32985 let mut dd = common::DefaultDelegate;
32986 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32987 dlg.begin(common::MethodInfo {
32988 id: "walletobjects.permissions.get",
32989 http_method: hyper::Method::GET,
32990 });
32991
32992 for &field in ["alt", "resourceId"].iter() {
32993 if self._additional_params.contains_key(field) {
32994 dlg.finished(false);
32995 return Err(common::Error::FieldClash(field));
32996 }
32997 }
32998
32999 let mut params = Params::with_capacity(3 + self._additional_params.len());
33000 params.push("resourceId", self._resource_id.to_string());
33001
33002 params.extend(self._additional_params.iter());
33003
33004 params.push("alt", "json");
33005 let mut url = self.hub._base_url.clone() + "walletobjects/v1/permissions/{resourceId}";
33006 if self._scopes.is_empty() {
33007 self._scopes
33008 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
33009 }
33010
33011 #[allow(clippy::single_element_loop)]
33012 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
33013 url = params.uri_replacement(url, param_name, find_this, false);
33014 }
33015 {
33016 let to_remove = ["resourceId"];
33017 params.remove_params(&to_remove);
33018 }
33019
33020 let url = params.parse_with_url(&url);
33021
33022 loop {
33023 let token = match self
33024 .hub
33025 .auth
33026 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33027 .await
33028 {
33029 Ok(token) => token,
33030 Err(e) => match dlg.token(e) {
33031 Ok(token) => token,
33032 Err(e) => {
33033 dlg.finished(false);
33034 return Err(common::Error::MissingToken(e));
33035 }
33036 },
33037 };
33038 let mut req_result = {
33039 let client = &self.hub.client;
33040 dlg.pre_request();
33041 let mut req_builder = hyper::Request::builder()
33042 .method(hyper::Method::GET)
33043 .uri(url.as_str())
33044 .header(USER_AGENT, self.hub._user_agent.clone());
33045
33046 if let Some(token) = token.as_ref() {
33047 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33048 }
33049
33050 let request = req_builder
33051 .header(CONTENT_LENGTH, 0_u64)
33052 .body(common::to_body::<String>(None));
33053
33054 client.request(request.unwrap()).await
33055 };
33056
33057 match req_result {
33058 Err(err) => {
33059 if let common::Retry::After(d) = dlg.http_error(&err) {
33060 sleep(d).await;
33061 continue;
33062 }
33063 dlg.finished(false);
33064 return Err(common::Error::HttpError(err));
33065 }
33066 Ok(res) => {
33067 let (mut parts, body) = res.into_parts();
33068 let mut body = common::Body::new(body);
33069 if !parts.status.is_success() {
33070 let bytes = common::to_bytes(body).await.unwrap_or_default();
33071 let error = serde_json::from_str(&common::to_string(&bytes));
33072 let response = common::to_response(parts, bytes.into());
33073
33074 if let common::Retry::After(d) =
33075 dlg.http_failure(&response, error.as_ref().ok())
33076 {
33077 sleep(d).await;
33078 continue;
33079 }
33080
33081 dlg.finished(false);
33082
33083 return Err(match error {
33084 Ok(value) => common::Error::BadRequest(value),
33085 _ => common::Error::Failure(response),
33086 });
33087 }
33088 let response = {
33089 let bytes = common::to_bytes(body).await.unwrap_or_default();
33090 let encoded = common::to_string(&bytes);
33091 match serde_json::from_str(&encoded) {
33092 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33093 Err(error) => {
33094 dlg.response_json_decode_error(&encoded, &error);
33095 return Err(common::Error::JsonDecodeError(
33096 encoded.to_string(),
33097 error,
33098 ));
33099 }
33100 }
33101 };
33102
33103 dlg.finished(true);
33104 return Ok(response);
33105 }
33106 }
33107 }
33108 }
33109
33110 /// The unique identifier for an issuer. This ID must be unique across all issuers.
33111 ///
33112 /// Sets the *resource id* path property to the given value.
33113 ///
33114 /// Even though the property as already been set when instantiating this call,
33115 /// we provide this method for API completeness.
33116 pub fn resource_id(mut self, new_value: i64) -> PermissionGetCall<'a, C> {
33117 self._resource_id = new_value;
33118 self
33119 }
33120 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33121 /// while executing the actual API request.
33122 ///
33123 /// ````text
33124 /// It should be used to handle progress information, and to implement a certain level of resilience.
33125 /// ````
33126 ///
33127 /// Sets the *delegate* property to the given value.
33128 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PermissionGetCall<'a, C> {
33129 self._delegate = Some(new_value);
33130 self
33131 }
33132
33133 /// Set any additional parameter of the query string used in the request.
33134 /// It should be used to set parameters which are not yet available through their own
33135 /// setters.
33136 ///
33137 /// Please note that this method must not be used to set any of the known parameters
33138 /// which have their own setter method. If done anyway, the request will fail.
33139 ///
33140 /// # Additional Parameters
33141 ///
33142 /// * *$.xgafv* (query-string) - V1 error format.
33143 /// * *access_token* (query-string) - OAuth access token.
33144 /// * *alt* (query-string) - Data format for response.
33145 /// * *callback* (query-string) - JSONP
33146 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33147 /// * *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.
33148 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33149 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33150 /// * *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.
33151 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33152 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33153 pub fn param<T>(mut self, name: T, value: T) -> PermissionGetCall<'a, C>
33154 where
33155 T: AsRef<str>,
33156 {
33157 self._additional_params
33158 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33159 self
33160 }
33161
33162 /// Identifies the authorization scope for the method you are building.
33163 ///
33164 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33165 /// [`Scope::WalletObjectIssuer`].
33166 ///
33167 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33168 /// tokens for more than one scope.
33169 ///
33170 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33171 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33172 /// sufficient, a read-write scope will do as well.
33173 pub fn add_scope<St>(mut self, scope: St) -> PermissionGetCall<'a, C>
33174 where
33175 St: AsRef<str>,
33176 {
33177 self._scopes.insert(String::from(scope.as_ref()));
33178 self
33179 }
33180 /// Identifies the authorization scope(s) for the method you are building.
33181 ///
33182 /// See [`Self::add_scope()`] for details.
33183 pub fn add_scopes<I, St>(mut self, scopes: I) -> PermissionGetCall<'a, C>
33184 where
33185 I: IntoIterator<Item = St>,
33186 St: AsRef<str>,
33187 {
33188 self._scopes
33189 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33190 self
33191 }
33192
33193 /// Removes all scopes, and no default scope will be used either.
33194 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33195 /// for details).
33196 pub fn clear_scopes(mut self) -> PermissionGetCall<'a, C> {
33197 self._scopes.clear();
33198 self
33199 }
33200}
33201
33202/// Updates the permissions for the given issuer.
33203///
33204/// A builder for the *update* method supported by a *permission* resource.
33205/// It is not used directly, but through a [`PermissionMethods`] instance.
33206///
33207/// # Example
33208///
33209/// Instantiate a resource method builder
33210///
33211/// ```test_harness,no_run
33212/// # extern crate hyper;
33213/// # extern crate hyper_rustls;
33214/// # extern crate google_walletobjects1 as walletobjects1;
33215/// use walletobjects1::api::Permissions;
33216/// # async fn dox() {
33217/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33218///
33219/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33220/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33221/// # secret,
33222/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33223/// # ).build().await.unwrap();
33224///
33225/// # let client = hyper_util::client::legacy::Client::builder(
33226/// # hyper_util::rt::TokioExecutor::new()
33227/// # )
33228/// # .build(
33229/// # hyper_rustls::HttpsConnectorBuilder::new()
33230/// # .with_native_roots()
33231/// # .unwrap()
33232/// # .https_or_http()
33233/// # .enable_http1()
33234/// # .build()
33235/// # );
33236/// # let mut hub = Walletobjects::new(client, auth);
33237/// // As the method needs a request, you would usually fill it with the desired information
33238/// // into the respective structure. Some of the parts shown here might not be applicable !
33239/// // Values shown here are possibly random and not representative !
33240/// let mut req = Permissions::default();
33241///
33242/// // You can configure optional parameters by calling the respective setters at will, and
33243/// // execute the final call using `doit()`.
33244/// // Values shown here are possibly random and not representative !
33245/// let result = hub.permissions().update(req, -17)
33246/// .doit().await;
33247/// # }
33248/// ```
33249pub struct PermissionUpdateCall<'a, C>
33250where
33251 C: 'a,
33252{
33253 hub: &'a Walletobjects<C>,
33254 _request: Permissions,
33255 _resource_id: i64,
33256 _delegate: Option<&'a mut dyn common::Delegate>,
33257 _additional_params: HashMap<String, String>,
33258 _scopes: BTreeSet<String>,
33259}
33260
33261impl<'a, C> common::CallBuilder for PermissionUpdateCall<'a, C> {}
33262
33263impl<'a, C> PermissionUpdateCall<'a, C>
33264where
33265 C: common::Connector,
33266{
33267 /// Perform the operation you have build so far.
33268 pub async fn doit(mut self) -> common::Result<(common::Response, Permissions)> {
33269 use std::borrow::Cow;
33270 use std::io::{Read, Seek};
33271
33272 use common::{url::Params, ToParts};
33273 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33274
33275 let mut dd = common::DefaultDelegate;
33276 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33277 dlg.begin(common::MethodInfo {
33278 id: "walletobjects.permissions.update",
33279 http_method: hyper::Method::PUT,
33280 });
33281
33282 for &field in ["alt", "resourceId"].iter() {
33283 if self._additional_params.contains_key(field) {
33284 dlg.finished(false);
33285 return Err(common::Error::FieldClash(field));
33286 }
33287 }
33288
33289 let mut params = Params::with_capacity(4 + self._additional_params.len());
33290 params.push("resourceId", self._resource_id.to_string());
33291
33292 params.extend(self._additional_params.iter());
33293
33294 params.push("alt", "json");
33295 let mut url = self.hub._base_url.clone() + "walletobjects/v1/permissions/{resourceId}";
33296 if self._scopes.is_empty() {
33297 self._scopes
33298 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
33299 }
33300
33301 #[allow(clippy::single_element_loop)]
33302 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
33303 url = params.uri_replacement(url, param_name, find_this, false);
33304 }
33305 {
33306 let to_remove = ["resourceId"];
33307 params.remove_params(&to_remove);
33308 }
33309
33310 let url = params.parse_with_url(&url);
33311
33312 let mut json_mime_type = mime::APPLICATION_JSON;
33313 let mut request_value_reader = {
33314 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33315 common::remove_json_null_values(&mut value);
33316 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33317 serde_json::to_writer(&mut dst, &value).unwrap();
33318 dst
33319 };
33320 let request_size = request_value_reader
33321 .seek(std::io::SeekFrom::End(0))
33322 .unwrap();
33323 request_value_reader
33324 .seek(std::io::SeekFrom::Start(0))
33325 .unwrap();
33326
33327 loop {
33328 let token = match self
33329 .hub
33330 .auth
33331 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33332 .await
33333 {
33334 Ok(token) => token,
33335 Err(e) => match dlg.token(e) {
33336 Ok(token) => token,
33337 Err(e) => {
33338 dlg.finished(false);
33339 return Err(common::Error::MissingToken(e));
33340 }
33341 },
33342 };
33343 request_value_reader
33344 .seek(std::io::SeekFrom::Start(0))
33345 .unwrap();
33346 let mut req_result = {
33347 let client = &self.hub.client;
33348 dlg.pre_request();
33349 let mut req_builder = hyper::Request::builder()
33350 .method(hyper::Method::PUT)
33351 .uri(url.as_str())
33352 .header(USER_AGENT, self.hub._user_agent.clone());
33353
33354 if let Some(token) = token.as_ref() {
33355 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33356 }
33357
33358 let request = req_builder
33359 .header(CONTENT_TYPE, json_mime_type.to_string())
33360 .header(CONTENT_LENGTH, request_size as u64)
33361 .body(common::to_body(
33362 request_value_reader.get_ref().clone().into(),
33363 ));
33364
33365 client.request(request.unwrap()).await
33366 };
33367
33368 match req_result {
33369 Err(err) => {
33370 if let common::Retry::After(d) = dlg.http_error(&err) {
33371 sleep(d).await;
33372 continue;
33373 }
33374 dlg.finished(false);
33375 return Err(common::Error::HttpError(err));
33376 }
33377 Ok(res) => {
33378 let (mut parts, body) = res.into_parts();
33379 let mut body = common::Body::new(body);
33380 if !parts.status.is_success() {
33381 let bytes = common::to_bytes(body).await.unwrap_or_default();
33382 let error = serde_json::from_str(&common::to_string(&bytes));
33383 let response = common::to_response(parts, bytes.into());
33384
33385 if let common::Retry::After(d) =
33386 dlg.http_failure(&response, error.as_ref().ok())
33387 {
33388 sleep(d).await;
33389 continue;
33390 }
33391
33392 dlg.finished(false);
33393
33394 return Err(match error {
33395 Ok(value) => common::Error::BadRequest(value),
33396 _ => common::Error::Failure(response),
33397 });
33398 }
33399 let response = {
33400 let bytes = common::to_bytes(body).await.unwrap_or_default();
33401 let encoded = common::to_string(&bytes);
33402 match serde_json::from_str(&encoded) {
33403 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33404 Err(error) => {
33405 dlg.response_json_decode_error(&encoded, &error);
33406 return Err(common::Error::JsonDecodeError(
33407 encoded.to_string(),
33408 error,
33409 ));
33410 }
33411 }
33412 };
33413
33414 dlg.finished(true);
33415 return Ok(response);
33416 }
33417 }
33418 }
33419 }
33420
33421 ///
33422 /// Sets the *request* property to the given value.
33423 ///
33424 /// Even though the property as already been set when instantiating this call,
33425 /// we provide this method for API completeness.
33426 pub fn request(mut self, new_value: Permissions) -> PermissionUpdateCall<'a, C> {
33427 self._request = new_value;
33428 self
33429 }
33430 /// The unique identifier for an issuer. This ID must be unique across all issuers.
33431 ///
33432 /// Sets the *resource id* path property to the given value.
33433 ///
33434 /// Even though the property as already been set when instantiating this call,
33435 /// we provide this method for API completeness.
33436 pub fn resource_id(mut self, new_value: i64) -> PermissionUpdateCall<'a, C> {
33437 self._resource_id = new_value;
33438 self
33439 }
33440 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33441 /// while executing the actual API request.
33442 ///
33443 /// ````text
33444 /// It should be used to handle progress information, and to implement a certain level of resilience.
33445 /// ````
33446 ///
33447 /// Sets the *delegate* property to the given value.
33448 pub fn delegate(
33449 mut self,
33450 new_value: &'a mut dyn common::Delegate,
33451 ) -> PermissionUpdateCall<'a, C> {
33452 self._delegate = Some(new_value);
33453 self
33454 }
33455
33456 /// Set any additional parameter of the query string used in the request.
33457 /// It should be used to set parameters which are not yet available through their own
33458 /// setters.
33459 ///
33460 /// Please note that this method must not be used to set any of the known parameters
33461 /// which have their own setter method. If done anyway, the request will fail.
33462 ///
33463 /// # Additional Parameters
33464 ///
33465 /// * *$.xgafv* (query-string) - V1 error format.
33466 /// * *access_token* (query-string) - OAuth access token.
33467 /// * *alt* (query-string) - Data format for response.
33468 /// * *callback* (query-string) - JSONP
33469 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33470 /// * *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.
33471 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33472 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33473 /// * *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.
33474 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33475 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33476 pub fn param<T>(mut self, name: T, value: T) -> PermissionUpdateCall<'a, C>
33477 where
33478 T: AsRef<str>,
33479 {
33480 self._additional_params
33481 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33482 self
33483 }
33484
33485 /// Identifies the authorization scope for the method you are building.
33486 ///
33487 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33488 /// [`Scope::WalletObjectIssuer`].
33489 ///
33490 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33491 /// tokens for more than one scope.
33492 ///
33493 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33494 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33495 /// sufficient, a read-write scope will do as well.
33496 pub fn add_scope<St>(mut self, scope: St) -> PermissionUpdateCall<'a, C>
33497 where
33498 St: AsRef<str>,
33499 {
33500 self._scopes.insert(String::from(scope.as_ref()));
33501 self
33502 }
33503 /// Identifies the authorization scope(s) for the method you are building.
33504 ///
33505 /// See [`Self::add_scope()`] for details.
33506 pub fn add_scopes<I, St>(mut self, scopes: I) -> PermissionUpdateCall<'a, C>
33507 where
33508 I: IntoIterator<Item = St>,
33509 St: AsRef<str>,
33510 {
33511 self._scopes
33512 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33513 self
33514 }
33515
33516 /// Removes all scopes, and no default scope will be used either.
33517 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33518 /// for details).
33519 pub fn clear_scopes(mut self) -> PermissionUpdateCall<'a, C> {
33520 self._scopes.clear();
33521 self
33522 }
33523}
33524
33525/// Inserts the smart tap.
33526///
33527/// A builder for the *insert* method supported by a *smarttap* resource.
33528/// It is not used directly, but through a [`SmarttapMethods`] instance.
33529///
33530/// # Example
33531///
33532/// Instantiate a resource method builder
33533///
33534/// ```test_harness,no_run
33535/// # extern crate hyper;
33536/// # extern crate hyper_rustls;
33537/// # extern crate google_walletobjects1 as walletobjects1;
33538/// use walletobjects1::api::SmartTap;
33539/// # async fn dox() {
33540/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33541///
33542/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33543/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33544/// # secret,
33545/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33546/// # ).build().await.unwrap();
33547///
33548/// # let client = hyper_util::client::legacy::Client::builder(
33549/// # hyper_util::rt::TokioExecutor::new()
33550/// # )
33551/// # .build(
33552/// # hyper_rustls::HttpsConnectorBuilder::new()
33553/// # .with_native_roots()
33554/// # .unwrap()
33555/// # .https_or_http()
33556/// # .enable_http1()
33557/// # .build()
33558/// # );
33559/// # let mut hub = Walletobjects::new(client, auth);
33560/// // As the method needs a request, you would usually fill it with the desired information
33561/// // into the respective structure. Some of the parts shown here might not be applicable !
33562/// // Values shown here are possibly random and not representative !
33563/// let mut req = SmartTap::default();
33564///
33565/// // You can configure optional parameters by calling the respective setters at will, and
33566/// // execute the final call using `doit()`.
33567/// // Values shown here are possibly random and not representative !
33568/// let result = hub.smarttap().insert(req)
33569/// .doit().await;
33570/// # }
33571/// ```
33572pub struct SmarttapInsertCall<'a, C>
33573where
33574 C: 'a,
33575{
33576 hub: &'a Walletobjects<C>,
33577 _request: SmartTap,
33578 _delegate: Option<&'a mut dyn common::Delegate>,
33579 _additional_params: HashMap<String, String>,
33580 _scopes: BTreeSet<String>,
33581}
33582
33583impl<'a, C> common::CallBuilder for SmarttapInsertCall<'a, C> {}
33584
33585impl<'a, C> SmarttapInsertCall<'a, C>
33586where
33587 C: common::Connector,
33588{
33589 /// Perform the operation you have build so far.
33590 pub async fn doit(mut self) -> common::Result<(common::Response, SmartTap)> {
33591 use std::borrow::Cow;
33592 use std::io::{Read, Seek};
33593
33594 use common::{url::Params, ToParts};
33595 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33596
33597 let mut dd = common::DefaultDelegate;
33598 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33599 dlg.begin(common::MethodInfo {
33600 id: "walletobjects.smarttap.insert",
33601 http_method: hyper::Method::POST,
33602 });
33603
33604 for &field in ["alt"].iter() {
33605 if self._additional_params.contains_key(field) {
33606 dlg.finished(false);
33607 return Err(common::Error::FieldClash(field));
33608 }
33609 }
33610
33611 let mut params = Params::with_capacity(3 + self._additional_params.len());
33612
33613 params.extend(self._additional_params.iter());
33614
33615 params.push("alt", "json");
33616 let mut url = self.hub._base_url.clone() + "walletobjects/v1/smartTap";
33617 if self._scopes.is_empty() {
33618 self._scopes
33619 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
33620 }
33621
33622 let url = params.parse_with_url(&url);
33623
33624 let mut json_mime_type = mime::APPLICATION_JSON;
33625 let mut request_value_reader = {
33626 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33627 common::remove_json_null_values(&mut value);
33628 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33629 serde_json::to_writer(&mut dst, &value).unwrap();
33630 dst
33631 };
33632 let request_size = request_value_reader
33633 .seek(std::io::SeekFrom::End(0))
33634 .unwrap();
33635 request_value_reader
33636 .seek(std::io::SeekFrom::Start(0))
33637 .unwrap();
33638
33639 loop {
33640 let token = match self
33641 .hub
33642 .auth
33643 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33644 .await
33645 {
33646 Ok(token) => token,
33647 Err(e) => match dlg.token(e) {
33648 Ok(token) => token,
33649 Err(e) => {
33650 dlg.finished(false);
33651 return Err(common::Error::MissingToken(e));
33652 }
33653 },
33654 };
33655 request_value_reader
33656 .seek(std::io::SeekFrom::Start(0))
33657 .unwrap();
33658 let mut req_result = {
33659 let client = &self.hub.client;
33660 dlg.pre_request();
33661 let mut req_builder = hyper::Request::builder()
33662 .method(hyper::Method::POST)
33663 .uri(url.as_str())
33664 .header(USER_AGENT, self.hub._user_agent.clone());
33665
33666 if let Some(token) = token.as_ref() {
33667 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33668 }
33669
33670 let request = req_builder
33671 .header(CONTENT_TYPE, json_mime_type.to_string())
33672 .header(CONTENT_LENGTH, request_size as u64)
33673 .body(common::to_body(
33674 request_value_reader.get_ref().clone().into(),
33675 ));
33676
33677 client.request(request.unwrap()).await
33678 };
33679
33680 match req_result {
33681 Err(err) => {
33682 if let common::Retry::After(d) = dlg.http_error(&err) {
33683 sleep(d).await;
33684 continue;
33685 }
33686 dlg.finished(false);
33687 return Err(common::Error::HttpError(err));
33688 }
33689 Ok(res) => {
33690 let (mut parts, body) = res.into_parts();
33691 let mut body = common::Body::new(body);
33692 if !parts.status.is_success() {
33693 let bytes = common::to_bytes(body).await.unwrap_or_default();
33694 let error = serde_json::from_str(&common::to_string(&bytes));
33695 let response = common::to_response(parts, bytes.into());
33696
33697 if let common::Retry::After(d) =
33698 dlg.http_failure(&response, error.as_ref().ok())
33699 {
33700 sleep(d).await;
33701 continue;
33702 }
33703
33704 dlg.finished(false);
33705
33706 return Err(match error {
33707 Ok(value) => common::Error::BadRequest(value),
33708 _ => common::Error::Failure(response),
33709 });
33710 }
33711 let response = {
33712 let bytes = common::to_bytes(body).await.unwrap_or_default();
33713 let encoded = common::to_string(&bytes);
33714 match serde_json::from_str(&encoded) {
33715 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33716 Err(error) => {
33717 dlg.response_json_decode_error(&encoded, &error);
33718 return Err(common::Error::JsonDecodeError(
33719 encoded.to_string(),
33720 error,
33721 ));
33722 }
33723 }
33724 };
33725
33726 dlg.finished(true);
33727 return Ok(response);
33728 }
33729 }
33730 }
33731 }
33732
33733 ///
33734 /// Sets the *request* property to the given value.
33735 ///
33736 /// Even though the property as already been set when instantiating this call,
33737 /// we provide this method for API completeness.
33738 pub fn request(mut self, new_value: SmartTap) -> SmarttapInsertCall<'a, C> {
33739 self._request = new_value;
33740 self
33741 }
33742 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33743 /// while executing the actual API request.
33744 ///
33745 /// ````text
33746 /// It should be used to handle progress information, and to implement a certain level of resilience.
33747 /// ````
33748 ///
33749 /// Sets the *delegate* property to the given value.
33750 pub fn delegate(
33751 mut self,
33752 new_value: &'a mut dyn common::Delegate,
33753 ) -> SmarttapInsertCall<'a, C> {
33754 self._delegate = Some(new_value);
33755 self
33756 }
33757
33758 /// Set any additional parameter of the query string used in the request.
33759 /// It should be used to set parameters which are not yet available through their own
33760 /// setters.
33761 ///
33762 /// Please note that this method must not be used to set any of the known parameters
33763 /// which have their own setter method. If done anyway, the request will fail.
33764 ///
33765 /// # Additional Parameters
33766 ///
33767 /// * *$.xgafv* (query-string) - V1 error format.
33768 /// * *access_token* (query-string) - OAuth access token.
33769 /// * *alt* (query-string) - Data format for response.
33770 /// * *callback* (query-string) - JSONP
33771 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33772 /// * *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.
33773 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33774 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33775 /// * *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.
33776 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33777 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33778 pub fn param<T>(mut self, name: T, value: T) -> SmarttapInsertCall<'a, C>
33779 where
33780 T: AsRef<str>,
33781 {
33782 self._additional_params
33783 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33784 self
33785 }
33786
33787 /// Identifies the authorization scope for the method you are building.
33788 ///
33789 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33790 /// [`Scope::WalletObjectIssuer`].
33791 ///
33792 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33793 /// tokens for more than one scope.
33794 ///
33795 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33796 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33797 /// sufficient, a read-write scope will do as well.
33798 pub fn add_scope<St>(mut self, scope: St) -> SmarttapInsertCall<'a, C>
33799 where
33800 St: AsRef<str>,
33801 {
33802 self._scopes.insert(String::from(scope.as_ref()));
33803 self
33804 }
33805 /// Identifies the authorization scope(s) for the method you are building.
33806 ///
33807 /// See [`Self::add_scope()`] for details.
33808 pub fn add_scopes<I, St>(mut self, scopes: I) -> SmarttapInsertCall<'a, C>
33809 where
33810 I: IntoIterator<Item = St>,
33811 St: AsRef<str>,
33812 {
33813 self._scopes
33814 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33815 self
33816 }
33817
33818 /// Removes all scopes, and no default scope will be used either.
33819 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33820 /// for details).
33821 pub fn clear_scopes(mut self) -> SmarttapInsertCall<'a, C> {
33822 self._scopes.clear();
33823 self
33824 }
33825}
33826
33827/// Adds a message to the transit class referenced by the given class ID.
33828///
33829/// A builder for the *addmessage* method supported by a *transitclas* resource.
33830/// It is not used directly, but through a [`TransitclasMethods`] instance.
33831///
33832/// # Example
33833///
33834/// Instantiate a resource method builder
33835///
33836/// ```test_harness,no_run
33837/// # extern crate hyper;
33838/// # extern crate hyper_rustls;
33839/// # extern crate google_walletobjects1 as walletobjects1;
33840/// use walletobjects1::api::AddMessageRequest;
33841/// # async fn dox() {
33842/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33843///
33844/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33845/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33846/// # secret,
33847/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33848/// # ).build().await.unwrap();
33849///
33850/// # let client = hyper_util::client::legacy::Client::builder(
33851/// # hyper_util::rt::TokioExecutor::new()
33852/// # )
33853/// # .build(
33854/// # hyper_rustls::HttpsConnectorBuilder::new()
33855/// # .with_native_roots()
33856/// # .unwrap()
33857/// # .https_or_http()
33858/// # .enable_http1()
33859/// # .build()
33860/// # );
33861/// # let mut hub = Walletobjects::new(client, auth);
33862/// // As the method needs a request, you would usually fill it with the desired information
33863/// // into the respective structure. Some of the parts shown here might not be applicable !
33864/// // Values shown here are possibly random and not representative !
33865/// let mut req = AddMessageRequest::default();
33866///
33867/// // You can configure optional parameters by calling the respective setters at will, and
33868/// // execute the final call using `doit()`.
33869/// // Values shown here are possibly random and not representative !
33870/// let result = hub.transitclass().addmessage(req, "resourceId")
33871/// .doit().await;
33872/// # }
33873/// ```
33874pub struct TransitclasAddmessageCall<'a, C>
33875where
33876 C: 'a,
33877{
33878 hub: &'a Walletobjects<C>,
33879 _request: AddMessageRequest,
33880 _resource_id: String,
33881 _delegate: Option<&'a mut dyn common::Delegate>,
33882 _additional_params: HashMap<String, String>,
33883 _scopes: BTreeSet<String>,
33884}
33885
33886impl<'a, C> common::CallBuilder for TransitclasAddmessageCall<'a, C> {}
33887
33888impl<'a, C> TransitclasAddmessageCall<'a, C>
33889where
33890 C: common::Connector,
33891{
33892 /// Perform the operation you have build so far.
33893 pub async fn doit(
33894 mut self,
33895 ) -> common::Result<(common::Response, TransitClassAddMessageResponse)> {
33896 use std::borrow::Cow;
33897 use std::io::{Read, Seek};
33898
33899 use common::{url::Params, ToParts};
33900 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33901
33902 let mut dd = common::DefaultDelegate;
33903 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33904 dlg.begin(common::MethodInfo {
33905 id: "walletobjects.transitclass.addmessage",
33906 http_method: hyper::Method::POST,
33907 });
33908
33909 for &field in ["alt", "resourceId"].iter() {
33910 if self._additional_params.contains_key(field) {
33911 dlg.finished(false);
33912 return Err(common::Error::FieldClash(field));
33913 }
33914 }
33915
33916 let mut params = Params::with_capacity(4 + self._additional_params.len());
33917 params.push("resourceId", self._resource_id);
33918
33919 params.extend(self._additional_params.iter());
33920
33921 params.push("alt", "json");
33922 let mut url =
33923 self.hub._base_url.clone() + "walletobjects/v1/transitClass/{resourceId}/addMessage";
33924 if self._scopes.is_empty() {
33925 self._scopes
33926 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
33927 }
33928
33929 #[allow(clippy::single_element_loop)]
33930 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
33931 url = params.uri_replacement(url, param_name, find_this, false);
33932 }
33933 {
33934 let to_remove = ["resourceId"];
33935 params.remove_params(&to_remove);
33936 }
33937
33938 let url = params.parse_with_url(&url);
33939
33940 let mut json_mime_type = mime::APPLICATION_JSON;
33941 let mut request_value_reader = {
33942 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33943 common::remove_json_null_values(&mut value);
33944 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33945 serde_json::to_writer(&mut dst, &value).unwrap();
33946 dst
33947 };
33948 let request_size = request_value_reader
33949 .seek(std::io::SeekFrom::End(0))
33950 .unwrap();
33951 request_value_reader
33952 .seek(std::io::SeekFrom::Start(0))
33953 .unwrap();
33954
33955 loop {
33956 let token = match self
33957 .hub
33958 .auth
33959 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33960 .await
33961 {
33962 Ok(token) => token,
33963 Err(e) => match dlg.token(e) {
33964 Ok(token) => token,
33965 Err(e) => {
33966 dlg.finished(false);
33967 return Err(common::Error::MissingToken(e));
33968 }
33969 },
33970 };
33971 request_value_reader
33972 .seek(std::io::SeekFrom::Start(0))
33973 .unwrap();
33974 let mut req_result = {
33975 let client = &self.hub.client;
33976 dlg.pre_request();
33977 let mut req_builder = hyper::Request::builder()
33978 .method(hyper::Method::POST)
33979 .uri(url.as_str())
33980 .header(USER_AGENT, self.hub._user_agent.clone());
33981
33982 if let Some(token) = token.as_ref() {
33983 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33984 }
33985
33986 let request = req_builder
33987 .header(CONTENT_TYPE, json_mime_type.to_string())
33988 .header(CONTENT_LENGTH, request_size as u64)
33989 .body(common::to_body(
33990 request_value_reader.get_ref().clone().into(),
33991 ));
33992
33993 client.request(request.unwrap()).await
33994 };
33995
33996 match req_result {
33997 Err(err) => {
33998 if let common::Retry::After(d) = dlg.http_error(&err) {
33999 sleep(d).await;
34000 continue;
34001 }
34002 dlg.finished(false);
34003 return Err(common::Error::HttpError(err));
34004 }
34005 Ok(res) => {
34006 let (mut parts, body) = res.into_parts();
34007 let mut body = common::Body::new(body);
34008 if !parts.status.is_success() {
34009 let bytes = common::to_bytes(body).await.unwrap_or_default();
34010 let error = serde_json::from_str(&common::to_string(&bytes));
34011 let response = common::to_response(parts, bytes.into());
34012
34013 if let common::Retry::After(d) =
34014 dlg.http_failure(&response, error.as_ref().ok())
34015 {
34016 sleep(d).await;
34017 continue;
34018 }
34019
34020 dlg.finished(false);
34021
34022 return Err(match error {
34023 Ok(value) => common::Error::BadRequest(value),
34024 _ => common::Error::Failure(response),
34025 });
34026 }
34027 let response = {
34028 let bytes = common::to_bytes(body).await.unwrap_or_default();
34029 let encoded = common::to_string(&bytes);
34030 match serde_json::from_str(&encoded) {
34031 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34032 Err(error) => {
34033 dlg.response_json_decode_error(&encoded, &error);
34034 return Err(common::Error::JsonDecodeError(
34035 encoded.to_string(),
34036 error,
34037 ));
34038 }
34039 }
34040 };
34041
34042 dlg.finished(true);
34043 return Ok(response);
34044 }
34045 }
34046 }
34047 }
34048
34049 ///
34050 /// Sets the *request* property to the given value.
34051 ///
34052 /// Even though the property as already been set when instantiating this call,
34053 /// we provide this method for API completeness.
34054 pub fn request(mut self, new_value: AddMessageRequest) -> TransitclasAddmessageCall<'a, C> {
34055 self._request = new_value;
34056 self
34057 }
34058 /// 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 '-'.
34059 ///
34060 /// Sets the *resource id* path property to the given value.
34061 ///
34062 /// Even though the property as already been set when instantiating this call,
34063 /// we provide this method for API completeness.
34064 pub fn resource_id(mut self, new_value: &str) -> TransitclasAddmessageCall<'a, C> {
34065 self._resource_id = new_value.to_string();
34066 self
34067 }
34068 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34069 /// while executing the actual API request.
34070 ///
34071 /// ````text
34072 /// It should be used to handle progress information, and to implement a certain level of resilience.
34073 /// ````
34074 ///
34075 /// Sets the *delegate* property to the given value.
34076 pub fn delegate(
34077 mut self,
34078 new_value: &'a mut dyn common::Delegate,
34079 ) -> TransitclasAddmessageCall<'a, C> {
34080 self._delegate = Some(new_value);
34081 self
34082 }
34083
34084 /// Set any additional parameter of the query string used in the request.
34085 /// It should be used to set parameters which are not yet available through their own
34086 /// setters.
34087 ///
34088 /// Please note that this method must not be used to set any of the known parameters
34089 /// which have their own setter method. If done anyway, the request will fail.
34090 ///
34091 /// # Additional Parameters
34092 ///
34093 /// * *$.xgafv* (query-string) - V1 error format.
34094 /// * *access_token* (query-string) - OAuth access token.
34095 /// * *alt* (query-string) - Data format for response.
34096 /// * *callback* (query-string) - JSONP
34097 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34098 /// * *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.
34099 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34100 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34101 /// * *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.
34102 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34103 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34104 pub fn param<T>(mut self, name: T, value: T) -> TransitclasAddmessageCall<'a, C>
34105 where
34106 T: AsRef<str>,
34107 {
34108 self._additional_params
34109 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34110 self
34111 }
34112
34113 /// Identifies the authorization scope for the method you are building.
34114 ///
34115 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34116 /// [`Scope::WalletObjectIssuer`].
34117 ///
34118 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34119 /// tokens for more than one scope.
34120 ///
34121 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34122 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34123 /// sufficient, a read-write scope will do as well.
34124 pub fn add_scope<St>(mut self, scope: St) -> TransitclasAddmessageCall<'a, C>
34125 where
34126 St: AsRef<str>,
34127 {
34128 self._scopes.insert(String::from(scope.as_ref()));
34129 self
34130 }
34131 /// Identifies the authorization scope(s) for the method you are building.
34132 ///
34133 /// See [`Self::add_scope()`] for details.
34134 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasAddmessageCall<'a, C>
34135 where
34136 I: IntoIterator<Item = St>,
34137 St: AsRef<str>,
34138 {
34139 self._scopes
34140 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34141 self
34142 }
34143
34144 /// Removes all scopes, and no default scope will be used either.
34145 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34146 /// for details).
34147 pub fn clear_scopes(mut self) -> TransitclasAddmessageCall<'a, C> {
34148 self._scopes.clear();
34149 self
34150 }
34151}
34152
34153/// Returns the transit class with the given class ID.
34154///
34155/// A builder for the *get* method supported by a *transitclas* resource.
34156/// It is not used directly, but through a [`TransitclasMethods`] instance.
34157///
34158/// # Example
34159///
34160/// Instantiate a resource method builder
34161///
34162/// ```test_harness,no_run
34163/// # extern crate hyper;
34164/// # extern crate hyper_rustls;
34165/// # extern crate google_walletobjects1 as walletobjects1;
34166/// # async fn dox() {
34167/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34168///
34169/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34170/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34171/// # secret,
34172/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34173/// # ).build().await.unwrap();
34174///
34175/// # let client = hyper_util::client::legacy::Client::builder(
34176/// # hyper_util::rt::TokioExecutor::new()
34177/// # )
34178/// # .build(
34179/// # hyper_rustls::HttpsConnectorBuilder::new()
34180/// # .with_native_roots()
34181/// # .unwrap()
34182/// # .https_or_http()
34183/// # .enable_http1()
34184/// # .build()
34185/// # );
34186/// # let mut hub = Walletobjects::new(client, auth);
34187/// // You can configure optional parameters by calling the respective setters at will, and
34188/// // execute the final call using `doit()`.
34189/// // Values shown here are possibly random and not representative !
34190/// let result = hub.transitclass().get("resourceId")
34191/// .doit().await;
34192/// # }
34193/// ```
34194pub struct TransitclasGetCall<'a, C>
34195where
34196 C: 'a,
34197{
34198 hub: &'a Walletobjects<C>,
34199 _resource_id: String,
34200 _delegate: Option<&'a mut dyn common::Delegate>,
34201 _additional_params: HashMap<String, String>,
34202 _scopes: BTreeSet<String>,
34203}
34204
34205impl<'a, C> common::CallBuilder for TransitclasGetCall<'a, C> {}
34206
34207impl<'a, C> TransitclasGetCall<'a, C>
34208where
34209 C: common::Connector,
34210{
34211 /// Perform the operation you have build so far.
34212 pub async fn doit(mut self) -> common::Result<(common::Response, TransitClass)> {
34213 use std::borrow::Cow;
34214 use std::io::{Read, Seek};
34215
34216 use common::{url::Params, ToParts};
34217 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34218
34219 let mut dd = common::DefaultDelegate;
34220 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34221 dlg.begin(common::MethodInfo {
34222 id: "walletobjects.transitclass.get",
34223 http_method: hyper::Method::GET,
34224 });
34225
34226 for &field in ["alt", "resourceId"].iter() {
34227 if self._additional_params.contains_key(field) {
34228 dlg.finished(false);
34229 return Err(common::Error::FieldClash(field));
34230 }
34231 }
34232
34233 let mut params = Params::with_capacity(3 + self._additional_params.len());
34234 params.push("resourceId", self._resource_id);
34235
34236 params.extend(self._additional_params.iter());
34237
34238 params.push("alt", "json");
34239 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass/{resourceId}";
34240 if self._scopes.is_empty() {
34241 self._scopes
34242 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
34243 }
34244
34245 #[allow(clippy::single_element_loop)]
34246 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
34247 url = params.uri_replacement(url, param_name, find_this, false);
34248 }
34249 {
34250 let to_remove = ["resourceId"];
34251 params.remove_params(&to_remove);
34252 }
34253
34254 let url = params.parse_with_url(&url);
34255
34256 loop {
34257 let token = match self
34258 .hub
34259 .auth
34260 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34261 .await
34262 {
34263 Ok(token) => token,
34264 Err(e) => match dlg.token(e) {
34265 Ok(token) => token,
34266 Err(e) => {
34267 dlg.finished(false);
34268 return Err(common::Error::MissingToken(e));
34269 }
34270 },
34271 };
34272 let mut req_result = {
34273 let client = &self.hub.client;
34274 dlg.pre_request();
34275 let mut req_builder = hyper::Request::builder()
34276 .method(hyper::Method::GET)
34277 .uri(url.as_str())
34278 .header(USER_AGENT, self.hub._user_agent.clone());
34279
34280 if let Some(token) = token.as_ref() {
34281 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34282 }
34283
34284 let request = req_builder
34285 .header(CONTENT_LENGTH, 0_u64)
34286 .body(common::to_body::<String>(None));
34287
34288 client.request(request.unwrap()).await
34289 };
34290
34291 match req_result {
34292 Err(err) => {
34293 if let common::Retry::After(d) = dlg.http_error(&err) {
34294 sleep(d).await;
34295 continue;
34296 }
34297 dlg.finished(false);
34298 return Err(common::Error::HttpError(err));
34299 }
34300 Ok(res) => {
34301 let (mut parts, body) = res.into_parts();
34302 let mut body = common::Body::new(body);
34303 if !parts.status.is_success() {
34304 let bytes = common::to_bytes(body).await.unwrap_or_default();
34305 let error = serde_json::from_str(&common::to_string(&bytes));
34306 let response = common::to_response(parts, bytes.into());
34307
34308 if let common::Retry::After(d) =
34309 dlg.http_failure(&response, error.as_ref().ok())
34310 {
34311 sleep(d).await;
34312 continue;
34313 }
34314
34315 dlg.finished(false);
34316
34317 return Err(match error {
34318 Ok(value) => common::Error::BadRequest(value),
34319 _ => common::Error::Failure(response),
34320 });
34321 }
34322 let response = {
34323 let bytes = common::to_bytes(body).await.unwrap_or_default();
34324 let encoded = common::to_string(&bytes);
34325 match serde_json::from_str(&encoded) {
34326 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34327 Err(error) => {
34328 dlg.response_json_decode_error(&encoded, &error);
34329 return Err(common::Error::JsonDecodeError(
34330 encoded.to_string(),
34331 error,
34332 ));
34333 }
34334 }
34335 };
34336
34337 dlg.finished(true);
34338 return Ok(response);
34339 }
34340 }
34341 }
34342 }
34343
34344 /// 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 '-'.
34345 ///
34346 /// Sets the *resource id* path property to the given value.
34347 ///
34348 /// Even though the property as already been set when instantiating this call,
34349 /// we provide this method for API completeness.
34350 pub fn resource_id(mut self, new_value: &str) -> TransitclasGetCall<'a, C> {
34351 self._resource_id = new_value.to_string();
34352 self
34353 }
34354 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34355 /// while executing the actual API request.
34356 ///
34357 /// ````text
34358 /// It should be used to handle progress information, and to implement a certain level of resilience.
34359 /// ````
34360 ///
34361 /// Sets the *delegate* property to the given value.
34362 pub fn delegate(
34363 mut self,
34364 new_value: &'a mut dyn common::Delegate,
34365 ) -> TransitclasGetCall<'a, C> {
34366 self._delegate = Some(new_value);
34367 self
34368 }
34369
34370 /// Set any additional parameter of the query string used in the request.
34371 /// It should be used to set parameters which are not yet available through their own
34372 /// setters.
34373 ///
34374 /// Please note that this method must not be used to set any of the known parameters
34375 /// which have their own setter method. If done anyway, the request will fail.
34376 ///
34377 /// # Additional Parameters
34378 ///
34379 /// * *$.xgafv* (query-string) - V1 error format.
34380 /// * *access_token* (query-string) - OAuth access token.
34381 /// * *alt* (query-string) - Data format for response.
34382 /// * *callback* (query-string) - JSONP
34383 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34384 /// * *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.
34385 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34386 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34387 /// * *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.
34388 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34389 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34390 pub fn param<T>(mut self, name: T, value: T) -> TransitclasGetCall<'a, C>
34391 where
34392 T: AsRef<str>,
34393 {
34394 self._additional_params
34395 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34396 self
34397 }
34398
34399 /// Identifies the authorization scope for the method you are building.
34400 ///
34401 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34402 /// [`Scope::WalletObjectIssuer`].
34403 ///
34404 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34405 /// tokens for more than one scope.
34406 ///
34407 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34408 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34409 /// sufficient, a read-write scope will do as well.
34410 pub fn add_scope<St>(mut self, scope: St) -> TransitclasGetCall<'a, C>
34411 where
34412 St: AsRef<str>,
34413 {
34414 self._scopes.insert(String::from(scope.as_ref()));
34415 self
34416 }
34417 /// Identifies the authorization scope(s) for the method you are building.
34418 ///
34419 /// See [`Self::add_scope()`] for details.
34420 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasGetCall<'a, C>
34421 where
34422 I: IntoIterator<Item = St>,
34423 St: AsRef<str>,
34424 {
34425 self._scopes
34426 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34427 self
34428 }
34429
34430 /// Removes all scopes, and no default scope will be used either.
34431 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34432 /// for details).
34433 pub fn clear_scopes(mut self) -> TransitclasGetCall<'a, C> {
34434 self._scopes.clear();
34435 self
34436 }
34437}
34438
34439/// Inserts a transit class with the given ID and properties.
34440///
34441/// A builder for the *insert* method supported by a *transitclas* resource.
34442/// It is not used directly, but through a [`TransitclasMethods`] instance.
34443///
34444/// # Example
34445///
34446/// Instantiate a resource method builder
34447///
34448/// ```test_harness,no_run
34449/// # extern crate hyper;
34450/// # extern crate hyper_rustls;
34451/// # extern crate google_walletobjects1 as walletobjects1;
34452/// use walletobjects1::api::TransitClass;
34453/// # async fn dox() {
34454/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34455///
34456/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34457/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34458/// # secret,
34459/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34460/// # ).build().await.unwrap();
34461///
34462/// # let client = hyper_util::client::legacy::Client::builder(
34463/// # hyper_util::rt::TokioExecutor::new()
34464/// # )
34465/// # .build(
34466/// # hyper_rustls::HttpsConnectorBuilder::new()
34467/// # .with_native_roots()
34468/// # .unwrap()
34469/// # .https_or_http()
34470/// # .enable_http1()
34471/// # .build()
34472/// # );
34473/// # let mut hub = Walletobjects::new(client, auth);
34474/// // As the method needs a request, you would usually fill it with the desired information
34475/// // into the respective structure. Some of the parts shown here might not be applicable !
34476/// // Values shown here are possibly random and not representative !
34477/// let mut req = TransitClass::default();
34478///
34479/// // You can configure optional parameters by calling the respective setters at will, and
34480/// // execute the final call using `doit()`.
34481/// // Values shown here are possibly random and not representative !
34482/// let result = hub.transitclass().insert(req)
34483/// .doit().await;
34484/// # }
34485/// ```
34486pub struct TransitclasInsertCall<'a, C>
34487where
34488 C: 'a,
34489{
34490 hub: &'a Walletobjects<C>,
34491 _request: TransitClass,
34492 _delegate: Option<&'a mut dyn common::Delegate>,
34493 _additional_params: HashMap<String, String>,
34494 _scopes: BTreeSet<String>,
34495}
34496
34497impl<'a, C> common::CallBuilder for TransitclasInsertCall<'a, C> {}
34498
34499impl<'a, C> TransitclasInsertCall<'a, C>
34500where
34501 C: common::Connector,
34502{
34503 /// Perform the operation you have build so far.
34504 pub async fn doit(mut self) -> common::Result<(common::Response, TransitClass)> {
34505 use std::borrow::Cow;
34506 use std::io::{Read, Seek};
34507
34508 use common::{url::Params, ToParts};
34509 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34510
34511 let mut dd = common::DefaultDelegate;
34512 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34513 dlg.begin(common::MethodInfo {
34514 id: "walletobjects.transitclass.insert",
34515 http_method: hyper::Method::POST,
34516 });
34517
34518 for &field in ["alt"].iter() {
34519 if self._additional_params.contains_key(field) {
34520 dlg.finished(false);
34521 return Err(common::Error::FieldClash(field));
34522 }
34523 }
34524
34525 let mut params = Params::with_capacity(3 + self._additional_params.len());
34526
34527 params.extend(self._additional_params.iter());
34528
34529 params.push("alt", "json");
34530 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass";
34531 if self._scopes.is_empty() {
34532 self._scopes
34533 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
34534 }
34535
34536 let url = params.parse_with_url(&url);
34537
34538 let mut json_mime_type = mime::APPLICATION_JSON;
34539 let mut request_value_reader = {
34540 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34541 common::remove_json_null_values(&mut value);
34542 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34543 serde_json::to_writer(&mut dst, &value).unwrap();
34544 dst
34545 };
34546 let request_size = request_value_reader
34547 .seek(std::io::SeekFrom::End(0))
34548 .unwrap();
34549 request_value_reader
34550 .seek(std::io::SeekFrom::Start(0))
34551 .unwrap();
34552
34553 loop {
34554 let token = match self
34555 .hub
34556 .auth
34557 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34558 .await
34559 {
34560 Ok(token) => token,
34561 Err(e) => match dlg.token(e) {
34562 Ok(token) => token,
34563 Err(e) => {
34564 dlg.finished(false);
34565 return Err(common::Error::MissingToken(e));
34566 }
34567 },
34568 };
34569 request_value_reader
34570 .seek(std::io::SeekFrom::Start(0))
34571 .unwrap();
34572 let mut req_result = {
34573 let client = &self.hub.client;
34574 dlg.pre_request();
34575 let mut req_builder = hyper::Request::builder()
34576 .method(hyper::Method::POST)
34577 .uri(url.as_str())
34578 .header(USER_AGENT, self.hub._user_agent.clone());
34579
34580 if let Some(token) = token.as_ref() {
34581 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34582 }
34583
34584 let request = req_builder
34585 .header(CONTENT_TYPE, json_mime_type.to_string())
34586 .header(CONTENT_LENGTH, request_size as u64)
34587 .body(common::to_body(
34588 request_value_reader.get_ref().clone().into(),
34589 ));
34590
34591 client.request(request.unwrap()).await
34592 };
34593
34594 match req_result {
34595 Err(err) => {
34596 if let common::Retry::After(d) = dlg.http_error(&err) {
34597 sleep(d).await;
34598 continue;
34599 }
34600 dlg.finished(false);
34601 return Err(common::Error::HttpError(err));
34602 }
34603 Ok(res) => {
34604 let (mut parts, body) = res.into_parts();
34605 let mut body = common::Body::new(body);
34606 if !parts.status.is_success() {
34607 let bytes = common::to_bytes(body).await.unwrap_or_default();
34608 let error = serde_json::from_str(&common::to_string(&bytes));
34609 let response = common::to_response(parts, bytes.into());
34610
34611 if let common::Retry::After(d) =
34612 dlg.http_failure(&response, error.as_ref().ok())
34613 {
34614 sleep(d).await;
34615 continue;
34616 }
34617
34618 dlg.finished(false);
34619
34620 return Err(match error {
34621 Ok(value) => common::Error::BadRequest(value),
34622 _ => common::Error::Failure(response),
34623 });
34624 }
34625 let response = {
34626 let bytes = common::to_bytes(body).await.unwrap_or_default();
34627 let encoded = common::to_string(&bytes);
34628 match serde_json::from_str(&encoded) {
34629 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34630 Err(error) => {
34631 dlg.response_json_decode_error(&encoded, &error);
34632 return Err(common::Error::JsonDecodeError(
34633 encoded.to_string(),
34634 error,
34635 ));
34636 }
34637 }
34638 };
34639
34640 dlg.finished(true);
34641 return Ok(response);
34642 }
34643 }
34644 }
34645 }
34646
34647 ///
34648 /// Sets the *request* property to the given value.
34649 ///
34650 /// Even though the property as already been set when instantiating this call,
34651 /// we provide this method for API completeness.
34652 pub fn request(mut self, new_value: TransitClass) -> TransitclasInsertCall<'a, C> {
34653 self._request = new_value;
34654 self
34655 }
34656 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34657 /// while executing the actual API request.
34658 ///
34659 /// ````text
34660 /// It should be used to handle progress information, and to implement a certain level of resilience.
34661 /// ````
34662 ///
34663 /// Sets the *delegate* property to the given value.
34664 pub fn delegate(
34665 mut self,
34666 new_value: &'a mut dyn common::Delegate,
34667 ) -> TransitclasInsertCall<'a, C> {
34668 self._delegate = Some(new_value);
34669 self
34670 }
34671
34672 /// Set any additional parameter of the query string used in the request.
34673 /// It should be used to set parameters which are not yet available through their own
34674 /// setters.
34675 ///
34676 /// Please note that this method must not be used to set any of the known parameters
34677 /// which have their own setter method. If done anyway, the request will fail.
34678 ///
34679 /// # Additional Parameters
34680 ///
34681 /// * *$.xgafv* (query-string) - V1 error format.
34682 /// * *access_token* (query-string) - OAuth access token.
34683 /// * *alt* (query-string) - Data format for response.
34684 /// * *callback* (query-string) - JSONP
34685 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34686 /// * *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.
34687 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34688 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34689 /// * *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.
34690 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34691 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34692 pub fn param<T>(mut self, name: T, value: T) -> TransitclasInsertCall<'a, C>
34693 where
34694 T: AsRef<str>,
34695 {
34696 self._additional_params
34697 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34698 self
34699 }
34700
34701 /// Identifies the authorization scope for the method you are building.
34702 ///
34703 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34704 /// [`Scope::WalletObjectIssuer`].
34705 ///
34706 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34707 /// tokens for more than one scope.
34708 ///
34709 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34710 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34711 /// sufficient, a read-write scope will do as well.
34712 pub fn add_scope<St>(mut self, scope: St) -> TransitclasInsertCall<'a, C>
34713 where
34714 St: AsRef<str>,
34715 {
34716 self._scopes.insert(String::from(scope.as_ref()));
34717 self
34718 }
34719 /// Identifies the authorization scope(s) for the method you are building.
34720 ///
34721 /// See [`Self::add_scope()`] for details.
34722 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasInsertCall<'a, C>
34723 where
34724 I: IntoIterator<Item = St>,
34725 St: AsRef<str>,
34726 {
34727 self._scopes
34728 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34729 self
34730 }
34731
34732 /// Removes all scopes, and no default scope will be used either.
34733 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34734 /// for details).
34735 pub fn clear_scopes(mut self) -> TransitclasInsertCall<'a, C> {
34736 self._scopes.clear();
34737 self
34738 }
34739}
34740
34741/// Returns a list of all transit classes for a given issuer ID.
34742///
34743/// A builder for the *list* method supported by a *transitclas* resource.
34744/// It is not used directly, but through a [`TransitclasMethods`] instance.
34745///
34746/// # Example
34747///
34748/// Instantiate a resource method builder
34749///
34750/// ```test_harness,no_run
34751/// # extern crate hyper;
34752/// # extern crate hyper_rustls;
34753/// # extern crate google_walletobjects1 as walletobjects1;
34754/// # async fn dox() {
34755/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34756///
34757/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34758/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34759/// # secret,
34760/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34761/// # ).build().await.unwrap();
34762///
34763/// # let client = hyper_util::client::legacy::Client::builder(
34764/// # hyper_util::rt::TokioExecutor::new()
34765/// # )
34766/// # .build(
34767/// # hyper_rustls::HttpsConnectorBuilder::new()
34768/// # .with_native_roots()
34769/// # .unwrap()
34770/// # .https_or_http()
34771/// # .enable_http1()
34772/// # .build()
34773/// # );
34774/// # let mut hub = Walletobjects::new(client, auth);
34775/// // You can configure optional parameters by calling the respective setters at will, and
34776/// // execute the final call using `doit()`.
34777/// // Values shown here are possibly random and not representative !
34778/// let result = hub.transitclass().list()
34779/// .token("invidunt")
34780/// .max_results(-11)
34781/// .issuer_id(-7)
34782/// .doit().await;
34783/// # }
34784/// ```
34785pub struct TransitclasListCall<'a, C>
34786where
34787 C: 'a,
34788{
34789 hub: &'a Walletobjects<C>,
34790 _token: Option<String>,
34791 _max_results: Option<i32>,
34792 _issuer_id: Option<i64>,
34793 _delegate: Option<&'a mut dyn common::Delegate>,
34794 _additional_params: HashMap<String, String>,
34795 _scopes: BTreeSet<String>,
34796}
34797
34798impl<'a, C> common::CallBuilder for TransitclasListCall<'a, C> {}
34799
34800impl<'a, C> TransitclasListCall<'a, C>
34801where
34802 C: common::Connector,
34803{
34804 /// Perform the operation you have build so far.
34805 pub async fn doit(mut self) -> common::Result<(common::Response, TransitClassListResponse)> {
34806 use std::borrow::Cow;
34807 use std::io::{Read, Seek};
34808
34809 use common::{url::Params, ToParts};
34810 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34811
34812 let mut dd = common::DefaultDelegate;
34813 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34814 dlg.begin(common::MethodInfo {
34815 id: "walletobjects.transitclass.list",
34816 http_method: hyper::Method::GET,
34817 });
34818
34819 for &field in ["alt", "token", "maxResults", "issuerId"].iter() {
34820 if self._additional_params.contains_key(field) {
34821 dlg.finished(false);
34822 return Err(common::Error::FieldClash(field));
34823 }
34824 }
34825
34826 let mut params = Params::with_capacity(5 + self._additional_params.len());
34827 if let Some(value) = self._token.as_ref() {
34828 params.push("token", value);
34829 }
34830 if let Some(value) = self._max_results.as_ref() {
34831 params.push("maxResults", value.to_string());
34832 }
34833 if let Some(value) = self._issuer_id.as_ref() {
34834 params.push("issuerId", value.to_string());
34835 }
34836
34837 params.extend(self._additional_params.iter());
34838
34839 params.push("alt", "json");
34840 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass";
34841 if self._scopes.is_empty() {
34842 self._scopes
34843 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
34844 }
34845
34846 let url = params.parse_with_url(&url);
34847
34848 loop {
34849 let token = match self
34850 .hub
34851 .auth
34852 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34853 .await
34854 {
34855 Ok(token) => token,
34856 Err(e) => match dlg.token(e) {
34857 Ok(token) => token,
34858 Err(e) => {
34859 dlg.finished(false);
34860 return Err(common::Error::MissingToken(e));
34861 }
34862 },
34863 };
34864 let mut req_result = {
34865 let client = &self.hub.client;
34866 dlg.pre_request();
34867 let mut req_builder = hyper::Request::builder()
34868 .method(hyper::Method::GET)
34869 .uri(url.as_str())
34870 .header(USER_AGENT, self.hub._user_agent.clone());
34871
34872 if let Some(token) = token.as_ref() {
34873 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34874 }
34875
34876 let request = req_builder
34877 .header(CONTENT_LENGTH, 0_u64)
34878 .body(common::to_body::<String>(None));
34879
34880 client.request(request.unwrap()).await
34881 };
34882
34883 match req_result {
34884 Err(err) => {
34885 if let common::Retry::After(d) = dlg.http_error(&err) {
34886 sleep(d).await;
34887 continue;
34888 }
34889 dlg.finished(false);
34890 return Err(common::Error::HttpError(err));
34891 }
34892 Ok(res) => {
34893 let (mut parts, body) = res.into_parts();
34894 let mut body = common::Body::new(body);
34895 if !parts.status.is_success() {
34896 let bytes = common::to_bytes(body).await.unwrap_or_default();
34897 let error = serde_json::from_str(&common::to_string(&bytes));
34898 let response = common::to_response(parts, bytes.into());
34899
34900 if let common::Retry::After(d) =
34901 dlg.http_failure(&response, error.as_ref().ok())
34902 {
34903 sleep(d).await;
34904 continue;
34905 }
34906
34907 dlg.finished(false);
34908
34909 return Err(match error {
34910 Ok(value) => common::Error::BadRequest(value),
34911 _ => common::Error::Failure(response),
34912 });
34913 }
34914 let response = {
34915 let bytes = common::to_bytes(body).await.unwrap_or_default();
34916 let encoded = common::to_string(&bytes);
34917 match serde_json::from_str(&encoded) {
34918 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34919 Err(error) => {
34920 dlg.response_json_decode_error(&encoded, &error);
34921 return Err(common::Error::JsonDecodeError(
34922 encoded.to_string(),
34923 error,
34924 ));
34925 }
34926 }
34927 };
34928
34929 dlg.finished(true);
34930 return Ok(response);
34931 }
34932 }
34933 }
34934 }
34935
34936 /// 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.
34937 ///
34938 /// Sets the *token* query property to the given value.
34939 pub fn token(mut self, new_value: &str) -> TransitclasListCall<'a, C> {
34940 self._token = Some(new_value.to_string());
34941 self
34942 }
34943 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
34944 ///
34945 /// Sets the *max results* query property to the given value.
34946 pub fn max_results(mut self, new_value: i32) -> TransitclasListCall<'a, C> {
34947 self._max_results = Some(new_value);
34948 self
34949 }
34950 /// The ID of the issuer authorized to list classes.
34951 ///
34952 /// Sets the *issuer id* query property to the given value.
34953 pub fn issuer_id(mut self, new_value: i64) -> TransitclasListCall<'a, C> {
34954 self._issuer_id = Some(new_value);
34955 self
34956 }
34957 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34958 /// while executing the actual API request.
34959 ///
34960 /// ````text
34961 /// It should be used to handle progress information, and to implement a certain level of resilience.
34962 /// ````
34963 ///
34964 /// Sets the *delegate* property to the given value.
34965 pub fn delegate(
34966 mut self,
34967 new_value: &'a mut dyn common::Delegate,
34968 ) -> TransitclasListCall<'a, C> {
34969 self._delegate = Some(new_value);
34970 self
34971 }
34972
34973 /// Set any additional parameter of the query string used in the request.
34974 /// It should be used to set parameters which are not yet available through their own
34975 /// setters.
34976 ///
34977 /// Please note that this method must not be used to set any of the known parameters
34978 /// which have their own setter method. If done anyway, the request will fail.
34979 ///
34980 /// # Additional Parameters
34981 ///
34982 /// * *$.xgafv* (query-string) - V1 error format.
34983 /// * *access_token* (query-string) - OAuth access token.
34984 /// * *alt* (query-string) - Data format for response.
34985 /// * *callback* (query-string) - JSONP
34986 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34987 /// * *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.
34988 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34989 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34990 /// * *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.
34991 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34992 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34993 pub fn param<T>(mut self, name: T, value: T) -> TransitclasListCall<'a, C>
34994 where
34995 T: AsRef<str>,
34996 {
34997 self._additional_params
34998 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34999 self
35000 }
35001
35002 /// Identifies the authorization scope for the method you are building.
35003 ///
35004 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35005 /// [`Scope::WalletObjectIssuer`].
35006 ///
35007 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35008 /// tokens for more than one scope.
35009 ///
35010 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35011 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35012 /// sufficient, a read-write scope will do as well.
35013 pub fn add_scope<St>(mut self, scope: St) -> TransitclasListCall<'a, C>
35014 where
35015 St: AsRef<str>,
35016 {
35017 self._scopes.insert(String::from(scope.as_ref()));
35018 self
35019 }
35020 /// Identifies the authorization scope(s) for the method you are building.
35021 ///
35022 /// See [`Self::add_scope()`] for details.
35023 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasListCall<'a, C>
35024 where
35025 I: IntoIterator<Item = St>,
35026 St: AsRef<str>,
35027 {
35028 self._scopes
35029 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35030 self
35031 }
35032
35033 /// Removes all scopes, and no default scope will be used either.
35034 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35035 /// for details).
35036 pub fn clear_scopes(mut self) -> TransitclasListCall<'a, C> {
35037 self._scopes.clear();
35038 self
35039 }
35040}
35041
35042/// Updates the transit class referenced by the given class ID. This method supports patch semantics.
35043///
35044/// A builder for the *patch* method supported by a *transitclas* resource.
35045/// It is not used directly, but through a [`TransitclasMethods`] instance.
35046///
35047/// # Example
35048///
35049/// Instantiate a resource method builder
35050///
35051/// ```test_harness,no_run
35052/// # extern crate hyper;
35053/// # extern crate hyper_rustls;
35054/// # extern crate google_walletobjects1 as walletobjects1;
35055/// use walletobjects1::api::TransitClass;
35056/// # async fn dox() {
35057/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35058///
35059/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35060/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35061/// # secret,
35062/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35063/// # ).build().await.unwrap();
35064///
35065/// # let client = hyper_util::client::legacy::Client::builder(
35066/// # hyper_util::rt::TokioExecutor::new()
35067/// # )
35068/// # .build(
35069/// # hyper_rustls::HttpsConnectorBuilder::new()
35070/// # .with_native_roots()
35071/// # .unwrap()
35072/// # .https_or_http()
35073/// # .enable_http1()
35074/// # .build()
35075/// # );
35076/// # let mut hub = Walletobjects::new(client, auth);
35077/// // As the method needs a request, you would usually fill it with the desired information
35078/// // into the respective structure. Some of the parts shown here might not be applicable !
35079/// // Values shown here are possibly random and not representative !
35080/// let mut req = TransitClass::default();
35081///
35082/// // You can configure optional parameters by calling the respective setters at will, and
35083/// // execute the final call using `doit()`.
35084/// // Values shown here are possibly random and not representative !
35085/// let result = hub.transitclass().patch(req, "resourceId")
35086/// .doit().await;
35087/// # }
35088/// ```
35089pub struct TransitclasPatchCall<'a, C>
35090where
35091 C: 'a,
35092{
35093 hub: &'a Walletobjects<C>,
35094 _request: TransitClass,
35095 _resource_id: String,
35096 _delegate: Option<&'a mut dyn common::Delegate>,
35097 _additional_params: HashMap<String, String>,
35098 _scopes: BTreeSet<String>,
35099}
35100
35101impl<'a, C> common::CallBuilder for TransitclasPatchCall<'a, C> {}
35102
35103impl<'a, C> TransitclasPatchCall<'a, C>
35104where
35105 C: common::Connector,
35106{
35107 /// Perform the operation you have build so far.
35108 pub async fn doit(mut self) -> common::Result<(common::Response, TransitClass)> {
35109 use std::borrow::Cow;
35110 use std::io::{Read, Seek};
35111
35112 use common::{url::Params, ToParts};
35113 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35114
35115 let mut dd = common::DefaultDelegate;
35116 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35117 dlg.begin(common::MethodInfo {
35118 id: "walletobjects.transitclass.patch",
35119 http_method: hyper::Method::PATCH,
35120 });
35121
35122 for &field in ["alt", "resourceId"].iter() {
35123 if self._additional_params.contains_key(field) {
35124 dlg.finished(false);
35125 return Err(common::Error::FieldClash(field));
35126 }
35127 }
35128
35129 let mut params = Params::with_capacity(4 + self._additional_params.len());
35130 params.push("resourceId", self._resource_id);
35131
35132 params.extend(self._additional_params.iter());
35133
35134 params.push("alt", "json");
35135 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass/{resourceId}";
35136 if self._scopes.is_empty() {
35137 self._scopes
35138 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
35139 }
35140
35141 #[allow(clippy::single_element_loop)]
35142 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
35143 url = params.uri_replacement(url, param_name, find_this, false);
35144 }
35145 {
35146 let to_remove = ["resourceId"];
35147 params.remove_params(&to_remove);
35148 }
35149
35150 let url = params.parse_with_url(&url);
35151
35152 let mut json_mime_type = mime::APPLICATION_JSON;
35153 let mut request_value_reader = {
35154 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35155 common::remove_json_null_values(&mut value);
35156 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35157 serde_json::to_writer(&mut dst, &value).unwrap();
35158 dst
35159 };
35160 let request_size = request_value_reader
35161 .seek(std::io::SeekFrom::End(0))
35162 .unwrap();
35163 request_value_reader
35164 .seek(std::io::SeekFrom::Start(0))
35165 .unwrap();
35166
35167 loop {
35168 let token = match self
35169 .hub
35170 .auth
35171 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35172 .await
35173 {
35174 Ok(token) => token,
35175 Err(e) => match dlg.token(e) {
35176 Ok(token) => token,
35177 Err(e) => {
35178 dlg.finished(false);
35179 return Err(common::Error::MissingToken(e));
35180 }
35181 },
35182 };
35183 request_value_reader
35184 .seek(std::io::SeekFrom::Start(0))
35185 .unwrap();
35186 let mut req_result = {
35187 let client = &self.hub.client;
35188 dlg.pre_request();
35189 let mut req_builder = hyper::Request::builder()
35190 .method(hyper::Method::PATCH)
35191 .uri(url.as_str())
35192 .header(USER_AGENT, self.hub._user_agent.clone());
35193
35194 if let Some(token) = token.as_ref() {
35195 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35196 }
35197
35198 let request = req_builder
35199 .header(CONTENT_TYPE, json_mime_type.to_string())
35200 .header(CONTENT_LENGTH, request_size as u64)
35201 .body(common::to_body(
35202 request_value_reader.get_ref().clone().into(),
35203 ));
35204
35205 client.request(request.unwrap()).await
35206 };
35207
35208 match req_result {
35209 Err(err) => {
35210 if let common::Retry::After(d) = dlg.http_error(&err) {
35211 sleep(d).await;
35212 continue;
35213 }
35214 dlg.finished(false);
35215 return Err(common::Error::HttpError(err));
35216 }
35217 Ok(res) => {
35218 let (mut parts, body) = res.into_parts();
35219 let mut body = common::Body::new(body);
35220 if !parts.status.is_success() {
35221 let bytes = common::to_bytes(body).await.unwrap_or_default();
35222 let error = serde_json::from_str(&common::to_string(&bytes));
35223 let response = common::to_response(parts, bytes.into());
35224
35225 if let common::Retry::After(d) =
35226 dlg.http_failure(&response, error.as_ref().ok())
35227 {
35228 sleep(d).await;
35229 continue;
35230 }
35231
35232 dlg.finished(false);
35233
35234 return Err(match error {
35235 Ok(value) => common::Error::BadRequest(value),
35236 _ => common::Error::Failure(response),
35237 });
35238 }
35239 let response = {
35240 let bytes = common::to_bytes(body).await.unwrap_or_default();
35241 let encoded = common::to_string(&bytes);
35242 match serde_json::from_str(&encoded) {
35243 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35244 Err(error) => {
35245 dlg.response_json_decode_error(&encoded, &error);
35246 return Err(common::Error::JsonDecodeError(
35247 encoded.to_string(),
35248 error,
35249 ));
35250 }
35251 }
35252 };
35253
35254 dlg.finished(true);
35255 return Ok(response);
35256 }
35257 }
35258 }
35259 }
35260
35261 ///
35262 /// Sets the *request* property to the given value.
35263 ///
35264 /// Even though the property as already been set when instantiating this call,
35265 /// we provide this method for API completeness.
35266 pub fn request(mut self, new_value: TransitClass) -> TransitclasPatchCall<'a, C> {
35267 self._request = new_value;
35268 self
35269 }
35270 /// 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 '-'.
35271 ///
35272 /// Sets the *resource id* path property to the given value.
35273 ///
35274 /// Even though the property as already been set when instantiating this call,
35275 /// we provide this method for API completeness.
35276 pub fn resource_id(mut self, new_value: &str) -> TransitclasPatchCall<'a, C> {
35277 self._resource_id = new_value.to_string();
35278 self
35279 }
35280 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35281 /// while executing the actual API request.
35282 ///
35283 /// ````text
35284 /// It should be used to handle progress information, and to implement a certain level of resilience.
35285 /// ````
35286 ///
35287 /// Sets the *delegate* property to the given value.
35288 pub fn delegate(
35289 mut self,
35290 new_value: &'a mut dyn common::Delegate,
35291 ) -> TransitclasPatchCall<'a, C> {
35292 self._delegate = Some(new_value);
35293 self
35294 }
35295
35296 /// Set any additional parameter of the query string used in the request.
35297 /// It should be used to set parameters which are not yet available through their own
35298 /// setters.
35299 ///
35300 /// Please note that this method must not be used to set any of the known parameters
35301 /// which have their own setter method. If done anyway, the request will fail.
35302 ///
35303 /// # Additional Parameters
35304 ///
35305 /// * *$.xgafv* (query-string) - V1 error format.
35306 /// * *access_token* (query-string) - OAuth access token.
35307 /// * *alt* (query-string) - Data format for response.
35308 /// * *callback* (query-string) - JSONP
35309 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35310 /// * *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.
35311 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35312 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35313 /// * *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.
35314 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35315 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35316 pub fn param<T>(mut self, name: T, value: T) -> TransitclasPatchCall<'a, C>
35317 where
35318 T: AsRef<str>,
35319 {
35320 self._additional_params
35321 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35322 self
35323 }
35324
35325 /// Identifies the authorization scope for the method you are building.
35326 ///
35327 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35328 /// [`Scope::WalletObjectIssuer`].
35329 ///
35330 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35331 /// tokens for more than one scope.
35332 ///
35333 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35334 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35335 /// sufficient, a read-write scope will do as well.
35336 pub fn add_scope<St>(mut self, scope: St) -> TransitclasPatchCall<'a, C>
35337 where
35338 St: AsRef<str>,
35339 {
35340 self._scopes.insert(String::from(scope.as_ref()));
35341 self
35342 }
35343 /// Identifies the authorization scope(s) for the method you are building.
35344 ///
35345 /// See [`Self::add_scope()`] for details.
35346 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasPatchCall<'a, C>
35347 where
35348 I: IntoIterator<Item = St>,
35349 St: AsRef<str>,
35350 {
35351 self._scopes
35352 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35353 self
35354 }
35355
35356 /// Removes all scopes, and no default scope will be used either.
35357 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35358 /// for details).
35359 pub fn clear_scopes(mut self) -> TransitclasPatchCall<'a, C> {
35360 self._scopes.clear();
35361 self
35362 }
35363}
35364
35365/// Updates the transit class referenced by the given class ID.
35366///
35367/// A builder for the *update* method supported by a *transitclas* resource.
35368/// It is not used directly, but through a [`TransitclasMethods`] instance.
35369///
35370/// # Example
35371///
35372/// Instantiate a resource method builder
35373///
35374/// ```test_harness,no_run
35375/// # extern crate hyper;
35376/// # extern crate hyper_rustls;
35377/// # extern crate google_walletobjects1 as walletobjects1;
35378/// use walletobjects1::api::TransitClass;
35379/// # async fn dox() {
35380/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35381///
35382/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35383/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35384/// # secret,
35385/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35386/// # ).build().await.unwrap();
35387///
35388/// # let client = hyper_util::client::legacy::Client::builder(
35389/// # hyper_util::rt::TokioExecutor::new()
35390/// # )
35391/// # .build(
35392/// # hyper_rustls::HttpsConnectorBuilder::new()
35393/// # .with_native_roots()
35394/// # .unwrap()
35395/// # .https_or_http()
35396/// # .enable_http1()
35397/// # .build()
35398/// # );
35399/// # let mut hub = Walletobjects::new(client, auth);
35400/// // As the method needs a request, you would usually fill it with the desired information
35401/// // into the respective structure. Some of the parts shown here might not be applicable !
35402/// // Values shown here are possibly random and not representative !
35403/// let mut req = TransitClass::default();
35404///
35405/// // You can configure optional parameters by calling the respective setters at will, and
35406/// // execute the final call using `doit()`.
35407/// // Values shown here are possibly random and not representative !
35408/// let result = hub.transitclass().update(req, "resourceId")
35409/// .doit().await;
35410/// # }
35411/// ```
35412pub struct TransitclasUpdateCall<'a, C>
35413where
35414 C: 'a,
35415{
35416 hub: &'a Walletobjects<C>,
35417 _request: TransitClass,
35418 _resource_id: String,
35419 _delegate: Option<&'a mut dyn common::Delegate>,
35420 _additional_params: HashMap<String, String>,
35421 _scopes: BTreeSet<String>,
35422}
35423
35424impl<'a, C> common::CallBuilder for TransitclasUpdateCall<'a, C> {}
35425
35426impl<'a, C> TransitclasUpdateCall<'a, C>
35427where
35428 C: common::Connector,
35429{
35430 /// Perform the operation you have build so far.
35431 pub async fn doit(mut self) -> common::Result<(common::Response, TransitClass)> {
35432 use std::borrow::Cow;
35433 use std::io::{Read, Seek};
35434
35435 use common::{url::Params, ToParts};
35436 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35437
35438 let mut dd = common::DefaultDelegate;
35439 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35440 dlg.begin(common::MethodInfo {
35441 id: "walletobjects.transitclass.update",
35442 http_method: hyper::Method::PUT,
35443 });
35444
35445 for &field in ["alt", "resourceId"].iter() {
35446 if self._additional_params.contains_key(field) {
35447 dlg.finished(false);
35448 return Err(common::Error::FieldClash(field));
35449 }
35450 }
35451
35452 let mut params = Params::with_capacity(4 + self._additional_params.len());
35453 params.push("resourceId", self._resource_id);
35454
35455 params.extend(self._additional_params.iter());
35456
35457 params.push("alt", "json");
35458 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitClass/{resourceId}";
35459 if self._scopes.is_empty() {
35460 self._scopes
35461 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
35462 }
35463
35464 #[allow(clippy::single_element_loop)]
35465 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
35466 url = params.uri_replacement(url, param_name, find_this, false);
35467 }
35468 {
35469 let to_remove = ["resourceId"];
35470 params.remove_params(&to_remove);
35471 }
35472
35473 let url = params.parse_with_url(&url);
35474
35475 let mut json_mime_type = mime::APPLICATION_JSON;
35476 let mut request_value_reader = {
35477 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35478 common::remove_json_null_values(&mut value);
35479 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35480 serde_json::to_writer(&mut dst, &value).unwrap();
35481 dst
35482 };
35483 let request_size = request_value_reader
35484 .seek(std::io::SeekFrom::End(0))
35485 .unwrap();
35486 request_value_reader
35487 .seek(std::io::SeekFrom::Start(0))
35488 .unwrap();
35489
35490 loop {
35491 let token = match self
35492 .hub
35493 .auth
35494 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35495 .await
35496 {
35497 Ok(token) => token,
35498 Err(e) => match dlg.token(e) {
35499 Ok(token) => token,
35500 Err(e) => {
35501 dlg.finished(false);
35502 return Err(common::Error::MissingToken(e));
35503 }
35504 },
35505 };
35506 request_value_reader
35507 .seek(std::io::SeekFrom::Start(0))
35508 .unwrap();
35509 let mut req_result = {
35510 let client = &self.hub.client;
35511 dlg.pre_request();
35512 let mut req_builder = hyper::Request::builder()
35513 .method(hyper::Method::PUT)
35514 .uri(url.as_str())
35515 .header(USER_AGENT, self.hub._user_agent.clone());
35516
35517 if let Some(token) = token.as_ref() {
35518 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35519 }
35520
35521 let request = req_builder
35522 .header(CONTENT_TYPE, json_mime_type.to_string())
35523 .header(CONTENT_LENGTH, request_size as u64)
35524 .body(common::to_body(
35525 request_value_reader.get_ref().clone().into(),
35526 ));
35527
35528 client.request(request.unwrap()).await
35529 };
35530
35531 match req_result {
35532 Err(err) => {
35533 if let common::Retry::After(d) = dlg.http_error(&err) {
35534 sleep(d).await;
35535 continue;
35536 }
35537 dlg.finished(false);
35538 return Err(common::Error::HttpError(err));
35539 }
35540 Ok(res) => {
35541 let (mut parts, body) = res.into_parts();
35542 let mut body = common::Body::new(body);
35543 if !parts.status.is_success() {
35544 let bytes = common::to_bytes(body).await.unwrap_or_default();
35545 let error = serde_json::from_str(&common::to_string(&bytes));
35546 let response = common::to_response(parts, bytes.into());
35547
35548 if let common::Retry::After(d) =
35549 dlg.http_failure(&response, error.as_ref().ok())
35550 {
35551 sleep(d).await;
35552 continue;
35553 }
35554
35555 dlg.finished(false);
35556
35557 return Err(match error {
35558 Ok(value) => common::Error::BadRequest(value),
35559 _ => common::Error::Failure(response),
35560 });
35561 }
35562 let response = {
35563 let bytes = common::to_bytes(body).await.unwrap_or_default();
35564 let encoded = common::to_string(&bytes);
35565 match serde_json::from_str(&encoded) {
35566 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35567 Err(error) => {
35568 dlg.response_json_decode_error(&encoded, &error);
35569 return Err(common::Error::JsonDecodeError(
35570 encoded.to_string(),
35571 error,
35572 ));
35573 }
35574 }
35575 };
35576
35577 dlg.finished(true);
35578 return Ok(response);
35579 }
35580 }
35581 }
35582 }
35583
35584 ///
35585 /// Sets the *request* property to the given value.
35586 ///
35587 /// Even though the property as already been set when instantiating this call,
35588 /// we provide this method for API completeness.
35589 pub fn request(mut self, new_value: TransitClass) -> TransitclasUpdateCall<'a, C> {
35590 self._request = new_value;
35591 self
35592 }
35593 /// 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 '-'.
35594 ///
35595 /// Sets the *resource id* path property to the given value.
35596 ///
35597 /// Even though the property as already been set when instantiating this call,
35598 /// we provide this method for API completeness.
35599 pub fn resource_id(mut self, new_value: &str) -> TransitclasUpdateCall<'a, C> {
35600 self._resource_id = new_value.to_string();
35601 self
35602 }
35603 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35604 /// while executing the actual API request.
35605 ///
35606 /// ````text
35607 /// It should be used to handle progress information, and to implement a certain level of resilience.
35608 /// ````
35609 ///
35610 /// Sets the *delegate* property to the given value.
35611 pub fn delegate(
35612 mut self,
35613 new_value: &'a mut dyn common::Delegate,
35614 ) -> TransitclasUpdateCall<'a, C> {
35615 self._delegate = Some(new_value);
35616 self
35617 }
35618
35619 /// Set any additional parameter of the query string used in the request.
35620 /// It should be used to set parameters which are not yet available through their own
35621 /// setters.
35622 ///
35623 /// Please note that this method must not be used to set any of the known parameters
35624 /// which have their own setter method. If done anyway, the request will fail.
35625 ///
35626 /// # Additional Parameters
35627 ///
35628 /// * *$.xgafv* (query-string) - V1 error format.
35629 /// * *access_token* (query-string) - OAuth access token.
35630 /// * *alt* (query-string) - Data format for response.
35631 /// * *callback* (query-string) - JSONP
35632 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35633 /// * *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.
35634 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35635 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35636 /// * *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.
35637 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35638 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35639 pub fn param<T>(mut self, name: T, value: T) -> TransitclasUpdateCall<'a, C>
35640 where
35641 T: AsRef<str>,
35642 {
35643 self._additional_params
35644 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35645 self
35646 }
35647
35648 /// Identifies the authorization scope for the method you are building.
35649 ///
35650 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35651 /// [`Scope::WalletObjectIssuer`].
35652 ///
35653 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35654 /// tokens for more than one scope.
35655 ///
35656 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35657 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35658 /// sufficient, a read-write scope will do as well.
35659 pub fn add_scope<St>(mut self, scope: St) -> TransitclasUpdateCall<'a, C>
35660 where
35661 St: AsRef<str>,
35662 {
35663 self._scopes.insert(String::from(scope.as_ref()));
35664 self
35665 }
35666 /// Identifies the authorization scope(s) for the method you are building.
35667 ///
35668 /// See [`Self::add_scope()`] for details.
35669 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitclasUpdateCall<'a, C>
35670 where
35671 I: IntoIterator<Item = St>,
35672 St: AsRef<str>,
35673 {
35674 self._scopes
35675 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35676 self
35677 }
35678
35679 /// Removes all scopes, and no default scope will be used either.
35680 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35681 /// for details).
35682 pub fn clear_scopes(mut self) -> TransitclasUpdateCall<'a, C> {
35683 self._scopes.clear();
35684 self
35685 }
35686}
35687
35688/// Adds a message to the transit object referenced by the given object ID.
35689///
35690/// A builder for the *addmessage* method supported by a *transitobject* resource.
35691/// It is not used directly, but through a [`TransitobjectMethods`] instance.
35692///
35693/// # Example
35694///
35695/// Instantiate a resource method builder
35696///
35697/// ```test_harness,no_run
35698/// # extern crate hyper;
35699/// # extern crate hyper_rustls;
35700/// # extern crate google_walletobjects1 as walletobjects1;
35701/// use walletobjects1::api::AddMessageRequest;
35702/// # async fn dox() {
35703/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35704///
35705/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35706/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35707/// # secret,
35708/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35709/// # ).build().await.unwrap();
35710///
35711/// # let client = hyper_util::client::legacy::Client::builder(
35712/// # hyper_util::rt::TokioExecutor::new()
35713/// # )
35714/// # .build(
35715/// # hyper_rustls::HttpsConnectorBuilder::new()
35716/// # .with_native_roots()
35717/// # .unwrap()
35718/// # .https_or_http()
35719/// # .enable_http1()
35720/// # .build()
35721/// # );
35722/// # let mut hub = Walletobjects::new(client, auth);
35723/// // As the method needs a request, you would usually fill it with the desired information
35724/// // into the respective structure. Some of the parts shown here might not be applicable !
35725/// // Values shown here are possibly random and not representative !
35726/// let mut req = AddMessageRequest::default();
35727///
35728/// // You can configure optional parameters by calling the respective setters at will, and
35729/// // execute the final call using `doit()`.
35730/// // Values shown here are possibly random and not representative !
35731/// let result = hub.transitobject().addmessage(req, "resourceId")
35732/// .doit().await;
35733/// # }
35734/// ```
35735pub struct TransitobjectAddmessageCall<'a, C>
35736where
35737 C: 'a,
35738{
35739 hub: &'a Walletobjects<C>,
35740 _request: AddMessageRequest,
35741 _resource_id: String,
35742 _delegate: Option<&'a mut dyn common::Delegate>,
35743 _additional_params: HashMap<String, String>,
35744 _scopes: BTreeSet<String>,
35745}
35746
35747impl<'a, C> common::CallBuilder for TransitobjectAddmessageCall<'a, C> {}
35748
35749impl<'a, C> TransitobjectAddmessageCall<'a, C>
35750where
35751 C: common::Connector,
35752{
35753 /// Perform the operation you have build so far.
35754 pub async fn doit(
35755 mut self,
35756 ) -> common::Result<(common::Response, TransitObjectAddMessageResponse)> {
35757 use std::borrow::Cow;
35758 use std::io::{Read, Seek};
35759
35760 use common::{url::Params, ToParts};
35761 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35762
35763 let mut dd = common::DefaultDelegate;
35764 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35765 dlg.begin(common::MethodInfo {
35766 id: "walletobjects.transitobject.addmessage",
35767 http_method: hyper::Method::POST,
35768 });
35769
35770 for &field in ["alt", "resourceId"].iter() {
35771 if self._additional_params.contains_key(field) {
35772 dlg.finished(false);
35773 return Err(common::Error::FieldClash(field));
35774 }
35775 }
35776
35777 let mut params = Params::with_capacity(4 + self._additional_params.len());
35778 params.push("resourceId", self._resource_id);
35779
35780 params.extend(self._additional_params.iter());
35781
35782 params.push("alt", "json");
35783 let mut url =
35784 self.hub._base_url.clone() + "walletobjects/v1/transitObject/{resourceId}/addMessage";
35785 if self._scopes.is_empty() {
35786 self._scopes
35787 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
35788 }
35789
35790 #[allow(clippy::single_element_loop)]
35791 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
35792 url = params.uri_replacement(url, param_name, find_this, false);
35793 }
35794 {
35795 let to_remove = ["resourceId"];
35796 params.remove_params(&to_remove);
35797 }
35798
35799 let url = params.parse_with_url(&url);
35800
35801 let mut json_mime_type = mime::APPLICATION_JSON;
35802 let mut request_value_reader = {
35803 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35804 common::remove_json_null_values(&mut value);
35805 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35806 serde_json::to_writer(&mut dst, &value).unwrap();
35807 dst
35808 };
35809 let request_size = request_value_reader
35810 .seek(std::io::SeekFrom::End(0))
35811 .unwrap();
35812 request_value_reader
35813 .seek(std::io::SeekFrom::Start(0))
35814 .unwrap();
35815
35816 loop {
35817 let token = match self
35818 .hub
35819 .auth
35820 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35821 .await
35822 {
35823 Ok(token) => token,
35824 Err(e) => match dlg.token(e) {
35825 Ok(token) => token,
35826 Err(e) => {
35827 dlg.finished(false);
35828 return Err(common::Error::MissingToken(e));
35829 }
35830 },
35831 };
35832 request_value_reader
35833 .seek(std::io::SeekFrom::Start(0))
35834 .unwrap();
35835 let mut req_result = {
35836 let client = &self.hub.client;
35837 dlg.pre_request();
35838 let mut req_builder = hyper::Request::builder()
35839 .method(hyper::Method::POST)
35840 .uri(url.as_str())
35841 .header(USER_AGENT, self.hub._user_agent.clone());
35842
35843 if let Some(token) = token.as_ref() {
35844 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35845 }
35846
35847 let request = req_builder
35848 .header(CONTENT_TYPE, json_mime_type.to_string())
35849 .header(CONTENT_LENGTH, request_size as u64)
35850 .body(common::to_body(
35851 request_value_reader.get_ref().clone().into(),
35852 ));
35853
35854 client.request(request.unwrap()).await
35855 };
35856
35857 match req_result {
35858 Err(err) => {
35859 if let common::Retry::After(d) = dlg.http_error(&err) {
35860 sleep(d).await;
35861 continue;
35862 }
35863 dlg.finished(false);
35864 return Err(common::Error::HttpError(err));
35865 }
35866 Ok(res) => {
35867 let (mut parts, body) = res.into_parts();
35868 let mut body = common::Body::new(body);
35869 if !parts.status.is_success() {
35870 let bytes = common::to_bytes(body).await.unwrap_or_default();
35871 let error = serde_json::from_str(&common::to_string(&bytes));
35872 let response = common::to_response(parts, bytes.into());
35873
35874 if let common::Retry::After(d) =
35875 dlg.http_failure(&response, error.as_ref().ok())
35876 {
35877 sleep(d).await;
35878 continue;
35879 }
35880
35881 dlg.finished(false);
35882
35883 return Err(match error {
35884 Ok(value) => common::Error::BadRequest(value),
35885 _ => common::Error::Failure(response),
35886 });
35887 }
35888 let response = {
35889 let bytes = common::to_bytes(body).await.unwrap_or_default();
35890 let encoded = common::to_string(&bytes);
35891 match serde_json::from_str(&encoded) {
35892 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35893 Err(error) => {
35894 dlg.response_json_decode_error(&encoded, &error);
35895 return Err(common::Error::JsonDecodeError(
35896 encoded.to_string(),
35897 error,
35898 ));
35899 }
35900 }
35901 };
35902
35903 dlg.finished(true);
35904 return Ok(response);
35905 }
35906 }
35907 }
35908 }
35909
35910 ///
35911 /// Sets the *request* property to the given value.
35912 ///
35913 /// Even though the property as already been set when instantiating this call,
35914 /// we provide this method for API completeness.
35915 pub fn request(mut self, new_value: AddMessageRequest) -> TransitobjectAddmessageCall<'a, C> {
35916 self._request = new_value;
35917 self
35918 }
35919 /// 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 '-'.
35920 ///
35921 /// Sets the *resource id* path property to the given value.
35922 ///
35923 /// Even though the property as already been set when instantiating this call,
35924 /// we provide this method for API completeness.
35925 pub fn resource_id(mut self, new_value: &str) -> TransitobjectAddmessageCall<'a, C> {
35926 self._resource_id = new_value.to_string();
35927 self
35928 }
35929 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35930 /// while executing the actual API request.
35931 ///
35932 /// ````text
35933 /// It should be used to handle progress information, and to implement a certain level of resilience.
35934 /// ````
35935 ///
35936 /// Sets the *delegate* property to the given value.
35937 pub fn delegate(
35938 mut self,
35939 new_value: &'a mut dyn common::Delegate,
35940 ) -> TransitobjectAddmessageCall<'a, C> {
35941 self._delegate = Some(new_value);
35942 self
35943 }
35944
35945 /// Set any additional parameter of the query string used in the request.
35946 /// It should be used to set parameters which are not yet available through their own
35947 /// setters.
35948 ///
35949 /// Please note that this method must not be used to set any of the known parameters
35950 /// which have their own setter method. If done anyway, the request will fail.
35951 ///
35952 /// # Additional Parameters
35953 ///
35954 /// * *$.xgafv* (query-string) - V1 error format.
35955 /// * *access_token* (query-string) - OAuth access token.
35956 /// * *alt* (query-string) - Data format for response.
35957 /// * *callback* (query-string) - JSONP
35958 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35959 /// * *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.
35960 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35961 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35962 /// * *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.
35963 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35964 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35965 pub fn param<T>(mut self, name: T, value: T) -> TransitobjectAddmessageCall<'a, C>
35966 where
35967 T: AsRef<str>,
35968 {
35969 self._additional_params
35970 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35971 self
35972 }
35973
35974 /// Identifies the authorization scope for the method you are building.
35975 ///
35976 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35977 /// [`Scope::WalletObjectIssuer`].
35978 ///
35979 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35980 /// tokens for more than one scope.
35981 ///
35982 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35983 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35984 /// sufficient, a read-write scope will do as well.
35985 pub fn add_scope<St>(mut self, scope: St) -> TransitobjectAddmessageCall<'a, C>
35986 where
35987 St: AsRef<str>,
35988 {
35989 self._scopes.insert(String::from(scope.as_ref()));
35990 self
35991 }
35992 /// Identifies the authorization scope(s) for the method you are building.
35993 ///
35994 /// See [`Self::add_scope()`] for details.
35995 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectAddmessageCall<'a, C>
35996 where
35997 I: IntoIterator<Item = St>,
35998 St: AsRef<str>,
35999 {
36000 self._scopes
36001 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36002 self
36003 }
36004
36005 /// Removes all scopes, and no default scope will be used either.
36006 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36007 /// for details).
36008 pub fn clear_scopes(mut self) -> TransitobjectAddmessageCall<'a, C> {
36009 self._scopes.clear();
36010 self
36011 }
36012}
36013
36014/// Returns the transit object with the given object ID.
36015///
36016/// A builder for the *get* method supported by a *transitobject* resource.
36017/// It is not used directly, but through a [`TransitobjectMethods`] instance.
36018///
36019/// # Example
36020///
36021/// Instantiate a resource method builder
36022///
36023/// ```test_harness,no_run
36024/// # extern crate hyper;
36025/// # extern crate hyper_rustls;
36026/// # extern crate google_walletobjects1 as walletobjects1;
36027/// # async fn dox() {
36028/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36029///
36030/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36031/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36032/// # secret,
36033/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36034/// # ).build().await.unwrap();
36035///
36036/// # let client = hyper_util::client::legacy::Client::builder(
36037/// # hyper_util::rt::TokioExecutor::new()
36038/// # )
36039/// # .build(
36040/// # hyper_rustls::HttpsConnectorBuilder::new()
36041/// # .with_native_roots()
36042/// # .unwrap()
36043/// # .https_or_http()
36044/// # .enable_http1()
36045/// # .build()
36046/// # );
36047/// # let mut hub = Walletobjects::new(client, auth);
36048/// // You can configure optional parameters by calling the respective setters at will, and
36049/// // execute the final call using `doit()`.
36050/// // Values shown here are possibly random and not representative !
36051/// let result = hub.transitobject().get("resourceId")
36052/// .doit().await;
36053/// # }
36054/// ```
36055pub struct TransitobjectGetCall<'a, C>
36056where
36057 C: 'a,
36058{
36059 hub: &'a Walletobjects<C>,
36060 _resource_id: String,
36061 _delegate: Option<&'a mut dyn common::Delegate>,
36062 _additional_params: HashMap<String, String>,
36063 _scopes: BTreeSet<String>,
36064}
36065
36066impl<'a, C> common::CallBuilder for TransitobjectGetCall<'a, C> {}
36067
36068impl<'a, C> TransitobjectGetCall<'a, C>
36069where
36070 C: common::Connector,
36071{
36072 /// Perform the operation you have build so far.
36073 pub async fn doit(mut self) -> common::Result<(common::Response, TransitObject)> {
36074 use std::borrow::Cow;
36075 use std::io::{Read, Seek};
36076
36077 use common::{url::Params, ToParts};
36078 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36079
36080 let mut dd = common::DefaultDelegate;
36081 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36082 dlg.begin(common::MethodInfo {
36083 id: "walletobjects.transitobject.get",
36084 http_method: hyper::Method::GET,
36085 });
36086
36087 for &field in ["alt", "resourceId"].iter() {
36088 if self._additional_params.contains_key(field) {
36089 dlg.finished(false);
36090 return Err(common::Error::FieldClash(field));
36091 }
36092 }
36093
36094 let mut params = Params::with_capacity(3 + self._additional_params.len());
36095 params.push("resourceId", self._resource_id);
36096
36097 params.extend(self._additional_params.iter());
36098
36099 params.push("alt", "json");
36100 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject/{resourceId}";
36101 if self._scopes.is_empty() {
36102 self._scopes
36103 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
36104 }
36105
36106 #[allow(clippy::single_element_loop)]
36107 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
36108 url = params.uri_replacement(url, param_name, find_this, false);
36109 }
36110 {
36111 let to_remove = ["resourceId"];
36112 params.remove_params(&to_remove);
36113 }
36114
36115 let url = params.parse_with_url(&url);
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 let mut req_result = {
36134 let client = &self.hub.client;
36135 dlg.pre_request();
36136 let mut req_builder = hyper::Request::builder()
36137 .method(hyper::Method::GET)
36138 .uri(url.as_str())
36139 .header(USER_AGENT, self.hub._user_agent.clone());
36140
36141 if let Some(token) = token.as_ref() {
36142 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36143 }
36144
36145 let request = req_builder
36146 .header(CONTENT_LENGTH, 0_u64)
36147 .body(common::to_body::<String>(None));
36148
36149 client.request(request.unwrap()).await
36150 };
36151
36152 match req_result {
36153 Err(err) => {
36154 if let common::Retry::After(d) = dlg.http_error(&err) {
36155 sleep(d).await;
36156 continue;
36157 }
36158 dlg.finished(false);
36159 return Err(common::Error::HttpError(err));
36160 }
36161 Ok(res) => {
36162 let (mut parts, body) = res.into_parts();
36163 let mut body = common::Body::new(body);
36164 if !parts.status.is_success() {
36165 let bytes = common::to_bytes(body).await.unwrap_or_default();
36166 let error = serde_json::from_str(&common::to_string(&bytes));
36167 let response = common::to_response(parts, bytes.into());
36168
36169 if let common::Retry::After(d) =
36170 dlg.http_failure(&response, error.as_ref().ok())
36171 {
36172 sleep(d).await;
36173 continue;
36174 }
36175
36176 dlg.finished(false);
36177
36178 return Err(match error {
36179 Ok(value) => common::Error::BadRequest(value),
36180 _ => common::Error::Failure(response),
36181 });
36182 }
36183 let response = {
36184 let bytes = common::to_bytes(body).await.unwrap_or_default();
36185 let encoded = common::to_string(&bytes);
36186 match serde_json::from_str(&encoded) {
36187 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36188 Err(error) => {
36189 dlg.response_json_decode_error(&encoded, &error);
36190 return Err(common::Error::JsonDecodeError(
36191 encoded.to_string(),
36192 error,
36193 ));
36194 }
36195 }
36196 };
36197
36198 dlg.finished(true);
36199 return Ok(response);
36200 }
36201 }
36202 }
36203 }
36204
36205 /// 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 '-'.
36206 ///
36207 /// Sets the *resource id* path property to the given value.
36208 ///
36209 /// Even though the property as already been set when instantiating this call,
36210 /// we provide this method for API completeness.
36211 pub fn resource_id(mut self, new_value: &str) -> TransitobjectGetCall<'a, C> {
36212 self._resource_id = new_value.to_string();
36213 self
36214 }
36215 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36216 /// while executing the actual API request.
36217 ///
36218 /// ````text
36219 /// It should be used to handle progress information, and to implement a certain level of resilience.
36220 /// ````
36221 ///
36222 /// Sets the *delegate* property to the given value.
36223 pub fn delegate(
36224 mut self,
36225 new_value: &'a mut dyn common::Delegate,
36226 ) -> TransitobjectGetCall<'a, C> {
36227 self._delegate = Some(new_value);
36228 self
36229 }
36230
36231 /// Set any additional parameter of the query string used in the request.
36232 /// It should be used to set parameters which are not yet available through their own
36233 /// setters.
36234 ///
36235 /// Please note that this method must not be used to set any of the known parameters
36236 /// which have their own setter method. If done anyway, the request will fail.
36237 ///
36238 /// # Additional Parameters
36239 ///
36240 /// * *$.xgafv* (query-string) - V1 error format.
36241 /// * *access_token* (query-string) - OAuth access token.
36242 /// * *alt* (query-string) - Data format for response.
36243 /// * *callback* (query-string) - JSONP
36244 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36245 /// * *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.
36246 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36247 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36248 /// * *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.
36249 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36250 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36251 pub fn param<T>(mut self, name: T, value: T) -> TransitobjectGetCall<'a, C>
36252 where
36253 T: AsRef<str>,
36254 {
36255 self._additional_params
36256 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36257 self
36258 }
36259
36260 /// Identifies the authorization scope for the method you are building.
36261 ///
36262 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36263 /// [`Scope::WalletObjectIssuer`].
36264 ///
36265 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36266 /// tokens for more than one scope.
36267 ///
36268 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36269 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36270 /// sufficient, a read-write scope will do as well.
36271 pub fn add_scope<St>(mut self, scope: St) -> TransitobjectGetCall<'a, C>
36272 where
36273 St: AsRef<str>,
36274 {
36275 self._scopes.insert(String::from(scope.as_ref()));
36276 self
36277 }
36278 /// Identifies the authorization scope(s) for the method you are building.
36279 ///
36280 /// See [`Self::add_scope()`] for details.
36281 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectGetCall<'a, C>
36282 where
36283 I: IntoIterator<Item = St>,
36284 St: AsRef<str>,
36285 {
36286 self._scopes
36287 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36288 self
36289 }
36290
36291 /// Removes all scopes, and no default scope will be used either.
36292 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36293 /// for details).
36294 pub fn clear_scopes(mut self) -> TransitobjectGetCall<'a, C> {
36295 self._scopes.clear();
36296 self
36297 }
36298}
36299
36300/// Inserts an transit object with the given ID and properties.
36301///
36302/// A builder for the *insert* method supported by a *transitobject* resource.
36303/// It is not used directly, but through a [`TransitobjectMethods`] instance.
36304///
36305/// # Example
36306///
36307/// Instantiate a resource method builder
36308///
36309/// ```test_harness,no_run
36310/// # extern crate hyper;
36311/// # extern crate hyper_rustls;
36312/// # extern crate google_walletobjects1 as walletobjects1;
36313/// use walletobjects1::api::TransitObject;
36314/// # async fn dox() {
36315/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36316///
36317/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36318/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36319/// # secret,
36320/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36321/// # ).build().await.unwrap();
36322///
36323/// # let client = hyper_util::client::legacy::Client::builder(
36324/// # hyper_util::rt::TokioExecutor::new()
36325/// # )
36326/// # .build(
36327/// # hyper_rustls::HttpsConnectorBuilder::new()
36328/// # .with_native_roots()
36329/// # .unwrap()
36330/// # .https_or_http()
36331/// # .enable_http1()
36332/// # .build()
36333/// # );
36334/// # let mut hub = Walletobjects::new(client, auth);
36335/// // As the method needs a request, you would usually fill it with the desired information
36336/// // into the respective structure. Some of the parts shown here might not be applicable !
36337/// // Values shown here are possibly random and not representative !
36338/// let mut req = TransitObject::default();
36339///
36340/// // You can configure optional parameters by calling the respective setters at will, and
36341/// // execute the final call using `doit()`.
36342/// // Values shown here are possibly random and not representative !
36343/// let result = hub.transitobject().insert(req)
36344/// .doit().await;
36345/// # }
36346/// ```
36347pub struct TransitobjectInsertCall<'a, C>
36348where
36349 C: 'a,
36350{
36351 hub: &'a Walletobjects<C>,
36352 _request: TransitObject,
36353 _delegate: Option<&'a mut dyn common::Delegate>,
36354 _additional_params: HashMap<String, String>,
36355 _scopes: BTreeSet<String>,
36356}
36357
36358impl<'a, C> common::CallBuilder for TransitobjectInsertCall<'a, C> {}
36359
36360impl<'a, C> TransitobjectInsertCall<'a, C>
36361where
36362 C: common::Connector,
36363{
36364 /// Perform the operation you have build so far.
36365 pub async fn doit(mut self) -> common::Result<(common::Response, TransitObject)> {
36366 use std::borrow::Cow;
36367 use std::io::{Read, Seek};
36368
36369 use common::{url::Params, ToParts};
36370 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36371
36372 let mut dd = common::DefaultDelegate;
36373 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36374 dlg.begin(common::MethodInfo {
36375 id: "walletobjects.transitobject.insert",
36376 http_method: hyper::Method::POST,
36377 });
36378
36379 for &field in ["alt"].iter() {
36380 if self._additional_params.contains_key(field) {
36381 dlg.finished(false);
36382 return Err(common::Error::FieldClash(field));
36383 }
36384 }
36385
36386 let mut params = Params::with_capacity(3 + self._additional_params.len());
36387
36388 params.extend(self._additional_params.iter());
36389
36390 params.push("alt", "json");
36391 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject";
36392 if self._scopes.is_empty() {
36393 self._scopes
36394 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
36395 }
36396
36397 let url = params.parse_with_url(&url);
36398
36399 let mut json_mime_type = mime::APPLICATION_JSON;
36400 let mut request_value_reader = {
36401 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36402 common::remove_json_null_values(&mut value);
36403 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36404 serde_json::to_writer(&mut dst, &value).unwrap();
36405 dst
36406 };
36407 let request_size = request_value_reader
36408 .seek(std::io::SeekFrom::End(0))
36409 .unwrap();
36410 request_value_reader
36411 .seek(std::io::SeekFrom::Start(0))
36412 .unwrap();
36413
36414 loop {
36415 let token = match self
36416 .hub
36417 .auth
36418 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36419 .await
36420 {
36421 Ok(token) => token,
36422 Err(e) => match dlg.token(e) {
36423 Ok(token) => token,
36424 Err(e) => {
36425 dlg.finished(false);
36426 return Err(common::Error::MissingToken(e));
36427 }
36428 },
36429 };
36430 request_value_reader
36431 .seek(std::io::SeekFrom::Start(0))
36432 .unwrap();
36433 let mut req_result = {
36434 let client = &self.hub.client;
36435 dlg.pre_request();
36436 let mut req_builder = hyper::Request::builder()
36437 .method(hyper::Method::POST)
36438 .uri(url.as_str())
36439 .header(USER_AGENT, self.hub._user_agent.clone());
36440
36441 if let Some(token) = token.as_ref() {
36442 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36443 }
36444
36445 let request = req_builder
36446 .header(CONTENT_TYPE, json_mime_type.to_string())
36447 .header(CONTENT_LENGTH, request_size as u64)
36448 .body(common::to_body(
36449 request_value_reader.get_ref().clone().into(),
36450 ));
36451
36452 client.request(request.unwrap()).await
36453 };
36454
36455 match req_result {
36456 Err(err) => {
36457 if let common::Retry::After(d) = dlg.http_error(&err) {
36458 sleep(d).await;
36459 continue;
36460 }
36461 dlg.finished(false);
36462 return Err(common::Error::HttpError(err));
36463 }
36464 Ok(res) => {
36465 let (mut parts, body) = res.into_parts();
36466 let mut body = common::Body::new(body);
36467 if !parts.status.is_success() {
36468 let bytes = common::to_bytes(body).await.unwrap_or_default();
36469 let error = serde_json::from_str(&common::to_string(&bytes));
36470 let response = common::to_response(parts, bytes.into());
36471
36472 if let common::Retry::After(d) =
36473 dlg.http_failure(&response, error.as_ref().ok())
36474 {
36475 sleep(d).await;
36476 continue;
36477 }
36478
36479 dlg.finished(false);
36480
36481 return Err(match error {
36482 Ok(value) => common::Error::BadRequest(value),
36483 _ => common::Error::Failure(response),
36484 });
36485 }
36486 let response = {
36487 let bytes = common::to_bytes(body).await.unwrap_or_default();
36488 let encoded = common::to_string(&bytes);
36489 match serde_json::from_str(&encoded) {
36490 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36491 Err(error) => {
36492 dlg.response_json_decode_error(&encoded, &error);
36493 return Err(common::Error::JsonDecodeError(
36494 encoded.to_string(),
36495 error,
36496 ));
36497 }
36498 }
36499 };
36500
36501 dlg.finished(true);
36502 return Ok(response);
36503 }
36504 }
36505 }
36506 }
36507
36508 ///
36509 /// Sets the *request* property to the given value.
36510 ///
36511 /// Even though the property as already been set when instantiating this call,
36512 /// we provide this method for API completeness.
36513 pub fn request(mut self, new_value: TransitObject) -> TransitobjectInsertCall<'a, C> {
36514 self._request = new_value;
36515 self
36516 }
36517 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36518 /// while executing the actual API request.
36519 ///
36520 /// ````text
36521 /// It should be used to handle progress information, and to implement a certain level of resilience.
36522 /// ````
36523 ///
36524 /// Sets the *delegate* property to the given value.
36525 pub fn delegate(
36526 mut self,
36527 new_value: &'a mut dyn common::Delegate,
36528 ) -> TransitobjectInsertCall<'a, C> {
36529 self._delegate = Some(new_value);
36530 self
36531 }
36532
36533 /// Set any additional parameter of the query string used in the request.
36534 /// It should be used to set parameters which are not yet available through their own
36535 /// setters.
36536 ///
36537 /// Please note that this method must not be used to set any of the known parameters
36538 /// which have their own setter method. If done anyway, the request will fail.
36539 ///
36540 /// # Additional Parameters
36541 ///
36542 /// * *$.xgafv* (query-string) - V1 error format.
36543 /// * *access_token* (query-string) - OAuth access token.
36544 /// * *alt* (query-string) - Data format for response.
36545 /// * *callback* (query-string) - JSONP
36546 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36547 /// * *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.
36548 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36549 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36550 /// * *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.
36551 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36552 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36553 pub fn param<T>(mut self, name: T, value: T) -> TransitobjectInsertCall<'a, C>
36554 where
36555 T: AsRef<str>,
36556 {
36557 self._additional_params
36558 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36559 self
36560 }
36561
36562 /// Identifies the authorization scope for the method you are building.
36563 ///
36564 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36565 /// [`Scope::WalletObjectIssuer`].
36566 ///
36567 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36568 /// tokens for more than one scope.
36569 ///
36570 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36571 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36572 /// sufficient, a read-write scope will do as well.
36573 pub fn add_scope<St>(mut self, scope: St) -> TransitobjectInsertCall<'a, C>
36574 where
36575 St: AsRef<str>,
36576 {
36577 self._scopes.insert(String::from(scope.as_ref()));
36578 self
36579 }
36580 /// Identifies the authorization scope(s) for the method you are building.
36581 ///
36582 /// See [`Self::add_scope()`] for details.
36583 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectInsertCall<'a, C>
36584 where
36585 I: IntoIterator<Item = St>,
36586 St: AsRef<str>,
36587 {
36588 self._scopes
36589 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36590 self
36591 }
36592
36593 /// Removes all scopes, and no default scope will be used either.
36594 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36595 /// for details).
36596 pub fn clear_scopes(mut self) -> TransitobjectInsertCall<'a, C> {
36597 self._scopes.clear();
36598 self
36599 }
36600}
36601
36602/// Returns a list of all transit objects for a given issuer ID.
36603///
36604/// A builder for the *list* method supported by a *transitobject* resource.
36605/// It is not used directly, but through a [`TransitobjectMethods`] instance.
36606///
36607/// # Example
36608///
36609/// Instantiate a resource method builder
36610///
36611/// ```test_harness,no_run
36612/// # extern crate hyper;
36613/// # extern crate hyper_rustls;
36614/// # extern crate google_walletobjects1 as walletobjects1;
36615/// # async fn dox() {
36616/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36617///
36618/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36619/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36620/// # secret,
36621/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36622/// # ).build().await.unwrap();
36623///
36624/// # let client = hyper_util::client::legacy::Client::builder(
36625/// # hyper_util::rt::TokioExecutor::new()
36626/// # )
36627/// # .build(
36628/// # hyper_rustls::HttpsConnectorBuilder::new()
36629/// # .with_native_roots()
36630/// # .unwrap()
36631/// # .https_or_http()
36632/// # .enable_http1()
36633/// # .build()
36634/// # );
36635/// # let mut hub = Walletobjects::new(client, auth);
36636/// // You can configure optional parameters by calling the respective setters at will, and
36637/// // execute the final call using `doit()`.
36638/// // Values shown here are possibly random and not representative !
36639/// let result = hub.transitobject().list()
36640/// .token("tempor")
36641/// .max_results(-32)
36642/// .class_id("ipsum")
36643/// .doit().await;
36644/// # }
36645/// ```
36646pub struct TransitobjectListCall<'a, C>
36647where
36648 C: 'a,
36649{
36650 hub: &'a Walletobjects<C>,
36651 _token: Option<String>,
36652 _max_results: Option<i32>,
36653 _class_id: Option<String>,
36654 _delegate: Option<&'a mut dyn common::Delegate>,
36655 _additional_params: HashMap<String, String>,
36656 _scopes: BTreeSet<String>,
36657}
36658
36659impl<'a, C> common::CallBuilder for TransitobjectListCall<'a, C> {}
36660
36661impl<'a, C> TransitobjectListCall<'a, C>
36662where
36663 C: common::Connector,
36664{
36665 /// Perform the operation you have build so far.
36666 pub async fn doit(mut self) -> common::Result<(common::Response, TransitObjectListResponse)> {
36667 use std::borrow::Cow;
36668 use std::io::{Read, Seek};
36669
36670 use common::{url::Params, ToParts};
36671 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36672
36673 let mut dd = common::DefaultDelegate;
36674 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36675 dlg.begin(common::MethodInfo {
36676 id: "walletobjects.transitobject.list",
36677 http_method: hyper::Method::GET,
36678 });
36679
36680 for &field in ["alt", "token", "maxResults", "classId"].iter() {
36681 if self._additional_params.contains_key(field) {
36682 dlg.finished(false);
36683 return Err(common::Error::FieldClash(field));
36684 }
36685 }
36686
36687 let mut params = Params::with_capacity(5 + self._additional_params.len());
36688 if let Some(value) = self._token.as_ref() {
36689 params.push("token", value);
36690 }
36691 if let Some(value) = self._max_results.as_ref() {
36692 params.push("maxResults", value.to_string());
36693 }
36694 if let Some(value) = self._class_id.as_ref() {
36695 params.push("classId", value);
36696 }
36697
36698 params.extend(self._additional_params.iter());
36699
36700 params.push("alt", "json");
36701 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject";
36702 if self._scopes.is_empty() {
36703 self._scopes
36704 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
36705 }
36706
36707 let url = params.parse_with_url(&url);
36708
36709 loop {
36710 let token = match self
36711 .hub
36712 .auth
36713 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36714 .await
36715 {
36716 Ok(token) => token,
36717 Err(e) => match dlg.token(e) {
36718 Ok(token) => token,
36719 Err(e) => {
36720 dlg.finished(false);
36721 return Err(common::Error::MissingToken(e));
36722 }
36723 },
36724 };
36725 let mut req_result = {
36726 let client = &self.hub.client;
36727 dlg.pre_request();
36728 let mut req_builder = hyper::Request::builder()
36729 .method(hyper::Method::GET)
36730 .uri(url.as_str())
36731 .header(USER_AGENT, self.hub._user_agent.clone());
36732
36733 if let Some(token) = token.as_ref() {
36734 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36735 }
36736
36737 let request = req_builder
36738 .header(CONTENT_LENGTH, 0_u64)
36739 .body(common::to_body::<String>(None));
36740
36741 client.request(request.unwrap()).await
36742 };
36743
36744 match req_result {
36745 Err(err) => {
36746 if let common::Retry::After(d) = dlg.http_error(&err) {
36747 sleep(d).await;
36748 continue;
36749 }
36750 dlg.finished(false);
36751 return Err(common::Error::HttpError(err));
36752 }
36753 Ok(res) => {
36754 let (mut parts, body) = res.into_parts();
36755 let mut body = common::Body::new(body);
36756 if !parts.status.is_success() {
36757 let bytes = common::to_bytes(body).await.unwrap_or_default();
36758 let error = serde_json::from_str(&common::to_string(&bytes));
36759 let response = common::to_response(parts, bytes.into());
36760
36761 if let common::Retry::After(d) =
36762 dlg.http_failure(&response, error.as_ref().ok())
36763 {
36764 sleep(d).await;
36765 continue;
36766 }
36767
36768 dlg.finished(false);
36769
36770 return Err(match error {
36771 Ok(value) => common::Error::BadRequest(value),
36772 _ => common::Error::Failure(response),
36773 });
36774 }
36775 let response = {
36776 let bytes = common::to_bytes(body).await.unwrap_or_default();
36777 let encoded = common::to_string(&bytes);
36778 match serde_json::from_str(&encoded) {
36779 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36780 Err(error) => {
36781 dlg.response_json_decode_error(&encoded, &error);
36782 return Err(common::Error::JsonDecodeError(
36783 encoded.to_string(),
36784 error,
36785 ));
36786 }
36787 }
36788 };
36789
36790 dlg.finished(true);
36791 return Ok(response);
36792 }
36793 }
36794 }
36795 }
36796
36797 /// 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.
36798 ///
36799 /// Sets the *token* query property to the given value.
36800 pub fn token(mut self, new_value: &str) -> TransitobjectListCall<'a, C> {
36801 self._token = Some(new_value.to_string());
36802 self
36803 }
36804 /// Identifies the max number of results returned by a list. All results are returned if `maxResults` isn't defined.
36805 ///
36806 /// Sets the *max results* query property to the given value.
36807 pub fn max_results(mut self, new_value: i32) -> TransitobjectListCall<'a, C> {
36808 self._max_results = Some(new_value);
36809 self
36810 }
36811 /// The ID of the class whose objects will be listed.
36812 ///
36813 /// Sets the *class id* query property to the given value.
36814 pub fn class_id(mut self, new_value: &str) -> TransitobjectListCall<'a, C> {
36815 self._class_id = Some(new_value.to_string());
36816 self
36817 }
36818 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36819 /// while executing the actual API request.
36820 ///
36821 /// ````text
36822 /// It should be used to handle progress information, and to implement a certain level of resilience.
36823 /// ````
36824 ///
36825 /// Sets the *delegate* property to the given value.
36826 pub fn delegate(
36827 mut self,
36828 new_value: &'a mut dyn common::Delegate,
36829 ) -> TransitobjectListCall<'a, C> {
36830 self._delegate = Some(new_value);
36831 self
36832 }
36833
36834 /// Set any additional parameter of the query string used in the request.
36835 /// It should be used to set parameters which are not yet available through their own
36836 /// setters.
36837 ///
36838 /// Please note that this method must not be used to set any of the known parameters
36839 /// which have their own setter method. If done anyway, the request will fail.
36840 ///
36841 /// # Additional Parameters
36842 ///
36843 /// * *$.xgafv* (query-string) - V1 error format.
36844 /// * *access_token* (query-string) - OAuth access token.
36845 /// * *alt* (query-string) - Data format for response.
36846 /// * *callback* (query-string) - JSONP
36847 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36848 /// * *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.
36849 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36850 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36851 /// * *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.
36852 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36853 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36854 pub fn param<T>(mut self, name: T, value: T) -> TransitobjectListCall<'a, C>
36855 where
36856 T: AsRef<str>,
36857 {
36858 self._additional_params
36859 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36860 self
36861 }
36862
36863 /// Identifies the authorization scope for the method you are building.
36864 ///
36865 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36866 /// [`Scope::WalletObjectIssuer`].
36867 ///
36868 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36869 /// tokens for more than one scope.
36870 ///
36871 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36872 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36873 /// sufficient, a read-write scope will do as well.
36874 pub fn add_scope<St>(mut self, scope: St) -> TransitobjectListCall<'a, C>
36875 where
36876 St: AsRef<str>,
36877 {
36878 self._scopes.insert(String::from(scope.as_ref()));
36879 self
36880 }
36881 /// Identifies the authorization scope(s) for the method you are building.
36882 ///
36883 /// See [`Self::add_scope()`] for details.
36884 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectListCall<'a, C>
36885 where
36886 I: IntoIterator<Item = St>,
36887 St: AsRef<str>,
36888 {
36889 self._scopes
36890 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36891 self
36892 }
36893
36894 /// Removes all scopes, and no default scope will be used either.
36895 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36896 /// for details).
36897 pub fn clear_scopes(mut self) -> TransitobjectListCall<'a, C> {
36898 self._scopes.clear();
36899 self
36900 }
36901}
36902
36903/// Updates the transit object referenced by the given object ID. This method supports patch semantics.
36904///
36905/// A builder for the *patch* method supported by a *transitobject* resource.
36906/// It is not used directly, but through a [`TransitobjectMethods`] instance.
36907///
36908/// # Example
36909///
36910/// Instantiate a resource method builder
36911///
36912/// ```test_harness,no_run
36913/// # extern crate hyper;
36914/// # extern crate hyper_rustls;
36915/// # extern crate google_walletobjects1 as walletobjects1;
36916/// use walletobjects1::api::TransitObject;
36917/// # async fn dox() {
36918/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36919///
36920/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36921/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36922/// # secret,
36923/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36924/// # ).build().await.unwrap();
36925///
36926/// # let client = hyper_util::client::legacy::Client::builder(
36927/// # hyper_util::rt::TokioExecutor::new()
36928/// # )
36929/// # .build(
36930/// # hyper_rustls::HttpsConnectorBuilder::new()
36931/// # .with_native_roots()
36932/// # .unwrap()
36933/// # .https_or_http()
36934/// # .enable_http1()
36935/// # .build()
36936/// # );
36937/// # let mut hub = Walletobjects::new(client, auth);
36938/// // As the method needs a request, you would usually fill it with the desired information
36939/// // into the respective structure. Some of the parts shown here might not be applicable !
36940/// // Values shown here are possibly random and not representative !
36941/// let mut req = TransitObject::default();
36942///
36943/// // You can configure optional parameters by calling the respective setters at will, and
36944/// // execute the final call using `doit()`.
36945/// // Values shown here are possibly random and not representative !
36946/// let result = hub.transitobject().patch(req, "resourceId")
36947/// .doit().await;
36948/// # }
36949/// ```
36950pub struct TransitobjectPatchCall<'a, C>
36951where
36952 C: 'a,
36953{
36954 hub: &'a Walletobjects<C>,
36955 _request: TransitObject,
36956 _resource_id: String,
36957 _delegate: Option<&'a mut dyn common::Delegate>,
36958 _additional_params: HashMap<String, String>,
36959 _scopes: BTreeSet<String>,
36960}
36961
36962impl<'a, C> common::CallBuilder for TransitobjectPatchCall<'a, C> {}
36963
36964impl<'a, C> TransitobjectPatchCall<'a, C>
36965where
36966 C: common::Connector,
36967{
36968 /// Perform the operation you have build so far.
36969 pub async fn doit(mut self) -> common::Result<(common::Response, TransitObject)> {
36970 use std::borrow::Cow;
36971 use std::io::{Read, Seek};
36972
36973 use common::{url::Params, ToParts};
36974 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36975
36976 let mut dd = common::DefaultDelegate;
36977 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36978 dlg.begin(common::MethodInfo {
36979 id: "walletobjects.transitobject.patch",
36980 http_method: hyper::Method::PATCH,
36981 });
36982
36983 for &field in ["alt", "resourceId"].iter() {
36984 if self._additional_params.contains_key(field) {
36985 dlg.finished(false);
36986 return Err(common::Error::FieldClash(field));
36987 }
36988 }
36989
36990 let mut params = Params::with_capacity(4 + self._additional_params.len());
36991 params.push("resourceId", self._resource_id);
36992
36993 params.extend(self._additional_params.iter());
36994
36995 params.push("alt", "json");
36996 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject/{resourceId}";
36997 if self._scopes.is_empty() {
36998 self._scopes
36999 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
37000 }
37001
37002 #[allow(clippy::single_element_loop)]
37003 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
37004 url = params.uri_replacement(url, param_name, find_this, false);
37005 }
37006 {
37007 let to_remove = ["resourceId"];
37008 params.remove_params(&to_remove);
37009 }
37010
37011 let url = params.parse_with_url(&url);
37012
37013 let mut json_mime_type = mime::APPLICATION_JSON;
37014 let mut request_value_reader = {
37015 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37016 common::remove_json_null_values(&mut value);
37017 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37018 serde_json::to_writer(&mut dst, &value).unwrap();
37019 dst
37020 };
37021 let request_size = request_value_reader
37022 .seek(std::io::SeekFrom::End(0))
37023 .unwrap();
37024 request_value_reader
37025 .seek(std::io::SeekFrom::Start(0))
37026 .unwrap();
37027
37028 loop {
37029 let token = match self
37030 .hub
37031 .auth
37032 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37033 .await
37034 {
37035 Ok(token) => token,
37036 Err(e) => match dlg.token(e) {
37037 Ok(token) => token,
37038 Err(e) => {
37039 dlg.finished(false);
37040 return Err(common::Error::MissingToken(e));
37041 }
37042 },
37043 };
37044 request_value_reader
37045 .seek(std::io::SeekFrom::Start(0))
37046 .unwrap();
37047 let mut req_result = {
37048 let client = &self.hub.client;
37049 dlg.pre_request();
37050 let mut req_builder = hyper::Request::builder()
37051 .method(hyper::Method::PATCH)
37052 .uri(url.as_str())
37053 .header(USER_AGENT, self.hub._user_agent.clone());
37054
37055 if let Some(token) = token.as_ref() {
37056 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37057 }
37058
37059 let request = req_builder
37060 .header(CONTENT_TYPE, json_mime_type.to_string())
37061 .header(CONTENT_LENGTH, request_size as u64)
37062 .body(common::to_body(
37063 request_value_reader.get_ref().clone().into(),
37064 ));
37065
37066 client.request(request.unwrap()).await
37067 };
37068
37069 match req_result {
37070 Err(err) => {
37071 if let common::Retry::After(d) = dlg.http_error(&err) {
37072 sleep(d).await;
37073 continue;
37074 }
37075 dlg.finished(false);
37076 return Err(common::Error::HttpError(err));
37077 }
37078 Ok(res) => {
37079 let (mut parts, body) = res.into_parts();
37080 let mut body = common::Body::new(body);
37081 if !parts.status.is_success() {
37082 let bytes = common::to_bytes(body).await.unwrap_or_default();
37083 let error = serde_json::from_str(&common::to_string(&bytes));
37084 let response = common::to_response(parts, bytes.into());
37085
37086 if let common::Retry::After(d) =
37087 dlg.http_failure(&response, error.as_ref().ok())
37088 {
37089 sleep(d).await;
37090 continue;
37091 }
37092
37093 dlg.finished(false);
37094
37095 return Err(match error {
37096 Ok(value) => common::Error::BadRequest(value),
37097 _ => common::Error::Failure(response),
37098 });
37099 }
37100 let response = {
37101 let bytes = common::to_bytes(body).await.unwrap_or_default();
37102 let encoded = common::to_string(&bytes);
37103 match serde_json::from_str(&encoded) {
37104 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37105 Err(error) => {
37106 dlg.response_json_decode_error(&encoded, &error);
37107 return Err(common::Error::JsonDecodeError(
37108 encoded.to_string(),
37109 error,
37110 ));
37111 }
37112 }
37113 };
37114
37115 dlg.finished(true);
37116 return Ok(response);
37117 }
37118 }
37119 }
37120 }
37121
37122 ///
37123 /// Sets the *request* property to the given value.
37124 ///
37125 /// Even though the property as already been set when instantiating this call,
37126 /// we provide this method for API completeness.
37127 pub fn request(mut self, new_value: TransitObject) -> TransitobjectPatchCall<'a, C> {
37128 self._request = new_value;
37129 self
37130 }
37131 /// 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 '-'.
37132 ///
37133 /// Sets the *resource id* path property to the given value.
37134 ///
37135 /// Even though the property as already been set when instantiating this call,
37136 /// we provide this method for API completeness.
37137 pub fn resource_id(mut self, new_value: &str) -> TransitobjectPatchCall<'a, C> {
37138 self._resource_id = new_value.to_string();
37139 self
37140 }
37141 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37142 /// while executing the actual API request.
37143 ///
37144 /// ````text
37145 /// It should be used to handle progress information, and to implement a certain level of resilience.
37146 /// ````
37147 ///
37148 /// Sets the *delegate* property to the given value.
37149 pub fn delegate(
37150 mut self,
37151 new_value: &'a mut dyn common::Delegate,
37152 ) -> TransitobjectPatchCall<'a, C> {
37153 self._delegate = Some(new_value);
37154 self
37155 }
37156
37157 /// Set any additional parameter of the query string used in the request.
37158 /// It should be used to set parameters which are not yet available through their own
37159 /// setters.
37160 ///
37161 /// Please note that this method must not be used to set any of the known parameters
37162 /// which have their own setter method. If done anyway, the request will fail.
37163 ///
37164 /// # Additional Parameters
37165 ///
37166 /// * *$.xgafv* (query-string) - V1 error format.
37167 /// * *access_token* (query-string) - OAuth access token.
37168 /// * *alt* (query-string) - Data format for response.
37169 /// * *callback* (query-string) - JSONP
37170 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37171 /// * *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.
37172 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37173 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37174 /// * *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.
37175 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37176 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37177 pub fn param<T>(mut self, name: T, value: T) -> TransitobjectPatchCall<'a, C>
37178 where
37179 T: AsRef<str>,
37180 {
37181 self._additional_params
37182 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37183 self
37184 }
37185
37186 /// Identifies the authorization scope for the method you are building.
37187 ///
37188 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37189 /// [`Scope::WalletObjectIssuer`].
37190 ///
37191 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37192 /// tokens for more than one scope.
37193 ///
37194 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37195 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37196 /// sufficient, a read-write scope will do as well.
37197 pub fn add_scope<St>(mut self, scope: St) -> TransitobjectPatchCall<'a, C>
37198 where
37199 St: AsRef<str>,
37200 {
37201 self._scopes.insert(String::from(scope.as_ref()));
37202 self
37203 }
37204 /// Identifies the authorization scope(s) for the method you are building.
37205 ///
37206 /// See [`Self::add_scope()`] for details.
37207 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectPatchCall<'a, C>
37208 where
37209 I: IntoIterator<Item = St>,
37210 St: AsRef<str>,
37211 {
37212 self._scopes
37213 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37214 self
37215 }
37216
37217 /// Removes all scopes, and no default scope will be used either.
37218 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37219 /// for details).
37220 pub fn clear_scopes(mut self) -> TransitobjectPatchCall<'a, C> {
37221 self._scopes.clear();
37222 self
37223 }
37224}
37225
37226/// Updates the transit object referenced by the given object ID.
37227///
37228/// A builder for the *update* method supported by a *transitobject* resource.
37229/// It is not used directly, but through a [`TransitobjectMethods`] instance.
37230///
37231/// # Example
37232///
37233/// Instantiate a resource method builder
37234///
37235/// ```test_harness,no_run
37236/// # extern crate hyper;
37237/// # extern crate hyper_rustls;
37238/// # extern crate google_walletobjects1 as walletobjects1;
37239/// use walletobjects1::api::TransitObject;
37240/// # async fn dox() {
37241/// # use walletobjects1::{Walletobjects, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37242///
37243/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37244/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37245/// # secret,
37246/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37247/// # ).build().await.unwrap();
37248///
37249/// # let client = hyper_util::client::legacy::Client::builder(
37250/// # hyper_util::rt::TokioExecutor::new()
37251/// # )
37252/// # .build(
37253/// # hyper_rustls::HttpsConnectorBuilder::new()
37254/// # .with_native_roots()
37255/// # .unwrap()
37256/// # .https_or_http()
37257/// # .enable_http1()
37258/// # .build()
37259/// # );
37260/// # let mut hub = Walletobjects::new(client, auth);
37261/// // As the method needs a request, you would usually fill it with the desired information
37262/// // into the respective structure. Some of the parts shown here might not be applicable !
37263/// // Values shown here are possibly random and not representative !
37264/// let mut req = TransitObject::default();
37265///
37266/// // You can configure optional parameters by calling the respective setters at will, and
37267/// // execute the final call using `doit()`.
37268/// // Values shown here are possibly random and not representative !
37269/// let result = hub.transitobject().update(req, "resourceId")
37270/// .doit().await;
37271/// # }
37272/// ```
37273pub struct TransitobjectUpdateCall<'a, C>
37274where
37275 C: 'a,
37276{
37277 hub: &'a Walletobjects<C>,
37278 _request: TransitObject,
37279 _resource_id: String,
37280 _delegate: Option<&'a mut dyn common::Delegate>,
37281 _additional_params: HashMap<String, String>,
37282 _scopes: BTreeSet<String>,
37283}
37284
37285impl<'a, C> common::CallBuilder for TransitobjectUpdateCall<'a, C> {}
37286
37287impl<'a, C> TransitobjectUpdateCall<'a, C>
37288where
37289 C: common::Connector,
37290{
37291 /// Perform the operation you have build so far.
37292 pub async fn doit(mut self) -> common::Result<(common::Response, TransitObject)> {
37293 use std::borrow::Cow;
37294 use std::io::{Read, Seek};
37295
37296 use common::{url::Params, ToParts};
37297 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37298
37299 let mut dd = common::DefaultDelegate;
37300 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37301 dlg.begin(common::MethodInfo {
37302 id: "walletobjects.transitobject.update",
37303 http_method: hyper::Method::PUT,
37304 });
37305
37306 for &field in ["alt", "resourceId"].iter() {
37307 if self._additional_params.contains_key(field) {
37308 dlg.finished(false);
37309 return Err(common::Error::FieldClash(field));
37310 }
37311 }
37312
37313 let mut params = Params::with_capacity(4 + self._additional_params.len());
37314 params.push("resourceId", self._resource_id);
37315
37316 params.extend(self._additional_params.iter());
37317
37318 params.push("alt", "json");
37319 let mut url = self.hub._base_url.clone() + "walletobjects/v1/transitObject/{resourceId}";
37320 if self._scopes.is_empty() {
37321 self._scopes
37322 .insert(Scope::WalletObjectIssuer.as_ref().to_string());
37323 }
37324
37325 #[allow(clippy::single_element_loop)]
37326 for &(find_this, param_name) in [("{resourceId}", "resourceId")].iter() {
37327 url = params.uri_replacement(url, param_name, find_this, false);
37328 }
37329 {
37330 let to_remove = ["resourceId"];
37331 params.remove_params(&to_remove);
37332 }
37333
37334 let url = params.parse_with_url(&url);
37335
37336 let mut json_mime_type = mime::APPLICATION_JSON;
37337 let mut request_value_reader = {
37338 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37339 common::remove_json_null_values(&mut value);
37340 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37341 serde_json::to_writer(&mut dst, &value).unwrap();
37342 dst
37343 };
37344 let request_size = request_value_reader
37345 .seek(std::io::SeekFrom::End(0))
37346 .unwrap();
37347 request_value_reader
37348 .seek(std::io::SeekFrom::Start(0))
37349 .unwrap();
37350
37351 loop {
37352 let token = match self
37353 .hub
37354 .auth
37355 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37356 .await
37357 {
37358 Ok(token) => token,
37359 Err(e) => match dlg.token(e) {
37360 Ok(token) => token,
37361 Err(e) => {
37362 dlg.finished(false);
37363 return Err(common::Error::MissingToken(e));
37364 }
37365 },
37366 };
37367 request_value_reader
37368 .seek(std::io::SeekFrom::Start(0))
37369 .unwrap();
37370 let mut req_result = {
37371 let client = &self.hub.client;
37372 dlg.pre_request();
37373 let mut req_builder = hyper::Request::builder()
37374 .method(hyper::Method::PUT)
37375 .uri(url.as_str())
37376 .header(USER_AGENT, self.hub._user_agent.clone());
37377
37378 if let Some(token) = token.as_ref() {
37379 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37380 }
37381
37382 let request = req_builder
37383 .header(CONTENT_TYPE, json_mime_type.to_string())
37384 .header(CONTENT_LENGTH, request_size as u64)
37385 .body(common::to_body(
37386 request_value_reader.get_ref().clone().into(),
37387 ));
37388
37389 client.request(request.unwrap()).await
37390 };
37391
37392 match req_result {
37393 Err(err) => {
37394 if let common::Retry::After(d) = dlg.http_error(&err) {
37395 sleep(d).await;
37396 continue;
37397 }
37398 dlg.finished(false);
37399 return Err(common::Error::HttpError(err));
37400 }
37401 Ok(res) => {
37402 let (mut parts, body) = res.into_parts();
37403 let mut body = common::Body::new(body);
37404 if !parts.status.is_success() {
37405 let bytes = common::to_bytes(body).await.unwrap_or_default();
37406 let error = serde_json::from_str(&common::to_string(&bytes));
37407 let response = common::to_response(parts, bytes.into());
37408
37409 if let common::Retry::After(d) =
37410 dlg.http_failure(&response, error.as_ref().ok())
37411 {
37412 sleep(d).await;
37413 continue;
37414 }
37415
37416 dlg.finished(false);
37417
37418 return Err(match error {
37419 Ok(value) => common::Error::BadRequest(value),
37420 _ => common::Error::Failure(response),
37421 });
37422 }
37423 let response = {
37424 let bytes = common::to_bytes(body).await.unwrap_or_default();
37425 let encoded = common::to_string(&bytes);
37426 match serde_json::from_str(&encoded) {
37427 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37428 Err(error) => {
37429 dlg.response_json_decode_error(&encoded, &error);
37430 return Err(common::Error::JsonDecodeError(
37431 encoded.to_string(),
37432 error,
37433 ));
37434 }
37435 }
37436 };
37437
37438 dlg.finished(true);
37439 return Ok(response);
37440 }
37441 }
37442 }
37443 }
37444
37445 ///
37446 /// Sets the *request* property to the given value.
37447 ///
37448 /// Even though the property as already been set when instantiating this call,
37449 /// we provide this method for API completeness.
37450 pub fn request(mut self, new_value: TransitObject) -> TransitobjectUpdateCall<'a, C> {
37451 self._request = new_value;
37452 self
37453 }
37454 /// 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 '-'.
37455 ///
37456 /// Sets the *resource id* path property to the given value.
37457 ///
37458 /// Even though the property as already been set when instantiating this call,
37459 /// we provide this method for API completeness.
37460 pub fn resource_id(mut self, new_value: &str) -> TransitobjectUpdateCall<'a, C> {
37461 self._resource_id = new_value.to_string();
37462 self
37463 }
37464 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37465 /// while executing the actual API request.
37466 ///
37467 /// ````text
37468 /// It should be used to handle progress information, and to implement a certain level of resilience.
37469 /// ````
37470 ///
37471 /// Sets the *delegate* property to the given value.
37472 pub fn delegate(
37473 mut self,
37474 new_value: &'a mut dyn common::Delegate,
37475 ) -> TransitobjectUpdateCall<'a, C> {
37476 self._delegate = Some(new_value);
37477 self
37478 }
37479
37480 /// Set any additional parameter of the query string used in the request.
37481 /// It should be used to set parameters which are not yet available through their own
37482 /// setters.
37483 ///
37484 /// Please note that this method must not be used to set any of the known parameters
37485 /// which have their own setter method. If done anyway, the request will fail.
37486 ///
37487 /// # Additional Parameters
37488 ///
37489 /// * *$.xgafv* (query-string) - V1 error format.
37490 /// * *access_token* (query-string) - OAuth access token.
37491 /// * *alt* (query-string) - Data format for response.
37492 /// * *callback* (query-string) - JSONP
37493 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37494 /// * *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.
37495 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37496 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37497 /// * *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.
37498 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37499 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37500 pub fn param<T>(mut self, name: T, value: T) -> TransitobjectUpdateCall<'a, C>
37501 where
37502 T: AsRef<str>,
37503 {
37504 self._additional_params
37505 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37506 self
37507 }
37508
37509 /// Identifies the authorization scope for the method you are building.
37510 ///
37511 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37512 /// [`Scope::WalletObjectIssuer`].
37513 ///
37514 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37515 /// tokens for more than one scope.
37516 ///
37517 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37518 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37519 /// sufficient, a read-write scope will do as well.
37520 pub fn add_scope<St>(mut self, scope: St) -> TransitobjectUpdateCall<'a, C>
37521 where
37522 St: AsRef<str>,
37523 {
37524 self._scopes.insert(String::from(scope.as_ref()));
37525 self
37526 }
37527 /// Identifies the authorization scope(s) for the method you are building.
37528 ///
37529 /// See [`Self::add_scope()`] for details.
37530 pub fn add_scopes<I, St>(mut self, scopes: I) -> TransitobjectUpdateCall<'a, C>
37531 where
37532 I: IntoIterator<Item = St>,
37533 St: AsRef<str>,
37534 {
37535 self._scopes
37536 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37537 self
37538 }
37539
37540 /// Removes all scopes, and no default scope will be used either.
37541 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37542 /// for details).
37543 pub fn clear_scopes(mut self) -> TransitobjectUpdateCall<'a, C> {
37544 self._scopes.clear();
37545 self
37546 }
37547}