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