google_partners2/
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 Partners 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_partners2 as partners2;
25/// use partners2::api::CompanyRelation;
26/// use partners2::{Result, Error};
27/// # async fn dox() {
28/// use partners2::{Partners, 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 auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39///     secret,
40///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41/// ).build().await.unwrap();
42///
43/// let client = hyper_util::client::legacy::Client::builder(
44///     hyper_util::rt::TokioExecutor::new()
45/// )
46/// .build(
47///     hyper_rustls::HttpsConnectorBuilder::new()
48///         .with_native_roots()
49///         .unwrap()
50///         .https_or_http()
51///         .enable_http1()
52///         .build()
53/// );
54/// let mut hub = Partners::new(client, auth);
55/// // As the method needs a request, you would usually fill it with the desired information
56/// // into the respective structure. Some of the parts shown here might not be applicable !
57/// // Values shown here are possibly random and not representative !
58/// let mut req = CompanyRelation::default();
59///
60/// // You can configure optional parameters by calling the respective setters at will, and
61/// // execute the final call using `doit()`.
62/// // Values shown here are possibly random and not representative !
63/// let result = hub.users().create_company_relation(req, "userId")
64///              .request_metadata_user_overrides_user_id("dolor")
65///              .request_metadata_user_overrides_ip_address("ea")
66///              .request_metadata_traffic_source_traffic_sub_id("ipsum")
67///              .request_metadata_traffic_source_traffic_source_id("invidunt")
68///              .request_metadata_partners_session_id("amet")
69///              .request_metadata_locale("duo")
70///              .add_request_metadata_experiment_ids("ipsum")
71///              .doit().await;
72///
73/// match result {
74///     Err(e) => match e {
75///         // The Error enum provides details about what exactly happened.
76///         // You can also just use its `Debug`, `Display` or `Error` traits
77///          Error::HttpError(_)
78///         |Error::Io(_)
79///         |Error::MissingAPIKey
80///         |Error::MissingToken(_)
81///         |Error::Cancelled
82///         |Error::UploadSizeLimitExceeded(_, _)
83///         |Error::Failure(_)
84///         |Error::BadRequest(_)
85///         |Error::FieldClash(_)
86///         |Error::JsonDecodeError(_, _) => println!("{}", e),
87///     },
88///     Ok(res) => println!("Success: {:?}", res),
89/// }
90/// # }
91/// ```
92#[derive(Clone)]
93pub struct Partners<C> {
94    pub client: common::Client<C>,
95    pub auth: Box<dyn common::GetToken>,
96    _user_agent: String,
97    _base_url: String,
98    _root_url: String,
99}
100
101impl<C> common::Hub for Partners<C> {}
102
103impl<'a, C> Partners<C> {
104    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Partners<C> {
105        Partners {
106            client,
107            auth: Box::new(auth),
108            _user_agent: "google-api-rust-client/6.0.0".to_string(),
109            _base_url: "https://partners.googleapis.com/".to_string(),
110            _root_url: "https://partners.googleapis.com/".to_string(),
111        }
112    }
113
114    pub fn analytics(&'a self) -> AnalyticMethods<'a, C> {
115        AnalyticMethods { hub: self }
116    }
117    pub fn client_messages(&'a self) -> ClientMessageMethods<'a, C> {
118        ClientMessageMethods { hub: self }
119    }
120    pub fn companies(&'a self) -> CompanyMethods<'a, C> {
121        CompanyMethods { hub: self }
122    }
123    pub fn leads(&'a self) -> LeadMethods<'a, C> {
124        LeadMethods { hub: self }
125    }
126    pub fn methods(&'a self) -> MethodMethods<'a, C> {
127        MethodMethods { hub: self }
128    }
129    pub fn offers(&'a self) -> OfferMethods<'a, C> {
130        OfferMethods { hub: self }
131    }
132    pub fn user_events(&'a self) -> UserEventMethods<'a, C> {
133        UserEventMethods { hub: self }
134    }
135    pub fn user_states(&'a self) -> UserStateMethods<'a, C> {
136        UserStateMethods { hub: self }
137    }
138    pub fn users(&'a self) -> UserMethods<'a, C> {
139        UserMethods { hub: self }
140    }
141
142    /// Set the user-agent header field to use in all requests to the server.
143    /// It defaults to `google-api-rust-client/6.0.0`.
144    ///
145    /// Returns the previously set user-agent.
146    pub fn user_agent(&mut self, agent_name: String) -> String {
147        std::mem::replace(&mut self._user_agent, agent_name)
148    }
149
150    /// Set the base url to use in all requests to the server.
151    /// It defaults to `https://partners.googleapis.com/`.
152    ///
153    /// Returns the previously set base url.
154    pub fn base_url(&mut self, new_base_url: String) -> String {
155        std::mem::replace(&mut self._base_url, new_base_url)
156    }
157
158    /// Set the root url to use in all requests to the server.
159    /// It defaults to `https://partners.googleapis.com/`.
160    ///
161    /// Returns the previously set root url.
162    pub fn root_url(&mut self, new_root_url: String) -> String {
163        std::mem::replace(&mut self._root_url, new_root_url)
164    }
165}
166
167// ############
168// SCHEMAS ###
169// ##########
170/// A generic empty message that you can re-use to avoid defining duplicated
171/// empty messages in your APIs. A typical example is to use it as the request
172/// or the response type of an API method. For instance:
173///
174/// ````text
175/// service Foo {
176///   rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
177/// }
178/// ````
179///
180/// The JSON representation for `Empty` is empty JSON object `{}`.
181///
182/// # Activities
183///
184/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
185/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
186///
187/// * [delete company relation users](UserDeleteCompanyRelationCall) (response)
188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
189#[serde_with::serde_as]
190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
191pub struct Empty {
192    _never_set: Option<bool>,
193}
194
195impl common::ResponseResult for Empty {}
196
197/// Source of traffic for the current request.
198///
199/// This type is not used in any activity, and only used as *part* of another schema.
200///
201#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
202#[serde_with::serde_as]
203#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
204pub struct TrafficSource {
205    /// Identifier to indicate where the traffic comes from.
206    /// An identifier has multiple letters created by a team which redirected the
207    /// traffic to us.
208    #[serde(rename = "trafficSourceId")]
209    pub traffic_source_id: Option<String>,
210    /// Second level identifier to indicate where the traffic comes from.
211    /// An identifier has multiple letters created by a team which redirected the
212    /// traffic to us.
213    #[serde(rename = "trafficSubId")]
214    pub traffic_sub_id: Option<String>,
215}
216
217impl common::Part for TrafficSource {}
218
219/// Common data that is in each API request.
220///
221/// This type is not used in any activity, and only used as *part* of another schema.
222///
223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
224#[serde_with::serde_as]
225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
226pub struct RequestMetadata {
227    /// Locale to use for the current request.
228    pub locale: Option<String>,
229    /// Values to use instead of the user's respective defaults for the current
230    /// request. These are only honored by whitelisted products.
231    #[serde(rename = "userOverrides")]
232    pub user_overrides: Option<UserOverrides>,
233    /// Google Partners session ID.
234    #[serde(rename = "partnersSessionId")]
235    pub partners_session_id: Option<String>,
236    /// Experiment IDs the current request belongs to.
237    #[serde(rename = "experimentIds")]
238    pub experiment_ids: Option<Vec<String>>,
239    /// Source of traffic for the current request.
240    #[serde(rename = "trafficSource")]
241    pub traffic_source: Option<TrafficSource>,
242}
243
244impl common::Part for RequestMetadata {}
245
246/// Request message for CreateLead.
247///
248/// # Activities
249///
250/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
251/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
252///
253/// * [leads create companies](CompanyLeadCreateCall) (request)
254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
255#[serde_with::serde_as]
256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
257pub struct CreateLeadRequest {
258    /// Current request metadata.
259    #[serde(rename = "requestMetadata")]
260    pub request_metadata: Option<RequestMetadata>,
261    /// The lead resource. The `LeadType` must not be `LEAD_TYPE_UNSPECIFIED`
262    /// and either `email` or `phone_number` must be provided.
263    pub lead: Option<Lead>,
264    /// <a href="https://www.google.com/recaptcha/">reCaptcha</a> challenge info.
265    #[serde(rename = "recaptchaChallenge")]
266    pub recaptcha_challenge: Option<RecaptchaChallenge>,
267}
268
269impl common::RequestValue for CreateLeadRequest {}
270
271/// Key value data pair for an event.
272///
273/// This type is not used in any activity, and only used as *part* of another schema.
274///
275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
276#[serde_with::serde_as]
277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
278pub struct EventData {
279    /// Data type.
280    pub key: Option<String>,
281    /// Data values.
282    pub values: Option<Vec<String>>,
283}
284
285impl common::Part for EventData {}
286
287/// A user's information on a specific exam.
288///
289/// This type is not used in any activity, and only used as *part* of another schema.
290///
291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
292#[serde_with::serde_as]
293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
294pub struct ExamStatus {
295    /// Whether this exam is in the state of warning.
296    pub warning: Option<bool>,
297    /// Date this exam is due to expire.
298    pub expiration: Option<chrono::DateTime<chrono::offset::Utc>>,
299    /// The date the user last passed this exam.
300    #[serde(rename = "lastPassed")]
301    pub last_passed: Option<chrono::DateTime<chrono::offset::Utc>>,
302    /// The type of the exam.
303    #[serde(rename = "examType")]
304    pub exam_type: Option<String>,
305    /// Whether this exam has been passed and not expired.
306    pub passed: Option<bool>,
307    /// The date the user last taken this exam.
308    pub taken: Option<chrono::DateTime<chrono::offset::Utc>>,
309}
310
311impl common::Part for ExamStatus {}
312
313/// Response for ListOffer.
314///
315/// # Activities
316///
317/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
318/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
319///
320/// * [list offers](OfferListCall) (response)
321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
322#[serde_with::serde_as]
323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
324pub struct ListOffersResponse {
325    /// Current response metadata.
326    #[serde(rename = "responseMetadata")]
327    pub response_metadata: Option<ResponseMetadata>,
328    /// Reason why no Offers are available.
329    #[serde(rename = "noOfferReason")]
330    pub no_offer_reason: Option<String>,
331    /// Available Offers to be distributed.
332    #[serde(rename = "availableOffers")]
333    pub available_offers: Option<Vec<AvailableOffer>>,
334}
335
336impl common::ResponseResult for ListOffersResponse {}
337
338/// Offer info by country.
339///
340/// This type is not used in any activity, and only used as *part* of another schema.
341///
342#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
343#[serde_with::serde_as]
344#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
345pub struct CountryOfferInfo {
346    /// Country code for which offer codes may be requested.
347    #[serde(rename = "offerCountryCode")]
348    pub offer_country_code: Option<String>,
349    /// (localized) Spend X amount for that country's offer.
350    #[serde(rename = "spendXAmount")]
351    pub spend_x_amount: Option<String>,
352    /// Type of offer country is eligible for.
353    #[serde(rename = "offerType")]
354    pub offer_type: Option<String>,
355    /// (localized) Get Y amount for that country's offer.
356    #[serde(rename = "getYAmount")]
357    pub get_y_amount: Option<String>,
358}
359
360impl common::Part for CountryOfferInfo {}
361
362/// Response message for
363/// ListCompanies.
364///
365/// # Activities
366///
367/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
368/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
369///
370/// * [list companies](CompanyListCall) (response)
371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
372#[serde_with::serde_as]
373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
374pub struct ListCompaniesResponse {
375    /// Current response metadata.
376    #[serde(rename = "responseMetadata")]
377    pub response_metadata: Option<ResponseMetadata>,
378    /// The list of companies.
379    pub companies: Option<Vec<Company>>,
380    /// A token to retrieve next page of results.
381    /// Pass this value in the `ListCompaniesRequest.page_token` field in the
382    /// subsequent call to
383    /// ListCompanies to retrieve the
384    /// next page of results.
385    #[serde(rename = "nextPageToken")]
386    pub next_page_token: Option<String>,
387}
388
389impl common::ResponseResult for ListCompaniesResponse {}
390
391/// Customers qualified for an offer.
392///
393/// This type is not used in any activity, and only used as *part* of another schema.
394///
395#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
396#[serde_with::serde_as]
397#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
398pub struct OfferCustomer {
399    /// URL to the customer's AdWords page.
400    #[serde(rename = "adwordsUrl")]
401    pub adwords_url: Option<String>,
402    /// Type of the offer
403    #[serde(rename = "offerType")]
404    pub offer_type: Option<String>,
405    /// External CID for the customer.
406    #[serde(rename = "externalCid")]
407    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
408    pub external_cid: Option<i64>,
409    /// Country code of the customer.
410    #[serde(rename = "countryCode")]
411    pub country_code: Option<String>,
412    /// Time the customer was created.
413    #[serde(rename = "creationTime")]
414    pub creation_time: Option<chrono::DateTime<chrono::offset::Utc>>,
415    /// Days the customer is still eligible.
416    #[serde(rename = "eligibilityDaysLeft")]
417    pub eligibility_days_left: Option<i32>,
418    /// Formatted Get Y amount with currency code.
419    #[serde(rename = "getYAmount")]
420    pub get_y_amount: Option<String>,
421    /// Name of the customer.
422    pub name: Option<String>,
423    /// Formatted Spend X amount with currency code.
424    #[serde(rename = "spendXAmount")]
425    pub spend_x_amount: Option<String>,
426}
427
428impl common::Part for OfferCustomer {}
429
430/// Google Partners certification status.
431///
432/// This type is not used in any activity, and only used as *part* of another schema.
433///
434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
435#[serde_with::serde_as]
436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
437pub struct CertificationStatus {
438    /// The type of the certification.
439    #[serde(rename = "type")]
440    pub type_: Option<String>,
441    /// Number of people who are certified,
442    #[serde(rename = "userCount")]
443    pub user_count: Option<i32>,
444    /// Whether certification is passing.
445    #[serde(rename = "isCertified")]
446    pub is_certified: Option<bool>,
447    /// List of certification exam statuses.
448    #[serde(rename = "examStatuses")]
449    pub exam_statuses: Option<Vec<CertificationExamStatus>>,
450}
451
452impl common::Part for CertificationStatus {}
453
454/// The localized company information.
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 LocalizedCompanyInfo {
462    /// Language code of the localized company info, as defined by
463    /// <a href="https://tools.ietf.org/html/bcp47">BCP 47</a>
464    /// (IETF BCP 47, "Tags for Identifying Languages").
465    #[serde(rename = "languageCode")]
466    pub language_code: Option<String>,
467    /// List of country codes for the localized company info.
468    #[serde(rename = "countryCodes")]
469    pub country_codes: Option<Vec<String>>,
470    /// Localized brief description that the company uses to advertise themselves.
471    pub overview: Option<String>,
472    /// Localized display name.
473    #[serde(rename = "displayName")]
474    pub display_name: Option<String>,
475}
476
477impl common::Part for LocalizedCompanyInfo {}
478
479/// Response message for
480/// LogUserEvent.
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/// * [log user events](UserEventLogCall) (response)
488#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
489#[serde_with::serde_as]
490#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
491pub struct LogUserEventResponse {
492    /// Current response metadata.
493    #[serde(rename = "responseMetadata")]
494    pub response_metadata: Option<ResponseMetadata>,
495}
496
497impl common::ResponseResult for LogUserEventResponse {}
498
499/// Response for ListOfferHistory.
500///
501/// # Activities
502///
503/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
504/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
505///
506/// * [history list offers](OfferHistoryListCall) (response)
507#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
508#[serde_with::serde_as]
509#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
510pub struct ListOffersHistoryResponse {
511    /// True if the user has the option to show entire company history.
512    #[serde(rename = "canShowEntireCompany")]
513    pub can_show_entire_company: Option<bool>,
514    /// Number of results across all pages.
515    #[serde(rename = "totalResults")]
516    pub total_results: Option<i32>,
517    /// True if this response is showing entire company history.
518    #[serde(rename = "showingEntireCompany")]
519    pub showing_entire_company: Option<bool>,
520    /// Historical offers meeting request.
521    pub offers: Option<Vec<HistoricalOffer>>,
522    /// Supply this token in a ListOffersHistoryRequest to retrieve the next page.
523    #[serde(rename = "nextPageToken")]
524    pub next_page_token: Option<String>,
525    /// Current response metadata.
526    #[serde(rename = "responseMetadata")]
527    pub response_metadata: Option<ResponseMetadata>,
528}
529
530impl common::ResponseResult for ListOffersHistoryResponse {}
531
532/// Response message for
533/// LogClientMessage.
534///
535/// # Activities
536///
537/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
538/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
539///
540/// * [log client messages](ClientMessageLogCall) (response)
541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
542#[serde_with::serde_as]
543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
544pub struct LogMessageResponse {
545    /// Current response metadata.
546    #[serde(rename = "responseMetadata")]
547    pub response_metadata: Option<ResponseMetadata>,
548}
549
550impl common::ResponseResult for LogMessageResponse {}
551
552/// Agency specialization status
553///
554/// This type is not used in any activity, and only used as *part* of another schema.
555///
556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
557#[serde_with::serde_as]
558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
559pub struct SpecializationStatus {
560    /// The specialization this status is for.
561    #[serde(rename = "badgeSpecialization")]
562    pub badge_specialization: Option<String>,
563    /// State of agency specialization.
564    #[serde(rename = "badgeSpecializationState")]
565    pub badge_specialization_state: Option<String>,
566}
567
568impl common::Part for SpecializationStatus {}
569
570/// A user's information on a specific certification.
571///
572/// This type is not used in any activity, and only used as *part* of another schema.
573///
574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
575#[serde_with::serde_as]
576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
577pub struct Certification {
578    /// The date the user last achieved certification.
579    #[serde(rename = "lastAchieved")]
580    pub last_achieved: Option<chrono::DateTime<chrono::offset::Utc>>,
581    /// Whether this certification has been achieved.
582    pub achieved: Option<bool>,
583    /// Date this certification is due to expire.
584    pub expiration: Option<chrono::DateTime<chrono::offset::Utc>>,
585    /// Whether this certification is in the state of warning.
586    pub warning: Option<bool>,
587    /// The type of certification, the area of expertise.
588    #[serde(rename = "certificationType")]
589    pub certification_type: Option<String>,
590}
591
592impl common::Part for Certification {}
593
594/// A resource representing a user of the Partners platform.
595///
596/// # Activities
597///
598/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
599/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
600///
601/// * [update profile users](UserUpdateProfileCall) (none)
602/// * [create company relation users](UserCreateCompanyRelationCall) (none)
603/// * [delete company relation users](UserDeleteCompanyRelationCall) (none)
604/// * [get users](UserGetCall) (response)
605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
606#[serde_with::serde_as]
607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
608pub struct User {
609    /// The profile information of a Partners user, contains all the directly
610    /// editable user information.
611    pub profile: Option<UserProfile>,
612    /// This is the list of AdWords Manager Accounts the user has edit access to.
613    /// If the user has edit access to multiple accounts, the user can choose the
614    /// preferred account and we use this when a personal account is needed. Can
615    /// be empty meaning the user has access to no accounts.
616    /// @OutputOnly
617    #[serde(rename = "availableAdwordsManagerAccounts")]
618    pub available_adwords_manager_accounts: Option<Vec<AdWordsManagerAccountInfo>>,
619    /// The internal user ID.
620    /// Only available for a whitelisted set of api clients.
621    #[serde(rename = "internalId")]
622    pub internal_id: Option<String>,
623    /// The list of exams the user ever taken. For each type of exam, only one
624    /// entry is listed.
625    #[serde(rename = "examStatus")]
626    pub exam_status: Option<Vec<ExamStatus>>,
627    /// The ID of the user.
628    pub id: Option<String>,
629    /// Information about a user's external public profile outside Google Partners.
630    #[serde(rename = "publicProfile")]
631    pub public_profile: Option<PublicProfile>,
632    /// The email address used by the user used for company verification.
633    /// @OutputOnly
634    #[serde(rename = "companyVerificationEmail")]
635    pub company_verification_email: Option<String>,
636    /// The company that the user is associated with.
637    /// If not present, the user is not associated with any company.
638    pub company: Option<CompanyRelation>,
639    /// The most recent time the user interacted with the Partners site.
640    /// @OutputOnly
641    #[serde(rename = "lastAccessTime")]
642    pub last_access_time: Option<chrono::DateTime<chrono::offset::Utc>>,
643    /// The list of emails the user has access to/can select as primary.
644    /// @OutputOnly
645    #[serde(rename = "primaryEmails")]
646    pub primary_emails: Option<Vec<String>>,
647    /// The list of achieved certifications. These are calculated based on exam
648    /// results and other requirements.
649    /// @OutputOnly
650    #[serde(rename = "certificationStatus")]
651    pub certification_status: Option<Vec<Certification>>,
652    /// Whether or not the user has opted to share their Academy for Ads info with
653    /// Google Partners.
654    #[serde(rename = "afaInfoShared")]
655    pub afa_info_shared: Option<bool>,
656}
657
658impl common::Resource for User {}
659impl common::ResponseResult for User {}
660
661/// Response message for
662/// ListAnalytics.
663///
664/// # Activities
665///
666/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
667/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
668///
669/// * [list analytics](AnalyticListCall) (response)
670#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
671#[serde_with::serde_as]
672#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
673pub struct ListAnalyticsResponse {
674    /// A token to retrieve next page of results.
675    /// Pass this value in the `ListAnalyticsRequest.page_token` field in the
676    /// subsequent call to
677    /// ListAnalytics to retrieve the
678    /// next page of results.
679    #[serde(rename = "nextPageToken")]
680    pub next_page_token: Option<String>,
681    /// Current response metadata.
682    #[serde(rename = "responseMetadata")]
683    pub response_metadata: Option<ResponseMetadata>,
684    /// Aggregated information across the response's
685    /// analytics.
686    #[serde(rename = "analyticsSummary")]
687    pub analytics_summary: Option<AnalyticsSummary>,
688    /// The list of analytics.
689    /// Sorted in ascending order of
690    /// Analytics.event_date.
691    pub analytics: Option<Vec<Analytics>>,
692}
693
694impl common::ResponseResult for ListAnalyticsResponse {}
695
696/// Response message for ListLeads.
697///
698/// # Activities
699///
700/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
701/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
702///
703/// * [list leads](LeadListCall) (response)
704#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
705#[serde_with::serde_as]
706#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
707pub struct ListLeadsResponse {
708    /// A token to retrieve next page of results.
709    /// Pass this value in the `ListLeadsRequest.page_token` field in the
710    /// subsequent call to
711    /// ListLeads to retrieve the
712    /// next page of results.
713    #[serde(rename = "nextPageToken")]
714    pub next_page_token: Option<String>,
715    /// Current response metadata.
716    #[serde(rename = "responseMetadata")]
717    pub response_metadata: Option<ResponseMetadata>,
718    /// The total count of leads for the given company.
719    #[serde(rename = "totalSize")]
720    pub total_size: Option<i32>,
721    /// The list of leads.
722    pub leads: Option<Vec<Lead>>,
723}
724
725impl common::ResponseResult for ListLeadsResponse {}
726
727/// A company resource in the Google Partners API. Once certified, it qualifies
728/// for being searched by advertisers.
729///
730/// # Activities
731///
732/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
733/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
734///
735/// * [update companies](MethodUpdateCompanyCall) (request|response)
736#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
737#[serde_with::serde_as]
738#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
739pub struct Company {
740    /// The public viewability status of the company's profile.
741    #[serde(rename = "profileStatus")]
742    pub profile_status: Option<String>,
743    /// The primary language code of the company, as defined by
744    /// <a href="https://tools.ietf.org/html/bcp47">BCP 47</a>
745    /// (IETF BCP 47, "Tags for Identifying Languages").
746    #[serde(rename = "primaryLanguageCode")]
747    pub primary_language_code: Option<String>,
748    /// The list of all company locations.
749    /// If set, must include the
750    /// primary_location
751    /// in the list.
752    pub locations: Option<Vec<Location>>,
753    /// The minimum monthly budget that the company accepts for partner business,
754    /// converted to the requested currency code.
755    #[serde(rename = "convertedMinMonthlyBudget")]
756    pub converted_min_monthly_budget: Option<Money>,
757    /// Industries the company can help with.
758    pub industries: Option<Vec<String>>,
759    /// URL of the company's website.
760    #[serde(rename = "websiteUrl")]
761    pub website_url: Option<String>,
762    /// URL of the company's additional websites used to verify the dynamic badges.
763    /// These are stored as full URLs as entered by the user, but only the TLD will
764    /// be used for the actual verification.
765    #[serde(rename = "additionalWebsites")]
766    pub additional_websites: Option<Vec<String>>,
767    /// The Primary AdWords Manager Account id.
768    #[serde(rename = "primaryAdwordsManagerAccountId")]
769    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
770    pub primary_adwords_manager_account_id: Option<i64>,
771    /// Whether the company's badge authority is in AWN
772    #[serde(rename = "badgeAuthorityInAwn")]
773    pub badge_authority_in_awn: Option<bool>,
774    /// The name of the company.
775    pub name: Option<String>,
776    /// The list of localized info for the company.
777    #[serde(rename = "localizedInfos")]
778    pub localized_infos: Option<Vec<LocalizedCompanyInfo>>,
779    /// The list of Google Partners certification statuses for the company.
780    #[serde(rename = "certificationStatuses")]
781    pub certification_statuses: Option<Vec<CertificationStatus>>,
782    /// The ID of the company.
783    pub id: Option<String>,
784    /// Basic information from the company's public profile.
785    #[serde(rename = "publicProfile")]
786    pub public_profile: Option<PublicProfile>,
787    /// The unconverted minimum monthly budget that the company accepts for partner
788    /// business.
789    #[serde(rename = "originalMinMonthlyBudget")]
790    pub original_min_monthly_budget: Option<Money>,
791    /// Services the company can help with.
792    pub services: Option<Vec<String>>,
793    /// The primary location of the company.
794    #[serde(rename = "primaryLocation")]
795    pub primary_location: Option<Location>,
796    /// Information related to the ranking of the company within the list of
797    /// companies.
798    pub ranks: Option<Vec<Rank>>,
799    /// The list of Google Partners specialization statuses for the company.
800    #[serde(rename = "specializationStatus")]
801    pub specialization_status: Option<Vec<SpecializationStatus>>,
802    /// Partner badge tier
803    #[serde(rename = "badgeTier")]
804    pub badge_tier: Option<String>,
805    /// Email domains that allow users with a matching email address to get
806    /// auto-approved for associating with this company.
807    #[serde(rename = "autoApprovalEmailDomains")]
808    pub auto_approval_email_domains: Option<Vec<String>>,
809    /// Company type labels listed on the company's profile.
810    #[serde(rename = "companyTypes")]
811    pub company_types: Option<Vec<String>>,
812}
813
814impl common::RequestValue for Company {}
815impl common::ResponseResult for Company {}
816
817/// Response message for CreateLead.
818///
819/// # Activities
820///
821/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
822/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
823///
824/// * [leads create companies](CompanyLeadCreateCall) (response)
825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
826#[serde_with::serde_as]
827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
828pub struct CreateLeadResponse {
829    /// Lead that was created depending on the outcome of
830    /// <a href="https://www.google.com/recaptcha/">reCaptcha</a> validation.
831    pub lead: Option<Lead>,
832    /// The outcome of <a href="https://www.google.com/recaptcha/">reCaptcha</a>
833    /// validation.
834    #[serde(rename = "recaptchaStatus")]
835    pub recaptcha_status: Option<String>,
836    /// Current response metadata.
837    #[serde(rename = "responseMetadata")]
838    pub response_metadata: Option<ResponseMetadata>,
839}
840
841impl common::ResponseResult for CreateLeadResponse {}
842
843/// Response message for GetCompany.
844///
845/// # Activities
846///
847/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
848/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
849///
850/// * [get companies](CompanyGetCall) (response)
851#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
852#[serde_with::serde_as]
853#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
854pub struct GetCompanyResponse {
855    /// Current response metadata.
856    #[serde(rename = "responseMetadata")]
857    pub response_metadata: Option<ResponseMetadata>,
858    /// The company.
859    pub company: Option<Company>,
860}
861
862impl common::ResponseResult for GetCompanyResponse {}
863
864/// A location with address and geographic coordinates. May optionally contain a
865/// detailed (multi-field) version of the address.
866///
867/// This type is not used in any activity, and only used as *part* of another schema.
868///
869#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
870#[serde_with::serde_as]
871#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
872pub struct Location {
873    /// Top-level administrative subdivision of this country.
874    #[serde(rename = "administrativeArea")]
875    pub administrative_area: Option<String>,
876    /// Generally refers to the city/town portion of an address.
877    pub locality: Option<String>,
878    /// The latitude and longitude of the location, in degrees.
879    #[serde(rename = "latLng")]
880    pub lat_lng: Option<LatLng>,
881    /// CLDR (Common Locale Data Repository) region code .
882    #[serde(rename = "regionCode")]
883    pub region_code: Option<String>,
884    /// Dependent locality or sublocality. Used for UK dependent localities, or
885    /// neighborhoods or boroughs in other locations.
886    #[serde(rename = "dependentLocality")]
887    pub dependent_locality: Option<String>,
888    /// The single string version of the address.
889    pub address: Option<String>,
890    /// Values are frequently alphanumeric.
891    #[serde(rename = "postalCode")]
892    pub postal_code: Option<String>,
893    /// Use of this code is very country-specific, but will refer to a secondary
894    /// classification code for sorting mail.
895    #[serde(rename = "sortingCode")]
896    pub sorting_code: Option<String>,
897    /// Language code of the address. Should be in BCP 47 format.
898    #[serde(rename = "languageCode")]
899    pub language_code: Option<String>,
900    /// The following address lines represent the most specific part of any
901    /// address.
902    #[serde(rename = "addressLine")]
903    pub address_line: Option<Vec<String>>,
904}
905
906impl common::Part for Location {}
907
908/// Status for a Google Partners certification exam.
909///
910/// This type is not used in any activity, and only used as *part* of another schema.
911///
912#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
913#[serde_with::serde_as]
914#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
915pub struct CertificationExamStatus {
916    /// The number of people who have passed the certification exam.
917    #[serde(rename = "numberUsersPass")]
918    pub number_users_pass: Option<i32>,
919    /// The type of certification exam.
920    #[serde(rename = "type")]
921    pub type_: Option<String>,
922}
923
924impl common::Part for CertificationExamStatus {}
925
926/// A set of opt-ins for a user.
927///
928/// This type is not used in any activity, and only used as *part* of another schema.
929///
930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
931#[serde_with::serde_as]
932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
933pub struct OptIns {
934    /// An opt-in about receiving email from Partners marketing teams. Includes
935    /// member-only events and special promotional offers for Google products.
936    #[serde(rename = "marketComm")]
937    pub market_comm: Option<bool>,
938    /// An opt-in about receiving email regarding new features and products.
939    #[serde(rename = "specialOffers")]
940    pub special_offers: Option<bool>,
941    /// An opt-in about receiving email with customized AdWords campaign management
942    /// tips.
943    #[serde(rename = "performanceSuggestions")]
944    pub performance_suggestions: Option<bool>,
945    /// An opt-in to receive special promotional gifts and material in the mail.
946    #[serde(rename = "physicalMail")]
947    pub physical_mail: Option<bool>,
948    /// An opt-in to allow recieivng phone calls about their Partners account.
949    #[serde(rename = "phoneContact")]
950    pub phone_contact: Option<bool>,
951}
952
953impl common::Part for OptIns {}
954
955/// Information related to ranking of results.
956///
957/// This type is not used in any activity, and only used as *part* of another schema.
958///
959#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
960#[serde_with::serde_as]
961#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
962pub struct Rank {
963    /// The numerical value of the rank.
964    pub value: Option<f64>,
965    /// The type of rank.
966    #[serde(rename = "type")]
967    pub type_: Option<String>,
968}
969
970impl common::Part for Rank {}
971
972/// Response message for
973/// GetPartnersStatus.
974///
975/// # Activities
976///
977/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
978/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
979///
980/// * [get partnersstatus](MethodGetPartnersstatuCall) (response)
981#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
982#[serde_with::serde_as]
983#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
984pub struct GetPartnersStatusResponse {
985    /// Current response metadata.
986    #[serde(rename = "responseMetadata")]
987    pub response_metadata: Option<ResponseMetadata>,
988}
989
990impl common::ResponseResult for GetPartnersStatusResponse {}
991
992/// The profile information of a Partners user.
993///
994/// # Activities
995///
996/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
997/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
998///
999/// * [update profile users](UserUpdateProfileCall) (request|response)
1000#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1001#[serde_with::serde_as]
1002#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1003pub struct UserProfile {
1004    /// A list of ids representing which channels the user selected they were in.
1005    pub channels: Option<Vec<String>>,
1006    /// Whether the user's public profile is visible to anyone with the URL.
1007    #[serde(rename = "profilePublic")]
1008    pub profile_public: Option<bool>,
1009    /// A list of ids represnting which job categories the user selected.
1010    #[serde(rename = "jobFunctions")]
1011    pub job_functions: Option<Vec<String>>,
1012    /// The user's given name.
1013    #[serde(rename = "givenName")]
1014    pub given_name: Option<String>,
1015    /// The user's mailing address, contains multiple fields.
1016    pub address: Option<Location>,
1017    /// A list of ids representing which industries the user selected.
1018    pub industries: Option<Vec<String>>,
1019    /// The list of opt-ins for the user, related to communication preferences.
1020    #[serde(rename = "emailOptIns")]
1021    pub email_opt_ins: Option<OptIns>,
1022    /// The user's family name.
1023    #[serde(rename = "familyName")]
1024    pub family_name: Option<String>,
1025    /// The list of languages this user understands.
1026    pub languages: Option<Vec<String>>,
1027    /// A list of ids representing which markets the user was interested in.
1028    pub markets: Option<Vec<String>>,
1029    /// Whether or not to migrate the user's exam data to Academy for Ads.
1030    #[serde(rename = "migrateToAfa")]
1031    pub migrate_to_afa: Option<bool>,
1032    /// If the user has edit access to multiple accounts, the user can choose the
1033    /// preferred account and it is used when a personal account is needed. Can
1034    /// be empty.
1035    #[serde(rename = "adwordsManagerAccount")]
1036    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1037    pub adwords_manager_account: Option<i64>,
1038    /// The user's phone number.
1039    #[serde(rename = "phoneNumber")]
1040    pub phone_number: Option<String>,
1041    /// The user's primary country, an ISO 2-character code.
1042    #[serde(rename = "primaryCountryCode")]
1043    pub primary_country_code: Option<String>,
1044    /// The email address the user has selected on the Partners site as primary.
1045    #[serde(rename = "emailAddress")]
1046    pub email_address: Option<String>,
1047}
1048
1049impl common::RequestValue for UserProfile {}
1050impl common::ResponseResult for UserProfile {}
1051
1052/// Historical information about a Google Partners Offer.
1053///
1054/// This type is not used in any activity, and only used as *part* of another schema.
1055///
1056#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1057#[serde_with::serde_as]
1058#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1059pub struct HistoricalOffer {
1060    /// Time offer was first created.
1061    #[serde(rename = "creationTime")]
1062    pub creation_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1063    /// Status of the offer.
1064    pub status: Option<String>,
1065    /// Email address for client.
1066    #[serde(rename = "clientEmail")]
1067    pub client_email: Option<String>,
1068    /// ID of client.
1069    #[serde(rename = "clientId")]
1070    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1071    pub client_id: Option<i64>,
1072    /// Name of the client.
1073    #[serde(rename = "clientName")]
1074    pub client_name: Option<String>,
1075    /// Time last action was taken.
1076    #[serde(rename = "lastModifiedTime")]
1077    pub last_modified_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1078    /// Client's AdWords page URL.
1079    #[serde(rename = "adwordsUrl")]
1080    pub adwords_url: Option<String>,
1081    /// Type of offer.
1082    #[serde(rename = "offerType")]
1083    pub offer_type: Option<String>,
1084    /// Name (First + Last) of the partners user to whom the incentive is allocated.
1085    #[serde(rename = "senderName")]
1086    pub sender_name: Option<String>,
1087    /// Country Code for the offer country.
1088    #[serde(rename = "offerCountryCode")]
1089    pub offer_country_code: Option<String>,
1090    /// Time this offer expires.
1091    #[serde(rename = "expirationTime")]
1092    pub expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1093    /// Offer code.
1094    #[serde(rename = "offerCode")]
1095    pub offer_code: Option<String>,
1096}
1097
1098impl common::Part for HistoricalOffer {}
1099
1100/// Request message for
1101/// LogUserEvent.
1102///
1103/// # Activities
1104///
1105/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1106/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1107///
1108/// * [log user events](UserEventLogCall) (request)
1109#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1110#[serde_with::serde_as]
1111#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1112pub struct LogUserEventRequest {
1113    /// The URL where the event occurred.
1114    pub url: Option<String>,
1115    /// Current request metadata.
1116    #[serde(rename = "requestMetadata")]
1117    pub request_metadata: Option<RequestMetadata>,
1118    /// List of event data for the event.
1119    #[serde(rename = "eventDatas")]
1120    pub event_datas: Option<Vec<EventData>>,
1121    /// The scope of the event.
1122    #[serde(rename = "eventScope")]
1123    pub event_scope: Option<String>,
1124    /// The category the action belongs to.
1125    #[serde(rename = "eventCategory")]
1126    pub event_category: Option<String>,
1127    /// Advertiser lead information.
1128    pub lead: Option<Lead>,
1129    /// The action that occurred.
1130    #[serde(rename = "eventAction")]
1131    pub event_action: Option<String>,
1132}
1133
1134impl common::RequestValue for LogUserEventRequest {}
1135
1136/// Values to use instead of the user's respective defaults. These are only
1137/// honored by whitelisted products.
1138///
1139/// This type is not used in any activity, and only used as *part* of another schema.
1140///
1141#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1142#[serde_with::serde_as]
1143#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1144pub struct UserOverrides {
1145    /// IP address to use instead of the user's geo-located IP address.
1146    #[serde(rename = "ipAddress")]
1147    pub ip_address: Option<String>,
1148    /// Logged-in user ID to impersonate instead of the user's ID.
1149    #[serde(rename = "userId")]
1150    pub user_id: Option<String>,
1151}
1152
1153impl common::Part for UserOverrides {}
1154
1155/// Details of the analytics events for a `Company` within a single day.
1156///
1157/// This type is not used in any activity, and only used as *part* of another schema.
1158///
1159#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1160#[serde_with::serde_as]
1161#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1162pub struct AnalyticsDataPoint {
1163    /// Location information of where these events occurred.
1164    #[serde(rename = "eventLocations")]
1165    pub event_locations: Option<Vec<LatLng>>,
1166    /// Number of times the type of event occurred.
1167    /// Meaning depends on context (e.g. profile views, contacts, etc.).
1168    #[serde(rename = "eventCount")]
1169    pub event_count: Option<i32>,
1170}
1171
1172impl common::Part for AnalyticsDataPoint {}
1173
1174/// Analytics data for a `Company` within a single day.
1175///
1176/// This type is not used in any activity, and only used as *part* of another schema.
1177///
1178#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1179#[serde_with::serde_as]
1180#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1181pub struct Analytics {
1182    /// Date on which these events occurred.
1183    #[serde(rename = "eventDate")]
1184    pub event_date: Option<Date>,
1185    /// Instances of users viewing the `Company` profile
1186    /// on the specified date.
1187    #[serde(rename = "profileViews")]
1188    pub profile_views: Option<AnalyticsDataPoint>,
1189    /// Instances of users seeing the `Company` in Google Partners Search results
1190    /// on the specified date.
1191    #[serde(rename = "searchViews")]
1192    pub search_views: Option<AnalyticsDataPoint>,
1193    /// Instances of users contacting the `Company`
1194    /// on the specified date.
1195    pub contacts: Option<AnalyticsDataPoint>,
1196}
1197
1198impl common::Part for Analytics {}
1199
1200/// Information about a particular AdWords Manager Account.
1201/// Read more at https://support.google.com/adwords/answer/6139186
1202///
1203/// This type is not used in any activity, and only used as *part* of another schema.
1204///
1205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1206#[serde_with::serde_as]
1207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1208pub struct AdWordsManagerAccountInfo {
1209    /// The AdWords Manager Account id.
1210    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1211    pub id: Option<i64>,
1212    /// Name of the customer this account represents.
1213    #[serde(rename = "customerName")]
1214    pub customer_name: Option<String>,
1215}
1216
1217impl common::Part for AdWordsManagerAccountInfo {}
1218
1219/// Basic information from a public profile.
1220///
1221/// This type is not used in any activity, and only used as *part* of another schema.
1222///
1223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1224#[serde_with::serde_as]
1225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1226pub struct PublicProfile {
1227    /// The URL to the main profile image of the public profile.
1228    #[serde(rename = "profileImage")]
1229    pub profile_image: Option<String>,
1230    /// The display name of the public profile.
1231    #[serde(rename = "displayName")]
1232    pub display_name: Option<String>,
1233    /// The URL to the main display image of the public profile. Being deprecated.
1234    #[serde(rename = "displayImageUrl")]
1235    pub display_image_url: Option<String>,
1236    /// The ID which can be used to retrieve more details about the public profile.
1237    pub id: Option<String>,
1238    /// The URL of the public profile.
1239    pub url: Option<String>,
1240}
1241
1242impl common::Part for PublicProfile {}
1243
1244/// Common data that is in each API response.
1245///
1246/// This type is not used in any activity, and only used as *part* of another schema.
1247///
1248#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1249#[serde_with::serde_as]
1250#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1251pub struct ResponseMetadata {
1252    /// Debug information about this request.
1253    #[serde(rename = "debugInfo")]
1254    pub debug_info: Option<DebugInfo>,
1255}
1256
1257impl common::Part for ResponseMetadata {}
1258
1259/// <a href="https://www.google.com/recaptcha/">reCaptcha</a> challenge info.
1260///
1261/// This type is not used in any activity, and only used as *part* of another schema.
1262///
1263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1264#[serde_with::serde_as]
1265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1266pub struct RecaptchaChallenge {
1267    /// The ID of the reCaptcha challenge.
1268    pub id: Option<String>,
1269    /// The response to the reCaptcha challenge.
1270    pub response: Option<String>,
1271}
1272
1273impl common::Part for RecaptchaChallenge {}
1274
1275/// Available Offers to be distributed.
1276///
1277/// This type is not used in any activity, and only used as *part* of another schema.
1278///
1279#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1280#[serde_with::serde_as]
1281#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1282pub struct AvailableOffer {
1283    /// Level of this offer.
1284    #[serde(rename = "offerLevel")]
1285    pub offer_level: Option<String>,
1286    /// Name of the offer.
1287    pub name: Option<String>,
1288    /// ID of this offer.
1289    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1290    pub id: Option<i64>,
1291    /// Whether or not the list of qualified customers is definitely complete.
1292    #[serde(rename = "qualifiedCustomersComplete")]
1293    pub qualified_customers_complete: Option<bool>,
1294    /// Offer info by country.
1295    #[serde(rename = "countryOfferInfos")]
1296    pub country_offer_infos: Option<Vec<CountryOfferInfo>>,
1297    /// Type of offer.
1298    #[serde(rename = "offerType")]
1299    pub offer_type: Option<String>,
1300    /// The maximum age of an account [in days] to be eligible.
1301    #[serde(rename = "maxAccountAge")]
1302    pub max_account_age: Option<i32>,
1303    /// Customers who qualify for this offer.
1304    #[serde(rename = "qualifiedCustomer")]
1305    pub qualified_customer: Option<Vec<OfferCustomer>>,
1306    /// Terms of the offer.
1307    pub terms: Option<String>,
1308    /// Should special text be shown on the offers page.
1309    #[serde(rename = "showSpecialOfferCopy")]
1310    pub show_special_offer_copy: Option<bool>,
1311    /// The number of codes for this offer that are available for distribution.
1312    pub available: Option<i32>,
1313    /// Description of the offer.
1314    pub description: Option<String>,
1315}
1316
1317impl common::Part for AvailableOffer {}
1318
1319/// An object representing a latitude/longitude pair. This is expressed as a pair
1320/// of doubles representing degrees latitude and degrees longitude. Unless
1321/// specified otherwise, this must conform to the
1322/// <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
1323/// standard</a>. Values must be within normalized ranges.
1324///
1325/// This type is not used in any activity, and only used as *part* of another schema.
1326///
1327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1328#[serde_with::serde_as]
1329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1330pub struct LatLng {
1331    /// The latitude in degrees. It must be in the range [-90.0, +90.0].
1332    pub latitude: Option<f64>,
1333    /// The longitude in degrees. It must be in the range [-180.0, +180.0].
1334    pub longitude: Option<f64>,
1335}
1336
1337impl common::Part for LatLng {}
1338
1339/// Represents an amount of money with its currency type.
1340///
1341/// This type is not used in any activity, and only used as *part* of another schema.
1342///
1343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1344#[serde_with::serde_as]
1345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1346pub struct Money {
1347    /// The 3-letter currency code defined in ISO 4217.
1348    #[serde(rename = "currencyCode")]
1349    pub currency_code: Option<String>,
1350    /// Number of nano (10^-9) units of the amount.
1351    /// The value must be between -999,999,999 and +999,999,999 inclusive.
1352    /// If `units` is positive, `nanos` must be positive or zero.
1353    /// If `units` is zero, `nanos` can be positive, zero, or negative.
1354    /// If `units` is negative, `nanos` must be negative or zero.
1355    /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
1356    pub nanos: Option<i32>,
1357    /// The whole units of the amount.
1358    /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
1359    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1360    pub units: Option<i64>,
1361}
1362
1363impl common::Part for Money {}
1364
1365/// Analytics aggregated data for a `Company` for a given date range.
1366///
1367/// This type is not used in any activity, and only used as *part* of another schema.
1368///
1369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1370#[serde_with::serde_as]
1371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1372pub struct AnalyticsSummary {
1373    /// Aggregated number of profile views for the `Company` for given date range.
1374    #[serde(rename = "profileViewsCount")]
1375    pub profile_views_count: Option<i32>,
1376    /// Aggregated number of times users saw the `Company`
1377    /// in Google Partners Search results for given date range.
1378    #[serde(rename = "searchViewsCount")]
1379    pub search_views_count: Option<i32>,
1380    /// Aggregated number of times users contacted the `Company`
1381    /// for given date range.
1382    #[serde(rename = "contactsCount")]
1383    pub contacts_count: Option<i32>,
1384}
1385
1386impl common::Part for AnalyticsSummary {}
1387
1388/// Request message for
1389/// LogClientMessage.
1390///
1391/// # Activities
1392///
1393/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1394/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1395///
1396/// * [log client messages](ClientMessageLogCall) (request)
1397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1398#[serde_with::serde_as]
1399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1400pub struct LogMessageRequest {
1401    /// Map of client info, such as URL, browser navigator, browser platform, etc.
1402    #[serde(rename = "clientInfo")]
1403    pub client_info: Option<HashMap<String, String>>,
1404    /// Current request metadata.
1405    #[serde(rename = "requestMetadata")]
1406    pub request_metadata: Option<RequestMetadata>,
1407    /// Message level of client message.
1408    pub level: Option<String>,
1409    /// Details about the client message.
1410    pub details: Option<String>,
1411}
1412
1413impl common::RequestValue for LogMessageRequest {}
1414
1415/// A lead resource that represents an advertiser contact for a `Company`. These
1416/// are usually generated via Google Partner Search (the advertiser portal).
1417///
1418/// # Activities
1419///
1420/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1421/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1422///
1423/// * [list leads](LeadListCall) (none)
1424/// * [update leads](MethodUpdateLeadCall) (request|response)
1425#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1426#[serde_with::serde_as]
1427#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1428pub struct Lead {
1429    /// The minimum monthly budget lead source is willing to spend.
1430    #[serde(rename = "minMonthlyBudget")]
1431    pub min_monthly_budget: Option<Money>,
1432    /// First name of lead source.
1433    #[serde(rename = "givenName")]
1434    pub given_name: Option<String>,
1435    /// Language code of the lead's language preference, as defined by
1436    /// <a href="https://tools.ietf.org/html/bcp47">BCP 47</a>
1437    /// (IETF BCP 47, "Tags for Identifying Languages").
1438    #[serde(rename = "languageCode")]
1439    pub language_code: Option<String>,
1440    /// Website URL of lead source.
1441    #[serde(rename = "websiteUrl")]
1442    pub website_url: Option<String>,
1443    /// The lead's state in relation to the company.
1444    pub state: Option<String>,
1445    /// List of reasons for using Google Partner Search and creating a lead.
1446    #[serde(rename = "gpsMotivations")]
1447    pub gps_motivations: Option<Vec<String>>,
1448    /// Email address of lead source.
1449    pub email: Option<String>,
1450    /// Last name of lead source.
1451    #[serde(rename = "familyName")]
1452    pub family_name: Option<String>,
1453    /// ID of the lead.
1454    pub id: Option<String>,
1455    /// Comments lead source gave.
1456    pub comments: Option<String>,
1457    /// Phone number of lead source.
1458    #[serde(rename = "phoneNumber")]
1459    pub phone_number: Option<String>,
1460    /// The AdWords Customer ID of the lead.
1461    #[serde(rename = "adwordsCustomerId")]
1462    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1463    pub adwords_customer_id: Option<i64>,
1464    /// Timestamp of when this lead was created.
1465    #[serde(rename = "createTime")]
1466    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1467    /// Whether or not the lead signed up for marketing emails
1468    #[serde(rename = "marketingOptIn")]
1469    pub marketing_opt_in: Option<bool>,
1470    /// Type of lead.
1471    #[serde(rename = "type")]
1472    pub type_: Option<String>,
1473}
1474
1475impl common::RequestValue for Lead {}
1476impl common::Resource for Lead {}
1477impl common::ResponseResult for Lead {}
1478
1479/// Debug information about this request.
1480///
1481/// This type is not used in any activity, and only used as *part* of another schema.
1482///
1483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1484#[serde_with::serde_as]
1485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1486pub struct DebugInfo {
1487    /// Info about the server that serviced this request.
1488    #[serde(rename = "serverInfo")]
1489    pub server_info: Option<String>,
1490    /// Server-side debug stack trace.
1491    #[serde(rename = "serverTraceInfo")]
1492    pub server_trace_info: Option<String>,
1493    /// URL of the service that handled this request.
1494    #[serde(rename = "serviceUrl")]
1495    pub service_url: Option<String>,
1496}
1497
1498impl common::Part for DebugInfo {}
1499
1500/// Response message for
1501/// ListUserStates.
1502///
1503/// # Activities
1504///
1505/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1506/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1507///
1508/// * [list user states](UserStateListCall) (response)
1509#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1510#[serde_with::serde_as]
1511#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1512pub struct ListUserStatesResponse {
1513    /// Current response metadata.
1514    #[serde(rename = "responseMetadata")]
1515    pub response_metadata: Option<ResponseMetadata>,
1516    /// User's states.
1517    #[serde(rename = "userStates")]
1518    pub user_states: Option<Vec<String>>,
1519}
1520
1521impl common::ResponseResult for ListUserStatesResponse {}
1522
1523/// A CompanyRelation resource representing information about a user’s
1524/// affiliation and standing with a company in Partners.
1525///
1526/// # Activities
1527///
1528/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1529/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1530///
1531/// * [create company relation users](UserCreateCompanyRelationCall) (request|response)
1532#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1533#[serde_with::serde_as]
1534#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1535pub struct CompanyRelation {
1536    /// Indicates if the user is an admin for this company.
1537    #[serde(rename = "companyAdmin")]
1538    pub company_admin: Option<bool>,
1539    /// The primary address for this company.
1540    pub address: Option<String>,
1541    /// The flag that indicates if the company is pending verification.
1542    #[serde(rename = "isPending")]
1543    pub is_pending: Option<bool>,
1544    /// The timestamp of when affiliation was requested.
1545    /// @OutputOnly
1546    #[serde(rename = "creationTime")]
1547    pub creation_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1548    /// The primary location of the company.
1549    #[serde(rename = "primaryAddress")]
1550    pub primary_address: Option<Location>,
1551    /// The state of relationship, in terms of approvals.
1552    pub state: Option<String>,
1553    /// The name (in the company's primary language) for the company.
1554    pub name: Option<String>,
1555    /// The AdWords manager account # associated this company.
1556    #[serde(rename = "managerAccount")]
1557    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1558    pub manager_account: Option<i64>,
1559    /// The segment the company is classified as.
1560    pub segment: Option<Vec<String>>,
1561    /// The internal company ID.
1562    /// Only available for a whitelisted set of api clients.
1563    #[serde(rename = "internalCompanyId")]
1564    pub internal_company_id: Option<String>,
1565    /// Whether the company is a Partner.
1566    #[serde(rename = "badgeTier")]
1567    pub badge_tier: Option<String>,
1568    /// The list of Google Partners specialization statuses for the company.
1569    #[serde(rename = "specializationStatus")]
1570    pub specialization_status: Option<Vec<SpecializationStatus>>,
1571    /// The phone number for the company's primary address.
1572    #[serde(rename = "phoneNumber")]
1573    pub phone_number: Option<String>,
1574    /// The website URL for this company.
1575    pub website: Option<String>,
1576    /// The primary country code of the company.
1577    #[serde(rename = "primaryCountryCode")]
1578    pub primary_country_code: Option<String>,
1579    /// The ID of the company. There may be no id if this is a
1580    /// pending company.5
1581    #[serde(rename = "companyId")]
1582    pub company_id: Option<String>,
1583    /// The primary language code of the company.
1584    #[serde(rename = "primaryLanguageCode")]
1585    pub primary_language_code: Option<String>,
1586    /// A URL to a profile photo, e.g. a G+ profile photo.
1587    #[serde(rename = "logoUrl")]
1588    pub logo_url: Option<String>,
1589    /// The timestamp when the user was approved.
1590    /// @OutputOnly
1591    #[serde(rename = "resolvedTimestamp")]
1592    pub resolved_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1593}
1594
1595impl common::RequestValue for CompanyRelation {}
1596impl common::ResponseResult for CompanyRelation {}
1597
1598/// Represents a whole or partial calendar date, e.g. a birthday. The time of day
1599/// and time zone are either specified elsewhere or are not significant. The date
1600/// is relative to the Proleptic Gregorian Calendar. This can represent:
1601///
1602/// * A full date, with non-zero year, month and day values
1603/// * A month and day value, with a zero year, e.g. an anniversary
1604/// * A year on its own, with zero month and day values
1605/// * A year and month value, with a zero day, e.g. a credit card expiration date
1606///
1607/// Related types are google.type.TimeOfDay and `google.protobuf.Timestamp`.
1608///
1609/// This type is not used in any activity, and only used as *part* of another schema.
1610///
1611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1612#[serde_with::serde_as]
1613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1614pub struct Date {
1615    /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without
1616    /// a year.
1617    pub year: Option<i32>,
1618    /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0
1619    /// if specifying a year by itself or a year and month where the day is not
1620    /// significant.
1621    pub day: Option<i32>,
1622    /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a
1623    /// month and day.
1624    pub month: Option<i32>,
1625}
1626
1627impl common::Part for Date {}
1628
1629// ###################
1630// MethodBuilders ###
1631// #################
1632
1633/// A builder providing access to all methods supported on *userEvent* resources.
1634/// It is not used directly, but through the [`Partners`] hub.
1635///
1636/// # Example
1637///
1638/// Instantiate a resource builder
1639///
1640/// ```test_harness,no_run
1641/// extern crate hyper;
1642/// extern crate hyper_rustls;
1643/// extern crate google_partners2 as partners2;
1644///
1645/// # async fn dox() {
1646/// use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1647///
1648/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1649/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1650///     secret,
1651///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1652/// ).build().await.unwrap();
1653///
1654/// let client = hyper_util::client::legacy::Client::builder(
1655///     hyper_util::rt::TokioExecutor::new()
1656/// )
1657/// .build(
1658///     hyper_rustls::HttpsConnectorBuilder::new()
1659///         .with_native_roots()
1660///         .unwrap()
1661///         .https_or_http()
1662///         .enable_http1()
1663///         .build()
1664/// );
1665/// let mut hub = Partners::new(client, auth);
1666/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1667/// // like `log(...)`
1668/// // to build up your call.
1669/// let rb = hub.user_events();
1670/// # }
1671/// ```
1672pub struct UserEventMethods<'a, C>
1673where
1674    C: 'a,
1675{
1676    hub: &'a Partners<C>,
1677}
1678
1679impl<'a, C> common::MethodsBuilder for UserEventMethods<'a, C> {}
1680
1681impl<'a, C> UserEventMethods<'a, C> {
1682    /// Create a builder to help you perform the following task:
1683    ///
1684    /// Logs a user event.
1685    ///
1686    /// # Arguments
1687    ///
1688    /// * `request` - No description provided.
1689    pub fn log(&self, request: LogUserEventRequest) -> UserEventLogCall<'a, C> {
1690        UserEventLogCall {
1691            hub: self.hub,
1692            _request: request,
1693            _delegate: Default::default(),
1694            _additional_params: Default::default(),
1695        }
1696    }
1697}
1698
1699/// A builder providing access to all methods supported on *clientMessage* resources.
1700/// It is not used directly, but through the [`Partners`] hub.
1701///
1702/// # Example
1703///
1704/// Instantiate a resource builder
1705///
1706/// ```test_harness,no_run
1707/// extern crate hyper;
1708/// extern crate hyper_rustls;
1709/// extern crate google_partners2 as partners2;
1710///
1711/// # async fn dox() {
1712/// use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1713///
1714/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1715/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1716///     secret,
1717///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1718/// ).build().await.unwrap();
1719///
1720/// let client = hyper_util::client::legacy::Client::builder(
1721///     hyper_util::rt::TokioExecutor::new()
1722/// )
1723/// .build(
1724///     hyper_rustls::HttpsConnectorBuilder::new()
1725///         .with_native_roots()
1726///         .unwrap()
1727///         .https_or_http()
1728///         .enable_http1()
1729///         .build()
1730/// );
1731/// let mut hub = Partners::new(client, auth);
1732/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1733/// // like `log(...)`
1734/// // to build up your call.
1735/// let rb = hub.client_messages();
1736/// # }
1737/// ```
1738pub struct ClientMessageMethods<'a, C>
1739where
1740    C: 'a,
1741{
1742    hub: &'a Partners<C>,
1743}
1744
1745impl<'a, C> common::MethodsBuilder for ClientMessageMethods<'a, C> {}
1746
1747impl<'a, C> ClientMessageMethods<'a, C> {
1748    /// Create a builder to help you perform the following task:
1749    ///
1750    /// Logs a generic message from the client, such as
1751    /// `Failed to render component`, `Profile page is running slow`,
1752    /// `More than 500 users have accessed this result.`, etc.
1753    ///
1754    /// # Arguments
1755    ///
1756    /// * `request` - No description provided.
1757    pub fn log(&self, request: LogMessageRequest) -> ClientMessageLogCall<'a, C> {
1758        ClientMessageLogCall {
1759            hub: self.hub,
1760            _request: request,
1761            _delegate: Default::default(),
1762            _additional_params: Default::default(),
1763        }
1764    }
1765}
1766
1767/// A builder providing access to all methods supported on *lead* resources.
1768/// It is not used directly, but through the [`Partners`] hub.
1769///
1770/// # Example
1771///
1772/// Instantiate a resource builder
1773///
1774/// ```test_harness,no_run
1775/// extern crate hyper;
1776/// extern crate hyper_rustls;
1777/// extern crate google_partners2 as partners2;
1778///
1779/// # async fn dox() {
1780/// use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1781///
1782/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1783/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1784///     secret,
1785///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1786/// ).build().await.unwrap();
1787///
1788/// let client = hyper_util::client::legacy::Client::builder(
1789///     hyper_util::rt::TokioExecutor::new()
1790/// )
1791/// .build(
1792///     hyper_rustls::HttpsConnectorBuilder::new()
1793///         .with_native_roots()
1794///         .unwrap()
1795///         .https_or_http()
1796///         .enable_http1()
1797///         .build()
1798/// );
1799/// let mut hub = Partners::new(client, auth);
1800/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1801/// // like `list(...)`
1802/// // to build up your call.
1803/// let rb = hub.leads();
1804/// # }
1805/// ```
1806pub struct LeadMethods<'a, C>
1807where
1808    C: 'a,
1809{
1810    hub: &'a Partners<C>,
1811}
1812
1813impl<'a, C> common::MethodsBuilder for LeadMethods<'a, C> {}
1814
1815impl<'a, C> LeadMethods<'a, C> {
1816    /// Create a builder to help you perform the following task:
1817    ///
1818    /// Lists advertiser leads for a user's associated company.
1819    /// Should only be called within the context of an authorized logged in user.
1820    pub fn list(&self) -> LeadListCall<'a, C> {
1821        LeadListCall {
1822            hub: self.hub,
1823            _request_metadata_user_overrides_user_id: Default::default(),
1824            _request_metadata_user_overrides_ip_address: Default::default(),
1825            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
1826            _request_metadata_traffic_source_traffic_source_id: Default::default(),
1827            _request_metadata_partners_session_id: Default::default(),
1828            _request_metadata_locale: Default::default(),
1829            _request_metadata_experiment_ids: Default::default(),
1830            _page_token: Default::default(),
1831            _page_size: Default::default(),
1832            _order_by: Default::default(),
1833            _delegate: Default::default(),
1834            _additional_params: Default::default(),
1835        }
1836    }
1837}
1838
1839/// A builder providing access to all methods supported on *offer* resources.
1840/// It is not used directly, but through the [`Partners`] hub.
1841///
1842/// # Example
1843///
1844/// Instantiate a resource builder
1845///
1846/// ```test_harness,no_run
1847/// extern crate hyper;
1848/// extern crate hyper_rustls;
1849/// extern crate google_partners2 as partners2;
1850///
1851/// # async fn dox() {
1852/// use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1853///
1854/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1855/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1856///     secret,
1857///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1858/// ).build().await.unwrap();
1859///
1860/// let client = hyper_util::client::legacy::Client::builder(
1861///     hyper_util::rt::TokioExecutor::new()
1862/// )
1863/// .build(
1864///     hyper_rustls::HttpsConnectorBuilder::new()
1865///         .with_native_roots()
1866///         .unwrap()
1867///         .https_or_http()
1868///         .enable_http1()
1869///         .build()
1870/// );
1871/// let mut hub = Partners::new(client, auth);
1872/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1873/// // like `history_list(...)` and `list(...)`
1874/// // to build up your call.
1875/// let rb = hub.offers();
1876/// # }
1877/// ```
1878pub struct OfferMethods<'a, C>
1879where
1880    C: 'a,
1881{
1882    hub: &'a Partners<C>,
1883}
1884
1885impl<'a, C> common::MethodsBuilder for OfferMethods<'a, C> {}
1886
1887impl<'a, C> OfferMethods<'a, C> {
1888    /// Create a builder to help you perform the following task:
1889    ///
1890    /// Lists the Historical Offers for the current user (or user's entire company)
1891    pub fn history_list(&self) -> OfferHistoryListCall<'a, C> {
1892        OfferHistoryListCall {
1893            hub: self.hub,
1894            _request_metadata_user_overrides_user_id: Default::default(),
1895            _request_metadata_user_overrides_ip_address: Default::default(),
1896            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
1897            _request_metadata_traffic_source_traffic_source_id: Default::default(),
1898            _request_metadata_partners_session_id: Default::default(),
1899            _request_metadata_locale: Default::default(),
1900            _request_metadata_experiment_ids: Default::default(),
1901            _page_token: Default::default(),
1902            _page_size: Default::default(),
1903            _order_by: Default::default(),
1904            _entire_company: Default::default(),
1905            _delegate: Default::default(),
1906            _additional_params: Default::default(),
1907        }
1908    }
1909
1910    /// Create a builder to help you perform the following task:
1911    ///
1912    /// Lists the Offers available for the current user
1913    pub fn list(&self) -> OfferListCall<'a, C> {
1914        OfferListCall {
1915            hub: self.hub,
1916            _request_metadata_user_overrides_user_id: Default::default(),
1917            _request_metadata_user_overrides_ip_address: Default::default(),
1918            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
1919            _request_metadata_traffic_source_traffic_source_id: Default::default(),
1920            _request_metadata_partners_session_id: Default::default(),
1921            _request_metadata_locale: Default::default(),
1922            _request_metadata_experiment_ids: Default::default(),
1923            _delegate: Default::default(),
1924            _additional_params: Default::default(),
1925        }
1926    }
1927}
1928
1929/// A builder providing access to all methods supported on *analytic* resources.
1930/// It is not used directly, but through the [`Partners`] hub.
1931///
1932/// # Example
1933///
1934/// Instantiate a resource builder
1935///
1936/// ```test_harness,no_run
1937/// extern crate hyper;
1938/// extern crate hyper_rustls;
1939/// extern crate google_partners2 as partners2;
1940///
1941/// # async fn dox() {
1942/// use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1943///
1944/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1945/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1946///     secret,
1947///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1948/// ).build().await.unwrap();
1949///
1950/// let client = hyper_util::client::legacy::Client::builder(
1951///     hyper_util::rt::TokioExecutor::new()
1952/// )
1953/// .build(
1954///     hyper_rustls::HttpsConnectorBuilder::new()
1955///         .with_native_roots()
1956///         .unwrap()
1957///         .https_or_http()
1958///         .enable_http1()
1959///         .build()
1960/// );
1961/// let mut hub = Partners::new(client, auth);
1962/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1963/// // like `list(...)`
1964/// // to build up your call.
1965/// let rb = hub.analytics();
1966/// # }
1967/// ```
1968pub struct AnalyticMethods<'a, C>
1969where
1970    C: 'a,
1971{
1972    hub: &'a Partners<C>,
1973}
1974
1975impl<'a, C> common::MethodsBuilder for AnalyticMethods<'a, C> {}
1976
1977impl<'a, C> AnalyticMethods<'a, C> {
1978    /// Create a builder to help you perform the following task:
1979    ///
1980    /// Lists analytics data for a user's associated company.
1981    /// Should only be called within the context of an authorized logged in user.
1982    pub fn list(&self) -> AnalyticListCall<'a, C> {
1983        AnalyticListCall {
1984            hub: self.hub,
1985            _request_metadata_user_overrides_user_id: Default::default(),
1986            _request_metadata_user_overrides_ip_address: Default::default(),
1987            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
1988            _request_metadata_traffic_source_traffic_source_id: Default::default(),
1989            _request_metadata_partners_session_id: Default::default(),
1990            _request_metadata_locale: Default::default(),
1991            _request_metadata_experiment_ids: Default::default(),
1992            _page_token: Default::default(),
1993            _page_size: Default::default(),
1994            _delegate: Default::default(),
1995            _additional_params: Default::default(),
1996        }
1997    }
1998}
1999
2000/// A builder providing access to all methods supported on *userState* resources.
2001/// It is not used directly, but through the [`Partners`] hub.
2002///
2003/// # Example
2004///
2005/// Instantiate a resource builder
2006///
2007/// ```test_harness,no_run
2008/// extern crate hyper;
2009/// extern crate hyper_rustls;
2010/// extern crate google_partners2 as partners2;
2011///
2012/// # async fn dox() {
2013/// use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2014///
2015/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2016/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2017///     secret,
2018///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2019/// ).build().await.unwrap();
2020///
2021/// let client = hyper_util::client::legacy::Client::builder(
2022///     hyper_util::rt::TokioExecutor::new()
2023/// )
2024/// .build(
2025///     hyper_rustls::HttpsConnectorBuilder::new()
2026///         .with_native_roots()
2027///         .unwrap()
2028///         .https_or_http()
2029///         .enable_http1()
2030///         .build()
2031/// );
2032/// let mut hub = Partners::new(client, auth);
2033/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2034/// // like `list(...)`
2035/// // to build up your call.
2036/// let rb = hub.user_states();
2037/// # }
2038/// ```
2039pub struct UserStateMethods<'a, C>
2040where
2041    C: 'a,
2042{
2043    hub: &'a Partners<C>,
2044}
2045
2046impl<'a, C> common::MethodsBuilder for UserStateMethods<'a, C> {}
2047
2048impl<'a, C> UserStateMethods<'a, C> {
2049    /// Create a builder to help you perform the following task:
2050    ///
2051    /// Lists states for current user.
2052    pub fn list(&self) -> UserStateListCall<'a, C> {
2053        UserStateListCall {
2054            hub: self.hub,
2055            _request_metadata_user_overrides_user_id: Default::default(),
2056            _request_metadata_user_overrides_ip_address: Default::default(),
2057            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2058            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2059            _request_metadata_partners_session_id: Default::default(),
2060            _request_metadata_locale: Default::default(),
2061            _request_metadata_experiment_ids: Default::default(),
2062            _delegate: Default::default(),
2063            _additional_params: Default::default(),
2064        }
2065    }
2066}
2067
2068/// A builder providing access to all free methods, which are not associated with a particular resource.
2069/// It is not used directly, but through the [`Partners`] hub.
2070///
2071/// # Example
2072///
2073/// Instantiate a resource builder
2074///
2075/// ```test_harness,no_run
2076/// extern crate hyper;
2077/// extern crate hyper_rustls;
2078/// extern crate google_partners2 as partners2;
2079///
2080/// # async fn dox() {
2081/// use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2082///
2083/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2084/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2085///     secret,
2086///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2087/// ).build().await.unwrap();
2088///
2089/// let client = hyper_util::client::legacy::Client::builder(
2090///     hyper_util::rt::TokioExecutor::new()
2091/// )
2092/// .build(
2093///     hyper_rustls::HttpsConnectorBuilder::new()
2094///         .with_native_roots()
2095///         .unwrap()
2096///         .https_or_http()
2097///         .enable_http1()
2098///         .build()
2099/// );
2100/// let mut hub = Partners::new(client, auth);
2101/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2102/// // like `get_partnersstatus(...)`, `update_companies(...)` and `update_leads(...)`
2103/// // to build up your call.
2104/// let rb = hub.methods();
2105/// # }
2106/// ```
2107pub struct MethodMethods<'a, C>
2108where
2109    C: 'a,
2110{
2111    hub: &'a Partners<C>,
2112}
2113
2114impl<'a, C> common::MethodsBuilder for MethodMethods<'a, C> {}
2115
2116impl<'a, C> MethodMethods<'a, C> {
2117    /// Create a builder to help you perform the following task:
2118    ///
2119    /// Updates the specified lead.
2120    ///
2121    /// # Arguments
2122    ///
2123    /// * `request` - No description provided.
2124    pub fn update_leads(&self, request: Lead) -> MethodUpdateLeadCall<'a, C> {
2125        MethodUpdateLeadCall {
2126            hub: self.hub,
2127            _request: request,
2128            _update_mask: Default::default(),
2129            _request_metadata_user_overrides_user_id: Default::default(),
2130            _request_metadata_user_overrides_ip_address: Default::default(),
2131            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2132            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2133            _request_metadata_partners_session_id: Default::default(),
2134            _request_metadata_locale: Default::default(),
2135            _request_metadata_experiment_ids: Default::default(),
2136            _delegate: Default::default(),
2137            _additional_params: Default::default(),
2138        }
2139    }
2140
2141    /// Create a builder to help you perform the following task:
2142    ///
2143    /// Update company.
2144    /// Should only be called within the context of an authorized logged in user.
2145    ///
2146    /// # Arguments
2147    ///
2148    /// * `request` - No description provided.
2149    pub fn update_companies(&self, request: Company) -> MethodUpdateCompanyCall<'a, C> {
2150        MethodUpdateCompanyCall {
2151            hub: self.hub,
2152            _request: request,
2153            _update_mask: Default::default(),
2154            _request_metadata_user_overrides_user_id: Default::default(),
2155            _request_metadata_user_overrides_ip_address: Default::default(),
2156            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2157            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2158            _request_metadata_partners_session_id: Default::default(),
2159            _request_metadata_locale: Default::default(),
2160            _request_metadata_experiment_ids: Default::default(),
2161            _delegate: Default::default(),
2162            _additional_params: Default::default(),
2163        }
2164    }
2165
2166    /// Create a builder to help you perform the following task:
2167    ///
2168    /// Gets Partners Status of the logged in user's agency.
2169    /// Should only be called if the logged in user is the admin of the agency.
2170    pub fn get_partnersstatus(&self) -> MethodGetPartnersstatuCall<'a, C> {
2171        MethodGetPartnersstatuCall {
2172            hub: self.hub,
2173            _request_metadata_user_overrides_user_id: Default::default(),
2174            _request_metadata_user_overrides_ip_address: Default::default(),
2175            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2176            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2177            _request_metadata_partners_session_id: Default::default(),
2178            _request_metadata_locale: Default::default(),
2179            _request_metadata_experiment_ids: Default::default(),
2180            _delegate: Default::default(),
2181            _additional_params: Default::default(),
2182        }
2183    }
2184}
2185
2186/// A builder providing access to all methods supported on *company* resources.
2187/// It is not used directly, but through the [`Partners`] hub.
2188///
2189/// # Example
2190///
2191/// Instantiate a resource builder
2192///
2193/// ```test_harness,no_run
2194/// extern crate hyper;
2195/// extern crate hyper_rustls;
2196/// extern crate google_partners2 as partners2;
2197///
2198/// # async fn dox() {
2199/// use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2200///
2201/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2202/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2203///     secret,
2204///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2205/// ).build().await.unwrap();
2206///
2207/// let client = hyper_util::client::legacy::Client::builder(
2208///     hyper_util::rt::TokioExecutor::new()
2209/// )
2210/// .build(
2211///     hyper_rustls::HttpsConnectorBuilder::new()
2212///         .with_native_roots()
2213///         .unwrap()
2214///         .https_or_http()
2215///         .enable_http1()
2216///         .build()
2217/// );
2218/// let mut hub = Partners::new(client, auth);
2219/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2220/// // like `get(...)`, `leads_create(...)` and `list(...)`
2221/// // to build up your call.
2222/// let rb = hub.companies();
2223/// # }
2224/// ```
2225pub struct CompanyMethods<'a, C>
2226where
2227    C: 'a,
2228{
2229    hub: &'a Partners<C>,
2230}
2231
2232impl<'a, C> common::MethodsBuilder for CompanyMethods<'a, C> {}
2233
2234impl<'a, C> CompanyMethods<'a, C> {
2235    /// Create a builder to help you perform the following task:
2236    ///
2237    /// Creates an advertiser lead for the given company ID.
2238    ///
2239    /// # Arguments
2240    ///
2241    /// * `request` - No description provided.
2242    /// * `companyId` - The ID of the company to contact.
2243    pub fn leads_create(
2244        &self,
2245        request: CreateLeadRequest,
2246        company_id: &str,
2247    ) -> CompanyLeadCreateCall<'a, C> {
2248        CompanyLeadCreateCall {
2249            hub: self.hub,
2250            _request: request,
2251            _company_id: company_id.to_string(),
2252            _delegate: Default::default(),
2253            _additional_params: Default::default(),
2254        }
2255    }
2256
2257    /// Create a builder to help you perform the following task:
2258    ///
2259    /// Gets a company.
2260    ///
2261    /// # Arguments
2262    ///
2263    /// * `companyId` - The ID of the company to retrieve.
2264    pub fn get(&self, company_id: &str) -> CompanyGetCall<'a, C> {
2265        CompanyGetCall {
2266            hub: self.hub,
2267            _company_id: company_id.to_string(),
2268            _view: Default::default(),
2269            _request_metadata_user_overrides_user_id: Default::default(),
2270            _request_metadata_user_overrides_ip_address: Default::default(),
2271            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2272            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2273            _request_metadata_partners_session_id: Default::default(),
2274            _request_metadata_locale: Default::default(),
2275            _request_metadata_experiment_ids: Default::default(),
2276            _order_by: Default::default(),
2277            _currency_code: Default::default(),
2278            _address: Default::default(),
2279            _delegate: Default::default(),
2280            _additional_params: Default::default(),
2281        }
2282    }
2283
2284    /// Create a builder to help you perform the following task:
2285    ///
2286    /// Lists companies.
2287    pub fn list(&self) -> CompanyListCall<'a, C> {
2288        CompanyListCall {
2289            hub: self.hub,
2290            _website_url: Default::default(),
2291            _view: Default::default(),
2292            _specializations: Default::default(),
2293            _services: Default::default(),
2294            _request_metadata_user_overrides_user_id: Default::default(),
2295            _request_metadata_user_overrides_ip_address: Default::default(),
2296            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2297            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2298            _request_metadata_partners_session_id: Default::default(),
2299            _request_metadata_locale: Default::default(),
2300            _request_metadata_experiment_ids: Default::default(),
2301            _page_token: Default::default(),
2302            _page_size: Default::default(),
2303            _order_by: Default::default(),
2304            _min_monthly_budget_units: Default::default(),
2305            _min_monthly_budget_nanos: Default::default(),
2306            _min_monthly_budget_currency_code: Default::default(),
2307            _max_monthly_budget_units: Default::default(),
2308            _max_monthly_budget_nanos: Default::default(),
2309            _max_monthly_budget_currency_code: Default::default(),
2310            _language_codes: Default::default(),
2311            _industries: Default::default(),
2312            _gps_motivations: Default::default(),
2313            _company_name: Default::default(),
2314            _address: Default::default(),
2315            _delegate: Default::default(),
2316            _additional_params: Default::default(),
2317        }
2318    }
2319}
2320
2321/// A builder providing access to all methods supported on *user* resources.
2322/// It is not used directly, but through the [`Partners`] hub.
2323///
2324/// # Example
2325///
2326/// Instantiate a resource builder
2327///
2328/// ```test_harness,no_run
2329/// extern crate hyper;
2330/// extern crate hyper_rustls;
2331/// extern crate google_partners2 as partners2;
2332///
2333/// # async fn dox() {
2334/// use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2335///
2336/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2337/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2338///     secret,
2339///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2340/// ).build().await.unwrap();
2341///
2342/// let client = hyper_util::client::legacy::Client::builder(
2343///     hyper_util::rt::TokioExecutor::new()
2344/// )
2345/// .build(
2346///     hyper_rustls::HttpsConnectorBuilder::new()
2347///         .with_native_roots()
2348///         .unwrap()
2349///         .https_or_http()
2350///         .enable_http1()
2351///         .build()
2352/// );
2353/// let mut hub = Partners::new(client, auth);
2354/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2355/// // like `create_company_relation(...)`, `delete_company_relation(...)`, `get(...)` and `update_profile(...)`
2356/// // to build up your call.
2357/// let rb = hub.users();
2358/// # }
2359/// ```
2360pub struct UserMethods<'a, C>
2361where
2362    C: 'a,
2363{
2364    hub: &'a Partners<C>,
2365}
2366
2367impl<'a, C> common::MethodsBuilder for UserMethods<'a, C> {}
2368
2369impl<'a, C> UserMethods<'a, C> {
2370    /// Create a builder to help you perform the following task:
2371    ///
2372    /// Updates a user's profile. A user can only update their own profile and
2373    /// should only be called within the context of a logged in user.
2374    ///
2375    /// # Arguments
2376    ///
2377    /// * `request` - No description provided.
2378    pub fn update_profile(&self, request: UserProfile) -> UserUpdateProfileCall<'a, C> {
2379        UserUpdateProfileCall {
2380            hub: self.hub,
2381            _request: request,
2382            _request_metadata_user_overrides_user_id: Default::default(),
2383            _request_metadata_user_overrides_ip_address: Default::default(),
2384            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2385            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2386            _request_metadata_partners_session_id: Default::default(),
2387            _request_metadata_locale: Default::default(),
2388            _request_metadata_experiment_ids: Default::default(),
2389            _delegate: Default::default(),
2390            _additional_params: Default::default(),
2391        }
2392    }
2393
2394    /// Create a builder to help you perform the following task:
2395    ///
2396    /// Creates a user's company relation. Affiliates the user to a company.
2397    ///
2398    /// # Arguments
2399    ///
2400    /// * `request` - No description provided.
2401    /// * `userId` - The ID of the user. Can be set to <code>me</code> to mean
2402    ///              the currently authenticated user.
2403    pub fn create_company_relation(
2404        &self,
2405        request: CompanyRelation,
2406        user_id: &str,
2407    ) -> UserCreateCompanyRelationCall<'a, C> {
2408        UserCreateCompanyRelationCall {
2409            hub: self.hub,
2410            _request: request,
2411            _user_id: user_id.to_string(),
2412            _request_metadata_user_overrides_user_id: Default::default(),
2413            _request_metadata_user_overrides_ip_address: Default::default(),
2414            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2415            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2416            _request_metadata_partners_session_id: Default::default(),
2417            _request_metadata_locale: Default::default(),
2418            _request_metadata_experiment_ids: Default::default(),
2419            _delegate: Default::default(),
2420            _additional_params: Default::default(),
2421        }
2422    }
2423
2424    /// Create a builder to help you perform the following task:
2425    ///
2426    /// Deletes a user's company relation. Unaffiliaites the user from a company.
2427    ///
2428    /// # Arguments
2429    ///
2430    /// * `userId` - The ID of the user. Can be set to <code>me</code> to mean
2431    ///              the currently authenticated user.
2432    pub fn delete_company_relation(&self, user_id: &str) -> UserDeleteCompanyRelationCall<'a, C> {
2433        UserDeleteCompanyRelationCall {
2434            hub: self.hub,
2435            _user_id: user_id.to_string(),
2436            _request_metadata_user_overrides_user_id: Default::default(),
2437            _request_metadata_user_overrides_ip_address: Default::default(),
2438            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2439            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2440            _request_metadata_partners_session_id: Default::default(),
2441            _request_metadata_locale: Default::default(),
2442            _request_metadata_experiment_ids: Default::default(),
2443            _delegate: Default::default(),
2444            _additional_params: Default::default(),
2445        }
2446    }
2447
2448    /// Create a builder to help you perform the following task:
2449    ///
2450    /// Gets a user.
2451    ///
2452    /// # Arguments
2453    ///
2454    /// * `userId` - Identifier of the user. Can be set to <code>me</code> to mean the currently
2455    ///              authenticated user.
2456    pub fn get(&self, user_id: &str) -> UserGetCall<'a, C> {
2457        UserGetCall {
2458            hub: self.hub,
2459            _user_id: user_id.to_string(),
2460            _user_view: Default::default(),
2461            _request_metadata_user_overrides_user_id: Default::default(),
2462            _request_metadata_user_overrides_ip_address: Default::default(),
2463            _request_metadata_traffic_source_traffic_sub_id: Default::default(),
2464            _request_metadata_traffic_source_traffic_source_id: Default::default(),
2465            _request_metadata_partners_session_id: Default::default(),
2466            _request_metadata_locale: Default::default(),
2467            _request_metadata_experiment_ids: Default::default(),
2468            _delegate: Default::default(),
2469            _additional_params: Default::default(),
2470        }
2471    }
2472}
2473
2474// ###################
2475// CallBuilders   ###
2476// #################
2477
2478/// Logs a user event.
2479///
2480/// A builder for the *log* method supported by a *userEvent* resource.
2481/// It is not used directly, but through a [`UserEventMethods`] instance.
2482///
2483/// # Example
2484///
2485/// Instantiate a resource method builder
2486///
2487/// ```test_harness,no_run
2488/// # extern crate hyper;
2489/// # extern crate hyper_rustls;
2490/// # extern crate google_partners2 as partners2;
2491/// use partners2::api::LogUserEventRequest;
2492/// # async fn dox() {
2493/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2494///
2495/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2496/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2497/// #     secret,
2498/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2499/// # ).build().await.unwrap();
2500///
2501/// # let client = hyper_util::client::legacy::Client::builder(
2502/// #     hyper_util::rt::TokioExecutor::new()
2503/// # )
2504/// # .build(
2505/// #     hyper_rustls::HttpsConnectorBuilder::new()
2506/// #         .with_native_roots()
2507/// #         .unwrap()
2508/// #         .https_or_http()
2509/// #         .enable_http1()
2510/// #         .build()
2511/// # );
2512/// # let mut hub = Partners::new(client, auth);
2513/// // As the method needs a request, you would usually fill it with the desired information
2514/// // into the respective structure. Some of the parts shown here might not be applicable !
2515/// // Values shown here are possibly random and not representative !
2516/// let mut req = LogUserEventRequest::default();
2517///
2518/// // You can configure optional parameters by calling the respective setters at will, and
2519/// // execute the final call using `doit()`.
2520/// // Values shown here are possibly random and not representative !
2521/// let result = hub.user_events().log(req)
2522///              .doit().await;
2523/// # }
2524/// ```
2525pub struct UserEventLogCall<'a, C>
2526where
2527    C: 'a,
2528{
2529    hub: &'a Partners<C>,
2530    _request: LogUserEventRequest,
2531    _delegate: Option<&'a mut dyn common::Delegate>,
2532    _additional_params: HashMap<String, String>,
2533}
2534
2535impl<'a, C> common::CallBuilder for UserEventLogCall<'a, C> {}
2536
2537impl<'a, C> UserEventLogCall<'a, C>
2538where
2539    C: common::Connector,
2540{
2541    /// Perform the operation you have build so far.
2542    pub async fn doit(mut self) -> common::Result<(common::Response, LogUserEventResponse)> {
2543        use std::borrow::Cow;
2544        use std::io::{Read, Seek};
2545
2546        use common::{url::Params, ToParts};
2547        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2548
2549        let mut dd = common::DefaultDelegate;
2550        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2551        dlg.begin(common::MethodInfo {
2552            id: "partners.userEvents.log",
2553            http_method: hyper::Method::POST,
2554        });
2555
2556        for &field in ["alt"].iter() {
2557            if self._additional_params.contains_key(field) {
2558                dlg.finished(false);
2559                return Err(common::Error::FieldClash(field));
2560            }
2561        }
2562
2563        let mut params = Params::with_capacity(3 + self._additional_params.len());
2564
2565        params.extend(self._additional_params.iter());
2566
2567        params.push("alt", "json");
2568        let mut url = self.hub._base_url.clone() + "v2/userEvents:log";
2569
2570        match dlg.api_key() {
2571            Some(value) => params.push("key", value),
2572            None => {
2573                dlg.finished(false);
2574                return Err(common::Error::MissingAPIKey);
2575            }
2576        }
2577
2578        let url = params.parse_with_url(&url);
2579
2580        let mut json_mime_type = mime::APPLICATION_JSON;
2581        let mut request_value_reader = {
2582            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2583            common::remove_json_null_values(&mut value);
2584            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2585            serde_json::to_writer(&mut dst, &value).unwrap();
2586            dst
2587        };
2588        let request_size = request_value_reader
2589            .seek(std::io::SeekFrom::End(0))
2590            .unwrap();
2591        request_value_reader
2592            .seek(std::io::SeekFrom::Start(0))
2593            .unwrap();
2594
2595        loop {
2596            request_value_reader
2597                .seek(std::io::SeekFrom::Start(0))
2598                .unwrap();
2599            let mut req_result = {
2600                let client = &self.hub.client;
2601                dlg.pre_request();
2602                let mut req_builder = hyper::Request::builder()
2603                    .method(hyper::Method::POST)
2604                    .uri(url.as_str())
2605                    .header(USER_AGENT, self.hub._user_agent.clone());
2606
2607                let request = req_builder
2608                    .header(CONTENT_TYPE, json_mime_type.to_string())
2609                    .header(CONTENT_LENGTH, request_size as u64)
2610                    .body(common::to_body(
2611                        request_value_reader.get_ref().clone().into(),
2612                    ));
2613
2614                client.request(request.unwrap()).await
2615            };
2616
2617            match req_result {
2618                Err(err) => {
2619                    if let common::Retry::After(d) = dlg.http_error(&err) {
2620                        sleep(d).await;
2621                        continue;
2622                    }
2623                    dlg.finished(false);
2624                    return Err(common::Error::HttpError(err));
2625                }
2626                Ok(res) => {
2627                    let (mut parts, body) = res.into_parts();
2628                    let mut body = common::Body::new(body);
2629                    if !parts.status.is_success() {
2630                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2631                        let error = serde_json::from_str(&common::to_string(&bytes));
2632                        let response = common::to_response(parts, bytes.into());
2633
2634                        if let common::Retry::After(d) =
2635                            dlg.http_failure(&response, error.as_ref().ok())
2636                        {
2637                            sleep(d).await;
2638                            continue;
2639                        }
2640
2641                        dlg.finished(false);
2642
2643                        return Err(match error {
2644                            Ok(value) => common::Error::BadRequest(value),
2645                            _ => common::Error::Failure(response),
2646                        });
2647                    }
2648                    let response = {
2649                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2650                        let encoded = common::to_string(&bytes);
2651                        match serde_json::from_str(&encoded) {
2652                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2653                            Err(error) => {
2654                                dlg.response_json_decode_error(&encoded, &error);
2655                                return Err(common::Error::JsonDecodeError(
2656                                    encoded.to_string(),
2657                                    error,
2658                                ));
2659                            }
2660                        }
2661                    };
2662
2663                    dlg.finished(true);
2664                    return Ok(response);
2665                }
2666            }
2667        }
2668    }
2669
2670    ///
2671    /// Sets the *request* property to the given value.
2672    ///
2673    /// Even though the property as already been set when instantiating this call,
2674    /// we provide this method for API completeness.
2675    pub fn request(mut self, new_value: LogUserEventRequest) -> UserEventLogCall<'a, C> {
2676        self._request = new_value;
2677        self
2678    }
2679    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2680    /// while executing the actual API request.
2681    ///
2682    /// ````text
2683    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2684    /// ````
2685    ///
2686    /// Sets the *delegate* property to the given value.
2687    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserEventLogCall<'a, C> {
2688        self._delegate = Some(new_value);
2689        self
2690    }
2691
2692    /// Set any additional parameter of the query string used in the request.
2693    /// It should be used to set parameters which are not yet available through their own
2694    /// setters.
2695    ///
2696    /// Please note that this method must not be used to set any of the known parameters
2697    /// which have their own setter method. If done anyway, the request will fail.
2698    ///
2699    /// # Additional Parameters
2700    ///
2701    /// * *alt* (query-string) - Data format for response.
2702    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2703    /// * *access_token* (query-string) - OAuth access token.
2704    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2705    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2706    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2707    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2708    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2709    /// * *$.xgafv* (query-string) - V1 error format.
2710    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2711    /// * *callback* (query-string) - JSONP
2712    pub fn param<T>(mut self, name: T, value: T) -> UserEventLogCall<'a, C>
2713    where
2714        T: AsRef<str>,
2715    {
2716        self._additional_params
2717            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2718        self
2719    }
2720}
2721
2722/// Logs a generic message from the client, such as
2723/// `Failed to render component`, `Profile page is running slow`,
2724/// `More than 500 users have accessed this result.`, etc.
2725///
2726/// A builder for the *log* method supported by a *clientMessage* resource.
2727/// It is not used directly, but through a [`ClientMessageMethods`] instance.
2728///
2729/// # Example
2730///
2731/// Instantiate a resource method builder
2732///
2733/// ```test_harness,no_run
2734/// # extern crate hyper;
2735/// # extern crate hyper_rustls;
2736/// # extern crate google_partners2 as partners2;
2737/// use partners2::api::LogMessageRequest;
2738/// # async fn dox() {
2739/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2740///
2741/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2742/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2743/// #     secret,
2744/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2745/// # ).build().await.unwrap();
2746///
2747/// # let client = hyper_util::client::legacy::Client::builder(
2748/// #     hyper_util::rt::TokioExecutor::new()
2749/// # )
2750/// # .build(
2751/// #     hyper_rustls::HttpsConnectorBuilder::new()
2752/// #         .with_native_roots()
2753/// #         .unwrap()
2754/// #         .https_or_http()
2755/// #         .enable_http1()
2756/// #         .build()
2757/// # );
2758/// # let mut hub = Partners::new(client, auth);
2759/// // As the method needs a request, you would usually fill it with the desired information
2760/// // into the respective structure. Some of the parts shown here might not be applicable !
2761/// // Values shown here are possibly random and not representative !
2762/// let mut req = LogMessageRequest::default();
2763///
2764/// // You can configure optional parameters by calling the respective setters at will, and
2765/// // execute the final call using `doit()`.
2766/// // Values shown here are possibly random and not representative !
2767/// let result = hub.client_messages().log(req)
2768///              .doit().await;
2769/// # }
2770/// ```
2771pub struct ClientMessageLogCall<'a, C>
2772where
2773    C: 'a,
2774{
2775    hub: &'a Partners<C>,
2776    _request: LogMessageRequest,
2777    _delegate: Option<&'a mut dyn common::Delegate>,
2778    _additional_params: HashMap<String, String>,
2779}
2780
2781impl<'a, C> common::CallBuilder for ClientMessageLogCall<'a, C> {}
2782
2783impl<'a, C> ClientMessageLogCall<'a, C>
2784where
2785    C: common::Connector,
2786{
2787    /// Perform the operation you have build so far.
2788    pub async fn doit(mut self) -> common::Result<(common::Response, LogMessageResponse)> {
2789        use std::borrow::Cow;
2790        use std::io::{Read, Seek};
2791
2792        use common::{url::Params, ToParts};
2793        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2794
2795        let mut dd = common::DefaultDelegate;
2796        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2797        dlg.begin(common::MethodInfo {
2798            id: "partners.clientMessages.log",
2799            http_method: hyper::Method::POST,
2800        });
2801
2802        for &field in ["alt"].iter() {
2803            if self._additional_params.contains_key(field) {
2804                dlg.finished(false);
2805                return Err(common::Error::FieldClash(field));
2806            }
2807        }
2808
2809        let mut params = Params::with_capacity(3 + self._additional_params.len());
2810
2811        params.extend(self._additional_params.iter());
2812
2813        params.push("alt", "json");
2814        let mut url = self.hub._base_url.clone() + "v2/clientMessages:log";
2815
2816        match dlg.api_key() {
2817            Some(value) => params.push("key", value),
2818            None => {
2819                dlg.finished(false);
2820                return Err(common::Error::MissingAPIKey);
2821            }
2822        }
2823
2824        let url = params.parse_with_url(&url);
2825
2826        let mut json_mime_type = mime::APPLICATION_JSON;
2827        let mut request_value_reader = {
2828            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2829            common::remove_json_null_values(&mut value);
2830            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2831            serde_json::to_writer(&mut dst, &value).unwrap();
2832            dst
2833        };
2834        let request_size = request_value_reader
2835            .seek(std::io::SeekFrom::End(0))
2836            .unwrap();
2837        request_value_reader
2838            .seek(std::io::SeekFrom::Start(0))
2839            .unwrap();
2840
2841        loop {
2842            request_value_reader
2843                .seek(std::io::SeekFrom::Start(0))
2844                .unwrap();
2845            let mut req_result = {
2846                let client = &self.hub.client;
2847                dlg.pre_request();
2848                let mut req_builder = hyper::Request::builder()
2849                    .method(hyper::Method::POST)
2850                    .uri(url.as_str())
2851                    .header(USER_AGENT, self.hub._user_agent.clone());
2852
2853                let request = req_builder
2854                    .header(CONTENT_TYPE, json_mime_type.to_string())
2855                    .header(CONTENT_LENGTH, request_size as u64)
2856                    .body(common::to_body(
2857                        request_value_reader.get_ref().clone().into(),
2858                    ));
2859
2860                client.request(request.unwrap()).await
2861            };
2862
2863            match req_result {
2864                Err(err) => {
2865                    if let common::Retry::After(d) = dlg.http_error(&err) {
2866                        sleep(d).await;
2867                        continue;
2868                    }
2869                    dlg.finished(false);
2870                    return Err(common::Error::HttpError(err));
2871                }
2872                Ok(res) => {
2873                    let (mut parts, body) = res.into_parts();
2874                    let mut body = common::Body::new(body);
2875                    if !parts.status.is_success() {
2876                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2877                        let error = serde_json::from_str(&common::to_string(&bytes));
2878                        let response = common::to_response(parts, bytes.into());
2879
2880                        if let common::Retry::After(d) =
2881                            dlg.http_failure(&response, error.as_ref().ok())
2882                        {
2883                            sleep(d).await;
2884                            continue;
2885                        }
2886
2887                        dlg.finished(false);
2888
2889                        return Err(match error {
2890                            Ok(value) => common::Error::BadRequest(value),
2891                            _ => common::Error::Failure(response),
2892                        });
2893                    }
2894                    let response = {
2895                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2896                        let encoded = common::to_string(&bytes);
2897                        match serde_json::from_str(&encoded) {
2898                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2899                            Err(error) => {
2900                                dlg.response_json_decode_error(&encoded, &error);
2901                                return Err(common::Error::JsonDecodeError(
2902                                    encoded.to_string(),
2903                                    error,
2904                                ));
2905                            }
2906                        }
2907                    };
2908
2909                    dlg.finished(true);
2910                    return Ok(response);
2911                }
2912            }
2913        }
2914    }
2915
2916    ///
2917    /// Sets the *request* property to the given value.
2918    ///
2919    /// Even though the property as already been set when instantiating this call,
2920    /// we provide this method for API completeness.
2921    pub fn request(mut self, new_value: LogMessageRequest) -> ClientMessageLogCall<'a, C> {
2922        self._request = new_value;
2923        self
2924    }
2925    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2926    /// while executing the actual API request.
2927    ///
2928    /// ````text
2929    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2930    /// ````
2931    ///
2932    /// Sets the *delegate* property to the given value.
2933    pub fn delegate(
2934        mut self,
2935        new_value: &'a mut dyn common::Delegate,
2936    ) -> ClientMessageLogCall<'a, C> {
2937        self._delegate = Some(new_value);
2938        self
2939    }
2940
2941    /// Set any additional parameter of the query string used in the request.
2942    /// It should be used to set parameters which are not yet available through their own
2943    /// setters.
2944    ///
2945    /// Please note that this method must not be used to set any of the known parameters
2946    /// which have their own setter method. If done anyway, the request will fail.
2947    ///
2948    /// # Additional Parameters
2949    ///
2950    /// * *alt* (query-string) - Data format for response.
2951    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2952    /// * *access_token* (query-string) - OAuth access token.
2953    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2954    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2955    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2956    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2957    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2958    /// * *$.xgafv* (query-string) - V1 error format.
2959    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2960    /// * *callback* (query-string) - JSONP
2961    pub fn param<T>(mut self, name: T, value: T) -> ClientMessageLogCall<'a, C>
2962    where
2963        T: AsRef<str>,
2964    {
2965        self._additional_params
2966            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2967        self
2968    }
2969}
2970
2971/// Lists advertiser leads for a user's associated company.
2972/// Should only be called within the context of an authorized logged in user.
2973///
2974/// A builder for the *list* method supported by a *lead* resource.
2975/// It is not used directly, but through a [`LeadMethods`] instance.
2976///
2977/// # Example
2978///
2979/// Instantiate a resource method builder
2980///
2981/// ```test_harness,no_run
2982/// # extern crate hyper;
2983/// # extern crate hyper_rustls;
2984/// # extern crate google_partners2 as partners2;
2985/// # async fn dox() {
2986/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2987///
2988/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2989/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2990/// #     secret,
2991/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2992/// # ).build().await.unwrap();
2993///
2994/// # let client = hyper_util::client::legacy::Client::builder(
2995/// #     hyper_util::rt::TokioExecutor::new()
2996/// # )
2997/// # .build(
2998/// #     hyper_rustls::HttpsConnectorBuilder::new()
2999/// #         .with_native_roots()
3000/// #         .unwrap()
3001/// #         .https_or_http()
3002/// #         .enable_http1()
3003/// #         .build()
3004/// # );
3005/// # let mut hub = Partners::new(client, auth);
3006/// // You can configure optional parameters by calling the respective setters at will, and
3007/// // execute the final call using `doit()`.
3008/// // Values shown here are possibly random and not representative !
3009/// let result = hub.leads().list()
3010///              .request_metadata_user_overrides_user_id("sed")
3011///              .request_metadata_user_overrides_ip_address("ut")
3012///              .request_metadata_traffic_source_traffic_sub_id("gubergren")
3013///              .request_metadata_traffic_source_traffic_source_id("rebum.")
3014///              .request_metadata_partners_session_id("est")
3015///              .request_metadata_locale("ipsum")
3016///              .add_request_metadata_experiment_ids("ipsum")
3017///              .page_token("est")
3018///              .page_size(-62)
3019///              .order_by("ea")
3020///              .doit().await;
3021/// # }
3022/// ```
3023pub struct LeadListCall<'a, C>
3024where
3025    C: 'a,
3026{
3027    hub: &'a Partners<C>,
3028    _request_metadata_user_overrides_user_id: Option<String>,
3029    _request_metadata_user_overrides_ip_address: Option<String>,
3030    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
3031    _request_metadata_traffic_source_traffic_source_id: Option<String>,
3032    _request_metadata_partners_session_id: Option<String>,
3033    _request_metadata_locale: Option<String>,
3034    _request_metadata_experiment_ids: Vec<String>,
3035    _page_token: Option<String>,
3036    _page_size: Option<i32>,
3037    _order_by: Option<String>,
3038    _delegate: Option<&'a mut dyn common::Delegate>,
3039    _additional_params: HashMap<String, String>,
3040}
3041
3042impl<'a, C> common::CallBuilder for LeadListCall<'a, C> {}
3043
3044impl<'a, C> LeadListCall<'a, C>
3045where
3046    C: common::Connector,
3047{
3048    /// Perform the operation you have build so far.
3049    pub async fn doit(mut self) -> common::Result<(common::Response, ListLeadsResponse)> {
3050        use std::borrow::Cow;
3051        use std::io::{Read, Seek};
3052
3053        use common::{url::Params, ToParts};
3054        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3055
3056        let mut dd = common::DefaultDelegate;
3057        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3058        dlg.begin(common::MethodInfo {
3059            id: "partners.leads.list",
3060            http_method: hyper::Method::GET,
3061        });
3062
3063        for &field in [
3064            "alt",
3065            "requestMetadata.userOverrides.userId",
3066            "requestMetadata.userOverrides.ipAddress",
3067            "requestMetadata.trafficSource.trafficSubId",
3068            "requestMetadata.trafficSource.trafficSourceId",
3069            "requestMetadata.partnersSessionId",
3070            "requestMetadata.locale",
3071            "requestMetadata.experimentIds",
3072            "pageToken",
3073            "pageSize",
3074            "orderBy",
3075        ]
3076        .iter()
3077        {
3078            if self._additional_params.contains_key(field) {
3079                dlg.finished(false);
3080                return Err(common::Error::FieldClash(field));
3081            }
3082        }
3083
3084        let mut params = Params::with_capacity(12 + self._additional_params.len());
3085        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
3086            params.push("requestMetadata.userOverrides.userId", value);
3087        }
3088        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
3089            params.push("requestMetadata.userOverrides.ipAddress", value);
3090        }
3091        if let Some(value) = self
3092            ._request_metadata_traffic_source_traffic_sub_id
3093            .as_ref()
3094        {
3095            params.push("requestMetadata.trafficSource.trafficSubId", value);
3096        }
3097        if let Some(value) = self
3098            ._request_metadata_traffic_source_traffic_source_id
3099            .as_ref()
3100        {
3101            params.push("requestMetadata.trafficSource.trafficSourceId", value);
3102        }
3103        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
3104            params.push("requestMetadata.partnersSessionId", value);
3105        }
3106        if let Some(value) = self._request_metadata_locale.as_ref() {
3107            params.push("requestMetadata.locale", value);
3108        }
3109        if !self._request_metadata_experiment_ids.is_empty() {
3110            for f in self._request_metadata_experiment_ids.iter() {
3111                params.push("requestMetadata.experimentIds", f);
3112            }
3113        }
3114        if let Some(value) = self._page_token.as_ref() {
3115            params.push("pageToken", value);
3116        }
3117        if let Some(value) = self._page_size.as_ref() {
3118            params.push("pageSize", value.to_string());
3119        }
3120        if let Some(value) = self._order_by.as_ref() {
3121            params.push("orderBy", value);
3122        }
3123
3124        params.extend(self._additional_params.iter());
3125
3126        params.push("alt", "json");
3127        let mut url = self.hub._base_url.clone() + "v2/leads";
3128
3129        match dlg.api_key() {
3130            Some(value) => params.push("key", value),
3131            None => {
3132                dlg.finished(false);
3133                return Err(common::Error::MissingAPIKey);
3134            }
3135        }
3136
3137        let url = params.parse_with_url(&url);
3138
3139        loop {
3140            let mut req_result = {
3141                let client = &self.hub.client;
3142                dlg.pre_request();
3143                let mut req_builder = hyper::Request::builder()
3144                    .method(hyper::Method::GET)
3145                    .uri(url.as_str())
3146                    .header(USER_AGENT, self.hub._user_agent.clone());
3147
3148                let request = req_builder
3149                    .header(CONTENT_LENGTH, 0_u64)
3150                    .body(common::to_body::<String>(None));
3151
3152                client.request(request.unwrap()).await
3153            };
3154
3155            match req_result {
3156                Err(err) => {
3157                    if let common::Retry::After(d) = dlg.http_error(&err) {
3158                        sleep(d).await;
3159                        continue;
3160                    }
3161                    dlg.finished(false);
3162                    return Err(common::Error::HttpError(err));
3163                }
3164                Ok(res) => {
3165                    let (mut parts, body) = res.into_parts();
3166                    let mut body = common::Body::new(body);
3167                    if !parts.status.is_success() {
3168                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3169                        let error = serde_json::from_str(&common::to_string(&bytes));
3170                        let response = common::to_response(parts, bytes.into());
3171
3172                        if let common::Retry::After(d) =
3173                            dlg.http_failure(&response, error.as_ref().ok())
3174                        {
3175                            sleep(d).await;
3176                            continue;
3177                        }
3178
3179                        dlg.finished(false);
3180
3181                        return Err(match error {
3182                            Ok(value) => common::Error::BadRequest(value),
3183                            _ => common::Error::Failure(response),
3184                        });
3185                    }
3186                    let response = {
3187                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3188                        let encoded = common::to_string(&bytes);
3189                        match serde_json::from_str(&encoded) {
3190                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3191                            Err(error) => {
3192                                dlg.response_json_decode_error(&encoded, &error);
3193                                return Err(common::Error::JsonDecodeError(
3194                                    encoded.to_string(),
3195                                    error,
3196                                ));
3197                            }
3198                        }
3199                    };
3200
3201                    dlg.finished(true);
3202                    return Ok(response);
3203                }
3204            }
3205        }
3206    }
3207
3208    /// Logged-in user ID to impersonate instead of the user's ID.
3209    ///
3210    /// Sets the *request metadata.user overrides.user id* query property to the given value.
3211    pub fn request_metadata_user_overrides_user_id(
3212        mut self,
3213        new_value: &str,
3214    ) -> LeadListCall<'a, C> {
3215        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
3216        self
3217    }
3218    /// IP address to use instead of the user's geo-located IP address.
3219    ///
3220    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
3221    pub fn request_metadata_user_overrides_ip_address(
3222        mut self,
3223        new_value: &str,
3224    ) -> LeadListCall<'a, C> {
3225        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
3226        self
3227    }
3228    /// Second level identifier to indicate where the traffic comes from.
3229    /// An identifier has multiple letters created by a team which redirected the
3230    /// traffic to us.
3231    ///
3232    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
3233    pub fn request_metadata_traffic_source_traffic_sub_id(
3234        mut self,
3235        new_value: &str,
3236    ) -> LeadListCall<'a, C> {
3237        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
3238        self
3239    }
3240    /// Identifier to indicate where the traffic comes from.
3241    /// An identifier has multiple letters created by a team which redirected the
3242    /// traffic to us.
3243    ///
3244    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
3245    pub fn request_metadata_traffic_source_traffic_source_id(
3246        mut self,
3247        new_value: &str,
3248    ) -> LeadListCall<'a, C> {
3249        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
3250        self
3251    }
3252    /// Google Partners session ID.
3253    ///
3254    /// Sets the *request metadata.partners session id* query property to the given value.
3255    pub fn request_metadata_partners_session_id(mut self, new_value: &str) -> LeadListCall<'a, C> {
3256        self._request_metadata_partners_session_id = Some(new_value.to_string());
3257        self
3258    }
3259    /// Locale to use for the current request.
3260    ///
3261    /// Sets the *request metadata.locale* query property to the given value.
3262    pub fn request_metadata_locale(mut self, new_value: &str) -> LeadListCall<'a, C> {
3263        self._request_metadata_locale = Some(new_value.to_string());
3264        self
3265    }
3266    /// Experiment IDs the current request belongs to.
3267    ///
3268    /// Append the given value to the *request metadata.experiment ids* query property.
3269    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
3270    pub fn add_request_metadata_experiment_ids(mut self, new_value: &str) -> LeadListCall<'a, C> {
3271        self._request_metadata_experiment_ids
3272            .push(new_value.to_string());
3273        self
3274    }
3275    /// A token identifying a page of results that the server returns.
3276    /// Typically, this is the value of `ListLeadsResponse.next_page_token`
3277    /// returned from the previous call to
3278    /// ListLeads.
3279    ///
3280    /// Sets the *page token* query property to the given value.
3281    pub fn page_token(mut self, new_value: &str) -> LeadListCall<'a, C> {
3282        self._page_token = Some(new_value.to_string());
3283        self
3284    }
3285    /// Requested page size. Server may return fewer leads than requested.
3286    /// If unspecified, server picks an appropriate default.
3287    ///
3288    /// Sets the *page size* query property to the given value.
3289    pub fn page_size(mut self, new_value: i32) -> LeadListCall<'a, C> {
3290        self._page_size = Some(new_value);
3291        self
3292    }
3293    /// How to order Leads. Currently, only `create_time`
3294    /// and `create_time desc` are supported
3295    ///
3296    /// Sets the *order by* query property to the given value.
3297    pub fn order_by(mut self, new_value: &str) -> LeadListCall<'a, C> {
3298        self._order_by = Some(new_value.to_string());
3299        self
3300    }
3301    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3302    /// while executing the actual API request.
3303    ///
3304    /// ````text
3305    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3306    /// ````
3307    ///
3308    /// Sets the *delegate* property to the given value.
3309    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> LeadListCall<'a, C> {
3310        self._delegate = Some(new_value);
3311        self
3312    }
3313
3314    /// Set any additional parameter of the query string used in the request.
3315    /// It should be used to set parameters which are not yet available through their own
3316    /// setters.
3317    ///
3318    /// Please note that this method must not be used to set any of the known parameters
3319    /// which have their own setter method. If done anyway, the request will fail.
3320    ///
3321    /// # Additional Parameters
3322    ///
3323    /// * *alt* (query-string) - Data format for response.
3324    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3325    /// * *access_token* (query-string) - OAuth access token.
3326    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3327    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3328    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3329    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3330    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3331    /// * *$.xgafv* (query-string) - V1 error format.
3332    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3333    /// * *callback* (query-string) - JSONP
3334    pub fn param<T>(mut self, name: T, value: T) -> LeadListCall<'a, C>
3335    where
3336        T: AsRef<str>,
3337    {
3338        self._additional_params
3339            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3340        self
3341    }
3342}
3343
3344/// Lists the Historical Offers for the current user (or user's entire company)
3345///
3346/// A builder for the *history.list* method supported by a *offer* resource.
3347/// It is not used directly, but through a [`OfferMethods`] instance.
3348///
3349/// # Example
3350///
3351/// Instantiate a resource method builder
3352///
3353/// ```test_harness,no_run
3354/// # extern crate hyper;
3355/// # extern crate hyper_rustls;
3356/// # extern crate google_partners2 as partners2;
3357/// # async fn dox() {
3358/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3359///
3360/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3361/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3362/// #     secret,
3363/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3364/// # ).build().await.unwrap();
3365///
3366/// # let client = hyper_util::client::legacy::Client::builder(
3367/// #     hyper_util::rt::TokioExecutor::new()
3368/// # )
3369/// # .build(
3370/// #     hyper_rustls::HttpsConnectorBuilder::new()
3371/// #         .with_native_roots()
3372/// #         .unwrap()
3373/// #         .https_or_http()
3374/// #         .enable_http1()
3375/// #         .build()
3376/// # );
3377/// # let mut hub = Partners::new(client, auth);
3378/// // You can configure optional parameters by calling the respective setters at will, and
3379/// // execute the final call using `doit()`.
3380/// // Values shown here are possibly random and not representative !
3381/// let result = hub.offers().history_list()
3382///              .request_metadata_user_overrides_user_id("dolor")
3383///              .request_metadata_user_overrides_ip_address("Lorem")
3384///              .request_metadata_traffic_source_traffic_sub_id("eos")
3385///              .request_metadata_traffic_source_traffic_source_id("labore")
3386///              .request_metadata_partners_session_id("sed")
3387///              .request_metadata_locale("duo")
3388///              .add_request_metadata_experiment_ids("sed")
3389///              .page_token("no")
3390///              .page_size(-15)
3391///              .order_by("kasd")
3392///              .entire_company(true)
3393///              .doit().await;
3394/// # }
3395/// ```
3396pub struct OfferHistoryListCall<'a, C>
3397where
3398    C: 'a,
3399{
3400    hub: &'a Partners<C>,
3401    _request_metadata_user_overrides_user_id: Option<String>,
3402    _request_metadata_user_overrides_ip_address: Option<String>,
3403    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
3404    _request_metadata_traffic_source_traffic_source_id: Option<String>,
3405    _request_metadata_partners_session_id: Option<String>,
3406    _request_metadata_locale: Option<String>,
3407    _request_metadata_experiment_ids: Vec<String>,
3408    _page_token: Option<String>,
3409    _page_size: Option<i32>,
3410    _order_by: Option<String>,
3411    _entire_company: Option<bool>,
3412    _delegate: Option<&'a mut dyn common::Delegate>,
3413    _additional_params: HashMap<String, String>,
3414}
3415
3416impl<'a, C> common::CallBuilder for OfferHistoryListCall<'a, C> {}
3417
3418impl<'a, C> OfferHistoryListCall<'a, C>
3419where
3420    C: common::Connector,
3421{
3422    /// Perform the operation you have build so far.
3423    pub async fn doit(mut self) -> common::Result<(common::Response, ListOffersHistoryResponse)> {
3424        use std::borrow::Cow;
3425        use std::io::{Read, Seek};
3426
3427        use common::{url::Params, ToParts};
3428        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3429
3430        let mut dd = common::DefaultDelegate;
3431        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3432        dlg.begin(common::MethodInfo {
3433            id: "partners.offers.history.list",
3434            http_method: hyper::Method::GET,
3435        });
3436
3437        for &field in [
3438            "alt",
3439            "requestMetadata.userOverrides.userId",
3440            "requestMetadata.userOverrides.ipAddress",
3441            "requestMetadata.trafficSource.trafficSubId",
3442            "requestMetadata.trafficSource.trafficSourceId",
3443            "requestMetadata.partnersSessionId",
3444            "requestMetadata.locale",
3445            "requestMetadata.experimentIds",
3446            "pageToken",
3447            "pageSize",
3448            "orderBy",
3449            "entireCompany",
3450        ]
3451        .iter()
3452        {
3453            if self._additional_params.contains_key(field) {
3454                dlg.finished(false);
3455                return Err(common::Error::FieldClash(field));
3456            }
3457        }
3458
3459        let mut params = Params::with_capacity(13 + self._additional_params.len());
3460        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
3461            params.push("requestMetadata.userOverrides.userId", value);
3462        }
3463        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
3464            params.push("requestMetadata.userOverrides.ipAddress", value);
3465        }
3466        if let Some(value) = self
3467            ._request_metadata_traffic_source_traffic_sub_id
3468            .as_ref()
3469        {
3470            params.push("requestMetadata.trafficSource.trafficSubId", value);
3471        }
3472        if let Some(value) = self
3473            ._request_metadata_traffic_source_traffic_source_id
3474            .as_ref()
3475        {
3476            params.push("requestMetadata.trafficSource.trafficSourceId", value);
3477        }
3478        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
3479            params.push("requestMetadata.partnersSessionId", value);
3480        }
3481        if let Some(value) = self._request_metadata_locale.as_ref() {
3482            params.push("requestMetadata.locale", value);
3483        }
3484        if !self._request_metadata_experiment_ids.is_empty() {
3485            for f in self._request_metadata_experiment_ids.iter() {
3486                params.push("requestMetadata.experimentIds", f);
3487            }
3488        }
3489        if let Some(value) = self._page_token.as_ref() {
3490            params.push("pageToken", value);
3491        }
3492        if let Some(value) = self._page_size.as_ref() {
3493            params.push("pageSize", value.to_string());
3494        }
3495        if let Some(value) = self._order_by.as_ref() {
3496            params.push("orderBy", value);
3497        }
3498        if let Some(value) = self._entire_company.as_ref() {
3499            params.push("entireCompany", value.to_string());
3500        }
3501
3502        params.extend(self._additional_params.iter());
3503
3504        params.push("alt", "json");
3505        let mut url = self.hub._base_url.clone() + "v2/offers/history";
3506
3507        match dlg.api_key() {
3508            Some(value) => params.push("key", value),
3509            None => {
3510                dlg.finished(false);
3511                return Err(common::Error::MissingAPIKey);
3512            }
3513        }
3514
3515        let url = params.parse_with_url(&url);
3516
3517        loop {
3518            let mut req_result = {
3519                let client = &self.hub.client;
3520                dlg.pre_request();
3521                let mut req_builder = hyper::Request::builder()
3522                    .method(hyper::Method::GET)
3523                    .uri(url.as_str())
3524                    .header(USER_AGENT, self.hub._user_agent.clone());
3525
3526                let request = req_builder
3527                    .header(CONTENT_LENGTH, 0_u64)
3528                    .body(common::to_body::<String>(None));
3529
3530                client.request(request.unwrap()).await
3531            };
3532
3533            match req_result {
3534                Err(err) => {
3535                    if let common::Retry::After(d) = dlg.http_error(&err) {
3536                        sleep(d).await;
3537                        continue;
3538                    }
3539                    dlg.finished(false);
3540                    return Err(common::Error::HttpError(err));
3541                }
3542                Ok(res) => {
3543                    let (mut parts, body) = res.into_parts();
3544                    let mut body = common::Body::new(body);
3545                    if !parts.status.is_success() {
3546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3547                        let error = serde_json::from_str(&common::to_string(&bytes));
3548                        let response = common::to_response(parts, bytes.into());
3549
3550                        if let common::Retry::After(d) =
3551                            dlg.http_failure(&response, error.as_ref().ok())
3552                        {
3553                            sleep(d).await;
3554                            continue;
3555                        }
3556
3557                        dlg.finished(false);
3558
3559                        return Err(match error {
3560                            Ok(value) => common::Error::BadRequest(value),
3561                            _ => common::Error::Failure(response),
3562                        });
3563                    }
3564                    let response = {
3565                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3566                        let encoded = common::to_string(&bytes);
3567                        match serde_json::from_str(&encoded) {
3568                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3569                            Err(error) => {
3570                                dlg.response_json_decode_error(&encoded, &error);
3571                                return Err(common::Error::JsonDecodeError(
3572                                    encoded.to_string(),
3573                                    error,
3574                                ));
3575                            }
3576                        }
3577                    };
3578
3579                    dlg.finished(true);
3580                    return Ok(response);
3581                }
3582            }
3583        }
3584    }
3585
3586    /// Logged-in user ID to impersonate instead of the user's ID.
3587    ///
3588    /// Sets the *request metadata.user overrides.user id* query property to the given value.
3589    pub fn request_metadata_user_overrides_user_id(
3590        mut self,
3591        new_value: &str,
3592    ) -> OfferHistoryListCall<'a, C> {
3593        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
3594        self
3595    }
3596    /// IP address to use instead of the user's geo-located IP address.
3597    ///
3598    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
3599    pub fn request_metadata_user_overrides_ip_address(
3600        mut self,
3601        new_value: &str,
3602    ) -> OfferHistoryListCall<'a, C> {
3603        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
3604        self
3605    }
3606    /// Second level identifier to indicate where the traffic comes from.
3607    /// An identifier has multiple letters created by a team which redirected the
3608    /// traffic to us.
3609    ///
3610    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
3611    pub fn request_metadata_traffic_source_traffic_sub_id(
3612        mut self,
3613        new_value: &str,
3614    ) -> OfferHistoryListCall<'a, C> {
3615        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
3616        self
3617    }
3618    /// Identifier to indicate where the traffic comes from.
3619    /// An identifier has multiple letters created by a team which redirected the
3620    /// traffic to us.
3621    ///
3622    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
3623    pub fn request_metadata_traffic_source_traffic_source_id(
3624        mut self,
3625        new_value: &str,
3626    ) -> OfferHistoryListCall<'a, C> {
3627        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
3628        self
3629    }
3630    /// Google Partners session ID.
3631    ///
3632    /// Sets the *request metadata.partners session id* query property to the given value.
3633    pub fn request_metadata_partners_session_id(
3634        mut self,
3635        new_value: &str,
3636    ) -> OfferHistoryListCall<'a, C> {
3637        self._request_metadata_partners_session_id = Some(new_value.to_string());
3638        self
3639    }
3640    /// Locale to use for the current request.
3641    ///
3642    /// Sets the *request metadata.locale* query property to the given value.
3643    pub fn request_metadata_locale(mut self, new_value: &str) -> OfferHistoryListCall<'a, C> {
3644        self._request_metadata_locale = Some(new_value.to_string());
3645        self
3646    }
3647    /// Experiment IDs the current request belongs to.
3648    ///
3649    /// Append the given value to the *request metadata.experiment ids* query property.
3650    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
3651    pub fn add_request_metadata_experiment_ids(
3652        mut self,
3653        new_value: &str,
3654    ) -> OfferHistoryListCall<'a, C> {
3655        self._request_metadata_experiment_ids
3656            .push(new_value.to_string());
3657        self
3658    }
3659    /// Token to retrieve a specific page.
3660    ///
3661    /// Sets the *page token* query property to the given value.
3662    pub fn page_token(mut self, new_value: &str) -> OfferHistoryListCall<'a, C> {
3663        self._page_token = Some(new_value.to_string());
3664        self
3665    }
3666    /// Maximum number of rows to return per page.
3667    ///
3668    /// Sets the *page size* query property to the given value.
3669    pub fn page_size(mut self, new_value: i32) -> OfferHistoryListCall<'a, C> {
3670        self._page_size = Some(new_value);
3671        self
3672    }
3673    /// Comma-separated list of fields to order by, e.g.: “foo,bar,baz”.
3674    /// Use “foo desc” to sort descending.
3675    /// List of valid field names is: name, offer_code, expiration_time, status,
3676    /// last_modified_time, sender_name, creation_time, country_code,
3677    /// offer_type.
3678    ///
3679    /// Sets the *order by* query property to the given value.
3680    pub fn order_by(mut self, new_value: &str) -> OfferHistoryListCall<'a, C> {
3681        self._order_by = Some(new_value.to_string());
3682        self
3683    }
3684    /// if true, show history for the entire company.  Requires user to be admin.
3685    ///
3686    /// Sets the *entire company* query property to the given value.
3687    pub fn entire_company(mut self, new_value: bool) -> OfferHistoryListCall<'a, C> {
3688        self._entire_company = Some(new_value);
3689        self
3690    }
3691    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3692    /// while executing the actual API request.
3693    ///
3694    /// ````text
3695    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3696    /// ````
3697    ///
3698    /// Sets the *delegate* property to the given value.
3699    pub fn delegate(
3700        mut self,
3701        new_value: &'a mut dyn common::Delegate,
3702    ) -> OfferHistoryListCall<'a, C> {
3703        self._delegate = Some(new_value);
3704        self
3705    }
3706
3707    /// Set any additional parameter of the query string used in the request.
3708    /// It should be used to set parameters which are not yet available through their own
3709    /// setters.
3710    ///
3711    /// Please note that this method must not be used to set any of the known parameters
3712    /// which have their own setter method. If done anyway, the request will fail.
3713    ///
3714    /// # Additional Parameters
3715    ///
3716    /// * *alt* (query-string) - Data format for response.
3717    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3718    /// * *access_token* (query-string) - OAuth access token.
3719    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3720    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3721    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3722    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3723    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3724    /// * *$.xgafv* (query-string) - V1 error format.
3725    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3726    /// * *callback* (query-string) - JSONP
3727    pub fn param<T>(mut self, name: T, value: T) -> OfferHistoryListCall<'a, C>
3728    where
3729        T: AsRef<str>,
3730    {
3731        self._additional_params
3732            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3733        self
3734    }
3735}
3736
3737/// Lists the Offers available for the current user
3738///
3739/// A builder for the *list* method supported by a *offer* resource.
3740/// It is not used directly, but through a [`OfferMethods`] instance.
3741///
3742/// # Example
3743///
3744/// Instantiate a resource method builder
3745///
3746/// ```test_harness,no_run
3747/// # extern crate hyper;
3748/// # extern crate hyper_rustls;
3749/// # extern crate google_partners2 as partners2;
3750/// # async fn dox() {
3751/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3752///
3753/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3754/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3755/// #     secret,
3756/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3757/// # ).build().await.unwrap();
3758///
3759/// # let client = hyper_util::client::legacy::Client::builder(
3760/// #     hyper_util::rt::TokioExecutor::new()
3761/// # )
3762/// # .build(
3763/// #     hyper_rustls::HttpsConnectorBuilder::new()
3764/// #         .with_native_roots()
3765/// #         .unwrap()
3766/// #         .https_or_http()
3767/// #         .enable_http1()
3768/// #         .build()
3769/// # );
3770/// # let mut hub = Partners::new(client, auth);
3771/// // You can configure optional parameters by calling the respective setters at will, and
3772/// // execute the final call using `doit()`.
3773/// // Values shown here are possibly random and not representative !
3774/// let result = hub.offers().list()
3775///              .request_metadata_user_overrides_user_id("et")
3776///              .request_metadata_user_overrides_ip_address("et")
3777///              .request_metadata_traffic_source_traffic_sub_id("vero")
3778///              .request_metadata_traffic_source_traffic_source_id("erat")
3779///              .request_metadata_partners_session_id("sed")
3780///              .request_metadata_locale("duo")
3781///              .add_request_metadata_experiment_ids("dolore")
3782///              .doit().await;
3783/// # }
3784/// ```
3785pub struct OfferListCall<'a, C>
3786where
3787    C: 'a,
3788{
3789    hub: &'a Partners<C>,
3790    _request_metadata_user_overrides_user_id: Option<String>,
3791    _request_metadata_user_overrides_ip_address: Option<String>,
3792    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
3793    _request_metadata_traffic_source_traffic_source_id: Option<String>,
3794    _request_metadata_partners_session_id: Option<String>,
3795    _request_metadata_locale: Option<String>,
3796    _request_metadata_experiment_ids: Vec<String>,
3797    _delegate: Option<&'a mut dyn common::Delegate>,
3798    _additional_params: HashMap<String, String>,
3799}
3800
3801impl<'a, C> common::CallBuilder for OfferListCall<'a, C> {}
3802
3803impl<'a, C> OfferListCall<'a, C>
3804where
3805    C: common::Connector,
3806{
3807    /// Perform the operation you have build so far.
3808    pub async fn doit(mut self) -> common::Result<(common::Response, ListOffersResponse)> {
3809        use std::borrow::Cow;
3810        use std::io::{Read, Seek};
3811
3812        use common::{url::Params, ToParts};
3813        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3814
3815        let mut dd = common::DefaultDelegate;
3816        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3817        dlg.begin(common::MethodInfo {
3818            id: "partners.offers.list",
3819            http_method: hyper::Method::GET,
3820        });
3821
3822        for &field in [
3823            "alt",
3824            "requestMetadata.userOverrides.userId",
3825            "requestMetadata.userOverrides.ipAddress",
3826            "requestMetadata.trafficSource.trafficSubId",
3827            "requestMetadata.trafficSource.trafficSourceId",
3828            "requestMetadata.partnersSessionId",
3829            "requestMetadata.locale",
3830            "requestMetadata.experimentIds",
3831        ]
3832        .iter()
3833        {
3834            if self._additional_params.contains_key(field) {
3835                dlg.finished(false);
3836                return Err(common::Error::FieldClash(field));
3837            }
3838        }
3839
3840        let mut params = Params::with_capacity(9 + self._additional_params.len());
3841        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
3842            params.push("requestMetadata.userOverrides.userId", value);
3843        }
3844        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
3845            params.push("requestMetadata.userOverrides.ipAddress", value);
3846        }
3847        if let Some(value) = self
3848            ._request_metadata_traffic_source_traffic_sub_id
3849            .as_ref()
3850        {
3851            params.push("requestMetadata.trafficSource.trafficSubId", value);
3852        }
3853        if let Some(value) = self
3854            ._request_metadata_traffic_source_traffic_source_id
3855            .as_ref()
3856        {
3857            params.push("requestMetadata.trafficSource.trafficSourceId", value);
3858        }
3859        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
3860            params.push("requestMetadata.partnersSessionId", value);
3861        }
3862        if let Some(value) = self._request_metadata_locale.as_ref() {
3863            params.push("requestMetadata.locale", value);
3864        }
3865        if !self._request_metadata_experiment_ids.is_empty() {
3866            for f in self._request_metadata_experiment_ids.iter() {
3867                params.push("requestMetadata.experimentIds", f);
3868            }
3869        }
3870
3871        params.extend(self._additional_params.iter());
3872
3873        params.push("alt", "json");
3874        let mut url = self.hub._base_url.clone() + "v2/offers";
3875
3876        match dlg.api_key() {
3877            Some(value) => params.push("key", value),
3878            None => {
3879                dlg.finished(false);
3880                return Err(common::Error::MissingAPIKey);
3881            }
3882        }
3883
3884        let url = params.parse_with_url(&url);
3885
3886        loop {
3887            let mut req_result = {
3888                let client = &self.hub.client;
3889                dlg.pre_request();
3890                let mut req_builder = hyper::Request::builder()
3891                    .method(hyper::Method::GET)
3892                    .uri(url.as_str())
3893                    .header(USER_AGENT, self.hub._user_agent.clone());
3894
3895                let request = req_builder
3896                    .header(CONTENT_LENGTH, 0_u64)
3897                    .body(common::to_body::<String>(None));
3898
3899                client.request(request.unwrap()).await
3900            };
3901
3902            match req_result {
3903                Err(err) => {
3904                    if let common::Retry::After(d) = dlg.http_error(&err) {
3905                        sleep(d).await;
3906                        continue;
3907                    }
3908                    dlg.finished(false);
3909                    return Err(common::Error::HttpError(err));
3910                }
3911                Ok(res) => {
3912                    let (mut parts, body) = res.into_parts();
3913                    let mut body = common::Body::new(body);
3914                    if !parts.status.is_success() {
3915                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3916                        let error = serde_json::from_str(&common::to_string(&bytes));
3917                        let response = common::to_response(parts, bytes.into());
3918
3919                        if let common::Retry::After(d) =
3920                            dlg.http_failure(&response, error.as_ref().ok())
3921                        {
3922                            sleep(d).await;
3923                            continue;
3924                        }
3925
3926                        dlg.finished(false);
3927
3928                        return Err(match error {
3929                            Ok(value) => common::Error::BadRequest(value),
3930                            _ => common::Error::Failure(response),
3931                        });
3932                    }
3933                    let response = {
3934                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3935                        let encoded = common::to_string(&bytes);
3936                        match serde_json::from_str(&encoded) {
3937                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3938                            Err(error) => {
3939                                dlg.response_json_decode_error(&encoded, &error);
3940                                return Err(common::Error::JsonDecodeError(
3941                                    encoded.to_string(),
3942                                    error,
3943                                ));
3944                            }
3945                        }
3946                    };
3947
3948                    dlg.finished(true);
3949                    return Ok(response);
3950                }
3951            }
3952        }
3953    }
3954
3955    /// Logged-in user ID to impersonate instead of the user's ID.
3956    ///
3957    /// Sets the *request metadata.user overrides.user id* query property to the given value.
3958    pub fn request_metadata_user_overrides_user_id(
3959        mut self,
3960        new_value: &str,
3961    ) -> OfferListCall<'a, C> {
3962        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
3963        self
3964    }
3965    /// IP address to use instead of the user's geo-located IP address.
3966    ///
3967    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
3968    pub fn request_metadata_user_overrides_ip_address(
3969        mut self,
3970        new_value: &str,
3971    ) -> OfferListCall<'a, C> {
3972        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
3973        self
3974    }
3975    /// Second level identifier to indicate where the traffic comes from.
3976    /// An identifier has multiple letters created by a team which redirected the
3977    /// traffic to us.
3978    ///
3979    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
3980    pub fn request_metadata_traffic_source_traffic_sub_id(
3981        mut self,
3982        new_value: &str,
3983    ) -> OfferListCall<'a, C> {
3984        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
3985        self
3986    }
3987    /// Identifier to indicate where the traffic comes from.
3988    /// An identifier has multiple letters created by a team which redirected the
3989    /// traffic to us.
3990    ///
3991    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
3992    pub fn request_metadata_traffic_source_traffic_source_id(
3993        mut self,
3994        new_value: &str,
3995    ) -> OfferListCall<'a, C> {
3996        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
3997        self
3998    }
3999    /// Google Partners session ID.
4000    ///
4001    /// Sets the *request metadata.partners session id* query property to the given value.
4002    pub fn request_metadata_partners_session_id(mut self, new_value: &str) -> OfferListCall<'a, C> {
4003        self._request_metadata_partners_session_id = Some(new_value.to_string());
4004        self
4005    }
4006    /// Locale to use for the current request.
4007    ///
4008    /// Sets the *request metadata.locale* query property to the given value.
4009    pub fn request_metadata_locale(mut self, new_value: &str) -> OfferListCall<'a, C> {
4010        self._request_metadata_locale = Some(new_value.to_string());
4011        self
4012    }
4013    /// Experiment IDs the current request belongs to.
4014    ///
4015    /// Append the given value to the *request metadata.experiment ids* query property.
4016    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4017    pub fn add_request_metadata_experiment_ids(mut self, new_value: &str) -> OfferListCall<'a, C> {
4018        self._request_metadata_experiment_ids
4019            .push(new_value.to_string());
4020        self
4021    }
4022    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4023    /// while executing the actual API request.
4024    ///
4025    /// ````text
4026    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4027    /// ````
4028    ///
4029    /// Sets the *delegate* property to the given value.
4030    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OfferListCall<'a, C> {
4031        self._delegate = Some(new_value);
4032        self
4033    }
4034
4035    /// Set any additional parameter of the query string used in the request.
4036    /// It should be used to set parameters which are not yet available through their own
4037    /// setters.
4038    ///
4039    /// Please note that this method must not be used to set any of the known parameters
4040    /// which have their own setter method. If done anyway, the request will fail.
4041    ///
4042    /// # Additional Parameters
4043    ///
4044    /// * *alt* (query-string) - Data format for response.
4045    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4046    /// * *access_token* (query-string) - OAuth access token.
4047    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4048    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4049    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4050    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4051    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4052    /// * *$.xgafv* (query-string) - V1 error format.
4053    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4054    /// * *callback* (query-string) - JSONP
4055    pub fn param<T>(mut self, name: T, value: T) -> OfferListCall<'a, C>
4056    where
4057        T: AsRef<str>,
4058    {
4059        self._additional_params
4060            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4061        self
4062    }
4063}
4064
4065/// Lists analytics data for a user's associated company.
4066/// Should only be called within the context of an authorized logged in user.
4067///
4068/// A builder for the *list* method supported by a *analytic* resource.
4069/// It is not used directly, but through a [`AnalyticMethods`] instance.
4070///
4071/// # Example
4072///
4073/// Instantiate a resource method builder
4074///
4075/// ```test_harness,no_run
4076/// # extern crate hyper;
4077/// # extern crate hyper_rustls;
4078/// # extern crate google_partners2 as partners2;
4079/// # async fn dox() {
4080/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4081///
4082/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4083/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4084/// #     secret,
4085/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4086/// # ).build().await.unwrap();
4087///
4088/// # let client = hyper_util::client::legacy::Client::builder(
4089/// #     hyper_util::rt::TokioExecutor::new()
4090/// # )
4091/// # .build(
4092/// #     hyper_rustls::HttpsConnectorBuilder::new()
4093/// #         .with_native_roots()
4094/// #         .unwrap()
4095/// #         .https_or_http()
4096/// #         .enable_http1()
4097/// #         .build()
4098/// # );
4099/// # let mut hub = Partners::new(client, auth);
4100/// // You can configure optional parameters by calling the respective setters at will, and
4101/// // execute the final call using `doit()`.
4102/// // Values shown here are possibly random and not representative !
4103/// let result = hub.analytics().list()
4104///              .request_metadata_user_overrides_user_id("et")
4105///              .request_metadata_user_overrides_ip_address("voluptua.")
4106///              .request_metadata_traffic_source_traffic_sub_id("amet.")
4107///              .request_metadata_traffic_source_traffic_source_id("consetetur")
4108///              .request_metadata_partners_session_id("diam")
4109///              .request_metadata_locale("dolor")
4110///              .add_request_metadata_experiment_ids("et")
4111///              .page_token("et")
4112///              .page_size(-95)
4113///              .doit().await;
4114/// # }
4115/// ```
4116pub struct AnalyticListCall<'a, C>
4117where
4118    C: 'a,
4119{
4120    hub: &'a Partners<C>,
4121    _request_metadata_user_overrides_user_id: Option<String>,
4122    _request_metadata_user_overrides_ip_address: Option<String>,
4123    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
4124    _request_metadata_traffic_source_traffic_source_id: Option<String>,
4125    _request_metadata_partners_session_id: Option<String>,
4126    _request_metadata_locale: Option<String>,
4127    _request_metadata_experiment_ids: Vec<String>,
4128    _page_token: Option<String>,
4129    _page_size: Option<i32>,
4130    _delegate: Option<&'a mut dyn common::Delegate>,
4131    _additional_params: HashMap<String, String>,
4132}
4133
4134impl<'a, C> common::CallBuilder for AnalyticListCall<'a, C> {}
4135
4136impl<'a, C> AnalyticListCall<'a, C>
4137where
4138    C: common::Connector,
4139{
4140    /// Perform the operation you have build so far.
4141    pub async fn doit(mut self) -> common::Result<(common::Response, ListAnalyticsResponse)> {
4142        use std::borrow::Cow;
4143        use std::io::{Read, Seek};
4144
4145        use common::{url::Params, ToParts};
4146        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4147
4148        let mut dd = common::DefaultDelegate;
4149        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4150        dlg.begin(common::MethodInfo {
4151            id: "partners.analytics.list",
4152            http_method: hyper::Method::GET,
4153        });
4154
4155        for &field in [
4156            "alt",
4157            "requestMetadata.userOverrides.userId",
4158            "requestMetadata.userOverrides.ipAddress",
4159            "requestMetadata.trafficSource.trafficSubId",
4160            "requestMetadata.trafficSource.trafficSourceId",
4161            "requestMetadata.partnersSessionId",
4162            "requestMetadata.locale",
4163            "requestMetadata.experimentIds",
4164            "pageToken",
4165            "pageSize",
4166        ]
4167        .iter()
4168        {
4169            if self._additional_params.contains_key(field) {
4170                dlg.finished(false);
4171                return Err(common::Error::FieldClash(field));
4172            }
4173        }
4174
4175        let mut params = Params::with_capacity(11 + self._additional_params.len());
4176        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
4177            params.push("requestMetadata.userOverrides.userId", value);
4178        }
4179        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
4180            params.push("requestMetadata.userOverrides.ipAddress", value);
4181        }
4182        if let Some(value) = self
4183            ._request_metadata_traffic_source_traffic_sub_id
4184            .as_ref()
4185        {
4186            params.push("requestMetadata.trafficSource.trafficSubId", value);
4187        }
4188        if let Some(value) = self
4189            ._request_metadata_traffic_source_traffic_source_id
4190            .as_ref()
4191        {
4192            params.push("requestMetadata.trafficSource.trafficSourceId", value);
4193        }
4194        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
4195            params.push("requestMetadata.partnersSessionId", value);
4196        }
4197        if let Some(value) = self._request_metadata_locale.as_ref() {
4198            params.push("requestMetadata.locale", value);
4199        }
4200        if !self._request_metadata_experiment_ids.is_empty() {
4201            for f in self._request_metadata_experiment_ids.iter() {
4202                params.push("requestMetadata.experimentIds", f);
4203            }
4204        }
4205        if let Some(value) = self._page_token.as_ref() {
4206            params.push("pageToken", value);
4207        }
4208        if let Some(value) = self._page_size.as_ref() {
4209            params.push("pageSize", value.to_string());
4210        }
4211
4212        params.extend(self._additional_params.iter());
4213
4214        params.push("alt", "json");
4215        let mut url = self.hub._base_url.clone() + "v2/analytics";
4216
4217        match dlg.api_key() {
4218            Some(value) => params.push("key", value),
4219            None => {
4220                dlg.finished(false);
4221                return Err(common::Error::MissingAPIKey);
4222            }
4223        }
4224
4225        let url = params.parse_with_url(&url);
4226
4227        loop {
4228            let mut req_result = {
4229                let client = &self.hub.client;
4230                dlg.pre_request();
4231                let mut req_builder = hyper::Request::builder()
4232                    .method(hyper::Method::GET)
4233                    .uri(url.as_str())
4234                    .header(USER_AGENT, self.hub._user_agent.clone());
4235
4236                let request = req_builder
4237                    .header(CONTENT_LENGTH, 0_u64)
4238                    .body(common::to_body::<String>(None));
4239
4240                client.request(request.unwrap()).await
4241            };
4242
4243            match req_result {
4244                Err(err) => {
4245                    if let common::Retry::After(d) = dlg.http_error(&err) {
4246                        sleep(d).await;
4247                        continue;
4248                    }
4249                    dlg.finished(false);
4250                    return Err(common::Error::HttpError(err));
4251                }
4252                Ok(res) => {
4253                    let (mut parts, body) = res.into_parts();
4254                    let mut body = common::Body::new(body);
4255                    if !parts.status.is_success() {
4256                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4257                        let error = serde_json::from_str(&common::to_string(&bytes));
4258                        let response = common::to_response(parts, bytes.into());
4259
4260                        if let common::Retry::After(d) =
4261                            dlg.http_failure(&response, error.as_ref().ok())
4262                        {
4263                            sleep(d).await;
4264                            continue;
4265                        }
4266
4267                        dlg.finished(false);
4268
4269                        return Err(match error {
4270                            Ok(value) => common::Error::BadRequest(value),
4271                            _ => common::Error::Failure(response),
4272                        });
4273                    }
4274                    let response = {
4275                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4276                        let encoded = common::to_string(&bytes);
4277                        match serde_json::from_str(&encoded) {
4278                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4279                            Err(error) => {
4280                                dlg.response_json_decode_error(&encoded, &error);
4281                                return Err(common::Error::JsonDecodeError(
4282                                    encoded.to_string(),
4283                                    error,
4284                                ));
4285                            }
4286                        }
4287                    };
4288
4289                    dlg.finished(true);
4290                    return Ok(response);
4291                }
4292            }
4293        }
4294    }
4295
4296    /// Logged-in user ID to impersonate instead of the user's ID.
4297    ///
4298    /// Sets the *request metadata.user overrides.user id* query property to the given value.
4299    pub fn request_metadata_user_overrides_user_id(
4300        mut self,
4301        new_value: &str,
4302    ) -> AnalyticListCall<'a, C> {
4303        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
4304        self
4305    }
4306    /// IP address to use instead of the user's geo-located IP address.
4307    ///
4308    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
4309    pub fn request_metadata_user_overrides_ip_address(
4310        mut self,
4311        new_value: &str,
4312    ) -> AnalyticListCall<'a, C> {
4313        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
4314        self
4315    }
4316    /// Second level identifier to indicate where the traffic comes from.
4317    /// An identifier has multiple letters created by a team which redirected the
4318    /// traffic to us.
4319    ///
4320    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
4321    pub fn request_metadata_traffic_source_traffic_sub_id(
4322        mut self,
4323        new_value: &str,
4324    ) -> AnalyticListCall<'a, C> {
4325        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
4326        self
4327    }
4328    /// Identifier to indicate where the traffic comes from.
4329    /// An identifier has multiple letters created by a team which redirected the
4330    /// traffic to us.
4331    ///
4332    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
4333    pub fn request_metadata_traffic_source_traffic_source_id(
4334        mut self,
4335        new_value: &str,
4336    ) -> AnalyticListCall<'a, C> {
4337        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
4338        self
4339    }
4340    /// Google Partners session ID.
4341    ///
4342    /// Sets the *request metadata.partners session id* query property to the given value.
4343    pub fn request_metadata_partners_session_id(
4344        mut self,
4345        new_value: &str,
4346    ) -> AnalyticListCall<'a, C> {
4347        self._request_metadata_partners_session_id = Some(new_value.to_string());
4348        self
4349    }
4350    /// Locale to use for the current request.
4351    ///
4352    /// Sets the *request metadata.locale* query property to the given value.
4353    pub fn request_metadata_locale(mut self, new_value: &str) -> AnalyticListCall<'a, C> {
4354        self._request_metadata_locale = Some(new_value.to_string());
4355        self
4356    }
4357    /// Experiment IDs the current request belongs to.
4358    ///
4359    /// Append the given value to the *request metadata.experiment ids* query property.
4360    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4361    pub fn add_request_metadata_experiment_ids(
4362        mut self,
4363        new_value: &str,
4364    ) -> AnalyticListCall<'a, C> {
4365        self._request_metadata_experiment_ids
4366            .push(new_value.to_string());
4367        self
4368    }
4369    /// A token identifying a page of results that the server returns.
4370    /// Typically, this is the value of `ListAnalyticsResponse.next_page_token`
4371    /// returned from the previous call to
4372    /// ListAnalytics.
4373    /// Will be a date string in `YYYY-MM-DD` format representing the end date
4374    /// of the date range of results to return.
4375    /// If unspecified or set to "", default value is the current date.
4376    ///
4377    /// Sets the *page token* query property to the given value.
4378    pub fn page_token(mut self, new_value: &str) -> AnalyticListCall<'a, C> {
4379        self._page_token = Some(new_value.to_string());
4380        self
4381    }
4382    /// Requested page size. Server may return fewer analytics than requested.
4383    /// If unspecified or set to 0, default value is 30.
4384    /// Specifies the number of days in the date range when querying analytics.
4385    /// The `page_token` represents the end date of the date range
4386    /// and the start date is calculated using the `page_size` as the number
4387    /// of days BEFORE the end date.
4388    /// Must be a non-negative integer.
4389    ///
4390    /// Sets the *page size* query property to the given value.
4391    pub fn page_size(mut self, new_value: i32) -> AnalyticListCall<'a, C> {
4392        self._page_size = Some(new_value);
4393        self
4394    }
4395    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4396    /// while executing the actual API request.
4397    ///
4398    /// ````text
4399    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4400    /// ````
4401    ///
4402    /// Sets the *delegate* property to the given value.
4403    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AnalyticListCall<'a, C> {
4404        self._delegate = Some(new_value);
4405        self
4406    }
4407
4408    /// Set any additional parameter of the query string used in the request.
4409    /// It should be used to set parameters which are not yet available through their own
4410    /// setters.
4411    ///
4412    /// Please note that this method must not be used to set any of the known parameters
4413    /// which have their own setter method. If done anyway, the request will fail.
4414    ///
4415    /// # Additional Parameters
4416    ///
4417    /// * *alt* (query-string) - Data format for response.
4418    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4419    /// * *access_token* (query-string) - OAuth access token.
4420    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4421    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4422    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4423    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4424    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4425    /// * *$.xgafv* (query-string) - V1 error format.
4426    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4427    /// * *callback* (query-string) - JSONP
4428    pub fn param<T>(mut self, name: T, value: T) -> AnalyticListCall<'a, C>
4429    where
4430        T: AsRef<str>,
4431    {
4432        self._additional_params
4433            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4434        self
4435    }
4436}
4437
4438/// Lists states for current user.
4439///
4440/// A builder for the *list* method supported by a *userState* resource.
4441/// It is not used directly, but through a [`UserStateMethods`] instance.
4442///
4443/// # Example
4444///
4445/// Instantiate a resource method builder
4446///
4447/// ```test_harness,no_run
4448/// # extern crate hyper;
4449/// # extern crate hyper_rustls;
4450/// # extern crate google_partners2 as partners2;
4451/// # async fn dox() {
4452/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4453///
4454/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4455/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4456/// #     secret,
4457/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4458/// # ).build().await.unwrap();
4459///
4460/// # let client = hyper_util::client::legacy::Client::builder(
4461/// #     hyper_util::rt::TokioExecutor::new()
4462/// # )
4463/// # .build(
4464/// #     hyper_rustls::HttpsConnectorBuilder::new()
4465/// #         .with_native_roots()
4466/// #         .unwrap()
4467/// #         .https_or_http()
4468/// #         .enable_http1()
4469/// #         .build()
4470/// # );
4471/// # let mut hub = Partners::new(client, auth);
4472/// // You can configure optional parameters by calling the respective setters at will, and
4473/// // execute the final call using `doit()`.
4474/// // Values shown here are possibly random and not representative !
4475/// let result = hub.user_states().list()
4476///              .request_metadata_user_overrides_user_id("Stet")
4477///              .request_metadata_user_overrides_ip_address("dolor")
4478///              .request_metadata_traffic_source_traffic_sub_id("duo")
4479///              .request_metadata_traffic_source_traffic_source_id("vero")
4480///              .request_metadata_partners_session_id("vero")
4481///              .request_metadata_locale("invidunt")
4482///              .add_request_metadata_experiment_ids("Stet")
4483///              .doit().await;
4484/// # }
4485/// ```
4486pub struct UserStateListCall<'a, C>
4487where
4488    C: 'a,
4489{
4490    hub: &'a Partners<C>,
4491    _request_metadata_user_overrides_user_id: Option<String>,
4492    _request_metadata_user_overrides_ip_address: Option<String>,
4493    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
4494    _request_metadata_traffic_source_traffic_source_id: Option<String>,
4495    _request_metadata_partners_session_id: Option<String>,
4496    _request_metadata_locale: Option<String>,
4497    _request_metadata_experiment_ids: Vec<String>,
4498    _delegate: Option<&'a mut dyn common::Delegate>,
4499    _additional_params: HashMap<String, String>,
4500}
4501
4502impl<'a, C> common::CallBuilder for UserStateListCall<'a, C> {}
4503
4504impl<'a, C> UserStateListCall<'a, C>
4505where
4506    C: common::Connector,
4507{
4508    /// Perform the operation you have build so far.
4509    pub async fn doit(mut self) -> common::Result<(common::Response, ListUserStatesResponse)> {
4510        use std::borrow::Cow;
4511        use std::io::{Read, Seek};
4512
4513        use common::{url::Params, ToParts};
4514        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4515
4516        let mut dd = common::DefaultDelegate;
4517        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4518        dlg.begin(common::MethodInfo {
4519            id: "partners.userStates.list",
4520            http_method: hyper::Method::GET,
4521        });
4522
4523        for &field in [
4524            "alt",
4525            "requestMetadata.userOverrides.userId",
4526            "requestMetadata.userOverrides.ipAddress",
4527            "requestMetadata.trafficSource.trafficSubId",
4528            "requestMetadata.trafficSource.trafficSourceId",
4529            "requestMetadata.partnersSessionId",
4530            "requestMetadata.locale",
4531            "requestMetadata.experimentIds",
4532        ]
4533        .iter()
4534        {
4535            if self._additional_params.contains_key(field) {
4536                dlg.finished(false);
4537                return Err(common::Error::FieldClash(field));
4538            }
4539        }
4540
4541        let mut params = Params::with_capacity(9 + self._additional_params.len());
4542        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
4543            params.push("requestMetadata.userOverrides.userId", value);
4544        }
4545        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
4546            params.push("requestMetadata.userOverrides.ipAddress", value);
4547        }
4548        if let Some(value) = self
4549            ._request_metadata_traffic_source_traffic_sub_id
4550            .as_ref()
4551        {
4552            params.push("requestMetadata.trafficSource.trafficSubId", value);
4553        }
4554        if let Some(value) = self
4555            ._request_metadata_traffic_source_traffic_source_id
4556            .as_ref()
4557        {
4558            params.push("requestMetadata.trafficSource.trafficSourceId", value);
4559        }
4560        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
4561            params.push("requestMetadata.partnersSessionId", value);
4562        }
4563        if let Some(value) = self._request_metadata_locale.as_ref() {
4564            params.push("requestMetadata.locale", value);
4565        }
4566        if !self._request_metadata_experiment_ids.is_empty() {
4567            for f in self._request_metadata_experiment_ids.iter() {
4568                params.push("requestMetadata.experimentIds", f);
4569            }
4570        }
4571
4572        params.extend(self._additional_params.iter());
4573
4574        params.push("alt", "json");
4575        let mut url = self.hub._base_url.clone() + "v2/userStates";
4576
4577        match dlg.api_key() {
4578            Some(value) => params.push("key", value),
4579            None => {
4580                dlg.finished(false);
4581                return Err(common::Error::MissingAPIKey);
4582            }
4583        }
4584
4585        let url = params.parse_with_url(&url);
4586
4587        loop {
4588            let mut req_result = {
4589                let client = &self.hub.client;
4590                dlg.pre_request();
4591                let mut req_builder = hyper::Request::builder()
4592                    .method(hyper::Method::GET)
4593                    .uri(url.as_str())
4594                    .header(USER_AGENT, self.hub._user_agent.clone());
4595
4596                let request = req_builder
4597                    .header(CONTENT_LENGTH, 0_u64)
4598                    .body(common::to_body::<String>(None));
4599
4600                client.request(request.unwrap()).await
4601            };
4602
4603            match req_result {
4604                Err(err) => {
4605                    if let common::Retry::After(d) = dlg.http_error(&err) {
4606                        sleep(d).await;
4607                        continue;
4608                    }
4609                    dlg.finished(false);
4610                    return Err(common::Error::HttpError(err));
4611                }
4612                Ok(res) => {
4613                    let (mut parts, body) = res.into_parts();
4614                    let mut body = common::Body::new(body);
4615                    if !parts.status.is_success() {
4616                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4617                        let error = serde_json::from_str(&common::to_string(&bytes));
4618                        let response = common::to_response(parts, bytes.into());
4619
4620                        if let common::Retry::After(d) =
4621                            dlg.http_failure(&response, error.as_ref().ok())
4622                        {
4623                            sleep(d).await;
4624                            continue;
4625                        }
4626
4627                        dlg.finished(false);
4628
4629                        return Err(match error {
4630                            Ok(value) => common::Error::BadRequest(value),
4631                            _ => common::Error::Failure(response),
4632                        });
4633                    }
4634                    let response = {
4635                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4636                        let encoded = common::to_string(&bytes);
4637                        match serde_json::from_str(&encoded) {
4638                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4639                            Err(error) => {
4640                                dlg.response_json_decode_error(&encoded, &error);
4641                                return Err(common::Error::JsonDecodeError(
4642                                    encoded.to_string(),
4643                                    error,
4644                                ));
4645                            }
4646                        }
4647                    };
4648
4649                    dlg.finished(true);
4650                    return Ok(response);
4651                }
4652            }
4653        }
4654    }
4655
4656    /// Logged-in user ID to impersonate instead of the user's ID.
4657    ///
4658    /// Sets the *request metadata.user overrides.user id* query property to the given value.
4659    pub fn request_metadata_user_overrides_user_id(
4660        mut self,
4661        new_value: &str,
4662    ) -> UserStateListCall<'a, C> {
4663        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
4664        self
4665    }
4666    /// IP address to use instead of the user's geo-located IP address.
4667    ///
4668    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
4669    pub fn request_metadata_user_overrides_ip_address(
4670        mut self,
4671        new_value: &str,
4672    ) -> UserStateListCall<'a, C> {
4673        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
4674        self
4675    }
4676    /// Second level identifier to indicate where the traffic comes from.
4677    /// An identifier has multiple letters created by a team which redirected the
4678    /// traffic to us.
4679    ///
4680    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
4681    pub fn request_metadata_traffic_source_traffic_sub_id(
4682        mut self,
4683        new_value: &str,
4684    ) -> UserStateListCall<'a, C> {
4685        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
4686        self
4687    }
4688    /// Identifier to indicate where the traffic comes from.
4689    /// An identifier has multiple letters created by a team which redirected the
4690    /// traffic to us.
4691    ///
4692    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
4693    pub fn request_metadata_traffic_source_traffic_source_id(
4694        mut self,
4695        new_value: &str,
4696    ) -> UserStateListCall<'a, C> {
4697        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
4698        self
4699    }
4700    /// Google Partners session ID.
4701    ///
4702    /// Sets the *request metadata.partners session id* query property to the given value.
4703    pub fn request_metadata_partners_session_id(
4704        mut self,
4705        new_value: &str,
4706    ) -> UserStateListCall<'a, C> {
4707        self._request_metadata_partners_session_id = Some(new_value.to_string());
4708        self
4709    }
4710    /// Locale to use for the current request.
4711    ///
4712    /// Sets the *request metadata.locale* query property to the given value.
4713    pub fn request_metadata_locale(mut self, new_value: &str) -> UserStateListCall<'a, C> {
4714        self._request_metadata_locale = Some(new_value.to_string());
4715        self
4716    }
4717    /// Experiment IDs the current request belongs to.
4718    ///
4719    /// Append the given value to the *request metadata.experiment ids* query property.
4720    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4721    pub fn add_request_metadata_experiment_ids(
4722        mut self,
4723        new_value: &str,
4724    ) -> UserStateListCall<'a, C> {
4725        self._request_metadata_experiment_ids
4726            .push(new_value.to_string());
4727        self
4728    }
4729    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4730    /// while executing the actual API request.
4731    ///
4732    /// ````text
4733    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4734    /// ````
4735    ///
4736    /// Sets the *delegate* property to the given value.
4737    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserStateListCall<'a, C> {
4738        self._delegate = Some(new_value);
4739        self
4740    }
4741
4742    /// Set any additional parameter of the query string used in the request.
4743    /// It should be used to set parameters which are not yet available through their own
4744    /// setters.
4745    ///
4746    /// Please note that this method must not be used to set any of the known parameters
4747    /// which have their own setter method. If done anyway, the request will fail.
4748    ///
4749    /// # Additional Parameters
4750    ///
4751    /// * *alt* (query-string) - Data format for response.
4752    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4753    /// * *access_token* (query-string) - OAuth access token.
4754    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4755    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4756    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4757    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4758    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4759    /// * *$.xgafv* (query-string) - V1 error format.
4760    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4761    /// * *callback* (query-string) - JSONP
4762    pub fn param<T>(mut self, name: T, value: T) -> UserStateListCall<'a, C>
4763    where
4764        T: AsRef<str>,
4765    {
4766        self._additional_params
4767            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4768        self
4769    }
4770}
4771
4772/// Updates the specified lead.
4773///
4774/// A builder for the *updateLeads* method.
4775/// It is not used directly, but through a [`MethodMethods`] instance.
4776///
4777/// # Example
4778///
4779/// Instantiate a resource method builder
4780///
4781/// ```test_harness,no_run
4782/// # extern crate hyper;
4783/// # extern crate hyper_rustls;
4784/// # extern crate google_partners2 as partners2;
4785/// use partners2::api::Lead;
4786/// # async fn dox() {
4787/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4788///
4789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4790/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4791/// #     secret,
4792/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4793/// # ).build().await.unwrap();
4794///
4795/// # let client = hyper_util::client::legacy::Client::builder(
4796/// #     hyper_util::rt::TokioExecutor::new()
4797/// # )
4798/// # .build(
4799/// #     hyper_rustls::HttpsConnectorBuilder::new()
4800/// #         .with_native_roots()
4801/// #         .unwrap()
4802/// #         .https_or_http()
4803/// #         .enable_http1()
4804/// #         .build()
4805/// # );
4806/// # let mut hub = Partners::new(client, auth);
4807/// // As the method needs a request, you would usually fill it with the desired information
4808/// // into the respective structure. Some of the parts shown here might not be applicable !
4809/// // Values shown here are possibly random and not representative !
4810/// let mut req = Lead::default();
4811///
4812/// // You can configure optional parameters by calling the respective setters at will, and
4813/// // execute the final call using `doit()`.
4814/// // Values shown here are possibly random and not representative !
4815/// let result = hub.methods().update_leads(req)
4816///              .update_mask(FieldMask::new::<&str>(&[]))
4817///              .request_metadata_user_overrides_user_id("vero")
4818///              .request_metadata_user_overrides_ip_address("elitr")
4819///              .request_metadata_traffic_source_traffic_sub_id("Lorem")
4820///              .request_metadata_traffic_source_traffic_source_id("diam")
4821///              .request_metadata_partners_session_id("no")
4822///              .request_metadata_locale("ipsum")
4823///              .add_request_metadata_experiment_ids("accusam")
4824///              .doit().await;
4825/// # }
4826/// ```
4827pub struct MethodUpdateLeadCall<'a, C>
4828where
4829    C: 'a,
4830{
4831    hub: &'a Partners<C>,
4832    _request: Lead,
4833    _update_mask: Option<common::FieldMask>,
4834    _request_metadata_user_overrides_user_id: Option<String>,
4835    _request_metadata_user_overrides_ip_address: Option<String>,
4836    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
4837    _request_metadata_traffic_source_traffic_source_id: Option<String>,
4838    _request_metadata_partners_session_id: Option<String>,
4839    _request_metadata_locale: Option<String>,
4840    _request_metadata_experiment_ids: Vec<String>,
4841    _delegate: Option<&'a mut dyn common::Delegate>,
4842    _additional_params: HashMap<String, String>,
4843}
4844
4845impl<'a, C> common::CallBuilder for MethodUpdateLeadCall<'a, C> {}
4846
4847impl<'a, C> MethodUpdateLeadCall<'a, C>
4848where
4849    C: common::Connector,
4850{
4851    /// Perform the operation you have build so far.
4852    pub async fn doit(mut self) -> common::Result<(common::Response, Lead)> {
4853        use std::borrow::Cow;
4854        use std::io::{Read, Seek};
4855
4856        use common::{url::Params, ToParts};
4857        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4858
4859        let mut dd = common::DefaultDelegate;
4860        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4861        dlg.begin(common::MethodInfo {
4862            id: "partners.updateLeads",
4863            http_method: hyper::Method::PATCH,
4864        });
4865
4866        for &field in [
4867            "alt",
4868            "updateMask",
4869            "requestMetadata.userOverrides.userId",
4870            "requestMetadata.userOverrides.ipAddress",
4871            "requestMetadata.trafficSource.trafficSubId",
4872            "requestMetadata.trafficSource.trafficSourceId",
4873            "requestMetadata.partnersSessionId",
4874            "requestMetadata.locale",
4875            "requestMetadata.experimentIds",
4876        ]
4877        .iter()
4878        {
4879            if self._additional_params.contains_key(field) {
4880                dlg.finished(false);
4881                return Err(common::Error::FieldClash(field));
4882            }
4883        }
4884
4885        let mut params = Params::with_capacity(11 + self._additional_params.len());
4886        if let Some(value) = self._update_mask.as_ref() {
4887            params.push("updateMask", value.to_string());
4888        }
4889        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
4890            params.push("requestMetadata.userOverrides.userId", value);
4891        }
4892        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
4893            params.push("requestMetadata.userOverrides.ipAddress", value);
4894        }
4895        if let Some(value) = self
4896            ._request_metadata_traffic_source_traffic_sub_id
4897            .as_ref()
4898        {
4899            params.push("requestMetadata.trafficSource.trafficSubId", value);
4900        }
4901        if let Some(value) = self
4902            ._request_metadata_traffic_source_traffic_source_id
4903            .as_ref()
4904        {
4905            params.push("requestMetadata.trafficSource.trafficSourceId", value);
4906        }
4907        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
4908            params.push("requestMetadata.partnersSessionId", value);
4909        }
4910        if let Some(value) = self._request_metadata_locale.as_ref() {
4911            params.push("requestMetadata.locale", value);
4912        }
4913        if !self._request_metadata_experiment_ids.is_empty() {
4914            for f in self._request_metadata_experiment_ids.iter() {
4915                params.push("requestMetadata.experimentIds", f);
4916            }
4917        }
4918
4919        params.extend(self._additional_params.iter());
4920
4921        params.push("alt", "json");
4922        let mut url = self.hub._base_url.clone() + "v2/leads";
4923
4924        match dlg.api_key() {
4925            Some(value) => params.push("key", value),
4926            None => {
4927                dlg.finished(false);
4928                return Err(common::Error::MissingAPIKey);
4929            }
4930        }
4931
4932        let url = params.parse_with_url(&url);
4933
4934        let mut json_mime_type = mime::APPLICATION_JSON;
4935        let mut request_value_reader = {
4936            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4937            common::remove_json_null_values(&mut value);
4938            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4939            serde_json::to_writer(&mut dst, &value).unwrap();
4940            dst
4941        };
4942        let request_size = request_value_reader
4943            .seek(std::io::SeekFrom::End(0))
4944            .unwrap();
4945        request_value_reader
4946            .seek(std::io::SeekFrom::Start(0))
4947            .unwrap();
4948
4949        loop {
4950            request_value_reader
4951                .seek(std::io::SeekFrom::Start(0))
4952                .unwrap();
4953            let mut req_result = {
4954                let client = &self.hub.client;
4955                dlg.pre_request();
4956                let mut req_builder = hyper::Request::builder()
4957                    .method(hyper::Method::PATCH)
4958                    .uri(url.as_str())
4959                    .header(USER_AGENT, self.hub._user_agent.clone());
4960
4961                let request = req_builder
4962                    .header(CONTENT_TYPE, json_mime_type.to_string())
4963                    .header(CONTENT_LENGTH, request_size as u64)
4964                    .body(common::to_body(
4965                        request_value_reader.get_ref().clone().into(),
4966                    ));
4967
4968                client.request(request.unwrap()).await
4969            };
4970
4971            match req_result {
4972                Err(err) => {
4973                    if let common::Retry::After(d) = dlg.http_error(&err) {
4974                        sleep(d).await;
4975                        continue;
4976                    }
4977                    dlg.finished(false);
4978                    return Err(common::Error::HttpError(err));
4979                }
4980                Ok(res) => {
4981                    let (mut parts, body) = res.into_parts();
4982                    let mut body = common::Body::new(body);
4983                    if !parts.status.is_success() {
4984                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4985                        let error = serde_json::from_str(&common::to_string(&bytes));
4986                        let response = common::to_response(parts, bytes.into());
4987
4988                        if let common::Retry::After(d) =
4989                            dlg.http_failure(&response, error.as_ref().ok())
4990                        {
4991                            sleep(d).await;
4992                            continue;
4993                        }
4994
4995                        dlg.finished(false);
4996
4997                        return Err(match error {
4998                            Ok(value) => common::Error::BadRequest(value),
4999                            _ => common::Error::Failure(response),
5000                        });
5001                    }
5002                    let response = {
5003                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5004                        let encoded = common::to_string(&bytes);
5005                        match serde_json::from_str(&encoded) {
5006                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5007                            Err(error) => {
5008                                dlg.response_json_decode_error(&encoded, &error);
5009                                return Err(common::Error::JsonDecodeError(
5010                                    encoded.to_string(),
5011                                    error,
5012                                ));
5013                            }
5014                        }
5015                    };
5016
5017                    dlg.finished(true);
5018                    return Ok(response);
5019                }
5020            }
5021        }
5022    }
5023
5024    ///
5025    /// Sets the *request* property to the given value.
5026    ///
5027    /// Even though the property as already been set when instantiating this call,
5028    /// we provide this method for API completeness.
5029    pub fn request(mut self, new_value: Lead) -> MethodUpdateLeadCall<'a, C> {
5030        self._request = new_value;
5031        self
5032    }
5033    /// Standard field mask for the set of fields to be updated.
5034    /// Required with at least 1 value in FieldMask's paths.
5035    /// Only `state` and `adwords_customer_id` are currently supported.
5036    ///
5037    /// Sets the *update mask* query property to the given value.
5038    pub fn update_mask(mut self, new_value: common::FieldMask) -> MethodUpdateLeadCall<'a, C> {
5039        self._update_mask = Some(new_value);
5040        self
5041    }
5042    /// Logged-in user ID to impersonate instead of the user's ID.
5043    ///
5044    /// Sets the *request metadata.user overrides.user id* query property to the given value.
5045    pub fn request_metadata_user_overrides_user_id(
5046        mut self,
5047        new_value: &str,
5048    ) -> MethodUpdateLeadCall<'a, C> {
5049        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
5050        self
5051    }
5052    /// IP address to use instead of the user's geo-located IP address.
5053    ///
5054    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
5055    pub fn request_metadata_user_overrides_ip_address(
5056        mut self,
5057        new_value: &str,
5058    ) -> MethodUpdateLeadCall<'a, C> {
5059        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
5060        self
5061    }
5062    /// Second level identifier to indicate where the traffic comes from.
5063    /// An identifier has multiple letters created by a team which redirected the
5064    /// traffic to us.
5065    ///
5066    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
5067    pub fn request_metadata_traffic_source_traffic_sub_id(
5068        mut self,
5069        new_value: &str,
5070    ) -> MethodUpdateLeadCall<'a, C> {
5071        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
5072        self
5073    }
5074    /// Identifier to indicate where the traffic comes from.
5075    /// An identifier has multiple letters created by a team which redirected the
5076    /// traffic to us.
5077    ///
5078    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
5079    pub fn request_metadata_traffic_source_traffic_source_id(
5080        mut self,
5081        new_value: &str,
5082    ) -> MethodUpdateLeadCall<'a, C> {
5083        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
5084        self
5085    }
5086    /// Google Partners session ID.
5087    ///
5088    /// Sets the *request metadata.partners session id* query property to the given value.
5089    pub fn request_metadata_partners_session_id(
5090        mut self,
5091        new_value: &str,
5092    ) -> MethodUpdateLeadCall<'a, C> {
5093        self._request_metadata_partners_session_id = Some(new_value.to_string());
5094        self
5095    }
5096    /// Locale to use for the current request.
5097    ///
5098    /// Sets the *request metadata.locale* query property to the given value.
5099    pub fn request_metadata_locale(mut self, new_value: &str) -> MethodUpdateLeadCall<'a, C> {
5100        self._request_metadata_locale = Some(new_value.to_string());
5101        self
5102    }
5103    /// Experiment IDs the current request belongs to.
5104    ///
5105    /// Append the given value to the *request metadata.experiment ids* query property.
5106    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
5107    pub fn add_request_metadata_experiment_ids(
5108        mut self,
5109        new_value: &str,
5110    ) -> MethodUpdateLeadCall<'a, C> {
5111        self._request_metadata_experiment_ids
5112            .push(new_value.to_string());
5113        self
5114    }
5115    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5116    /// while executing the actual API request.
5117    ///
5118    /// ````text
5119    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5120    /// ````
5121    ///
5122    /// Sets the *delegate* property to the given value.
5123    pub fn delegate(
5124        mut self,
5125        new_value: &'a mut dyn common::Delegate,
5126    ) -> MethodUpdateLeadCall<'a, C> {
5127        self._delegate = Some(new_value);
5128        self
5129    }
5130
5131    /// Set any additional parameter of the query string used in the request.
5132    /// It should be used to set parameters which are not yet available through their own
5133    /// setters.
5134    ///
5135    /// Please note that this method must not be used to set any of the known parameters
5136    /// which have their own setter method. If done anyway, the request will fail.
5137    ///
5138    /// # Additional Parameters
5139    ///
5140    /// * *alt* (query-string) - Data format for response.
5141    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5142    /// * *access_token* (query-string) - OAuth access token.
5143    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5144    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5145    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5146    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5147    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5148    /// * *$.xgafv* (query-string) - V1 error format.
5149    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5150    /// * *callback* (query-string) - JSONP
5151    pub fn param<T>(mut self, name: T, value: T) -> MethodUpdateLeadCall<'a, C>
5152    where
5153        T: AsRef<str>,
5154    {
5155        self._additional_params
5156            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5157        self
5158    }
5159}
5160
5161/// Update company.
5162/// Should only be called within the context of an authorized logged in user.
5163///
5164/// A builder for the *updateCompanies* method.
5165/// It is not used directly, but through a [`MethodMethods`] instance.
5166///
5167/// # Example
5168///
5169/// Instantiate a resource method builder
5170///
5171/// ```test_harness,no_run
5172/// # extern crate hyper;
5173/// # extern crate hyper_rustls;
5174/// # extern crate google_partners2 as partners2;
5175/// use partners2::api::Company;
5176/// # async fn dox() {
5177/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5178///
5179/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5180/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5181/// #     secret,
5182/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5183/// # ).build().await.unwrap();
5184///
5185/// # let client = hyper_util::client::legacy::Client::builder(
5186/// #     hyper_util::rt::TokioExecutor::new()
5187/// # )
5188/// # .build(
5189/// #     hyper_rustls::HttpsConnectorBuilder::new()
5190/// #         .with_native_roots()
5191/// #         .unwrap()
5192/// #         .https_or_http()
5193/// #         .enable_http1()
5194/// #         .build()
5195/// # );
5196/// # let mut hub = Partners::new(client, auth);
5197/// // As the method needs a request, you would usually fill it with the desired information
5198/// // into the respective structure. Some of the parts shown here might not be applicable !
5199/// // Values shown here are possibly random and not representative !
5200/// let mut req = Company::default();
5201///
5202/// // You can configure optional parameters by calling the respective setters at will, and
5203/// // execute the final call using `doit()`.
5204/// // Values shown here are possibly random and not representative !
5205/// let result = hub.methods().update_companies(req)
5206///              .update_mask(FieldMask::new::<&str>(&[]))
5207///              .request_metadata_user_overrides_user_id("takimata")
5208///              .request_metadata_user_overrides_ip_address("consetetur")
5209///              .request_metadata_traffic_source_traffic_sub_id("voluptua.")
5210///              .request_metadata_traffic_source_traffic_source_id("et")
5211///              .request_metadata_partners_session_id("erat")
5212///              .request_metadata_locale("consetetur")
5213///              .add_request_metadata_experiment_ids("amet.")
5214///              .doit().await;
5215/// # }
5216/// ```
5217pub struct MethodUpdateCompanyCall<'a, C>
5218where
5219    C: 'a,
5220{
5221    hub: &'a Partners<C>,
5222    _request: Company,
5223    _update_mask: Option<common::FieldMask>,
5224    _request_metadata_user_overrides_user_id: Option<String>,
5225    _request_metadata_user_overrides_ip_address: Option<String>,
5226    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
5227    _request_metadata_traffic_source_traffic_source_id: Option<String>,
5228    _request_metadata_partners_session_id: Option<String>,
5229    _request_metadata_locale: Option<String>,
5230    _request_metadata_experiment_ids: Vec<String>,
5231    _delegate: Option<&'a mut dyn common::Delegate>,
5232    _additional_params: HashMap<String, String>,
5233}
5234
5235impl<'a, C> common::CallBuilder for MethodUpdateCompanyCall<'a, C> {}
5236
5237impl<'a, C> MethodUpdateCompanyCall<'a, C>
5238where
5239    C: common::Connector,
5240{
5241    /// Perform the operation you have build so far.
5242    pub async fn doit(mut self) -> common::Result<(common::Response, Company)> {
5243        use std::borrow::Cow;
5244        use std::io::{Read, Seek};
5245
5246        use common::{url::Params, ToParts};
5247        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5248
5249        let mut dd = common::DefaultDelegate;
5250        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5251        dlg.begin(common::MethodInfo {
5252            id: "partners.updateCompanies",
5253            http_method: hyper::Method::PATCH,
5254        });
5255
5256        for &field in [
5257            "alt",
5258            "updateMask",
5259            "requestMetadata.userOverrides.userId",
5260            "requestMetadata.userOverrides.ipAddress",
5261            "requestMetadata.trafficSource.trafficSubId",
5262            "requestMetadata.trafficSource.trafficSourceId",
5263            "requestMetadata.partnersSessionId",
5264            "requestMetadata.locale",
5265            "requestMetadata.experimentIds",
5266        ]
5267        .iter()
5268        {
5269            if self._additional_params.contains_key(field) {
5270                dlg.finished(false);
5271                return Err(common::Error::FieldClash(field));
5272            }
5273        }
5274
5275        let mut params = Params::with_capacity(11 + self._additional_params.len());
5276        if let Some(value) = self._update_mask.as_ref() {
5277            params.push("updateMask", value.to_string());
5278        }
5279        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
5280            params.push("requestMetadata.userOverrides.userId", value);
5281        }
5282        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
5283            params.push("requestMetadata.userOverrides.ipAddress", value);
5284        }
5285        if let Some(value) = self
5286            ._request_metadata_traffic_source_traffic_sub_id
5287            .as_ref()
5288        {
5289            params.push("requestMetadata.trafficSource.trafficSubId", value);
5290        }
5291        if let Some(value) = self
5292            ._request_metadata_traffic_source_traffic_source_id
5293            .as_ref()
5294        {
5295            params.push("requestMetadata.trafficSource.trafficSourceId", value);
5296        }
5297        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
5298            params.push("requestMetadata.partnersSessionId", value);
5299        }
5300        if let Some(value) = self._request_metadata_locale.as_ref() {
5301            params.push("requestMetadata.locale", value);
5302        }
5303        if !self._request_metadata_experiment_ids.is_empty() {
5304            for f in self._request_metadata_experiment_ids.iter() {
5305                params.push("requestMetadata.experimentIds", f);
5306            }
5307        }
5308
5309        params.extend(self._additional_params.iter());
5310
5311        params.push("alt", "json");
5312        let mut url = self.hub._base_url.clone() + "v2/companies";
5313
5314        match dlg.api_key() {
5315            Some(value) => params.push("key", value),
5316            None => {
5317                dlg.finished(false);
5318                return Err(common::Error::MissingAPIKey);
5319            }
5320        }
5321
5322        let url = params.parse_with_url(&url);
5323
5324        let mut json_mime_type = mime::APPLICATION_JSON;
5325        let mut request_value_reader = {
5326            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5327            common::remove_json_null_values(&mut value);
5328            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5329            serde_json::to_writer(&mut dst, &value).unwrap();
5330            dst
5331        };
5332        let request_size = request_value_reader
5333            .seek(std::io::SeekFrom::End(0))
5334            .unwrap();
5335        request_value_reader
5336            .seek(std::io::SeekFrom::Start(0))
5337            .unwrap();
5338
5339        loop {
5340            request_value_reader
5341                .seek(std::io::SeekFrom::Start(0))
5342                .unwrap();
5343            let mut req_result = {
5344                let client = &self.hub.client;
5345                dlg.pre_request();
5346                let mut req_builder = hyper::Request::builder()
5347                    .method(hyper::Method::PATCH)
5348                    .uri(url.as_str())
5349                    .header(USER_AGENT, self.hub._user_agent.clone());
5350
5351                let request = req_builder
5352                    .header(CONTENT_TYPE, json_mime_type.to_string())
5353                    .header(CONTENT_LENGTH, request_size as u64)
5354                    .body(common::to_body(
5355                        request_value_reader.get_ref().clone().into(),
5356                    ));
5357
5358                client.request(request.unwrap()).await
5359            };
5360
5361            match req_result {
5362                Err(err) => {
5363                    if let common::Retry::After(d) = dlg.http_error(&err) {
5364                        sleep(d).await;
5365                        continue;
5366                    }
5367                    dlg.finished(false);
5368                    return Err(common::Error::HttpError(err));
5369                }
5370                Ok(res) => {
5371                    let (mut parts, body) = res.into_parts();
5372                    let mut body = common::Body::new(body);
5373                    if !parts.status.is_success() {
5374                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5375                        let error = serde_json::from_str(&common::to_string(&bytes));
5376                        let response = common::to_response(parts, bytes.into());
5377
5378                        if let common::Retry::After(d) =
5379                            dlg.http_failure(&response, error.as_ref().ok())
5380                        {
5381                            sleep(d).await;
5382                            continue;
5383                        }
5384
5385                        dlg.finished(false);
5386
5387                        return Err(match error {
5388                            Ok(value) => common::Error::BadRequest(value),
5389                            _ => common::Error::Failure(response),
5390                        });
5391                    }
5392                    let response = {
5393                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5394                        let encoded = common::to_string(&bytes);
5395                        match serde_json::from_str(&encoded) {
5396                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5397                            Err(error) => {
5398                                dlg.response_json_decode_error(&encoded, &error);
5399                                return Err(common::Error::JsonDecodeError(
5400                                    encoded.to_string(),
5401                                    error,
5402                                ));
5403                            }
5404                        }
5405                    };
5406
5407                    dlg.finished(true);
5408                    return Ok(response);
5409                }
5410            }
5411        }
5412    }
5413
5414    ///
5415    /// Sets the *request* property to the given value.
5416    ///
5417    /// Even though the property as already been set when instantiating this call,
5418    /// we provide this method for API completeness.
5419    pub fn request(mut self, new_value: Company) -> MethodUpdateCompanyCall<'a, C> {
5420        self._request = new_value;
5421        self
5422    }
5423    /// Standard field mask for the set of fields to be updated.
5424    /// Required with at least 1 value in FieldMask's paths.
5425    ///
5426    /// Sets the *update mask* query property to the given value.
5427    pub fn update_mask(mut self, new_value: common::FieldMask) -> MethodUpdateCompanyCall<'a, C> {
5428        self._update_mask = Some(new_value);
5429        self
5430    }
5431    /// Logged-in user ID to impersonate instead of the user's ID.
5432    ///
5433    /// Sets the *request metadata.user overrides.user id* query property to the given value.
5434    pub fn request_metadata_user_overrides_user_id(
5435        mut self,
5436        new_value: &str,
5437    ) -> MethodUpdateCompanyCall<'a, C> {
5438        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
5439        self
5440    }
5441    /// IP address to use instead of the user's geo-located IP address.
5442    ///
5443    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
5444    pub fn request_metadata_user_overrides_ip_address(
5445        mut self,
5446        new_value: &str,
5447    ) -> MethodUpdateCompanyCall<'a, C> {
5448        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
5449        self
5450    }
5451    /// Second level identifier to indicate where the traffic comes from.
5452    /// An identifier has multiple letters created by a team which redirected the
5453    /// traffic to us.
5454    ///
5455    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
5456    pub fn request_metadata_traffic_source_traffic_sub_id(
5457        mut self,
5458        new_value: &str,
5459    ) -> MethodUpdateCompanyCall<'a, C> {
5460        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
5461        self
5462    }
5463    /// Identifier to indicate where the traffic comes from.
5464    /// An identifier has multiple letters created by a team which redirected the
5465    /// traffic to us.
5466    ///
5467    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
5468    pub fn request_metadata_traffic_source_traffic_source_id(
5469        mut self,
5470        new_value: &str,
5471    ) -> MethodUpdateCompanyCall<'a, C> {
5472        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
5473        self
5474    }
5475    /// Google Partners session ID.
5476    ///
5477    /// Sets the *request metadata.partners session id* query property to the given value.
5478    pub fn request_metadata_partners_session_id(
5479        mut self,
5480        new_value: &str,
5481    ) -> MethodUpdateCompanyCall<'a, C> {
5482        self._request_metadata_partners_session_id = Some(new_value.to_string());
5483        self
5484    }
5485    /// Locale to use for the current request.
5486    ///
5487    /// Sets the *request metadata.locale* query property to the given value.
5488    pub fn request_metadata_locale(mut self, new_value: &str) -> MethodUpdateCompanyCall<'a, C> {
5489        self._request_metadata_locale = Some(new_value.to_string());
5490        self
5491    }
5492    /// Experiment IDs the current request belongs to.
5493    ///
5494    /// Append the given value to the *request metadata.experiment ids* query property.
5495    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
5496    pub fn add_request_metadata_experiment_ids(
5497        mut self,
5498        new_value: &str,
5499    ) -> MethodUpdateCompanyCall<'a, C> {
5500        self._request_metadata_experiment_ids
5501            .push(new_value.to_string());
5502        self
5503    }
5504    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5505    /// while executing the actual API request.
5506    ///
5507    /// ````text
5508    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5509    /// ````
5510    ///
5511    /// Sets the *delegate* property to the given value.
5512    pub fn delegate(
5513        mut self,
5514        new_value: &'a mut dyn common::Delegate,
5515    ) -> MethodUpdateCompanyCall<'a, C> {
5516        self._delegate = Some(new_value);
5517        self
5518    }
5519
5520    /// Set any additional parameter of the query string used in the request.
5521    /// It should be used to set parameters which are not yet available through their own
5522    /// setters.
5523    ///
5524    /// Please note that this method must not be used to set any of the known parameters
5525    /// which have their own setter method. If done anyway, the request will fail.
5526    ///
5527    /// # Additional Parameters
5528    ///
5529    /// * *alt* (query-string) - Data format for response.
5530    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5531    /// * *access_token* (query-string) - OAuth access token.
5532    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5533    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5534    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5535    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5536    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5537    /// * *$.xgafv* (query-string) - V1 error format.
5538    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5539    /// * *callback* (query-string) - JSONP
5540    pub fn param<T>(mut self, name: T, value: T) -> MethodUpdateCompanyCall<'a, C>
5541    where
5542        T: AsRef<str>,
5543    {
5544        self._additional_params
5545            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5546        self
5547    }
5548}
5549
5550/// Gets Partners Status of the logged in user's agency.
5551/// Should only be called if the logged in user is the admin of the agency.
5552///
5553/// A builder for the *getPartnersstatus* method.
5554/// It is not used directly, but through a [`MethodMethods`] instance.
5555///
5556/// # Example
5557///
5558/// Instantiate a resource method builder
5559///
5560/// ```test_harness,no_run
5561/// # extern crate hyper;
5562/// # extern crate hyper_rustls;
5563/// # extern crate google_partners2 as partners2;
5564/// # async fn dox() {
5565/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5566///
5567/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5568/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5569/// #     secret,
5570/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5571/// # ).build().await.unwrap();
5572///
5573/// # let client = hyper_util::client::legacy::Client::builder(
5574/// #     hyper_util::rt::TokioExecutor::new()
5575/// # )
5576/// # .build(
5577/// #     hyper_rustls::HttpsConnectorBuilder::new()
5578/// #         .with_native_roots()
5579/// #         .unwrap()
5580/// #         .https_or_http()
5581/// #         .enable_http1()
5582/// #         .build()
5583/// # );
5584/// # let mut hub = Partners::new(client, auth);
5585/// // You can configure optional parameters by calling the respective setters at will, and
5586/// // execute the final call using `doit()`.
5587/// // Values shown here are possibly random and not representative !
5588/// let result = hub.methods().get_partnersstatus()
5589///              .request_metadata_user_overrides_user_id("sed")
5590///              .request_metadata_user_overrides_ip_address("takimata")
5591///              .request_metadata_traffic_source_traffic_sub_id("dolores")
5592///              .request_metadata_traffic_source_traffic_source_id("gubergren")
5593///              .request_metadata_partners_session_id("et")
5594///              .request_metadata_locale("accusam")
5595///              .add_request_metadata_experiment_ids("voluptua.")
5596///              .doit().await;
5597/// # }
5598/// ```
5599pub struct MethodGetPartnersstatuCall<'a, C>
5600where
5601    C: 'a,
5602{
5603    hub: &'a Partners<C>,
5604    _request_metadata_user_overrides_user_id: Option<String>,
5605    _request_metadata_user_overrides_ip_address: Option<String>,
5606    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
5607    _request_metadata_traffic_source_traffic_source_id: Option<String>,
5608    _request_metadata_partners_session_id: Option<String>,
5609    _request_metadata_locale: Option<String>,
5610    _request_metadata_experiment_ids: Vec<String>,
5611    _delegate: Option<&'a mut dyn common::Delegate>,
5612    _additional_params: HashMap<String, String>,
5613}
5614
5615impl<'a, C> common::CallBuilder for MethodGetPartnersstatuCall<'a, C> {}
5616
5617impl<'a, C> MethodGetPartnersstatuCall<'a, C>
5618where
5619    C: common::Connector,
5620{
5621    /// Perform the operation you have build so far.
5622    pub async fn doit(mut self) -> common::Result<(common::Response, GetPartnersStatusResponse)> {
5623        use std::borrow::Cow;
5624        use std::io::{Read, Seek};
5625
5626        use common::{url::Params, ToParts};
5627        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5628
5629        let mut dd = common::DefaultDelegate;
5630        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5631        dlg.begin(common::MethodInfo {
5632            id: "partners.getPartnersstatus",
5633            http_method: hyper::Method::GET,
5634        });
5635
5636        for &field in [
5637            "alt",
5638            "requestMetadata.userOverrides.userId",
5639            "requestMetadata.userOverrides.ipAddress",
5640            "requestMetadata.trafficSource.trafficSubId",
5641            "requestMetadata.trafficSource.trafficSourceId",
5642            "requestMetadata.partnersSessionId",
5643            "requestMetadata.locale",
5644            "requestMetadata.experimentIds",
5645        ]
5646        .iter()
5647        {
5648            if self._additional_params.contains_key(field) {
5649                dlg.finished(false);
5650                return Err(common::Error::FieldClash(field));
5651            }
5652        }
5653
5654        let mut params = Params::with_capacity(9 + self._additional_params.len());
5655        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
5656            params.push("requestMetadata.userOverrides.userId", value);
5657        }
5658        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
5659            params.push("requestMetadata.userOverrides.ipAddress", value);
5660        }
5661        if let Some(value) = self
5662            ._request_metadata_traffic_source_traffic_sub_id
5663            .as_ref()
5664        {
5665            params.push("requestMetadata.trafficSource.trafficSubId", value);
5666        }
5667        if let Some(value) = self
5668            ._request_metadata_traffic_source_traffic_source_id
5669            .as_ref()
5670        {
5671            params.push("requestMetadata.trafficSource.trafficSourceId", value);
5672        }
5673        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
5674            params.push("requestMetadata.partnersSessionId", value);
5675        }
5676        if let Some(value) = self._request_metadata_locale.as_ref() {
5677            params.push("requestMetadata.locale", value);
5678        }
5679        if !self._request_metadata_experiment_ids.is_empty() {
5680            for f in self._request_metadata_experiment_ids.iter() {
5681                params.push("requestMetadata.experimentIds", f);
5682            }
5683        }
5684
5685        params.extend(self._additional_params.iter());
5686
5687        params.push("alt", "json");
5688        let mut url = self.hub._base_url.clone() + "v2/partnersstatus";
5689
5690        match dlg.api_key() {
5691            Some(value) => params.push("key", value),
5692            None => {
5693                dlg.finished(false);
5694                return Err(common::Error::MissingAPIKey);
5695            }
5696        }
5697
5698        let url = params.parse_with_url(&url);
5699
5700        loop {
5701            let mut req_result = {
5702                let client = &self.hub.client;
5703                dlg.pre_request();
5704                let mut req_builder = hyper::Request::builder()
5705                    .method(hyper::Method::GET)
5706                    .uri(url.as_str())
5707                    .header(USER_AGENT, self.hub._user_agent.clone());
5708
5709                let request = req_builder
5710                    .header(CONTENT_LENGTH, 0_u64)
5711                    .body(common::to_body::<String>(None));
5712
5713                client.request(request.unwrap()).await
5714            };
5715
5716            match req_result {
5717                Err(err) => {
5718                    if let common::Retry::After(d) = dlg.http_error(&err) {
5719                        sleep(d).await;
5720                        continue;
5721                    }
5722                    dlg.finished(false);
5723                    return Err(common::Error::HttpError(err));
5724                }
5725                Ok(res) => {
5726                    let (mut parts, body) = res.into_parts();
5727                    let mut body = common::Body::new(body);
5728                    if !parts.status.is_success() {
5729                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5730                        let error = serde_json::from_str(&common::to_string(&bytes));
5731                        let response = common::to_response(parts, bytes.into());
5732
5733                        if let common::Retry::After(d) =
5734                            dlg.http_failure(&response, error.as_ref().ok())
5735                        {
5736                            sleep(d).await;
5737                            continue;
5738                        }
5739
5740                        dlg.finished(false);
5741
5742                        return Err(match error {
5743                            Ok(value) => common::Error::BadRequest(value),
5744                            _ => common::Error::Failure(response),
5745                        });
5746                    }
5747                    let response = {
5748                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5749                        let encoded = common::to_string(&bytes);
5750                        match serde_json::from_str(&encoded) {
5751                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5752                            Err(error) => {
5753                                dlg.response_json_decode_error(&encoded, &error);
5754                                return Err(common::Error::JsonDecodeError(
5755                                    encoded.to_string(),
5756                                    error,
5757                                ));
5758                            }
5759                        }
5760                    };
5761
5762                    dlg.finished(true);
5763                    return Ok(response);
5764                }
5765            }
5766        }
5767    }
5768
5769    /// Logged-in user ID to impersonate instead of the user's ID.
5770    ///
5771    /// Sets the *request metadata.user overrides.user id* query property to the given value.
5772    pub fn request_metadata_user_overrides_user_id(
5773        mut self,
5774        new_value: &str,
5775    ) -> MethodGetPartnersstatuCall<'a, C> {
5776        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
5777        self
5778    }
5779    /// IP address to use instead of the user's geo-located IP address.
5780    ///
5781    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
5782    pub fn request_metadata_user_overrides_ip_address(
5783        mut self,
5784        new_value: &str,
5785    ) -> MethodGetPartnersstatuCall<'a, C> {
5786        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
5787        self
5788    }
5789    /// Second level identifier to indicate where the traffic comes from.
5790    /// An identifier has multiple letters created by a team which redirected the
5791    /// traffic to us.
5792    ///
5793    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
5794    pub fn request_metadata_traffic_source_traffic_sub_id(
5795        mut self,
5796        new_value: &str,
5797    ) -> MethodGetPartnersstatuCall<'a, C> {
5798        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
5799        self
5800    }
5801    /// Identifier to indicate where the traffic comes from.
5802    /// An identifier has multiple letters created by a team which redirected the
5803    /// traffic to us.
5804    ///
5805    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
5806    pub fn request_metadata_traffic_source_traffic_source_id(
5807        mut self,
5808        new_value: &str,
5809    ) -> MethodGetPartnersstatuCall<'a, C> {
5810        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
5811        self
5812    }
5813    /// Google Partners session ID.
5814    ///
5815    /// Sets the *request metadata.partners session id* query property to the given value.
5816    pub fn request_metadata_partners_session_id(
5817        mut self,
5818        new_value: &str,
5819    ) -> MethodGetPartnersstatuCall<'a, C> {
5820        self._request_metadata_partners_session_id = Some(new_value.to_string());
5821        self
5822    }
5823    /// Locale to use for the current request.
5824    ///
5825    /// Sets the *request metadata.locale* query property to the given value.
5826    pub fn request_metadata_locale(mut self, new_value: &str) -> MethodGetPartnersstatuCall<'a, C> {
5827        self._request_metadata_locale = Some(new_value.to_string());
5828        self
5829    }
5830    /// Experiment IDs the current request belongs to.
5831    ///
5832    /// Append the given value to the *request metadata.experiment ids* query property.
5833    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
5834    pub fn add_request_metadata_experiment_ids(
5835        mut self,
5836        new_value: &str,
5837    ) -> MethodGetPartnersstatuCall<'a, C> {
5838        self._request_metadata_experiment_ids
5839            .push(new_value.to_string());
5840        self
5841    }
5842    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5843    /// while executing the actual API request.
5844    ///
5845    /// ````text
5846    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5847    /// ````
5848    ///
5849    /// Sets the *delegate* property to the given value.
5850    pub fn delegate(
5851        mut self,
5852        new_value: &'a mut dyn common::Delegate,
5853    ) -> MethodGetPartnersstatuCall<'a, C> {
5854        self._delegate = Some(new_value);
5855        self
5856    }
5857
5858    /// Set any additional parameter of the query string used in the request.
5859    /// It should be used to set parameters which are not yet available through their own
5860    /// setters.
5861    ///
5862    /// Please note that this method must not be used to set any of the known parameters
5863    /// which have their own setter method. If done anyway, the request will fail.
5864    ///
5865    /// # Additional Parameters
5866    ///
5867    /// * *alt* (query-string) - Data format for response.
5868    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5869    /// * *access_token* (query-string) - OAuth access token.
5870    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5871    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5872    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5873    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5874    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5875    /// * *$.xgafv* (query-string) - V1 error format.
5876    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5877    /// * *callback* (query-string) - JSONP
5878    pub fn param<T>(mut self, name: T, value: T) -> MethodGetPartnersstatuCall<'a, C>
5879    where
5880        T: AsRef<str>,
5881    {
5882        self._additional_params
5883            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5884        self
5885    }
5886}
5887
5888/// Creates an advertiser lead for the given company ID.
5889///
5890/// A builder for the *leads.create* method supported by a *company* resource.
5891/// It is not used directly, but through a [`CompanyMethods`] instance.
5892///
5893/// # Example
5894///
5895/// Instantiate a resource method builder
5896///
5897/// ```test_harness,no_run
5898/// # extern crate hyper;
5899/// # extern crate hyper_rustls;
5900/// # extern crate google_partners2 as partners2;
5901/// use partners2::api::CreateLeadRequest;
5902/// # async fn dox() {
5903/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5904///
5905/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5906/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5907/// #     secret,
5908/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5909/// # ).build().await.unwrap();
5910///
5911/// # let client = hyper_util::client::legacy::Client::builder(
5912/// #     hyper_util::rt::TokioExecutor::new()
5913/// # )
5914/// # .build(
5915/// #     hyper_rustls::HttpsConnectorBuilder::new()
5916/// #         .with_native_roots()
5917/// #         .unwrap()
5918/// #         .https_or_http()
5919/// #         .enable_http1()
5920/// #         .build()
5921/// # );
5922/// # let mut hub = Partners::new(client, auth);
5923/// // As the method needs a request, you would usually fill it with the desired information
5924/// // into the respective structure. Some of the parts shown here might not be applicable !
5925/// // Values shown here are possibly random and not representative !
5926/// let mut req = CreateLeadRequest::default();
5927///
5928/// // You can configure optional parameters by calling the respective setters at will, and
5929/// // execute the final call using `doit()`.
5930/// // Values shown here are possibly random and not representative !
5931/// let result = hub.companies().leads_create(req, "companyId")
5932///              .doit().await;
5933/// # }
5934/// ```
5935pub struct CompanyLeadCreateCall<'a, C>
5936where
5937    C: 'a,
5938{
5939    hub: &'a Partners<C>,
5940    _request: CreateLeadRequest,
5941    _company_id: String,
5942    _delegate: Option<&'a mut dyn common::Delegate>,
5943    _additional_params: HashMap<String, String>,
5944}
5945
5946impl<'a, C> common::CallBuilder for CompanyLeadCreateCall<'a, C> {}
5947
5948impl<'a, C> CompanyLeadCreateCall<'a, C>
5949where
5950    C: common::Connector,
5951{
5952    /// Perform the operation you have build so far.
5953    pub async fn doit(mut self) -> common::Result<(common::Response, CreateLeadResponse)> {
5954        use std::borrow::Cow;
5955        use std::io::{Read, Seek};
5956
5957        use common::{url::Params, ToParts};
5958        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5959
5960        let mut dd = common::DefaultDelegate;
5961        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5962        dlg.begin(common::MethodInfo {
5963            id: "partners.companies.leads.create",
5964            http_method: hyper::Method::POST,
5965        });
5966
5967        for &field in ["alt", "companyId"].iter() {
5968            if self._additional_params.contains_key(field) {
5969                dlg.finished(false);
5970                return Err(common::Error::FieldClash(field));
5971            }
5972        }
5973
5974        let mut params = Params::with_capacity(4 + self._additional_params.len());
5975        params.push("companyId", self._company_id);
5976
5977        params.extend(self._additional_params.iter());
5978
5979        params.push("alt", "json");
5980        let mut url = self.hub._base_url.clone() + "v2/companies/{companyId}/leads";
5981
5982        match dlg.api_key() {
5983            Some(value) => params.push("key", value),
5984            None => {
5985                dlg.finished(false);
5986                return Err(common::Error::MissingAPIKey);
5987            }
5988        }
5989
5990        #[allow(clippy::single_element_loop)]
5991        for &(find_this, param_name) in [("{companyId}", "companyId")].iter() {
5992            url = params.uri_replacement(url, param_name, find_this, false);
5993        }
5994        {
5995            let to_remove = ["companyId"];
5996            params.remove_params(&to_remove);
5997        }
5998
5999        let url = params.parse_with_url(&url);
6000
6001        let mut json_mime_type = mime::APPLICATION_JSON;
6002        let mut request_value_reader = {
6003            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6004            common::remove_json_null_values(&mut value);
6005            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6006            serde_json::to_writer(&mut dst, &value).unwrap();
6007            dst
6008        };
6009        let request_size = request_value_reader
6010            .seek(std::io::SeekFrom::End(0))
6011            .unwrap();
6012        request_value_reader
6013            .seek(std::io::SeekFrom::Start(0))
6014            .unwrap();
6015
6016        loop {
6017            request_value_reader
6018                .seek(std::io::SeekFrom::Start(0))
6019                .unwrap();
6020            let mut req_result = {
6021                let client = &self.hub.client;
6022                dlg.pre_request();
6023                let mut req_builder = hyper::Request::builder()
6024                    .method(hyper::Method::POST)
6025                    .uri(url.as_str())
6026                    .header(USER_AGENT, self.hub._user_agent.clone());
6027
6028                let request = req_builder
6029                    .header(CONTENT_TYPE, json_mime_type.to_string())
6030                    .header(CONTENT_LENGTH, request_size as u64)
6031                    .body(common::to_body(
6032                        request_value_reader.get_ref().clone().into(),
6033                    ));
6034
6035                client.request(request.unwrap()).await
6036            };
6037
6038            match req_result {
6039                Err(err) => {
6040                    if let common::Retry::After(d) = dlg.http_error(&err) {
6041                        sleep(d).await;
6042                        continue;
6043                    }
6044                    dlg.finished(false);
6045                    return Err(common::Error::HttpError(err));
6046                }
6047                Ok(res) => {
6048                    let (mut parts, body) = res.into_parts();
6049                    let mut body = common::Body::new(body);
6050                    if !parts.status.is_success() {
6051                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6052                        let error = serde_json::from_str(&common::to_string(&bytes));
6053                        let response = common::to_response(parts, bytes.into());
6054
6055                        if let common::Retry::After(d) =
6056                            dlg.http_failure(&response, error.as_ref().ok())
6057                        {
6058                            sleep(d).await;
6059                            continue;
6060                        }
6061
6062                        dlg.finished(false);
6063
6064                        return Err(match error {
6065                            Ok(value) => common::Error::BadRequest(value),
6066                            _ => common::Error::Failure(response),
6067                        });
6068                    }
6069                    let response = {
6070                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6071                        let encoded = common::to_string(&bytes);
6072                        match serde_json::from_str(&encoded) {
6073                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6074                            Err(error) => {
6075                                dlg.response_json_decode_error(&encoded, &error);
6076                                return Err(common::Error::JsonDecodeError(
6077                                    encoded.to_string(),
6078                                    error,
6079                                ));
6080                            }
6081                        }
6082                    };
6083
6084                    dlg.finished(true);
6085                    return Ok(response);
6086                }
6087            }
6088        }
6089    }
6090
6091    ///
6092    /// Sets the *request* property to the given value.
6093    ///
6094    /// Even though the property as already been set when instantiating this call,
6095    /// we provide this method for API completeness.
6096    pub fn request(mut self, new_value: CreateLeadRequest) -> CompanyLeadCreateCall<'a, C> {
6097        self._request = new_value;
6098        self
6099    }
6100    /// The ID of the company to contact.
6101    ///
6102    /// Sets the *company id* path property to the given value.
6103    ///
6104    /// Even though the property as already been set when instantiating this call,
6105    /// we provide this method for API completeness.
6106    pub fn company_id(mut self, new_value: &str) -> CompanyLeadCreateCall<'a, C> {
6107        self._company_id = new_value.to_string();
6108        self
6109    }
6110    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6111    /// while executing the actual API request.
6112    ///
6113    /// ````text
6114    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6115    /// ````
6116    ///
6117    /// Sets the *delegate* property to the given value.
6118    pub fn delegate(
6119        mut self,
6120        new_value: &'a mut dyn common::Delegate,
6121    ) -> CompanyLeadCreateCall<'a, C> {
6122        self._delegate = Some(new_value);
6123        self
6124    }
6125
6126    /// Set any additional parameter of the query string used in the request.
6127    /// It should be used to set parameters which are not yet available through their own
6128    /// setters.
6129    ///
6130    /// Please note that this method must not be used to set any of the known parameters
6131    /// which have their own setter method. If done anyway, the request will fail.
6132    ///
6133    /// # Additional Parameters
6134    ///
6135    /// * *alt* (query-string) - Data format for response.
6136    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6137    /// * *access_token* (query-string) - OAuth access token.
6138    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6139    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6140    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6141    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6142    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6143    /// * *$.xgafv* (query-string) - V1 error format.
6144    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6145    /// * *callback* (query-string) - JSONP
6146    pub fn param<T>(mut self, name: T, value: T) -> CompanyLeadCreateCall<'a, C>
6147    where
6148        T: AsRef<str>,
6149    {
6150        self._additional_params
6151            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6152        self
6153    }
6154}
6155
6156/// Gets a company.
6157///
6158/// A builder for the *get* method supported by a *company* resource.
6159/// It is not used directly, but through a [`CompanyMethods`] instance.
6160///
6161/// # Example
6162///
6163/// Instantiate a resource method builder
6164///
6165/// ```test_harness,no_run
6166/// # extern crate hyper;
6167/// # extern crate hyper_rustls;
6168/// # extern crate google_partners2 as partners2;
6169/// # async fn dox() {
6170/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6171///
6172/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6173/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6174/// #     secret,
6175/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6176/// # ).build().await.unwrap();
6177///
6178/// # let client = hyper_util::client::legacy::Client::builder(
6179/// #     hyper_util::rt::TokioExecutor::new()
6180/// # )
6181/// # .build(
6182/// #     hyper_rustls::HttpsConnectorBuilder::new()
6183/// #         .with_native_roots()
6184/// #         .unwrap()
6185/// #         .https_or_http()
6186/// #         .enable_http1()
6187/// #         .build()
6188/// # );
6189/// # let mut hub = Partners::new(client, auth);
6190/// // You can configure optional parameters by calling the respective setters at will, and
6191/// // execute the final call using `doit()`.
6192/// // Values shown here are possibly random and not representative !
6193/// let result = hub.companies().get("companyId")
6194///              .view("dolore")
6195///              .request_metadata_user_overrides_user_id("voluptua.")
6196///              .request_metadata_user_overrides_ip_address("amet.")
6197///              .request_metadata_traffic_source_traffic_sub_id("ea")
6198///              .request_metadata_traffic_source_traffic_source_id("sadipscing")
6199///              .request_metadata_partners_session_id("Lorem")
6200///              .request_metadata_locale("invidunt")
6201///              .add_request_metadata_experiment_ids("no")
6202///              .order_by("est")
6203///              .currency_code("At")
6204///              .address("sed")
6205///              .doit().await;
6206/// # }
6207/// ```
6208pub struct CompanyGetCall<'a, C>
6209where
6210    C: 'a,
6211{
6212    hub: &'a Partners<C>,
6213    _company_id: String,
6214    _view: Option<String>,
6215    _request_metadata_user_overrides_user_id: Option<String>,
6216    _request_metadata_user_overrides_ip_address: Option<String>,
6217    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
6218    _request_metadata_traffic_source_traffic_source_id: Option<String>,
6219    _request_metadata_partners_session_id: Option<String>,
6220    _request_metadata_locale: Option<String>,
6221    _request_metadata_experiment_ids: Vec<String>,
6222    _order_by: Option<String>,
6223    _currency_code: Option<String>,
6224    _address: Option<String>,
6225    _delegate: Option<&'a mut dyn common::Delegate>,
6226    _additional_params: HashMap<String, String>,
6227}
6228
6229impl<'a, C> common::CallBuilder for CompanyGetCall<'a, C> {}
6230
6231impl<'a, C> CompanyGetCall<'a, C>
6232where
6233    C: common::Connector,
6234{
6235    /// Perform the operation you have build so far.
6236    pub async fn doit(mut self) -> common::Result<(common::Response, GetCompanyResponse)> {
6237        use std::borrow::Cow;
6238        use std::io::{Read, Seek};
6239
6240        use common::{url::Params, ToParts};
6241        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6242
6243        let mut dd = common::DefaultDelegate;
6244        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6245        dlg.begin(common::MethodInfo {
6246            id: "partners.companies.get",
6247            http_method: hyper::Method::GET,
6248        });
6249
6250        for &field in [
6251            "alt",
6252            "companyId",
6253            "view",
6254            "requestMetadata.userOverrides.userId",
6255            "requestMetadata.userOverrides.ipAddress",
6256            "requestMetadata.trafficSource.trafficSubId",
6257            "requestMetadata.trafficSource.trafficSourceId",
6258            "requestMetadata.partnersSessionId",
6259            "requestMetadata.locale",
6260            "requestMetadata.experimentIds",
6261            "orderBy",
6262            "currencyCode",
6263            "address",
6264        ]
6265        .iter()
6266        {
6267            if self._additional_params.contains_key(field) {
6268                dlg.finished(false);
6269                return Err(common::Error::FieldClash(field));
6270            }
6271        }
6272
6273        let mut params = Params::with_capacity(14 + self._additional_params.len());
6274        params.push("companyId", self._company_id);
6275        if let Some(value) = self._view.as_ref() {
6276            params.push("view", value);
6277        }
6278        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
6279            params.push("requestMetadata.userOverrides.userId", value);
6280        }
6281        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
6282            params.push("requestMetadata.userOverrides.ipAddress", value);
6283        }
6284        if let Some(value) = self
6285            ._request_metadata_traffic_source_traffic_sub_id
6286            .as_ref()
6287        {
6288            params.push("requestMetadata.trafficSource.trafficSubId", value);
6289        }
6290        if let Some(value) = self
6291            ._request_metadata_traffic_source_traffic_source_id
6292            .as_ref()
6293        {
6294            params.push("requestMetadata.trafficSource.trafficSourceId", value);
6295        }
6296        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
6297            params.push("requestMetadata.partnersSessionId", value);
6298        }
6299        if let Some(value) = self._request_metadata_locale.as_ref() {
6300            params.push("requestMetadata.locale", value);
6301        }
6302        if !self._request_metadata_experiment_ids.is_empty() {
6303            for f in self._request_metadata_experiment_ids.iter() {
6304                params.push("requestMetadata.experimentIds", f);
6305            }
6306        }
6307        if let Some(value) = self._order_by.as_ref() {
6308            params.push("orderBy", value);
6309        }
6310        if let Some(value) = self._currency_code.as_ref() {
6311            params.push("currencyCode", value);
6312        }
6313        if let Some(value) = self._address.as_ref() {
6314            params.push("address", value);
6315        }
6316
6317        params.extend(self._additional_params.iter());
6318
6319        params.push("alt", "json");
6320        let mut url = self.hub._base_url.clone() + "v2/companies/{companyId}";
6321
6322        match dlg.api_key() {
6323            Some(value) => params.push("key", value),
6324            None => {
6325                dlg.finished(false);
6326                return Err(common::Error::MissingAPIKey);
6327            }
6328        }
6329
6330        #[allow(clippy::single_element_loop)]
6331        for &(find_this, param_name) in [("{companyId}", "companyId")].iter() {
6332            url = params.uri_replacement(url, param_name, find_this, false);
6333        }
6334        {
6335            let to_remove = ["companyId"];
6336            params.remove_params(&to_remove);
6337        }
6338
6339        let url = params.parse_with_url(&url);
6340
6341        loop {
6342            let mut req_result = {
6343                let client = &self.hub.client;
6344                dlg.pre_request();
6345                let mut req_builder = hyper::Request::builder()
6346                    .method(hyper::Method::GET)
6347                    .uri(url.as_str())
6348                    .header(USER_AGENT, self.hub._user_agent.clone());
6349
6350                let request = req_builder
6351                    .header(CONTENT_LENGTH, 0_u64)
6352                    .body(common::to_body::<String>(None));
6353
6354                client.request(request.unwrap()).await
6355            };
6356
6357            match req_result {
6358                Err(err) => {
6359                    if let common::Retry::After(d) = dlg.http_error(&err) {
6360                        sleep(d).await;
6361                        continue;
6362                    }
6363                    dlg.finished(false);
6364                    return Err(common::Error::HttpError(err));
6365                }
6366                Ok(res) => {
6367                    let (mut parts, body) = res.into_parts();
6368                    let mut body = common::Body::new(body);
6369                    if !parts.status.is_success() {
6370                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6371                        let error = serde_json::from_str(&common::to_string(&bytes));
6372                        let response = common::to_response(parts, bytes.into());
6373
6374                        if let common::Retry::After(d) =
6375                            dlg.http_failure(&response, error.as_ref().ok())
6376                        {
6377                            sleep(d).await;
6378                            continue;
6379                        }
6380
6381                        dlg.finished(false);
6382
6383                        return Err(match error {
6384                            Ok(value) => common::Error::BadRequest(value),
6385                            _ => common::Error::Failure(response),
6386                        });
6387                    }
6388                    let response = {
6389                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6390                        let encoded = common::to_string(&bytes);
6391                        match serde_json::from_str(&encoded) {
6392                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6393                            Err(error) => {
6394                                dlg.response_json_decode_error(&encoded, &error);
6395                                return Err(common::Error::JsonDecodeError(
6396                                    encoded.to_string(),
6397                                    error,
6398                                ));
6399                            }
6400                        }
6401                    };
6402
6403                    dlg.finished(true);
6404                    return Ok(response);
6405                }
6406            }
6407        }
6408    }
6409
6410    /// The ID of the company to retrieve.
6411    ///
6412    /// Sets the *company id* path property to the given value.
6413    ///
6414    /// Even though the property as already been set when instantiating this call,
6415    /// we provide this method for API completeness.
6416    pub fn company_id(mut self, new_value: &str) -> CompanyGetCall<'a, C> {
6417        self._company_id = new_value.to_string();
6418        self
6419    }
6420    /// The view of `Company` resource to be returned. This must not be
6421    /// `COMPANY_VIEW_UNSPECIFIED`.
6422    ///
6423    /// Sets the *view* query property to the given value.
6424    pub fn view(mut self, new_value: &str) -> CompanyGetCall<'a, C> {
6425        self._view = Some(new_value.to_string());
6426        self
6427    }
6428    /// Logged-in user ID to impersonate instead of the user's ID.
6429    ///
6430    /// Sets the *request metadata.user overrides.user id* query property to the given value.
6431    pub fn request_metadata_user_overrides_user_id(
6432        mut self,
6433        new_value: &str,
6434    ) -> CompanyGetCall<'a, C> {
6435        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
6436        self
6437    }
6438    /// IP address to use instead of the user's geo-located IP address.
6439    ///
6440    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
6441    pub fn request_metadata_user_overrides_ip_address(
6442        mut self,
6443        new_value: &str,
6444    ) -> CompanyGetCall<'a, C> {
6445        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
6446        self
6447    }
6448    /// Second level identifier to indicate where the traffic comes from.
6449    /// An identifier has multiple letters created by a team which redirected the
6450    /// traffic to us.
6451    ///
6452    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
6453    pub fn request_metadata_traffic_source_traffic_sub_id(
6454        mut self,
6455        new_value: &str,
6456    ) -> CompanyGetCall<'a, C> {
6457        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
6458        self
6459    }
6460    /// Identifier to indicate where the traffic comes from.
6461    /// An identifier has multiple letters created by a team which redirected the
6462    /// traffic to us.
6463    ///
6464    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
6465    pub fn request_metadata_traffic_source_traffic_source_id(
6466        mut self,
6467        new_value: &str,
6468    ) -> CompanyGetCall<'a, C> {
6469        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
6470        self
6471    }
6472    /// Google Partners session ID.
6473    ///
6474    /// Sets the *request metadata.partners session id* query property to the given value.
6475    pub fn request_metadata_partners_session_id(
6476        mut self,
6477        new_value: &str,
6478    ) -> CompanyGetCall<'a, C> {
6479        self._request_metadata_partners_session_id = Some(new_value.to_string());
6480        self
6481    }
6482    /// Locale to use for the current request.
6483    ///
6484    /// Sets the *request metadata.locale* query property to the given value.
6485    pub fn request_metadata_locale(mut self, new_value: &str) -> CompanyGetCall<'a, C> {
6486        self._request_metadata_locale = Some(new_value.to_string());
6487        self
6488    }
6489    /// Experiment IDs the current request belongs to.
6490    ///
6491    /// Append the given value to the *request metadata.experiment ids* query property.
6492    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6493    pub fn add_request_metadata_experiment_ids(mut self, new_value: &str) -> CompanyGetCall<'a, C> {
6494        self._request_metadata_experiment_ids
6495            .push(new_value.to_string());
6496        self
6497    }
6498    /// How to order addresses within the returned company. Currently, only
6499    /// `address` and `address desc` is supported which will sorted by closest to
6500    /// farthest in distance from given address and farthest to closest distance
6501    /// from given address respectively.
6502    ///
6503    /// Sets the *order by* query property to the given value.
6504    pub fn order_by(mut self, new_value: &str) -> CompanyGetCall<'a, C> {
6505        self._order_by = Some(new_value.to_string());
6506        self
6507    }
6508    /// If the company's budget is in a different currency code than this one, then
6509    /// the converted budget is converted to this currency code.
6510    ///
6511    /// Sets the *currency code* query property to the given value.
6512    pub fn currency_code(mut self, new_value: &str) -> CompanyGetCall<'a, C> {
6513        self._currency_code = Some(new_value.to_string());
6514        self
6515    }
6516    /// The address to use for sorting the company's addresses by proximity.
6517    /// If not given, the geo-located address of the request is used.
6518    /// Used when order_by is set.
6519    ///
6520    /// Sets the *address* query property to the given value.
6521    pub fn address(mut self, new_value: &str) -> CompanyGetCall<'a, C> {
6522        self._address = Some(new_value.to_string());
6523        self
6524    }
6525    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6526    /// while executing the actual API request.
6527    ///
6528    /// ````text
6529    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6530    /// ````
6531    ///
6532    /// Sets the *delegate* property to the given value.
6533    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CompanyGetCall<'a, C> {
6534        self._delegate = Some(new_value);
6535        self
6536    }
6537
6538    /// Set any additional parameter of the query string used in the request.
6539    /// It should be used to set parameters which are not yet available through their own
6540    /// setters.
6541    ///
6542    /// Please note that this method must not be used to set any of the known parameters
6543    /// which have their own setter method. If done anyway, the request will fail.
6544    ///
6545    /// # Additional Parameters
6546    ///
6547    /// * *alt* (query-string) - Data format for response.
6548    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6549    /// * *access_token* (query-string) - OAuth access token.
6550    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6551    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6552    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6553    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6554    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6555    /// * *$.xgafv* (query-string) - V1 error format.
6556    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6557    /// * *callback* (query-string) - JSONP
6558    pub fn param<T>(mut self, name: T, value: T) -> CompanyGetCall<'a, C>
6559    where
6560        T: AsRef<str>,
6561    {
6562        self._additional_params
6563            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6564        self
6565    }
6566}
6567
6568/// Lists companies.
6569///
6570/// A builder for the *list* method supported by a *company* resource.
6571/// It is not used directly, but through a [`CompanyMethods`] instance.
6572///
6573/// # Example
6574///
6575/// Instantiate a resource method builder
6576///
6577/// ```test_harness,no_run
6578/// # extern crate hyper;
6579/// # extern crate hyper_rustls;
6580/// # extern crate google_partners2 as partners2;
6581/// # async fn dox() {
6582/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6583///
6584/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6585/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6586/// #     secret,
6587/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6588/// # ).build().await.unwrap();
6589///
6590/// # let client = hyper_util::client::legacy::Client::builder(
6591/// #     hyper_util::rt::TokioExecutor::new()
6592/// # )
6593/// # .build(
6594/// #     hyper_rustls::HttpsConnectorBuilder::new()
6595/// #         .with_native_roots()
6596/// #         .unwrap()
6597/// #         .https_or_http()
6598/// #         .enable_http1()
6599/// #         .build()
6600/// # );
6601/// # let mut hub = Partners::new(client, auth);
6602/// // You can configure optional parameters by calling the respective setters at will, and
6603/// // execute the final call using `doit()`.
6604/// // Values shown here are possibly random and not representative !
6605/// let result = hub.companies().list()
6606///              .website_url("sit")
6607///              .view("et")
6608///              .add_specializations("tempor")
6609///              .add_services("aliquyam")
6610///              .request_metadata_user_overrides_user_id("ipsum")
6611///              .request_metadata_user_overrides_ip_address("et")
6612///              .request_metadata_traffic_source_traffic_sub_id("sanctus")
6613///              .request_metadata_traffic_source_traffic_source_id("Lorem")
6614///              .request_metadata_partners_session_id("est")
6615///              .request_metadata_locale("sed")
6616///              .add_request_metadata_experiment_ids("diam")
6617///              .page_token("dolores")
6618///              .page_size(-69)
6619///              .order_by("et")
6620///              .min_monthly_budget_units(-93)
6621///              .min_monthly_budget_nanos(-11)
6622///              .min_monthly_budget_currency_code("et")
6623///              .max_monthly_budget_units(-94)
6624///              .max_monthly_budget_nanos(-80)
6625///              .max_monthly_budget_currency_code("no")
6626///              .add_language_codes("nonumy")
6627///              .add_industries("At")
6628///              .add_gps_motivations("sadipscing")
6629///              .company_name("aliquyam")
6630///              .address("dolores")
6631///              .doit().await;
6632/// # }
6633/// ```
6634pub struct CompanyListCall<'a, C>
6635where
6636    C: 'a,
6637{
6638    hub: &'a Partners<C>,
6639    _website_url: Option<String>,
6640    _view: Option<String>,
6641    _specializations: Vec<String>,
6642    _services: Vec<String>,
6643    _request_metadata_user_overrides_user_id: Option<String>,
6644    _request_metadata_user_overrides_ip_address: Option<String>,
6645    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
6646    _request_metadata_traffic_source_traffic_source_id: Option<String>,
6647    _request_metadata_partners_session_id: Option<String>,
6648    _request_metadata_locale: Option<String>,
6649    _request_metadata_experiment_ids: Vec<String>,
6650    _page_token: Option<String>,
6651    _page_size: Option<i32>,
6652    _order_by: Option<String>,
6653    _min_monthly_budget_units: Option<i64>,
6654    _min_monthly_budget_nanos: Option<i32>,
6655    _min_monthly_budget_currency_code: Option<String>,
6656    _max_monthly_budget_units: Option<i64>,
6657    _max_monthly_budget_nanos: Option<i32>,
6658    _max_monthly_budget_currency_code: Option<String>,
6659    _language_codes: Vec<String>,
6660    _industries: Vec<String>,
6661    _gps_motivations: Vec<String>,
6662    _company_name: Option<String>,
6663    _address: Option<String>,
6664    _delegate: Option<&'a mut dyn common::Delegate>,
6665    _additional_params: HashMap<String, String>,
6666}
6667
6668impl<'a, C> common::CallBuilder for CompanyListCall<'a, C> {}
6669
6670impl<'a, C> CompanyListCall<'a, C>
6671where
6672    C: common::Connector,
6673{
6674    /// Perform the operation you have build so far.
6675    pub async fn doit(mut self) -> common::Result<(common::Response, ListCompaniesResponse)> {
6676        use std::borrow::Cow;
6677        use std::io::{Read, Seek};
6678
6679        use common::{url::Params, ToParts};
6680        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6681
6682        let mut dd = common::DefaultDelegate;
6683        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6684        dlg.begin(common::MethodInfo {
6685            id: "partners.companies.list",
6686            http_method: hyper::Method::GET,
6687        });
6688
6689        for &field in [
6690            "alt",
6691            "websiteUrl",
6692            "view",
6693            "specializations",
6694            "services",
6695            "requestMetadata.userOverrides.userId",
6696            "requestMetadata.userOverrides.ipAddress",
6697            "requestMetadata.trafficSource.trafficSubId",
6698            "requestMetadata.trafficSource.trafficSourceId",
6699            "requestMetadata.partnersSessionId",
6700            "requestMetadata.locale",
6701            "requestMetadata.experimentIds",
6702            "pageToken",
6703            "pageSize",
6704            "orderBy",
6705            "minMonthlyBudget.units",
6706            "minMonthlyBudget.nanos",
6707            "minMonthlyBudget.currencyCode",
6708            "maxMonthlyBudget.units",
6709            "maxMonthlyBudget.nanos",
6710            "maxMonthlyBudget.currencyCode",
6711            "languageCodes",
6712            "industries",
6713            "gpsMotivations",
6714            "companyName",
6715            "address",
6716        ]
6717        .iter()
6718        {
6719            if self._additional_params.contains_key(field) {
6720                dlg.finished(false);
6721                return Err(common::Error::FieldClash(field));
6722            }
6723        }
6724
6725        let mut params = Params::with_capacity(27 + self._additional_params.len());
6726        if let Some(value) = self._website_url.as_ref() {
6727            params.push("websiteUrl", value);
6728        }
6729        if let Some(value) = self._view.as_ref() {
6730            params.push("view", value);
6731        }
6732        if !self._specializations.is_empty() {
6733            for f in self._specializations.iter() {
6734                params.push("specializations", f);
6735            }
6736        }
6737        if !self._services.is_empty() {
6738            for f in self._services.iter() {
6739                params.push("services", f);
6740            }
6741        }
6742        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
6743            params.push("requestMetadata.userOverrides.userId", value);
6744        }
6745        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
6746            params.push("requestMetadata.userOverrides.ipAddress", value);
6747        }
6748        if let Some(value) = self
6749            ._request_metadata_traffic_source_traffic_sub_id
6750            .as_ref()
6751        {
6752            params.push("requestMetadata.trafficSource.trafficSubId", value);
6753        }
6754        if let Some(value) = self
6755            ._request_metadata_traffic_source_traffic_source_id
6756            .as_ref()
6757        {
6758            params.push("requestMetadata.trafficSource.trafficSourceId", value);
6759        }
6760        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
6761            params.push("requestMetadata.partnersSessionId", value);
6762        }
6763        if let Some(value) = self._request_metadata_locale.as_ref() {
6764            params.push("requestMetadata.locale", value);
6765        }
6766        if !self._request_metadata_experiment_ids.is_empty() {
6767            for f in self._request_metadata_experiment_ids.iter() {
6768                params.push("requestMetadata.experimentIds", f);
6769            }
6770        }
6771        if let Some(value) = self._page_token.as_ref() {
6772            params.push("pageToken", value);
6773        }
6774        if let Some(value) = self._page_size.as_ref() {
6775            params.push("pageSize", value.to_string());
6776        }
6777        if let Some(value) = self._order_by.as_ref() {
6778            params.push("orderBy", value);
6779        }
6780        if let Some(value) = self._min_monthly_budget_units.as_ref() {
6781            params.push("minMonthlyBudget.units", value.to_string());
6782        }
6783        if let Some(value) = self._min_monthly_budget_nanos.as_ref() {
6784            params.push("minMonthlyBudget.nanos", value.to_string());
6785        }
6786        if let Some(value) = self._min_monthly_budget_currency_code.as_ref() {
6787            params.push("minMonthlyBudget.currencyCode", value);
6788        }
6789        if let Some(value) = self._max_monthly_budget_units.as_ref() {
6790            params.push("maxMonthlyBudget.units", value.to_string());
6791        }
6792        if let Some(value) = self._max_monthly_budget_nanos.as_ref() {
6793            params.push("maxMonthlyBudget.nanos", value.to_string());
6794        }
6795        if let Some(value) = self._max_monthly_budget_currency_code.as_ref() {
6796            params.push("maxMonthlyBudget.currencyCode", value);
6797        }
6798        if !self._language_codes.is_empty() {
6799            for f in self._language_codes.iter() {
6800                params.push("languageCodes", f);
6801            }
6802        }
6803        if !self._industries.is_empty() {
6804            for f in self._industries.iter() {
6805                params.push("industries", f);
6806            }
6807        }
6808        if !self._gps_motivations.is_empty() {
6809            for f in self._gps_motivations.iter() {
6810                params.push("gpsMotivations", f);
6811            }
6812        }
6813        if let Some(value) = self._company_name.as_ref() {
6814            params.push("companyName", value);
6815        }
6816        if let Some(value) = self._address.as_ref() {
6817            params.push("address", value);
6818        }
6819
6820        params.extend(self._additional_params.iter());
6821
6822        params.push("alt", "json");
6823        let mut url = self.hub._base_url.clone() + "v2/companies";
6824
6825        match dlg.api_key() {
6826            Some(value) => params.push("key", value),
6827            None => {
6828                dlg.finished(false);
6829                return Err(common::Error::MissingAPIKey);
6830            }
6831        }
6832
6833        let url = params.parse_with_url(&url);
6834
6835        loop {
6836            let mut req_result = {
6837                let client = &self.hub.client;
6838                dlg.pre_request();
6839                let mut req_builder = hyper::Request::builder()
6840                    .method(hyper::Method::GET)
6841                    .uri(url.as_str())
6842                    .header(USER_AGENT, self.hub._user_agent.clone());
6843
6844                let request = req_builder
6845                    .header(CONTENT_LENGTH, 0_u64)
6846                    .body(common::to_body::<String>(None));
6847
6848                client.request(request.unwrap()).await
6849            };
6850
6851            match req_result {
6852                Err(err) => {
6853                    if let common::Retry::After(d) = dlg.http_error(&err) {
6854                        sleep(d).await;
6855                        continue;
6856                    }
6857                    dlg.finished(false);
6858                    return Err(common::Error::HttpError(err));
6859                }
6860                Ok(res) => {
6861                    let (mut parts, body) = res.into_parts();
6862                    let mut body = common::Body::new(body);
6863                    if !parts.status.is_success() {
6864                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6865                        let error = serde_json::from_str(&common::to_string(&bytes));
6866                        let response = common::to_response(parts, bytes.into());
6867
6868                        if let common::Retry::After(d) =
6869                            dlg.http_failure(&response, error.as_ref().ok())
6870                        {
6871                            sleep(d).await;
6872                            continue;
6873                        }
6874
6875                        dlg.finished(false);
6876
6877                        return Err(match error {
6878                            Ok(value) => common::Error::BadRequest(value),
6879                            _ => common::Error::Failure(response),
6880                        });
6881                    }
6882                    let response = {
6883                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6884                        let encoded = common::to_string(&bytes);
6885                        match serde_json::from_str(&encoded) {
6886                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6887                            Err(error) => {
6888                                dlg.response_json_decode_error(&encoded, &error);
6889                                return Err(common::Error::JsonDecodeError(
6890                                    encoded.to_string(),
6891                                    error,
6892                                ));
6893                            }
6894                        }
6895                    };
6896
6897                    dlg.finished(true);
6898                    return Ok(response);
6899                }
6900            }
6901        }
6902    }
6903
6904    /// Website URL that will help to find a better matched company.
6905    /// .
6906    ///
6907    /// Sets the *website url* query property to the given value.
6908    pub fn website_url(mut self, new_value: &str) -> CompanyListCall<'a, C> {
6909        self._website_url = Some(new_value.to_string());
6910        self
6911    }
6912    /// The view of the `Company` resource to be returned. This must not be
6913    /// `COMPANY_VIEW_UNSPECIFIED`.
6914    ///
6915    /// Sets the *view* query property to the given value.
6916    pub fn view(mut self, new_value: &str) -> CompanyListCall<'a, C> {
6917        self._view = Some(new_value.to_string());
6918        self
6919    }
6920    /// List of specializations that the returned agencies should provide. If this
6921    /// is not empty, any returned agency must have at least one of these
6922    /// specializations, or one of the services in the "services" field.
6923    ///
6924    /// Append the given value to the *specializations* query property.
6925    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6926    pub fn add_specializations(mut self, new_value: &str) -> CompanyListCall<'a, C> {
6927        self._specializations.push(new_value.to_string());
6928        self
6929    }
6930    /// List of services that the returned agencies should provide. If this is
6931    /// not empty, any returned agency must have at least one of these services,
6932    /// or one of the specializations in the "specializations" field.
6933    ///
6934    /// Append the given value to the *services* query property.
6935    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6936    pub fn add_services(mut self, new_value: &str) -> CompanyListCall<'a, C> {
6937        self._services.push(new_value.to_string());
6938        self
6939    }
6940    /// Logged-in user ID to impersonate instead of the user's ID.
6941    ///
6942    /// Sets the *request metadata.user overrides.user id* query property to the given value.
6943    pub fn request_metadata_user_overrides_user_id(
6944        mut self,
6945        new_value: &str,
6946    ) -> CompanyListCall<'a, C> {
6947        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
6948        self
6949    }
6950    /// IP address to use instead of the user's geo-located IP address.
6951    ///
6952    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
6953    pub fn request_metadata_user_overrides_ip_address(
6954        mut self,
6955        new_value: &str,
6956    ) -> CompanyListCall<'a, C> {
6957        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
6958        self
6959    }
6960    /// Second level identifier to indicate where the traffic comes from.
6961    /// An identifier has multiple letters created by a team which redirected the
6962    /// traffic to us.
6963    ///
6964    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
6965    pub fn request_metadata_traffic_source_traffic_sub_id(
6966        mut self,
6967        new_value: &str,
6968    ) -> CompanyListCall<'a, C> {
6969        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
6970        self
6971    }
6972    /// Identifier to indicate where the traffic comes from.
6973    /// An identifier has multiple letters created by a team which redirected the
6974    /// traffic to us.
6975    ///
6976    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
6977    pub fn request_metadata_traffic_source_traffic_source_id(
6978        mut self,
6979        new_value: &str,
6980    ) -> CompanyListCall<'a, C> {
6981        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
6982        self
6983    }
6984    /// Google Partners session ID.
6985    ///
6986    /// Sets the *request metadata.partners session id* query property to the given value.
6987    pub fn request_metadata_partners_session_id(
6988        mut self,
6989        new_value: &str,
6990    ) -> CompanyListCall<'a, C> {
6991        self._request_metadata_partners_session_id = Some(new_value.to_string());
6992        self
6993    }
6994    /// Locale to use for the current request.
6995    ///
6996    /// Sets the *request metadata.locale* query property to the given value.
6997    pub fn request_metadata_locale(mut self, new_value: &str) -> CompanyListCall<'a, C> {
6998        self._request_metadata_locale = Some(new_value.to_string());
6999        self
7000    }
7001    /// Experiment IDs the current request belongs to.
7002    ///
7003    /// Append the given value to the *request metadata.experiment ids* query property.
7004    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7005    pub fn add_request_metadata_experiment_ids(
7006        mut self,
7007        new_value: &str,
7008    ) -> CompanyListCall<'a, C> {
7009        self._request_metadata_experiment_ids
7010            .push(new_value.to_string());
7011        self
7012    }
7013    /// A token identifying a page of results that the server returns.
7014    /// Typically, this is the value of `ListCompaniesResponse.next_page_token`
7015    /// returned from the previous call to
7016    /// ListCompanies.
7017    ///
7018    /// Sets the *page token* query property to the given value.
7019    pub fn page_token(mut self, new_value: &str) -> CompanyListCall<'a, C> {
7020        self._page_token = Some(new_value.to_string());
7021        self
7022    }
7023    /// Requested page size. Server may return fewer companies than requested.
7024    /// If unspecified, server picks an appropriate default.
7025    ///
7026    /// Sets the *page size* query property to the given value.
7027    pub fn page_size(mut self, new_value: i32) -> CompanyListCall<'a, C> {
7028        self._page_size = Some(new_value);
7029        self
7030    }
7031    /// How to order addresses within the returned companies. Currently, only
7032    /// `address` and `address desc` is supported which will sorted by closest to
7033    /// farthest in distance from given address and farthest to closest distance
7034    /// from given address respectively.
7035    ///
7036    /// Sets the *order by* query property to the given value.
7037    pub fn order_by(mut self, new_value: &str) -> CompanyListCall<'a, C> {
7038        self._order_by = Some(new_value.to_string());
7039        self
7040    }
7041    /// The whole units of the amount.
7042    /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
7043    ///
7044    /// Sets the *min monthly budget.units* query property to the given value.
7045    pub fn min_monthly_budget_units(mut self, new_value: i64) -> CompanyListCall<'a, C> {
7046        self._min_monthly_budget_units = Some(new_value);
7047        self
7048    }
7049    /// Number of nano (10^-9) units of the amount.
7050    /// The value must be between -999,999,999 and +999,999,999 inclusive.
7051    /// If `units` is positive, `nanos` must be positive or zero.
7052    /// If `units` is zero, `nanos` can be positive, zero, or negative.
7053    /// If `units` is negative, `nanos` must be negative or zero.
7054    /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
7055    ///
7056    /// Sets the *min monthly budget.nanos* query property to the given value.
7057    pub fn min_monthly_budget_nanos(mut self, new_value: i32) -> CompanyListCall<'a, C> {
7058        self._min_monthly_budget_nanos = Some(new_value);
7059        self
7060    }
7061    /// The 3-letter currency code defined in ISO 4217.
7062    ///
7063    /// Sets the *min monthly budget.currency code* query property to the given value.
7064    pub fn min_monthly_budget_currency_code(mut self, new_value: &str) -> CompanyListCall<'a, C> {
7065        self._min_monthly_budget_currency_code = Some(new_value.to_string());
7066        self
7067    }
7068    /// The whole units of the amount.
7069    /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
7070    ///
7071    /// Sets the *max monthly budget.units* query property to the given value.
7072    pub fn max_monthly_budget_units(mut self, new_value: i64) -> CompanyListCall<'a, C> {
7073        self._max_monthly_budget_units = Some(new_value);
7074        self
7075    }
7076    /// Number of nano (10^-9) units of the amount.
7077    /// The value must be between -999,999,999 and +999,999,999 inclusive.
7078    /// If `units` is positive, `nanos` must be positive or zero.
7079    /// If `units` is zero, `nanos` can be positive, zero, or negative.
7080    /// If `units` is negative, `nanos` must be negative or zero.
7081    /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
7082    ///
7083    /// Sets the *max monthly budget.nanos* query property to the given value.
7084    pub fn max_monthly_budget_nanos(mut self, new_value: i32) -> CompanyListCall<'a, C> {
7085        self._max_monthly_budget_nanos = Some(new_value);
7086        self
7087    }
7088    /// The 3-letter currency code defined in ISO 4217.
7089    ///
7090    /// Sets the *max monthly budget.currency code* query property to the given value.
7091    pub fn max_monthly_budget_currency_code(mut self, new_value: &str) -> CompanyListCall<'a, C> {
7092        self._max_monthly_budget_currency_code = Some(new_value.to_string());
7093        self
7094    }
7095    /// List of language codes that company can support. Only primary language
7096    /// subtags are accepted as defined by
7097    /// <a href="https://tools.ietf.org/html/bcp47">BCP 47</a>
7098    /// (IETF BCP 47, "Tags for Identifying Languages").
7099    ///
7100    /// Append the given value to the *language codes* query property.
7101    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7102    pub fn add_language_codes(mut self, new_value: &str) -> CompanyListCall<'a, C> {
7103        self._language_codes.push(new_value.to_string());
7104        self
7105    }
7106    /// List of industries the company can help with.
7107    ///
7108    /// Append the given value to the *industries* query property.
7109    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7110    pub fn add_industries(mut self, new_value: &str) -> CompanyListCall<'a, C> {
7111        self._industries.push(new_value.to_string());
7112        self
7113    }
7114    /// List of reasons for using Google Partner Search to get companies.
7115    ///
7116    /// Append the given value to the *gps motivations* query property.
7117    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7118    pub fn add_gps_motivations(mut self, new_value: &str) -> CompanyListCall<'a, C> {
7119        self._gps_motivations.push(new_value.to_string());
7120        self
7121    }
7122    /// Company name to search for.
7123    ///
7124    /// Sets the *company name* query property to the given value.
7125    pub fn company_name(mut self, new_value: &str) -> CompanyListCall<'a, C> {
7126        self._company_name = Some(new_value.to_string());
7127        self
7128    }
7129    /// The address to use when searching for companies.
7130    /// If not given, the geo-located address of the request is used.
7131    ///
7132    /// Sets the *address* query property to the given value.
7133    pub fn address(mut self, new_value: &str) -> CompanyListCall<'a, C> {
7134        self._address = Some(new_value.to_string());
7135        self
7136    }
7137    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7138    /// while executing the actual API request.
7139    ///
7140    /// ````text
7141    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7142    /// ````
7143    ///
7144    /// Sets the *delegate* property to the given value.
7145    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CompanyListCall<'a, C> {
7146        self._delegate = Some(new_value);
7147        self
7148    }
7149
7150    /// Set any additional parameter of the query string used in the request.
7151    /// It should be used to set parameters which are not yet available through their own
7152    /// setters.
7153    ///
7154    /// Please note that this method must not be used to set any of the known parameters
7155    /// which have their own setter method. If done anyway, the request will fail.
7156    ///
7157    /// # Additional Parameters
7158    ///
7159    /// * *alt* (query-string) - Data format for response.
7160    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7161    /// * *access_token* (query-string) - OAuth access token.
7162    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7163    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7164    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7165    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7166    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7167    /// * *$.xgafv* (query-string) - V1 error format.
7168    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7169    /// * *callback* (query-string) - JSONP
7170    pub fn param<T>(mut self, name: T, value: T) -> CompanyListCall<'a, C>
7171    where
7172        T: AsRef<str>,
7173    {
7174        self._additional_params
7175            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7176        self
7177    }
7178}
7179
7180/// Updates a user's profile. A user can only update their own profile and
7181/// should only be called within the context of a logged in user.
7182///
7183/// A builder for the *updateProfile* method supported by a *user* resource.
7184/// It is not used directly, but through a [`UserMethods`] instance.
7185///
7186/// # Example
7187///
7188/// Instantiate a resource method builder
7189///
7190/// ```test_harness,no_run
7191/// # extern crate hyper;
7192/// # extern crate hyper_rustls;
7193/// # extern crate google_partners2 as partners2;
7194/// use partners2::api::UserProfile;
7195/// # async fn dox() {
7196/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7197///
7198/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7199/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7200/// #     secret,
7201/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7202/// # ).build().await.unwrap();
7203///
7204/// # let client = hyper_util::client::legacy::Client::builder(
7205/// #     hyper_util::rt::TokioExecutor::new()
7206/// # )
7207/// # .build(
7208/// #     hyper_rustls::HttpsConnectorBuilder::new()
7209/// #         .with_native_roots()
7210/// #         .unwrap()
7211/// #         .https_or_http()
7212/// #         .enable_http1()
7213/// #         .build()
7214/// # );
7215/// # let mut hub = Partners::new(client, auth);
7216/// // As the method needs a request, you would usually fill it with the desired information
7217/// // into the respective structure. Some of the parts shown here might not be applicable !
7218/// // Values shown here are possibly random and not representative !
7219/// let mut req = UserProfile::default();
7220///
7221/// // You can configure optional parameters by calling the respective setters at will, and
7222/// // execute the final call using `doit()`.
7223/// // Values shown here are possibly random and not representative !
7224/// let result = hub.users().update_profile(req)
7225///              .request_metadata_user_overrides_user_id("sadipscing")
7226///              .request_metadata_user_overrides_ip_address("erat")
7227///              .request_metadata_traffic_source_traffic_sub_id("aliquyam")
7228///              .request_metadata_traffic_source_traffic_source_id("amet")
7229///              .request_metadata_partners_session_id("est")
7230///              .request_metadata_locale("et")
7231///              .add_request_metadata_experiment_ids("sea")
7232///              .doit().await;
7233/// # }
7234/// ```
7235pub struct UserUpdateProfileCall<'a, C>
7236where
7237    C: 'a,
7238{
7239    hub: &'a Partners<C>,
7240    _request: UserProfile,
7241    _request_metadata_user_overrides_user_id: Option<String>,
7242    _request_metadata_user_overrides_ip_address: Option<String>,
7243    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
7244    _request_metadata_traffic_source_traffic_source_id: Option<String>,
7245    _request_metadata_partners_session_id: Option<String>,
7246    _request_metadata_locale: Option<String>,
7247    _request_metadata_experiment_ids: Vec<String>,
7248    _delegate: Option<&'a mut dyn common::Delegate>,
7249    _additional_params: HashMap<String, String>,
7250}
7251
7252impl<'a, C> common::CallBuilder for UserUpdateProfileCall<'a, C> {}
7253
7254impl<'a, C> UserUpdateProfileCall<'a, C>
7255where
7256    C: common::Connector,
7257{
7258    /// Perform the operation you have build so far.
7259    pub async fn doit(mut self) -> common::Result<(common::Response, UserProfile)> {
7260        use std::borrow::Cow;
7261        use std::io::{Read, Seek};
7262
7263        use common::{url::Params, ToParts};
7264        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7265
7266        let mut dd = common::DefaultDelegate;
7267        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7268        dlg.begin(common::MethodInfo {
7269            id: "partners.users.updateProfile",
7270            http_method: hyper::Method::PATCH,
7271        });
7272
7273        for &field in [
7274            "alt",
7275            "requestMetadata.userOverrides.userId",
7276            "requestMetadata.userOverrides.ipAddress",
7277            "requestMetadata.trafficSource.trafficSubId",
7278            "requestMetadata.trafficSource.trafficSourceId",
7279            "requestMetadata.partnersSessionId",
7280            "requestMetadata.locale",
7281            "requestMetadata.experimentIds",
7282        ]
7283        .iter()
7284        {
7285            if self._additional_params.contains_key(field) {
7286                dlg.finished(false);
7287                return Err(common::Error::FieldClash(field));
7288            }
7289        }
7290
7291        let mut params = Params::with_capacity(10 + self._additional_params.len());
7292        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
7293            params.push("requestMetadata.userOverrides.userId", value);
7294        }
7295        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
7296            params.push("requestMetadata.userOverrides.ipAddress", value);
7297        }
7298        if let Some(value) = self
7299            ._request_metadata_traffic_source_traffic_sub_id
7300            .as_ref()
7301        {
7302            params.push("requestMetadata.trafficSource.trafficSubId", value);
7303        }
7304        if let Some(value) = self
7305            ._request_metadata_traffic_source_traffic_source_id
7306            .as_ref()
7307        {
7308            params.push("requestMetadata.trafficSource.trafficSourceId", value);
7309        }
7310        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
7311            params.push("requestMetadata.partnersSessionId", value);
7312        }
7313        if let Some(value) = self._request_metadata_locale.as_ref() {
7314            params.push("requestMetadata.locale", value);
7315        }
7316        if !self._request_metadata_experiment_ids.is_empty() {
7317            for f in self._request_metadata_experiment_ids.iter() {
7318                params.push("requestMetadata.experimentIds", f);
7319            }
7320        }
7321
7322        params.extend(self._additional_params.iter());
7323
7324        params.push("alt", "json");
7325        let mut url = self.hub._base_url.clone() + "v2/users/profile";
7326
7327        match dlg.api_key() {
7328            Some(value) => params.push("key", value),
7329            None => {
7330                dlg.finished(false);
7331                return Err(common::Error::MissingAPIKey);
7332            }
7333        }
7334
7335        let url = params.parse_with_url(&url);
7336
7337        let mut json_mime_type = mime::APPLICATION_JSON;
7338        let mut request_value_reader = {
7339            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7340            common::remove_json_null_values(&mut value);
7341            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7342            serde_json::to_writer(&mut dst, &value).unwrap();
7343            dst
7344        };
7345        let request_size = request_value_reader
7346            .seek(std::io::SeekFrom::End(0))
7347            .unwrap();
7348        request_value_reader
7349            .seek(std::io::SeekFrom::Start(0))
7350            .unwrap();
7351
7352        loop {
7353            request_value_reader
7354                .seek(std::io::SeekFrom::Start(0))
7355                .unwrap();
7356            let mut req_result = {
7357                let client = &self.hub.client;
7358                dlg.pre_request();
7359                let mut req_builder = hyper::Request::builder()
7360                    .method(hyper::Method::PATCH)
7361                    .uri(url.as_str())
7362                    .header(USER_AGENT, self.hub._user_agent.clone());
7363
7364                let request = req_builder
7365                    .header(CONTENT_TYPE, json_mime_type.to_string())
7366                    .header(CONTENT_LENGTH, request_size as u64)
7367                    .body(common::to_body(
7368                        request_value_reader.get_ref().clone().into(),
7369                    ));
7370
7371                client.request(request.unwrap()).await
7372            };
7373
7374            match req_result {
7375                Err(err) => {
7376                    if let common::Retry::After(d) = dlg.http_error(&err) {
7377                        sleep(d).await;
7378                        continue;
7379                    }
7380                    dlg.finished(false);
7381                    return Err(common::Error::HttpError(err));
7382                }
7383                Ok(res) => {
7384                    let (mut parts, body) = res.into_parts();
7385                    let mut body = common::Body::new(body);
7386                    if !parts.status.is_success() {
7387                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7388                        let error = serde_json::from_str(&common::to_string(&bytes));
7389                        let response = common::to_response(parts, bytes.into());
7390
7391                        if let common::Retry::After(d) =
7392                            dlg.http_failure(&response, error.as_ref().ok())
7393                        {
7394                            sleep(d).await;
7395                            continue;
7396                        }
7397
7398                        dlg.finished(false);
7399
7400                        return Err(match error {
7401                            Ok(value) => common::Error::BadRequest(value),
7402                            _ => common::Error::Failure(response),
7403                        });
7404                    }
7405                    let response = {
7406                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7407                        let encoded = common::to_string(&bytes);
7408                        match serde_json::from_str(&encoded) {
7409                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7410                            Err(error) => {
7411                                dlg.response_json_decode_error(&encoded, &error);
7412                                return Err(common::Error::JsonDecodeError(
7413                                    encoded.to_string(),
7414                                    error,
7415                                ));
7416                            }
7417                        }
7418                    };
7419
7420                    dlg.finished(true);
7421                    return Ok(response);
7422                }
7423            }
7424        }
7425    }
7426
7427    ///
7428    /// Sets the *request* property to the given value.
7429    ///
7430    /// Even though the property as already been set when instantiating this call,
7431    /// we provide this method for API completeness.
7432    pub fn request(mut self, new_value: UserProfile) -> UserUpdateProfileCall<'a, C> {
7433        self._request = new_value;
7434        self
7435    }
7436    /// Logged-in user ID to impersonate instead of the user's ID.
7437    ///
7438    /// Sets the *request metadata.user overrides.user id* query property to the given value.
7439    pub fn request_metadata_user_overrides_user_id(
7440        mut self,
7441        new_value: &str,
7442    ) -> UserUpdateProfileCall<'a, C> {
7443        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
7444        self
7445    }
7446    /// IP address to use instead of the user's geo-located IP address.
7447    ///
7448    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
7449    pub fn request_metadata_user_overrides_ip_address(
7450        mut self,
7451        new_value: &str,
7452    ) -> UserUpdateProfileCall<'a, C> {
7453        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
7454        self
7455    }
7456    /// Second level identifier to indicate where the traffic comes from.
7457    /// An identifier has multiple letters created by a team which redirected the
7458    /// traffic to us.
7459    ///
7460    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
7461    pub fn request_metadata_traffic_source_traffic_sub_id(
7462        mut self,
7463        new_value: &str,
7464    ) -> UserUpdateProfileCall<'a, C> {
7465        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
7466        self
7467    }
7468    /// Identifier to indicate where the traffic comes from.
7469    /// An identifier has multiple letters created by a team which redirected the
7470    /// traffic to us.
7471    ///
7472    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
7473    pub fn request_metadata_traffic_source_traffic_source_id(
7474        mut self,
7475        new_value: &str,
7476    ) -> UserUpdateProfileCall<'a, C> {
7477        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
7478        self
7479    }
7480    /// Google Partners session ID.
7481    ///
7482    /// Sets the *request metadata.partners session id* query property to the given value.
7483    pub fn request_metadata_partners_session_id(
7484        mut self,
7485        new_value: &str,
7486    ) -> UserUpdateProfileCall<'a, C> {
7487        self._request_metadata_partners_session_id = Some(new_value.to_string());
7488        self
7489    }
7490    /// Locale to use for the current request.
7491    ///
7492    /// Sets the *request metadata.locale* query property to the given value.
7493    pub fn request_metadata_locale(mut self, new_value: &str) -> UserUpdateProfileCall<'a, C> {
7494        self._request_metadata_locale = Some(new_value.to_string());
7495        self
7496    }
7497    /// Experiment IDs the current request belongs to.
7498    ///
7499    /// Append the given value to the *request metadata.experiment ids* query property.
7500    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7501    pub fn add_request_metadata_experiment_ids(
7502        mut self,
7503        new_value: &str,
7504    ) -> UserUpdateProfileCall<'a, C> {
7505        self._request_metadata_experiment_ids
7506            .push(new_value.to_string());
7507        self
7508    }
7509    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7510    /// while executing the actual API request.
7511    ///
7512    /// ````text
7513    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7514    /// ````
7515    ///
7516    /// Sets the *delegate* property to the given value.
7517    pub fn delegate(
7518        mut self,
7519        new_value: &'a mut dyn common::Delegate,
7520    ) -> UserUpdateProfileCall<'a, C> {
7521        self._delegate = Some(new_value);
7522        self
7523    }
7524
7525    /// Set any additional parameter of the query string used in the request.
7526    /// It should be used to set parameters which are not yet available through their own
7527    /// setters.
7528    ///
7529    /// Please note that this method must not be used to set any of the known parameters
7530    /// which have their own setter method. If done anyway, the request will fail.
7531    ///
7532    /// # Additional Parameters
7533    ///
7534    /// * *alt* (query-string) - Data format for response.
7535    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7536    /// * *access_token* (query-string) - OAuth access token.
7537    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7538    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7539    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7540    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7541    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7542    /// * *$.xgafv* (query-string) - V1 error format.
7543    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7544    /// * *callback* (query-string) - JSONP
7545    pub fn param<T>(mut self, name: T, value: T) -> UserUpdateProfileCall<'a, C>
7546    where
7547        T: AsRef<str>,
7548    {
7549        self._additional_params
7550            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7551        self
7552    }
7553}
7554
7555/// Creates a user's company relation. Affiliates the user to a company.
7556///
7557/// A builder for the *createCompanyRelation* method supported by a *user* resource.
7558/// It is not used directly, but through a [`UserMethods`] instance.
7559///
7560/// # Example
7561///
7562/// Instantiate a resource method builder
7563///
7564/// ```test_harness,no_run
7565/// # extern crate hyper;
7566/// # extern crate hyper_rustls;
7567/// # extern crate google_partners2 as partners2;
7568/// use partners2::api::CompanyRelation;
7569/// # async fn dox() {
7570/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7571///
7572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7573/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7574/// #     secret,
7575/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7576/// # ).build().await.unwrap();
7577///
7578/// # let client = hyper_util::client::legacy::Client::builder(
7579/// #     hyper_util::rt::TokioExecutor::new()
7580/// # )
7581/// # .build(
7582/// #     hyper_rustls::HttpsConnectorBuilder::new()
7583/// #         .with_native_roots()
7584/// #         .unwrap()
7585/// #         .https_or_http()
7586/// #         .enable_http1()
7587/// #         .build()
7588/// # );
7589/// # let mut hub = Partners::new(client, auth);
7590/// // As the method needs a request, you would usually fill it with the desired information
7591/// // into the respective structure. Some of the parts shown here might not be applicable !
7592/// // Values shown here are possibly random and not representative !
7593/// let mut req = CompanyRelation::default();
7594///
7595/// // You can configure optional parameters by calling the respective setters at will, and
7596/// // execute the final call using `doit()`.
7597/// // Values shown here are possibly random and not representative !
7598/// let result = hub.users().create_company_relation(req, "userId")
7599///              .request_metadata_user_overrides_user_id("consetetur")
7600///              .request_metadata_user_overrides_ip_address("Stet")
7601///              .request_metadata_traffic_source_traffic_sub_id("est")
7602///              .request_metadata_traffic_source_traffic_source_id("aliquyam")
7603///              .request_metadata_partners_session_id("elitr")
7604///              .request_metadata_locale("duo")
7605///              .add_request_metadata_experiment_ids("diam")
7606///              .doit().await;
7607/// # }
7608/// ```
7609pub struct UserCreateCompanyRelationCall<'a, C>
7610where
7611    C: 'a,
7612{
7613    hub: &'a Partners<C>,
7614    _request: CompanyRelation,
7615    _user_id: String,
7616    _request_metadata_user_overrides_user_id: Option<String>,
7617    _request_metadata_user_overrides_ip_address: Option<String>,
7618    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
7619    _request_metadata_traffic_source_traffic_source_id: Option<String>,
7620    _request_metadata_partners_session_id: Option<String>,
7621    _request_metadata_locale: Option<String>,
7622    _request_metadata_experiment_ids: Vec<String>,
7623    _delegate: Option<&'a mut dyn common::Delegate>,
7624    _additional_params: HashMap<String, String>,
7625}
7626
7627impl<'a, C> common::CallBuilder for UserCreateCompanyRelationCall<'a, C> {}
7628
7629impl<'a, C> UserCreateCompanyRelationCall<'a, C>
7630where
7631    C: common::Connector,
7632{
7633    /// Perform the operation you have build so far.
7634    pub async fn doit(mut self) -> common::Result<(common::Response, CompanyRelation)> {
7635        use std::borrow::Cow;
7636        use std::io::{Read, Seek};
7637
7638        use common::{url::Params, ToParts};
7639        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7640
7641        let mut dd = common::DefaultDelegate;
7642        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7643        dlg.begin(common::MethodInfo {
7644            id: "partners.users.createCompanyRelation",
7645            http_method: hyper::Method::PUT,
7646        });
7647
7648        for &field in [
7649            "alt",
7650            "userId",
7651            "requestMetadata.userOverrides.userId",
7652            "requestMetadata.userOverrides.ipAddress",
7653            "requestMetadata.trafficSource.trafficSubId",
7654            "requestMetadata.trafficSource.trafficSourceId",
7655            "requestMetadata.partnersSessionId",
7656            "requestMetadata.locale",
7657            "requestMetadata.experimentIds",
7658        ]
7659        .iter()
7660        {
7661            if self._additional_params.contains_key(field) {
7662                dlg.finished(false);
7663                return Err(common::Error::FieldClash(field));
7664            }
7665        }
7666
7667        let mut params = Params::with_capacity(11 + self._additional_params.len());
7668        params.push("userId", self._user_id);
7669        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
7670            params.push("requestMetadata.userOverrides.userId", value);
7671        }
7672        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
7673            params.push("requestMetadata.userOverrides.ipAddress", value);
7674        }
7675        if let Some(value) = self
7676            ._request_metadata_traffic_source_traffic_sub_id
7677            .as_ref()
7678        {
7679            params.push("requestMetadata.trafficSource.trafficSubId", value);
7680        }
7681        if let Some(value) = self
7682            ._request_metadata_traffic_source_traffic_source_id
7683            .as_ref()
7684        {
7685            params.push("requestMetadata.trafficSource.trafficSourceId", value);
7686        }
7687        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
7688            params.push("requestMetadata.partnersSessionId", value);
7689        }
7690        if let Some(value) = self._request_metadata_locale.as_ref() {
7691            params.push("requestMetadata.locale", value);
7692        }
7693        if !self._request_metadata_experiment_ids.is_empty() {
7694            for f in self._request_metadata_experiment_ids.iter() {
7695                params.push("requestMetadata.experimentIds", f);
7696            }
7697        }
7698
7699        params.extend(self._additional_params.iter());
7700
7701        params.push("alt", "json");
7702        let mut url = self.hub._base_url.clone() + "v2/users/{userId}/companyRelation";
7703
7704        match dlg.api_key() {
7705            Some(value) => params.push("key", value),
7706            None => {
7707                dlg.finished(false);
7708                return Err(common::Error::MissingAPIKey);
7709            }
7710        }
7711
7712        #[allow(clippy::single_element_loop)]
7713        for &(find_this, param_name) in [("{userId}", "userId")].iter() {
7714            url = params.uri_replacement(url, param_name, find_this, false);
7715        }
7716        {
7717            let to_remove = ["userId"];
7718            params.remove_params(&to_remove);
7719        }
7720
7721        let url = params.parse_with_url(&url);
7722
7723        let mut json_mime_type = mime::APPLICATION_JSON;
7724        let mut request_value_reader = {
7725            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7726            common::remove_json_null_values(&mut value);
7727            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7728            serde_json::to_writer(&mut dst, &value).unwrap();
7729            dst
7730        };
7731        let request_size = request_value_reader
7732            .seek(std::io::SeekFrom::End(0))
7733            .unwrap();
7734        request_value_reader
7735            .seek(std::io::SeekFrom::Start(0))
7736            .unwrap();
7737
7738        loop {
7739            request_value_reader
7740                .seek(std::io::SeekFrom::Start(0))
7741                .unwrap();
7742            let mut req_result = {
7743                let client = &self.hub.client;
7744                dlg.pre_request();
7745                let mut req_builder = hyper::Request::builder()
7746                    .method(hyper::Method::PUT)
7747                    .uri(url.as_str())
7748                    .header(USER_AGENT, self.hub._user_agent.clone());
7749
7750                let request = req_builder
7751                    .header(CONTENT_TYPE, json_mime_type.to_string())
7752                    .header(CONTENT_LENGTH, request_size as u64)
7753                    .body(common::to_body(
7754                        request_value_reader.get_ref().clone().into(),
7755                    ));
7756
7757                client.request(request.unwrap()).await
7758            };
7759
7760            match req_result {
7761                Err(err) => {
7762                    if let common::Retry::After(d) = dlg.http_error(&err) {
7763                        sleep(d).await;
7764                        continue;
7765                    }
7766                    dlg.finished(false);
7767                    return Err(common::Error::HttpError(err));
7768                }
7769                Ok(res) => {
7770                    let (mut parts, body) = res.into_parts();
7771                    let mut body = common::Body::new(body);
7772                    if !parts.status.is_success() {
7773                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7774                        let error = serde_json::from_str(&common::to_string(&bytes));
7775                        let response = common::to_response(parts, bytes.into());
7776
7777                        if let common::Retry::After(d) =
7778                            dlg.http_failure(&response, error.as_ref().ok())
7779                        {
7780                            sleep(d).await;
7781                            continue;
7782                        }
7783
7784                        dlg.finished(false);
7785
7786                        return Err(match error {
7787                            Ok(value) => common::Error::BadRequest(value),
7788                            _ => common::Error::Failure(response),
7789                        });
7790                    }
7791                    let response = {
7792                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7793                        let encoded = common::to_string(&bytes);
7794                        match serde_json::from_str(&encoded) {
7795                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7796                            Err(error) => {
7797                                dlg.response_json_decode_error(&encoded, &error);
7798                                return Err(common::Error::JsonDecodeError(
7799                                    encoded.to_string(),
7800                                    error,
7801                                ));
7802                            }
7803                        }
7804                    };
7805
7806                    dlg.finished(true);
7807                    return Ok(response);
7808                }
7809            }
7810        }
7811    }
7812
7813    ///
7814    /// Sets the *request* property to the given value.
7815    ///
7816    /// Even though the property as already been set when instantiating this call,
7817    /// we provide this method for API completeness.
7818    pub fn request(mut self, new_value: CompanyRelation) -> UserCreateCompanyRelationCall<'a, C> {
7819        self._request = new_value;
7820        self
7821    }
7822    /// The ID of the user. Can be set to <code>me</code> to mean
7823    /// the currently authenticated user.
7824    ///
7825    /// Sets the *user id* path property to the given value.
7826    ///
7827    /// Even though the property as already been set when instantiating this call,
7828    /// we provide this method for API completeness.
7829    pub fn user_id(mut self, new_value: &str) -> UserCreateCompanyRelationCall<'a, C> {
7830        self._user_id = new_value.to_string();
7831        self
7832    }
7833    /// Logged-in user ID to impersonate instead of the user's ID.
7834    ///
7835    /// Sets the *request metadata.user overrides.user id* query property to the given value.
7836    pub fn request_metadata_user_overrides_user_id(
7837        mut self,
7838        new_value: &str,
7839    ) -> UserCreateCompanyRelationCall<'a, C> {
7840        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
7841        self
7842    }
7843    /// IP address to use instead of the user's geo-located IP address.
7844    ///
7845    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
7846    pub fn request_metadata_user_overrides_ip_address(
7847        mut self,
7848        new_value: &str,
7849    ) -> UserCreateCompanyRelationCall<'a, C> {
7850        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
7851        self
7852    }
7853    /// Second level identifier to indicate where the traffic comes from.
7854    /// An identifier has multiple letters created by a team which redirected the
7855    /// traffic to us.
7856    ///
7857    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
7858    pub fn request_metadata_traffic_source_traffic_sub_id(
7859        mut self,
7860        new_value: &str,
7861    ) -> UserCreateCompanyRelationCall<'a, C> {
7862        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
7863        self
7864    }
7865    /// Identifier to indicate where the traffic comes from.
7866    /// An identifier has multiple letters created by a team which redirected the
7867    /// traffic to us.
7868    ///
7869    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
7870    pub fn request_metadata_traffic_source_traffic_source_id(
7871        mut self,
7872        new_value: &str,
7873    ) -> UserCreateCompanyRelationCall<'a, C> {
7874        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
7875        self
7876    }
7877    /// Google Partners session ID.
7878    ///
7879    /// Sets the *request metadata.partners session id* query property to the given value.
7880    pub fn request_metadata_partners_session_id(
7881        mut self,
7882        new_value: &str,
7883    ) -> UserCreateCompanyRelationCall<'a, C> {
7884        self._request_metadata_partners_session_id = Some(new_value.to_string());
7885        self
7886    }
7887    /// Locale to use for the current request.
7888    ///
7889    /// Sets the *request metadata.locale* query property to the given value.
7890    pub fn request_metadata_locale(
7891        mut self,
7892        new_value: &str,
7893    ) -> UserCreateCompanyRelationCall<'a, C> {
7894        self._request_metadata_locale = Some(new_value.to_string());
7895        self
7896    }
7897    /// Experiment IDs the current request belongs to.
7898    ///
7899    /// Append the given value to the *request metadata.experiment ids* query property.
7900    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7901    pub fn add_request_metadata_experiment_ids(
7902        mut self,
7903        new_value: &str,
7904    ) -> UserCreateCompanyRelationCall<'a, C> {
7905        self._request_metadata_experiment_ids
7906            .push(new_value.to_string());
7907        self
7908    }
7909    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7910    /// while executing the actual API request.
7911    ///
7912    /// ````text
7913    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7914    /// ````
7915    ///
7916    /// Sets the *delegate* property to the given value.
7917    pub fn delegate(
7918        mut self,
7919        new_value: &'a mut dyn common::Delegate,
7920    ) -> UserCreateCompanyRelationCall<'a, C> {
7921        self._delegate = Some(new_value);
7922        self
7923    }
7924
7925    /// Set any additional parameter of the query string used in the request.
7926    /// It should be used to set parameters which are not yet available through their own
7927    /// setters.
7928    ///
7929    /// Please note that this method must not be used to set any of the known parameters
7930    /// which have their own setter method. If done anyway, the request will fail.
7931    ///
7932    /// # Additional Parameters
7933    ///
7934    /// * *alt* (query-string) - Data format for response.
7935    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7936    /// * *access_token* (query-string) - OAuth access token.
7937    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7938    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7939    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7940    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7941    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7942    /// * *$.xgafv* (query-string) - V1 error format.
7943    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7944    /// * *callback* (query-string) - JSONP
7945    pub fn param<T>(mut self, name: T, value: T) -> UserCreateCompanyRelationCall<'a, C>
7946    where
7947        T: AsRef<str>,
7948    {
7949        self._additional_params
7950            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7951        self
7952    }
7953}
7954
7955/// Deletes a user's company relation. Unaffiliaites the user from a company.
7956///
7957/// A builder for the *deleteCompanyRelation* method supported by a *user* resource.
7958/// It is not used directly, but through a [`UserMethods`] instance.
7959///
7960/// # Example
7961///
7962/// Instantiate a resource method builder
7963///
7964/// ```test_harness,no_run
7965/// # extern crate hyper;
7966/// # extern crate hyper_rustls;
7967/// # extern crate google_partners2 as partners2;
7968/// # async fn dox() {
7969/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7970///
7971/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7972/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7973/// #     secret,
7974/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7975/// # ).build().await.unwrap();
7976///
7977/// # let client = hyper_util::client::legacy::Client::builder(
7978/// #     hyper_util::rt::TokioExecutor::new()
7979/// # )
7980/// # .build(
7981/// #     hyper_rustls::HttpsConnectorBuilder::new()
7982/// #         .with_native_roots()
7983/// #         .unwrap()
7984/// #         .https_or_http()
7985/// #         .enable_http1()
7986/// #         .build()
7987/// # );
7988/// # let mut hub = Partners::new(client, auth);
7989/// // You can configure optional parameters by calling the respective setters at will, and
7990/// // execute the final call using `doit()`.
7991/// // Values shown here are possibly random and not representative !
7992/// let result = hub.users().delete_company_relation("userId")
7993///              .request_metadata_user_overrides_user_id("sit")
7994///              .request_metadata_user_overrides_ip_address("sed")
7995///              .request_metadata_traffic_source_traffic_sub_id("eos")
7996///              .request_metadata_traffic_source_traffic_source_id("Lorem")
7997///              .request_metadata_partners_session_id("ea")
7998///              .request_metadata_locale("Stet")
7999///              .add_request_metadata_experiment_ids("dolores")
8000///              .doit().await;
8001/// # }
8002/// ```
8003pub struct UserDeleteCompanyRelationCall<'a, C>
8004where
8005    C: 'a,
8006{
8007    hub: &'a Partners<C>,
8008    _user_id: String,
8009    _request_metadata_user_overrides_user_id: Option<String>,
8010    _request_metadata_user_overrides_ip_address: Option<String>,
8011    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
8012    _request_metadata_traffic_source_traffic_source_id: Option<String>,
8013    _request_metadata_partners_session_id: Option<String>,
8014    _request_metadata_locale: Option<String>,
8015    _request_metadata_experiment_ids: Vec<String>,
8016    _delegate: Option<&'a mut dyn common::Delegate>,
8017    _additional_params: HashMap<String, String>,
8018}
8019
8020impl<'a, C> common::CallBuilder for UserDeleteCompanyRelationCall<'a, C> {}
8021
8022impl<'a, C> UserDeleteCompanyRelationCall<'a, C>
8023where
8024    C: common::Connector,
8025{
8026    /// Perform the operation you have build so far.
8027    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8028        use std::borrow::Cow;
8029        use std::io::{Read, Seek};
8030
8031        use common::{url::Params, ToParts};
8032        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8033
8034        let mut dd = common::DefaultDelegate;
8035        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8036        dlg.begin(common::MethodInfo {
8037            id: "partners.users.deleteCompanyRelation",
8038            http_method: hyper::Method::DELETE,
8039        });
8040
8041        for &field in [
8042            "alt",
8043            "userId",
8044            "requestMetadata.userOverrides.userId",
8045            "requestMetadata.userOverrides.ipAddress",
8046            "requestMetadata.trafficSource.trafficSubId",
8047            "requestMetadata.trafficSource.trafficSourceId",
8048            "requestMetadata.partnersSessionId",
8049            "requestMetadata.locale",
8050            "requestMetadata.experimentIds",
8051        ]
8052        .iter()
8053        {
8054            if self._additional_params.contains_key(field) {
8055                dlg.finished(false);
8056                return Err(common::Error::FieldClash(field));
8057            }
8058        }
8059
8060        let mut params = Params::with_capacity(10 + self._additional_params.len());
8061        params.push("userId", self._user_id);
8062        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
8063            params.push("requestMetadata.userOverrides.userId", value);
8064        }
8065        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
8066            params.push("requestMetadata.userOverrides.ipAddress", value);
8067        }
8068        if let Some(value) = self
8069            ._request_metadata_traffic_source_traffic_sub_id
8070            .as_ref()
8071        {
8072            params.push("requestMetadata.trafficSource.trafficSubId", value);
8073        }
8074        if let Some(value) = self
8075            ._request_metadata_traffic_source_traffic_source_id
8076            .as_ref()
8077        {
8078            params.push("requestMetadata.trafficSource.trafficSourceId", value);
8079        }
8080        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
8081            params.push("requestMetadata.partnersSessionId", value);
8082        }
8083        if let Some(value) = self._request_metadata_locale.as_ref() {
8084            params.push("requestMetadata.locale", value);
8085        }
8086        if !self._request_metadata_experiment_ids.is_empty() {
8087            for f in self._request_metadata_experiment_ids.iter() {
8088                params.push("requestMetadata.experimentIds", f);
8089            }
8090        }
8091
8092        params.extend(self._additional_params.iter());
8093
8094        params.push("alt", "json");
8095        let mut url = self.hub._base_url.clone() + "v2/users/{userId}/companyRelation";
8096
8097        match dlg.api_key() {
8098            Some(value) => params.push("key", value),
8099            None => {
8100                dlg.finished(false);
8101                return Err(common::Error::MissingAPIKey);
8102            }
8103        }
8104
8105        #[allow(clippy::single_element_loop)]
8106        for &(find_this, param_name) in [("{userId}", "userId")].iter() {
8107            url = params.uri_replacement(url, param_name, find_this, false);
8108        }
8109        {
8110            let to_remove = ["userId"];
8111            params.remove_params(&to_remove);
8112        }
8113
8114        let url = params.parse_with_url(&url);
8115
8116        loop {
8117            let mut req_result = {
8118                let client = &self.hub.client;
8119                dlg.pre_request();
8120                let mut req_builder = hyper::Request::builder()
8121                    .method(hyper::Method::DELETE)
8122                    .uri(url.as_str())
8123                    .header(USER_AGENT, self.hub._user_agent.clone());
8124
8125                let request = req_builder
8126                    .header(CONTENT_LENGTH, 0_u64)
8127                    .body(common::to_body::<String>(None));
8128
8129                client.request(request.unwrap()).await
8130            };
8131
8132            match req_result {
8133                Err(err) => {
8134                    if let common::Retry::After(d) = dlg.http_error(&err) {
8135                        sleep(d).await;
8136                        continue;
8137                    }
8138                    dlg.finished(false);
8139                    return Err(common::Error::HttpError(err));
8140                }
8141                Ok(res) => {
8142                    let (mut parts, body) = res.into_parts();
8143                    let mut body = common::Body::new(body);
8144                    if !parts.status.is_success() {
8145                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8146                        let error = serde_json::from_str(&common::to_string(&bytes));
8147                        let response = common::to_response(parts, bytes.into());
8148
8149                        if let common::Retry::After(d) =
8150                            dlg.http_failure(&response, error.as_ref().ok())
8151                        {
8152                            sleep(d).await;
8153                            continue;
8154                        }
8155
8156                        dlg.finished(false);
8157
8158                        return Err(match error {
8159                            Ok(value) => common::Error::BadRequest(value),
8160                            _ => common::Error::Failure(response),
8161                        });
8162                    }
8163                    let response = {
8164                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8165                        let encoded = common::to_string(&bytes);
8166                        match serde_json::from_str(&encoded) {
8167                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8168                            Err(error) => {
8169                                dlg.response_json_decode_error(&encoded, &error);
8170                                return Err(common::Error::JsonDecodeError(
8171                                    encoded.to_string(),
8172                                    error,
8173                                ));
8174                            }
8175                        }
8176                    };
8177
8178                    dlg.finished(true);
8179                    return Ok(response);
8180                }
8181            }
8182        }
8183    }
8184
8185    /// The ID of the user. Can be set to <code>me</code> to mean
8186    /// the currently authenticated user.
8187    ///
8188    /// Sets the *user id* path property to the given value.
8189    ///
8190    /// Even though the property as already been set when instantiating this call,
8191    /// we provide this method for API completeness.
8192    pub fn user_id(mut self, new_value: &str) -> UserDeleteCompanyRelationCall<'a, C> {
8193        self._user_id = new_value.to_string();
8194        self
8195    }
8196    /// Logged-in user ID to impersonate instead of the user's ID.
8197    ///
8198    /// Sets the *request metadata.user overrides.user id* query property to the given value.
8199    pub fn request_metadata_user_overrides_user_id(
8200        mut self,
8201        new_value: &str,
8202    ) -> UserDeleteCompanyRelationCall<'a, C> {
8203        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
8204        self
8205    }
8206    /// IP address to use instead of the user's geo-located IP address.
8207    ///
8208    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
8209    pub fn request_metadata_user_overrides_ip_address(
8210        mut self,
8211        new_value: &str,
8212    ) -> UserDeleteCompanyRelationCall<'a, C> {
8213        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
8214        self
8215    }
8216    /// Second level identifier to indicate where the traffic comes from.
8217    /// An identifier has multiple letters created by a team which redirected the
8218    /// traffic to us.
8219    ///
8220    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
8221    pub fn request_metadata_traffic_source_traffic_sub_id(
8222        mut self,
8223        new_value: &str,
8224    ) -> UserDeleteCompanyRelationCall<'a, C> {
8225        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
8226        self
8227    }
8228    /// Identifier to indicate where the traffic comes from.
8229    /// An identifier has multiple letters created by a team which redirected the
8230    /// traffic to us.
8231    ///
8232    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
8233    pub fn request_metadata_traffic_source_traffic_source_id(
8234        mut self,
8235        new_value: &str,
8236    ) -> UserDeleteCompanyRelationCall<'a, C> {
8237        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
8238        self
8239    }
8240    /// Google Partners session ID.
8241    ///
8242    /// Sets the *request metadata.partners session id* query property to the given value.
8243    pub fn request_metadata_partners_session_id(
8244        mut self,
8245        new_value: &str,
8246    ) -> UserDeleteCompanyRelationCall<'a, C> {
8247        self._request_metadata_partners_session_id = Some(new_value.to_string());
8248        self
8249    }
8250    /// Locale to use for the current request.
8251    ///
8252    /// Sets the *request metadata.locale* query property to the given value.
8253    pub fn request_metadata_locale(
8254        mut self,
8255        new_value: &str,
8256    ) -> UserDeleteCompanyRelationCall<'a, C> {
8257        self._request_metadata_locale = Some(new_value.to_string());
8258        self
8259    }
8260    /// Experiment IDs the current request belongs to.
8261    ///
8262    /// Append the given value to the *request metadata.experiment ids* query property.
8263    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8264    pub fn add_request_metadata_experiment_ids(
8265        mut self,
8266        new_value: &str,
8267    ) -> UserDeleteCompanyRelationCall<'a, C> {
8268        self._request_metadata_experiment_ids
8269            .push(new_value.to_string());
8270        self
8271    }
8272    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8273    /// while executing the actual API request.
8274    ///
8275    /// ````text
8276    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8277    /// ````
8278    ///
8279    /// Sets the *delegate* property to the given value.
8280    pub fn delegate(
8281        mut self,
8282        new_value: &'a mut dyn common::Delegate,
8283    ) -> UserDeleteCompanyRelationCall<'a, C> {
8284        self._delegate = Some(new_value);
8285        self
8286    }
8287
8288    /// Set any additional parameter of the query string used in the request.
8289    /// It should be used to set parameters which are not yet available through their own
8290    /// setters.
8291    ///
8292    /// Please note that this method must not be used to set any of the known parameters
8293    /// which have their own setter method. If done anyway, the request will fail.
8294    ///
8295    /// # Additional Parameters
8296    ///
8297    /// * *alt* (query-string) - Data format for response.
8298    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8299    /// * *access_token* (query-string) - OAuth access token.
8300    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8301    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8302    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8303    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8304    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8305    /// * *$.xgafv* (query-string) - V1 error format.
8306    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8307    /// * *callback* (query-string) - JSONP
8308    pub fn param<T>(mut self, name: T, value: T) -> UserDeleteCompanyRelationCall<'a, C>
8309    where
8310        T: AsRef<str>,
8311    {
8312        self._additional_params
8313            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8314        self
8315    }
8316}
8317
8318/// Gets a user.
8319///
8320/// A builder for the *get* method supported by a *user* resource.
8321/// It is not used directly, but through a [`UserMethods`] instance.
8322///
8323/// # Example
8324///
8325/// Instantiate a resource method builder
8326///
8327/// ```test_harness,no_run
8328/// # extern crate hyper;
8329/// # extern crate hyper_rustls;
8330/// # extern crate google_partners2 as partners2;
8331/// # async fn dox() {
8332/// # use partners2::{Partners, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8333///
8334/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8335/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8336/// #     secret,
8337/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8338/// # ).build().await.unwrap();
8339///
8340/// # let client = hyper_util::client::legacy::Client::builder(
8341/// #     hyper_util::rt::TokioExecutor::new()
8342/// # )
8343/// # .build(
8344/// #     hyper_rustls::HttpsConnectorBuilder::new()
8345/// #         .with_native_roots()
8346/// #         .unwrap()
8347/// #         .https_or_http()
8348/// #         .enable_http1()
8349/// #         .build()
8350/// # );
8351/// # let mut hub = Partners::new(client, auth);
8352/// // You can configure optional parameters by calling the respective setters at will, and
8353/// // execute the final call using `doit()`.
8354/// // Values shown here are possibly random and not representative !
8355/// let result = hub.users().get("userId")
8356///              .user_view("et")
8357///              .request_metadata_user_overrides_user_id("sea")
8358///              .request_metadata_user_overrides_ip_address("et")
8359///              .request_metadata_traffic_source_traffic_sub_id("At")
8360///              .request_metadata_traffic_source_traffic_source_id("dolore")
8361///              .request_metadata_partners_session_id("eirmod")
8362///              .request_metadata_locale("Lorem")
8363///              .add_request_metadata_experiment_ids("accusam")
8364///              .doit().await;
8365/// # }
8366/// ```
8367pub struct UserGetCall<'a, C>
8368where
8369    C: 'a,
8370{
8371    hub: &'a Partners<C>,
8372    _user_id: String,
8373    _user_view: Option<String>,
8374    _request_metadata_user_overrides_user_id: Option<String>,
8375    _request_metadata_user_overrides_ip_address: Option<String>,
8376    _request_metadata_traffic_source_traffic_sub_id: Option<String>,
8377    _request_metadata_traffic_source_traffic_source_id: Option<String>,
8378    _request_metadata_partners_session_id: Option<String>,
8379    _request_metadata_locale: Option<String>,
8380    _request_metadata_experiment_ids: Vec<String>,
8381    _delegate: Option<&'a mut dyn common::Delegate>,
8382    _additional_params: HashMap<String, String>,
8383}
8384
8385impl<'a, C> common::CallBuilder for UserGetCall<'a, C> {}
8386
8387impl<'a, C> UserGetCall<'a, C>
8388where
8389    C: common::Connector,
8390{
8391    /// Perform the operation you have build so far.
8392    pub async fn doit(mut self) -> common::Result<(common::Response, User)> {
8393        use std::borrow::Cow;
8394        use std::io::{Read, Seek};
8395
8396        use common::{url::Params, ToParts};
8397        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8398
8399        let mut dd = common::DefaultDelegate;
8400        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8401        dlg.begin(common::MethodInfo {
8402            id: "partners.users.get",
8403            http_method: hyper::Method::GET,
8404        });
8405
8406        for &field in [
8407            "alt",
8408            "userId",
8409            "userView",
8410            "requestMetadata.userOverrides.userId",
8411            "requestMetadata.userOverrides.ipAddress",
8412            "requestMetadata.trafficSource.trafficSubId",
8413            "requestMetadata.trafficSource.trafficSourceId",
8414            "requestMetadata.partnersSessionId",
8415            "requestMetadata.locale",
8416            "requestMetadata.experimentIds",
8417        ]
8418        .iter()
8419        {
8420            if self._additional_params.contains_key(field) {
8421                dlg.finished(false);
8422                return Err(common::Error::FieldClash(field));
8423            }
8424        }
8425
8426        let mut params = Params::with_capacity(11 + self._additional_params.len());
8427        params.push("userId", self._user_id);
8428        if let Some(value) = self._user_view.as_ref() {
8429            params.push("userView", value);
8430        }
8431        if let Some(value) = self._request_metadata_user_overrides_user_id.as_ref() {
8432            params.push("requestMetadata.userOverrides.userId", value);
8433        }
8434        if let Some(value) = self._request_metadata_user_overrides_ip_address.as_ref() {
8435            params.push("requestMetadata.userOverrides.ipAddress", value);
8436        }
8437        if let Some(value) = self
8438            ._request_metadata_traffic_source_traffic_sub_id
8439            .as_ref()
8440        {
8441            params.push("requestMetadata.trafficSource.trafficSubId", value);
8442        }
8443        if let Some(value) = self
8444            ._request_metadata_traffic_source_traffic_source_id
8445            .as_ref()
8446        {
8447            params.push("requestMetadata.trafficSource.trafficSourceId", value);
8448        }
8449        if let Some(value) = self._request_metadata_partners_session_id.as_ref() {
8450            params.push("requestMetadata.partnersSessionId", value);
8451        }
8452        if let Some(value) = self._request_metadata_locale.as_ref() {
8453            params.push("requestMetadata.locale", value);
8454        }
8455        if !self._request_metadata_experiment_ids.is_empty() {
8456            for f in self._request_metadata_experiment_ids.iter() {
8457                params.push("requestMetadata.experimentIds", f);
8458            }
8459        }
8460
8461        params.extend(self._additional_params.iter());
8462
8463        params.push("alt", "json");
8464        let mut url = self.hub._base_url.clone() + "v2/users/{userId}";
8465
8466        match dlg.api_key() {
8467            Some(value) => params.push("key", value),
8468            None => {
8469                dlg.finished(false);
8470                return Err(common::Error::MissingAPIKey);
8471            }
8472        }
8473
8474        #[allow(clippy::single_element_loop)]
8475        for &(find_this, param_name) in [("{userId}", "userId")].iter() {
8476            url = params.uri_replacement(url, param_name, find_this, false);
8477        }
8478        {
8479            let to_remove = ["userId"];
8480            params.remove_params(&to_remove);
8481        }
8482
8483        let url = params.parse_with_url(&url);
8484
8485        loop {
8486            let mut req_result = {
8487                let client = &self.hub.client;
8488                dlg.pre_request();
8489                let mut req_builder = hyper::Request::builder()
8490                    .method(hyper::Method::GET)
8491                    .uri(url.as_str())
8492                    .header(USER_AGENT, self.hub._user_agent.clone());
8493
8494                let request = req_builder
8495                    .header(CONTENT_LENGTH, 0_u64)
8496                    .body(common::to_body::<String>(None));
8497
8498                client.request(request.unwrap()).await
8499            };
8500
8501            match req_result {
8502                Err(err) => {
8503                    if let common::Retry::After(d) = dlg.http_error(&err) {
8504                        sleep(d).await;
8505                        continue;
8506                    }
8507                    dlg.finished(false);
8508                    return Err(common::Error::HttpError(err));
8509                }
8510                Ok(res) => {
8511                    let (mut parts, body) = res.into_parts();
8512                    let mut body = common::Body::new(body);
8513                    if !parts.status.is_success() {
8514                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8515                        let error = serde_json::from_str(&common::to_string(&bytes));
8516                        let response = common::to_response(parts, bytes.into());
8517
8518                        if let common::Retry::After(d) =
8519                            dlg.http_failure(&response, error.as_ref().ok())
8520                        {
8521                            sleep(d).await;
8522                            continue;
8523                        }
8524
8525                        dlg.finished(false);
8526
8527                        return Err(match error {
8528                            Ok(value) => common::Error::BadRequest(value),
8529                            _ => common::Error::Failure(response),
8530                        });
8531                    }
8532                    let response = {
8533                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8534                        let encoded = common::to_string(&bytes);
8535                        match serde_json::from_str(&encoded) {
8536                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8537                            Err(error) => {
8538                                dlg.response_json_decode_error(&encoded, &error);
8539                                return Err(common::Error::JsonDecodeError(
8540                                    encoded.to_string(),
8541                                    error,
8542                                ));
8543                            }
8544                        }
8545                    };
8546
8547                    dlg.finished(true);
8548                    return Ok(response);
8549                }
8550            }
8551        }
8552    }
8553
8554    /// Identifier of the user. Can be set to <code>me</code> to mean the currently
8555    /// authenticated user.
8556    ///
8557    /// Sets the *user id* path property to the given value.
8558    ///
8559    /// Even though the property as already been set when instantiating this call,
8560    /// we provide this method for API completeness.
8561    pub fn user_id(mut self, new_value: &str) -> UserGetCall<'a, C> {
8562        self._user_id = new_value.to_string();
8563        self
8564    }
8565    /// Specifies what parts of the user information to return.
8566    ///
8567    /// Sets the *user view* query property to the given value.
8568    pub fn user_view(mut self, new_value: &str) -> UserGetCall<'a, C> {
8569        self._user_view = Some(new_value.to_string());
8570        self
8571    }
8572    /// Logged-in user ID to impersonate instead of the user's ID.
8573    ///
8574    /// Sets the *request metadata.user overrides.user id* query property to the given value.
8575    pub fn request_metadata_user_overrides_user_id(
8576        mut self,
8577        new_value: &str,
8578    ) -> UserGetCall<'a, C> {
8579        self._request_metadata_user_overrides_user_id = Some(new_value.to_string());
8580        self
8581    }
8582    /// IP address to use instead of the user's geo-located IP address.
8583    ///
8584    /// Sets the *request metadata.user overrides.ip address* query property to the given value.
8585    pub fn request_metadata_user_overrides_ip_address(
8586        mut self,
8587        new_value: &str,
8588    ) -> UserGetCall<'a, C> {
8589        self._request_metadata_user_overrides_ip_address = Some(new_value.to_string());
8590        self
8591    }
8592    /// Second level identifier to indicate where the traffic comes from.
8593    /// An identifier has multiple letters created by a team which redirected the
8594    /// traffic to us.
8595    ///
8596    /// Sets the *request metadata.traffic source.traffic sub id* query property to the given value.
8597    pub fn request_metadata_traffic_source_traffic_sub_id(
8598        mut self,
8599        new_value: &str,
8600    ) -> UserGetCall<'a, C> {
8601        self._request_metadata_traffic_source_traffic_sub_id = Some(new_value.to_string());
8602        self
8603    }
8604    /// Identifier to indicate where the traffic comes from.
8605    /// An identifier has multiple letters created by a team which redirected the
8606    /// traffic to us.
8607    ///
8608    /// Sets the *request metadata.traffic source.traffic source id* query property to the given value.
8609    pub fn request_metadata_traffic_source_traffic_source_id(
8610        mut self,
8611        new_value: &str,
8612    ) -> UserGetCall<'a, C> {
8613        self._request_metadata_traffic_source_traffic_source_id = Some(new_value.to_string());
8614        self
8615    }
8616    /// Google Partners session ID.
8617    ///
8618    /// Sets the *request metadata.partners session id* query property to the given value.
8619    pub fn request_metadata_partners_session_id(mut self, new_value: &str) -> UserGetCall<'a, C> {
8620        self._request_metadata_partners_session_id = Some(new_value.to_string());
8621        self
8622    }
8623    /// Locale to use for the current request.
8624    ///
8625    /// Sets the *request metadata.locale* query property to the given value.
8626    pub fn request_metadata_locale(mut self, new_value: &str) -> UserGetCall<'a, C> {
8627        self._request_metadata_locale = Some(new_value.to_string());
8628        self
8629    }
8630    /// Experiment IDs the current request belongs to.
8631    ///
8632    /// Append the given value to the *request metadata.experiment ids* query property.
8633    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8634    pub fn add_request_metadata_experiment_ids(mut self, new_value: &str) -> UserGetCall<'a, C> {
8635        self._request_metadata_experiment_ids
8636            .push(new_value.to_string());
8637        self
8638    }
8639    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8640    /// while executing the actual API request.
8641    ///
8642    /// ````text
8643    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8644    /// ````
8645    ///
8646    /// Sets the *delegate* property to the given value.
8647    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserGetCall<'a, C> {
8648        self._delegate = Some(new_value);
8649        self
8650    }
8651
8652    /// Set any additional parameter of the query string used in the request.
8653    /// It should be used to set parameters which are not yet available through their own
8654    /// setters.
8655    ///
8656    /// Please note that this method must not be used to set any of the known parameters
8657    /// which have their own setter method. If done anyway, the request will fail.
8658    ///
8659    /// # Additional Parameters
8660    ///
8661    /// * *alt* (query-string) - Data format for response.
8662    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8663    /// * *access_token* (query-string) - OAuth access token.
8664    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8665    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8666    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8667    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8668    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8669    /// * *$.xgafv* (query-string) - V1 error format.
8670    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8671    /// * *callback* (query-string) - JSONP
8672    pub fn param<T>(mut self, name: T, value: T) -> UserGetCall<'a, C>
8673    where
8674        T: AsRef<str>,
8675    {
8676        self._additional_params
8677            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8678        self
8679    }
8680}