google_mybusinessverifications1/
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// ########
12// HUB ###
13// ######
14
15/// Central instance to access all MyBusinessVerifications related resource activities
16///
17/// # Examples
18///
19/// Instantiate a new hub
20///
21/// ```test_harness,no_run
22/// extern crate hyper;
23/// extern crate hyper_rustls;
24/// extern crate google_mybusinessverifications1 as mybusinessverifications1;
25/// use mybusinessverifications1::api::VerifyLocationRequest;
26/// use mybusinessverifications1::{Result, Error};
27/// # async fn dox() {
28/// use mybusinessverifications1::{MyBusinessVerifications, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29///
30/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
31/// // `client_secret`, among other things.
32/// let secret: yup_oauth2::ApplicationSecret = Default::default();
33/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
34/// // unless you replace  `None` with the desired Flow.
35/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
36/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
37/// // retrieve them from storage.
38/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
39///     .with_native_roots()
40///     .unwrap()
41///     .https_only()
42///     .enable_http2()
43///     .build();
44///
45/// let executor = hyper_util::rt::TokioExecutor::new();
46/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
47///     secret,
48///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49///     yup_oauth2::client::CustomHyperClientBuilder::from(
50///         hyper_util::client::legacy::Client::builder(executor).build(connector),
51///     ),
52/// ).build().await.unwrap();
53///
54/// let client = hyper_util::client::legacy::Client::builder(
55///     hyper_util::rt::TokioExecutor::new()
56/// )
57/// .build(
58///     hyper_rustls::HttpsConnectorBuilder::new()
59///         .with_native_roots()
60///         .unwrap()
61///         .https_or_http()
62///         .enable_http2()
63///         .build()
64/// );
65/// let mut hub = MyBusinessVerifications::new(client, auth);
66/// // As the method needs a request, you would usually fill it with the desired information
67/// // into the respective structure. Some of the parts shown here might not be applicable !
68/// // Values shown here are possibly random and not representative !
69/// let mut req = VerifyLocationRequest::default();
70///
71/// // You can configure optional parameters by calling the respective setters at will, and
72/// // execute the final call using `doit()`.
73/// // Values shown here are possibly random and not representative !
74/// let result = hub.locations().verify(req, "name")
75///              .doit().await;
76///
77/// match result {
78///     Err(e) => match e {
79///         // The Error enum provides details about what exactly happened.
80///         // You can also just use its `Debug`, `Display` or `Error` traits
81///          Error::HttpError(_)
82///         |Error::Io(_)
83///         |Error::MissingAPIKey
84///         |Error::MissingToken(_)
85///         |Error::Cancelled
86///         |Error::UploadSizeLimitExceeded(_, _)
87///         |Error::Failure(_)
88///         |Error::BadRequest(_)
89///         |Error::FieldClash(_)
90///         |Error::JsonDecodeError(_, _) => println!("{}", e),
91///     },
92///     Ok(res) => println!("Success: {:?}", res),
93/// }
94/// # }
95/// ```
96#[derive(Clone)]
97pub struct MyBusinessVerifications<C> {
98    pub client: common::Client<C>,
99    pub auth: Box<dyn common::GetToken>,
100    _user_agent: String,
101    _base_url: String,
102    _root_url: String,
103}
104
105impl<C> common::Hub for MyBusinessVerifications<C> {}
106
107impl<'a, C> MyBusinessVerifications<C> {
108    pub fn new<A: 'static + common::GetToken>(
109        client: common::Client<C>,
110        auth: A,
111    ) -> MyBusinessVerifications<C> {
112        MyBusinessVerifications {
113            client,
114            auth: Box::new(auth),
115            _user_agent: "google-api-rust-client/7.0.0".to_string(),
116            _base_url: "https://mybusinessverifications.googleapis.com/".to_string(),
117            _root_url: "https://mybusinessverifications.googleapis.com/".to_string(),
118        }
119    }
120
121    pub fn locations(&'a self) -> LocationMethods<'a, C> {
122        LocationMethods { hub: self }
123    }
124    pub fn verification_tokens(&'a self) -> VerificationTokenMethods<'a, C> {
125        VerificationTokenMethods { hub: self }
126    }
127
128    /// Set the user-agent header field to use in all requests to the server.
129    /// It defaults to `google-api-rust-client/7.0.0`.
130    ///
131    /// Returns the previously set user-agent.
132    pub fn user_agent(&mut self, agent_name: String) -> String {
133        std::mem::replace(&mut self._user_agent, agent_name)
134    }
135
136    /// Set the base url to use in all requests to the server.
137    /// It defaults to `https://mybusinessverifications.googleapis.com/`.
138    ///
139    /// Returns the previously set base url.
140    pub fn base_url(&mut self, new_base_url: String) -> String {
141        std::mem::replace(&mut self._base_url, new_base_url)
142    }
143
144    /// Set the root url to use in all requests to the server.
145    /// It defaults to `https://mybusinessverifications.googleapis.com/`.
146    ///
147    /// Returns the previously set root url.
148    pub fn root_url(&mut self, new_root_url: String) -> String {
149        std::mem::replace(&mut self._root_url, new_root_url)
150    }
151}
152
153// ############
154// SCHEMAS ###
155// ##########
156/// Display data for verifications through postcard.
157///
158/// This type is not used in any activity, and only used as *part* of another schema.
159///
160#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
161#[serde_with::serde_as]
162#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
163pub struct AddressVerificationData {
164    /// Address that a postcard can be sent to.
165    pub address: Option<PostalAddress>,
166    /// Merchant's business name.
167    pub business: Option<String>,
168    /// Expected number of days it takes to deliver a postcard to the address's region.
169    #[serde(rename = "expectedDeliveryDaysRegion")]
170    pub expected_delivery_days_region: Option<i32>,
171}
172
173impl common::Part for AddressVerificationData {}
174
175/// Request message for Verifications.CompleteVerificationAction.
176///
177/// # Activities
178///
179/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
180/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
181///
182/// * [verifications complete locations](LocationVerificationCompleteCall) (request)
183#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
184#[serde_with::serde_as]
185#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
186pub struct CompleteVerificationRequest {
187    /// Required. PIN code received by the merchant to complete the verification.
188    pub pin: Option<String>,
189}
190
191impl common::RequestValue for CompleteVerificationRequest {}
192
193/// Response message for Verifications.CompleteVerificationAction.
194///
195/// # Activities
196///
197/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
198/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
199///
200/// * [verifications complete locations](LocationVerificationCompleteCall) (response)
201#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
202#[serde_with::serde_as]
203#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
204pub struct CompleteVerificationResponse {
205    /// The completed verification.
206    pub verification: Option<Verification>,
207}
208
209impl common::ResponseResult for CompleteVerificationResponse {}
210
211/// Indicates that the location fails to comply with our [guidelines](https://support.google.com/business/answer/3038177).
212///
213/// This type is not used in any activity, and only used as *part* of another schema.
214///
215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
216#[serde_with::serde_as]
217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
218pub struct ComplyWithGuidelines {
219    /// The reason why the location is being recommended to comply with guidelines.
220    #[serde(rename = "recommendationReason")]
221    pub recommendation_reason: Option<String>,
222}
223
224impl common::Part for ComplyWithGuidelines {}
225
226/// Display data for verifications through email.
227///
228/// This type is not used in any activity, and only used as *part* of another schema.
229///
230#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
231#[serde_with::serde_as]
232#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
233pub struct EmailVerificationData {
234    /// Domain name in the email address. e.g. "gmail.com" in foo@gmail.com
235    pub domain: Option<String>,
236    /// Whether client is allowed to provide a different user name.
237    #[serde(rename = "isUserNameEditable")]
238    pub is_user_name_editable: Option<bool>,
239    /// User name in the email address. e.g. "foo" in foo@gmail.com
240    pub user: Option<String>,
241}
242
243impl common::Part for EmailVerificationData {}
244
245/// Request message for Verifications.FetchVerificationOptions.
246///
247/// # Activities
248///
249/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
250/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
251///
252/// * [fetch verification options locations](LocationFetchVerificationOptionCall) (request)
253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
254#[serde_with::serde_as]
255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
256pub struct FetchVerificationOptionsRequest {
257    /// Optional. Extra context information for the verification of service businesses. Can only be applied to the locations whose business type is CUSTOMER_LOCATION_ONLY. Specifying an accurate address could enable more options. INVALID_ARGUMENT will be thrown if it is set for other business types of locations.
258    pub context: Option<ServiceBusinessContext>,
259    /// Required. The BCP 47 language code representing the language that is to be used for the verification process. Available options vary by language.
260    #[serde(rename = "languageCode")]
261    pub language_code: Option<String>,
262}
263
264impl common::RequestValue for FetchVerificationOptionsRequest {}
265
266/// Response message for Verifications.FetchVerificationOptions.
267///
268/// # Activities
269///
270/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
271/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
272///
273/// * [fetch verification options locations](LocationFetchVerificationOptionCall) (response)
274#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
275#[serde_with::serde_as]
276#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
277pub struct FetchVerificationOptionsResponse {
278    /// The available verification options.
279    pub options: Option<Vec<VerificationOption>>,
280}
281
282impl common::ResponseResult for FetchVerificationOptionsResponse {}
283
284/// Request message for Verifications.GenerateInstantVerificationToken.
285///
286/// # Activities
287///
288/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
289/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
290///
291/// * [generate verification tokens](VerificationTokenGenerateCall) (request)
292#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
293#[serde_with::serde_as]
294#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
295pub struct GenerateInstantVerificationTokenRequest {
296    /// Immutable. The address and other details of the location to generate an instant verification token for.
297    #[serde(rename = "locationData")]
298    pub location_data: Option<LocationData>,
299    /// The location identifier associated with an unverified listing. This is the location id generated at the time that the listing was originally created. It is the final portion of a location resource name as generated by the Google My Business API. Note: the caller must be an owner or manager of this listing in order to generate a verification token. See the [location resource](https://developers.google.com/my-business/reference/rest/v4/accounts.locations) documentation for more information.
300    #[serde(rename = "locationId")]
301    pub location_id: Option<String>,
302}
303
304impl common::RequestValue for GenerateInstantVerificationTokenRequest {}
305
306/// Response message for Verifications.GenerateInstantVerificationToken.
307///
308/// # Activities
309///
310/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
311/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
312///
313/// * [generate verification tokens](VerificationTokenGenerateCall) (response)
314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
315#[serde_with::serde_as]
316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
317pub struct GenerateInstantVerificationTokenResponse {
318    /// The generated instant verification token.
319    #[serde(rename = "instantVerificationToken")]
320    pub instant_verification_token: Option<String>,
321    /// Output only. The result of the instant verification token generation.
322    pub result: Option<String>,
323}
324
325impl common::ResponseResult for GenerateInstantVerificationTokenResponse {}
326
327/// Response message for Verifications.ListVerifications.
328///
329/// # Activities
330///
331/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
332/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
333///
334/// * [verifications list locations](LocationVerificationListCall) (response)
335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
336#[serde_with::serde_as]
337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
338pub struct ListVerificationsResponse {
339    /// If the number of verifications exceeded the requested page size, this field will be populated with a token to fetch the next page of verification on a subsequent call. If there are no more attributes, this field will not be present in the response.
340    #[serde(rename = "nextPageToken")]
341    pub next_page_token: Option<String>,
342    /// List of the verifications.
343    pub verifications: Option<Vec<Verification>>,
344}
345
346impl common::ResponseResult for ListVerificationsResponse {}
347
348/// The address and other details of the location to generate an instant verification token for.
349///
350/// This type is not used in any activity, and only used as *part* of another schema.
351///
352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
353#[serde_with::serde_as]
354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
355pub struct LocationData {
356    /// Immutable. A precise, accurate address to describe your business location. PO boxes or mailboxes located at remote locations are not acceptable. At this time, you can specify a maximum of five `address_lines` values in the address.
357    pub address: Option<PostalAddress>,
358    /// Immutable. Name should reflect your business's real-world name, as used consistently on your storefront, website, and stationery, and as known to customers. Any additional information, when relevant, can be included in other fields of the resource (for example, `Address`, `Categories`). Don't add unnecessary information to your name (for example, prefer "Google" over "Google Inc. - Mountain View Corporate Headquarters"). Don't include marketing taglines, store codes, special characters, hours or closed/open status, phone numbers, website URLs, service/product information, location/address or directions, or containment information (for example, "Chase ATM in Duane Reade").
359    pub name: Option<String>,
360}
361
362impl common::Part for LocationData {}
363
364/// Represents a postal address, such as for postal delivery or payments addresses. With a postal address, a postal service can deliver items to a premise, P.O. box, or similar. A postal address is not intended to model geographical locations like roads, towns, or mountains. In typical usage, an address would be created by user input or from importing existing data, depending on the type of process. Advice on address input or editing: - Use an internationalization-ready address widget such as https://github.com/google/libaddressinput. - Users should not be presented with UI elements for input or editing of fields outside countries where that field is used. For more guidance on how to use this schema, see: https://support.google.com/business/answer/6397478.
365///
366/// This type is not used in any activity, and only used as *part* of another schema.
367///
368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
369#[serde_with::serde_as]
370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
371pub struct PostalAddress {
372    /// Unstructured address lines describing the lower levels of an address. Because values in `address_lines` do not have type information and may sometimes contain multiple values in a single field (for example, "Austin, TX"), it is important that the line order is clear. The order of address lines should be "envelope order" for the country or region of the address. In places where this can vary (for example, Japan), `address_language` is used to make it explicit (for example, "ja" for large-to-small ordering and "ja-Latn" or "en" for small-to-large). In this way, the most specific line of an address can be selected based on the language. The minimum permitted structural representation of an address consists of a `region_code` with all remaining information placed in the `address_lines`. It would be possible to format such an address very approximately without geocoding, but no semantic reasoning could be made about any of the address components until it was at least partially resolved. Creating an address only containing a `region_code` and `address_lines` and then geocoding is the recommended way to handle completely unstructured addresses (as opposed to guessing which parts of the address should be localities or administrative areas).
373    #[serde(rename = "addressLines")]
374    pub address_lines: Option<Vec<String>>,
375    /// Optional. Highest administrative subdivision which is used for postal addresses of a country or region. For example, this can be a state, a province, an oblast, or a prefecture. For Spain, this is the province and not the autonomous community (for example, "Barcelona" and not "Catalonia"). Many countries don't use an administrative area in postal addresses. For example, in Switzerland, this should be left unpopulated.
376    #[serde(rename = "administrativeArea")]
377    pub administrative_area: Option<String>,
378    /// Optional. BCP-47 language code of the contents of this address (if known). This is often the UI language of the input form or is expected to match one of the languages used in the address' country/region, or their transliterated equivalents. This can affect formatting in certain countries, but is not critical to the correctness of the data and will never affect any validation or other non-formatting related operations. If this value is not known, it should be omitted (rather than specifying a possibly incorrect default). Examples: "zh-Hant", "ja", "ja-Latn", "en".
379    #[serde(rename = "languageCode")]
380    pub language_code: Option<String>,
381    /// Optional. Generally refers to the city or town portion of the address. Examples: US city, IT comune, UK post town. In regions of the world where localities are not well defined or do not fit into this structure well, leave `locality` empty and use `address_lines`.
382    pub locality: Option<String>,
383    /// Optional. The name of the organization at the address.
384    pub organization: Option<String>,
385    /// Optional. Postal code of the address. Not all countries use or require postal codes to be present, but where they are used, they may trigger additional validation with other parts of the address (for example, state or zip code validation in the United States).
386    #[serde(rename = "postalCode")]
387    pub postal_code: Option<String>,
388    /// Optional. The recipient at the address. This field may, under certain circumstances, contain multiline information. For example, it might contain "care of" information.
389    pub recipients: Option<Vec<String>>,
390    /// Required. CLDR region code of the country/region of the address. This is never inferred and it is up to the user to ensure the value is correct. See https://cldr.unicode.org/ and https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "CH" for Switzerland.
391    #[serde(rename = "regionCode")]
392    pub region_code: Option<String>,
393    /// The schema revision of the `PostalAddress`. This must be set to 0, which is the latest revision. All new revisions **must** be backward compatible with old revisions.
394    pub revision: Option<i32>,
395    /// Optional. Additional, country-specific, sorting code. This is not used in most regions. Where it is used, the value is either a string like "CEDEX", optionally followed by a number (for example, "CEDEX 7"), or just a number alone, representing the "sector code" (Jamaica), "delivery area indicator" (Malawi) or "post office indicator" (Côte d'Ivoire).
396    #[serde(rename = "sortingCode")]
397    pub sorting_code: Option<String>,
398    /// Optional. Sublocality of the address. For example, this can be a neighborhood, borough, or district.
399    pub sublocality: Option<String>,
400}
401
402impl common::Part for PostalAddress {}
403
404/// Indicates that the location duplicates another location that is in good standing.
405///
406/// This type is not used in any activity, and only used as *part* of another schema.
407///
408#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
409#[serde_with::serde_as]
410#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
411pub struct ResolveOwnershipConflict {
412    _never_set: Option<bool>,
413}
414
415impl common::Part for ResolveOwnershipConflict {}
416
417/// Additional data for service business verification.
418///
419/// This type is not used in any activity, and only used as *part* of another schema.
420///
421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
422#[serde_with::serde_as]
423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
424pub struct ServiceBusinessContext {
425    /// The verification address of the location. It is used to either enable more verification options or send a postcard.
426    pub address: Option<PostalAddress>,
427}
428
429impl common::Part for ServiceBusinessContext {}
430
431/// A verification represents a verification attempt on a location.
432///
433/// This type is not used in any activity, and only used as *part* of another schema.
434///
435#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
436#[serde_with::serde_as]
437#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
438pub struct Verification {
439    /// Optional. Response announcement set only if the method is VETTED_PARTNER.
440    pub announcement: Option<String>,
441    /// The timestamp when the verification is requested.
442    #[serde(rename = "createTime")]
443    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
444    /// The method of the verification.
445    pub method: Option<String>,
446    /// Resource name of the verification.
447    pub name: Option<String>,
448    /// The state of the verification.
449    pub state: Option<String>,
450}
451
452impl common::Part for Verification {}
453
454/// The verification option represents how to verify the location (indicated by verification method) and where the verification will be sent to (indicated by display data).
455///
456/// This type is not used in any activity, and only used as *part* of another schema.
457///
458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
459#[serde_with::serde_as]
460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
461pub struct VerificationOption {
462    /// Set only if the method is MAIL.
463    #[serde(rename = "addressData")]
464    pub address_data: Option<AddressVerificationData>,
465    /// Set only if the method is VETTED_PARTNER.
466    pub announcement: Option<String>,
467    /// Set only if the method is EMAIL.
468    #[serde(rename = "emailData")]
469    pub email_data: Option<EmailVerificationData>,
470    /// Set only if the method is PHONE_CALL or SMS. Phone number that the PIN will be sent to.
471    #[serde(rename = "phoneNumber")]
472    pub phone_number: Option<String>,
473    /// Method to verify the location.
474    #[serde(rename = "verificationMethod")]
475    pub verification_method: Option<String>,
476}
477
478impl common::Part for VerificationOption {}
479
480/// Token generated by a vetted [partner](https://support.google.com/business/answer/7674102).
481///
482/// # Activities
483///
484/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
485/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
486///
487/// * [generate verification tokens](VerificationTokenGenerateCall) (none)
488#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
489#[serde_with::serde_as]
490#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
491pub struct VerificationToken {
492    /// The token string.
493    #[serde(rename = "tokenString")]
494    pub token_string: Option<String>,
495}
496
497impl common::Resource for VerificationToken {}
498
499/// Indicates that the location requires verification. Contains information about the current verification actions performed on the location.
500///
501/// This type is not used in any activity, and only used as *part* of another schema.
502///
503#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
504#[serde_with::serde_as]
505#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
506pub struct Verify {
507    /// Indicates whether a verification process has already started, and can be completed by the location.
508    #[serde(rename = "hasPendingVerification")]
509    pub has_pending_verification: Option<bool>,
510}
511
512impl common::Part for Verify {}
513
514/// Request message for Verifications.VerifyLocation.
515///
516/// # Activities
517///
518/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
519/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
520///
521/// * [verify locations](LocationVerifyCall) (request)
522#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
523#[serde_with::serde_as]
524#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
525pub struct VerifyLocationRequest {
526    /// Optional. Extra context information for the verification of service businesses. It is only required for the locations whose business type is CUSTOMER_LOCATION_ONLY. For ADDRESS verification, the address will be used to send out postcard. For other methods, it should be the same as the one that is passed to GetVerificationOptions. INVALID_ARGUMENT will be thrown if it is set for other types of business locations.
527    pub context: Option<ServiceBusinessContext>,
528    /// Optional. The input for EMAIL method. Email address where the PIN should be sent to. An email address is accepted only if it is one of the addresses provided by FetchVerificationOptions. If the EmailVerificationData has is_user_name_editable set to true, the client may specify a different user name (local-part) but must match the domain name.
529    #[serde(rename = "emailAddress")]
530    pub email_address: Option<String>,
531    /// Optional. The BCP 47 language code representing the language that is to be used for the verification process.
532    #[serde(rename = "languageCode")]
533    pub language_code: Option<String>,
534    /// Optional. The input for ADDRESS method. Contact name the mail should be sent to.
535    #[serde(rename = "mailerContact")]
536    pub mailer_contact: Option<String>,
537    /// Required. Verification method.
538    pub method: Option<String>,
539    /// Optional. The input for PHONE_CALL/SMS method The phone number that should be called or be sent SMS to. It must be one of the phone numbers in the eligible options.
540    #[serde(rename = "phoneNumber")]
541    pub phone_number: Option<String>,
542    /// Optional. The input for VETTED_PARTNER method available to select [partners.](https://support.google.com/business/answer/7674102) The input is not needed for a vetted account. Token that is associated to the location. Token that is associated to the location.
543    pub token: Option<VerificationToken>,
544    /// The input for TRUSTED_PARTNER method The verification token that is associated to the location.
545    #[serde(rename = "trustedPartnerToken")]
546    pub trusted_partner_token: Option<String>,
547}
548
549impl common::RequestValue for VerifyLocationRequest {}
550
551/// Response message for Verifications.VerifyLocation.
552///
553/// # Activities
554///
555/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
556/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
557///
558/// * [verify locations](LocationVerifyCall) (response)
559#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
560#[serde_with::serde_as]
561#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
562pub struct VerifyLocationResponse {
563    /// The created verification request.
564    pub verification: Option<Verification>,
565}
566
567impl common::ResponseResult for VerifyLocationResponse {}
568
569/// Response message for VoiceOfMerchant.GetVoiceOfMerchantState.
570///
571/// # Activities
572///
573/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
574/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
575///
576/// * [get voice of merchant state locations](LocationGetVoiceOfMerchantStateCall) (response)
577#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
578#[serde_with::serde_as]
579#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
580pub struct VoiceOfMerchantState {
581    /// The location fails to comply with our [guidelines](https://support.google.com/business/answer/3038177) and requires additional steps for reinstatement. To fix this issue, consult the [Help Center Article](https://support.google.com/business/answer/4569145).
582    #[serde(rename = "complyWithGuidelines")]
583    pub comply_with_guidelines: Option<ComplyWithGuidelines>,
584    /// Indicates whether the location has the authority (ownership) over the business on Google. If true, another location cannot take over and become the dominant listing on Maps. However, edits will not become live unless Voice of Merchant is gained (i.e. has_voice_of_merchant is true).
585    #[serde(rename = "hasBusinessAuthority")]
586    pub has_business_authority: Option<bool>,
587    /// Indicates whether the location is in good standing and has control over the business on Google. Any edits made to the location will propagate to Maps after passing the review phase.
588    #[serde(rename = "hasVoiceOfMerchant")]
589    pub has_voice_of_merchant: Option<bool>,
590    /// This location duplicates another location that is in good standing. If you have access to the location in good standing, use that location's id to perform operations. Otherwise, request access from the current owner.
591    #[serde(rename = "resolveOwnershipConflict")]
592    pub resolve_ownership_conflict: Option<ResolveOwnershipConflict>,
593    /// Start or continue the verification process.
594    pub verify: Option<Verify>,
595    /// Wait to gain Voice of Merchant. The location is under review for quality purposes.
596    #[serde(rename = "waitForVoiceOfMerchant")]
597    pub wait_for_voice_of_merchant: Option<WaitForVoiceOfMerchant>,
598}
599
600impl common::ResponseResult for VoiceOfMerchantState {}
601
602/// Indicates that the location will gain voice of merchant after passing review.
603///
604/// This type is not used in any activity, and only used as *part* of another schema.
605///
606#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
607#[serde_with::serde_as]
608#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
609pub struct WaitForVoiceOfMerchant {
610    _never_set: Option<bool>,
611}
612
613impl common::Part for WaitForVoiceOfMerchant {}
614
615// ###################
616// MethodBuilders ###
617// #################
618
619/// A builder providing access to all methods supported on *location* resources.
620/// It is not used directly, but through the [`MyBusinessVerifications`] hub.
621///
622/// # Example
623///
624/// Instantiate a resource builder
625///
626/// ```test_harness,no_run
627/// extern crate hyper;
628/// extern crate hyper_rustls;
629/// extern crate google_mybusinessverifications1 as mybusinessverifications1;
630///
631/// # async fn dox() {
632/// use mybusinessverifications1::{MyBusinessVerifications, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
633///
634/// let secret: yup_oauth2::ApplicationSecret = Default::default();
635/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
636///     .with_native_roots()
637///     .unwrap()
638///     .https_only()
639///     .enable_http2()
640///     .build();
641///
642/// let executor = hyper_util::rt::TokioExecutor::new();
643/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
644///     secret,
645///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
646///     yup_oauth2::client::CustomHyperClientBuilder::from(
647///         hyper_util::client::legacy::Client::builder(executor).build(connector),
648///     ),
649/// ).build().await.unwrap();
650///
651/// let client = hyper_util::client::legacy::Client::builder(
652///     hyper_util::rt::TokioExecutor::new()
653/// )
654/// .build(
655///     hyper_rustls::HttpsConnectorBuilder::new()
656///         .with_native_roots()
657///         .unwrap()
658///         .https_or_http()
659///         .enable_http2()
660///         .build()
661/// );
662/// let mut hub = MyBusinessVerifications::new(client, auth);
663/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
664/// // like `fetch_verification_options(...)`, `get_voice_of_merchant_state(...)`, `verifications_complete(...)`, `verifications_list(...)` and `verify(...)`
665/// // to build up your call.
666/// let rb = hub.locations();
667/// # }
668/// ```
669pub struct LocationMethods<'a, C>
670where
671    C: 'a,
672{
673    hub: &'a MyBusinessVerifications<C>,
674}
675
676impl<'a, C> common::MethodsBuilder for LocationMethods<'a, C> {}
677
678impl<'a, C> LocationMethods<'a, C> {
679    /// Create a builder to help you perform the following task:
680    ///
681    /// Completes a `PENDING` verification. It is only necessary for non `AUTO` verification methods. `AUTO` verification request is instantly `VERIFIED` upon creation.
682    ///
683    /// # Arguments
684    ///
685    /// * `request` - No description provided.
686    /// * `name` - Required. Resource name of the verification to complete.
687    pub fn verifications_complete(
688        &self,
689        request: CompleteVerificationRequest,
690        name: &str,
691    ) -> LocationVerificationCompleteCall<'a, C> {
692        LocationVerificationCompleteCall {
693            hub: self.hub,
694            _request: request,
695            _name: name.to_string(),
696            _delegate: Default::default(),
697            _additional_params: Default::default(),
698        }
699    }
700
701    /// Create a builder to help you perform the following task:
702    ///
703    /// List verifications of a location, ordered by create time.
704    ///
705    /// # Arguments
706    ///
707    /// * `parent` - Required. Resource name of the location that verification requests belong to.
708    pub fn verifications_list(&self, parent: &str) -> LocationVerificationListCall<'a, C> {
709        LocationVerificationListCall {
710            hub: self.hub,
711            _parent: parent.to_string(),
712            _page_token: Default::default(),
713            _page_size: Default::default(),
714            _delegate: Default::default(),
715            _additional_params: Default::default(),
716        }
717    }
718
719    /// Create a builder to help you perform the following task:
720    ///
721    /// Reports all eligible verification options for a location in a specific language.
722    ///
723    /// # Arguments
724    ///
725    /// * `request` - No description provided.
726    /// * `location` - Required. The location to verify.
727    pub fn fetch_verification_options(
728        &self,
729        request: FetchVerificationOptionsRequest,
730        location: &str,
731    ) -> LocationFetchVerificationOptionCall<'a, C> {
732        LocationFetchVerificationOptionCall {
733            hub: self.hub,
734            _request: request,
735            _location: location.to_string(),
736            _delegate: Default::default(),
737            _additional_params: Default::default(),
738        }
739    }
740
741    /// Create a builder to help you perform the following task:
742    ///
743    /// Gets the VoiceOfMerchant state.
744    ///
745    /// # Arguments
746    ///
747    /// * `name` - Required. Resource name of the location.
748    pub fn get_voice_of_merchant_state(
749        &self,
750        name: &str,
751    ) -> LocationGetVoiceOfMerchantStateCall<'a, C> {
752        LocationGetVoiceOfMerchantStateCall {
753            hub: self.hub,
754            _name: name.to_string(),
755            _delegate: Default::default(),
756            _additional_params: Default::default(),
757        }
758    }
759
760    /// Create a builder to help you perform the following task:
761    ///
762    /// Starts the verification process for a location.
763    ///
764    /// # Arguments
765    ///
766    /// * `request` - No description provided.
767    /// * `name` - Required. Resource name of the location to verify.
768    pub fn verify(&self, request: VerifyLocationRequest, name: &str) -> LocationVerifyCall<'a, C> {
769        LocationVerifyCall {
770            hub: self.hub,
771            _request: request,
772            _name: name.to_string(),
773            _delegate: Default::default(),
774            _additional_params: Default::default(),
775        }
776    }
777}
778
779/// A builder providing access to all methods supported on *verificationToken* resources.
780/// It is not used directly, but through the [`MyBusinessVerifications`] hub.
781///
782/// # Example
783///
784/// Instantiate a resource builder
785///
786/// ```test_harness,no_run
787/// extern crate hyper;
788/// extern crate hyper_rustls;
789/// extern crate google_mybusinessverifications1 as mybusinessverifications1;
790///
791/// # async fn dox() {
792/// use mybusinessverifications1::{MyBusinessVerifications, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
793///
794/// let secret: yup_oauth2::ApplicationSecret = Default::default();
795/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
796///     .with_native_roots()
797///     .unwrap()
798///     .https_only()
799///     .enable_http2()
800///     .build();
801///
802/// let executor = hyper_util::rt::TokioExecutor::new();
803/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
804///     secret,
805///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
806///     yup_oauth2::client::CustomHyperClientBuilder::from(
807///         hyper_util::client::legacy::Client::builder(executor).build(connector),
808///     ),
809/// ).build().await.unwrap();
810///
811/// let client = hyper_util::client::legacy::Client::builder(
812///     hyper_util::rt::TokioExecutor::new()
813/// )
814/// .build(
815///     hyper_rustls::HttpsConnectorBuilder::new()
816///         .with_native_roots()
817///         .unwrap()
818///         .https_or_http()
819///         .enable_http2()
820///         .build()
821/// );
822/// let mut hub = MyBusinessVerifications::new(client, auth);
823/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
824/// // like `generate(...)`
825/// // to build up your call.
826/// let rb = hub.verification_tokens();
827/// # }
828/// ```
829pub struct VerificationTokenMethods<'a, C>
830where
831    C: 'a,
832{
833    hub: &'a MyBusinessVerifications<C>,
834}
835
836impl<'a, C> common::MethodsBuilder for VerificationTokenMethods<'a, C> {}
837
838impl<'a, C> VerificationTokenMethods<'a, C> {
839    /// Create a builder to help you perform the following task:
840    ///
841    /// Generate a token for the provided location data to verify the location.
842    ///
843    /// # Arguments
844    ///
845    /// * `request` - No description provided.
846    pub fn generate(
847        &self,
848        request: GenerateInstantVerificationTokenRequest,
849    ) -> VerificationTokenGenerateCall<'a, C> {
850        VerificationTokenGenerateCall {
851            hub: self.hub,
852            _request: request,
853            _delegate: Default::default(),
854            _additional_params: Default::default(),
855        }
856    }
857}
858
859// ###################
860// CallBuilders   ###
861// #################
862
863/// Completes a `PENDING` verification. It is only necessary for non `AUTO` verification methods. `AUTO` verification request is instantly `VERIFIED` upon creation.
864///
865/// A builder for the *verifications.complete* method supported by a *location* resource.
866/// It is not used directly, but through a [`LocationMethods`] instance.
867///
868/// # Example
869///
870/// Instantiate a resource method builder
871///
872/// ```test_harness,no_run
873/// # extern crate hyper;
874/// # extern crate hyper_rustls;
875/// # extern crate google_mybusinessverifications1 as mybusinessverifications1;
876/// use mybusinessverifications1::api::CompleteVerificationRequest;
877/// # async fn dox() {
878/// # use mybusinessverifications1::{MyBusinessVerifications, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
879///
880/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
881/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
882/// #     .with_native_roots()
883/// #     .unwrap()
884/// #     .https_only()
885/// #     .enable_http2()
886/// #     .build();
887///
888/// # let executor = hyper_util::rt::TokioExecutor::new();
889/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
890/// #     secret,
891/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
892/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
893/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
894/// #     ),
895/// # ).build().await.unwrap();
896///
897/// # let client = hyper_util::client::legacy::Client::builder(
898/// #     hyper_util::rt::TokioExecutor::new()
899/// # )
900/// # .build(
901/// #     hyper_rustls::HttpsConnectorBuilder::new()
902/// #         .with_native_roots()
903/// #         .unwrap()
904/// #         .https_or_http()
905/// #         .enable_http2()
906/// #         .build()
907/// # );
908/// # let mut hub = MyBusinessVerifications::new(client, auth);
909/// // As the method needs a request, you would usually fill it with the desired information
910/// // into the respective structure. Some of the parts shown here might not be applicable !
911/// // Values shown here are possibly random and not representative !
912/// let mut req = CompleteVerificationRequest::default();
913///
914/// // You can configure optional parameters by calling the respective setters at will, and
915/// // execute the final call using `doit()`.
916/// // Values shown here are possibly random and not representative !
917/// let result = hub.locations().verifications_complete(req, "name")
918///              .doit().await;
919/// # }
920/// ```
921pub struct LocationVerificationCompleteCall<'a, C>
922where
923    C: 'a,
924{
925    hub: &'a MyBusinessVerifications<C>,
926    _request: CompleteVerificationRequest,
927    _name: String,
928    _delegate: Option<&'a mut dyn common::Delegate>,
929    _additional_params: HashMap<String, String>,
930}
931
932impl<'a, C> common::CallBuilder for LocationVerificationCompleteCall<'a, C> {}
933
934impl<'a, C> LocationVerificationCompleteCall<'a, C>
935where
936    C: common::Connector,
937{
938    /// Perform the operation you have build so far.
939    pub async fn doit(
940        mut self,
941    ) -> common::Result<(common::Response, CompleteVerificationResponse)> {
942        use std::borrow::Cow;
943        use std::io::{Read, Seek};
944
945        use common::{url::Params, ToParts};
946        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
947
948        let mut dd = common::DefaultDelegate;
949        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
950        dlg.begin(common::MethodInfo {
951            id: "mybusinessverifications.locations.verifications.complete",
952            http_method: hyper::Method::POST,
953        });
954
955        for &field in ["alt", "name"].iter() {
956            if self._additional_params.contains_key(field) {
957                dlg.finished(false);
958                return Err(common::Error::FieldClash(field));
959            }
960        }
961
962        let mut params = Params::with_capacity(4 + self._additional_params.len());
963        params.push("name", self._name);
964
965        params.extend(self._additional_params.iter());
966
967        params.push("alt", "json");
968        let mut url = self.hub._base_url.clone() + "v1/{+name}:complete";
969
970        match dlg.api_key() {
971            Some(value) => params.push("key", value),
972            None => {
973                dlg.finished(false);
974                return Err(common::Error::MissingAPIKey);
975            }
976        }
977
978        #[allow(clippy::single_element_loop)]
979        for &(find_this, param_name) in [("{+name}", "name")].iter() {
980            url = params.uri_replacement(url, param_name, find_this, true);
981        }
982        {
983            let to_remove = ["name"];
984            params.remove_params(&to_remove);
985        }
986
987        let url = params.parse_with_url(&url);
988
989        let mut json_mime_type = mime::APPLICATION_JSON;
990        let mut request_value_reader = {
991            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
992            common::remove_json_null_values(&mut value);
993            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
994            serde_json::to_writer(&mut dst, &value).unwrap();
995            dst
996        };
997        let request_size = request_value_reader
998            .seek(std::io::SeekFrom::End(0))
999            .unwrap();
1000        request_value_reader
1001            .seek(std::io::SeekFrom::Start(0))
1002            .unwrap();
1003
1004        loop {
1005            request_value_reader
1006                .seek(std::io::SeekFrom::Start(0))
1007                .unwrap();
1008            let mut req_result = {
1009                let client = &self.hub.client;
1010                dlg.pre_request();
1011                let mut req_builder = hyper::Request::builder()
1012                    .method(hyper::Method::POST)
1013                    .uri(url.as_str())
1014                    .header(USER_AGENT, self.hub._user_agent.clone());
1015
1016                let request = req_builder
1017                    .header(CONTENT_TYPE, json_mime_type.to_string())
1018                    .header(CONTENT_LENGTH, request_size as u64)
1019                    .body(common::to_body(
1020                        request_value_reader.get_ref().clone().into(),
1021                    ));
1022
1023                client.request(request.unwrap()).await
1024            };
1025
1026            match req_result {
1027                Err(err) => {
1028                    if let common::Retry::After(d) = dlg.http_error(&err) {
1029                        sleep(d).await;
1030                        continue;
1031                    }
1032                    dlg.finished(false);
1033                    return Err(common::Error::HttpError(err));
1034                }
1035                Ok(res) => {
1036                    let (mut parts, body) = res.into_parts();
1037                    let mut body = common::Body::new(body);
1038                    if !parts.status.is_success() {
1039                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1040                        let error = serde_json::from_str(&common::to_string(&bytes));
1041                        let response = common::to_response(parts, bytes.into());
1042
1043                        if let common::Retry::After(d) =
1044                            dlg.http_failure(&response, error.as_ref().ok())
1045                        {
1046                            sleep(d).await;
1047                            continue;
1048                        }
1049
1050                        dlg.finished(false);
1051
1052                        return Err(match error {
1053                            Ok(value) => common::Error::BadRequest(value),
1054                            _ => common::Error::Failure(response),
1055                        });
1056                    }
1057                    let response = {
1058                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1059                        let encoded = common::to_string(&bytes);
1060                        match serde_json::from_str(&encoded) {
1061                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1062                            Err(error) => {
1063                                dlg.response_json_decode_error(&encoded, &error);
1064                                return Err(common::Error::JsonDecodeError(
1065                                    encoded.to_string(),
1066                                    error,
1067                                ));
1068                            }
1069                        }
1070                    };
1071
1072                    dlg.finished(true);
1073                    return Ok(response);
1074                }
1075            }
1076        }
1077    }
1078
1079    ///
1080    /// Sets the *request* property to the given value.
1081    ///
1082    /// Even though the property as already been set when instantiating this call,
1083    /// we provide this method for API completeness.
1084    pub fn request(
1085        mut self,
1086        new_value: CompleteVerificationRequest,
1087    ) -> LocationVerificationCompleteCall<'a, C> {
1088        self._request = new_value;
1089        self
1090    }
1091    /// Required. Resource name of the verification to complete.
1092    ///
1093    /// Sets the *name* path property to the given value.
1094    ///
1095    /// Even though the property as already been set when instantiating this call,
1096    /// we provide this method for API completeness.
1097    pub fn name(mut self, new_value: &str) -> LocationVerificationCompleteCall<'a, C> {
1098        self._name = new_value.to_string();
1099        self
1100    }
1101    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1102    /// while executing the actual API request.
1103    ///
1104    /// ````text
1105    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1106    /// ````
1107    ///
1108    /// Sets the *delegate* property to the given value.
1109    pub fn delegate(
1110        mut self,
1111        new_value: &'a mut dyn common::Delegate,
1112    ) -> LocationVerificationCompleteCall<'a, C> {
1113        self._delegate = Some(new_value);
1114        self
1115    }
1116
1117    /// Set any additional parameter of the query string used in the request.
1118    /// It should be used to set parameters which are not yet available through their own
1119    /// setters.
1120    ///
1121    /// Please note that this method must not be used to set any of the known parameters
1122    /// which have their own setter method. If done anyway, the request will fail.
1123    ///
1124    /// # Additional Parameters
1125    ///
1126    /// * *$.xgafv* (query-string) - V1 error format.
1127    /// * *access_token* (query-string) - OAuth access token.
1128    /// * *alt* (query-string) - Data format for response.
1129    /// * *callback* (query-string) - JSONP
1130    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1131    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1132    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1133    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1134    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1135    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1136    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1137    pub fn param<T>(mut self, name: T, value: T) -> LocationVerificationCompleteCall<'a, C>
1138    where
1139        T: AsRef<str>,
1140    {
1141        self._additional_params
1142            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1143        self
1144    }
1145}
1146
1147/// List verifications of a location, ordered by create time.
1148///
1149/// A builder for the *verifications.list* method supported by a *location* resource.
1150/// It is not used directly, but through a [`LocationMethods`] instance.
1151///
1152/// # Example
1153///
1154/// Instantiate a resource method builder
1155///
1156/// ```test_harness,no_run
1157/// # extern crate hyper;
1158/// # extern crate hyper_rustls;
1159/// # extern crate google_mybusinessverifications1 as mybusinessverifications1;
1160/// # async fn dox() {
1161/// # use mybusinessverifications1::{MyBusinessVerifications, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1162///
1163/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1164/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1165/// #     .with_native_roots()
1166/// #     .unwrap()
1167/// #     .https_only()
1168/// #     .enable_http2()
1169/// #     .build();
1170///
1171/// # let executor = hyper_util::rt::TokioExecutor::new();
1172/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1173/// #     secret,
1174/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1175/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1176/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1177/// #     ),
1178/// # ).build().await.unwrap();
1179///
1180/// # let client = hyper_util::client::legacy::Client::builder(
1181/// #     hyper_util::rt::TokioExecutor::new()
1182/// # )
1183/// # .build(
1184/// #     hyper_rustls::HttpsConnectorBuilder::new()
1185/// #         .with_native_roots()
1186/// #         .unwrap()
1187/// #         .https_or_http()
1188/// #         .enable_http2()
1189/// #         .build()
1190/// # );
1191/// # let mut hub = MyBusinessVerifications::new(client, auth);
1192/// // You can configure optional parameters by calling the respective setters at will, and
1193/// // execute the final call using `doit()`.
1194/// // Values shown here are possibly random and not representative !
1195/// let result = hub.locations().verifications_list("parent")
1196///              .page_token("At")
1197///              .page_size(-8)
1198///              .doit().await;
1199/// # }
1200/// ```
1201pub struct LocationVerificationListCall<'a, C>
1202where
1203    C: 'a,
1204{
1205    hub: &'a MyBusinessVerifications<C>,
1206    _parent: String,
1207    _page_token: Option<String>,
1208    _page_size: Option<i32>,
1209    _delegate: Option<&'a mut dyn common::Delegate>,
1210    _additional_params: HashMap<String, String>,
1211}
1212
1213impl<'a, C> common::CallBuilder for LocationVerificationListCall<'a, C> {}
1214
1215impl<'a, C> LocationVerificationListCall<'a, C>
1216where
1217    C: common::Connector,
1218{
1219    /// Perform the operation you have build so far.
1220    pub async fn doit(mut self) -> common::Result<(common::Response, ListVerificationsResponse)> {
1221        use std::borrow::Cow;
1222        use std::io::{Read, Seek};
1223
1224        use common::{url::Params, ToParts};
1225        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1226
1227        let mut dd = common::DefaultDelegate;
1228        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1229        dlg.begin(common::MethodInfo {
1230            id: "mybusinessverifications.locations.verifications.list",
1231            http_method: hyper::Method::GET,
1232        });
1233
1234        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
1235            if self._additional_params.contains_key(field) {
1236                dlg.finished(false);
1237                return Err(common::Error::FieldClash(field));
1238            }
1239        }
1240
1241        let mut params = Params::with_capacity(5 + self._additional_params.len());
1242        params.push("parent", self._parent);
1243        if let Some(value) = self._page_token.as_ref() {
1244            params.push("pageToken", value);
1245        }
1246        if let Some(value) = self._page_size.as_ref() {
1247            params.push("pageSize", value.to_string());
1248        }
1249
1250        params.extend(self._additional_params.iter());
1251
1252        params.push("alt", "json");
1253        let mut url = self.hub._base_url.clone() + "v1/{+parent}/verifications";
1254
1255        match dlg.api_key() {
1256            Some(value) => params.push("key", value),
1257            None => {
1258                dlg.finished(false);
1259                return Err(common::Error::MissingAPIKey);
1260            }
1261        }
1262
1263        #[allow(clippy::single_element_loop)]
1264        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1265            url = params.uri_replacement(url, param_name, find_this, true);
1266        }
1267        {
1268            let to_remove = ["parent"];
1269            params.remove_params(&to_remove);
1270        }
1271
1272        let url = params.parse_with_url(&url);
1273
1274        loop {
1275            let mut req_result = {
1276                let client = &self.hub.client;
1277                dlg.pre_request();
1278                let mut req_builder = hyper::Request::builder()
1279                    .method(hyper::Method::GET)
1280                    .uri(url.as_str())
1281                    .header(USER_AGENT, self.hub._user_agent.clone());
1282
1283                let request = req_builder
1284                    .header(CONTENT_LENGTH, 0_u64)
1285                    .body(common::to_body::<String>(None));
1286
1287                client.request(request.unwrap()).await
1288            };
1289
1290            match req_result {
1291                Err(err) => {
1292                    if let common::Retry::After(d) = dlg.http_error(&err) {
1293                        sleep(d).await;
1294                        continue;
1295                    }
1296                    dlg.finished(false);
1297                    return Err(common::Error::HttpError(err));
1298                }
1299                Ok(res) => {
1300                    let (mut parts, body) = res.into_parts();
1301                    let mut body = common::Body::new(body);
1302                    if !parts.status.is_success() {
1303                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1304                        let error = serde_json::from_str(&common::to_string(&bytes));
1305                        let response = common::to_response(parts, bytes.into());
1306
1307                        if let common::Retry::After(d) =
1308                            dlg.http_failure(&response, error.as_ref().ok())
1309                        {
1310                            sleep(d).await;
1311                            continue;
1312                        }
1313
1314                        dlg.finished(false);
1315
1316                        return Err(match error {
1317                            Ok(value) => common::Error::BadRequest(value),
1318                            _ => common::Error::Failure(response),
1319                        });
1320                    }
1321                    let response = {
1322                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1323                        let encoded = common::to_string(&bytes);
1324                        match serde_json::from_str(&encoded) {
1325                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1326                            Err(error) => {
1327                                dlg.response_json_decode_error(&encoded, &error);
1328                                return Err(common::Error::JsonDecodeError(
1329                                    encoded.to_string(),
1330                                    error,
1331                                ));
1332                            }
1333                        }
1334                    };
1335
1336                    dlg.finished(true);
1337                    return Ok(response);
1338                }
1339            }
1340        }
1341    }
1342
1343    /// Required. Resource name of the location that verification requests belong to.
1344    ///
1345    /// Sets the *parent* path property to the given value.
1346    ///
1347    /// Even though the property as already been set when instantiating this call,
1348    /// we provide this method for API completeness.
1349    pub fn parent(mut self, new_value: &str) -> LocationVerificationListCall<'a, C> {
1350        self._parent = new_value.to_string();
1351        self
1352    }
1353    /// If specified, returns the next page of verifications.
1354    ///
1355    /// Sets the *page token* query property to the given value.
1356    pub fn page_token(mut self, new_value: &str) -> LocationVerificationListCall<'a, C> {
1357        self._page_token = Some(new_value.to_string());
1358        self
1359    }
1360    /// How many verification to include per page. Minimum is 1, and the default and maximum page size is 100.
1361    ///
1362    /// Sets the *page size* query property to the given value.
1363    pub fn page_size(mut self, new_value: i32) -> LocationVerificationListCall<'a, C> {
1364        self._page_size = Some(new_value);
1365        self
1366    }
1367    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1368    /// while executing the actual API request.
1369    ///
1370    /// ````text
1371    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1372    /// ````
1373    ///
1374    /// Sets the *delegate* property to the given value.
1375    pub fn delegate(
1376        mut self,
1377        new_value: &'a mut dyn common::Delegate,
1378    ) -> LocationVerificationListCall<'a, C> {
1379        self._delegate = Some(new_value);
1380        self
1381    }
1382
1383    /// Set any additional parameter of the query string used in the request.
1384    /// It should be used to set parameters which are not yet available through their own
1385    /// setters.
1386    ///
1387    /// Please note that this method must not be used to set any of the known parameters
1388    /// which have their own setter method. If done anyway, the request will fail.
1389    ///
1390    /// # Additional Parameters
1391    ///
1392    /// * *$.xgafv* (query-string) - V1 error format.
1393    /// * *access_token* (query-string) - OAuth access token.
1394    /// * *alt* (query-string) - Data format for response.
1395    /// * *callback* (query-string) - JSONP
1396    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1397    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1398    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1399    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1400    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1401    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1402    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1403    pub fn param<T>(mut self, name: T, value: T) -> LocationVerificationListCall<'a, C>
1404    where
1405        T: AsRef<str>,
1406    {
1407        self._additional_params
1408            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1409        self
1410    }
1411}
1412
1413/// Reports all eligible verification options for a location in a specific language.
1414///
1415/// A builder for the *fetchVerificationOptions* method supported by a *location* resource.
1416/// It is not used directly, but through a [`LocationMethods`] instance.
1417///
1418/// # Example
1419///
1420/// Instantiate a resource method builder
1421///
1422/// ```test_harness,no_run
1423/// # extern crate hyper;
1424/// # extern crate hyper_rustls;
1425/// # extern crate google_mybusinessverifications1 as mybusinessverifications1;
1426/// use mybusinessverifications1::api::FetchVerificationOptionsRequest;
1427/// # async fn dox() {
1428/// # use mybusinessverifications1::{MyBusinessVerifications, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1429///
1430/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1431/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1432/// #     .with_native_roots()
1433/// #     .unwrap()
1434/// #     .https_only()
1435/// #     .enable_http2()
1436/// #     .build();
1437///
1438/// # let executor = hyper_util::rt::TokioExecutor::new();
1439/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1440/// #     secret,
1441/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1442/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1443/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1444/// #     ),
1445/// # ).build().await.unwrap();
1446///
1447/// # let client = hyper_util::client::legacy::Client::builder(
1448/// #     hyper_util::rt::TokioExecutor::new()
1449/// # )
1450/// # .build(
1451/// #     hyper_rustls::HttpsConnectorBuilder::new()
1452/// #         .with_native_roots()
1453/// #         .unwrap()
1454/// #         .https_or_http()
1455/// #         .enable_http2()
1456/// #         .build()
1457/// # );
1458/// # let mut hub = MyBusinessVerifications::new(client, auth);
1459/// // As the method needs a request, you would usually fill it with the desired information
1460/// // into the respective structure. Some of the parts shown here might not be applicable !
1461/// // Values shown here are possibly random and not representative !
1462/// let mut req = FetchVerificationOptionsRequest::default();
1463///
1464/// // You can configure optional parameters by calling the respective setters at will, and
1465/// // execute the final call using `doit()`.
1466/// // Values shown here are possibly random and not representative !
1467/// let result = hub.locations().fetch_verification_options(req, "location")
1468///              .doit().await;
1469/// # }
1470/// ```
1471pub struct LocationFetchVerificationOptionCall<'a, C>
1472where
1473    C: 'a,
1474{
1475    hub: &'a MyBusinessVerifications<C>,
1476    _request: FetchVerificationOptionsRequest,
1477    _location: String,
1478    _delegate: Option<&'a mut dyn common::Delegate>,
1479    _additional_params: HashMap<String, String>,
1480}
1481
1482impl<'a, C> common::CallBuilder for LocationFetchVerificationOptionCall<'a, C> {}
1483
1484impl<'a, C> LocationFetchVerificationOptionCall<'a, C>
1485where
1486    C: common::Connector,
1487{
1488    /// Perform the operation you have build so far.
1489    pub async fn doit(
1490        mut self,
1491    ) -> common::Result<(common::Response, FetchVerificationOptionsResponse)> {
1492        use std::borrow::Cow;
1493        use std::io::{Read, Seek};
1494
1495        use common::{url::Params, ToParts};
1496        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1497
1498        let mut dd = common::DefaultDelegate;
1499        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1500        dlg.begin(common::MethodInfo {
1501            id: "mybusinessverifications.locations.fetchVerificationOptions",
1502            http_method: hyper::Method::POST,
1503        });
1504
1505        for &field in ["alt", "location"].iter() {
1506            if self._additional_params.contains_key(field) {
1507                dlg.finished(false);
1508                return Err(common::Error::FieldClash(field));
1509            }
1510        }
1511
1512        let mut params = Params::with_capacity(4 + self._additional_params.len());
1513        params.push("location", self._location);
1514
1515        params.extend(self._additional_params.iter());
1516
1517        params.push("alt", "json");
1518        let mut url = self.hub._base_url.clone() + "v1/{+location}:fetchVerificationOptions";
1519
1520        match dlg.api_key() {
1521            Some(value) => params.push("key", value),
1522            None => {
1523                dlg.finished(false);
1524                return Err(common::Error::MissingAPIKey);
1525            }
1526        }
1527
1528        #[allow(clippy::single_element_loop)]
1529        for &(find_this, param_name) in [("{+location}", "location")].iter() {
1530            url = params.uri_replacement(url, param_name, find_this, true);
1531        }
1532        {
1533            let to_remove = ["location"];
1534            params.remove_params(&to_remove);
1535        }
1536
1537        let url = params.parse_with_url(&url);
1538
1539        let mut json_mime_type = mime::APPLICATION_JSON;
1540        let mut request_value_reader = {
1541            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1542            common::remove_json_null_values(&mut value);
1543            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1544            serde_json::to_writer(&mut dst, &value).unwrap();
1545            dst
1546        };
1547        let request_size = request_value_reader
1548            .seek(std::io::SeekFrom::End(0))
1549            .unwrap();
1550        request_value_reader
1551            .seek(std::io::SeekFrom::Start(0))
1552            .unwrap();
1553
1554        loop {
1555            request_value_reader
1556                .seek(std::io::SeekFrom::Start(0))
1557                .unwrap();
1558            let mut req_result = {
1559                let client = &self.hub.client;
1560                dlg.pre_request();
1561                let mut req_builder = hyper::Request::builder()
1562                    .method(hyper::Method::POST)
1563                    .uri(url.as_str())
1564                    .header(USER_AGENT, self.hub._user_agent.clone());
1565
1566                let request = req_builder
1567                    .header(CONTENT_TYPE, json_mime_type.to_string())
1568                    .header(CONTENT_LENGTH, request_size as u64)
1569                    .body(common::to_body(
1570                        request_value_reader.get_ref().clone().into(),
1571                    ));
1572
1573                client.request(request.unwrap()).await
1574            };
1575
1576            match req_result {
1577                Err(err) => {
1578                    if let common::Retry::After(d) = dlg.http_error(&err) {
1579                        sleep(d).await;
1580                        continue;
1581                    }
1582                    dlg.finished(false);
1583                    return Err(common::Error::HttpError(err));
1584                }
1585                Ok(res) => {
1586                    let (mut parts, body) = res.into_parts();
1587                    let mut body = common::Body::new(body);
1588                    if !parts.status.is_success() {
1589                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1590                        let error = serde_json::from_str(&common::to_string(&bytes));
1591                        let response = common::to_response(parts, bytes.into());
1592
1593                        if let common::Retry::After(d) =
1594                            dlg.http_failure(&response, error.as_ref().ok())
1595                        {
1596                            sleep(d).await;
1597                            continue;
1598                        }
1599
1600                        dlg.finished(false);
1601
1602                        return Err(match error {
1603                            Ok(value) => common::Error::BadRequest(value),
1604                            _ => common::Error::Failure(response),
1605                        });
1606                    }
1607                    let response = {
1608                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1609                        let encoded = common::to_string(&bytes);
1610                        match serde_json::from_str(&encoded) {
1611                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1612                            Err(error) => {
1613                                dlg.response_json_decode_error(&encoded, &error);
1614                                return Err(common::Error::JsonDecodeError(
1615                                    encoded.to_string(),
1616                                    error,
1617                                ));
1618                            }
1619                        }
1620                    };
1621
1622                    dlg.finished(true);
1623                    return Ok(response);
1624                }
1625            }
1626        }
1627    }
1628
1629    ///
1630    /// Sets the *request* property to the given value.
1631    ///
1632    /// Even though the property as already been set when instantiating this call,
1633    /// we provide this method for API completeness.
1634    pub fn request(
1635        mut self,
1636        new_value: FetchVerificationOptionsRequest,
1637    ) -> LocationFetchVerificationOptionCall<'a, C> {
1638        self._request = new_value;
1639        self
1640    }
1641    /// Required. The location to verify.
1642    ///
1643    /// Sets the *location* path property to the given value.
1644    ///
1645    /// Even though the property as already been set when instantiating this call,
1646    /// we provide this method for API completeness.
1647    pub fn location(mut self, new_value: &str) -> LocationFetchVerificationOptionCall<'a, C> {
1648        self._location = new_value.to_string();
1649        self
1650    }
1651    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1652    /// while executing the actual API request.
1653    ///
1654    /// ````text
1655    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1656    /// ````
1657    ///
1658    /// Sets the *delegate* property to the given value.
1659    pub fn delegate(
1660        mut self,
1661        new_value: &'a mut dyn common::Delegate,
1662    ) -> LocationFetchVerificationOptionCall<'a, C> {
1663        self._delegate = Some(new_value);
1664        self
1665    }
1666
1667    /// Set any additional parameter of the query string used in the request.
1668    /// It should be used to set parameters which are not yet available through their own
1669    /// setters.
1670    ///
1671    /// Please note that this method must not be used to set any of the known parameters
1672    /// which have their own setter method. If done anyway, the request will fail.
1673    ///
1674    /// # Additional Parameters
1675    ///
1676    /// * *$.xgafv* (query-string) - V1 error format.
1677    /// * *access_token* (query-string) - OAuth access token.
1678    /// * *alt* (query-string) - Data format for response.
1679    /// * *callback* (query-string) - JSONP
1680    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1681    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1682    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1683    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1684    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1685    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1686    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1687    pub fn param<T>(mut self, name: T, value: T) -> LocationFetchVerificationOptionCall<'a, C>
1688    where
1689        T: AsRef<str>,
1690    {
1691        self._additional_params
1692            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1693        self
1694    }
1695}
1696
1697/// Gets the VoiceOfMerchant state.
1698///
1699/// A builder for the *getVoiceOfMerchantState* method supported by a *location* resource.
1700/// It is not used directly, but through a [`LocationMethods`] instance.
1701///
1702/// # Example
1703///
1704/// Instantiate a resource method builder
1705///
1706/// ```test_harness,no_run
1707/// # extern crate hyper;
1708/// # extern crate hyper_rustls;
1709/// # extern crate google_mybusinessverifications1 as mybusinessverifications1;
1710/// # async fn dox() {
1711/// # use mybusinessverifications1::{MyBusinessVerifications, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1712///
1713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1714/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1715/// #     .with_native_roots()
1716/// #     .unwrap()
1717/// #     .https_only()
1718/// #     .enable_http2()
1719/// #     .build();
1720///
1721/// # let executor = hyper_util::rt::TokioExecutor::new();
1722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1723/// #     secret,
1724/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1725/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1726/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1727/// #     ),
1728/// # ).build().await.unwrap();
1729///
1730/// # let client = hyper_util::client::legacy::Client::builder(
1731/// #     hyper_util::rt::TokioExecutor::new()
1732/// # )
1733/// # .build(
1734/// #     hyper_rustls::HttpsConnectorBuilder::new()
1735/// #         .with_native_roots()
1736/// #         .unwrap()
1737/// #         .https_or_http()
1738/// #         .enable_http2()
1739/// #         .build()
1740/// # );
1741/// # let mut hub = MyBusinessVerifications::new(client, auth);
1742/// // You can configure optional parameters by calling the respective setters at will, and
1743/// // execute the final call using `doit()`.
1744/// // Values shown here are possibly random and not representative !
1745/// let result = hub.locations().get_voice_of_merchant_state("name")
1746///              .doit().await;
1747/// # }
1748/// ```
1749pub struct LocationGetVoiceOfMerchantStateCall<'a, C>
1750where
1751    C: 'a,
1752{
1753    hub: &'a MyBusinessVerifications<C>,
1754    _name: String,
1755    _delegate: Option<&'a mut dyn common::Delegate>,
1756    _additional_params: HashMap<String, String>,
1757}
1758
1759impl<'a, C> common::CallBuilder for LocationGetVoiceOfMerchantStateCall<'a, C> {}
1760
1761impl<'a, C> LocationGetVoiceOfMerchantStateCall<'a, C>
1762where
1763    C: common::Connector,
1764{
1765    /// Perform the operation you have build so far.
1766    pub async fn doit(mut self) -> common::Result<(common::Response, VoiceOfMerchantState)> {
1767        use std::borrow::Cow;
1768        use std::io::{Read, Seek};
1769
1770        use common::{url::Params, ToParts};
1771        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1772
1773        let mut dd = common::DefaultDelegate;
1774        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1775        dlg.begin(common::MethodInfo {
1776            id: "mybusinessverifications.locations.getVoiceOfMerchantState",
1777            http_method: hyper::Method::GET,
1778        });
1779
1780        for &field in ["alt", "name"].iter() {
1781            if self._additional_params.contains_key(field) {
1782                dlg.finished(false);
1783                return Err(common::Error::FieldClash(field));
1784            }
1785        }
1786
1787        let mut params = Params::with_capacity(3 + self._additional_params.len());
1788        params.push("name", self._name);
1789
1790        params.extend(self._additional_params.iter());
1791
1792        params.push("alt", "json");
1793        let mut url = self.hub._base_url.clone() + "v1/{+name}/VoiceOfMerchantState";
1794
1795        match dlg.api_key() {
1796            Some(value) => params.push("key", value),
1797            None => {
1798                dlg.finished(false);
1799                return Err(common::Error::MissingAPIKey);
1800            }
1801        }
1802
1803        #[allow(clippy::single_element_loop)]
1804        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1805            url = params.uri_replacement(url, param_name, find_this, true);
1806        }
1807        {
1808            let to_remove = ["name"];
1809            params.remove_params(&to_remove);
1810        }
1811
1812        let url = params.parse_with_url(&url);
1813
1814        loop {
1815            let mut req_result = {
1816                let client = &self.hub.client;
1817                dlg.pre_request();
1818                let mut req_builder = hyper::Request::builder()
1819                    .method(hyper::Method::GET)
1820                    .uri(url.as_str())
1821                    .header(USER_AGENT, self.hub._user_agent.clone());
1822
1823                let request = req_builder
1824                    .header(CONTENT_LENGTH, 0_u64)
1825                    .body(common::to_body::<String>(None));
1826
1827                client.request(request.unwrap()).await
1828            };
1829
1830            match req_result {
1831                Err(err) => {
1832                    if let common::Retry::After(d) = dlg.http_error(&err) {
1833                        sleep(d).await;
1834                        continue;
1835                    }
1836                    dlg.finished(false);
1837                    return Err(common::Error::HttpError(err));
1838                }
1839                Ok(res) => {
1840                    let (mut parts, body) = res.into_parts();
1841                    let mut body = common::Body::new(body);
1842                    if !parts.status.is_success() {
1843                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1844                        let error = serde_json::from_str(&common::to_string(&bytes));
1845                        let response = common::to_response(parts, bytes.into());
1846
1847                        if let common::Retry::After(d) =
1848                            dlg.http_failure(&response, error.as_ref().ok())
1849                        {
1850                            sleep(d).await;
1851                            continue;
1852                        }
1853
1854                        dlg.finished(false);
1855
1856                        return Err(match error {
1857                            Ok(value) => common::Error::BadRequest(value),
1858                            _ => common::Error::Failure(response),
1859                        });
1860                    }
1861                    let response = {
1862                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1863                        let encoded = common::to_string(&bytes);
1864                        match serde_json::from_str(&encoded) {
1865                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1866                            Err(error) => {
1867                                dlg.response_json_decode_error(&encoded, &error);
1868                                return Err(common::Error::JsonDecodeError(
1869                                    encoded.to_string(),
1870                                    error,
1871                                ));
1872                            }
1873                        }
1874                    };
1875
1876                    dlg.finished(true);
1877                    return Ok(response);
1878                }
1879            }
1880        }
1881    }
1882
1883    /// Required. Resource name of the location.
1884    ///
1885    /// Sets the *name* path property to the given value.
1886    ///
1887    /// Even though the property as already been set when instantiating this call,
1888    /// we provide this method for API completeness.
1889    pub fn name(mut self, new_value: &str) -> LocationGetVoiceOfMerchantStateCall<'a, C> {
1890        self._name = new_value.to_string();
1891        self
1892    }
1893    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1894    /// while executing the actual API request.
1895    ///
1896    /// ````text
1897    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1898    /// ````
1899    ///
1900    /// Sets the *delegate* property to the given value.
1901    pub fn delegate(
1902        mut self,
1903        new_value: &'a mut dyn common::Delegate,
1904    ) -> LocationGetVoiceOfMerchantStateCall<'a, C> {
1905        self._delegate = Some(new_value);
1906        self
1907    }
1908
1909    /// Set any additional parameter of the query string used in the request.
1910    /// It should be used to set parameters which are not yet available through their own
1911    /// setters.
1912    ///
1913    /// Please note that this method must not be used to set any of the known parameters
1914    /// which have their own setter method. If done anyway, the request will fail.
1915    ///
1916    /// # Additional Parameters
1917    ///
1918    /// * *$.xgafv* (query-string) - V1 error format.
1919    /// * *access_token* (query-string) - OAuth access token.
1920    /// * *alt* (query-string) - Data format for response.
1921    /// * *callback* (query-string) - JSONP
1922    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1923    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1924    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1925    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1926    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1927    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1928    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1929    pub fn param<T>(mut self, name: T, value: T) -> LocationGetVoiceOfMerchantStateCall<'a, C>
1930    where
1931        T: AsRef<str>,
1932    {
1933        self._additional_params
1934            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1935        self
1936    }
1937}
1938
1939/// Starts the verification process for a location.
1940///
1941/// A builder for the *verify* method supported by a *location* resource.
1942/// It is not used directly, but through a [`LocationMethods`] instance.
1943///
1944/// # Example
1945///
1946/// Instantiate a resource method builder
1947///
1948/// ```test_harness,no_run
1949/// # extern crate hyper;
1950/// # extern crate hyper_rustls;
1951/// # extern crate google_mybusinessverifications1 as mybusinessverifications1;
1952/// use mybusinessverifications1::api::VerifyLocationRequest;
1953/// # async fn dox() {
1954/// # use mybusinessverifications1::{MyBusinessVerifications, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1955///
1956/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1957/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1958/// #     .with_native_roots()
1959/// #     .unwrap()
1960/// #     .https_only()
1961/// #     .enable_http2()
1962/// #     .build();
1963///
1964/// # let executor = hyper_util::rt::TokioExecutor::new();
1965/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1966/// #     secret,
1967/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1968/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1969/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1970/// #     ),
1971/// # ).build().await.unwrap();
1972///
1973/// # let client = hyper_util::client::legacy::Client::builder(
1974/// #     hyper_util::rt::TokioExecutor::new()
1975/// # )
1976/// # .build(
1977/// #     hyper_rustls::HttpsConnectorBuilder::new()
1978/// #         .with_native_roots()
1979/// #         .unwrap()
1980/// #         .https_or_http()
1981/// #         .enable_http2()
1982/// #         .build()
1983/// # );
1984/// # let mut hub = MyBusinessVerifications::new(client, auth);
1985/// // As the method needs a request, you would usually fill it with the desired information
1986/// // into the respective structure. Some of the parts shown here might not be applicable !
1987/// // Values shown here are possibly random and not representative !
1988/// let mut req = VerifyLocationRequest::default();
1989///
1990/// // You can configure optional parameters by calling the respective setters at will, and
1991/// // execute the final call using `doit()`.
1992/// // Values shown here are possibly random and not representative !
1993/// let result = hub.locations().verify(req, "name")
1994///              .doit().await;
1995/// # }
1996/// ```
1997pub struct LocationVerifyCall<'a, C>
1998where
1999    C: 'a,
2000{
2001    hub: &'a MyBusinessVerifications<C>,
2002    _request: VerifyLocationRequest,
2003    _name: String,
2004    _delegate: Option<&'a mut dyn common::Delegate>,
2005    _additional_params: HashMap<String, String>,
2006}
2007
2008impl<'a, C> common::CallBuilder for LocationVerifyCall<'a, C> {}
2009
2010impl<'a, C> LocationVerifyCall<'a, C>
2011where
2012    C: common::Connector,
2013{
2014    /// Perform the operation you have build so far.
2015    pub async fn doit(mut self) -> common::Result<(common::Response, VerifyLocationResponse)> {
2016        use std::borrow::Cow;
2017        use std::io::{Read, Seek};
2018
2019        use common::{url::Params, ToParts};
2020        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2021
2022        let mut dd = common::DefaultDelegate;
2023        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2024        dlg.begin(common::MethodInfo {
2025            id: "mybusinessverifications.locations.verify",
2026            http_method: hyper::Method::POST,
2027        });
2028
2029        for &field in ["alt", "name"].iter() {
2030            if self._additional_params.contains_key(field) {
2031                dlg.finished(false);
2032                return Err(common::Error::FieldClash(field));
2033            }
2034        }
2035
2036        let mut params = Params::with_capacity(4 + self._additional_params.len());
2037        params.push("name", self._name);
2038
2039        params.extend(self._additional_params.iter());
2040
2041        params.push("alt", "json");
2042        let mut url = self.hub._base_url.clone() + "v1/{+name}:verify";
2043
2044        match dlg.api_key() {
2045            Some(value) => params.push("key", value),
2046            None => {
2047                dlg.finished(false);
2048                return Err(common::Error::MissingAPIKey);
2049            }
2050        }
2051
2052        #[allow(clippy::single_element_loop)]
2053        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2054            url = params.uri_replacement(url, param_name, find_this, true);
2055        }
2056        {
2057            let to_remove = ["name"];
2058            params.remove_params(&to_remove);
2059        }
2060
2061        let url = params.parse_with_url(&url);
2062
2063        let mut json_mime_type = mime::APPLICATION_JSON;
2064        let mut request_value_reader = {
2065            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2066            common::remove_json_null_values(&mut value);
2067            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2068            serde_json::to_writer(&mut dst, &value).unwrap();
2069            dst
2070        };
2071        let request_size = request_value_reader
2072            .seek(std::io::SeekFrom::End(0))
2073            .unwrap();
2074        request_value_reader
2075            .seek(std::io::SeekFrom::Start(0))
2076            .unwrap();
2077
2078        loop {
2079            request_value_reader
2080                .seek(std::io::SeekFrom::Start(0))
2081                .unwrap();
2082            let mut req_result = {
2083                let client = &self.hub.client;
2084                dlg.pre_request();
2085                let mut req_builder = hyper::Request::builder()
2086                    .method(hyper::Method::POST)
2087                    .uri(url.as_str())
2088                    .header(USER_AGENT, self.hub._user_agent.clone());
2089
2090                let request = req_builder
2091                    .header(CONTENT_TYPE, json_mime_type.to_string())
2092                    .header(CONTENT_LENGTH, request_size as u64)
2093                    .body(common::to_body(
2094                        request_value_reader.get_ref().clone().into(),
2095                    ));
2096
2097                client.request(request.unwrap()).await
2098            };
2099
2100            match req_result {
2101                Err(err) => {
2102                    if let common::Retry::After(d) = dlg.http_error(&err) {
2103                        sleep(d).await;
2104                        continue;
2105                    }
2106                    dlg.finished(false);
2107                    return Err(common::Error::HttpError(err));
2108                }
2109                Ok(res) => {
2110                    let (mut parts, body) = res.into_parts();
2111                    let mut body = common::Body::new(body);
2112                    if !parts.status.is_success() {
2113                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2114                        let error = serde_json::from_str(&common::to_string(&bytes));
2115                        let response = common::to_response(parts, bytes.into());
2116
2117                        if let common::Retry::After(d) =
2118                            dlg.http_failure(&response, error.as_ref().ok())
2119                        {
2120                            sleep(d).await;
2121                            continue;
2122                        }
2123
2124                        dlg.finished(false);
2125
2126                        return Err(match error {
2127                            Ok(value) => common::Error::BadRequest(value),
2128                            _ => common::Error::Failure(response),
2129                        });
2130                    }
2131                    let response = {
2132                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2133                        let encoded = common::to_string(&bytes);
2134                        match serde_json::from_str(&encoded) {
2135                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2136                            Err(error) => {
2137                                dlg.response_json_decode_error(&encoded, &error);
2138                                return Err(common::Error::JsonDecodeError(
2139                                    encoded.to_string(),
2140                                    error,
2141                                ));
2142                            }
2143                        }
2144                    };
2145
2146                    dlg.finished(true);
2147                    return Ok(response);
2148                }
2149            }
2150        }
2151    }
2152
2153    ///
2154    /// Sets the *request* property to the given value.
2155    ///
2156    /// Even though the property as already been set when instantiating this call,
2157    /// we provide this method for API completeness.
2158    pub fn request(mut self, new_value: VerifyLocationRequest) -> LocationVerifyCall<'a, C> {
2159        self._request = new_value;
2160        self
2161    }
2162    /// Required. Resource name of the location to verify.
2163    ///
2164    /// Sets the *name* path property to the given value.
2165    ///
2166    /// Even though the property as already been set when instantiating this call,
2167    /// we provide this method for API completeness.
2168    pub fn name(mut self, new_value: &str) -> LocationVerifyCall<'a, C> {
2169        self._name = new_value.to_string();
2170        self
2171    }
2172    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2173    /// while executing the actual API request.
2174    ///
2175    /// ````text
2176    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2177    /// ````
2178    ///
2179    /// Sets the *delegate* property to the given value.
2180    pub fn delegate(
2181        mut self,
2182        new_value: &'a mut dyn common::Delegate,
2183    ) -> LocationVerifyCall<'a, C> {
2184        self._delegate = Some(new_value);
2185        self
2186    }
2187
2188    /// Set any additional parameter of the query string used in the request.
2189    /// It should be used to set parameters which are not yet available through their own
2190    /// setters.
2191    ///
2192    /// Please note that this method must not be used to set any of the known parameters
2193    /// which have their own setter method. If done anyway, the request will fail.
2194    ///
2195    /// # Additional Parameters
2196    ///
2197    /// * *$.xgafv* (query-string) - V1 error format.
2198    /// * *access_token* (query-string) - OAuth access token.
2199    /// * *alt* (query-string) - Data format for response.
2200    /// * *callback* (query-string) - JSONP
2201    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2202    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2203    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2204    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2205    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2206    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2207    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2208    pub fn param<T>(mut self, name: T, value: T) -> LocationVerifyCall<'a, C>
2209    where
2210        T: AsRef<str>,
2211    {
2212        self._additional_params
2213            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2214        self
2215    }
2216}
2217
2218/// Generate a token for the provided location data to verify the location.
2219///
2220/// A builder for the *generate* method supported by a *verificationToken* resource.
2221/// It is not used directly, but through a [`VerificationTokenMethods`] instance.
2222///
2223/// # Example
2224///
2225/// Instantiate a resource method builder
2226///
2227/// ```test_harness,no_run
2228/// # extern crate hyper;
2229/// # extern crate hyper_rustls;
2230/// # extern crate google_mybusinessverifications1 as mybusinessverifications1;
2231/// use mybusinessverifications1::api::GenerateInstantVerificationTokenRequest;
2232/// # async fn dox() {
2233/// # use mybusinessverifications1::{MyBusinessVerifications, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2234///
2235/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2236/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2237/// #     .with_native_roots()
2238/// #     .unwrap()
2239/// #     .https_only()
2240/// #     .enable_http2()
2241/// #     .build();
2242///
2243/// # let executor = hyper_util::rt::TokioExecutor::new();
2244/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2245/// #     secret,
2246/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2247/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2248/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2249/// #     ),
2250/// # ).build().await.unwrap();
2251///
2252/// # let client = hyper_util::client::legacy::Client::builder(
2253/// #     hyper_util::rt::TokioExecutor::new()
2254/// # )
2255/// # .build(
2256/// #     hyper_rustls::HttpsConnectorBuilder::new()
2257/// #         .with_native_roots()
2258/// #         .unwrap()
2259/// #         .https_or_http()
2260/// #         .enable_http2()
2261/// #         .build()
2262/// # );
2263/// # let mut hub = MyBusinessVerifications::new(client, auth);
2264/// // As the method needs a request, you would usually fill it with the desired information
2265/// // into the respective structure. Some of the parts shown here might not be applicable !
2266/// // Values shown here are possibly random and not representative !
2267/// let mut req = GenerateInstantVerificationTokenRequest::default();
2268///
2269/// // You can configure optional parameters by calling the respective setters at will, and
2270/// // execute the final call using `doit()`.
2271/// // Values shown here are possibly random and not representative !
2272/// let result = hub.verification_tokens().generate(req)
2273///              .doit().await;
2274/// # }
2275/// ```
2276pub struct VerificationTokenGenerateCall<'a, C>
2277where
2278    C: 'a,
2279{
2280    hub: &'a MyBusinessVerifications<C>,
2281    _request: GenerateInstantVerificationTokenRequest,
2282    _delegate: Option<&'a mut dyn common::Delegate>,
2283    _additional_params: HashMap<String, String>,
2284}
2285
2286impl<'a, C> common::CallBuilder for VerificationTokenGenerateCall<'a, C> {}
2287
2288impl<'a, C> VerificationTokenGenerateCall<'a, C>
2289where
2290    C: common::Connector,
2291{
2292    /// Perform the operation you have build so far.
2293    pub async fn doit(
2294        mut self,
2295    ) -> common::Result<(common::Response, GenerateInstantVerificationTokenResponse)> {
2296        use std::borrow::Cow;
2297        use std::io::{Read, Seek};
2298
2299        use common::{url::Params, ToParts};
2300        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2301
2302        let mut dd = common::DefaultDelegate;
2303        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2304        dlg.begin(common::MethodInfo {
2305            id: "mybusinessverifications.verificationTokens.generate",
2306            http_method: hyper::Method::POST,
2307        });
2308
2309        for &field in ["alt"].iter() {
2310            if self._additional_params.contains_key(field) {
2311                dlg.finished(false);
2312                return Err(common::Error::FieldClash(field));
2313            }
2314        }
2315
2316        let mut params = Params::with_capacity(3 + self._additional_params.len());
2317
2318        params.extend(self._additional_params.iter());
2319
2320        params.push("alt", "json");
2321        let mut url = self.hub._base_url.clone() + "v1/verificationTokens:generate";
2322
2323        match dlg.api_key() {
2324            Some(value) => params.push("key", value),
2325            None => {
2326                dlg.finished(false);
2327                return Err(common::Error::MissingAPIKey);
2328            }
2329        }
2330
2331        let url = params.parse_with_url(&url);
2332
2333        let mut json_mime_type = mime::APPLICATION_JSON;
2334        let mut request_value_reader = {
2335            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2336            common::remove_json_null_values(&mut value);
2337            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2338            serde_json::to_writer(&mut dst, &value).unwrap();
2339            dst
2340        };
2341        let request_size = request_value_reader
2342            .seek(std::io::SeekFrom::End(0))
2343            .unwrap();
2344        request_value_reader
2345            .seek(std::io::SeekFrom::Start(0))
2346            .unwrap();
2347
2348        loop {
2349            request_value_reader
2350                .seek(std::io::SeekFrom::Start(0))
2351                .unwrap();
2352            let mut req_result = {
2353                let client = &self.hub.client;
2354                dlg.pre_request();
2355                let mut req_builder = hyper::Request::builder()
2356                    .method(hyper::Method::POST)
2357                    .uri(url.as_str())
2358                    .header(USER_AGENT, self.hub._user_agent.clone());
2359
2360                let request = req_builder
2361                    .header(CONTENT_TYPE, json_mime_type.to_string())
2362                    .header(CONTENT_LENGTH, request_size as u64)
2363                    .body(common::to_body(
2364                        request_value_reader.get_ref().clone().into(),
2365                    ));
2366
2367                client.request(request.unwrap()).await
2368            };
2369
2370            match req_result {
2371                Err(err) => {
2372                    if let common::Retry::After(d) = dlg.http_error(&err) {
2373                        sleep(d).await;
2374                        continue;
2375                    }
2376                    dlg.finished(false);
2377                    return Err(common::Error::HttpError(err));
2378                }
2379                Ok(res) => {
2380                    let (mut parts, body) = res.into_parts();
2381                    let mut body = common::Body::new(body);
2382                    if !parts.status.is_success() {
2383                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2384                        let error = serde_json::from_str(&common::to_string(&bytes));
2385                        let response = common::to_response(parts, bytes.into());
2386
2387                        if let common::Retry::After(d) =
2388                            dlg.http_failure(&response, error.as_ref().ok())
2389                        {
2390                            sleep(d).await;
2391                            continue;
2392                        }
2393
2394                        dlg.finished(false);
2395
2396                        return Err(match error {
2397                            Ok(value) => common::Error::BadRequest(value),
2398                            _ => common::Error::Failure(response),
2399                        });
2400                    }
2401                    let response = {
2402                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2403                        let encoded = common::to_string(&bytes);
2404                        match serde_json::from_str(&encoded) {
2405                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2406                            Err(error) => {
2407                                dlg.response_json_decode_error(&encoded, &error);
2408                                return Err(common::Error::JsonDecodeError(
2409                                    encoded.to_string(),
2410                                    error,
2411                                ));
2412                            }
2413                        }
2414                    };
2415
2416                    dlg.finished(true);
2417                    return Ok(response);
2418                }
2419            }
2420        }
2421    }
2422
2423    ///
2424    /// Sets the *request* property to the given value.
2425    ///
2426    /// Even though the property as already been set when instantiating this call,
2427    /// we provide this method for API completeness.
2428    pub fn request(
2429        mut self,
2430        new_value: GenerateInstantVerificationTokenRequest,
2431    ) -> VerificationTokenGenerateCall<'a, C> {
2432        self._request = new_value;
2433        self
2434    }
2435    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2436    /// while executing the actual API request.
2437    ///
2438    /// ````text
2439    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2440    /// ````
2441    ///
2442    /// Sets the *delegate* property to the given value.
2443    pub fn delegate(
2444        mut self,
2445        new_value: &'a mut dyn common::Delegate,
2446    ) -> VerificationTokenGenerateCall<'a, C> {
2447        self._delegate = Some(new_value);
2448        self
2449    }
2450
2451    /// Set any additional parameter of the query string used in the request.
2452    /// It should be used to set parameters which are not yet available through their own
2453    /// setters.
2454    ///
2455    /// Please note that this method must not be used to set any of the known parameters
2456    /// which have their own setter method. If done anyway, the request will fail.
2457    ///
2458    /// # Additional Parameters
2459    ///
2460    /// * *$.xgafv* (query-string) - V1 error format.
2461    /// * *access_token* (query-string) - OAuth access token.
2462    /// * *alt* (query-string) - Data format for response.
2463    /// * *callback* (query-string) - JSONP
2464    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2465    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2466    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2467    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2468    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2469    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2470    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2471    pub fn param<T>(mut self, name: T, value: T) -> VerificationTokenGenerateCall<'a, C>
2472    where
2473        T: AsRef<str>,
2474    {
2475        self._additional_params
2476            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2477        self
2478    }
2479}