google_localservices1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, create, and delete your Google Ads accounts and data.
17    Adword,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::Adword => "https://www.googleapis.com/auth/adwords",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::Adword
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all Localservices related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_localservices1 as localservices1;
49/// use localservices1::{Result, Error};
50/// # async fn dox() {
51/// use localservices1::{Localservices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace  `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
62///     .with_native_roots()
63///     .unwrap()
64///     .https_only()
65///     .enable_http2()
66///     .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70///     secret,
71///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72///     yup_oauth2::client::CustomHyperClientBuilder::from(
73///         hyper_util::client::legacy::Client::builder(executor).build(connector),
74///     ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78///     hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81///     hyper_rustls::HttpsConnectorBuilder::new()
82///         .with_native_roots()
83///         .unwrap()
84///         .https_or_http()
85///         .enable_http2()
86///         .build()
87/// );
88/// let mut hub = Localservices::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.account_reports().search()
93///              .start_date_year(-17)
94///              .start_date_month(-55)
95///              .start_date_day(-88)
96///              .query("amet")
97///              .page_token("duo")
98///              .page_size(-50)
99///              .end_date_year(-93)
100///              .end_date_month(-37)
101///              .end_date_day(-12)
102///              .doit().await;
103///
104/// match result {
105///     Err(e) => match e {
106///         // The Error enum provides details about what exactly happened.
107///         // You can also just use its `Debug`, `Display` or `Error` traits
108///          Error::HttpError(_)
109///         |Error::Io(_)
110///         |Error::MissingAPIKey
111///         |Error::MissingToken(_)
112///         |Error::Cancelled
113///         |Error::UploadSizeLimitExceeded(_, _)
114///         |Error::Failure(_)
115///         |Error::BadRequest(_)
116///         |Error::FieldClash(_)
117///         |Error::JsonDecodeError(_, _) => println!("{}", e),
118///     },
119///     Ok(res) => println!("Success: {:?}", res),
120/// }
121/// # }
122/// ```
123#[derive(Clone)]
124pub struct Localservices<C> {
125    pub client: common::Client<C>,
126    pub auth: Box<dyn common::GetToken>,
127    _user_agent: String,
128    _base_url: String,
129    _root_url: String,
130}
131
132impl<C> common::Hub for Localservices<C> {}
133
134impl<'a, C> Localservices<C> {
135    pub fn new<A: 'static + common::GetToken>(
136        client: common::Client<C>,
137        auth: A,
138    ) -> Localservices<C> {
139        Localservices {
140            client,
141            auth: Box::new(auth),
142            _user_agent: "google-api-rust-client/7.0.0".to_string(),
143            _base_url: "https://localservices.googleapis.com/".to_string(),
144            _root_url: "https://localservices.googleapis.com/".to_string(),
145        }
146    }
147
148    pub fn account_reports(&'a self) -> AccountReportMethods<'a, C> {
149        AccountReportMethods { hub: self }
150    }
151    pub fn detailed_lead_reports(&'a self) -> DetailedLeadReportMethods<'a, C> {
152        DetailedLeadReportMethods { hub: self }
153    }
154
155    /// Set the user-agent header field to use in all requests to the server.
156    /// It defaults to `google-api-rust-client/7.0.0`.
157    ///
158    /// Returns the previously set user-agent.
159    pub fn user_agent(&mut self, agent_name: String) -> String {
160        std::mem::replace(&mut self._user_agent, agent_name)
161    }
162
163    /// Set the base url to use in all requests to the server.
164    /// It defaults to `https://localservices.googleapis.com/`.
165    ///
166    /// Returns the previously set base url.
167    pub fn base_url(&mut self, new_base_url: String) -> String {
168        std::mem::replace(&mut self._base_url, new_base_url)
169    }
170
171    /// Set the root url to use in all requests to the server.
172    /// It defaults to `https://localservices.googleapis.com/`.
173    ///
174    /// Returns the previously set root url.
175    pub fn root_url(&mut self, new_root_url: String) -> String {
176        std::mem::replace(&mut self._root_url, new_root_url)
177    }
178}
179
180// ############
181// SCHEMAS ###
182// ##########
183/// An Account Report of a GLS account identified by their account id containing aggregate data gathered from a particular date range. Next ID: 18
184///
185/// This type is not used in any activity, and only used as *part* of another schema.
186///
187#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
188#[serde_with::serde_as]
189#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
190pub struct GoogleAdsHomeservicesLocalservicesV1AccountReport {
191    /// Unique identifier of the GLS account.
192    #[serde(rename = "accountId")]
193    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
194    pub account_id: Option<i64>,
195    /// Aggregator specific information related to the account.
196    #[serde(rename = "aggregatorInfo")]
197    pub aggregator_info: Option<GoogleAdsHomeservicesLocalservicesV1AggregatorInfo>,
198    /// Average review rating score from 1-5 stars.
199    #[serde(rename = "averageFiveStarRating")]
200    pub average_five_star_rating: Option<f64>,
201    /// Average weekly budget in the currency code of the account.
202    #[serde(rename = "averageWeeklyBudget")]
203    pub average_weekly_budget: Option<f64>,
204    /// Business name of the account.
205    #[serde(rename = "businessName")]
206    pub business_name: Option<String>,
207    /// Currency code of the account.
208    #[serde(rename = "currencyCode")]
209    pub currency_code: Option<String>,
210    /// Number of charged leads the account received in current specified period.
211    #[serde(rename = "currentPeriodChargedLeads")]
212    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
213    pub current_period_charged_leads: Option<i64>,
214    /// Number of connected phone calls (duration over 30s) in current specified period.
215    #[serde(rename = "currentPeriodConnectedPhoneCalls")]
216    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
217    pub current_period_connected_phone_calls: Option<i64>,
218    /// Number of phone calls in current specified period, including both connected and unconnected calls.
219    #[serde(rename = "currentPeriodPhoneCalls")]
220    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
221    pub current_period_phone_calls: Option<i64>,
222    /// Total cost of the account in current specified period in the account's specified currency.
223    #[serde(rename = "currentPeriodTotalCost")]
224    pub current_period_total_cost: Option<f64>,
225    /// Number of impressions that customers have had in the past 2 days.
226    #[serde(rename = "impressionsLastTwoDays")]
227    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
228    pub impressions_last_two_days: Option<i64>,
229    /// Phone lead responsiveness of the account for the past 90 days from current date. This is computed by taking the total number of connected calls from charged phone leads and dividing by the total number of calls received.
230    #[serde(rename = "phoneLeadResponsiveness")]
231    pub phone_lead_responsiveness: Option<f64>,
232    /// Number of charged leads the account received in previous specified period.
233    #[serde(rename = "previousPeriodChargedLeads")]
234    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
235    pub previous_period_charged_leads: Option<i64>,
236    /// Number of connected phone calls (duration over 30s) in previous specified period.
237    #[serde(rename = "previousPeriodConnectedPhoneCalls")]
238    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
239    pub previous_period_connected_phone_calls: Option<i64>,
240    /// Number of phone calls in previous specified period, including both connected and unconnected calls.
241    #[serde(rename = "previousPeriodPhoneCalls")]
242    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
243    pub previous_period_phone_calls: Option<i64>,
244    /// Total cost of the account in previous specified period in the account's specified currency.
245    #[serde(rename = "previousPeriodTotalCost")]
246    pub previous_period_total_cost: Option<f64>,
247    /// Total number of reviews the account has up to current date.
248    #[serde(rename = "totalReview")]
249    pub total_review: Option<i32>,
250}
251
252impl common::Part for GoogleAdsHomeservicesLocalservicesV1AccountReport {}
253
254/// Conatiner for aggregator specific information if lead is for an aggregator GLS account.
255///
256/// This type is not used in any activity, and only used as *part* of another schema.
257///
258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
259#[serde_with::serde_as]
260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
261pub struct GoogleAdsHomeservicesLocalservicesV1AggregatorInfo {
262    /// Provider id (listed in aggregator system) which maps to a account id in GLS system.
263    #[serde(rename = "aggregatorProviderId")]
264    pub aggregator_provider_id: Option<String>,
265}
266
267impl common::Part for GoogleAdsHomeservicesLocalservicesV1AggregatorInfo {}
268
269/// Container for booking lead specific information.
270///
271/// This type is not used in any activity, and only used as *part* of another schema.
272///
273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
274#[serde_with::serde_as]
275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
276pub struct GoogleAdsHomeservicesLocalservicesV1BookingLead {
277    /// Timestamp of when service is provided by advertiser.
278    #[serde(rename = "bookingAppointmentTimestamp")]
279    pub booking_appointment_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
280    /// Consumer email associated with the booking lead.
281    #[serde(rename = "consumerEmail")]
282    pub consumer_email: Option<String>,
283    /// Consumer phone number associated with the booking lead.
284    #[serde(rename = "consumerPhoneNumber")]
285    pub consumer_phone_number: Option<String>,
286    /// Name of the customer who created the lead.
287    #[serde(rename = "customerName")]
288    pub customer_name: Option<String>,
289    /// The job type of the specified lead.
290    #[serde(rename = "jobType")]
291    pub job_type: Option<String>,
292}
293
294impl common::Part for GoogleAdsHomeservicesLocalservicesV1BookingLead {}
295
296/// A Detailed Lead Report of a lead identified by their lead id and contains consumer, account, monetization, and lead data.
297///
298/// This type is not used in any activity, and only used as *part* of another schema.
299///
300#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
301#[serde_with::serde_as]
302#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
303pub struct GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport {
304    /// Identifies account that received the lead.
305    #[serde(rename = "accountId")]
306    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
307    pub account_id: Option<i64>,
308    /// Aggregator specific information related to the lead.
309    #[serde(rename = "aggregatorInfo")]
310    pub aggregator_info: Option<GoogleAdsHomeservicesLocalservicesV1AggregatorInfo>,
311    /// More information associated to only booking leads.
312    #[serde(rename = "bookingLead")]
313    pub booking_lead: Option<GoogleAdsHomeservicesLocalservicesV1BookingLead>,
314    /// Business name associated to the account.
315    #[serde(rename = "businessName")]
316    pub business_name: Option<String>,
317    /// Whether the lead has been charged.
318    #[serde(rename = "chargeStatus")]
319    pub charge_status: Option<String>,
320    /// Currency code.
321    #[serde(rename = "currencyCode")]
322    pub currency_code: Option<String>,
323    /// Dispute status related to the lead.
324    #[serde(rename = "disputeStatus")]
325    pub dispute_status: Option<String>,
326    /// Location of the associated account's home city.
327    pub geo: Option<String>,
328    /// Unique identifier of a Detailed Lead Report.
329    #[serde(rename = "googleAdsLeadId")]
330    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
331    pub google_ads_lead_id: Option<i64>,
332    /// Lead category (e.g. hvac, plumber)
333    #[serde(rename = "leadCategory")]
334    pub lead_category: Option<String>,
335    /// Timestamp of when the lead was created.
336    #[serde(rename = "leadCreationTimestamp")]
337    pub lead_creation_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
338    /// Deprecated in favor of google_ads_lead_id. Unique identifier of a Detailed Lead Report.
339    #[serde(rename = "leadId")]
340    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
341    pub lead_id: Option<i64>,
342    /// Price of the lead (available only after it has been charged).
343    #[serde(rename = "leadPrice")]
344    pub lead_price: Option<f64>,
345    /// Lead type.
346    #[serde(rename = "leadType")]
347    pub lead_type: Option<String>,
348    /// More information associated to only message leads.
349    #[serde(rename = "messageLead")]
350    pub message_lead: Option<GoogleAdsHomeservicesLocalservicesV1MessageLead>,
351    /// More information associated to only phone leads.
352    #[serde(rename = "phoneLead")]
353    pub phone_lead: Option<GoogleAdsHomeservicesLocalservicesV1PhoneLead>,
354    /// Timezone of the particular provider associated to a lead.
355    pub timezone: Option<GoogleTypeTimeZone>,
356}
357
358impl common::Part for GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport {}
359
360/// Container for message lead specific information.
361///
362/// This type is not used in any activity, and only used as *part* of another schema.
363///
364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
365#[serde_with::serde_as]
366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
367pub struct GoogleAdsHomeservicesLocalservicesV1MessageLead {
368    /// Consumer phone number associated with the message lead.
369    #[serde(rename = "consumerPhoneNumber")]
370    pub consumer_phone_number: Option<String>,
371    /// Name of the customer who created the lead.
372    #[serde(rename = "customerName")]
373    pub customer_name: Option<String>,
374    /// The job type of the specified lead.
375    #[serde(rename = "jobType")]
376    pub job_type: Option<String>,
377    /// The postal code of the customer who created the lead.
378    #[serde(rename = "postalCode")]
379    pub postal_code: Option<String>,
380}
381
382impl common::Part for GoogleAdsHomeservicesLocalservicesV1MessageLead {}
383
384/// Container for phone lead specific information.
385///
386/// This type is not used in any activity, and only used as *part* of another schema.
387///
388#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
389#[serde_with::serde_as]
390#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
391pub struct GoogleAdsHomeservicesLocalservicesV1PhoneLead {
392    /// Timestamp of the phone call which resulted in a charged phone lead.
393    #[serde(rename = "chargedCallTimestamp")]
394    pub charged_call_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
395    /// Duration of the charged phone call in seconds.
396    #[serde(rename = "chargedConnectedCallDurationSeconds")]
397    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
398    pub charged_connected_call_duration_seconds: Option<chrono::Duration>,
399    /// Consumer phone number associated with the phone lead.
400    #[serde(rename = "consumerPhoneNumber")]
401    pub consumer_phone_number: Option<String>,
402}
403
404impl common::Part for GoogleAdsHomeservicesLocalservicesV1PhoneLead {}
405
406/// A page of the response received from the SearchAccountReports method. A paginated response where more pages are available has `next_page_token` set. This token can be used in a subsequent request to retrieve the next request page.
407///
408/// # Activities
409///
410/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
411/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
412///
413/// * [search account reports](AccountReportSearchCall) (response)
414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
415#[serde_with::serde_as]
416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
417pub struct GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse {
418    /// List of account reports which maps 1:1 to a particular linked GLS account.
419    #[serde(rename = "accountReports")]
420    pub account_reports: Option<Vec<GoogleAdsHomeservicesLocalservicesV1AccountReport>>,
421    /// Pagination token to retrieve the next page of results. When `next_page_token` is not filled in, there is no next page and the list returned is the last page in the result set.
422    #[serde(rename = "nextPageToken")]
423    pub next_page_token: Option<String>,
424}
425
426impl common::ResponseResult for GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse {}
427
428/// A page of the response received from the SearchDetailedLeadReports method. A paginated response where more pages are available has `next_page_token` set. This token can be used in a subsequent request to retrieve the next request page.
429///
430/// # Activities
431///
432/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
433/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
434///
435/// * [search detailed lead reports](DetailedLeadReportSearchCall) (response)
436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
437#[serde_with::serde_as]
438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
439pub struct GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse {
440    /// List of detailed lead reports uniquely identified by external lead id.
441    #[serde(rename = "detailedLeadReports")]
442    pub detailed_lead_reports: Option<Vec<GoogleAdsHomeservicesLocalservicesV1DetailedLeadReport>>,
443    /// Pagination token to retrieve the next page of results. When `next_page_token` is not filled in, there is no next page and the list returned is the last page in the result set.
444    #[serde(rename = "nextPageToken")]
445    pub next_page_token: Option<String>,
446}
447
448impl common::ResponseResult
449    for GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse
450{
451}
452
453/// Represents a time zone from the [IANA Time Zone Database](https://www.iana.org/time-zones).
454///
455/// This type is not used in any activity, and only used as *part* of another schema.
456///
457#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
458#[serde_with::serde_as]
459#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
460pub struct GoogleTypeTimeZone {
461    /// IANA Time Zone Database time zone. For example "America/New_York".
462    pub id: Option<String>,
463    /// Optional. IANA Time Zone Database version number. For example "2019a".
464    pub version: Option<String>,
465}
466
467impl common::Part for GoogleTypeTimeZone {}
468
469// ###################
470// MethodBuilders ###
471// #################
472
473/// A builder providing access to all methods supported on *accountReport* resources.
474/// It is not used directly, but through the [`Localservices`] hub.
475///
476/// # Example
477///
478/// Instantiate a resource builder
479///
480/// ```test_harness,no_run
481/// extern crate hyper;
482/// extern crate hyper_rustls;
483/// extern crate google_localservices1 as localservices1;
484///
485/// # async fn dox() {
486/// use localservices1::{Localservices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
487///
488/// let secret: yup_oauth2::ApplicationSecret = Default::default();
489/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
490///     .with_native_roots()
491///     .unwrap()
492///     .https_only()
493///     .enable_http2()
494///     .build();
495///
496/// let executor = hyper_util::rt::TokioExecutor::new();
497/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
498///     secret,
499///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
500///     yup_oauth2::client::CustomHyperClientBuilder::from(
501///         hyper_util::client::legacy::Client::builder(executor).build(connector),
502///     ),
503/// ).build().await.unwrap();
504///
505/// let client = hyper_util::client::legacy::Client::builder(
506///     hyper_util::rt::TokioExecutor::new()
507/// )
508/// .build(
509///     hyper_rustls::HttpsConnectorBuilder::new()
510///         .with_native_roots()
511///         .unwrap()
512///         .https_or_http()
513///         .enable_http2()
514///         .build()
515/// );
516/// let mut hub = Localservices::new(client, auth);
517/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
518/// // like `search(...)`
519/// // to build up your call.
520/// let rb = hub.account_reports();
521/// # }
522/// ```
523pub struct AccountReportMethods<'a, C>
524where
525    C: 'a,
526{
527    hub: &'a Localservices<C>,
528}
529
530impl<'a, C> common::MethodsBuilder for AccountReportMethods<'a, C> {}
531
532impl<'a, C> AccountReportMethods<'a, C> {
533    /// Create a builder to help you perform the following task:
534    ///
535    /// Get account reports containing aggregate account data of all linked GLS accounts. Caller needs to provide their manager customer id and the associated auth credential that allows them read permissions on their linked accounts.
536    pub fn search(&self) -> AccountReportSearchCall<'a, C> {
537        AccountReportSearchCall {
538            hub: self.hub,
539            _start_date_year: Default::default(),
540            _start_date_month: Default::default(),
541            _start_date_day: Default::default(),
542            _query: Default::default(),
543            _page_token: Default::default(),
544            _page_size: Default::default(),
545            _end_date_year: Default::default(),
546            _end_date_month: Default::default(),
547            _end_date_day: Default::default(),
548            _delegate: Default::default(),
549            _additional_params: Default::default(),
550            _scopes: Default::default(),
551        }
552    }
553}
554
555/// A builder providing access to all methods supported on *detailedLeadReport* resources.
556/// It is not used directly, but through the [`Localservices`] hub.
557///
558/// # Example
559///
560/// Instantiate a resource builder
561///
562/// ```test_harness,no_run
563/// extern crate hyper;
564/// extern crate hyper_rustls;
565/// extern crate google_localservices1 as localservices1;
566///
567/// # async fn dox() {
568/// use localservices1::{Localservices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
569///
570/// let secret: yup_oauth2::ApplicationSecret = Default::default();
571/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
572///     .with_native_roots()
573///     .unwrap()
574///     .https_only()
575///     .enable_http2()
576///     .build();
577///
578/// let executor = hyper_util::rt::TokioExecutor::new();
579/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
580///     secret,
581///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
582///     yup_oauth2::client::CustomHyperClientBuilder::from(
583///         hyper_util::client::legacy::Client::builder(executor).build(connector),
584///     ),
585/// ).build().await.unwrap();
586///
587/// let client = hyper_util::client::legacy::Client::builder(
588///     hyper_util::rt::TokioExecutor::new()
589/// )
590/// .build(
591///     hyper_rustls::HttpsConnectorBuilder::new()
592///         .with_native_roots()
593///         .unwrap()
594///         .https_or_http()
595///         .enable_http2()
596///         .build()
597/// );
598/// let mut hub = Localservices::new(client, auth);
599/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
600/// // like `search(...)`
601/// // to build up your call.
602/// let rb = hub.detailed_lead_reports();
603/// # }
604/// ```
605pub struct DetailedLeadReportMethods<'a, C>
606where
607    C: 'a,
608{
609    hub: &'a Localservices<C>,
610}
611
612impl<'a, C> common::MethodsBuilder for DetailedLeadReportMethods<'a, C> {}
613
614impl<'a, C> DetailedLeadReportMethods<'a, C> {
615    /// Create a builder to help you perform the following task:
616    ///
617    /// Get detailed lead reports containing leads that have been received by all linked GLS accounts. Caller needs to provide their manager customer id and the associated auth credential that allows them read permissions on their linked accounts.
618    pub fn search(&self) -> DetailedLeadReportSearchCall<'a, C> {
619        DetailedLeadReportSearchCall {
620            hub: self.hub,
621            _start_date_year: Default::default(),
622            _start_date_month: Default::default(),
623            _start_date_day: Default::default(),
624            _query: Default::default(),
625            _page_token: Default::default(),
626            _page_size: Default::default(),
627            _end_date_year: Default::default(),
628            _end_date_month: Default::default(),
629            _end_date_day: Default::default(),
630            _delegate: Default::default(),
631            _additional_params: Default::default(),
632            _scopes: Default::default(),
633        }
634    }
635}
636
637// ###################
638// CallBuilders   ###
639// #################
640
641/// Get account reports containing aggregate account data of all linked GLS accounts. Caller needs to provide their manager customer id and the associated auth credential that allows them read permissions on their linked accounts.
642///
643/// A builder for the *search* method supported by a *accountReport* resource.
644/// It is not used directly, but through a [`AccountReportMethods`] instance.
645///
646/// # Example
647///
648/// Instantiate a resource method builder
649///
650/// ```test_harness,no_run
651/// # extern crate hyper;
652/// # extern crate hyper_rustls;
653/// # extern crate google_localservices1 as localservices1;
654/// # async fn dox() {
655/// # use localservices1::{Localservices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
656///
657/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
658/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
659/// #     .with_native_roots()
660/// #     .unwrap()
661/// #     .https_only()
662/// #     .enable_http2()
663/// #     .build();
664///
665/// # let executor = hyper_util::rt::TokioExecutor::new();
666/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
667/// #     secret,
668/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
669/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
670/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
671/// #     ),
672/// # ).build().await.unwrap();
673///
674/// # let client = hyper_util::client::legacy::Client::builder(
675/// #     hyper_util::rt::TokioExecutor::new()
676/// # )
677/// # .build(
678/// #     hyper_rustls::HttpsConnectorBuilder::new()
679/// #         .with_native_roots()
680/// #         .unwrap()
681/// #         .https_or_http()
682/// #         .enable_http2()
683/// #         .build()
684/// # );
685/// # let mut hub = Localservices::new(client, auth);
686/// // You can configure optional parameters by calling the respective setters at will, and
687/// // execute the final call using `doit()`.
688/// // Values shown here are possibly random and not representative !
689/// let result = hub.account_reports().search()
690///              .start_date_year(-16)
691///              .start_date_month(-57)
692///              .start_date_day(-50)
693///              .query("ipsum")
694///              .page_token("est")
695///              .page_size(-62)
696///              .end_date_year(-17)
697///              .end_date_month(-99)
698///              .end_date_day(-56)
699///              .doit().await;
700/// # }
701/// ```
702pub struct AccountReportSearchCall<'a, C>
703where
704    C: 'a,
705{
706    hub: &'a Localservices<C>,
707    _start_date_year: Option<i32>,
708    _start_date_month: Option<i32>,
709    _start_date_day: Option<i32>,
710    _query: Option<String>,
711    _page_token: Option<String>,
712    _page_size: Option<i32>,
713    _end_date_year: Option<i32>,
714    _end_date_month: Option<i32>,
715    _end_date_day: Option<i32>,
716    _delegate: Option<&'a mut dyn common::Delegate>,
717    _additional_params: HashMap<String, String>,
718    _scopes: BTreeSet<String>,
719}
720
721impl<'a, C> common::CallBuilder for AccountReportSearchCall<'a, C> {}
722
723impl<'a, C> AccountReportSearchCall<'a, C>
724where
725    C: common::Connector,
726{
727    /// Perform the operation you have build so far.
728    pub async fn doit(
729        mut self,
730    ) -> common::Result<(
731        common::Response,
732        GoogleAdsHomeservicesLocalservicesV1SearchAccountReportsResponse,
733    )> {
734        use std::borrow::Cow;
735        use std::io::{Read, Seek};
736
737        use common::{url::Params, ToParts};
738        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
739
740        let mut dd = common::DefaultDelegate;
741        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
742        dlg.begin(common::MethodInfo {
743            id: "localservices.accountReports.search",
744            http_method: hyper::Method::GET,
745        });
746
747        for &field in [
748            "alt",
749            "startDate.year",
750            "startDate.month",
751            "startDate.day",
752            "query",
753            "pageToken",
754            "pageSize",
755            "endDate.year",
756            "endDate.month",
757            "endDate.day",
758        ]
759        .iter()
760        {
761            if self._additional_params.contains_key(field) {
762                dlg.finished(false);
763                return Err(common::Error::FieldClash(field));
764            }
765        }
766
767        let mut params = Params::with_capacity(11 + self._additional_params.len());
768        if let Some(value) = self._start_date_year.as_ref() {
769            params.push("startDate.year", value.to_string());
770        }
771        if let Some(value) = self._start_date_month.as_ref() {
772            params.push("startDate.month", value.to_string());
773        }
774        if let Some(value) = self._start_date_day.as_ref() {
775            params.push("startDate.day", value.to_string());
776        }
777        if let Some(value) = self._query.as_ref() {
778            params.push("query", value);
779        }
780        if let Some(value) = self._page_token.as_ref() {
781            params.push("pageToken", value);
782        }
783        if let Some(value) = self._page_size.as_ref() {
784            params.push("pageSize", value.to_string());
785        }
786        if let Some(value) = self._end_date_year.as_ref() {
787            params.push("endDate.year", value.to_string());
788        }
789        if let Some(value) = self._end_date_month.as_ref() {
790            params.push("endDate.month", value.to_string());
791        }
792        if let Some(value) = self._end_date_day.as_ref() {
793            params.push("endDate.day", value.to_string());
794        }
795
796        params.extend(self._additional_params.iter());
797
798        params.push("alt", "json");
799        let mut url = self.hub._base_url.clone() + "v1/accountReports:search";
800        if self._scopes.is_empty() {
801            self._scopes.insert(Scope::Adword.as_ref().to_string());
802        }
803
804        let url = params.parse_with_url(&url);
805
806        loop {
807            let token = match self
808                .hub
809                .auth
810                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
811                .await
812            {
813                Ok(token) => token,
814                Err(e) => match dlg.token(e) {
815                    Ok(token) => token,
816                    Err(e) => {
817                        dlg.finished(false);
818                        return Err(common::Error::MissingToken(e));
819                    }
820                },
821            };
822            let mut req_result = {
823                let client = &self.hub.client;
824                dlg.pre_request();
825                let mut req_builder = hyper::Request::builder()
826                    .method(hyper::Method::GET)
827                    .uri(url.as_str())
828                    .header(USER_AGENT, self.hub._user_agent.clone());
829
830                if let Some(token) = token.as_ref() {
831                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
832                }
833
834                let request = req_builder
835                    .header(CONTENT_LENGTH, 0_u64)
836                    .body(common::to_body::<String>(None));
837
838                client.request(request.unwrap()).await
839            };
840
841            match req_result {
842                Err(err) => {
843                    if let common::Retry::After(d) = dlg.http_error(&err) {
844                        sleep(d).await;
845                        continue;
846                    }
847                    dlg.finished(false);
848                    return Err(common::Error::HttpError(err));
849                }
850                Ok(res) => {
851                    let (mut parts, body) = res.into_parts();
852                    let mut body = common::Body::new(body);
853                    if !parts.status.is_success() {
854                        let bytes = common::to_bytes(body).await.unwrap_or_default();
855                        let error = serde_json::from_str(&common::to_string(&bytes));
856                        let response = common::to_response(parts, bytes.into());
857
858                        if let common::Retry::After(d) =
859                            dlg.http_failure(&response, error.as_ref().ok())
860                        {
861                            sleep(d).await;
862                            continue;
863                        }
864
865                        dlg.finished(false);
866
867                        return Err(match error {
868                            Ok(value) => common::Error::BadRequest(value),
869                            _ => common::Error::Failure(response),
870                        });
871                    }
872                    let response = {
873                        let bytes = common::to_bytes(body).await.unwrap_or_default();
874                        let encoded = common::to_string(&bytes);
875                        match serde_json::from_str(&encoded) {
876                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
877                            Err(error) => {
878                                dlg.response_json_decode_error(&encoded, &error);
879                                return Err(common::Error::JsonDecodeError(
880                                    encoded.to_string(),
881                                    error,
882                                ));
883                            }
884                        }
885                    };
886
887                    dlg.finished(true);
888                    return Ok(response);
889                }
890            }
891        }
892    }
893
894    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
895    ///
896    /// Sets the *start date.year* query property to the given value.
897    pub fn start_date_year(mut self, new_value: i32) -> AccountReportSearchCall<'a, C> {
898        self._start_date_year = Some(new_value);
899        self
900    }
901    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
902    ///
903    /// Sets the *start date.month* query property to the given value.
904    pub fn start_date_month(mut self, new_value: i32) -> AccountReportSearchCall<'a, C> {
905        self._start_date_month = Some(new_value);
906        self
907    }
908    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
909    ///
910    /// Sets the *start date.day* query property to the given value.
911    pub fn start_date_day(mut self, new_value: i32) -> AccountReportSearchCall<'a, C> {
912        self._start_date_day = Some(new_value);
913        self
914    }
915    /// A query string for searching for account reports. Caller must provide a customer id of their MCC account with an associated Gaia Mint that allows read permission on their linked accounts. Search expressions are case insensitive. Example query: | Query | Description | |-------------------------|-----------------------------------------------| | manager_customer_id:123 | Get Account Report for Manager with id 123. | Required.
916    ///
917    /// Sets the *query* query property to the given value.
918    pub fn query(mut self, new_value: &str) -> AccountReportSearchCall<'a, C> {
919        self._query = Some(new_value.to_string());
920        self
921    }
922    /// The `next_page_token` value returned from a previous request to SearchAccountReports that indicates where listing should continue. Optional.
923    ///
924    /// Sets the *page token* query property to the given value.
925    pub fn page_token(mut self, new_value: &str) -> AccountReportSearchCall<'a, C> {
926        self._page_token = Some(new_value.to_string());
927        self
928    }
929    /// The maximum number of accounts to return. If the page size is unset, page size will default to 1000. Maximum page_size is 10000. Optional.
930    ///
931    /// Sets the *page size* query property to the given value.
932    pub fn page_size(mut self, new_value: i32) -> AccountReportSearchCall<'a, C> {
933        self._page_size = Some(new_value);
934        self
935    }
936    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
937    ///
938    /// Sets the *end date.year* query property to the given value.
939    pub fn end_date_year(mut self, new_value: i32) -> AccountReportSearchCall<'a, C> {
940        self._end_date_year = Some(new_value);
941        self
942    }
943    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
944    ///
945    /// Sets the *end date.month* query property to the given value.
946    pub fn end_date_month(mut self, new_value: i32) -> AccountReportSearchCall<'a, C> {
947        self._end_date_month = Some(new_value);
948        self
949    }
950    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
951    ///
952    /// Sets the *end date.day* query property to the given value.
953    pub fn end_date_day(mut self, new_value: i32) -> AccountReportSearchCall<'a, C> {
954        self._end_date_day = Some(new_value);
955        self
956    }
957    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
958    /// while executing the actual API request.
959    ///
960    /// ````text
961    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
962    /// ````
963    ///
964    /// Sets the *delegate* property to the given value.
965    pub fn delegate(
966        mut self,
967        new_value: &'a mut dyn common::Delegate,
968    ) -> AccountReportSearchCall<'a, C> {
969        self._delegate = Some(new_value);
970        self
971    }
972
973    /// Set any additional parameter of the query string used in the request.
974    /// It should be used to set parameters which are not yet available through their own
975    /// setters.
976    ///
977    /// Please note that this method must not be used to set any of the known parameters
978    /// which have their own setter method. If done anyway, the request will fail.
979    ///
980    /// # Additional Parameters
981    ///
982    /// * *$.xgafv* (query-string) - V1 error format.
983    /// * *access_token* (query-string) - OAuth access token.
984    /// * *alt* (query-string) - Data format for response.
985    /// * *callback* (query-string) - JSONP
986    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
987    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
988    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
989    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
990    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
991    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
992    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
993    pub fn param<T>(mut self, name: T, value: T) -> AccountReportSearchCall<'a, C>
994    where
995        T: AsRef<str>,
996    {
997        self._additional_params
998            .insert(name.as_ref().to_string(), value.as_ref().to_string());
999        self
1000    }
1001
1002    /// Identifies the authorization scope for the method you are building.
1003    ///
1004    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1005    /// [`Scope::Adword`].
1006    ///
1007    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1008    /// tokens for more than one scope.
1009    ///
1010    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1011    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1012    /// sufficient, a read-write scope will do as well.
1013    pub fn add_scope<St>(mut self, scope: St) -> AccountReportSearchCall<'a, C>
1014    where
1015        St: AsRef<str>,
1016    {
1017        self._scopes.insert(String::from(scope.as_ref()));
1018        self
1019    }
1020    /// Identifies the authorization scope(s) for the method you are building.
1021    ///
1022    /// See [`Self::add_scope()`] for details.
1023    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountReportSearchCall<'a, C>
1024    where
1025        I: IntoIterator<Item = St>,
1026        St: AsRef<str>,
1027    {
1028        self._scopes
1029            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1030        self
1031    }
1032
1033    /// Removes all scopes, and no default scope will be used either.
1034    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1035    /// for details).
1036    pub fn clear_scopes(mut self) -> AccountReportSearchCall<'a, C> {
1037        self._scopes.clear();
1038        self
1039    }
1040}
1041
1042/// Get detailed lead reports containing leads that have been received by all linked GLS accounts. Caller needs to provide their manager customer id and the associated auth credential that allows them read permissions on their linked accounts.
1043///
1044/// A builder for the *search* method supported by a *detailedLeadReport* resource.
1045/// It is not used directly, but through a [`DetailedLeadReportMethods`] instance.
1046///
1047/// # Example
1048///
1049/// Instantiate a resource method builder
1050///
1051/// ```test_harness,no_run
1052/// # extern crate hyper;
1053/// # extern crate hyper_rustls;
1054/// # extern crate google_localservices1 as localservices1;
1055/// # async fn dox() {
1056/// # use localservices1::{Localservices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1057///
1058/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1059/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1060/// #     .with_native_roots()
1061/// #     .unwrap()
1062/// #     .https_only()
1063/// #     .enable_http2()
1064/// #     .build();
1065///
1066/// # let executor = hyper_util::rt::TokioExecutor::new();
1067/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1068/// #     secret,
1069/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1070/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1071/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1072/// #     ),
1073/// # ).build().await.unwrap();
1074///
1075/// # let client = hyper_util::client::legacy::Client::builder(
1076/// #     hyper_util::rt::TokioExecutor::new()
1077/// # )
1078/// # .build(
1079/// #     hyper_rustls::HttpsConnectorBuilder::new()
1080/// #         .with_native_roots()
1081/// #         .unwrap()
1082/// #         .https_or_http()
1083/// #         .enable_http2()
1084/// #         .build()
1085/// # );
1086/// # let mut hub = Localservices::new(client, auth);
1087/// // You can configure optional parameters by calling the respective setters at will, and
1088/// // execute the final call using `doit()`.
1089/// // Values shown here are possibly random and not representative !
1090/// let result = hub.detailed_lead_reports().search()
1091///              .start_date_year(-25)
1092///              .start_date_month(-86)
1093///              .start_date_day(-43)
1094///              .query("duo")
1095///              .page_token("sed")
1096///              .page_size(-61)
1097///              .end_date_year(-15)
1098///              .end_date_month(-13)
1099///              .end_date_day(-24)
1100///              .doit().await;
1101/// # }
1102/// ```
1103pub struct DetailedLeadReportSearchCall<'a, C>
1104where
1105    C: 'a,
1106{
1107    hub: &'a Localservices<C>,
1108    _start_date_year: Option<i32>,
1109    _start_date_month: Option<i32>,
1110    _start_date_day: Option<i32>,
1111    _query: Option<String>,
1112    _page_token: Option<String>,
1113    _page_size: Option<i32>,
1114    _end_date_year: Option<i32>,
1115    _end_date_month: Option<i32>,
1116    _end_date_day: Option<i32>,
1117    _delegate: Option<&'a mut dyn common::Delegate>,
1118    _additional_params: HashMap<String, String>,
1119    _scopes: BTreeSet<String>,
1120}
1121
1122impl<'a, C> common::CallBuilder for DetailedLeadReportSearchCall<'a, C> {}
1123
1124impl<'a, C> DetailedLeadReportSearchCall<'a, C>
1125where
1126    C: common::Connector,
1127{
1128    /// Perform the operation you have build so far.
1129    pub async fn doit(
1130        mut self,
1131    ) -> common::Result<(
1132        common::Response,
1133        GoogleAdsHomeservicesLocalservicesV1SearchDetailedLeadReportsResponse,
1134    )> {
1135        use std::borrow::Cow;
1136        use std::io::{Read, Seek};
1137
1138        use common::{url::Params, ToParts};
1139        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1140
1141        let mut dd = common::DefaultDelegate;
1142        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1143        dlg.begin(common::MethodInfo {
1144            id: "localservices.detailedLeadReports.search",
1145            http_method: hyper::Method::GET,
1146        });
1147
1148        for &field in [
1149            "alt",
1150            "startDate.year",
1151            "startDate.month",
1152            "startDate.day",
1153            "query",
1154            "pageToken",
1155            "pageSize",
1156            "endDate.year",
1157            "endDate.month",
1158            "endDate.day",
1159        ]
1160        .iter()
1161        {
1162            if self._additional_params.contains_key(field) {
1163                dlg.finished(false);
1164                return Err(common::Error::FieldClash(field));
1165            }
1166        }
1167
1168        let mut params = Params::with_capacity(11 + self._additional_params.len());
1169        if let Some(value) = self._start_date_year.as_ref() {
1170            params.push("startDate.year", value.to_string());
1171        }
1172        if let Some(value) = self._start_date_month.as_ref() {
1173            params.push("startDate.month", value.to_string());
1174        }
1175        if let Some(value) = self._start_date_day.as_ref() {
1176            params.push("startDate.day", value.to_string());
1177        }
1178        if let Some(value) = self._query.as_ref() {
1179            params.push("query", value);
1180        }
1181        if let Some(value) = self._page_token.as_ref() {
1182            params.push("pageToken", value);
1183        }
1184        if let Some(value) = self._page_size.as_ref() {
1185            params.push("pageSize", value.to_string());
1186        }
1187        if let Some(value) = self._end_date_year.as_ref() {
1188            params.push("endDate.year", value.to_string());
1189        }
1190        if let Some(value) = self._end_date_month.as_ref() {
1191            params.push("endDate.month", value.to_string());
1192        }
1193        if let Some(value) = self._end_date_day.as_ref() {
1194            params.push("endDate.day", value.to_string());
1195        }
1196
1197        params.extend(self._additional_params.iter());
1198
1199        params.push("alt", "json");
1200        let mut url = self.hub._base_url.clone() + "v1/detailedLeadReports:search";
1201        if self._scopes.is_empty() {
1202            self._scopes.insert(Scope::Adword.as_ref().to_string());
1203        }
1204
1205        let url = params.parse_with_url(&url);
1206
1207        loop {
1208            let token = match self
1209                .hub
1210                .auth
1211                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1212                .await
1213            {
1214                Ok(token) => token,
1215                Err(e) => match dlg.token(e) {
1216                    Ok(token) => token,
1217                    Err(e) => {
1218                        dlg.finished(false);
1219                        return Err(common::Error::MissingToken(e));
1220                    }
1221                },
1222            };
1223            let mut req_result = {
1224                let client = &self.hub.client;
1225                dlg.pre_request();
1226                let mut req_builder = hyper::Request::builder()
1227                    .method(hyper::Method::GET)
1228                    .uri(url.as_str())
1229                    .header(USER_AGENT, self.hub._user_agent.clone());
1230
1231                if let Some(token) = token.as_ref() {
1232                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1233                }
1234
1235                let request = req_builder
1236                    .header(CONTENT_LENGTH, 0_u64)
1237                    .body(common::to_body::<String>(None));
1238
1239                client.request(request.unwrap()).await
1240            };
1241
1242            match req_result {
1243                Err(err) => {
1244                    if let common::Retry::After(d) = dlg.http_error(&err) {
1245                        sleep(d).await;
1246                        continue;
1247                    }
1248                    dlg.finished(false);
1249                    return Err(common::Error::HttpError(err));
1250                }
1251                Ok(res) => {
1252                    let (mut parts, body) = res.into_parts();
1253                    let mut body = common::Body::new(body);
1254                    if !parts.status.is_success() {
1255                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1256                        let error = serde_json::from_str(&common::to_string(&bytes));
1257                        let response = common::to_response(parts, bytes.into());
1258
1259                        if let common::Retry::After(d) =
1260                            dlg.http_failure(&response, error.as_ref().ok())
1261                        {
1262                            sleep(d).await;
1263                            continue;
1264                        }
1265
1266                        dlg.finished(false);
1267
1268                        return Err(match error {
1269                            Ok(value) => common::Error::BadRequest(value),
1270                            _ => common::Error::Failure(response),
1271                        });
1272                    }
1273                    let response = {
1274                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1275                        let encoded = common::to_string(&bytes);
1276                        match serde_json::from_str(&encoded) {
1277                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1278                            Err(error) => {
1279                                dlg.response_json_decode_error(&encoded, &error);
1280                                return Err(common::Error::JsonDecodeError(
1281                                    encoded.to_string(),
1282                                    error,
1283                                ));
1284                            }
1285                        }
1286                    };
1287
1288                    dlg.finished(true);
1289                    return Ok(response);
1290                }
1291            }
1292        }
1293    }
1294
1295    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
1296    ///
1297    /// Sets the *start date.year* query property to the given value.
1298    pub fn start_date_year(mut self, new_value: i32) -> DetailedLeadReportSearchCall<'a, C> {
1299        self._start_date_year = Some(new_value);
1300        self
1301    }
1302    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
1303    ///
1304    /// Sets the *start date.month* query property to the given value.
1305    pub fn start_date_month(mut self, new_value: i32) -> DetailedLeadReportSearchCall<'a, C> {
1306        self._start_date_month = Some(new_value);
1307        self
1308    }
1309    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
1310    ///
1311    /// Sets the *start date.day* query property to the given value.
1312    pub fn start_date_day(mut self, new_value: i32) -> DetailedLeadReportSearchCall<'a, C> {
1313        self._start_date_day = Some(new_value);
1314        self
1315    }
1316    /// A query string for searching for account reports. Caller must provide a customer id of their MCC account with an associated Gaia Mint that allows read permission on their linked accounts. Search expressions are case insensitive. Example query: | Query | Description | |-------------------------|-----------------------------------------------| | manager_customer_id:123 | Get Detailed Lead Report for Manager with id | | | 123. | Required.
1317    ///
1318    /// Sets the *query* query property to the given value.
1319    pub fn query(mut self, new_value: &str) -> DetailedLeadReportSearchCall<'a, C> {
1320        self._query = Some(new_value.to_string());
1321        self
1322    }
1323    /// The `next_page_token` value returned from a previous request to SearchDetailedLeadReports that indicates where listing should continue. Optional.
1324    ///
1325    /// Sets the *page token* query property to the given value.
1326    pub fn page_token(mut self, new_value: &str) -> DetailedLeadReportSearchCall<'a, C> {
1327        self._page_token = Some(new_value.to_string());
1328        self
1329    }
1330    /// The maximum number of accounts to return. If the page size is unset, page size will default to 1000. Maximum page_size is 10000. Optional.
1331    ///
1332    /// Sets the *page size* query property to the given value.
1333    pub fn page_size(mut self, new_value: i32) -> DetailedLeadReportSearchCall<'a, C> {
1334        self._page_size = Some(new_value);
1335        self
1336    }
1337    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
1338    ///
1339    /// Sets the *end date.year* query property to the given value.
1340    pub fn end_date_year(mut self, new_value: i32) -> DetailedLeadReportSearchCall<'a, C> {
1341        self._end_date_year = Some(new_value);
1342        self
1343    }
1344    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
1345    ///
1346    /// Sets the *end date.month* query property to the given value.
1347    pub fn end_date_month(mut self, new_value: i32) -> DetailedLeadReportSearchCall<'a, C> {
1348        self._end_date_month = Some(new_value);
1349        self
1350    }
1351    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
1352    ///
1353    /// Sets the *end date.day* query property to the given value.
1354    pub fn end_date_day(mut self, new_value: i32) -> DetailedLeadReportSearchCall<'a, C> {
1355        self._end_date_day = Some(new_value);
1356        self
1357    }
1358    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1359    /// while executing the actual API request.
1360    ///
1361    /// ````text
1362    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1363    /// ````
1364    ///
1365    /// Sets the *delegate* property to the given value.
1366    pub fn delegate(
1367        mut self,
1368        new_value: &'a mut dyn common::Delegate,
1369    ) -> DetailedLeadReportSearchCall<'a, C> {
1370        self._delegate = Some(new_value);
1371        self
1372    }
1373
1374    /// Set any additional parameter of the query string used in the request.
1375    /// It should be used to set parameters which are not yet available through their own
1376    /// setters.
1377    ///
1378    /// Please note that this method must not be used to set any of the known parameters
1379    /// which have their own setter method. If done anyway, the request will fail.
1380    ///
1381    /// # Additional Parameters
1382    ///
1383    /// * *$.xgafv* (query-string) - V1 error format.
1384    /// * *access_token* (query-string) - OAuth access token.
1385    /// * *alt* (query-string) - Data format for response.
1386    /// * *callback* (query-string) - JSONP
1387    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1388    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1389    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1390    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1391    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1392    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1393    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1394    pub fn param<T>(mut self, name: T, value: T) -> DetailedLeadReportSearchCall<'a, C>
1395    where
1396        T: AsRef<str>,
1397    {
1398        self._additional_params
1399            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1400        self
1401    }
1402
1403    /// Identifies the authorization scope for the method you are building.
1404    ///
1405    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1406    /// [`Scope::Adword`].
1407    ///
1408    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1409    /// tokens for more than one scope.
1410    ///
1411    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1412    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1413    /// sufficient, a read-write scope will do as well.
1414    pub fn add_scope<St>(mut self, scope: St) -> DetailedLeadReportSearchCall<'a, C>
1415    where
1416        St: AsRef<str>,
1417    {
1418        self._scopes.insert(String::from(scope.as_ref()));
1419        self
1420    }
1421    /// Identifies the authorization scope(s) for the method you are building.
1422    ///
1423    /// See [`Self::add_scope()`] for details.
1424    pub fn add_scopes<I, St>(mut self, scopes: I) -> DetailedLeadReportSearchCall<'a, C>
1425    where
1426        I: IntoIterator<Item = St>,
1427        St: AsRef<str>,
1428    {
1429        self._scopes
1430            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1431        self
1432    }
1433
1434    /// Removes all scopes, and no default scope will be used either.
1435    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1436    /// for details).
1437    pub fn clear_scopes(mut self) -> DetailedLeadReportSearchCall<'a, C> {
1438        self._scopes.clear();
1439        self
1440    }
1441}