google_people1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// See, edit, download, and permanently delete your contacts
17 Contact,
18
19 /// See and download contact info automatically saved in your "Other contacts"
20 ContactOtherReadonly,
21
22 /// See and download your contacts
23 ContactReadonly,
24
25 /// See and download your organization's Google Workspace directory
26 DirectoryReadonly,
27
28 /// View your street addresses
29 UserAddressRead,
30
31 /// See and download your exact date of birth
32 UserBirthdayRead,
33
34 /// See and download all of your Google Account email addresses
35 UserEmailRead,
36
37 /// See your gender
38 UserGenderRead,
39
40 /// See your education, work history and org info
41 UserOrganizationRead,
42
43 /// See and download your personal phone numbers
44 UserPhonenumberRead,
45
46 /// See your primary Google Account email address
47 UserinfoEmail,
48
49 /// See your personal info, including any personal info you've made publicly available
50 UserinfoProfile,
51}
52
53impl AsRef<str> for Scope {
54 fn as_ref(&self) -> &str {
55 match *self {
56 Scope::Contact => "https://www.googleapis.com/auth/contacts",
57 Scope::ContactOtherReadonly => {
58 "https://www.googleapis.com/auth/contacts.other.readonly"
59 }
60 Scope::ContactReadonly => "https://www.googleapis.com/auth/contacts.readonly",
61 Scope::DirectoryReadonly => "https://www.googleapis.com/auth/directory.readonly",
62 Scope::UserAddressRead => "https://www.googleapis.com/auth/user.addresses.read",
63 Scope::UserBirthdayRead => "https://www.googleapis.com/auth/user.birthday.read",
64 Scope::UserEmailRead => "https://www.googleapis.com/auth/user.emails.read",
65 Scope::UserGenderRead => "https://www.googleapis.com/auth/user.gender.read",
66 Scope::UserOrganizationRead => "https://www.googleapis.com/auth/user.organization.read",
67 Scope::UserPhonenumberRead => "https://www.googleapis.com/auth/user.phonenumbers.read",
68 Scope::UserinfoEmail => "https://www.googleapis.com/auth/userinfo.email",
69 Scope::UserinfoProfile => "https://www.googleapis.com/auth/userinfo.profile",
70 }
71 }
72}
73
74#[allow(clippy::derivable_impls)]
75impl Default for Scope {
76 fn default() -> Scope {
77 Scope::ContactOtherReadonly
78 }
79}
80
81// ########
82// HUB ###
83// ######
84
85/// Central instance to access all PeopleService related resource activities
86///
87/// # Examples
88///
89/// Instantiate a new hub
90///
91/// ```test_harness,no_run
92/// extern crate hyper;
93/// extern crate hyper_rustls;
94/// extern crate google_people1 as people1;
95/// use people1::{Result, Error};
96/// # async fn dox() {
97/// use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
98///
99/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
100/// // `client_secret`, among other things.
101/// let secret: yup_oauth2::ApplicationSecret = Default::default();
102/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
103/// // unless you replace `None` with the desired Flow.
104/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
105/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
106/// // retrieve them from storage.
107/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
108/// .with_native_roots()
109/// .unwrap()
110/// .https_only()
111/// .enable_http2()
112/// .build();
113///
114/// let executor = hyper_util::rt::TokioExecutor::new();
115/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
116/// secret,
117/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
118/// yup_oauth2::client::CustomHyperClientBuilder::from(
119/// hyper_util::client::legacy::Client::builder(executor).build(connector),
120/// ),
121/// ).build().await.unwrap();
122///
123/// let client = hyper_util::client::legacy::Client::builder(
124/// hyper_util::rt::TokioExecutor::new()
125/// )
126/// .build(
127/// hyper_rustls::HttpsConnectorBuilder::new()
128/// .with_native_roots()
129/// .unwrap()
130/// .https_or_http()
131/// .enable_http2()
132/// .build()
133/// );
134/// let mut hub = PeopleService::new(client, auth);
135/// // You can configure optional parameters by calling the respective setters at will, and
136/// // execute the final call using `doit()`.
137/// // Values shown here are possibly random and not representative !
138/// let result = hub.contact_groups().list()
139/// .sync_token("sanctus")
140/// .page_token("sed")
141/// .page_size(-2)
142/// .group_fields(FieldMask::new::<&str>(&[]))
143/// .doit().await;
144///
145/// match result {
146/// Err(e) => match e {
147/// // The Error enum provides details about what exactly happened.
148/// // You can also just use its `Debug`, `Display` or `Error` traits
149/// Error::HttpError(_)
150/// |Error::Io(_)
151/// |Error::MissingAPIKey
152/// |Error::MissingToken(_)
153/// |Error::Cancelled
154/// |Error::UploadSizeLimitExceeded(_, _)
155/// |Error::Failure(_)
156/// |Error::BadRequest(_)
157/// |Error::FieldClash(_)
158/// |Error::JsonDecodeError(_, _) => println!("{}", e),
159/// },
160/// Ok(res) => println!("Success: {:?}", res),
161/// }
162/// # }
163/// ```
164#[derive(Clone)]
165pub struct PeopleService<C> {
166 pub client: common::Client<C>,
167 pub auth: Box<dyn common::GetToken>,
168 _user_agent: String,
169 _base_url: String,
170 _root_url: String,
171}
172
173impl<C> common::Hub for PeopleService<C> {}
174
175impl<'a, C> PeopleService<C> {
176 pub fn new<A: 'static + common::GetToken>(
177 client: common::Client<C>,
178 auth: A,
179 ) -> PeopleService<C> {
180 PeopleService {
181 client,
182 auth: Box::new(auth),
183 _user_agent: "google-api-rust-client/7.0.0".to_string(),
184 _base_url: "https://people.googleapis.com/".to_string(),
185 _root_url: "https://people.googleapis.com/".to_string(),
186 }
187 }
188
189 pub fn contact_groups(&'a self) -> ContactGroupMethods<'a, C> {
190 ContactGroupMethods { hub: self }
191 }
192 pub fn other_contacts(&'a self) -> OtherContactMethods<'a, C> {
193 OtherContactMethods { hub: self }
194 }
195 pub fn people(&'a self) -> PersonMethods<'a, C> {
196 PersonMethods { hub: self }
197 }
198
199 /// Set the user-agent header field to use in all requests to the server.
200 /// It defaults to `google-api-rust-client/7.0.0`.
201 ///
202 /// Returns the previously set user-agent.
203 pub fn user_agent(&mut self, agent_name: String) -> String {
204 std::mem::replace(&mut self._user_agent, agent_name)
205 }
206
207 /// Set the base url to use in all requests to the server.
208 /// It defaults to `https://people.googleapis.com/`.
209 ///
210 /// Returns the previously set base url.
211 pub fn base_url(&mut self, new_base_url: String) -> String {
212 std::mem::replace(&mut self._base_url, new_base_url)
213 }
214
215 /// Set the root url to use in all requests to the server.
216 /// It defaults to `https://people.googleapis.com/`.
217 ///
218 /// Returns the previously set root url.
219 pub fn root_url(&mut self, new_root_url: String) -> String {
220 std::mem::replace(&mut self._root_url, new_root_url)
221 }
222}
223
224// ############
225// SCHEMAS ###
226// ##########
227/// A person's physical address. May be a P.O. box or street address. All fields are optional.
228///
229/// This type is not used in any activity, and only used as *part* of another schema.
230///
231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
232#[serde_with::serde_as]
233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
234pub struct Address {
235 /// The city of the address.
236 pub city: Option<String>,
237 /// The country of the address.
238 pub country: Option<String>,
239 /// The [ISO 3166-1 alpha-2](http://www.iso.org/iso/country_codes.htm) country code of the address.
240 #[serde(rename = "countryCode")]
241 pub country_code: Option<String>,
242 /// The extended address of the address; for example, the apartment number.
243 #[serde(rename = "extendedAddress")]
244 pub extended_address: Option<String>,
245 /// Output only. The type of the address translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
246 #[serde(rename = "formattedType")]
247 pub formatted_type: Option<String>,
248 /// The unstructured value of the address. If this is not set by the user it will be automatically constructed from structured values.
249 #[serde(rename = "formattedValue")]
250 pub formatted_value: Option<String>,
251 /// Metadata about the address.
252 pub metadata: Option<FieldMetadata>,
253 /// The P.O. box of the address.
254 #[serde(rename = "poBox")]
255 pub po_box: Option<String>,
256 /// The postal code of the address.
257 #[serde(rename = "postalCode")]
258 pub postal_code: Option<String>,
259 /// The region of the address; for example, the state or province.
260 pub region: Option<String>,
261 /// The street address.
262 #[serde(rename = "streetAddress")]
263 pub street_address: Option<String>,
264 /// The type of the address. The type can be custom or one of these predefined values: * `home` * `work` * `other`
265 #[serde(rename = "type")]
266 pub type_: Option<String>,
267}
268
269impl common::Part for Address {}
270
271/// A person's age range.
272///
273/// This type is not used in any activity, and only used as *part* of another schema.
274///
275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
276#[serde_with::serde_as]
277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
278pub struct AgeRangeType {
279 /// The age range.
280 #[serde(rename = "ageRange")]
281 pub age_range: Option<String>,
282 /// Metadata about the age range.
283 pub metadata: Option<FieldMetadata>,
284}
285
286impl common::Part for AgeRangeType {}
287
288/// A request to create a batch of contacts.
289///
290/// # Activities
291///
292/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
293/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
294///
295/// * [batch create contacts people](PersonBatchCreateContactCall) (request)
296#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
297#[serde_with::serde_as]
298#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
299pub struct BatchCreateContactsRequest {
300 /// Required. The contact to create. Allows up to 200 contacts in a single request.
301 pub contacts: Option<Vec<ContactToCreate>>,
302 /// Required. A field mask to restrict which fields on each person are returned in the response. Multiple fields can be specified by separating them with commas. If read mask is left empty, the post-mutate-get is skipped and no data will be returned in the response. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
303 #[serde(rename = "readMask")]
304 pub read_mask: Option<common::FieldMask>,
305 /// Optional. A mask of what source types to return in the post mutate read. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
306 pub sources: Option<Vec<String>>,
307}
308
309impl common::RequestValue for BatchCreateContactsRequest {}
310
311/// If not successful, returns BatchCreateContactsErrorDetails which contains a list of errors for each invalid contact. The response to a request to create a batch of contacts.
312///
313/// # Activities
314///
315/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
316/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
317///
318/// * [batch create contacts people](PersonBatchCreateContactCall) (response)
319#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
320#[serde_with::serde_as]
321#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
322pub struct BatchCreateContactsResponse {
323 /// The contacts that were created, unless the request `read_mask` is empty.
324 #[serde(rename = "createdPeople")]
325 pub created_people: Option<Vec<PersonResponse>>,
326}
327
328impl common::ResponseResult for BatchCreateContactsResponse {}
329
330/// A request to delete a batch of existing contacts.
331///
332/// # Activities
333///
334/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
335/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
336///
337/// * [batch delete contacts people](PersonBatchDeleteContactCall) (request)
338#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
339#[serde_with::serde_as]
340#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
341pub struct BatchDeleteContactsRequest {
342 /// Required. The resource names of the contact to delete. It's repeatable. Allows up to 500 resource names in a single request.
343 #[serde(rename = "resourceNames")]
344 pub resource_names: Option<Vec<String>>,
345}
346
347impl common::RequestValue for BatchDeleteContactsRequest {}
348
349/// The response to a batch get contact groups request.
350///
351/// # Activities
352///
353/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
354/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
355///
356/// * [batch get contact groups](ContactGroupBatchGetCall) (response)
357#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
358#[serde_with::serde_as]
359#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
360pub struct BatchGetContactGroupsResponse {
361 /// The list of responses for each requested contact group resource.
362 pub responses: Option<Vec<ContactGroupResponse>>,
363}
364
365impl common::ResponseResult for BatchGetContactGroupsResponse {}
366
367/// A request to update a batch of contacts.
368///
369/// # Activities
370///
371/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
372/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
373///
374/// * [batch update contacts people](PersonBatchUpdateContactCall) (request)
375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
376#[serde_with::serde_as]
377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
378pub struct BatchUpdateContactsRequest {
379 /// Required. A map of resource names to the person data to be updated. Allows up to 200 contacts in a single request.
380 pub contacts: Option<HashMap<String, Person>>,
381 /// Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. If read mask is left empty, the post-mutate-get is skipped and no data will be returned in the response. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
382 #[serde(rename = "readMask")]
383 pub read_mask: Option<common::FieldMask>,
384 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
385 pub sources: Option<Vec<String>>,
386 /// Required. A field mask to restrict which fields on the person are updated. Multiple fields can be specified by separating them with commas. All specified fields will be replaced, or cleared if left empty for each person. Valid values are: * addresses * biographies * birthdays * calendarUrls * clientData * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * relations * sipAddresses * urls * userDefined
387 #[serde(rename = "updateMask")]
388 pub update_mask: Option<common::FieldMask>,
389}
390
391impl common::RequestValue for BatchUpdateContactsRequest {}
392
393/// If not successful, returns BatchUpdateContactsErrorDetails, a list of errors corresponding to each contact. The response to a request to update a batch of contacts.
394///
395/// # Activities
396///
397/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
398/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
399///
400/// * [batch update contacts people](PersonBatchUpdateContactCall) (response)
401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
402#[serde_with::serde_as]
403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
404pub struct BatchUpdateContactsResponse {
405 /// A map of resource names to the contacts that were updated, unless the request `read_mask` is empty.
406 #[serde(rename = "updateResult")]
407 pub update_result: Option<HashMap<String, PersonResponse>>,
408}
409
410impl common::ResponseResult for BatchUpdateContactsResponse {}
411
412/// A person's short biography.
413///
414/// This type is not used in any activity, and only used as *part* of another schema.
415///
416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
417#[serde_with::serde_as]
418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
419pub struct Biography {
420 /// The content type of the biography.
421 #[serde(rename = "contentType")]
422 pub content_type: Option<String>,
423 /// Metadata about the biography.
424 pub metadata: Option<FieldMetadata>,
425 /// The short biography.
426 pub value: Option<String>,
427}
428
429impl common::Part for Biography {}
430
431/// A person's birthday. At least one of the `date` and `text` fields are specified. The `date` and `text` fields typically represent the same date, but are not guaranteed to. Clients should always set the `date` field when mutating birthdays.
432///
433/// This type is not used in any activity, and only used as *part* of another schema.
434///
435#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
436#[serde_with::serde_as]
437#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
438pub struct Birthday {
439 /// The structured date of the birthday.
440 pub date: Option<Date>,
441 /// Metadata about the birthday.
442 pub metadata: Option<FieldMetadata>,
443 /// Prefer to use the `date` field if set. A free-form string representing the user's birthday. This value is not validated.
444 pub text: Option<String>,
445}
446
447impl common::Part for Birthday {}
448
449/// **DEPRECATED**: No data will be returned A person's bragging rights.
450///
451/// This type is not used in any activity, and only used as *part* of another schema.
452///
453#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
454#[serde_with::serde_as]
455#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
456pub struct BraggingRights {
457 /// Metadata about the bragging rights.
458 pub metadata: Option<FieldMetadata>,
459 /// The bragging rights; for example, `climbed mount everest`.
460 pub value: Option<String>,
461}
462
463impl common::Part for BraggingRights {}
464
465/// A person's calendar URL.
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 CalendarUrl {
473 /// Output only. The type of the calendar URL translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
474 #[serde(rename = "formattedType")]
475 pub formatted_type: Option<String>,
476 /// Metadata about the calendar URL.
477 pub metadata: Option<FieldMetadata>,
478 /// The type of the calendar URL. The type can be custom or one of these predefined values: * `home` * `freeBusy` * `work`
479 #[serde(rename = "type")]
480 pub type_: Option<String>,
481 /// The calendar URL.
482 pub url: Option<String>,
483}
484
485impl common::Part for CalendarUrl {}
486
487/// Arbitrary client data that is populated by clients. Duplicate keys and values are allowed.
488///
489/// This type is not used in any activity, and only used as *part* of another schema.
490///
491#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
492#[serde_with::serde_as]
493#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
494pub struct ClientData {
495 /// The client specified key of the client data.
496 pub key: Option<String>,
497 /// Metadata about the client data.
498 pub metadata: Option<FieldMetadata>,
499 /// The client specified value of the client data.
500 pub value: Option<String>,
501}
502
503impl common::Part for ClientData {}
504
505/// A contact group.
506///
507/// # Activities
508///
509/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
510/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
511///
512/// * [members modify contact groups](ContactGroupMemberModifyCall) (none)
513/// * [batch get contact groups](ContactGroupBatchGetCall) (none)
514/// * [create contact groups](ContactGroupCreateCall) (response)
515/// * [delete contact groups](ContactGroupDeleteCall) (none)
516/// * [get contact groups](ContactGroupGetCall) (response)
517/// * [list contact groups](ContactGroupListCall) (none)
518/// * [update contact groups](ContactGroupUpdateCall) (response)
519#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
520#[serde_with::serde_as]
521#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
522pub struct ContactGroup {
523 /// The group's client data.
524 #[serde(rename = "clientData")]
525 pub client_data: Option<Vec<GroupClientData>>,
526 /// The [HTTP entity tag](https://en.wikipedia.org/wiki/HTTP_ETag) of the resource. Used for web cache validation.
527 pub etag: Option<String>,
528 /// Output only. The name translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale for system groups names. Group names set by the owner are the same as name.
529 #[serde(rename = "formattedName")]
530 pub formatted_name: Option<String>,
531 /// Output only. The contact group type.
532 #[serde(rename = "groupType")]
533 pub group_type: Option<String>,
534 /// Output only. The total number of contacts in the group irrespective of max members in specified in the request.
535 #[serde(rename = "memberCount")]
536 pub member_count: Option<i32>,
537 /// Output only. The list of contact person resource names that are members of the contact group. The field is only populated for GET requests and will only return as many members as `maxMembers` in the get request.
538 #[serde(rename = "memberResourceNames")]
539 pub member_resource_names: Option<Vec<String>>,
540 /// Output only. Metadata about the contact group.
541 pub metadata: Option<ContactGroupMetadata>,
542 /// The contact group name set by the group owner or a system provided name for system groups. For [`contactGroups.create`](https://developers.google.com/people/api/rest/v1/contactGroups/create) or [`contactGroups.update`](https://developers.google.com/people/api/rest/v1/contactGroups/update) the name must be unique to the users contact groups. Attempting to create a group with a duplicate name will return a HTTP 409 error.
543 pub name: Option<String>,
544 /// The resource name for the contact group, assigned by the server. An ASCII string, in the form of `contactGroups/{contact_group_id}`.
545 #[serde(rename = "resourceName")]
546 pub resource_name: Option<String>,
547}
548
549impl common::Resource for ContactGroup {}
550impl common::ResponseResult for ContactGroup {}
551
552/// A Google contact group membership.
553///
554/// This type is not used in any activity, and only used as *part* of another schema.
555///
556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
557#[serde_with::serde_as]
558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
559pub struct ContactGroupMembership {
560 /// Output only. The contact group ID for the contact group membership.
561 #[serde(rename = "contactGroupId")]
562 pub contact_group_id: Option<String>,
563 /// The resource name for the contact group, assigned by the server. An ASCII string, in the form of `contactGroups/{contact_group_id}`. Only contact_group_resource_name can be used for modifying memberships. Any contact group membership can be removed, but only user group or "myContacts" or "starred" system groups memberships can be added. A contact must always have at least one contact group membership.
564 #[serde(rename = "contactGroupResourceName")]
565 pub contact_group_resource_name: Option<String>,
566}
567
568impl common::Part for ContactGroupMembership {}
569
570/// The metadata about a contact group.
571///
572/// This type is not used in any activity, and only used as *part* of another schema.
573///
574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
575#[serde_with::serde_as]
576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
577pub struct ContactGroupMetadata {
578 /// Output only. True if the contact group resource has been deleted. Populated only for [`ListContactGroups`](https://developers.google.com/people/api/rest/v1/contactgroups/list) requests that include a sync token.
579 pub deleted: Option<bool>,
580 /// Output only. The time the group was last updated.
581 #[serde(rename = "updateTime")]
582 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
583}
584
585impl common::Part for ContactGroupMetadata {}
586
587/// The response for a specific contact group.
588///
589/// This type is not used in any activity, and only used as *part* of another schema.
590///
591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
592#[serde_with::serde_as]
593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
594pub struct ContactGroupResponse {
595 /// The contact group.
596 #[serde(rename = "contactGroup")]
597 pub contact_group: Option<ContactGroup>,
598 /// The original requested resource name.
599 #[serde(rename = "requestedResourceName")]
600 pub requested_resource_name: Option<String>,
601 /// The status of the response.
602 pub status: Option<Status>,
603}
604
605impl common::Part for ContactGroupResponse {}
606
607/// A wrapper that contains the person data to populate a newly created source.
608///
609/// This type is not used in any activity, and only used as *part* of another schema.
610///
611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
612#[serde_with::serde_as]
613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
614pub struct ContactToCreate {
615 /// Required. The person data to populate a newly created source.
616 #[serde(rename = "contactPerson")]
617 pub contact_person: Option<Person>,
618}
619
620impl common::Part for ContactToCreate {}
621
622/// A request to copy an “Other contact” to my contacts group.
623///
624/// # Activities
625///
626/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
627/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
628///
629/// * [copy other contact to my contacts group other contacts](OtherContactCopyOtherContactToMyContactsGroupCall) (request)
630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
631#[serde_with::serde_as]
632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
633pub struct CopyOtherContactToMyContactsGroupRequest {
634 /// Required. A field mask to restrict which fields are copied into the new contact. Valid values are: * emailAddresses * names * phoneNumbers
635 #[serde(rename = "copyMask")]
636 pub copy_mask: Option<common::FieldMask>,
637 /// Optional. A field mask to restrict which fields on the person are returned. Multiple fields can be specified by separating them with commas. Defaults to the copy mask with metadata and membership fields if not set. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
638 #[serde(rename = "readMask")]
639 pub read_mask: Option<common::FieldMask>,
640 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
641 pub sources: Option<Vec<String>>,
642}
643
644impl common::RequestValue for CopyOtherContactToMyContactsGroupRequest {}
645
646/// A person's cover photo. A large image shown on the person's profile page that represents who they are or what they care about.
647///
648/// This type is not used in any activity, and only used as *part* of another schema.
649///
650#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
651#[serde_with::serde_as]
652#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
653pub struct CoverPhoto {
654 /// True if the cover photo is the default cover photo; false if the cover photo is a user-provided cover photo.
655 pub default: Option<bool>,
656 /// Metadata about the cover photo.
657 pub metadata: Option<FieldMetadata>,
658 /// The URL of the cover photo.
659 pub url: Option<String>,
660}
661
662impl common::Part for CoverPhoto {}
663
664/// A request to create a new contact group.
665///
666/// # Activities
667///
668/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
669/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
670///
671/// * [create contact groups](ContactGroupCreateCall) (request)
672#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
673#[serde_with::serde_as]
674#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
675pub struct CreateContactGroupRequest {
676 /// Required. The contact group to create.
677 #[serde(rename = "contactGroup")]
678 pub contact_group: Option<ContactGroup>,
679 /// Optional. A field mask to restrict which fields on the group are returned. Defaults to `metadata`, `groupType`, and `name` if not set or set to empty. Valid fields are: * clientData * groupType * metadata * name
680 #[serde(rename = "readGroupFields")]
681 pub read_group_fields: Option<common::FieldMask>,
682}
683
684impl common::RequestValue for CreateContactGroupRequest {}
685
686/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
687///
688/// This type is not used in any activity, and only used as *part* of another schema.
689///
690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
691#[serde_with::serde_as]
692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
693pub struct Date {
694 /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
695 pub day: Option<i32>,
696 /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
697 pub month: Option<i32>,
698 /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
699 pub year: Option<i32>,
700}
701
702impl common::Part for Date {}
703
704/// The response for deleting a contact’s photo.
705///
706/// # Activities
707///
708/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
709/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
710///
711/// * [delete contact photo people](PersonDeleteContactPhotoCall) (response)
712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
713#[serde_with::serde_as]
714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
715pub struct DeleteContactPhotoResponse {
716 /// The updated person, if person_fields is set in the DeleteContactPhotoRequest; otherwise this will be unset.
717 pub person: Option<Person>,
718}
719
720impl common::ResponseResult for DeleteContactPhotoResponse {}
721
722/// A Google Workspace Domain membership.
723///
724/// This type is not used in any activity, and only used as *part* of another schema.
725///
726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
727#[serde_with::serde_as]
728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
729pub struct DomainMembership {
730 /// True if the person is in the viewer's Google Workspace domain.
731 #[serde(rename = "inViewerDomain")]
732 pub in_viewer_domain: Option<bool>,
733}
734
735impl common::Part for DomainMembership {}
736
737/// A person's email address.
738///
739/// This type is not used in any activity, and only used as *part* of another schema.
740///
741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
742#[serde_with::serde_as]
743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
744pub struct EmailAddress {
745 /// The display name of the email.
746 #[serde(rename = "displayName")]
747 pub display_name: Option<String>,
748 /// Output only. The type of the email address translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
749 #[serde(rename = "formattedType")]
750 pub formatted_type: Option<String>,
751 /// Metadata about the email address.
752 pub metadata: Option<FieldMetadata>,
753 /// The type of the email address. The type can be custom or one of these predefined values: * `home` * `work` * `other`
754 #[serde(rename = "type")]
755 pub type_: Option<String>,
756 /// The email address.
757 pub value: Option<String>,
758}
759
760impl common::Part for EmailAddress {}
761
762/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
763///
764/// # Activities
765///
766/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
767/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
768///
769/// * [delete contact groups](ContactGroupDeleteCall) (response)
770/// * [batch delete contacts people](PersonBatchDeleteContactCall) (response)
771/// * [delete contact people](PersonDeleteContactCall) (response)
772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
773#[serde_with::serde_as]
774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
775pub struct Empty {
776 _never_set: Option<bool>,
777}
778
779impl common::ResponseResult for Empty {}
780
781/// An event related to the person.
782///
783/// This type is not used in any activity, and only used as *part* of another schema.
784///
785#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
786#[serde_with::serde_as]
787#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
788pub struct Event {
789 /// The date of the event.
790 pub date: Option<Date>,
791 /// Output only. The type of the event translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
792 #[serde(rename = "formattedType")]
793 pub formatted_type: Option<String>,
794 /// Metadata about the event.
795 pub metadata: Option<FieldMetadata>,
796 /// The type of the event. The type can be custom or one of these predefined values: * `anniversary` * `other`
797 #[serde(rename = "type")]
798 pub type_: Option<String>,
799}
800
801impl common::Part for Event {}
802
803/// An identifier from an external entity related to the person.
804///
805/// This type is not used in any activity, and only used as *part* of another schema.
806///
807#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
808#[serde_with::serde_as]
809#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
810pub struct ExternalId {
811 /// Output only. The type of the event translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
812 #[serde(rename = "formattedType")]
813 pub formatted_type: Option<String>,
814 /// Metadata about the external ID.
815 pub metadata: Option<FieldMetadata>,
816 /// The type of the external ID. The type can be custom or one of these predefined values: * `account` * `customer` * `loginId` * `network` * `organization`
817 #[serde(rename = "type")]
818 pub type_: Option<String>,
819 /// The value of the external ID.
820 pub value: Option<String>,
821}
822
823impl common::Part for ExternalId {}
824
825/// Metadata about a field.
826///
827/// This type is not used in any activity, and only used as *part* of another schema.
828///
829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
830#[serde_with::serde_as]
831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
832pub struct FieldMetadata {
833 /// Output only. True if the field is the primary field for all sources in the person. Each person will have at most one field with `primary` set to true.
834 pub primary: Option<bool>,
835 /// The source of the field.
836 pub source: Option<Source>,
837 /// True if the field is the primary field for the source. Each source must have at most one field with `source_primary` set to true.
838 #[serde(rename = "sourcePrimary")]
839 pub source_primary: Option<bool>,
840 /// Output only. True if the field is verified; false if the field is unverified. A verified field is typically a name, email address, phone number, or website that has been confirmed to be owned by the person.
841 pub verified: Option<bool>,
842}
843
844impl common::Part for FieldMetadata {}
845
846/// The name that should be used to sort the person in a list.
847///
848/// This type is not used in any activity, and only used as *part* of another schema.
849///
850#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
851#[serde_with::serde_as]
852#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
853pub struct FileAs {
854 /// Metadata about the file-as.
855 pub metadata: Option<FieldMetadata>,
856 /// The file-as value
857 pub value: Option<String>,
858}
859
860impl common::Part for FileAs {}
861
862/// A person's gender.
863///
864/// This type is not used in any activity, and only used as *part* of another schema.
865///
866#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
867#[serde_with::serde_as]
868#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
869pub struct Gender {
870 /// Free form text field for pronouns that should be used to address the person. Common values are: * `he`/`him` * `she`/`her` * `they`/`them`
871 #[serde(rename = "addressMeAs")]
872 pub address_me_as: Option<String>,
873 /// Output only. The value of the gender translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale. Unspecified or custom value are not localized.
874 #[serde(rename = "formattedValue")]
875 pub formatted_value: Option<String>,
876 /// Metadata about the gender.
877 pub metadata: Option<FieldMetadata>,
878 /// The gender for the person. The gender can be custom or one of these predefined values: * `male` * `female` * `unspecified`
879 pub value: Option<String>,
880}
881
882impl common::Part for Gender {}
883
884/// The response to a get request for a list of people by resource name.
885///
886/// # Activities
887///
888/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
889/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
890///
891/// * [get batch get people](PersonGetBatchGetCall) (response)
892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
893#[serde_with::serde_as]
894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
895pub struct GetPeopleResponse {
896 /// The response for each requested resource name.
897 pub responses: Option<Vec<PersonResponse>>,
898}
899
900impl common::ResponseResult for GetPeopleResponse {}
901
902/// Arbitrary client data that is populated by clients. Duplicate keys and values are allowed.
903///
904/// This type is not used in any activity, and only used as *part* of another schema.
905///
906#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
907#[serde_with::serde_as]
908#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
909pub struct GroupClientData {
910 /// The client specified key of the client data.
911 pub key: Option<String>,
912 /// The client specified value of the client data.
913 pub value: Option<String>,
914}
915
916impl common::Part for GroupClientData {}
917
918/// A person's instant messaging client.
919///
920/// This type is not used in any activity, and only used as *part* of another schema.
921///
922#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
923#[serde_with::serde_as]
924#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
925pub struct ImClient {
926 /// Output only. The protocol of the IM client formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
927 #[serde(rename = "formattedProtocol")]
928 pub formatted_protocol: Option<String>,
929 /// Output only. The type of the IM client translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
930 #[serde(rename = "formattedType")]
931 pub formatted_type: Option<String>,
932 /// Metadata about the IM client.
933 pub metadata: Option<FieldMetadata>,
934 /// The protocol of the IM client. The protocol can be custom or one of these predefined values: * `aim` * `msn` * `yahoo` * `skype` * `qq` * `googleTalk` * `icq` * `jabber` * `netMeeting`
935 pub protocol: Option<String>,
936 /// The type of the IM client. The type can be custom or one of these predefined values: * `home` * `work` * `other`
937 #[serde(rename = "type")]
938 pub type_: Option<String>,
939 /// The user name used in the IM client.
940 pub username: Option<String>,
941}
942
943impl common::Part for ImClient {}
944
945/// One of the person's interests.
946///
947/// This type is not used in any activity, and only used as *part* of another schema.
948///
949#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
950#[serde_with::serde_as]
951#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
952pub struct Interest {
953 /// Metadata about the interest.
954 pub metadata: Option<FieldMetadata>,
955 /// The interest; for example, `stargazing`.
956 pub value: Option<String>,
957}
958
959impl common::Part for Interest {}
960
961/// The response to a request for the authenticated user’s connections.
962///
963/// # Activities
964///
965/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
966/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
967///
968/// * [connections list people](PersonConnectionListCall) (response)
969#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
970#[serde_with::serde_as]
971#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
972pub struct ListConnectionsResponse {
973 /// The list of people that the requestor is connected to.
974 pub connections: Option<Vec<Person>>,
975 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
976 #[serde(rename = "nextPageToken")]
977 pub next_page_token: Option<String>,
978 /// A token, which can be sent as `sync_token` to retrieve changes since the last request. Request must set `request_sync_token` to return the sync token. When the response is paginated, only the last page will contain `nextSyncToken`.
979 #[serde(rename = "nextSyncToken")]
980 pub next_sync_token: Option<String>,
981 /// The total number of items in the list without pagination.
982 #[serde(rename = "totalItems")]
983 pub total_items: Option<i32>,
984 /// **DEPRECATED** (Please use totalItems) The total number of people in the list without pagination.
985 #[serde(rename = "totalPeople")]
986 pub total_people: Option<i32>,
987}
988
989impl common::ResponseResult for ListConnectionsResponse {}
990
991/// The response to a list contact groups request.
992///
993/// # Activities
994///
995/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
996/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
997///
998/// * [list contact groups](ContactGroupListCall) (response)
999#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1000#[serde_with::serde_as]
1001#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1002pub struct ListContactGroupsResponse {
1003 /// The list of contact groups. Members of the contact groups are not populated.
1004 #[serde(rename = "contactGroups")]
1005 pub contact_groups: Option<Vec<ContactGroup>>,
1006 /// The token that can be used to retrieve the next page of results.
1007 #[serde(rename = "nextPageToken")]
1008 pub next_page_token: Option<String>,
1009 /// The token that can be used to retrieve changes since the last request.
1010 #[serde(rename = "nextSyncToken")]
1011 pub next_sync_token: Option<String>,
1012 /// The total number of items in the list without pagination.
1013 #[serde(rename = "totalItems")]
1014 pub total_items: Option<i32>,
1015}
1016
1017impl common::ResponseResult for ListContactGroupsResponse {}
1018
1019/// The response to a request for the authenticated user’s domain directory.
1020///
1021/// # Activities
1022///
1023/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1024/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1025///
1026/// * [list directory people people](PersonListDirectoryPersonCall) (response)
1027#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1028#[serde_with::serde_as]
1029#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1030pub struct ListDirectoryPeopleResponse {
1031 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1032 #[serde(rename = "nextPageToken")]
1033 pub next_page_token: Option<String>,
1034 /// A token, which can be sent as `sync_token` to retrieve changes since the last request. Request must set `request_sync_token` to return the sync token.
1035 #[serde(rename = "nextSyncToken")]
1036 pub next_sync_token: Option<String>,
1037 /// The list of people in the domain directory.
1038 pub people: Option<Vec<Person>>,
1039}
1040
1041impl common::ResponseResult for ListDirectoryPeopleResponse {}
1042
1043/// The response to a request for the authenticated user’s “Other contacts”.
1044///
1045/// # Activities
1046///
1047/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1048/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1049///
1050/// * [list other contacts](OtherContactListCall) (response)
1051#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1052#[serde_with::serde_as]
1053#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1054pub struct ListOtherContactsResponse {
1055 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1056 #[serde(rename = "nextPageToken")]
1057 pub next_page_token: Option<String>,
1058 /// A token, which can be sent as `sync_token` to retrieve changes since the last request. Request must set `request_sync_token` to return the sync token.
1059 #[serde(rename = "nextSyncToken")]
1060 pub next_sync_token: Option<String>,
1061 /// The list of "Other contacts" returned as Person resources. "Other contacts" support a limited subset of fields. See ListOtherContactsRequest.request_mask for more detailed information.
1062 #[serde(rename = "otherContacts")]
1063 pub other_contacts: Option<Vec<Person>>,
1064 /// The total number of other contacts in the list without pagination.
1065 #[serde(rename = "totalSize")]
1066 pub total_size: Option<i32>,
1067}
1068
1069impl common::ResponseResult for ListOtherContactsResponse {}
1070
1071/// A person's locale preference.
1072///
1073/// This type is not used in any activity, and only used as *part* of another schema.
1074///
1075#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1076#[serde_with::serde_as]
1077#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1078pub struct Locale {
1079 /// Metadata about the locale.
1080 pub metadata: Option<FieldMetadata>,
1081 /// The well-formed [IETF BCP 47](https://tools.ietf.org/html/bcp47) language tag representing the locale.
1082 pub value: Option<String>,
1083}
1084
1085impl common::Part for Locale {}
1086
1087/// A person's location.
1088///
1089/// This type is not used in any activity, and only used as *part* of another schema.
1090///
1091#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1092#[serde_with::serde_as]
1093#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1094pub struct Location {
1095 /// The building identifier.
1096 #[serde(rename = "buildingId")]
1097 pub building_id: Option<String>,
1098 /// Whether the location is the current location.
1099 pub current: Option<bool>,
1100 /// The individual desk location.
1101 #[serde(rename = "deskCode")]
1102 pub desk_code: Option<String>,
1103 /// The floor name or number.
1104 pub floor: Option<String>,
1105 /// The floor section in `floor_name`.
1106 #[serde(rename = "floorSection")]
1107 pub floor_section: Option<String>,
1108 /// Metadata about the location.
1109 pub metadata: Option<FieldMetadata>,
1110 /// The type of the location. The type can be custom or one of these predefined values: * `desk` * `grewUp`
1111 #[serde(rename = "type")]
1112 pub type_: Option<String>,
1113 /// The free-form value of the location.
1114 pub value: Option<String>,
1115}
1116
1117impl common::Part for Location {}
1118
1119/// A person's membership in a group. Only contact group memberships can be modified.
1120///
1121/// This type is not used in any activity, and only used as *part* of another schema.
1122///
1123#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1124#[serde_with::serde_as]
1125#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1126pub struct Membership {
1127 /// The contact group membership.
1128 #[serde(rename = "contactGroupMembership")]
1129 pub contact_group_membership: Option<ContactGroupMembership>,
1130 /// Output only. The domain membership.
1131 #[serde(rename = "domainMembership")]
1132 pub domain_membership: Option<DomainMembership>,
1133 /// Metadata about the membership.
1134 pub metadata: Option<FieldMetadata>,
1135}
1136
1137impl common::Part for Membership {}
1138
1139/// A person's miscellaneous keyword.
1140///
1141/// This type is not used in any activity, and only used as *part* of another schema.
1142///
1143#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1144#[serde_with::serde_as]
1145#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1146pub struct MiscKeyword {
1147 /// Output only. The type of the miscellaneous keyword translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
1148 #[serde(rename = "formattedType")]
1149 pub formatted_type: Option<String>,
1150 /// Metadata about the miscellaneous keyword.
1151 pub metadata: Option<FieldMetadata>,
1152 /// The miscellaneous keyword type.
1153 #[serde(rename = "type")]
1154 pub type_: Option<String>,
1155 /// The value of the miscellaneous keyword.
1156 pub value: Option<String>,
1157}
1158
1159impl common::Part for MiscKeyword {}
1160
1161/// A request to modify an existing contact group’s members. Contacts can be removed from any group but they can only be added to a user group or “myContacts” or “starred” system groups.
1162///
1163/// # Activities
1164///
1165/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1166/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1167///
1168/// * [members modify contact groups](ContactGroupMemberModifyCall) (request)
1169#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1170#[serde_with::serde_as]
1171#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1172pub struct ModifyContactGroupMembersRequest {
1173 /// Optional. The resource names of the contact people to add in the form of `people/{person_id}`. The total number of resource names in `resource_names_to_add` and `resource_names_to_remove` must be less than or equal to 1000.
1174 #[serde(rename = "resourceNamesToAdd")]
1175 pub resource_names_to_add: Option<Vec<String>>,
1176 /// Optional. The resource names of the contact people to remove in the form of `people/{person_id}`. The total number of resource names in `resource_names_to_add` and `resource_names_to_remove` must be less than or equal to 1000.
1177 #[serde(rename = "resourceNamesToRemove")]
1178 pub resource_names_to_remove: Option<Vec<String>>,
1179}
1180
1181impl common::RequestValue for ModifyContactGroupMembersRequest {}
1182
1183/// The response to a modify contact group members request.
1184///
1185/// # Activities
1186///
1187/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1188/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1189///
1190/// * [members modify contact groups](ContactGroupMemberModifyCall) (response)
1191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1192#[serde_with::serde_as]
1193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1194pub struct ModifyContactGroupMembersResponse {
1195 /// The contact people resource names that cannot be removed from their last contact group.
1196 #[serde(rename = "canNotRemoveLastContactGroupResourceNames")]
1197 pub can_not_remove_last_contact_group_resource_names: Option<Vec<String>>,
1198 /// The contact people resource names that were not found.
1199 #[serde(rename = "notFoundResourceNames")]
1200 pub not_found_resource_names: Option<Vec<String>>,
1201}
1202
1203impl common::ResponseResult for ModifyContactGroupMembersResponse {}
1204
1205/// A person's name. If the name is a mononym, the family name is empty.
1206///
1207/// This type is not used in any activity, and only used as *part* of another schema.
1208///
1209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1210#[serde_with::serde_as]
1211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1212pub struct Name {
1213 /// Output only. The display name formatted according to the locale specified by the viewer's account or the `Accept-Language` HTTP header.
1214 #[serde(rename = "displayName")]
1215 pub display_name: Option<String>,
1216 /// Output only. The display name with the last name first formatted according to the locale specified by the viewer's account or the `Accept-Language` HTTP header.
1217 #[serde(rename = "displayNameLastFirst")]
1218 pub display_name_last_first: Option<String>,
1219 /// The family name.
1220 #[serde(rename = "familyName")]
1221 pub family_name: Option<String>,
1222 /// The given name.
1223 #[serde(rename = "givenName")]
1224 pub given_name: Option<String>,
1225 /// The honorific prefixes, such as `Mrs.` or `Dr.`
1226 #[serde(rename = "honorificPrefix")]
1227 pub honorific_prefix: Option<String>,
1228 /// The honorific suffixes, such as `Jr.`
1229 #[serde(rename = "honorificSuffix")]
1230 pub honorific_suffix: Option<String>,
1231 /// Metadata about the name.
1232 pub metadata: Option<FieldMetadata>,
1233 /// The middle name(s).
1234 #[serde(rename = "middleName")]
1235 pub middle_name: Option<String>,
1236 /// The family name spelled as it sounds.
1237 #[serde(rename = "phoneticFamilyName")]
1238 pub phonetic_family_name: Option<String>,
1239 /// The full name spelled as it sounds.
1240 #[serde(rename = "phoneticFullName")]
1241 pub phonetic_full_name: Option<String>,
1242 /// The given name spelled as it sounds.
1243 #[serde(rename = "phoneticGivenName")]
1244 pub phonetic_given_name: Option<String>,
1245 /// The honorific prefixes spelled as they sound.
1246 #[serde(rename = "phoneticHonorificPrefix")]
1247 pub phonetic_honorific_prefix: Option<String>,
1248 /// The honorific suffixes spelled as they sound.
1249 #[serde(rename = "phoneticHonorificSuffix")]
1250 pub phonetic_honorific_suffix: Option<String>,
1251 /// The middle name(s) spelled as they sound.
1252 #[serde(rename = "phoneticMiddleName")]
1253 pub phonetic_middle_name: Option<String>,
1254 /// The free form name value.
1255 #[serde(rename = "unstructuredName")]
1256 pub unstructured_name: Option<String>,
1257}
1258
1259impl common::Part for Name {}
1260
1261/// A person's nickname.
1262///
1263/// This type is not used in any activity, and only used as *part* of another schema.
1264///
1265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1266#[serde_with::serde_as]
1267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1268pub struct Nickname {
1269 /// Metadata about the nickname.
1270 pub metadata: Option<FieldMetadata>,
1271 /// The type of the nickname.
1272 #[serde(rename = "type")]
1273 pub type_: Option<String>,
1274 /// The nickname.
1275 pub value: Option<String>,
1276}
1277
1278impl common::Part for Nickname {}
1279
1280/// A person's occupation.
1281///
1282/// This type is not used in any activity, and only used as *part* of another schema.
1283///
1284#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1285#[serde_with::serde_as]
1286#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1287pub struct Occupation {
1288 /// Metadata about the occupation.
1289 pub metadata: Option<FieldMetadata>,
1290 /// The occupation; for example, `carpenter`.
1291 pub value: Option<String>,
1292}
1293
1294impl common::Part for Occupation {}
1295
1296/// A person's past or current organization. Overlapping date ranges are permitted.
1297///
1298/// This type is not used in any activity, and only used as *part* of another schema.
1299///
1300#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1301#[serde_with::serde_as]
1302#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1303pub struct Organization {
1304 /// The person's cost center at the organization.
1305 #[serde(rename = "costCenter")]
1306 pub cost_center: Option<String>,
1307 /// True if the organization is the person's current organization; false if the organization is a past organization.
1308 pub current: Option<bool>,
1309 /// The person's department at the organization.
1310 pub department: Option<String>,
1311 /// The domain name associated with the organization; for example, `google.com`.
1312 pub domain: Option<String>,
1313 /// The end date when the person left the organization.
1314 #[serde(rename = "endDate")]
1315 pub end_date: Option<Date>,
1316 /// Output only. The type of the organization translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
1317 #[serde(rename = "formattedType")]
1318 pub formatted_type: Option<String>,
1319 /// The person's full-time equivalent millipercent within the organization (100000 = 100%).
1320 #[serde(rename = "fullTimeEquivalentMillipercent")]
1321 pub full_time_equivalent_millipercent: Option<i32>,
1322 /// The person's job description at the organization.
1323 #[serde(rename = "jobDescription")]
1324 pub job_description: Option<String>,
1325 /// The location of the organization office the person works at.
1326 pub location: Option<String>,
1327 /// Metadata about the organization.
1328 pub metadata: Option<FieldMetadata>,
1329 /// The name of the organization.
1330 pub name: Option<String>,
1331 /// The phonetic name of the organization.
1332 #[serde(rename = "phoneticName")]
1333 pub phonetic_name: Option<String>,
1334 /// The start date when the person joined the organization.
1335 #[serde(rename = "startDate")]
1336 pub start_date: Option<Date>,
1337 /// The symbol associated with the organization; for example, a stock ticker symbol, abbreviation, or acronym.
1338 pub symbol: Option<String>,
1339 /// The person's job title at the organization.
1340 pub title: Option<String>,
1341 /// The type of the organization. The type can be custom or one of these predefined values: * `work` * `school`
1342 #[serde(rename = "type")]
1343 pub type_: Option<String>,
1344}
1345
1346impl common::Part for Organization {}
1347
1348/// Information about a person merged from various data sources such as the authenticated user’s contacts and profile data. Most fields can have multiple items. The items in a field have no guaranteed order, but each non-empty field is guaranteed to have exactly one field with `metadata.primary` set to true.
1349///
1350/// # Activities
1351///
1352/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1353/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1354///
1355/// * [copy other contact to my contacts group other contacts](OtherContactCopyOtherContactToMyContactsGroupCall) (response)
1356/// * [create contact people](PersonCreateContactCall) (request|response)
1357/// * [get people](PersonGetCall) (response)
1358/// * [update contact people](PersonUpdateContactCall) (request|response)
1359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1360#[serde_with::serde_as]
1361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1362pub struct Person {
1363 /// The person's street addresses.
1364 pub addresses: Option<Vec<Address>>,
1365 /// Output only. **DEPRECATED** (Please use `person.ageRanges` instead) The person's age range.
1366 #[serde(rename = "ageRange")]
1367 pub age_range: Option<String>,
1368 /// Output only. The person's age ranges.
1369 #[serde(rename = "ageRanges")]
1370 pub age_ranges: Option<Vec<AgeRangeType>>,
1371 /// The person's biographies. This field is a singleton for contact sources.
1372 pub biographies: Option<Vec<Biography>>,
1373 /// The person's birthdays. This field is a singleton for contact sources.
1374 pub birthdays: Option<Vec<Birthday>>,
1375 /// **DEPRECATED**: No data will be returned The person's bragging rights.
1376 #[serde(rename = "braggingRights")]
1377 pub bragging_rights: Option<Vec<BraggingRights>>,
1378 /// The person's calendar URLs.
1379 #[serde(rename = "calendarUrls")]
1380 pub calendar_urls: Option<Vec<CalendarUrl>>,
1381 /// The person's client data.
1382 #[serde(rename = "clientData")]
1383 pub client_data: Option<Vec<ClientData>>,
1384 /// Output only. The person's cover photos.
1385 #[serde(rename = "coverPhotos")]
1386 pub cover_photos: Option<Vec<CoverPhoto>>,
1387 /// The person's email addresses. For `people.connections.list` and `otherContacts.list` the number of email addresses is limited to 100. If a Person has more email addresses the entire set can be obtained by calling GetPeople.
1388 #[serde(rename = "emailAddresses")]
1389 pub email_addresses: Option<Vec<EmailAddress>>,
1390 /// The [HTTP entity tag](https://en.wikipedia.org/wiki/HTTP_ETag) of the resource. Used for web cache validation.
1391 pub etag: Option<String>,
1392 /// The person's events.
1393 pub events: Option<Vec<Event>>,
1394 /// The person's external IDs.
1395 #[serde(rename = "externalIds")]
1396 pub external_ids: Option<Vec<ExternalId>>,
1397 /// The person's file-ases.
1398 #[serde(rename = "fileAses")]
1399 pub file_ases: Option<Vec<FileAs>>,
1400 /// The person's genders. This field is a singleton for contact sources.
1401 pub genders: Option<Vec<Gender>>,
1402 /// The person's instant messaging clients.
1403 #[serde(rename = "imClients")]
1404 pub im_clients: Option<Vec<ImClient>>,
1405 /// The person's interests.
1406 pub interests: Option<Vec<Interest>>,
1407 /// The person's locale preferences.
1408 pub locales: Option<Vec<Locale>>,
1409 /// The person's locations.
1410 pub locations: Option<Vec<Location>>,
1411 /// The person's group memberships.
1412 pub memberships: Option<Vec<Membership>>,
1413 /// Output only. Metadata about the person.
1414 pub metadata: Option<PersonMetadata>,
1415 /// The person's miscellaneous keywords.
1416 #[serde(rename = "miscKeywords")]
1417 pub misc_keywords: Option<Vec<MiscKeyword>>,
1418 /// The person's names. This field is a singleton for contact sources.
1419 pub names: Option<Vec<Name>>,
1420 /// The person's nicknames.
1421 pub nicknames: Option<Vec<Nickname>>,
1422 /// The person's occupations.
1423 pub occupations: Option<Vec<Occupation>>,
1424 /// The person's past or current organizations.
1425 pub organizations: Option<Vec<Organization>>,
1426 /// The person's phone numbers. For `people.connections.list` and `otherContacts.list` the number of phone numbers is limited to 100. If a Person has more phone numbers the entire set can be obtained by calling GetPeople.
1427 #[serde(rename = "phoneNumbers")]
1428 pub phone_numbers: Option<Vec<PhoneNumber>>,
1429 /// Output only. The person's photos.
1430 pub photos: Option<Vec<Photo>>,
1431 /// The person's relations.
1432 pub relations: Option<Vec<Relation>>,
1433 /// Output only. **DEPRECATED**: No data will be returned The person's relationship interests.
1434 #[serde(rename = "relationshipInterests")]
1435 pub relationship_interests: Option<Vec<RelationshipInterest>>,
1436 /// Output only. **DEPRECATED**: No data will be returned The person's relationship statuses.
1437 #[serde(rename = "relationshipStatuses")]
1438 pub relationship_statuses: Option<Vec<RelationshipStatus>>,
1439 /// **DEPRECATED**: (Please use `person.locations` instead) The person's residences.
1440 pub residences: Option<Vec<Residence>>,
1441 /// The resource name for the person, assigned by the server. An ASCII string in the form of `people/{person_id}`.
1442 #[serde(rename = "resourceName")]
1443 pub resource_name: Option<String>,
1444 /// The person's SIP addresses.
1445 #[serde(rename = "sipAddresses")]
1446 pub sip_addresses: Option<Vec<SipAddress>>,
1447 /// The person's skills.
1448 pub skills: Option<Vec<Skill>>,
1449 /// Output only. **DEPRECATED**: No data will be returned The person's taglines.
1450 pub taglines: Option<Vec<Tagline>>,
1451 /// The person's associated URLs.
1452 pub urls: Option<Vec<Url>>,
1453 /// The person's user defined data.
1454 #[serde(rename = "userDefined")]
1455 pub user_defined: Option<Vec<UserDefined>>,
1456}
1457
1458impl common::RequestValue for Person {}
1459impl common::ResponseResult for Person {}
1460
1461/// The metadata about a person.
1462///
1463/// This type is not used in any activity, and only used as *part* of another schema.
1464///
1465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1466#[serde_with::serde_as]
1467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1468pub struct PersonMetadata {
1469 /// Output only. True if the person resource has been deleted. Populated only for `people.connections.list` and `otherContacts.list` sync requests.
1470 pub deleted: Option<bool>,
1471 /// Output only. Resource names of people linked to this resource.
1472 #[serde(rename = "linkedPeopleResourceNames")]
1473 pub linked_people_resource_names: Option<Vec<String>>,
1474 /// Output only. **DEPRECATED** (Please use `person.metadata.sources.profileMetadata.objectType` instead) The type of the person object.
1475 #[serde(rename = "objectType")]
1476 pub object_type: Option<String>,
1477 /// Output only. Any former resource names this person has had. Populated only for `people.connections.list` requests that include a sync token. The resource name may change when adding or removing fields that link a contact and profile such as a verified email, verified phone number, or profile URL.
1478 #[serde(rename = "previousResourceNames")]
1479 pub previous_resource_names: Option<Vec<String>>,
1480 /// The sources of data for the person.
1481 pub sources: Option<Vec<Source>>,
1482}
1483
1484impl common::Part for PersonMetadata {}
1485
1486/// The response for a single person
1487///
1488/// This type is not used in any activity, and only used as *part* of another schema.
1489///
1490#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1491#[serde_with::serde_as]
1492#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1493pub struct PersonResponse {
1494 /// **DEPRECATED** (Please use status instead) [HTTP 1.1 status code] (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html).
1495 #[serde(rename = "httpStatusCode")]
1496 pub http_status_code: Option<i32>,
1497 /// The person.
1498 pub person: Option<Person>,
1499 /// The original requested resource name. May be different than the resource name on the returned person. The resource name can change when adding or removing fields that link a contact and profile such as a verified email, verified phone number, or a profile URL.
1500 #[serde(rename = "requestedResourceName")]
1501 pub requested_resource_name: Option<String>,
1502 /// The status of the response.
1503 pub status: Option<Status>,
1504}
1505
1506impl common::Part for PersonResponse {}
1507
1508/// A person's phone number.
1509///
1510/// This type is not used in any activity, and only used as *part* of another schema.
1511///
1512#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1513#[serde_with::serde_as]
1514#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1515pub struct PhoneNumber {
1516 /// Output only. The canonicalized [ITU-T E.164](https://law.resource.org/pub/us/cfr/ibr/004/itu-t.E.164.1.2008.pdf) form of the phone number.
1517 #[serde(rename = "canonicalForm")]
1518 pub canonical_form: Option<String>,
1519 /// Output only. The type of the phone number translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
1520 #[serde(rename = "formattedType")]
1521 pub formatted_type: Option<String>,
1522 /// Metadata about the phone number.
1523 pub metadata: Option<FieldMetadata>,
1524 /// The type of the phone number. The type can be custom or one of these predefined values: * `home` * `work` * `mobile` * `homeFax` * `workFax` * `otherFax` * `pager` * `workMobile` * `workPager` * `main` * `googleVoice` * `other`
1525 #[serde(rename = "type")]
1526 pub type_: Option<String>,
1527 /// The phone number.
1528 pub value: Option<String>,
1529}
1530
1531impl common::Part for PhoneNumber {}
1532
1533/// A person's photo. A picture shown next to the person's name to help others recognize the person.
1534///
1535/// This type is not used in any activity, and only used as *part* of another schema.
1536///
1537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1538#[serde_with::serde_as]
1539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1540pub struct Photo {
1541 /// True if the photo is a default photo; false if the photo is a user-provided photo.
1542 pub default: Option<bool>,
1543 /// Metadata about the photo.
1544 pub metadata: Option<FieldMetadata>,
1545 /// The URL of the photo. You can change the desired size by appending a query parameter `sz={size}` at the end of the url, where {size} is the size in pixels. Example: https://lh3.googleusercontent.com/-T_wVWLlmg7w/AAAAAAAAAAI/AAAAAAAABa8/00gzXvDBYqw/s100/photo.jpg?sz=50
1546 pub url: Option<String>,
1547}
1548
1549impl common::Part for Photo {}
1550
1551/// The metadata about a profile.
1552///
1553/// This type is not used in any activity, and only used as *part* of another schema.
1554///
1555#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1556#[serde_with::serde_as]
1557#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1558pub struct ProfileMetadata {
1559 /// Output only. The profile object type.
1560 #[serde(rename = "objectType")]
1561 pub object_type: Option<String>,
1562 /// Output only. The user types.
1563 #[serde(rename = "userTypes")]
1564 pub user_types: Option<Vec<String>>,
1565}
1566
1567impl common::Part for ProfileMetadata {}
1568
1569/// A person's relation to another person.
1570///
1571/// This type is not used in any activity, and only used as *part* of another schema.
1572///
1573#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1574#[serde_with::serde_as]
1575#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1576pub struct Relation {
1577 /// Output only. The type of the relation translated and formatted in the viewer's account locale or the locale specified in the Accept-Language HTTP header.
1578 #[serde(rename = "formattedType")]
1579 pub formatted_type: Option<String>,
1580 /// Metadata about the relation.
1581 pub metadata: Option<FieldMetadata>,
1582 /// The name of the other person this relation refers to.
1583 pub person: Option<String>,
1584 /// The person's relation to the other person. The type can be custom or one of these predefined values: * `spouse` * `child` * `mother` * `father` * `parent` * `brother` * `sister` * `friend` * `relative` * `domesticPartner` * `manager` * `assistant` * `referredBy` * `partner`
1585 #[serde(rename = "type")]
1586 pub type_: Option<String>,
1587}
1588
1589impl common::Part for Relation {}
1590
1591/// **DEPRECATED**: No data will be returned A person's relationship interest .
1592///
1593/// This type is not used in any activity, and only used as *part* of another schema.
1594///
1595#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1596#[serde_with::serde_as]
1597#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1598pub struct RelationshipInterest {
1599 /// Output only. The value of the relationship interest translated and formatted in the viewer's account locale or the locale specified in the Accept-Language HTTP header.
1600 #[serde(rename = "formattedValue")]
1601 pub formatted_value: Option<String>,
1602 /// Metadata about the relationship interest.
1603 pub metadata: Option<FieldMetadata>,
1604 /// The kind of relationship the person is looking for. The value can be custom or one of these predefined values: * `friend` * `date` * `relationship` * `networking`
1605 pub value: Option<String>,
1606}
1607
1608impl common::Part for RelationshipInterest {}
1609
1610/// **DEPRECATED**: No data will be returned A person's relationship status.
1611///
1612/// This type is not used in any activity, and only used as *part* of another schema.
1613///
1614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1615#[serde_with::serde_as]
1616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1617pub struct RelationshipStatus {
1618 /// Output only. The value of the relationship status translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
1619 #[serde(rename = "formattedValue")]
1620 pub formatted_value: Option<String>,
1621 /// Metadata about the relationship status.
1622 pub metadata: Option<FieldMetadata>,
1623 /// The relationship status. The value can be custom or one of these predefined values: * `single` * `inARelationship` * `engaged` * `married` * `itsComplicated` * `openRelationship` * `widowed` * `inDomesticPartnership` * `inCivilUnion`
1624 pub value: Option<String>,
1625}
1626
1627impl common::Part for RelationshipStatus {}
1628
1629/// **DEPRECATED**: Please use `person.locations` instead. A person's past or current residence.
1630///
1631/// This type is not used in any activity, and only used as *part* of another schema.
1632///
1633#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1634#[serde_with::serde_as]
1635#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1636pub struct Residence {
1637 /// True if the residence is the person's current residence; false if the residence is a past residence.
1638 pub current: Option<bool>,
1639 /// Metadata about the residence.
1640 pub metadata: Option<FieldMetadata>,
1641 /// The address of the residence.
1642 pub value: Option<String>,
1643}
1644
1645impl common::Part for Residence {}
1646
1647/// The response to a request for people in the authenticated user’s domain directory that match the specified query.
1648///
1649/// # Activities
1650///
1651/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1652/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1653///
1654/// * [search directory people people](PersonSearchDirectoryPersonCall) (response)
1655#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1656#[serde_with::serde_as]
1657#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1658pub struct SearchDirectoryPeopleResponse {
1659 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1660 #[serde(rename = "nextPageToken")]
1661 pub next_page_token: Option<String>,
1662 /// The list of people in the domain directory that match the query.
1663 pub people: Option<Vec<Person>>,
1664 /// The total number of items in the list without pagination.
1665 #[serde(rename = "totalSize")]
1666 pub total_size: Option<i32>,
1667}
1668
1669impl common::ResponseResult for SearchDirectoryPeopleResponse {}
1670
1671/// The response to a search request for the authenticated user, given a query.
1672///
1673/// # Activities
1674///
1675/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1676/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1677///
1678/// * [search other contacts](OtherContactSearchCall) (response)
1679/// * [search contacts people](PersonSearchContactCall) (response)
1680#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1681#[serde_with::serde_as]
1682#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1683pub struct SearchResponse {
1684 /// The results of the request.
1685 pub results: Option<Vec<SearchResult>>,
1686}
1687
1688impl common::ResponseResult for SearchResponse {}
1689
1690/// A result of a search query.
1691///
1692/// This type is not used in any activity, and only used as *part* of another schema.
1693///
1694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1695#[serde_with::serde_as]
1696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1697pub struct SearchResult {
1698 /// The matched Person.
1699 pub person: Option<Person>,
1700}
1701
1702impl common::Part for SearchResult {}
1703
1704/// A person's SIP address. Session Initial Protocol addresses are used for VoIP communications to make voice or video calls over the internet.
1705///
1706/// This type is not used in any activity, and only used as *part* of another schema.
1707///
1708#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1709#[serde_with::serde_as]
1710#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1711pub struct SipAddress {
1712 /// Output only. The type of the SIP address translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
1713 #[serde(rename = "formattedType")]
1714 pub formatted_type: Option<String>,
1715 /// Metadata about the SIP address.
1716 pub metadata: Option<FieldMetadata>,
1717 /// The type of the SIP address. The type can be custom or or one of these predefined values: * `home` * `work` * `mobile` * `other`
1718 #[serde(rename = "type")]
1719 pub type_: Option<String>,
1720 /// The SIP address in the [RFC 3261 19.1](https://tools.ietf.org/html/rfc3261#section-19.1) SIP URI format.
1721 pub value: Option<String>,
1722}
1723
1724impl common::Part for SipAddress {}
1725
1726/// A skill that the person has.
1727///
1728/// This type is not used in any activity, and only used as *part* of another schema.
1729///
1730#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1731#[serde_with::serde_as]
1732#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1733pub struct Skill {
1734 /// Metadata about the skill.
1735 pub metadata: Option<FieldMetadata>,
1736 /// The skill; for example, `underwater basket weaving`.
1737 pub value: Option<String>,
1738}
1739
1740impl common::Part for Skill {}
1741
1742/// The source of a field.
1743///
1744/// This type is not used in any activity, and only used as *part* of another schema.
1745///
1746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1747#[serde_with::serde_as]
1748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1749pub struct Source {
1750 /// **Only populated in `person.metadata.sources`.** The [HTTP entity tag](https://en.wikipedia.org/wiki/HTTP_ETag) of the source. Used for web cache validation.
1751 pub etag: Option<String>,
1752 /// The unique identifier within the source type generated by the server.
1753 pub id: Option<String>,
1754 /// Output only. **Only populated in `person.metadata.sources`.** Metadata about a source of type PROFILE.
1755 #[serde(rename = "profileMetadata")]
1756 pub profile_metadata: Option<ProfileMetadata>,
1757 /// The source type.
1758 #[serde(rename = "type")]
1759 pub type_: Option<String>,
1760 /// Output only. **Only populated in `person.metadata.sources`.** Last update timestamp of this source.
1761 #[serde(rename = "updateTime")]
1762 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1763}
1764
1765impl common::Part for Source {}
1766
1767/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
1768///
1769/// This type is not used in any activity, and only used as *part* of another schema.
1770///
1771#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1772#[serde_with::serde_as]
1773#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1774pub struct Status {
1775 /// The status code, which should be an enum value of google.rpc.Code.
1776 pub code: Option<i32>,
1777 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1778 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1779 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1780 pub message: Option<String>,
1781}
1782
1783impl common::Part for Status {}
1784
1785/// **DEPRECATED**: No data will be returned A brief one-line description of the person.
1786///
1787/// This type is not used in any activity, and only used as *part* of another schema.
1788///
1789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1790#[serde_with::serde_as]
1791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1792pub struct Tagline {
1793 /// Metadata about the tagline.
1794 pub metadata: Option<FieldMetadata>,
1795 /// The tagline.
1796 pub value: Option<String>,
1797}
1798
1799impl common::Part for Tagline {}
1800
1801/// A request to update an existing user contact group. All updated fields will be replaced.
1802///
1803/// # Activities
1804///
1805/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1806/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1807///
1808/// * [update contact groups](ContactGroupUpdateCall) (request)
1809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1810#[serde_with::serde_as]
1811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1812pub struct UpdateContactGroupRequest {
1813 /// Required. The contact group to update.
1814 #[serde(rename = "contactGroup")]
1815 pub contact_group: Option<ContactGroup>,
1816 /// Optional. A field mask to restrict which fields on the group are returned. Defaults to `metadata`, `groupType`, and `name` if not set or set to empty. Valid fields are: * clientData * groupType * memberCount * metadata * name
1817 #[serde(rename = "readGroupFields")]
1818 pub read_group_fields: Option<common::FieldMask>,
1819 /// Optional. A field mask to restrict which fields on the group are updated. Multiple fields can be specified by separating them with commas. Defaults to `name` if not set or set to empty. Updated fields are replaced. Valid values are: * clientData * name
1820 #[serde(rename = "updateGroupFields")]
1821 pub update_group_fields: Option<common::FieldMask>,
1822}
1823
1824impl common::RequestValue for UpdateContactGroupRequest {}
1825
1826/// A request to update an existing contact’s photo. All requests must have a valid photo format: JPEG or PNG.
1827///
1828/// # Activities
1829///
1830/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1831/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1832///
1833/// * [update contact photo people](PersonUpdateContactPhotoCall) (request)
1834#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1835#[serde_with::serde_as]
1836#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1837pub struct UpdateContactPhotoRequest {
1838 /// Optional. A field mask to restrict which fields on the person are returned. Multiple fields can be specified by separating them with commas. Defaults to empty if not set, which will skip the post mutate get. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
1839 #[serde(rename = "personFields")]
1840 pub person_fields: Option<common::FieldMask>,
1841 /// Required. Raw photo bytes
1842 #[serde(rename = "photoBytes")]
1843 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1844 pub photo_bytes: Option<Vec<u8>>,
1845 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
1846 pub sources: Option<Vec<String>>,
1847}
1848
1849impl common::RequestValue for UpdateContactPhotoRequest {}
1850
1851/// The response for updating a contact’s photo.
1852///
1853/// # Activities
1854///
1855/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1856/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1857///
1858/// * [update contact photo people](PersonUpdateContactPhotoCall) (response)
1859#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1860#[serde_with::serde_as]
1861#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1862pub struct UpdateContactPhotoResponse {
1863 /// The updated person, if person_fields is set in the UpdateContactPhotoRequest; otherwise this will be unset.
1864 pub person: Option<Person>,
1865}
1866
1867impl common::ResponseResult for UpdateContactPhotoResponse {}
1868
1869/// A person's associated URLs.
1870///
1871/// This type is not used in any activity, and only used as *part* of another schema.
1872///
1873#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1874#[serde_with::serde_as]
1875#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1876pub struct Url {
1877 /// Output only. The type of the URL translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
1878 #[serde(rename = "formattedType")]
1879 pub formatted_type: Option<String>,
1880 /// Metadata about the URL.
1881 pub metadata: Option<FieldMetadata>,
1882 /// The type of the URL. The type can be custom or one of these predefined values: * `home` * `work` * `blog` * `profile` * `homePage` * `ftp` * `reservations` * `appInstallPage`: website for a Currents application. * `other`
1883 #[serde(rename = "type")]
1884 pub type_: Option<String>,
1885 /// The URL.
1886 pub value: Option<String>,
1887}
1888
1889impl common::Part for Url {}
1890
1891/// Arbitrary user data that is populated by the end users.
1892///
1893/// This type is not used in any activity, and only used as *part* of another schema.
1894///
1895#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1896#[serde_with::serde_as]
1897#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1898pub struct UserDefined {
1899 /// The end user specified key of the user defined data.
1900 pub key: Option<String>,
1901 /// Metadata about the user defined data.
1902 pub metadata: Option<FieldMetadata>,
1903 /// The end user specified value of the user defined data.
1904 pub value: Option<String>,
1905}
1906
1907impl common::Part for UserDefined {}
1908
1909// ###################
1910// MethodBuilders ###
1911// #################
1912
1913/// A builder providing access to all methods supported on *contactGroup* resources.
1914/// It is not used directly, but through the [`PeopleService`] hub.
1915///
1916/// # Example
1917///
1918/// Instantiate a resource builder
1919///
1920/// ```test_harness,no_run
1921/// extern crate hyper;
1922/// extern crate hyper_rustls;
1923/// extern crate google_people1 as people1;
1924///
1925/// # async fn dox() {
1926/// use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1927///
1928/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1929/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1930/// .with_native_roots()
1931/// .unwrap()
1932/// .https_only()
1933/// .enable_http2()
1934/// .build();
1935///
1936/// let executor = hyper_util::rt::TokioExecutor::new();
1937/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1938/// secret,
1939/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1940/// yup_oauth2::client::CustomHyperClientBuilder::from(
1941/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1942/// ),
1943/// ).build().await.unwrap();
1944///
1945/// let client = hyper_util::client::legacy::Client::builder(
1946/// hyper_util::rt::TokioExecutor::new()
1947/// )
1948/// .build(
1949/// hyper_rustls::HttpsConnectorBuilder::new()
1950/// .with_native_roots()
1951/// .unwrap()
1952/// .https_or_http()
1953/// .enable_http2()
1954/// .build()
1955/// );
1956/// let mut hub = PeopleService::new(client, auth);
1957/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1958/// // like `batch_get(...)`, `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `members_modify(...)` and `update(...)`
1959/// // to build up your call.
1960/// let rb = hub.contact_groups();
1961/// # }
1962/// ```
1963pub struct ContactGroupMethods<'a, C>
1964where
1965 C: 'a,
1966{
1967 hub: &'a PeopleService<C>,
1968}
1969
1970impl<'a, C> common::MethodsBuilder for ContactGroupMethods<'a, C> {}
1971
1972impl<'a, C> ContactGroupMethods<'a, C> {
1973 /// Create a builder to help you perform the following task:
1974 ///
1975 /// Modify the members of a contact group owned by the authenticated user. The only system contact groups that can have members added are `contactGroups/myContacts` and `contactGroups/starred`. Other system contact groups are deprecated and can only have contacts removed.
1976 ///
1977 /// # Arguments
1978 ///
1979 /// * `request` - No description provided.
1980 /// * `resourceName` - Required. The resource name of the contact group to modify.
1981 pub fn members_modify(
1982 &self,
1983 request: ModifyContactGroupMembersRequest,
1984 resource_name: &str,
1985 ) -> ContactGroupMemberModifyCall<'a, C> {
1986 ContactGroupMemberModifyCall {
1987 hub: self.hub,
1988 _request: request,
1989 _resource_name: resource_name.to_string(),
1990 _delegate: Default::default(),
1991 _additional_params: Default::default(),
1992 _scopes: Default::default(),
1993 }
1994 }
1995
1996 /// Create a builder to help you perform the following task:
1997 ///
1998 /// Get a list of contact groups owned by the authenticated user by specifying a list of contact group resource names.
1999 pub fn batch_get(&self) -> ContactGroupBatchGetCall<'a, C> {
2000 ContactGroupBatchGetCall {
2001 hub: self.hub,
2002 _resource_names: Default::default(),
2003 _max_members: Default::default(),
2004 _group_fields: Default::default(),
2005 _delegate: Default::default(),
2006 _additional_params: Default::default(),
2007 _scopes: Default::default(),
2008 }
2009 }
2010
2011 /// Create a builder to help you perform the following task:
2012 ///
2013 /// Create a new contact group owned by the authenticated user. Created contact group names must be unique to the users contact groups. Attempting to create a group with a duplicate name will return a HTTP 409 error. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2014 ///
2015 /// # Arguments
2016 ///
2017 /// * `request` - No description provided.
2018 pub fn create(&self, request: CreateContactGroupRequest) -> ContactGroupCreateCall<'a, C> {
2019 ContactGroupCreateCall {
2020 hub: self.hub,
2021 _request: request,
2022 _delegate: Default::default(),
2023 _additional_params: Default::default(),
2024 _scopes: Default::default(),
2025 }
2026 }
2027
2028 /// Create a builder to help you perform the following task:
2029 ///
2030 /// Delete an existing contact group owned by the authenticated user by specifying a contact group resource name. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2031 ///
2032 /// # Arguments
2033 ///
2034 /// * `resourceName` - Required. The resource name of the contact group to delete.
2035 pub fn delete(&self, resource_name: &str) -> ContactGroupDeleteCall<'a, C> {
2036 ContactGroupDeleteCall {
2037 hub: self.hub,
2038 _resource_name: resource_name.to_string(),
2039 _delete_contacts: Default::default(),
2040 _delegate: Default::default(),
2041 _additional_params: Default::default(),
2042 _scopes: Default::default(),
2043 }
2044 }
2045
2046 /// Create a builder to help you perform the following task:
2047 ///
2048 /// Get a specific contact group owned by the authenticated user by specifying a contact group resource name.
2049 ///
2050 /// # Arguments
2051 ///
2052 /// * `resourceName` - Required. The resource name of the contact group to get.
2053 pub fn get(&self, resource_name: &str) -> ContactGroupGetCall<'a, C> {
2054 ContactGroupGetCall {
2055 hub: self.hub,
2056 _resource_name: resource_name.to_string(),
2057 _max_members: Default::default(),
2058 _group_fields: Default::default(),
2059 _delegate: Default::default(),
2060 _additional_params: Default::default(),
2061 _scopes: Default::default(),
2062 }
2063 }
2064
2065 /// Create a builder to help you perform the following task:
2066 ///
2067 /// List all contact groups owned by the authenticated user. Members of the contact groups are not populated.
2068 pub fn list(&self) -> ContactGroupListCall<'a, C> {
2069 ContactGroupListCall {
2070 hub: self.hub,
2071 _sync_token: Default::default(),
2072 _page_token: Default::default(),
2073 _page_size: Default::default(),
2074 _group_fields: Default::default(),
2075 _delegate: Default::default(),
2076 _additional_params: Default::default(),
2077 _scopes: Default::default(),
2078 }
2079 }
2080
2081 /// Create a builder to help you perform the following task:
2082 ///
2083 /// Update the name of an existing contact group owned by the authenticated user. Updated contact group names must be unique to the users contact groups. Attempting to create a group with a duplicate name will return a HTTP 409 error. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2084 ///
2085 /// # Arguments
2086 ///
2087 /// * `request` - No description provided.
2088 /// * `resourceName` - The resource name for the contact group, assigned by the server. An ASCII string, in the form of `contactGroups/{contact_group_id}`.
2089 pub fn update(
2090 &self,
2091 request: UpdateContactGroupRequest,
2092 resource_name: &str,
2093 ) -> ContactGroupUpdateCall<'a, C> {
2094 ContactGroupUpdateCall {
2095 hub: self.hub,
2096 _request: request,
2097 _resource_name: resource_name.to_string(),
2098 _delegate: Default::default(),
2099 _additional_params: Default::default(),
2100 _scopes: Default::default(),
2101 }
2102 }
2103}
2104
2105/// A builder providing access to all methods supported on *otherContact* resources.
2106/// It is not used directly, but through the [`PeopleService`] hub.
2107///
2108/// # Example
2109///
2110/// Instantiate a resource builder
2111///
2112/// ```test_harness,no_run
2113/// extern crate hyper;
2114/// extern crate hyper_rustls;
2115/// extern crate google_people1 as people1;
2116///
2117/// # async fn dox() {
2118/// use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2119///
2120/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2121/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2122/// .with_native_roots()
2123/// .unwrap()
2124/// .https_only()
2125/// .enable_http2()
2126/// .build();
2127///
2128/// let executor = hyper_util::rt::TokioExecutor::new();
2129/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2130/// secret,
2131/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2132/// yup_oauth2::client::CustomHyperClientBuilder::from(
2133/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2134/// ),
2135/// ).build().await.unwrap();
2136///
2137/// let client = hyper_util::client::legacy::Client::builder(
2138/// hyper_util::rt::TokioExecutor::new()
2139/// )
2140/// .build(
2141/// hyper_rustls::HttpsConnectorBuilder::new()
2142/// .with_native_roots()
2143/// .unwrap()
2144/// .https_or_http()
2145/// .enable_http2()
2146/// .build()
2147/// );
2148/// let mut hub = PeopleService::new(client, auth);
2149/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2150/// // like `copy_other_contact_to_my_contacts_group(...)`, `list(...)` and `search(...)`
2151/// // to build up your call.
2152/// let rb = hub.other_contacts();
2153/// # }
2154/// ```
2155pub struct OtherContactMethods<'a, C>
2156where
2157 C: 'a,
2158{
2159 hub: &'a PeopleService<C>,
2160}
2161
2162impl<'a, C> common::MethodsBuilder for OtherContactMethods<'a, C> {}
2163
2164impl<'a, C> OtherContactMethods<'a, C> {
2165 /// Create a builder to help you perform the following task:
2166 ///
2167 /// Copies an "Other contact" to a new contact in the user's "myContacts" group Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2168 ///
2169 /// # Arguments
2170 ///
2171 /// * `request` - No description provided.
2172 /// * `resourceName` - Required. The resource name of the "Other contact" to copy.
2173 pub fn copy_other_contact_to_my_contacts_group(
2174 &self,
2175 request: CopyOtherContactToMyContactsGroupRequest,
2176 resource_name: &str,
2177 ) -> OtherContactCopyOtherContactToMyContactsGroupCall<'a, C> {
2178 OtherContactCopyOtherContactToMyContactsGroupCall {
2179 hub: self.hub,
2180 _request: request,
2181 _resource_name: resource_name.to_string(),
2182 _delegate: Default::default(),
2183 _additional_params: Default::default(),
2184 _scopes: Default::default(),
2185 }
2186 }
2187
2188 /// Create a builder to help you perform the following task:
2189 ///
2190 /// List all “Other contacts”, that is contacts that are not in a contact group. “Other contacts” are typically auto created contacts from interactions. Sync tokens expire 7 days after the full sync. A request with an expired sync token will get an error with an [google.rpc.ErrorInfo](https://cloud.google.com/apis/design/errors#error_info) with reason “EXPIRED_SYNC_TOKEN”. In the case of such an error clients should make a full sync request without a `sync_token`. The first page of a full sync request has an additional quota. If the quota is exceeded, a 429 error will be returned. This quota is fixed and can not be increased. When the `sync_token` is specified, resources deleted since the last sync will be returned as a person with `PersonMetadata.deleted` set to true. When the `page_token` or `sync_token` is specified, all other request parameters must match the first call. Writes may have a propagation delay of several minutes for sync requests. Incremental syncs are not intended for read-after-write use cases. See example usage at [List the user’s other contacts that have changed](https://developers.google.com/people/v1/other-contacts#list_the_users_other_contacts_that_have_changed).
2191 pub fn list(&self) -> OtherContactListCall<'a, C> {
2192 OtherContactListCall {
2193 hub: self.hub,
2194 _sync_token: Default::default(),
2195 _sources: Default::default(),
2196 _request_sync_token: Default::default(),
2197 _read_mask: Default::default(),
2198 _page_token: Default::default(),
2199 _page_size: Default::default(),
2200 _delegate: Default::default(),
2201 _additional_params: Default::default(),
2202 _scopes: Default::default(),
2203 }
2204 }
2205
2206 /// Create a builder to help you perform the following task:
2207 ///
2208 /// Provides a list of contacts in the authenticated user's other contacts that matches the search query. The query matches on a contact's `names`, `emailAddresses`, and `phoneNumbers` fields that are from the OTHER_CONTACT source. **IMPORTANT**: Before searching, clients should send a warmup request with an empty query to update the cache. See https://developers.google.com/people/v1/other-contacts#search_the_users_other_contacts
2209 pub fn search(&self) -> OtherContactSearchCall<'a, C> {
2210 OtherContactSearchCall {
2211 hub: self.hub,
2212 _read_mask: Default::default(),
2213 _query: Default::default(),
2214 _page_size: Default::default(),
2215 _delegate: Default::default(),
2216 _additional_params: Default::default(),
2217 _scopes: Default::default(),
2218 }
2219 }
2220}
2221
2222/// A builder providing access to all methods supported on *person* resources.
2223/// It is not used directly, but through the [`PeopleService`] hub.
2224///
2225/// # Example
2226///
2227/// Instantiate a resource builder
2228///
2229/// ```test_harness,no_run
2230/// extern crate hyper;
2231/// extern crate hyper_rustls;
2232/// extern crate google_people1 as people1;
2233///
2234/// # async fn dox() {
2235/// use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2236///
2237/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2238/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2239/// .with_native_roots()
2240/// .unwrap()
2241/// .https_only()
2242/// .enable_http2()
2243/// .build();
2244///
2245/// let executor = hyper_util::rt::TokioExecutor::new();
2246/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2247/// secret,
2248/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2249/// yup_oauth2::client::CustomHyperClientBuilder::from(
2250/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2251/// ),
2252/// ).build().await.unwrap();
2253///
2254/// let client = hyper_util::client::legacy::Client::builder(
2255/// hyper_util::rt::TokioExecutor::new()
2256/// )
2257/// .build(
2258/// hyper_rustls::HttpsConnectorBuilder::new()
2259/// .with_native_roots()
2260/// .unwrap()
2261/// .https_or_http()
2262/// .enable_http2()
2263/// .build()
2264/// );
2265/// let mut hub = PeopleService::new(client, auth);
2266/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2267/// // like `batch_create_contacts(...)`, `batch_delete_contacts(...)`, `batch_update_contacts(...)`, `connections_list(...)`, `create_contact(...)`, `delete_contact(...)`, `delete_contact_photo(...)`, `get(...)`, `get_batch_get(...)`, `list_directory_people(...)`, `search_contacts(...)`, `search_directory_people(...)`, `update_contact(...)` and `update_contact_photo(...)`
2268/// // to build up your call.
2269/// let rb = hub.people();
2270/// # }
2271/// ```
2272pub struct PersonMethods<'a, C>
2273where
2274 C: 'a,
2275{
2276 hub: &'a PeopleService<C>,
2277}
2278
2279impl<'a, C> common::MethodsBuilder for PersonMethods<'a, C> {}
2280
2281impl<'a, C> PersonMethods<'a, C> {
2282 /// Create a builder to help you perform the following task:
2283 ///
2284 /// Provides a list of the authenticated user’s contacts. Sync tokens expire 7 days after the full sync. A request with an expired sync token will get an error with an [google.rpc.ErrorInfo](https://cloud.google.com/apis/design/errors#error_info) with reason “EXPIRED_SYNC_TOKEN”. In the case of such an error clients should make a full sync request without a `sync_token`. The first page of a full sync request has an additional quota. If the quota is exceeded, a 429 error will be returned. This quota is fixed and can not be increased. When the `sync_token` is specified, resources deleted since the last sync will be returned as a person with `PersonMetadata.deleted` set to true. When the `page_token` or `sync_token` is specified, all other request parameters must match the first call. Writes may have a propagation delay of several minutes for sync requests. Incremental syncs are not intended for read-after-write use cases. See example usage at [List the user’s contacts that have changed](https://developers.google.com/people/v1/contacts#list_the_users_contacts_that_have_changed).
2285 ///
2286 /// # Arguments
2287 ///
2288 /// * `resourceName` - Required. The resource name to return connections for. Only `people/me` is valid.
2289 pub fn connections_list(&self, resource_name: &str) -> PersonConnectionListCall<'a, C> {
2290 PersonConnectionListCall {
2291 hub: self.hub,
2292 _resource_name: resource_name.to_string(),
2293 _sync_token: Default::default(),
2294 _sources: Default::default(),
2295 _sort_order: Default::default(),
2296 _request_sync_token: Default::default(),
2297 _request_mask_include_field: Default::default(),
2298 _person_fields: Default::default(),
2299 _page_token: Default::default(),
2300 _page_size: Default::default(),
2301 _delegate: Default::default(),
2302 _additional_params: Default::default(),
2303 _scopes: Default::default(),
2304 }
2305 }
2306
2307 /// Create a builder to help you perform the following task:
2308 ///
2309 /// Create a batch of new contacts and return the PersonResponses for the newly Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2310 ///
2311 /// # Arguments
2312 ///
2313 /// * `request` - No description provided.
2314 pub fn batch_create_contacts(
2315 &self,
2316 request: BatchCreateContactsRequest,
2317 ) -> PersonBatchCreateContactCall<'a, C> {
2318 PersonBatchCreateContactCall {
2319 hub: self.hub,
2320 _request: request,
2321 _delegate: Default::default(),
2322 _additional_params: Default::default(),
2323 _scopes: Default::default(),
2324 }
2325 }
2326
2327 /// Create a builder to help you perform the following task:
2328 ///
2329 /// Delete a batch of contacts. Any non-contact data will not be deleted. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2330 ///
2331 /// # Arguments
2332 ///
2333 /// * `request` - No description provided.
2334 pub fn batch_delete_contacts(
2335 &self,
2336 request: BatchDeleteContactsRequest,
2337 ) -> PersonBatchDeleteContactCall<'a, C> {
2338 PersonBatchDeleteContactCall {
2339 hub: self.hub,
2340 _request: request,
2341 _delegate: Default::default(),
2342 _additional_params: Default::default(),
2343 _scopes: Default::default(),
2344 }
2345 }
2346
2347 /// Create a builder to help you perform the following task:
2348 ///
2349 /// Update a batch of contacts and return a map of resource names to PersonResponses for the updated contacts. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2350 ///
2351 /// # Arguments
2352 ///
2353 /// * `request` - No description provided.
2354 pub fn batch_update_contacts(
2355 &self,
2356 request: BatchUpdateContactsRequest,
2357 ) -> PersonBatchUpdateContactCall<'a, C> {
2358 PersonBatchUpdateContactCall {
2359 hub: self.hub,
2360 _request: request,
2361 _delegate: Default::default(),
2362 _additional_params: Default::default(),
2363 _scopes: Default::default(),
2364 }
2365 }
2366
2367 /// Create a builder to help you perform the following task:
2368 ///
2369 /// Create a new contact and return the person resource for that contact. The request returns a 400 error if more than one field is specified on a field that is a singleton for contact sources: * biographies * birthdays * genders * names Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2370 ///
2371 /// # Arguments
2372 ///
2373 /// * `request` - No description provided.
2374 pub fn create_contact(&self, request: Person) -> PersonCreateContactCall<'a, C> {
2375 PersonCreateContactCall {
2376 hub: self.hub,
2377 _request: request,
2378 _sources: Default::default(),
2379 _person_fields: Default::default(),
2380 _delegate: Default::default(),
2381 _additional_params: Default::default(),
2382 _scopes: Default::default(),
2383 }
2384 }
2385
2386 /// Create a builder to help you perform the following task:
2387 ///
2388 /// Delete a contact person. Any non-contact data will not be deleted. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2389 ///
2390 /// # Arguments
2391 ///
2392 /// * `resourceName` - Required. The resource name of the contact to delete.
2393 pub fn delete_contact(&self, resource_name: &str) -> PersonDeleteContactCall<'a, C> {
2394 PersonDeleteContactCall {
2395 hub: self.hub,
2396 _resource_name: resource_name.to_string(),
2397 _delegate: Default::default(),
2398 _additional_params: Default::default(),
2399 _scopes: Default::default(),
2400 }
2401 }
2402
2403 /// Create a builder to help you perform the following task:
2404 ///
2405 /// Delete a contact's photo. Mutate requests for the same user should be done sequentially to avoid // lock contention.
2406 ///
2407 /// # Arguments
2408 ///
2409 /// * `resourceName` - Required. The resource name of the contact whose photo will be deleted.
2410 pub fn delete_contact_photo(&self, resource_name: &str) -> PersonDeleteContactPhotoCall<'a, C> {
2411 PersonDeleteContactPhotoCall {
2412 hub: self.hub,
2413 _resource_name: resource_name.to_string(),
2414 _sources: Default::default(),
2415 _person_fields: Default::default(),
2416 _delegate: Default::default(),
2417 _additional_params: Default::default(),
2418 _scopes: Default::default(),
2419 }
2420 }
2421
2422 /// Create a builder to help you perform the following task:
2423 ///
2424 /// Provides information about a person by specifying a resource name. Use `people/me` to indicate the authenticated user. The request returns a 400 error if 'personFields' is not specified.
2425 ///
2426 /// # Arguments
2427 ///
2428 /// * `resourceName` - Required. The resource name of the person to provide information about. - To get information about the authenticated user, specify `people/me`. - To get information about a google account, specify `people/{account_id}`. - To get information about a contact, specify the resource name that identifies the contact as returned by `people.connections.list`.
2429 pub fn get(&self, resource_name: &str) -> PersonGetCall<'a, C> {
2430 PersonGetCall {
2431 hub: self.hub,
2432 _resource_name: resource_name.to_string(),
2433 _sources: Default::default(),
2434 _request_mask_include_field: Default::default(),
2435 _person_fields: Default::default(),
2436 _delegate: Default::default(),
2437 _additional_params: Default::default(),
2438 _scopes: Default::default(),
2439 }
2440 }
2441
2442 /// Create a builder to help you perform the following task:
2443 ///
2444 /// Provides information about a list of specific people by specifying a list of requested resource names. Use `people/me` to indicate the authenticated user. The request returns a 400 error if 'personFields' is not specified.
2445 pub fn get_batch_get(&self) -> PersonGetBatchGetCall<'a, C> {
2446 PersonGetBatchGetCall {
2447 hub: self.hub,
2448 _sources: Default::default(),
2449 _resource_names: Default::default(),
2450 _request_mask_include_field: Default::default(),
2451 _person_fields: Default::default(),
2452 _delegate: Default::default(),
2453 _additional_params: Default::default(),
2454 _scopes: Default::default(),
2455 }
2456 }
2457
2458 /// Create a builder to help you perform the following task:
2459 ///
2460 /// Provides a list of domain profiles and domain contacts in the authenticated user’s domain directory. When the `sync_token` is specified, resources deleted since the last sync will be returned as a person with `PersonMetadata.deleted` set to true. When the `page_token` or `sync_token` is specified, all other request parameters must match the first call. Writes may have a propagation delay of several minutes for sync requests. Incremental syncs are not intended for read-after-write use cases. See example usage at [List the directory people that have changed](https://developers.google.com/people/v1/directory#list_the_directory_people_that_have_changed).
2461 pub fn list_directory_people(&self) -> PersonListDirectoryPersonCall<'a, C> {
2462 PersonListDirectoryPersonCall {
2463 hub: self.hub,
2464 _sync_token: Default::default(),
2465 _sources: Default::default(),
2466 _request_sync_token: Default::default(),
2467 _read_mask: Default::default(),
2468 _page_token: Default::default(),
2469 _page_size: Default::default(),
2470 _merge_sources: Default::default(),
2471 _delegate: Default::default(),
2472 _additional_params: Default::default(),
2473 _scopes: Default::default(),
2474 }
2475 }
2476
2477 /// Create a builder to help you perform the following task:
2478 ///
2479 /// Provides a list of contacts in the authenticated user's grouped contacts that matches the search query. The query matches on a contact's `names`, `nickNames`, `emailAddresses`, `phoneNumbers`, and `organizations` fields that are from the CONTACT source. **IMPORTANT**: Before searching, clients should send a warmup request with an empty query to update the cache. See https://developers.google.com/people/v1/contacts#search_the_users_contacts
2480 pub fn search_contacts(&self) -> PersonSearchContactCall<'a, C> {
2481 PersonSearchContactCall {
2482 hub: self.hub,
2483 _sources: Default::default(),
2484 _read_mask: Default::default(),
2485 _query: Default::default(),
2486 _page_size: Default::default(),
2487 _delegate: Default::default(),
2488 _additional_params: Default::default(),
2489 _scopes: Default::default(),
2490 }
2491 }
2492
2493 /// Create a builder to help you perform the following task:
2494 ///
2495 /// Provides a list of domain profiles and domain contacts in the authenticated user's domain directory that match the search query.
2496 pub fn search_directory_people(&self) -> PersonSearchDirectoryPersonCall<'a, C> {
2497 PersonSearchDirectoryPersonCall {
2498 hub: self.hub,
2499 _sources: Default::default(),
2500 _read_mask: Default::default(),
2501 _query: Default::default(),
2502 _page_token: Default::default(),
2503 _page_size: Default::default(),
2504 _merge_sources: Default::default(),
2505 _delegate: Default::default(),
2506 _additional_params: Default::default(),
2507 _scopes: Default::default(),
2508 }
2509 }
2510
2511 /// Create a builder to help you perform the following task:
2512 ///
2513 /// Update contact data for an existing contact person. Any non-contact data will not be modified. Any non-contact data in the person to update will be ignored. All fields specified in the `update_mask` will be replaced. The server returns a 400 error if `person.metadata.sources` is not specified for the contact to be updated or if there is no contact source. The server returns a 400 error with reason `"failedPrecondition"` if `person.metadata.sources.etag` is different than the contact's etag, which indicates the contact has changed since its data was read. Clients should get the latest person and merge their updates into the latest person. If making sequential updates to the same person, the etag from the `updateContact` response should be used to avoid failures. The server returns a 400 error if `memberships` are being updated and there are no contact group memberships specified on the person. The server returns a 400 error if more than one field is specified on a field that is a singleton for contact sources: * biographies * birthdays * genders * names Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2514 ///
2515 /// # Arguments
2516 ///
2517 /// * `request` - No description provided.
2518 /// * `resourceName` - The resource name for the person, assigned by the server. An ASCII string in the form of `people/{person_id}`.
2519 pub fn update_contact(
2520 &self,
2521 request: Person,
2522 resource_name: &str,
2523 ) -> PersonUpdateContactCall<'a, C> {
2524 PersonUpdateContactCall {
2525 hub: self.hub,
2526 _request: request,
2527 _resource_name: resource_name.to_string(),
2528 _update_person_fields: Default::default(),
2529 _sources: Default::default(),
2530 _person_fields: Default::default(),
2531 _delegate: Default::default(),
2532 _additional_params: Default::default(),
2533 _scopes: Default::default(),
2534 }
2535 }
2536
2537 /// Create a builder to help you perform the following task:
2538 ///
2539 /// Update a contact's photo. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
2540 ///
2541 /// # Arguments
2542 ///
2543 /// * `request` - No description provided.
2544 /// * `resourceName` - Required. Person resource name
2545 pub fn update_contact_photo(
2546 &self,
2547 request: UpdateContactPhotoRequest,
2548 resource_name: &str,
2549 ) -> PersonUpdateContactPhotoCall<'a, C> {
2550 PersonUpdateContactPhotoCall {
2551 hub: self.hub,
2552 _request: request,
2553 _resource_name: resource_name.to_string(),
2554 _delegate: Default::default(),
2555 _additional_params: Default::default(),
2556 _scopes: Default::default(),
2557 }
2558 }
2559}
2560
2561// ###################
2562// CallBuilders ###
2563// #################
2564
2565/// Modify the members of a contact group owned by the authenticated user. The only system contact groups that can have members added are `contactGroups/myContacts` and `contactGroups/starred`. Other system contact groups are deprecated and can only have contacts removed.
2566///
2567/// A builder for the *members.modify* method supported by a *contactGroup* resource.
2568/// It is not used directly, but through a [`ContactGroupMethods`] instance.
2569///
2570/// # Example
2571///
2572/// Instantiate a resource method builder
2573///
2574/// ```test_harness,no_run
2575/// # extern crate hyper;
2576/// # extern crate hyper_rustls;
2577/// # extern crate google_people1 as people1;
2578/// use people1::api::ModifyContactGroupMembersRequest;
2579/// # async fn dox() {
2580/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2581///
2582/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2583/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2584/// # .with_native_roots()
2585/// # .unwrap()
2586/// # .https_only()
2587/// # .enable_http2()
2588/// # .build();
2589///
2590/// # let executor = hyper_util::rt::TokioExecutor::new();
2591/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2592/// # secret,
2593/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2594/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2595/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2596/// # ),
2597/// # ).build().await.unwrap();
2598///
2599/// # let client = hyper_util::client::legacy::Client::builder(
2600/// # hyper_util::rt::TokioExecutor::new()
2601/// # )
2602/// # .build(
2603/// # hyper_rustls::HttpsConnectorBuilder::new()
2604/// # .with_native_roots()
2605/// # .unwrap()
2606/// # .https_or_http()
2607/// # .enable_http2()
2608/// # .build()
2609/// # );
2610/// # let mut hub = PeopleService::new(client, auth);
2611/// // As the method needs a request, you would usually fill it with the desired information
2612/// // into the respective structure. Some of the parts shown here might not be applicable !
2613/// // Values shown here are possibly random and not representative !
2614/// let mut req = ModifyContactGroupMembersRequest::default();
2615///
2616/// // You can configure optional parameters by calling the respective setters at will, and
2617/// // execute the final call using `doit()`.
2618/// // Values shown here are possibly random and not representative !
2619/// let result = hub.contact_groups().members_modify(req, "resourceName")
2620/// .doit().await;
2621/// # }
2622/// ```
2623pub struct ContactGroupMemberModifyCall<'a, C>
2624where
2625 C: 'a,
2626{
2627 hub: &'a PeopleService<C>,
2628 _request: ModifyContactGroupMembersRequest,
2629 _resource_name: String,
2630 _delegate: Option<&'a mut dyn common::Delegate>,
2631 _additional_params: HashMap<String, String>,
2632 _scopes: BTreeSet<String>,
2633}
2634
2635impl<'a, C> common::CallBuilder for ContactGroupMemberModifyCall<'a, C> {}
2636
2637impl<'a, C> ContactGroupMemberModifyCall<'a, C>
2638where
2639 C: common::Connector,
2640{
2641 /// Perform the operation you have build so far.
2642 pub async fn doit(
2643 mut self,
2644 ) -> common::Result<(common::Response, ModifyContactGroupMembersResponse)> {
2645 use std::borrow::Cow;
2646 use std::io::{Read, Seek};
2647
2648 use common::{url::Params, ToParts};
2649 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2650
2651 let mut dd = common::DefaultDelegate;
2652 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2653 dlg.begin(common::MethodInfo {
2654 id: "people.contactGroups.members.modify",
2655 http_method: hyper::Method::POST,
2656 });
2657
2658 for &field in ["alt", "resourceName"].iter() {
2659 if self._additional_params.contains_key(field) {
2660 dlg.finished(false);
2661 return Err(common::Error::FieldClash(field));
2662 }
2663 }
2664
2665 let mut params = Params::with_capacity(4 + self._additional_params.len());
2666 params.push("resourceName", self._resource_name);
2667
2668 params.extend(self._additional_params.iter());
2669
2670 params.push("alt", "json");
2671 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}/members:modify";
2672 if self._scopes.is_empty() {
2673 self._scopes.insert(Scope::Contact.as_ref().to_string());
2674 }
2675
2676 #[allow(clippy::single_element_loop)]
2677 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
2678 url = params.uri_replacement(url, param_name, find_this, true);
2679 }
2680 {
2681 let to_remove = ["resourceName"];
2682 params.remove_params(&to_remove);
2683 }
2684
2685 let url = params.parse_with_url(&url);
2686
2687 let mut json_mime_type = mime::APPLICATION_JSON;
2688 let mut request_value_reader = {
2689 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2690 common::remove_json_null_values(&mut value);
2691 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2692 serde_json::to_writer(&mut dst, &value).unwrap();
2693 dst
2694 };
2695 let request_size = request_value_reader
2696 .seek(std::io::SeekFrom::End(0))
2697 .unwrap();
2698 request_value_reader
2699 .seek(std::io::SeekFrom::Start(0))
2700 .unwrap();
2701
2702 loop {
2703 let token = match self
2704 .hub
2705 .auth
2706 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2707 .await
2708 {
2709 Ok(token) => token,
2710 Err(e) => match dlg.token(e) {
2711 Ok(token) => token,
2712 Err(e) => {
2713 dlg.finished(false);
2714 return Err(common::Error::MissingToken(e));
2715 }
2716 },
2717 };
2718 request_value_reader
2719 .seek(std::io::SeekFrom::Start(0))
2720 .unwrap();
2721 let mut req_result = {
2722 let client = &self.hub.client;
2723 dlg.pre_request();
2724 let mut req_builder = hyper::Request::builder()
2725 .method(hyper::Method::POST)
2726 .uri(url.as_str())
2727 .header(USER_AGENT, self.hub._user_agent.clone());
2728
2729 if let Some(token) = token.as_ref() {
2730 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2731 }
2732
2733 let request = req_builder
2734 .header(CONTENT_TYPE, json_mime_type.to_string())
2735 .header(CONTENT_LENGTH, request_size as u64)
2736 .body(common::to_body(
2737 request_value_reader.get_ref().clone().into(),
2738 ));
2739
2740 client.request(request.unwrap()).await
2741 };
2742
2743 match req_result {
2744 Err(err) => {
2745 if let common::Retry::After(d) = dlg.http_error(&err) {
2746 sleep(d).await;
2747 continue;
2748 }
2749 dlg.finished(false);
2750 return Err(common::Error::HttpError(err));
2751 }
2752 Ok(res) => {
2753 let (mut parts, body) = res.into_parts();
2754 let mut body = common::Body::new(body);
2755 if !parts.status.is_success() {
2756 let bytes = common::to_bytes(body).await.unwrap_or_default();
2757 let error = serde_json::from_str(&common::to_string(&bytes));
2758 let response = common::to_response(parts, bytes.into());
2759
2760 if let common::Retry::After(d) =
2761 dlg.http_failure(&response, error.as_ref().ok())
2762 {
2763 sleep(d).await;
2764 continue;
2765 }
2766
2767 dlg.finished(false);
2768
2769 return Err(match error {
2770 Ok(value) => common::Error::BadRequest(value),
2771 _ => common::Error::Failure(response),
2772 });
2773 }
2774 let response = {
2775 let bytes = common::to_bytes(body).await.unwrap_or_default();
2776 let encoded = common::to_string(&bytes);
2777 match serde_json::from_str(&encoded) {
2778 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2779 Err(error) => {
2780 dlg.response_json_decode_error(&encoded, &error);
2781 return Err(common::Error::JsonDecodeError(
2782 encoded.to_string(),
2783 error,
2784 ));
2785 }
2786 }
2787 };
2788
2789 dlg.finished(true);
2790 return Ok(response);
2791 }
2792 }
2793 }
2794 }
2795
2796 ///
2797 /// Sets the *request* property to the given value.
2798 ///
2799 /// Even though the property as already been set when instantiating this call,
2800 /// we provide this method for API completeness.
2801 pub fn request(
2802 mut self,
2803 new_value: ModifyContactGroupMembersRequest,
2804 ) -> ContactGroupMemberModifyCall<'a, C> {
2805 self._request = new_value;
2806 self
2807 }
2808 /// Required. The resource name of the contact group to modify.
2809 ///
2810 /// Sets the *resource name* path property to the given value.
2811 ///
2812 /// Even though the property as already been set when instantiating this call,
2813 /// we provide this method for API completeness.
2814 pub fn resource_name(mut self, new_value: &str) -> ContactGroupMemberModifyCall<'a, C> {
2815 self._resource_name = new_value.to_string();
2816 self
2817 }
2818 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2819 /// while executing the actual API request.
2820 ///
2821 /// ````text
2822 /// It should be used to handle progress information, and to implement a certain level of resilience.
2823 /// ````
2824 ///
2825 /// Sets the *delegate* property to the given value.
2826 pub fn delegate(
2827 mut self,
2828 new_value: &'a mut dyn common::Delegate,
2829 ) -> ContactGroupMemberModifyCall<'a, C> {
2830 self._delegate = Some(new_value);
2831 self
2832 }
2833
2834 /// Set any additional parameter of the query string used in the request.
2835 /// It should be used to set parameters which are not yet available through their own
2836 /// setters.
2837 ///
2838 /// Please note that this method must not be used to set any of the known parameters
2839 /// which have their own setter method. If done anyway, the request will fail.
2840 ///
2841 /// # Additional Parameters
2842 ///
2843 /// * *$.xgafv* (query-string) - V1 error format.
2844 /// * *access_token* (query-string) - OAuth access token.
2845 /// * *alt* (query-string) - Data format for response.
2846 /// * *callback* (query-string) - JSONP
2847 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2848 /// * *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.
2849 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2850 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2851 /// * *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.
2852 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2853 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2854 pub fn param<T>(mut self, name: T, value: T) -> ContactGroupMemberModifyCall<'a, C>
2855 where
2856 T: AsRef<str>,
2857 {
2858 self._additional_params
2859 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2860 self
2861 }
2862
2863 /// Identifies the authorization scope for the method you are building.
2864 ///
2865 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2866 /// [`Scope::Contact`].
2867 ///
2868 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2869 /// tokens for more than one scope.
2870 ///
2871 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2872 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2873 /// sufficient, a read-write scope will do as well.
2874 pub fn add_scope<St>(mut self, scope: St) -> ContactGroupMemberModifyCall<'a, C>
2875 where
2876 St: AsRef<str>,
2877 {
2878 self._scopes.insert(String::from(scope.as_ref()));
2879 self
2880 }
2881 /// Identifies the authorization scope(s) for the method you are building.
2882 ///
2883 /// See [`Self::add_scope()`] for details.
2884 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContactGroupMemberModifyCall<'a, C>
2885 where
2886 I: IntoIterator<Item = St>,
2887 St: AsRef<str>,
2888 {
2889 self._scopes
2890 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2891 self
2892 }
2893
2894 /// Removes all scopes, and no default scope will be used either.
2895 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2896 /// for details).
2897 pub fn clear_scopes(mut self) -> ContactGroupMemberModifyCall<'a, C> {
2898 self._scopes.clear();
2899 self
2900 }
2901}
2902
2903/// Get a list of contact groups owned by the authenticated user by specifying a list of contact group resource names.
2904///
2905/// A builder for the *batchGet* method supported by a *contactGroup* resource.
2906/// It is not used directly, but through a [`ContactGroupMethods`] instance.
2907///
2908/// # Example
2909///
2910/// Instantiate a resource method builder
2911///
2912/// ```test_harness,no_run
2913/// # extern crate hyper;
2914/// # extern crate hyper_rustls;
2915/// # extern crate google_people1 as people1;
2916/// # async fn dox() {
2917/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2918///
2919/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2920/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2921/// # .with_native_roots()
2922/// # .unwrap()
2923/// # .https_only()
2924/// # .enable_http2()
2925/// # .build();
2926///
2927/// # let executor = hyper_util::rt::TokioExecutor::new();
2928/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2929/// # secret,
2930/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2931/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2932/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2933/// # ),
2934/// # ).build().await.unwrap();
2935///
2936/// # let client = hyper_util::client::legacy::Client::builder(
2937/// # hyper_util::rt::TokioExecutor::new()
2938/// # )
2939/// # .build(
2940/// # hyper_rustls::HttpsConnectorBuilder::new()
2941/// # .with_native_roots()
2942/// # .unwrap()
2943/// # .https_or_http()
2944/// # .enable_http2()
2945/// # .build()
2946/// # );
2947/// # let mut hub = PeopleService::new(client, auth);
2948/// // You can configure optional parameters by calling the respective setters at will, and
2949/// // execute the final call using `doit()`.
2950/// // Values shown here are possibly random and not representative !
2951/// let result = hub.contact_groups().batch_get()
2952/// .add_resource_names("amet.")
2953/// .max_members(-20)
2954/// .group_fields(FieldMask::new::<&str>(&[]))
2955/// .doit().await;
2956/// # }
2957/// ```
2958pub struct ContactGroupBatchGetCall<'a, C>
2959where
2960 C: 'a,
2961{
2962 hub: &'a PeopleService<C>,
2963 _resource_names: Vec<String>,
2964 _max_members: Option<i32>,
2965 _group_fields: Option<common::FieldMask>,
2966 _delegate: Option<&'a mut dyn common::Delegate>,
2967 _additional_params: HashMap<String, String>,
2968 _scopes: BTreeSet<String>,
2969}
2970
2971impl<'a, C> common::CallBuilder for ContactGroupBatchGetCall<'a, C> {}
2972
2973impl<'a, C> ContactGroupBatchGetCall<'a, C>
2974where
2975 C: common::Connector,
2976{
2977 /// Perform the operation you have build so far.
2978 pub async fn doit(
2979 mut self,
2980 ) -> common::Result<(common::Response, BatchGetContactGroupsResponse)> {
2981 use std::borrow::Cow;
2982 use std::io::{Read, Seek};
2983
2984 use common::{url::Params, ToParts};
2985 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2986
2987 let mut dd = common::DefaultDelegate;
2988 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2989 dlg.begin(common::MethodInfo {
2990 id: "people.contactGroups.batchGet",
2991 http_method: hyper::Method::GET,
2992 });
2993
2994 for &field in ["alt", "resourceNames", "maxMembers", "groupFields"].iter() {
2995 if self._additional_params.contains_key(field) {
2996 dlg.finished(false);
2997 return Err(common::Error::FieldClash(field));
2998 }
2999 }
3000
3001 let mut params = Params::with_capacity(5 + self._additional_params.len());
3002 if !self._resource_names.is_empty() {
3003 for f in self._resource_names.iter() {
3004 params.push("resourceNames", f);
3005 }
3006 }
3007 if let Some(value) = self._max_members.as_ref() {
3008 params.push("maxMembers", value.to_string());
3009 }
3010 if let Some(value) = self._group_fields.as_ref() {
3011 params.push("groupFields", value.to_string());
3012 }
3013
3014 params.extend(self._additional_params.iter());
3015
3016 params.push("alt", "json");
3017 let mut url = self.hub._base_url.clone() + "v1/contactGroups:batchGet";
3018 if self._scopes.is_empty() {
3019 self._scopes
3020 .insert(Scope::ContactReadonly.as_ref().to_string());
3021 }
3022
3023 let url = params.parse_with_url(&url);
3024
3025 loop {
3026 let token = match self
3027 .hub
3028 .auth
3029 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3030 .await
3031 {
3032 Ok(token) => token,
3033 Err(e) => match dlg.token(e) {
3034 Ok(token) => token,
3035 Err(e) => {
3036 dlg.finished(false);
3037 return Err(common::Error::MissingToken(e));
3038 }
3039 },
3040 };
3041 let mut req_result = {
3042 let client = &self.hub.client;
3043 dlg.pre_request();
3044 let mut req_builder = hyper::Request::builder()
3045 .method(hyper::Method::GET)
3046 .uri(url.as_str())
3047 .header(USER_AGENT, self.hub._user_agent.clone());
3048
3049 if let Some(token) = token.as_ref() {
3050 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3051 }
3052
3053 let request = req_builder
3054 .header(CONTENT_LENGTH, 0_u64)
3055 .body(common::to_body::<String>(None));
3056
3057 client.request(request.unwrap()).await
3058 };
3059
3060 match req_result {
3061 Err(err) => {
3062 if let common::Retry::After(d) = dlg.http_error(&err) {
3063 sleep(d).await;
3064 continue;
3065 }
3066 dlg.finished(false);
3067 return Err(common::Error::HttpError(err));
3068 }
3069 Ok(res) => {
3070 let (mut parts, body) = res.into_parts();
3071 let mut body = common::Body::new(body);
3072 if !parts.status.is_success() {
3073 let bytes = common::to_bytes(body).await.unwrap_or_default();
3074 let error = serde_json::from_str(&common::to_string(&bytes));
3075 let response = common::to_response(parts, bytes.into());
3076
3077 if let common::Retry::After(d) =
3078 dlg.http_failure(&response, error.as_ref().ok())
3079 {
3080 sleep(d).await;
3081 continue;
3082 }
3083
3084 dlg.finished(false);
3085
3086 return Err(match error {
3087 Ok(value) => common::Error::BadRequest(value),
3088 _ => common::Error::Failure(response),
3089 });
3090 }
3091 let response = {
3092 let bytes = common::to_bytes(body).await.unwrap_or_default();
3093 let encoded = common::to_string(&bytes);
3094 match serde_json::from_str(&encoded) {
3095 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3096 Err(error) => {
3097 dlg.response_json_decode_error(&encoded, &error);
3098 return Err(common::Error::JsonDecodeError(
3099 encoded.to_string(),
3100 error,
3101 ));
3102 }
3103 }
3104 };
3105
3106 dlg.finished(true);
3107 return Ok(response);
3108 }
3109 }
3110 }
3111 }
3112
3113 /// Required. The resource names of the contact groups to get. There is a maximum of 200 resource names.
3114 ///
3115 /// Append the given value to the *resource names* query property.
3116 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
3117 pub fn add_resource_names(mut self, new_value: &str) -> ContactGroupBatchGetCall<'a, C> {
3118 self._resource_names.push(new_value.to_string());
3119 self
3120 }
3121 /// Optional. Specifies the maximum number of members to return for each group. Defaults to 0 if not set, which will return zero members.
3122 ///
3123 /// Sets the *max members* query property to the given value.
3124 pub fn max_members(mut self, new_value: i32) -> ContactGroupBatchGetCall<'a, C> {
3125 self._max_members = Some(new_value);
3126 self
3127 }
3128 /// Optional. A field mask to restrict which fields on the group are returned. Defaults to `metadata`, `groupType`, `memberCount`, and `name` if not set or set to empty. Valid fields are: * clientData * groupType * memberCount * metadata * name
3129 ///
3130 /// Sets the *group fields* query property to the given value.
3131 pub fn group_fields(mut self, new_value: common::FieldMask) -> ContactGroupBatchGetCall<'a, C> {
3132 self._group_fields = Some(new_value);
3133 self
3134 }
3135 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3136 /// while executing the actual API request.
3137 ///
3138 /// ````text
3139 /// It should be used to handle progress information, and to implement a certain level of resilience.
3140 /// ````
3141 ///
3142 /// Sets the *delegate* property to the given value.
3143 pub fn delegate(
3144 mut self,
3145 new_value: &'a mut dyn common::Delegate,
3146 ) -> ContactGroupBatchGetCall<'a, C> {
3147 self._delegate = Some(new_value);
3148 self
3149 }
3150
3151 /// Set any additional parameter of the query string used in the request.
3152 /// It should be used to set parameters which are not yet available through their own
3153 /// setters.
3154 ///
3155 /// Please note that this method must not be used to set any of the known parameters
3156 /// which have their own setter method. If done anyway, the request will fail.
3157 ///
3158 /// # Additional Parameters
3159 ///
3160 /// * *$.xgafv* (query-string) - V1 error format.
3161 /// * *access_token* (query-string) - OAuth access token.
3162 /// * *alt* (query-string) - Data format for response.
3163 /// * *callback* (query-string) - JSONP
3164 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3165 /// * *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.
3166 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3167 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3168 /// * *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.
3169 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3170 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3171 pub fn param<T>(mut self, name: T, value: T) -> ContactGroupBatchGetCall<'a, C>
3172 where
3173 T: AsRef<str>,
3174 {
3175 self._additional_params
3176 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3177 self
3178 }
3179
3180 /// Identifies the authorization scope for the method you are building.
3181 ///
3182 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3183 /// [`Scope::ContactReadonly`].
3184 ///
3185 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3186 /// tokens for more than one scope.
3187 ///
3188 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3189 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3190 /// sufficient, a read-write scope will do as well.
3191 pub fn add_scope<St>(mut self, scope: St) -> ContactGroupBatchGetCall<'a, C>
3192 where
3193 St: AsRef<str>,
3194 {
3195 self._scopes.insert(String::from(scope.as_ref()));
3196 self
3197 }
3198 /// Identifies the authorization scope(s) for the method you are building.
3199 ///
3200 /// See [`Self::add_scope()`] for details.
3201 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContactGroupBatchGetCall<'a, C>
3202 where
3203 I: IntoIterator<Item = St>,
3204 St: AsRef<str>,
3205 {
3206 self._scopes
3207 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3208 self
3209 }
3210
3211 /// Removes all scopes, and no default scope will be used either.
3212 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3213 /// for details).
3214 pub fn clear_scopes(mut self) -> ContactGroupBatchGetCall<'a, C> {
3215 self._scopes.clear();
3216 self
3217 }
3218}
3219
3220/// Create a new contact group owned by the authenticated user. Created contact group names must be unique to the users contact groups. Attempting to create a group with a duplicate name will return a HTTP 409 error. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
3221///
3222/// A builder for the *create* method supported by a *contactGroup* resource.
3223/// It is not used directly, but through a [`ContactGroupMethods`] instance.
3224///
3225/// # Example
3226///
3227/// Instantiate a resource method builder
3228///
3229/// ```test_harness,no_run
3230/// # extern crate hyper;
3231/// # extern crate hyper_rustls;
3232/// # extern crate google_people1 as people1;
3233/// use people1::api::CreateContactGroupRequest;
3234/// # async fn dox() {
3235/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3236///
3237/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3238/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3239/// # .with_native_roots()
3240/// # .unwrap()
3241/// # .https_only()
3242/// # .enable_http2()
3243/// # .build();
3244///
3245/// # let executor = hyper_util::rt::TokioExecutor::new();
3246/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3247/// # secret,
3248/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3249/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3250/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3251/// # ),
3252/// # ).build().await.unwrap();
3253///
3254/// # let client = hyper_util::client::legacy::Client::builder(
3255/// # hyper_util::rt::TokioExecutor::new()
3256/// # )
3257/// # .build(
3258/// # hyper_rustls::HttpsConnectorBuilder::new()
3259/// # .with_native_roots()
3260/// # .unwrap()
3261/// # .https_or_http()
3262/// # .enable_http2()
3263/// # .build()
3264/// # );
3265/// # let mut hub = PeopleService::new(client, auth);
3266/// // As the method needs a request, you would usually fill it with the desired information
3267/// // into the respective structure. Some of the parts shown here might not be applicable !
3268/// // Values shown here are possibly random and not representative !
3269/// let mut req = CreateContactGroupRequest::default();
3270///
3271/// // You can configure optional parameters by calling the respective setters at will, and
3272/// // execute the final call using `doit()`.
3273/// // Values shown here are possibly random and not representative !
3274/// let result = hub.contact_groups().create(req)
3275/// .doit().await;
3276/// # }
3277/// ```
3278pub struct ContactGroupCreateCall<'a, C>
3279where
3280 C: 'a,
3281{
3282 hub: &'a PeopleService<C>,
3283 _request: CreateContactGroupRequest,
3284 _delegate: Option<&'a mut dyn common::Delegate>,
3285 _additional_params: HashMap<String, String>,
3286 _scopes: BTreeSet<String>,
3287}
3288
3289impl<'a, C> common::CallBuilder for ContactGroupCreateCall<'a, C> {}
3290
3291impl<'a, C> ContactGroupCreateCall<'a, C>
3292where
3293 C: common::Connector,
3294{
3295 /// Perform the operation you have build so far.
3296 pub async fn doit(mut self) -> common::Result<(common::Response, ContactGroup)> {
3297 use std::borrow::Cow;
3298 use std::io::{Read, Seek};
3299
3300 use common::{url::Params, ToParts};
3301 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3302
3303 let mut dd = common::DefaultDelegate;
3304 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3305 dlg.begin(common::MethodInfo {
3306 id: "people.contactGroups.create",
3307 http_method: hyper::Method::POST,
3308 });
3309
3310 for &field in ["alt"].iter() {
3311 if self._additional_params.contains_key(field) {
3312 dlg.finished(false);
3313 return Err(common::Error::FieldClash(field));
3314 }
3315 }
3316
3317 let mut params = Params::with_capacity(3 + self._additional_params.len());
3318
3319 params.extend(self._additional_params.iter());
3320
3321 params.push("alt", "json");
3322 let mut url = self.hub._base_url.clone() + "v1/contactGroups";
3323 if self._scopes.is_empty() {
3324 self._scopes.insert(Scope::Contact.as_ref().to_string());
3325 }
3326
3327 let url = params.parse_with_url(&url);
3328
3329 let mut json_mime_type = mime::APPLICATION_JSON;
3330 let mut request_value_reader = {
3331 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3332 common::remove_json_null_values(&mut value);
3333 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3334 serde_json::to_writer(&mut dst, &value).unwrap();
3335 dst
3336 };
3337 let request_size = request_value_reader
3338 .seek(std::io::SeekFrom::End(0))
3339 .unwrap();
3340 request_value_reader
3341 .seek(std::io::SeekFrom::Start(0))
3342 .unwrap();
3343
3344 loop {
3345 let token = match self
3346 .hub
3347 .auth
3348 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3349 .await
3350 {
3351 Ok(token) => token,
3352 Err(e) => match dlg.token(e) {
3353 Ok(token) => token,
3354 Err(e) => {
3355 dlg.finished(false);
3356 return Err(common::Error::MissingToken(e));
3357 }
3358 },
3359 };
3360 request_value_reader
3361 .seek(std::io::SeekFrom::Start(0))
3362 .unwrap();
3363 let mut req_result = {
3364 let client = &self.hub.client;
3365 dlg.pre_request();
3366 let mut req_builder = hyper::Request::builder()
3367 .method(hyper::Method::POST)
3368 .uri(url.as_str())
3369 .header(USER_AGENT, self.hub._user_agent.clone());
3370
3371 if let Some(token) = token.as_ref() {
3372 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3373 }
3374
3375 let request = req_builder
3376 .header(CONTENT_TYPE, json_mime_type.to_string())
3377 .header(CONTENT_LENGTH, request_size as u64)
3378 .body(common::to_body(
3379 request_value_reader.get_ref().clone().into(),
3380 ));
3381
3382 client.request(request.unwrap()).await
3383 };
3384
3385 match req_result {
3386 Err(err) => {
3387 if let common::Retry::After(d) = dlg.http_error(&err) {
3388 sleep(d).await;
3389 continue;
3390 }
3391 dlg.finished(false);
3392 return Err(common::Error::HttpError(err));
3393 }
3394 Ok(res) => {
3395 let (mut parts, body) = res.into_parts();
3396 let mut body = common::Body::new(body);
3397 if !parts.status.is_success() {
3398 let bytes = common::to_bytes(body).await.unwrap_or_default();
3399 let error = serde_json::from_str(&common::to_string(&bytes));
3400 let response = common::to_response(parts, bytes.into());
3401
3402 if let common::Retry::After(d) =
3403 dlg.http_failure(&response, error.as_ref().ok())
3404 {
3405 sleep(d).await;
3406 continue;
3407 }
3408
3409 dlg.finished(false);
3410
3411 return Err(match error {
3412 Ok(value) => common::Error::BadRequest(value),
3413 _ => common::Error::Failure(response),
3414 });
3415 }
3416 let response = {
3417 let bytes = common::to_bytes(body).await.unwrap_or_default();
3418 let encoded = common::to_string(&bytes);
3419 match serde_json::from_str(&encoded) {
3420 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3421 Err(error) => {
3422 dlg.response_json_decode_error(&encoded, &error);
3423 return Err(common::Error::JsonDecodeError(
3424 encoded.to_string(),
3425 error,
3426 ));
3427 }
3428 }
3429 };
3430
3431 dlg.finished(true);
3432 return Ok(response);
3433 }
3434 }
3435 }
3436 }
3437
3438 ///
3439 /// Sets the *request* property to the given value.
3440 ///
3441 /// Even though the property as already been set when instantiating this call,
3442 /// we provide this method for API completeness.
3443 pub fn request(
3444 mut self,
3445 new_value: CreateContactGroupRequest,
3446 ) -> ContactGroupCreateCall<'a, C> {
3447 self._request = new_value;
3448 self
3449 }
3450 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3451 /// while executing the actual API request.
3452 ///
3453 /// ````text
3454 /// It should be used to handle progress information, and to implement a certain level of resilience.
3455 /// ````
3456 ///
3457 /// Sets the *delegate* property to the given value.
3458 pub fn delegate(
3459 mut self,
3460 new_value: &'a mut dyn common::Delegate,
3461 ) -> ContactGroupCreateCall<'a, C> {
3462 self._delegate = Some(new_value);
3463 self
3464 }
3465
3466 /// Set any additional parameter of the query string used in the request.
3467 /// It should be used to set parameters which are not yet available through their own
3468 /// setters.
3469 ///
3470 /// Please note that this method must not be used to set any of the known parameters
3471 /// which have their own setter method. If done anyway, the request will fail.
3472 ///
3473 /// # Additional Parameters
3474 ///
3475 /// * *$.xgafv* (query-string) - V1 error format.
3476 /// * *access_token* (query-string) - OAuth access token.
3477 /// * *alt* (query-string) - Data format for response.
3478 /// * *callback* (query-string) - JSONP
3479 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3480 /// * *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.
3481 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3482 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3483 /// * *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.
3484 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3485 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3486 pub fn param<T>(mut self, name: T, value: T) -> ContactGroupCreateCall<'a, C>
3487 where
3488 T: AsRef<str>,
3489 {
3490 self._additional_params
3491 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3492 self
3493 }
3494
3495 /// Identifies the authorization scope for the method you are building.
3496 ///
3497 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3498 /// [`Scope::Contact`].
3499 ///
3500 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3501 /// tokens for more than one scope.
3502 ///
3503 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3504 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3505 /// sufficient, a read-write scope will do as well.
3506 pub fn add_scope<St>(mut self, scope: St) -> ContactGroupCreateCall<'a, C>
3507 where
3508 St: AsRef<str>,
3509 {
3510 self._scopes.insert(String::from(scope.as_ref()));
3511 self
3512 }
3513 /// Identifies the authorization scope(s) for the method you are building.
3514 ///
3515 /// See [`Self::add_scope()`] for details.
3516 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContactGroupCreateCall<'a, C>
3517 where
3518 I: IntoIterator<Item = St>,
3519 St: AsRef<str>,
3520 {
3521 self._scopes
3522 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3523 self
3524 }
3525
3526 /// Removes all scopes, and no default scope will be used either.
3527 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3528 /// for details).
3529 pub fn clear_scopes(mut self) -> ContactGroupCreateCall<'a, C> {
3530 self._scopes.clear();
3531 self
3532 }
3533}
3534
3535/// Delete an existing contact group owned by the authenticated user by specifying a contact group resource name. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
3536///
3537/// A builder for the *delete* method supported by a *contactGroup* resource.
3538/// It is not used directly, but through a [`ContactGroupMethods`] instance.
3539///
3540/// # Example
3541///
3542/// Instantiate a resource method builder
3543///
3544/// ```test_harness,no_run
3545/// # extern crate hyper;
3546/// # extern crate hyper_rustls;
3547/// # extern crate google_people1 as people1;
3548/// # async fn dox() {
3549/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3550///
3551/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3552/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3553/// # .with_native_roots()
3554/// # .unwrap()
3555/// # .https_only()
3556/// # .enable_http2()
3557/// # .build();
3558///
3559/// # let executor = hyper_util::rt::TokioExecutor::new();
3560/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3561/// # secret,
3562/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3563/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3564/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3565/// # ),
3566/// # ).build().await.unwrap();
3567///
3568/// # let client = hyper_util::client::legacy::Client::builder(
3569/// # hyper_util::rt::TokioExecutor::new()
3570/// # )
3571/// # .build(
3572/// # hyper_rustls::HttpsConnectorBuilder::new()
3573/// # .with_native_roots()
3574/// # .unwrap()
3575/// # .https_or_http()
3576/// # .enable_http2()
3577/// # .build()
3578/// # );
3579/// # let mut hub = PeopleService::new(client, auth);
3580/// // You can configure optional parameters by calling the respective setters at will, and
3581/// // execute the final call using `doit()`.
3582/// // Values shown here are possibly random and not representative !
3583/// let result = hub.contact_groups().delete("resourceName")
3584/// .delete_contacts(true)
3585/// .doit().await;
3586/// # }
3587/// ```
3588pub struct ContactGroupDeleteCall<'a, C>
3589where
3590 C: 'a,
3591{
3592 hub: &'a PeopleService<C>,
3593 _resource_name: String,
3594 _delete_contacts: Option<bool>,
3595 _delegate: Option<&'a mut dyn common::Delegate>,
3596 _additional_params: HashMap<String, String>,
3597 _scopes: BTreeSet<String>,
3598}
3599
3600impl<'a, C> common::CallBuilder for ContactGroupDeleteCall<'a, C> {}
3601
3602impl<'a, C> ContactGroupDeleteCall<'a, C>
3603where
3604 C: common::Connector,
3605{
3606 /// Perform the operation you have build so far.
3607 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3608 use std::borrow::Cow;
3609 use std::io::{Read, Seek};
3610
3611 use common::{url::Params, ToParts};
3612 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3613
3614 let mut dd = common::DefaultDelegate;
3615 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3616 dlg.begin(common::MethodInfo {
3617 id: "people.contactGroups.delete",
3618 http_method: hyper::Method::DELETE,
3619 });
3620
3621 for &field in ["alt", "resourceName", "deleteContacts"].iter() {
3622 if self._additional_params.contains_key(field) {
3623 dlg.finished(false);
3624 return Err(common::Error::FieldClash(field));
3625 }
3626 }
3627
3628 let mut params = Params::with_capacity(4 + self._additional_params.len());
3629 params.push("resourceName", self._resource_name);
3630 if let Some(value) = self._delete_contacts.as_ref() {
3631 params.push("deleteContacts", value.to_string());
3632 }
3633
3634 params.extend(self._additional_params.iter());
3635
3636 params.push("alt", "json");
3637 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}";
3638 if self._scopes.is_empty() {
3639 self._scopes.insert(Scope::Contact.as_ref().to_string());
3640 }
3641
3642 #[allow(clippy::single_element_loop)]
3643 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
3644 url = params.uri_replacement(url, param_name, find_this, true);
3645 }
3646 {
3647 let to_remove = ["resourceName"];
3648 params.remove_params(&to_remove);
3649 }
3650
3651 let url = params.parse_with_url(&url);
3652
3653 loop {
3654 let token = match self
3655 .hub
3656 .auth
3657 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3658 .await
3659 {
3660 Ok(token) => token,
3661 Err(e) => match dlg.token(e) {
3662 Ok(token) => token,
3663 Err(e) => {
3664 dlg.finished(false);
3665 return Err(common::Error::MissingToken(e));
3666 }
3667 },
3668 };
3669 let mut req_result = {
3670 let client = &self.hub.client;
3671 dlg.pre_request();
3672 let mut req_builder = hyper::Request::builder()
3673 .method(hyper::Method::DELETE)
3674 .uri(url.as_str())
3675 .header(USER_AGENT, self.hub._user_agent.clone());
3676
3677 if let Some(token) = token.as_ref() {
3678 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3679 }
3680
3681 let request = req_builder
3682 .header(CONTENT_LENGTH, 0_u64)
3683 .body(common::to_body::<String>(None));
3684
3685 client.request(request.unwrap()).await
3686 };
3687
3688 match req_result {
3689 Err(err) => {
3690 if let common::Retry::After(d) = dlg.http_error(&err) {
3691 sleep(d).await;
3692 continue;
3693 }
3694 dlg.finished(false);
3695 return Err(common::Error::HttpError(err));
3696 }
3697 Ok(res) => {
3698 let (mut parts, body) = res.into_parts();
3699 let mut body = common::Body::new(body);
3700 if !parts.status.is_success() {
3701 let bytes = common::to_bytes(body).await.unwrap_or_default();
3702 let error = serde_json::from_str(&common::to_string(&bytes));
3703 let response = common::to_response(parts, bytes.into());
3704
3705 if let common::Retry::After(d) =
3706 dlg.http_failure(&response, error.as_ref().ok())
3707 {
3708 sleep(d).await;
3709 continue;
3710 }
3711
3712 dlg.finished(false);
3713
3714 return Err(match error {
3715 Ok(value) => common::Error::BadRequest(value),
3716 _ => common::Error::Failure(response),
3717 });
3718 }
3719 let response = {
3720 let bytes = common::to_bytes(body).await.unwrap_or_default();
3721 let encoded = common::to_string(&bytes);
3722 match serde_json::from_str(&encoded) {
3723 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3724 Err(error) => {
3725 dlg.response_json_decode_error(&encoded, &error);
3726 return Err(common::Error::JsonDecodeError(
3727 encoded.to_string(),
3728 error,
3729 ));
3730 }
3731 }
3732 };
3733
3734 dlg.finished(true);
3735 return Ok(response);
3736 }
3737 }
3738 }
3739 }
3740
3741 /// Required. The resource name of the contact group to delete.
3742 ///
3743 /// Sets the *resource name* path property to the given value.
3744 ///
3745 /// Even though the property as already been set when instantiating this call,
3746 /// we provide this method for API completeness.
3747 pub fn resource_name(mut self, new_value: &str) -> ContactGroupDeleteCall<'a, C> {
3748 self._resource_name = new_value.to_string();
3749 self
3750 }
3751 /// Optional. Set to true to also delete the contacts in the specified group.
3752 ///
3753 /// Sets the *delete contacts* query property to the given value.
3754 pub fn delete_contacts(mut self, new_value: bool) -> ContactGroupDeleteCall<'a, C> {
3755 self._delete_contacts = Some(new_value);
3756 self
3757 }
3758 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3759 /// while executing the actual API request.
3760 ///
3761 /// ````text
3762 /// It should be used to handle progress information, and to implement a certain level of resilience.
3763 /// ````
3764 ///
3765 /// Sets the *delegate* property to the given value.
3766 pub fn delegate(
3767 mut self,
3768 new_value: &'a mut dyn common::Delegate,
3769 ) -> ContactGroupDeleteCall<'a, C> {
3770 self._delegate = Some(new_value);
3771 self
3772 }
3773
3774 /// Set any additional parameter of the query string used in the request.
3775 /// It should be used to set parameters which are not yet available through their own
3776 /// setters.
3777 ///
3778 /// Please note that this method must not be used to set any of the known parameters
3779 /// which have their own setter method. If done anyway, the request will fail.
3780 ///
3781 /// # Additional Parameters
3782 ///
3783 /// * *$.xgafv* (query-string) - V1 error format.
3784 /// * *access_token* (query-string) - OAuth access token.
3785 /// * *alt* (query-string) - Data format for response.
3786 /// * *callback* (query-string) - JSONP
3787 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3788 /// * *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.
3789 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3790 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3791 /// * *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.
3792 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3793 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3794 pub fn param<T>(mut self, name: T, value: T) -> ContactGroupDeleteCall<'a, C>
3795 where
3796 T: AsRef<str>,
3797 {
3798 self._additional_params
3799 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3800 self
3801 }
3802
3803 /// Identifies the authorization scope for the method you are building.
3804 ///
3805 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3806 /// [`Scope::Contact`].
3807 ///
3808 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3809 /// tokens for more than one scope.
3810 ///
3811 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3812 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3813 /// sufficient, a read-write scope will do as well.
3814 pub fn add_scope<St>(mut self, scope: St) -> ContactGroupDeleteCall<'a, C>
3815 where
3816 St: AsRef<str>,
3817 {
3818 self._scopes.insert(String::from(scope.as_ref()));
3819 self
3820 }
3821 /// Identifies the authorization scope(s) for the method you are building.
3822 ///
3823 /// See [`Self::add_scope()`] for details.
3824 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContactGroupDeleteCall<'a, C>
3825 where
3826 I: IntoIterator<Item = St>,
3827 St: AsRef<str>,
3828 {
3829 self._scopes
3830 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3831 self
3832 }
3833
3834 /// Removes all scopes, and no default scope will be used either.
3835 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3836 /// for details).
3837 pub fn clear_scopes(mut self) -> ContactGroupDeleteCall<'a, C> {
3838 self._scopes.clear();
3839 self
3840 }
3841}
3842
3843/// Get a specific contact group owned by the authenticated user by specifying a contact group resource name.
3844///
3845/// A builder for the *get* method supported by a *contactGroup* resource.
3846/// It is not used directly, but through a [`ContactGroupMethods`] instance.
3847///
3848/// # Example
3849///
3850/// Instantiate a resource method builder
3851///
3852/// ```test_harness,no_run
3853/// # extern crate hyper;
3854/// # extern crate hyper_rustls;
3855/// # extern crate google_people1 as people1;
3856/// # async fn dox() {
3857/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3858///
3859/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3860/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3861/// # .with_native_roots()
3862/// # .unwrap()
3863/// # .https_only()
3864/// # .enable_http2()
3865/// # .build();
3866///
3867/// # let executor = hyper_util::rt::TokioExecutor::new();
3868/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3869/// # secret,
3870/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3871/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3872/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3873/// # ),
3874/// # ).build().await.unwrap();
3875///
3876/// # let client = hyper_util::client::legacy::Client::builder(
3877/// # hyper_util::rt::TokioExecutor::new()
3878/// # )
3879/// # .build(
3880/// # hyper_rustls::HttpsConnectorBuilder::new()
3881/// # .with_native_roots()
3882/// # .unwrap()
3883/// # .https_or_http()
3884/// # .enable_http2()
3885/// # .build()
3886/// # );
3887/// # let mut hub = PeopleService::new(client, auth);
3888/// // You can configure optional parameters by calling the respective setters at will, and
3889/// // execute the final call using `doit()`.
3890/// // Values shown here are possibly random and not representative !
3891/// let result = hub.contact_groups().get("resourceName")
3892/// .max_members(-12)
3893/// .group_fields(FieldMask::new::<&str>(&[]))
3894/// .doit().await;
3895/// # }
3896/// ```
3897pub struct ContactGroupGetCall<'a, C>
3898where
3899 C: 'a,
3900{
3901 hub: &'a PeopleService<C>,
3902 _resource_name: String,
3903 _max_members: Option<i32>,
3904 _group_fields: Option<common::FieldMask>,
3905 _delegate: Option<&'a mut dyn common::Delegate>,
3906 _additional_params: HashMap<String, String>,
3907 _scopes: BTreeSet<String>,
3908}
3909
3910impl<'a, C> common::CallBuilder for ContactGroupGetCall<'a, C> {}
3911
3912impl<'a, C> ContactGroupGetCall<'a, C>
3913where
3914 C: common::Connector,
3915{
3916 /// Perform the operation you have build so far.
3917 pub async fn doit(mut self) -> common::Result<(common::Response, ContactGroup)> {
3918 use std::borrow::Cow;
3919 use std::io::{Read, Seek};
3920
3921 use common::{url::Params, ToParts};
3922 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3923
3924 let mut dd = common::DefaultDelegate;
3925 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3926 dlg.begin(common::MethodInfo {
3927 id: "people.contactGroups.get",
3928 http_method: hyper::Method::GET,
3929 });
3930
3931 for &field in ["alt", "resourceName", "maxMembers", "groupFields"].iter() {
3932 if self._additional_params.contains_key(field) {
3933 dlg.finished(false);
3934 return Err(common::Error::FieldClash(field));
3935 }
3936 }
3937
3938 let mut params = Params::with_capacity(5 + self._additional_params.len());
3939 params.push("resourceName", self._resource_name);
3940 if let Some(value) = self._max_members.as_ref() {
3941 params.push("maxMembers", value.to_string());
3942 }
3943 if let Some(value) = self._group_fields.as_ref() {
3944 params.push("groupFields", value.to_string());
3945 }
3946
3947 params.extend(self._additional_params.iter());
3948
3949 params.push("alt", "json");
3950 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}";
3951 if self._scopes.is_empty() {
3952 self._scopes
3953 .insert(Scope::ContactReadonly.as_ref().to_string());
3954 }
3955
3956 #[allow(clippy::single_element_loop)]
3957 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
3958 url = params.uri_replacement(url, param_name, find_this, true);
3959 }
3960 {
3961 let to_remove = ["resourceName"];
3962 params.remove_params(&to_remove);
3963 }
3964
3965 let url = params.parse_with_url(&url);
3966
3967 loop {
3968 let token = match self
3969 .hub
3970 .auth
3971 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3972 .await
3973 {
3974 Ok(token) => token,
3975 Err(e) => match dlg.token(e) {
3976 Ok(token) => token,
3977 Err(e) => {
3978 dlg.finished(false);
3979 return Err(common::Error::MissingToken(e));
3980 }
3981 },
3982 };
3983 let mut req_result = {
3984 let client = &self.hub.client;
3985 dlg.pre_request();
3986 let mut req_builder = hyper::Request::builder()
3987 .method(hyper::Method::GET)
3988 .uri(url.as_str())
3989 .header(USER_AGENT, self.hub._user_agent.clone());
3990
3991 if let Some(token) = token.as_ref() {
3992 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3993 }
3994
3995 let request = req_builder
3996 .header(CONTENT_LENGTH, 0_u64)
3997 .body(common::to_body::<String>(None));
3998
3999 client.request(request.unwrap()).await
4000 };
4001
4002 match req_result {
4003 Err(err) => {
4004 if let common::Retry::After(d) = dlg.http_error(&err) {
4005 sleep(d).await;
4006 continue;
4007 }
4008 dlg.finished(false);
4009 return Err(common::Error::HttpError(err));
4010 }
4011 Ok(res) => {
4012 let (mut parts, body) = res.into_parts();
4013 let mut body = common::Body::new(body);
4014 if !parts.status.is_success() {
4015 let bytes = common::to_bytes(body).await.unwrap_or_default();
4016 let error = serde_json::from_str(&common::to_string(&bytes));
4017 let response = common::to_response(parts, bytes.into());
4018
4019 if let common::Retry::After(d) =
4020 dlg.http_failure(&response, error.as_ref().ok())
4021 {
4022 sleep(d).await;
4023 continue;
4024 }
4025
4026 dlg.finished(false);
4027
4028 return Err(match error {
4029 Ok(value) => common::Error::BadRequest(value),
4030 _ => common::Error::Failure(response),
4031 });
4032 }
4033 let response = {
4034 let bytes = common::to_bytes(body).await.unwrap_or_default();
4035 let encoded = common::to_string(&bytes);
4036 match serde_json::from_str(&encoded) {
4037 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4038 Err(error) => {
4039 dlg.response_json_decode_error(&encoded, &error);
4040 return Err(common::Error::JsonDecodeError(
4041 encoded.to_string(),
4042 error,
4043 ));
4044 }
4045 }
4046 };
4047
4048 dlg.finished(true);
4049 return Ok(response);
4050 }
4051 }
4052 }
4053 }
4054
4055 /// Required. The resource name of the contact group to get.
4056 ///
4057 /// Sets the *resource name* path property to the given value.
4058 ///
4059 /// Even though the property as already been set when instantiating this call,
4060 /// we provide this method for API completeness.
4061 pub fn resource_name(mut self, new_value: &str) -> ContactGroupGetCall<'a, C> {
4062 self._resource_name = new_value.to_string();
4063 self
4064 }
4065 /// Optional. Specifies the maximum number of members to return. Defaults to 0 if not set, which will return zero members.
4066 ///
4067 /// Sets the *max members* query property to the given value.
4068 pub fn max_members(mut self, new_value: i32) -> ContactGroupGetCall<'a, C> {
4069 self._max_members = Some(new_value);
4070 self
4071 }
4072 /// Optional. A field mask to restrict which fields on the group are returned. Defaults to `metadata`, `groupType`, `memberCount`, and `name` if not set or set to empty. Valid fields are: * clientData * groupType * memberCount * metadata * name
4073 ///
4074 /// Sets the *group fields* query property to the given value.
4075 pub fn group_fields(mut self, new_value: common::FieldMask) -> ContactGroupGetCall<'a, C> {
4076 self._group_fields = Some(new_value);
4077 self
4078 }
4079 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4080 /// while executing the actual API request.
4081 ///
4082 /// ````text
4083 /// It should be used to handle progress information, and to implement a certain level of resilience.
4084 /// ````
4085 ///
4086 /// Sets the *delegate* property to the given value.
4087 pub fn delegate(
4088 mut self,
4089 new_value: &'a mut dyn common::Delegate,
4090 ) -> ContactGroupGetCall<'a, C> {
4091 self._delegate = Some(new_value);
4092 self
4093 }
4094
4095 /// Set any additional parameter of the query string used in the request.
4096 /// It should be used to set parameters which are not yet available through their own
4097 /// setters.
4098 ///
4099 /// Please note that this method must not be used to set any of the known parameters
4100 /// which have their own setter method. If done anyway, the request will fail.
4101 ///
4102 /// # Additional Parameters
4103 ///
4104 /// * *$.xgafv* (query-string) - V1 error format.
4105 /// * *access_token* (query-string) - OAuth access token.
4106 /// * *alt* (query-string) - Data format for response.
4107 /// * *callback* (query-string) - JSONP
4108 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4109 /// * *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.
4110 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4111 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4112 /// * *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.
4113 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4114 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4115 pub fn param<T>(mut self, name: T, value: T) -> ContactGroupGetCall<'a, C>
4116 where
4117 T: AsRef<str>,
4118 {
4119 self._additional_params
4120 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4121 self
4122 }
4123
4124 /// Identifies the authorization scope for the method you are building.
4125 ///
4126 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4127 /// [`Scope::ContactReadonly`].
4128 ///
4129 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4130 /// tokens for more than one scope.
4131 ///
4132 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4133 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4134 /// sufficient, a read-write scope will do as well.
4135 pub fn add_scope<St>(mut self, scope: St) -> ContactGroupGetCall<'a, C>
4136 where
4137 St: AsRef<str>,
4138 {
4139 self._scopes.insert(String::from(scope.as_ref()));
4140 self
4141 }
4142 /// Identifies the authorization scope(s) for the method you are building.
4143 ///
4144 /// See [`Self::add_scope()`] for details.
4145 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContactGroupGetCall<'a, C>
4146 where
4147 I: IntoIterator<Item = St>,
4148 St: AsRef<str>,
4149 {
4150 self._scopes
4151 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4152 self
4153 }
4154
4155 /// Removes all scopes, and no default scope will be used either.
4156 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4157 /// for details).
4158 pub fn clear_scopes(mut self) -> ContactGroupGetCall<'a, C> {
4159 self._scopes.clear();
4160 self
4161 }
4162}
4163
4164/// List all contact groups owned by the authenticated user. Members of the contact groups are not populated.
4165///
4166/// A builder for the *list* method supported by a *contactGroup* resource.
4167/// It is not used directly, but through a [`ContactGroupMethods`] instance.
4168///
4169/// # Example
4170///
4171/// Instantiate a resource method builder
4172///
4173/// ```test_harness,no_run
4174/// # extern crate hyper;
4175/// # extern crate hyper_rustls;
4176/// # extern crate google_people1 as people1;
4177/// # async fn dox() {
4178/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4179///
4180/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4181/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4182/// # .with_native_roots()
4183/// # .unwrap()
4184/// # .https_only()
4185/// # .enable_http2()
4186/// # .build();
4187///
4188/// # let executor = hyper_util::rt::TokioExecutor::new();
4189/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4190/// # secret,
4191/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4192/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4193/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4194/// # ),
4195/// # ).build().await.unwrap();
4196///
4197/// # let client = hyper_util::client::legacy::Client::builder(
4198/// # hyper_util::rt::TokioExecutor::new()
4199/// # )
4200/// # .build(
4201/// # hyper_rustls::HttpsConnectorBuilder::new()
4202/// # .with_native_roots()
4203/// # .unwrap()
4204/// # .https_or_http()
4205/// # .enable_http2()
4206/// # .build()
4207/// # );
4208/// # let mut hub = PeopleService::new(client, auth);
4209/// // You can configure optional parameters by calling the respective setters at will, and
4210/// // execute the final call using `doit()`.
4211/// // Values shown here are possibly random and not representative !
4212/// let result = hub.contact_groups().list()
4213/// .sync_token("eos")
4214/// .page_token("dolor")
4215/// .page_size(-17)
4216/// .group_fields(FieldMask::new::<&str>(&[]))
4217/// .doit().await;
4218/// # }
4219/// ```
4220pub struct ContactGroupListCall<'a, C>
4221where
4222 C: 'a,
4223{
4224 hub: &'a PeopleService<C>,
4225 _sync_token: Option<String>,
4226 _page_token: Option<String>,
4227 _page_size: Option<i32>,
4228 _group_fields: Option<common::FieldMask>,
4229 _delegate: Option<&'a mut dyn common::Delegate>,
4230 _additional_params: HashMap<String, String>,
4231 _scopes: BTreeSet<String>,
4232}
4233
4234impl<'a, C> common::CallBuilder for ContactGroupListCall<'a, C> {}
4235
4236impl<'a, C> ContactGroupListCall<'a, C>
4237where
4238 C: common::Connector,
4239{
4240 /// Perform the operation you have build so far.
4241 pub async fn doit(mut self) -> common::Result<(common::Response, ListContactGroupsResponse)> {
4242 use std::borrow::Cow;
4243 use std::io::{Read, Seek};
4244
4245 use common::{url::Params, ToParts};
4246 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4247
4248 let mut dd = common::DefaultDelegate;
4249 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4250 dlg.begin(common::MethodInfo {
4251 id: "people.contactGroups.list",
4252 http_method: hyper::Method::GET,
4253 });
4254
4255 for &field in ["alt", "syncToken", "pageToken", "pageSize", "groupFields"].iter() {
4256 if self._additional_params.contains_key(field) {
4257 dlg.finished(false);
4258 return Err(common::Error::FieldClash(field));
4259 }
4260 }
4261
4262 let mut params = Params::with_capacity(6 + self._additional_params.len());
4263 if let Some(value) = self._sync_token.as_ref() {
4264 params.push("syncToken", value);
4265 }
4266 if let Some(value) = self._page_token.as_ref() {
4267 params.push("pageToken", value);
4268 }
4269 if let Some(value) = self._page_size.as_ref() {
4270 params.push("pageSize", value.to_string());
4271 }
4272 if let Some(value) = self._group_fields.as_ref() {
4273 params.push("groupFields", value.to_string());
4274 }
4275
4276 params.extend(self._additional_params.iter());
4277
4278 params.push("alt", "json");
4279 let mut url = self.hub._base_url.clone() + "v1/contactGroups";
4280 if self._scopes.is_empty() {
4281 self._scopes
4282 .insert(Scope::ContactReadonly.as_ref().to_string());
4283 }
4284
4285 let url = params.parse_with_url(&url);
4286
4287 loop {
4288 let token = match self
4289 .hub
4290 .auth
4291 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4292 .await
4293 {
4294 Ok(token) => token,
4295 Err(e) => match dlg.token(e) {
4296 Ok(token) => token,
4297 Err(e) => {
4298 dlg.finished(false);
4299 return Err(common::Error::MissingToken(e));
4300 }
4301 },
4302 };
4303 let mut req_result = {
4304 let client = &self.hub.client;
4305 dlg.pre_request();
4306 let mut req_builder = hyper::Request::builder()
4307 .method(hyper::Method::GET)
4308 .uri(url.as_str())
4309 .header(USER_AGENT, self.hub._user_agent.clone());
4310
4311 if let Some(token) = token.as_ref() {
4312 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4313 }
4314
4315 let request = req_builder
4316 .header(CONTENT_LENGTH, 0_u64)
4317 .body(common::to_body::<String>(None));
4318
4319 client.request(request.unwrap()).await
4320 };
4321
4322 match req_result {
4323 Err(err) => {
4324 if let common::Retry::After(d) = dlg.http_error(&err) {
4325 sleep(d).await;
4326 continue;
4327 }
4328 dlg.finished(false);
4329 return Err(common::Error::HttpError(err));
4330 }
4331 Ok(res) => {
4332 let (mut parts, body) = res.into_parts();
4333 let mut body = common::Body::new(body);
4334 if !parts.status.is_success() {
4335 let bytes = common::to_bytes(body).await.unwrap_or_default();
4336 let error = serde_json::from_str(&common::to_string(&bytes));
4337 let response = common::to_response(parts, bytes.into());
4338
4339 if let common::Retry::After(d) =
4340 dlg.http_failure(&response, error.as_ref().ok())
4341 {
4342 sleep(d).await;
4343 continue;
4344 }
4345
4346 dlg.finished(false);
4347
4348 return Err(match error {
4349 Ok(value) => common::Error::BadRequest(value),
4350 _ => common::Error::Failure(response),
4351 });
4352 }
4353 let response = {
4354 let bytes = common::to_bytes(body).await.unwrap_or_default();
4355 let encoded = common::to_string(&bytes);
4356 match serde_json::from_str(&encoded) {
4357 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4358 Err(error) => {
4359 dlg.response_json_decode_error(&encoded, &error);
4360 return Err(common::Error::JsonDecodeError(
4361 encoded.to_string(),
4362 error,
4363 ));
4364 }
4365 }
4366 };
4367
4368 dlg.finished(true);
4369 return Ok(response);
4370 }
4371 }
4372 }
4373 }
4374
4375 /// Optional. A sync token, returned by a previous call to `contactgroups.list`. Only resources changed since the sync token was created will be returned.
4376 ///
4377 /// Sets the *sync token* query property to the given value.
4378 pub fn sync_token(mut self, new_value: &str) -> ContactGroupListCall<'a, C> {
4379 self._sync_token = Some(new_value.to_string());
4380 self
4381 }
4382 /// Optional. The next_page_token value returned from a previous call to [ListContactGroups](https://developers.google.com/people/api/rest/v1/contactgroups/list). Requests the next page of resources.
4383 ///
4384 /// Sets the *page token* query property to the given value.
4385 pub fn page_token(mut self, new_value: &str) -> ContactGroupListCall<'a, C> {
4386 self._page_token = Some(new_value.to_string());
4387 self
4388 }
4389 /// Optional. The maximum number of resources to return. Valid values are between 1 and 1000, inclusive. Defaults to 30 if not set or set to 0.
4390 ///
4391 /// Sets the *page size* query property to the given value.
4392 pub fn page_size(mut self, new_value: i32) -> ContactGroupListCall<'a, C> {
4393 self._page_size = Some(new_value);
4394 self
4395 }
4396 /// Optional. A field mask to restrict which fields on the group are returned. Defaults to `metadata`, `groupType`, `memberCount`, and `name` if not set or set to empty. Valid fields are: * clientData * groupType * memberCount * metadata * name
4397 ///
4398 /// Sets the *group fields* query property to the given value.
4399 pub fn group_fields(mut self, new_value: common::FieldMask) -> ContactGroupListCall<'a, C> {
4400 self._group_fields = Some(new_value);
4401 self
4402 }
4403 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4404 /// while executing the actual API request.
4405 ///
4406 /// ````text
4407 /// It should be used to handle progress information, and to implement a certain level of resilience.
4408 /// ````
4409 ///
4410 /// Sets the *delegate* property to the given value.
4411 pub fn delegate(
4412 mut self,
4413 new_value: &'a mut dyn common::Delegate,
4414 ) -> ContactGroupListCall<'a, C> {
4415 self._delegate = Some(new_value);
4416 self
4417 }
4418
4419 /// Set any additional parameter of the query string used in the request.
4420 /// It should be used to set parameters which are not yet available through their own
4421 /// setters.
4422 ///
4423 /// Please note that this method must not be used to set any of the known parameters
4424 /// which have their own setter method. If done anyway, the request will fail.
4425 ///
4426 /// # Additional Parameters
4427 ///
4428 /// * *$.xgafv* (query-string) - V1 error format.
4429 /// * *access_token* (query-string) - OAuth access token.
4430 /// * *alt* (query-string) - Data format for response.
4431 /// * *callback* (query-string) - JSONP
4432 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4433 /// * *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.
4434 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4435 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4436 /// * *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.
4437 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4438 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4439 pub fn param<T>(mut self, name: T, value: T) -> ContactGroupListCall<'a, C>
4440 where
4441 T: AsRef<str>,
4442 {
4443 self._additional_params
4444 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4445 self
4446 }
4447
4448 /// Identifies the authorization scope for the method you are building.
4449 ///
4450 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4451 /// [`Scope::ContactReadonly`].
4452 ///
4453 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4454 /// tokens for more than one scope.
4455 ///
4456 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4457 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4458 /// sufficient, a read-write scope will do as well.
4459 pub fn add_scope<St>(mut self, scope: St) -> ContactGroupListCall<'a, C>
4460 where
4461 St: AsRef<str>,
4462 {
4463 self._scopes.insert(String::from(scope.as_ref()));
4464 self
4465 }
4466 /// Identifies the authorization scope(s) for the method you are building.
4467 ///
4468 /// See [`Self::add_scope()`] for details.
4469 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContactGroupListCall<'a, C>
4470 where
4471 I: IntoIterator<Item = St>,
4472 St: AsRef<str>,
4473 {
4474 self._scopes
4475 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4476 self
4477 }
4478
4479 /// Removes all scopes, and no default scope will be used either.
4480 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4481 /// for details).
4482 pub fn clear_scopes(mut self) -> ContactGroupListCall<'a, C> {
4483 self._scopes.clear();
4484 self
4485 }
4486}
4487
4488/// Update the name of an existing contact group owned by the authenticated user. Updated contact group names must be unique to the users contact groups. Attempting to create a group with a duplicate name will return a HTTP 409 error. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
4489///
4490/// A builder for the *update* method supported by a *contactGroup* resource.
4491/// It is not used directly, but through a [`ContactGroupMethods`] instance.
4492///
4493/// # Example
4494///
4495/// Instantiate a resource method builder
4496///
4497/// ```test_harness,no_run
4498/// # extern crate hyper;
4499/// # extern crate hyper_rustls;
4500/// # extern crate google_people1 as people1;
4501/// use people1::api::UpdateContactGroupRequest;
4502/// # async fn dox() {
4503/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4504///
4505/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4506/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4507/// # .with_native_roots()
4508/// # .unwrap()
4509/// # .https_only()
4510/// # .enable_http2()
4511/// # .build();
4512///
4513/// # let executor = hyper_util::rt::TokioExecutor::new();
4514/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4515/// # secret,
4516/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4517/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4518/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4519/// # ),
4520/// # ).build().await.unwrap();
4521///
4522/// # let client = hyper_util::client::legacy::Client::builder(
4523/// # hyper_util::rt::TokioExecutor::new()
4524/// # )
4525/// # .build(
4526/// # hyper_rustls::HttpsConnectorBuilder::new()
4527/// # .with_native_roots()
4528/// # .unwrap()
4529/// # .https_or_http()
4530/// # .enable_http2()
4531/// # .build()
4532/// # );
4533/// # let mut hub = PeopleService::new(client, auth);
4534/// // As the method needs a request, you would usually fill it with the desired information
4535/// // into the respective structure. Some of the parts shown here might not be applicable !
4536/// // Values shown here are possibly random and not representative !
4537/// let mut req = UpdateContactGroupRequest::default();
4538///
4539/// // You can configure optional parameters by calling the respective setters at will, and
4540/// // execute the final call using `doit()`.
4541/// // Values shown here are possibly random and not representative !
4542/// let result = hub.contact_groups().update(req, "resourceName")
4543/// .doit().await;
4544/// # }
4545/// ```
4546pub struct ContactGroupUpdateCall<'a, C>
4547where
4548 C: 'a,
4549{
4550 hub: &'a PeopleService<C>,
4551 _request: UpdateContactGroupRequest,
4552 _resource_name: String,
4553 _delegate: Option<&'a mut dyn common::Delegate>,
4554 _additional_params: HashMap<String, String>,
4555 _scopes: BTreeSet<String>,
4556}
4557
4558impl<'a, C> common::CallBuilder for ContactGroupUpdateCall<'a, C> {}
4559
4560impl<'a, C> ContactGroupUpdateCall<'a, C>
4561where
4562 C: common::Connector,
4563{
4564 /// Perform the operation you have build so far.
4565 pub async fn doit(mut self) -> common::Result<(common::Response, ContactGroup)> {
4566 use std::borrow::Cow;
4567 use std::io::{Read, Seek};
4568
4569 use common::{url::Params, ToParts};
4570 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4571
4572 let mut dd = common::DefaultDelegate;
4573 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4574 dlg.begin(common::MethodInfo {
4575 id: "people.contactGroups.update",
4576 http_method: hyper::Method::PUT,
4577 });
4578
4579 for &field in ["alt", "resourceName"].iter() {
4580 if self._additional_params.contains_key(field) {
4581 dlg.finished(false);
4582 return Err(common::Error::FieldClash(field));
4583 }
4584 }
4585
4586 let mut params = Params::with_capacity(4 + self._additional_params.len());
4587 params.push("resourceName", self._resource_name);
4588
4589 params.extend(self._additional_params.iter());
4590
4591 params.push("alt", "json");
4592 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}";
4593 if self._scopes.is_empty() {
4594 self._scopes.insert(Scope::Contact.as_ref().to_string());
4595 }
4596
4597 #[allow(clippy::single_element_loop)]
4598 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
4599 url = params.uri_replacement(url, param_name, find_this, true);
4600 }
4601 {
4602 let to_remove = ["resourceName"];
4603 params.remove_params(&to_remove);
4604 }
4605
4606 let url = params.parse_with_url(&url);
4607
4608 let mut json_mime_type = mime::APPLICATION_JSON;
4609 let mut request_value_reader = {
4610 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4611 common::remove_json_null_values(&mut value);
4612 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4613 serde_json::to_writer(&mut dst, &value).unwrap();
4614 dst
4615 };
4616 let request_size = request_value_reader
4617 .seek(std::io::SeekFrom::End(0))
4618 .unwrap();
4619 request_value_reader
4620 .seek(std::io::SeekFrom::Start(0))
4621 .unwrap();
4622
4623 loop {
4624 let token = match self
4625 .hub
4626 .auth
4627 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4628 .await
4629 {
4630 Ok(token) => token,
4631 Err(e) => match dlg.token(e) {
4632 Ok(token) => token,
4633 Err(e) => {
4634 dlg.finished(false);
4635 return Err(common::Error::MissingToken(e));
4636 }
4637 },
4638 };
4639 request_value_reader
4640 .seek(std::io::SeekFrom::Start(0))
4641 .unwrap();
4642 let mut req_result = {
4643 let client = &self.hub.client;
4644 dlg.pre_request();
4645 let mut req_builder = hyper::Request::builder()
4646 .method(hyper::Method::PUT)
4647 .uri(url.as_str())
4648 .header(USER_AGENT, self.hub._user_agent.clone());
4649
4650 if let Some(token) = token.as_ref() {
4651 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4652 }
4653
4654 let request = req_builder
4655 .header(CONTENT_TYPE, json_mime_type.to_string())
4656 .header(CONTENT_LENGTH, request_size as u64)
4657 .body(common::to_body(
4658 request_value_reader.get_ref().clone().into(),
4659 ));
4660
4661 client.request(request.unwrap()).await
4662 };
4663
4664 match req_result {
4665 Err(err) => {
4666 if let common::Retry::After(d) = dlg.http_error(&err) {
4667 sleep(d).await;
4668 continue;
4669 }
4670 dlg.finished(false);
4671 return Err(common::Error::HttpError(err));
4672 }
4673 Ok(res) => {
4674 let (mut parts, body) = res.into_parts();
4675 let mut body = common::Body::new(body);
4676 if !parts.status.is_success() {
4677 let bytes = common::to_bytes(body).await.unwrap_or_default();
4678 let error = serde_json::from_str(&common::to_string(&bytes));
4679 let response = common::to_response(parts, bytes.into());
4680
4681 if let common::Retry::After(d) =
4682 dlg.http_failure(&response, error.as_ref().ok())
4683 {
4684 sleep(d).await;
4685 continue;
4686 }
4687
4688 dlg.finished(false);
4689
4690 return Err(match error {
4691 Ok(value) => common::Error::BadRequest(value),
4692 _ => common::Error::Failure(response),
4693 });
4694 }
4695 let response = {
4696 let bytes = common::to_bytes(body).await.unwrap_or_default();
4697 let encoded = common::to_string(&bytes);
4698 match serde_json::from_str(&encoded) {
4699 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4700 Err(error) => {
4701 dlg.response_json_decode_error(&encoded, &error);
4702 return Err(common::Error::JsonDecodeError(
4703 encoded.to_string(),
4704 error,
4705 ));
4706 }
4707 }
4708 };
4709
4710 dlg.finished(true);
4711 return Ok(response);
4712 }
4713 }
4714 }
4715 }
4716
4717 ///
4718 /// Sets the *request* property to the given value.
4719 ///
4720 /// Even though the property as already been set when instantiating this call,
4721 /// we provide this method for API completeness.
4722 pub fn request(
4723 mut self,
4724 new_value: UpdateContactGroupRequest,
4725 ) -> ContactGroupUpdateCall<'a, C> {
4726 self._request = new_value;
4727 self
4728 }
4729 /// The resource name for the contact group, assigned by the server. An ASCII string, in the form of `contactGroups/{contact_group_id}`.
4730 ///
4731 /// Sets the *resource name* path property to the given value.
4732 ///
4733 /// Even though the property as already been set when instantiating this call,
4734 /// we provide this method for API completeness.
4735 pub fn resource_name(mut self, new_value: &str) -> ContactGroupUpdateCall<'a, C> {
4736 self._resource_name = new_value.to_string();
4737 self
4738 }
4739 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4740 /// while executing the actual API request.
4741 ///
4742 /// ````text
4743 /// It should be used to handle progress information, and to implement a certain level of resilience.
4744 /// ````
4745 ///
4746 /// Sets the *delegate* property to the given value.
4747 pub fn delegate(
4748 mut self,
4749 new_value: &'a mut dyn common::Delegate,
4750 ) -> ContactGroupUpdateCall<'a, C> {
4751 self._delegate = Some(new_value);
4752 self
4753 }
4754
4755 /// Set any additional parameter of the query string used in the request.
4756 /// It should be used to set parameters which are not yet available through their own
4757 /// setters.
4758 ///
4759 /// Please note that this method must not be used to set any of the known parameters
4760 /// which have their own setter method. If done anyway, the request will fail.
4761 ///
4762 /// # Additional Parameters
4763 ///
4764 /// * *$.xgafv* (query-string) - V1 error format.
4765 /// * *access_token* (query-string) - OAuth access token.
4766 /// * *alt* (query-string) - Data format for response.
4767 /// * *callback* (query-string) - JSONP
4768 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4769 /// * *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.
4770 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4771 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4772 /// * *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.
4773 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4774 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4775 pub fn param<T>(mut self, name: T, value: T) -> ContactGroupUpdateCall<'a, C>
4776 where
4777 T: AsRef<str>,
4778 {
4779 self._additional_params
4780 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4781 self
4782 }
4783
4784 /// Identifies the authorization scope for the method you are building.
4785 ///
4786 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4787 /// [`Scope::Contact`].
4788 ///
4789 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4790 /// tokens for more than one scope.
4791 ///
4792 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4793 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4794 /// sufficient, a read-write scope will do as well.
4795 pub fn add_scope<St>(mut self, scope: St) -> ContactGroupUpdateCall<'a, C>
4796 where
4797 St: AsRef<str>,
4798 {
4799 self._scopes.insert(String::from(scope.as_ref()));
4800 self
4801 }
4802 /// Identifies the authorization scope(s) for the method you are building.
4803 ///
4804 /// See [`Self::add_scope()`] for details.
4805 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContactGroupUpdateCall<'a, C>
4806 where
4807 I: IntoIterator<Item = St>,
4808 St: AsRef<str>,
4809 {
4810 self._scopes
4811 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4812 self
4813 }
4814
4815 /// Removes all scopes, and no default scope will be used either.
4816 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4817 /// for details).
4818 pub fn clear_scopes(mut self) -> ContactGroupUpdateCall<'a, C> {
4819 self._scopes.clear();
4820 self
4821 }
4822}
4823
4824/// Copies an "Other contact" to a new contact in the user's "myContacts" group Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
4825///
4826/// A builder for the *copyOtherContactToMyContactsGroup* method supported by a *otherContact* resource.
4827/// It is not used directly, but through a [`OtherContactMethods`] instance.
4828///
4829/// # Example
4830///
4831/// Instantiate a resource method builder
4832///
4833/// ```test_harness,no_run
4834/// # extern crate hyper;
4835/// # extern crate hyper_rustls;
4836/// # extern crate google_people1 as people1;
4837/// use people1::api::CopyOtherContactToMyContactsGroupRequest;
4838/// # async fn dox() {
4839/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4840///
4841/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4842/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4843/// # .with_native_roots()
4844/// # .unwrap()
4845/// # .https_only()
4846/// # .enable_http2()
4847/// # .build();
4848///
4849/// # let executor = hyper_util::rt::TokioExecutor::new();
4850/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4851/// # secret,
4852/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4853/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4854/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4855/// # ),
4856/// # ).build().await.unwrap();
4857///
4858/// # let client = hyper_util::client::legacy::Client::builder(
4859/// # hyper_util::rt::TokioExecutor::new()
4860/// # )
4861/// # .build(
4862/// # hyper_rustls::HttpsConnectorBuilder::new()
4863/// # .with_native_roots()
4864/// # .unwrap()
4865/// # .https_or_http()
4866/// # .enable_http2()
4867/// # .build()
4868/// # );
4869/// # let mut hub = PeopleService::new(client, auth);
4870/// // As the method needs a request, you would usually fill it with the desired information
4871/// // into the respective structure. Some of the parts shown here might not be applicable !
4872/// // Values shown here are possibly random and not representative !
4873/// let mut req = CopyOtherContactToMyContactsGroupRequest::default();
4874///
4875/// // You can configure optional parameters by calling the respective setters at will, and
4876/// // execute the final call using `doit()`.
4877/// // Values shown here are possibly random and not representative !
4878/// let result = hub.other_contacts().copy_other_contact_to_my_contacts_group(req, "resourceName")
4879/// .doit().await;
4880/// # }
4881/// ```
4882pub struct OtherContactCopyOtherContactToMyContactsGroupCall<'a, C>
4883where
4884 C: 'a,
4885{
4886 hub: &'a PeopleService<C>,
4887 _request: CopyOtherContactToMyContactsGroupRequest,
4888 _resource_name: String,
4889 _delegate: Option<&'a mut dyn common::Delegate>,
4890 _additional_params: HashMap<String, String>,
4891 _scopes: BTreeSet<String>,
4892}
4893
4894impl<'a, C> common::CallBuilder for OtherContactCopyOtherContactToMyContactsGroupCall<'a, C> {}
4895
4896impl<'a, C> OtherContactCopyOtherContactToMyContactsGroupCall<'a, C>
4897where
4898 C: common::Connector,
4899{
4900 /// Perform the operation you have build so far.
4901 pub async fn doit(mut self) -> common::Result<(common::Response, Person)> {
4902 use std::borrow::Cow;
4903 use std::io::{Read, Seek};
4904
4905 use common::{url::Params, ToParts};
4906 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4907
4908 let mut dd = common::DefaultDelegate;
4909 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4910 dlg.begin(common::MethodInfo {
4911 id: "people.otherContacts.copyOtherContactToMyContactsGroup",
4912 http_method: hyper::Method::POST,
4913 });
4914
4915 for &field in ["alt", "resourceName"].iter() {
4916 if self._additional_params.contains_key(field) {
4917 dlg.finished(false);
4918 return Err(common::Error::FieldClash(field));
4919 }
4920 }
4921
4922 let mut params = Params::with_capacity(4 + self._additional_params.len());
4923 params.push("resourceName", self._resource_name);
4924
4925 params.extend(self._additional_params.iter());
4926
4927 params.push("alt", "json");
4928 let mut url =
4929 self.hub._base_url.clone() + "v1/{+resourceName}:copyOtherContactToMyContactsGroup";
4930 if self._scopes.is_empty() {
4931 self._scopes
4932 .insert(Scope::ContactOtherReadonly.as_ref().to_string());
4933 }
4934
4935 #[allow(clippy::single_element_loop)]
4936 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
4937 url = params.uri_replacement(url, param_name, find_this, true);
4938 }
4939 {
4940 let to_remove = ["resourceName"];
4941 params.remove_params(&to_remove);
4942 }
4943
4944 let url = params.parse_with_url(&url);
4945
4946 let mut json_mime_type = mime::APPLICATION_JSON;
4947 let mut request_value_reader = {
4948 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4949 common::remove_json_null_values(&mut value);
4950 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4951 serde_json::to_writer(&mut dst, &value).unwrap();
4952 dst
4953 };
4954 let request_size = request_value_reader
4955 .seek(std::io::SeekFrom::End(0))
4956 .unwrap();
4957 request_value_reader
4958 .seek(std::io::SeekFrom::Start(0))
4959 .unwrap();
4960
4961 loop {
4962 let token = match self
4963 .hub
4964 .auth
4965 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4966 .await
4967 {
4968 Ok(token) => token,
4969 Err(e) => match dlg.token(e) {
4970 Ok(token) => token,
4971 Err(e) => {
4972 dlg.finished(false);
4973 return Err(common::Error::MissingToken(e));
4974 }
4975 },
4976 };
4977 request_value_reader
4978 .seek(std::io::SeekFrom::Start(0))
4979 .unwrap();
4980 let mut req_result = {
4981 let client = &self.hub.client;
4982 dlg.pre_request();
4983 let mut req_builder = hyper::Request::builder()
4984 .method(hyper::Method::POST)
4985 .uri(url.as_str())
4986 .header(USER_AGENT, self.hub._user_agent.clone());
4987
4988 if let Some(token) = token.as_ref() {
4989 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4990 }
4991
4992 let request = req_builder
4993 .header(CONTENT_TYPE, json_mime_type.to_string())
4994 .header(CONTENT_LENGTH, request_size as u64)
4995 .body(common::to_body(
4996 request_value_reader.get_ref().clone().into(),
4997 ));
4998
4999 client.request(request.unwrap()).await
5000 };
5001
5002 match req_result {
5003 Err(err) => {
5004 if let common::Retry::After(d) = dlg.http_error(&err) {
5005 sleep(d).await;
5006 continue;
5007 }
5008 dlg.finished(false);
5009 return Err(common::Error::HttpError(err));
5010 }
5011 Ok(res) => {
5012 let (mut parts, body) = res.into_parts();
5013 let mut body = common::Body::new(body);
5014 if !parts.status.is_success() {
5015 let bytes = common::to_bytes(body).await.unwrap_or_default();
5016 let error = serde_json::from_str(&common::to_string(&bytes));
5017 let response = common::to_response(parts, bytes.into());
5018
5019 if let common::Retry::After(d) =
5020 dlg.http_failure(&response, error.as_ref().ok())
5021 {
5022 sleep(d).await;
5023 continue;
5024 }
5025
5026 dlg.finished(false);
5027
5028 return Err(match error {
5029 Ok(value) => common::Error::BadRequest(value),
5030 _ => common::Error::Failure(response),
5031 });
5032 }
5033 let response = {
5034 let bytes = common::to_bytes(body).await.unwrap_or_default();
5035 let encoded = common::to_string(&bytes);
5036 match serde_json::from_str(&encoded) {
5037 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5038 Err(error) => {
5039 dlg.response_json_decode_error(&encoded, &error);
5040 return Err(common::Error::JsonDecodeError(
5041 encoded.to_string(),
5042 error,
5043 ));
5044 }
5045 }
5046 };
5047
5048 dlg.finished(true);
5049 return Ok(response);
5050 }
5051 }
5052 }
5053 }
5054
5055 ///
5056 /// Sets the *request* property to the given value.
5057 ///
5058 /// Even though the property as already been set when instantiating this call,
5059 /// we provide this method for API completeness.
5060 pub fn request(
5061 mut self,
5062 new_value: CopyOtherContactToMyContactsGroupRequest,
5063 ) -> OtherContactCopyOtherContactToMyContactsGroupCall<'a, C> {
5064 self._request = new_value;
5065 self
5066 }
5067 /// Required. The resource name of the "Other contact" to copy.
5068 ///
5069 /// Sets the *resource name* path property to the given value.
5070 ///
5071 /// Even though the property as already been set when instantiating this call,
5072 /// we provide this method for API completeness.
5073 pub fn resource_name(
5074 mut self,
5075 new_value: &str,
5076 ) -> OtherContactCopyOtherContactToMyContactsGroupCall<'a, C> {
5077 self._resource_name = new_value.to_string();
5078 self
5079 }
5080 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5081 /// while executing the actual API request.
5082 ///
5083 /// ````text
5084 /// It should be used to handle progress information, and to implement a certain level of resilience.
5085 /// ````
5086 ///
5087 /// Sets the *delegate* property to the given value.
5088 pub fn delegate(
5089 mut self,
5090 new_value: &'a mut dyn common::Delegate,
5091 ) -> OtherContactCopyOtherContactToMyContactsGroupCall<'a, C> {
5092 self._delegate = Some(new_value);
5093 self
5094 }
5095
5096 /// Set any additional parameter of the query string used in the request.
5097 /// It should be used to set parameters which are not yet available through their own
5098 /// setters.
5099 ///
5100 /// Please note that this method must not be used to set any of the known parameters
5101 /// which have their own setter method. If done anyway, the request will fail.
5102 ///
5103 /// # Additional Parameters
5104 ///
5105 /// * *$.xgafv* (query-string) - V1 error format.
5106 /// * *access_token* (query-string) - OAuth access token.
5107 /// * *alt* (query-string) - Data format for response.
5108 /// * *callback* (query-string) - JSONP
5109 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5110 /// * *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.
5111 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5112 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5113 /// * *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.
5114 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5115 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5116 pub fn param<T>(
5117 mut self,
5118 name: T,
5119 value: T,
5120 ) -> OtherContactCopyOtherContactToMyContactsGroupCall<'a, C>
5121 where
5122 T: AsRef<str>,
5123 {
5124 self._additional_params
5125 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5126 self
5127 }
5128
5129 /// Identifies the authorization scope for the method you are building.
5130 ///
5131 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5132 /// [`Scope::ContactOtherReadonly`].
5133 ///
5134 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5135 /// tokens for more than one scope.
5136 ///
5137 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5138 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5139 /// sufficient, a read-write scope will do as well.
5140 pub fn add_scope<St>(
5141 mut self,
5142 scope: St,
5143 ) -> OtherContactCopyOtherContactToMyContactsGroupCall<'a, C>
5144 where
5145 St: AsRef<str>,
5146 {
5147 self._scopes.insert(String::from(scope.as_ref()));
5148 self
5149 }
5150 /// Identifies the authorization scope(s) for the method you are building.
5151 ///
5152 /// See [`Self::add_scope()`] for details.
5153 pub fn add_scopes<I, St>(
5154 mut self,
5155 scopes: I,
5156 ) -> OtherContactCopyOtherContactToMyContactsGroupCall<'a, C>
5157 where
5158 I: IntoIterator<Item = St>,
5159 St: AsRef<str>,
5160 {
5161 self._scopes
5162 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5163 self
5164 }
5165
5166 /// Removes all scopes, and no default scope will be used either.
5167 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5168 /// for details).
5169 pub fn clear_scopes(mut self) -> OtherContactCopyOtherContactToMyContactsGroupCall<'a, C> {
5170 self._scopes.clear();
5171 self
5172 }
5173}
5174
5175/// List all “Other contacts”, that is contacts that are not in a contact group. “Other contacts” are typically auto created contacts from interactions. Sync tokens expire 7 days after the full sync. A request with an expired sync token will get an error with an [google.rpc.ErrorInfo](https://cloud.google.com/apis/design/errors#error_info) with reason “EXPIRED_SYNC_TOKEN”. In the case of such an error clients should make a full sync request without a `sync_token`. The first page of a full sync request has an additional quota. If the quota is exceeded, a 429 error will be returned. This quota is fixed and can not be increased. When the `sync_token` is specified, resources deleted since the last sync will be returned as a person with `PersonMetadata.deleted` set to true. When the `page_token` or `sync_token` is specified, all other request parameters must match the first call. Writes may have a propagation delay of several minutes for sync requests. Incremental syncs are not intended for read-after-write use cases. See example usage at [List the user’s other contacts that have changed](https://developers.google.com/people/v1/other-contacts#list_the_users_other_contacts_that_have_changed).
5176///
5177/// A builder for the *list* method supported by a *otherContact* resource.
5178/// It is not used directly, but through a [`OtherContactMethods`] instance.
5179///
5180/// # Example
5181///
5182/// Instantiate a resource method builder
5183///
5184/// ```test_harness,no_run
5185/// # extern crate hyper;
5186/// # extern crate hyper_rustls;
5187/// # extern crate google_people1 as people1;
5188/// # async fn dox() {
5189/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5190///
5191/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5192/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5193/// # .with_native_roots()
5194/// # .unwrap()
5195/// # .https_only()
5196/// # .enable_http2()
5197/// # .build();
5198///
5199/// # let executor = hyper_util::rt::TokioExecutor::new();
5200/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5201/// # secret,
5202/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5203/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5204/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5205/// # ),
5206/// # ).build().await.unwrap();
5207///
5208/// # let client = hyper_util::client::legacy::Client::builder(
5209/// # hyper_util::rt::TokioExecutor::new()
5210/// # )
5211/// # .build(
5212/// # hyper_rustls::HttpsConnectorBuilder::new()
5213/// # .with_native_roots()
5214/// # .unwrap()
5215/// # .https_or_http()
5216/// # .enable_http2()
5217/// # .build()
5218/// # );
5219/// # let mut hub = PeopleService::new(client, auth);
5220/// // You can configure optional parameters by calling the respective setters at will, and
5221/// // execute the final call using `doit()`.
5222/// // Values shown here are possibly random and not representative !
5223/// let result = hub.other_contacts().list()
5224/// .sync_token("amet")
5225/// .add_sources("duo")
5226/// .request_sync_token(true)
5227/// .read_mask(FieldMask::new::<&str>(&[]))
5228/// .page_token("sed")
5229/// .page_size(-37)
5230/// .doit().await;
5231/// # }
5232/// ```
5233pub struct OtherContactListCall<'a, C>
5234where
5235 C: 'a,
5236{
5237 hub: &'a PeopleService<C>,
5238 _sync_token: Option<String>,
5239 _sources: Vec<String>,
5240 _request_sync_token: Option<bool>,
5241 _read_mask: Option<common::FieldMask>,
5242 _page_token: Option<String>,
5243 _page_size: Option<i32>,
5244 _delegate: Option<&'a mut dyn common::Delegate>,
5245 _additional_params: HashMap<String, String>,
5246 _scopes: BTreeSet<String>,
5247}
5248
5249impl<'a, C> common::CallBuilder for OtherContactListCall<'a, C> {}
5250
5251impl<'a, C> OtherContactListCall<'a, C>
5252where
5253 C: common::Connector,
5254{
5255 /// Perform the operation you have build so far.
5256 pub async fn doit(mut self) -> common::Result<(common::Response, ListOtherContactsResponse)> {
5257 use std::borrow::Cow;
5258 use std::io::{Read, Seek};
5259
5260 use common::{url::Params, ToParts};
5261 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5262
5263 let mut dd = common::DefaultDelegate;
5264 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5265 dlg.begin(common::MethodInfo {
5266 id: "people.otherContacts.list",
5267 http_method: hyper::Method::GET,
5268 });
5269
5270 for &field in [
5271 "alt",
5272 "syncToken",
5273 "sources",
5274 "requestSyncToken",
5275 "readMask",
5276 "pageToken",
5277 "pageSize",
5278 ]
5279 .iter()
5280 {
5281 if self._additional_params.contains_key(field) {
5282 dlg.finished(false);
5283 return Err(common::Error::FieldClash(field));
5284 }
5285 }
5286
5287 let mut params = Params::with_capacity(8 + self._additional_params.len());
5288 if let Some(value) = self._sync_token.as_ref() {
5289 params.push("syncToken", value);
5290 }
5291 if !self._sources.is_empty() {
5292 for f in self._sources.iter() {
5293 params.push("sources", f);
5294 }
5295 }
5296 if let Some(value) = self._request_sync_token.as_ref() {
5297 params.push("requestSyncToken", value.to_string());
5298 }
5299 if let Some(value) = self._read_mask.as_ref() {
5300 params.push("readMask", value.to_string());
5301 }
5302 if let Some(value) = self._page_token.as_ref() {
5303 params.push("pageToken", value);
5304 }
5305 if let Some(value) = self._page_size.as_ref() {
5306 params.push("pageSize", value.to_string());
5307 }
5308
5309 params.extend(self._additional_params.iter());
5310
5311 params.push("alt", "json");
5312 let mut url = self.hub._base_url.clone() + "v1/otherContacts";
5313 if self._scopes.is_empty() {
5314 self._scopes
5315 .insert(Scope::ContactOtherReadonly.as_ref().to_string());
5316 }
5317
5318 let url = params.parse_with_url(&url);
5319
5320 loop {
5321 let token = match self
5322 .hub
5323 .auth
5324 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5325 .await
5326 {
5327 Ok(token) => token,
5328 Err(e) => match dlg.token(e) {
5329 Ok(token) => token,
5330 Err(e) => {
5331 dlg.finished(false);
5332 return Err(common::Error::MissingToken(e));
5333 }
5334 },
5335 };
5336 let mut req_result = {
5337 let client = &self.hub.client;
5338 dlg.pre_request();
5339 let mut req_builder = hyper::Request::builder()
5340 .method(hyper::Method::GET)
5341 .uri(url.as_str())
5342 .header(USER_AGENT, self.hub._user_agent.clone());
5343
5344 if let Some(token) = token.as_ref() {
5345 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5346 }
5347
5348 let request = req_builder
5349 .header(CONTENT_LENGTH, 0_u64)
5350 .body(common::to_body::<String>(None));
5351
5352 client.request(request.unwrap()).await
5353 };
5354
5355 match req_result {
5356 Err(err) => {
5357 if let common::Retry::After(d) = dlg.http_error(&err) {
5358 sleep(d).await;
5359 continue;
5360 }
5361 dlg.finished(false);
5362 return Err(common::Error::HttpError(err));
5363 }
5364 Ok(res) => {
5365 let (mut parts, body) = res.into_parts();
5366 let mut body = common::Body::new(body);
5367 if !parts.status.is_success() {
5368 let bytes = common::to_bytes(body).await.unwrap_or_default();
5369 let error = serde_json::from_str(&common::to_string(&bytes));
5370 let response = common::to_response(parts, bytes.into());
5371
5372 if let common::Retry::After(d) =
5373 dlg.http_failure(&response, error.as_ref().ok())
5374 {
5375 sleep(d).await;
5376 continue;
5377 }
5378
5379 dlg.finished(false);
5380
5381 return Err(match error {
5382 Ok(value) => common::Error::BadRequest(value),
5383 _ => common::Error::Failure(response),
5384 });
5385 }
5386 let response = {
5387 let bytes = common::to_bytes(body).await.unwrap_or_default();
5388 let encoded = common::to_string(&bytes);
5389 match serde_json::from_str(&encoded) {
5390 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5391 Err(error) => {
5392 dlg.response_json_decode_error(&encoded, &error);
5393 return Err(common::Error::JsonDecodeError(
5394 encoded.to_string(),
5395 error,
5396 ));
5397 }
5398 }
5399 };
5400
5401 dlg.finished(true);
5402 return Ok(response);
5403 }
5404 }
5405 }
5406 }
5407
5408 /// Optional. A sync token, received from a previous response `next_sync_token` Provide this to retrieve only the resources changed since the last request. When syncing, all other parameters provided to `otherContacts.list` must match the first call that provided the sync token. More details about sync behavior at `otherContacts.list`.
5409 ///
5410 /// Sets the *sync token* query property to the given value.
5411 pub fn sync_token(mut self, new_value: &str) -> OtherContactListCall<'a, C> {
5412 self._sync_token = Some(new_value.to_string());
5413 self
5414 }
5415 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT if not set. Possible values for this field are: * READ_SOURCE_TYPE_CONTACT * READ_SOURCE_TYPE_CONTACT,READ_SOURCE_TYPE_PROFILE Specifying READ_SOURCE_TYPE_PROFILE without specifying READ_SOURCE_TYPE_CONTACT is not permitted.
5416 ///
5417 /// Append the given value to the *sources* query property.
5418 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
5419 pub fn add_sources(mut self, new_value: &str) -> OtherContactListCall<'a, C> {
5420 self._sources.push(new_value.to_string());
5421 self
5422 }
5423 /// Optional. Whether the response should return `next_sync_token` on the last page of results. It can be used to get incremental changes since the last request by setting it on the request `sync_token`. More details about sync behavior at `otherContacts.list`.
5424 ///
5425 /// Sets the *request sync token* query property to the given value.
5426 pub fn request_sync_token(mut self, new_value: bool) -> OtherContactListCall<'a, C> {
5427 self._request_sync_token = Some(new_value);
5428 self
5429 }
5430 /// Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. What values are valid depend on what ReadSourceType is used. If READ_SOURCE_TYPE_CONTACT is used, valid values are: * emailAddresses * metadata * names * phoneNumbers * photos If READ_SOURCE_TYPE_PROFILE is used, valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
5431 ///
5432 /// Sets the *read mask* query property to the given value.
5433 pub fn read_mask(mut self, new_value: common::FieldMask) -> OtherContactListCall<'a, C> {
5434 self._read_mask = Some(new_value);
5435 self
5436 }
5437 /// Optional. A page token, received from a previous response `next_page_token`. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `otherContacts.list` must match the first call that provided the page token.
5438 ///
5439 /// Sets the *page token* query property to the given value.
5440 pub fn page_token(mut self, new_value: &str) -> OtherContactListCall<'a, C> {
5441 self._page_token = Some(new_value.to_string());
5442 self
5443 }
5444 /// Optional. The number of "Other contacts" to include in the response. Valid values are between 1 and 1000, inclusive. Defaults to 100 if not set or set to 0.
5445 ///
5446 /// Sets the *page size* query property to the given value.
5447 pub fn page_size(mut self, new_value: i32) -> OtherContactListCall<'a, C> {
5448 self._page_size = Some(new_value);
5449 self
5450 }
5451 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5452 /// while executing the actual API request.
5453 ///
5454 /// ````text
5455 /// It should be used to handle progress information, and to implement a certain level of resilience.
5456 /// ````
5457 ///
5458 /// Sets the *delegate* property to the given value.
5459 pub fn delegate(
5460 mut self,
5461 new_value: &'a mut dyn common::Delegate,
5462 ) -> OtherContactListCall<'a, C> {
5463 self._delegate = Some(new_value);
5464 self
5465 }
5466
5467 /// Set any additional parameter of the query string used in the request.
5468 /// It should be used to set parameters which are not yet available through their own
5469 /// setters.
5470 ///
5471 /// Please note that this method must not be used to set any of the known parameters
5472 /// which have their own setter method. If done anyway, the request will fail.
5473 ///
5474 /// # Additional Parameters
5475 ///
5476 /// * *$.xgafv* (query-string) - V1 error format.
5477 /// * *access_token* (query-string) - OAuth access token.
5478 /// * *alt* (query-string) - Data format for response.
5479 /// * *callback* (query-string) - JSONP
5480 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5481 /// * *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.
5482 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5483 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5484 /// * *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.
5485 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5486 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5487 pub fn param<T>(mut self, name: T, value: T) -> OtherContactListCall<'a, C>
5488 where
5489 T: AsRef<str>,
5490 {
5491 self._additional_params
5492 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5493 self
5494 }
5495
5496 /// Identifies the authorization scope for the method you are building.
5497 ///
5498 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5499 /// [`Scope::ContactOtherReadonly`].
5500 ///
5501 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5502 /// tokens for more than one scope.
5503 ///
5504 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5505 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5506 /// sufficient, a read-write scope will do as well.
5507 pub fn add_scope<St>(mut self, scope: St) -> OtherContactListCall<'a, C>
5508 where
5509 St: AsRef<str>,
5510 {
5511 self._scopes.insert(String::from(scope.as_ref()));
5512 self
5513 }
5514 /// Identifies the authorization scope(s) for the method you are building.
5515 ///
5516 /// See [`Self::add_scope()`] for details.
5517 pub fn add_scopes<I, St>(mut self, scopes: I) -> OtherContactListCall<'a, C>
5518 where
5519 I: IntoIterator<Item = St>,
5520 St: AsRef<str>,
5521 {
5522 self._scopes
5523 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5524 self
5525 }
5526
5527 /// Removes all scopes, and no default scope will be used either.
5528 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5529 /// for details).
5530 pub fn clear_scopes(mut self) -> OtherContactListCall<'a, C> {
5531 self._scopes.clear();
5532 self
5533 }
5534}
5535
5536/// Provides a list of contacts in the authenticated user's other contacts that matches the search query. The query matches on a contact's `names`, `emailAddresses`, and `phoneNumbers` fields that are from the OTHER_CONTACT source. **IMPORTANT**: Before searching, clients should send a warmup request with an empty query to update the cache. See https://developers.google.com/people/v1/other-contacts#search_the_users_other_contacts
5537///
5538/// A builder for the *search* method supported by a *otherContact* resource.
5539/// It is not used directly, but through a [`OtherContactMethods`] instance.
5540///
5541/// # Example
5542///
5543/// Instantiate a resource method builder
5544///
5545/// ```test_harness,no_run
5546/// # extern crate hyper;
5547/// # extern crate hyper_rustls;
5548/// # extern crate google_people1 as people1;
5549/// # async fn dox() {
5550/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5551///
5552/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5553/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5554/// # .with_native_roots()
5555/// # .unwrap()
5556/// # .https_only()
5557/// # .enable_http2()
5558/// # .build();
5559///
5560/// # let executor = hyper_util::rt::TokioExecutor::new();
5561/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5562/// # secret,
5563/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5564/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5565/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5566/// # ),
5567/// # ).build().await.unwrap();
5568///
5569/// # let client = hyper_util::client::legacy::Client::builder(
5570/// # hyper_util::rt::TokioExecutor::new()
5571/// # )
5572/// # .build(
5573/// # hyper_rustls::HttpsConnectorBuilder::new()
5574/// # .with_native_roots()
5575/// # .unwrap()
5576/// # .https_or_http()
5577/// # .enable_http2()
5578/// # .build()
5579/// # );
5580/// # let mut hub = PeopleService::new(client, auth);
5581/// // You can configure optional parameters by calling the respective setters at will, and
5582/// // execute the final call using `doit()`.
5583/// // Values shown here are possibly random and not representative !
5584/// let result = hub.other_contacts().search()
5585/// .read_mask(FieldMask::new::<&str>(&[]))
5586/// .query("gubergren")
5587/// .page_size(-16)
5588/// .doit().await;
5589/// # }
5590/// ```
5591pub struct OtherContactSearchCall<'a, C>
5592where
5593 C: 'a,
5594{
5595 hub: &'a PeopleService<C>,
5596 _read_mask: Option<common::FieldMask>,
5597 _query: Option<String>,
5598 _page_size: Option<i32>,
5599 _delegate: Option<&'a mut dyn common::Delegate>,
5600 _additional_params: HashMap<String, String>,
5601 _scopes: BTreeSet<String>,
5602}
5603
5604impl<'a, C> common::CallBuilder for OtherContactSearchCall<'a, C> {}
5605
5606impl<'a, C> OtherContactSearchCall<'a, C>
5607where
5608 C: common::Connector,
5609{
5610 /// Perform the operation you have build so far.
5611 pub async fn doit(mut self) -> common::Result<(common::Response, SearchResponse)> {
5612 use std::borrow::Cow;
5613 use std::io::{Read, Seek};
5614
5615 use common::{url::Params, ToParts};
5616 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5617
5618 let mut dd = common::DefaultDelegate;
5619 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5620 dlg.begin(common::MethodInfo {
5621 id: "people.otherContacts.search",
5622 http_method: hyper::Method::GET,
5623 });
5624
5625 for &field in ["alt", "readMask", "query", "pageSize"].iter() {
5626 if self._additional_params.contains_key(field) {
5627 dlg.finished(false);
5628 return Err(common::Error::FieldClash(field));
5629 }
5630 }
5631
5632 let mut params = Params::with_capacity(5 + self._additional_params.len());
5633 if let Some(value) = self._read_mask.as_ref() {
5634 params.push("readMask", value.to_string());
5635 }
5636 if let Some(value) = self._query.as_ref() {
5637 params.push("query", value);
5638 }
5639 if let Some(value) = self._page_size.as_ref() {
5640 params.push("pageSize", value.to_string());
5641 }
5642
5643 params.extend(self._additional_params.iter());
5644
5645 params.push("alt", "json");
5646 let mut url = self.hub._base_url.clone() + "v1/otherContacts:search";
5647 if self._scopes.is_empty() {
5648 self._scopes
5649 .insert(Scope::ContactOtherReadonly.as_ref().to_string());
5650 }
5651
5652 let url = params.parse_with_url(&url);
5653
5654 loop {
5655 let token = match self
5656 .hub
5657 .auth
5658 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5659 .await
5660 {
5661 Ok(token) => token,
5662 Err(e) => match dlg.token(e) {
5663 Ok(token) => token,
5664 Err(e) => {
5665 dlg.finished(false);
5666 return Err(common::Error::MissingToken(e));
5667 }
5668 },
5669 };
5670 let mut req_result = {
5671 let client = &self.hub.client;
5672 dlg.pre_request();
5673 let mut req_builder = hyper::Request::builder()
5674 .method(hyper::Method::GET)
5675 .uri(url.as_str())
5676 .header(USER_AGENT, self.hub._user_agent.clone());
5677
5678 if let Some(token) = token.as_ref() {
5679 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5680 }
5681
5682 let request = req_builder
5683 .header(CONTENT_LENGTH, 0_u64)
5684 .body(common::to_body::<String>(None));
5685
5686 client.request(request.unwrap()).await
5687 };
5688
5689 match req_result {
5690 Err(err) => {
5691 if let common::Retry::After(d) = dlg.http_error(&err) {
5692 sleep(d).await;
5693 continue;
5694 }
5695 dlg.finished(false);
5696 return Err(common::Error::HttpError(err));
5697 }
5698 Ok(res) => {
5699 let (mut parts, body) = res.into_parts();
5700 let mut body = common::Body::new(body);
5701 if !parts.status.is_success() {
5702 let bytes = common::to_bytes(body).await.unwrap_or_default();
5703 let error = serde_json::from_str(&common::to_string(&bytes));
5704 let response = common::to_response(parts, bytes.into());
5705
5706 if let common::Retry::After(d) =
5707 dlg.http_failure(&response, error.as_ref().ok())
5708 {
5709 sleep(d).await;
5710 continue;
5711 }
5712
5713 dlg.finished(false);
5714
5715 return Err(match error {
5716 Ok(value) => common::Error::BadRequest(value),
5717 _ => common::Error::Failure(response),
5718 });
5719 }
5720 let response = {
5721 let bytes = common::to_bytes(body).await.unwrap_or_default();
5722 let encoded = common::to_string(&bytes);
5723 match serde_json::from_str(&encoded) {
5724 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5725 Err(error) => {
5726 dlg.response_json_decode_error(&encoded, &error);
5727 return Err(common::Error::JsonDecodeError(
5728 encoded.to_string(),
5729 error,
5730 ));
5731 }
5732 }
5733 };
5734
5735 dlg.finished(true);
5736 return Ok(response);
5737 }
5738 }
5739 }
5740 }
5741
5742 /// Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Valid values are: * emailAddresses * metadata * names * phoneNumbers
5743 ///
5744 /// Sets the *read mask* query property to the given value.
5745 pub fn read_mask(mut self, new_value: common::FieldMask) -> OtherContactSearchCall<'a, C> {
5746 self._read_mask = Some(new_value);
5747 self
5748 }
5749 /// Required. The plain-text query for the request. The query is used to match prefix phrases of the fields on a person. For example, a person with name "foo name" matches queries such as "f", "fo", "foo", "foo n", "nam", etc., but not "oo n".
5750 ///
5751 /// Sets the *query* query property to the given value.
5752 pub fn query(mut self, new_value: &str) -> OtherContactSearchCall<'a, C> {
5753 self._query = Some(new_value.to_string());
5754 self
5755 }
5756 /// Optional. The number of results to return. Defaults to 10 if field is not set, or set to 0. Values greater than 30 will be capped to 30.
5757 ///
5758 /// Sets the *page size* query property to the given value.
5759 pub fn page_size(mut self, new_value: i32) -> OtherContactSearchCall<'a, C> {
5760 self._page_size = Some(new_value);
5761 self
5762 }
5763 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5764 /// while executing the actual API request.
5765 ///
5766 /// ````text
5767 /// It should be used to handle progress information, and to implement a certain level of resilience.
5768 /// ````
5769 ///
5770 /// Sets the *delegate* property to the given value.
5771 pub fn delegate(
5772 mut self,
5773 new_value: &'a mut dyn common::Delegate,
5774 ) -> OtherContactSearchCall<'a, C> {
5775 self._delegate = Some(new_value);
5776 self
5777 }
5778
5779 /// Set any additional parameter of the query string used in the request.
5780 /// It should be used to set parameters which are not yet available through their own
5781 /// setters.
5782 ///
5783 /// Please note that this method must not be used to set any of the known parameters
5784 /// which have their own setter method. If done anyway, the request will fail.
5785 ///
5786 /// # Additional Parameters
5787 ///
5788 /// * *$.xgafv* (query-string) - V1 error format.
5789 /// * *access_token* (query-string) - OAuth access token.
5790 /// * *alt* (query-string) - Data format for response.
5791 /// * *callback* (query-string) - JSONP
5792 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5793 /// * *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.
5794 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5795 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5796 /// * *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.
5797 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5798 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5799 pub fn param<T>(mut self, name: T, value: T) -> OtherContactSearchCall<'a, C>
5800 where
5801 T: AsRef<str>,
5802 {
5803 self._additional_params
5804 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5805 self
5806 }
5807
5808 /// Identifies the authorization scope for the method you are building.
5809 ///
5810 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5811 /// [`Scope::ContactOtherReadonly`].
5812 ///
5813 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5814 /// tokens for more than one scope.
5815 ///
5816 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5817 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5818 /// sufficient, a read-write scope will do as well.
5819 pub fn add_scope<St>(mut self, scope: St) -> OtherContactSearchCall<'a, C>
5820 where
5821 St: AsRef<str>,
5822 {
5823 self._scopes.insert(String::from(scope.as_ref()));
5824 self
5825 }
5826 /// Identifies the authorization scope(s) for the method you are building.
5827 ///
5828 /// See [`Self::add_scope()`] for details.
5829 pub fn add_scopes<I, St>(mut self, scopes: I) -> OtherContactSearchCall<'a, C>
5830 where
5831 I: IntoIterator<Item = St>,
5832 St: AsRef<str>,
5833 {
5834 self._scopes
5835 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5836 self
5837 }
5838
5839 /// Removes all scopes, and no default scope will be used either.
5840 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5841 /// for details).
5842 pub fn clear_scopes(mut self) -> OtherContactSearchCall<'a, C> {
5843 self._scopes.clear();
5844 self
5845 }
5846}
5847
5848/// Provides a list of the authenticated user’s contacts. Sync tokens expire 7 days after the full sync. A request with an expired sync token will get an error with an [google.rpc.ErrorInfo](https://cloud.google.com/apis/design/errors#error_info) with reason “EXPIRED_SYNC_TOKEN”. In the case of such an error clients should make a full sync request without a `sync_token`. The first page of a full sync request has an additional quota. If the quota is exceeded, a 429 error will be returned. This quota is fixed and can not be increased. When the `sync_token` is specified, resources deleted since the last sync will be returned as a person with `PersonMetadata.deleted` set to true. When the `page_token` or `sync_token` is specified, all other request parameters must match the first call. Writes may have a propagation delay of several minutes for sync requests. Incremental syncs are not intended for read-after-write use cases. See example usage at [List the user’s contacts that have changed](https://developers.google.com/people/v1/contacts#list_the_users_contacts_that_have_changed).
5849///
5850/// A builder for the *connections.list* method supported by a *person* resource.
5851/// It is not used directly, but through a [`PersonMethods`] instance.
5852///
5853/// # Example
5854///
5855/// Instantiate a resource method builder
5856///
5857/// ```test_harness,no_run
5858/// # extern crate hyper;
5859/// # extern crate hyper_rustls;
5860/// # extern crate google_people1 as people1;
5861/// # async fn dox() {
5862/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5863///
5864/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5865/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5866/// # .with_native_roots()
5867/// # .unwrap()
5868/// # .https_only()
5869/// # .enable_http2()
5870/// # .build();
5871///
5872/// # let executor = hyper_util::rt::TokioExecutor::new();
5873/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5874/// # secret,
5875/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5876/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5877/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5878/// # ),
5879/// # ).build().await.unwrap();
5880///
5881/// # let client = hyper_util::client::legacy::Client::builder(
5882/// # hyper_util::rt::TokioExecutor::new()
5883/// # )
5884/// # .build(
5885/// # hyper_rustls::HttpsConnectorBuilder::new()
5886/// # .with_native_roots()
5887/// # .unwrap()
5888/// # .https_or_http()
5889/// # .enable_http2()
5890/// # .build()
5891/// # );
5892/// # let mut hub = PeopleService::new(client, auth);
5893/// // You can configure optional parameters by calling the respective setters at will, and
5894/// // execute the final call using `doit()`.
5895/// // Values shown here are possibly random and not representative !
5896/// let result = hub.people().connections_list("resourceName")
5897/// .sync_token("ipsum")
5898/// .add_sources("ipsum")
5899/// .sort_order("est")
5900/// .request_sync_token(true)
5901/// .request_mask_include_field(FieldMask::new::<&str>(&[]))
5902/// .person_fields(FieldMask::new::<&str>(&[]))
5903/// .page_token("ea")
5904/// .page_size(-99)
5905/// .doit().await;
5906/// # }
5907/// ```
5908pub struct PersonConnectionListCall<'a, C>
5909where
5910 C: 'a,
5911{
5912 hub: &'a PeopleService<C>,
5913 _resource_name: String,
5914 _sync_token: Option<String>,
5915 _sources: Vec<String>,
5916 _sort_order: Option<String>,
5917 _request_sync_token: Option<bool>,
5918 _request_mask_include_field: Option<common::FieldMask>,
5919 _person_fields: Option<common::FieldMask>,
5920 _page_token: Option<String>,
5921 _page_size: Option<i32>,
5922 _delegate: Option<&'a mut dyn common::Delegate>,
5923 _additional_params: HashMap<String, String>,
5924 _scopes: BTreeSet<String>,
5925}
5926
5927impl<'a, C> common::CallBuilder for PersonConnectionListCall<'a, C> {}
5928
5929impl<'a, C> PersonConnectionListCall<'a, C>
5930where
5931 C: common::Connector,
5932{
5933 /// Perform the operation you have build so far.
5934 pub async fn doit(mut self) -> common::Result<(common::Response, ListConnectionsResponse)> {
5935 use std::borrow::Cow;
5936 use std::io::{Read, Seek};
5937
5938 use common::{url::Params, ToParts};
5939 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5940
5941 let mut dd = common::DefaultDelegate;
5942 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5943 dlg.begin(common::MethodInfo {
5944 id: "people.people.connections.list",
5945 http_method: hyper::Method::GET,
5946 });
5947
5948 for &field in [
5949 "alt",
5950 "resourceName",
5951 "syncToken",
5952 "sources",
5953 "sortOrder",
5954 "requestSyncToken",
5955 "requestMask.includeField",
5956 "personFields",
5957 "pageToken",
5958 "pageSize",
5959 ]
5960 .iter()
5961 {
5962 if self._additional_params.contains_key(field) {
5963 dlg.finished(false);
5964 return Err(common::Error::FieldClash(field));
5965 }
5966 }
5967
5968 let mut params = Params::with_capacity(11 + self._additional_params.len());
5969 params.push("resourceName", self._resource_name);
5970 if let Some(value) = self._sync_token.as_ref() {
5971 params.push("syncToken", value);
5972 }
5973 if !self._sources.is_empty() {
5974 for f in self._sources.iter() {
5975 params.push("sources", f);
5976 }
5977 }
5978 if let Some(value) = self._sort_order.as_ref() {
5979 params.push("sortOrder", value);
5980 }
5981 if let Some(value) = self._request_sync_token.as_ref() {
5982 params.push("requestSyncToken", value.to_string());
5983 }
5984 if let Some(value) = self._request_mask_include_field.as_ref() {
5985 params.push("requestMask.includeField", value.to_string());
5986 }
5987 if let Some(value) = self._person_fields.as_ref() {
5988 params.push("personFields", value.to_string());
5989 }
5990 if let Some(value) = self._page_token.as_ref() {
5991 params.push("pageToken", value);
5992 }
5993 if let Some(value) = self._page_size.as_ref() {
5994 params.push("pageSize", value.to_string());
5995 }
5996
5997 params.extend(self._additional_params.iter());
5998
5999 params.push("alt", "json");
6000 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}/connections";
6001 if self._scopes.is_empty() {
6002 self._scopes
6003 .insert(Scope::ContactReadonly.as_ref().to_string());
6004 }
6005
6006 #[allow(clippy::single_element_loop)]
6007 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
6008 url = params.uri_replacement(url, param_name, find_this, true);
6009 }
6010 {
6011 let to_remove = ["resourceName"];
6012 params.remove_params(&to_remove);
6013 }
6014
6015 let url = params.parse_with_url(&url);
6016
6017 loop {
6018 let token = match self
6019 .hub
6020 .auth
6021 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6022 .await
6023 {
6024 Ok(token) => token,
6025 Err(e) => match dlg.token(e) {
6026 Ok(token) => token,
6027 Err(e) => {
6028 dlg.finished(false);
6029 return Err(common::Error::MissingToken(e));
6030 }
6031 },
6032 };
6033 let mut req_result = {
6034 let client = &self.hub.client;
6035 dlg.pre_request();
6036 let mut req_builder = hyper::Request::builder()
6037 .method(hyper::Method::GET)
6038 .uri(url.as_str())
6039 .header(USER_AGENT, self.hub._user_agent.clone());
6040
6041 if let Some(token) = token.as_ref() {
6042 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6043 }
6044
6045 let request = req_builder
6046 .header(CONTENT_LENGTH, 0_u64)
6047 .body(common::to_body::<String>(None));
6048
6049 client.request(request.unwrap()).await
6050 };
6051
6052 match req_result {
6053 Err(err) => {
6054 if let common::Retry::After(d) = dlg.http_error(&err) {
6055 sleep(d).await;
6056 continue;
6057 }
6058 dlg.finished(false);
6059 return Err(common::Error::HttpError(err));
6060 }
6061 Ok(res) => {
6062 let (mut parts, body) = res.into_parts();
6063 let mut body = common::Body::new(body);
6064 if !parts.status.is_success() {
6065 let bytes = common::to_bytes(body).await.unwrap_or_default();
6066 let error = serde_json::from_str(&common::to_string(&bytes));
6067 let response = common::to_response(parts, bytes.into());
6068
6069 if let common::Retry::After(d) =
6070 dlg.http_failure(&response, error.as_ref().ok())
6071 {
6072 sleep(d).await;
6073 continue;
6074 }
6075
6076 dlg.finished(false);
6077
6078 return Err(match error {
6079 Ok(value) => common::Error::BadRequest(value),
6080 _ => common::Error::Failure(response),
6081 });
6082 }
6083 let response = {
6084 let bytes = common::to_bytes(body).await.unwrap_or_default();
6085 let encoded = common::to_string(&bytes);
6086 match serde_json::from_str(&encoded) {
6087 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6088 Err(error) => {
6089 dlg.response_json_decode_error(&encoded, &error);
6090 return Err(common::Error::JsonDecodeError(
6091 encoded.to_string(),
6092 error,
6093 ));
6094 }
6095 }
6096 };
6097
6098 dlg.finished(true);
6099 return Ok(response);
6100 }
6101 }
6102 }
6103 }
6104
6105 /// Required. The resource name to return connections for. Only `people/me` is valid.
6106 ///
6107 /// Sets the *resource name* path property to the given value.
6108 ///
6109 /// Even though the property as already been set when instantiating this call,
6110 /// we provide this method for API completeness.
6111 pub fn resource_name(mut self, new_value: &str) -> PersonConnectionListCall<'a, C> {
6112 self._resource_name = new_value.to_string();
6113 self
6114 }
6115 /// Optional. A sync token, received from a previous response `next_sync_token` Provide this to retrieve only the resources changed since the last request. When syncing, all other parameters provided to `people.connections.list` must match the first call that provided the sync token. More details about sync behavior at `people.connections.list`.
6116 ///
6117 /// Sets the *sync token* query property to the given value.
6118 pub fn sync_token(mut self, new_value: &str) -> PersonConnectionListCall<'a, C> {
6119 self._sync_token = Some(new_value.to_string());
6120 self
6121 }
6122 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
6123 ///
6124 /// Append the given value to the *sources* query property.
6125 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6126 pub fn add_sources(mut self, new_value: &str) -> PersonConnectionListCall<'a, C> {
6127 self._sources.push(new_value.to_string());
6128 self
6129 }
6130 /// Optional. The order in which the connections should be sorted. Defaults to `LAST_MODIFIED_ASCENDING`.
6131 ///
6132 /// Sets the *sort order* query property to the given value.
6133 pub fn sort_order(mut self, new_value: &str) -> PersonConnectionListCall<'a, C> {
6134 self._sort_order = Some(new_value.to_string());
6135 self
6136 }
6137 /// Optional. Whether the response should return `next_sync_token` on the last page of results. It can be used to get incremental changes since the last request by setting it on the request `sync_token`. More details about sync behavior at `people.connections.list`.
6138 ///
6139 /// Sets the *request sync token* query property to the given value.
6140 pub fn request_sync_token(mut self, new_value: bool) -> PersonConnectionListCall<'a, C> {
6141 self._request_sync_token = Some(new_value);
6142 self
6143 }
6144 /// Required. Comma-separated list of person fields to be included in the response. Each path should start with `person.`: for example, `person.names` or `person.photos`.
6145 ///
6146 /// Sets the *request mask.include field* query property to the given value.
6147 pub fn request_mask_include_field(
6148 mut self,
6149 new_value: common::FieldMask,
6150 ) -> PersonConnectionListCall<'a, C> {
6151 self._request_mask_include_field = Some(new_value);
6152 self
6153 }
6154 /// Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
6155 ///
6156 /// Sets the *person fields* query property to the given value.
6157 pub fn person_fields(
6158 mut self,
6159 new_value: common::FieldMask,
6160 ) -> PersonConnectionListCall<'a, C> {
6161 self._person_fields = Some(new_value);
6162 self
6163 }
6164 /// Optional. A page token, received from a previous response `next_page_token`. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `people.connections.list` must match the first call that provided the page token.
6165 ///
6166 /// Sets the *page token* query property to the given value.
6167 pub fn page_token(mut self, new_value: &str) -> PersonConnectionListCall<'a, C> {
6168 self._page_token = Some(new_value.to_string());
6169 self
6170 }
6171 /// Optional. The number of connections to include in the response. Valid values are between 1 and 1000, inclusive. Defaults to 100 if not set or set to 0.
6172 ///
6173 /// Sets the *page size* query property to the given value.
6174 pub fn page_size(mut self, new_value: i32) -> PersonConnectionListCall<'a, C> {
6175 self._page_size = Some(new_value);
6176 self
6177 }
6178 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6179 /// while executing the actual API request.
6180 ///
6181 /// ````text
6182 /// It should be used to handle progress information, and to implement a certain level of resilience.
6183 /// ````
6184 ///
6185 /// Sets the *delegate* property to the given value.
6186 pub fn delegate(
6187 mut self,
6188 new_value: &'a mut dyn common::Delegate,
6189 ) -> PersonConnectionListCall<'a, C> {
6190 self._delegate = Some(new_value);
6191 self
6192 }
6193
6194 /// Set any additional parameter of the query string used in the request.
6195 /// It should be used to set parameters which are not yet available through their own
6196 /// setters.
6197 ///
6198 /// Please note that this method must not be used to set any of the known parameters
6199 /// which have their own setter method. If done anyway, the request will fail.
6200 ///
6201 /// # Additional Parameters
6202 ///
6203 /// * *$.xgafv* (query-string) - V1 error format.
6204 /// * *access_token* (query-string) - OAuth access token.
6205 /// * *alt* (query-string) - Data format for response.
6206 /// * *callback* (query-string) - JSONP
6207 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6208 /// * *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.
6209 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6210 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6211 /// * *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.
6212 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6213 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6214 pub fn param<T>(mut self, name: T, value: T) -> PersonConnectionListCall<'a, C>
6215 where
6216 T: AsRef<str>,
6217 {
6218 self._additional_params
6219 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6220 self
6221 }
6222
6223 /// Identifies the authorization scope for the method you are building.
6224 ///
6225 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6226 /// [`Scope::ContactReadonly`].
6227 ///
6228 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6229 /// tokens for more than one scope.
6230 ///
6231 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6232 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6233 /// sufficient, a read-write scope will do as well.
6234 pub fn add_scope<St>(mut self, scope: St) -> PersonConnectionListCall<'a, C>
6235 where
6236 St: AsRef<str>,
6237 {
6238 self._scopes.insert(String::from(scope.as_ref()));
6239 self
6240 }
6241 /// Identifies the authorization scope(s) for the method you are building.
6242 ///
6243 /// See [`Self::add_scope()`] for details.
6244 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonConnectionListCall<'a, C>
6245 where
6246 I: IntoIterator<Item = St>,
6247 St: AsRef<str>,
6248 {
6249 self._scopes
6250 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6251 self
6252 }
6253
6254 /// Removes all scopes, and no default scope will be used either.
6255 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6256 /// for details).
6257 pub fn clear_scopes(mut self) -> PersonConnectionListCall<'a, C> {
6258 self._scopes.clear();
6259 self
6260 }
6261}
6262
6263/// Create a batch of new contacts and return the PersonResponses for the newly Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
6264///
6265/// A builder for the *batchCreateContacts* method supported by a *person* resource.
6266/// It is not used directly, but through a [`PersonMethods`] instance.
6267///
6268/// # Example
6269///
6270/// Instantiate a resource method builder
6271///
6272/// ```test_harness,no_run
6273/// # extern crate hyper;
6274/// # extern crate hyper_rustls;
6275/// # extern crate google_people1 as people1;
6276/// use people1::api::BatchCreateContactsRequest;
6277/// # async fn dox() {
6278/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6279///
6280/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6281/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6282/// # .with_native_roots()
6283/// # .unwrap()
6284/// # .https_only()
6285/// # .enable_http2()
6286/// # .build();
6287///
6288/// # let executor = hyper_util::rt::TokioExecutor::new();
6289/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6290/// # secret,
6291/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6292/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6293/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6294/// # ),
6295/// # ).build().await.unwrap();
6296///
6297/// # let client = hyper_util::client::legacy::Client::builder(
6298/// # hyper_util::rt::TokioExecutor::new()
6299/// # )
6300/// # .build(
6301/// # hyper_rustls::HttpsConnectorBuilder::new()
6302/// # .with_native_roots()
6303/// # .unwrap()
6304/// # .https_or_http()
6305/// # .enable_http2()
6306/// # .build()
6307/// # );
6308/// # let mut hub = PeopleService::new(client, auth);
6309/// // As the method needs a request, you would usually fill it with the desired information
6310/// // into the respective structure. Some of the parts shown here might not be applicable !
6311/// // Values shown here are possibly random and not representative !
6312/// let mut req = BatchCreateContactsRequest::default();
6313///
6314/// // You can configure optional parameters by calling the respective setters at will, and
6315/// // execute the final call using `doit()`.
6316/// // Values shown here are possibly random and not representative !
6317/// let result = hub.people().batch_create_contacts(req)
6318/// .doit().await;
6319/// # }
6320/// ```
6321pub struct PersonBatchCreateContactCall<'a, C>
6322where
6323 C: 'a,
6324{
6325 hub: &'a PeopleService<C>,
6326 _request: BatchCreateContactsRequest,
6327 _delegate: Option<&'a mut dyn common::Delegate>,
6328 _additional_params: HashMap<String, String>,
6329 _scopes: BTreeSet<String>,
6330}
6331
6332impl<'a, C> common::CallBuilder for PersonBatchCreateContactCall<'a, C> {}
6333
6334impl<'a, C> PersonBatchCreateContactCall<'a, C>
6335where
6336 C: common::Connector,
6337{
6338 /// Perform the operation you have build so far.
6339 pub async fn doit(mut self) -> common::Result<(common::Response, BatchCreateContactsResponse)> {
6340 use std::borrow::Cow;
6341 use std::io::{Read, Seek};
6342
6343 use common::{url::Params, ToParts};
6344 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6345
6346 let mut dd = common::DefaultDelegate;
6347 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6348 dlg.begin(common::MethodInfo {
6349 id: "people.people.batchCreateContacts",
6350 http_method: hyper::Method::POST,
6351 });
6352
6353 for &field in ["alt"].iter() {
6354 if self._additional_params.contains_key(field) {
6355 dlg.finished(false);
6356 return Err(common::Error::FieldClash(field));
6357 }
6358 }
6359
6360 let mut params = Params::with_capacity(3 + self._additional_params.len());
6361
6362 params.extend(self._additional_params.iter());
6363
6364 params.push("alt", "json");
6365 let mut url = self.hub._base_url.clone() + "v1/people:batchCreateContacts";
6366 if self._scopes.is_empty() {
6367 self._scopes.insert(Scope::Contact.as_ref().to_string());
6368 }
6369
6370 let url = params.parse_with_url(&url);
6371
6372 let mut json_mime_type = mime::APPLICATION_JSON;
6373 let mut request_value_reader = {
6374 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6375 common::remove_json_null_values(&mut value);
6376 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6377 serde_json::to_writer(&mut dst, &value).unwrap();
6378 dst
6379 };
6380 let request_size = request_value_reader
6381 .seek(std::io::SeekFrom::End(0))
6382 .unwrap();
6383 request_value_reader
6384 .seek(std::io::SeekFrom::Start(0))
6385 .unwrap();
6386
6387 loop {
6388 let token = match self
6389 .hub
6390 .auth
6391 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6392 .await
6393 {
6394 Ok(token) => token,
6395 Err(e) => match dlg.token(e) {
6396 Ok(token) => token,
6397 Err(e) => {
6398 dlg.finished(false);
6399 return Err(common::Error::MissingToken(e));
6400 }
6401 },
6402 };
6403 request_value_reader
6404 .seek(std::io::SeekFrom::Start(0))
6405 .unwrap();
6406 let mut req_result = {
6407 let client = &self.hub.client;
6408 dlg.pre_request();
6409 let mut req_builder = hyper::Request::builder()
6410 .method(hyper::Method::POST)
6411 .uri(url.as_str())
6412 .header(USER_AGENT, self.hub._user_agent.clone());
6413
6414 if let Some(token) = token.as_ref() {
6415 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6416 }
6417
6418 let request = req_builder
6419 .header(CONTENT_TYPE, json_mime_type.to_string())
6420 .header(CONTENT_LENGTH, request_size as u64)
6421 .body(common::to_body(
6422 request_value_reader.get_ref().clone().into(),
6423 ));
6424
6425 client.request(request.unwrap()).await
6426 };
6427
6428 match req_result {
6429 Err(err) => {
6430 if let common::Retry::After(d) = dlg.http_error(&err) {
6431 sleep(d).await;
6432 continue;
6433 }
6434 dlg.finished(false);
6435 return Err(common::Error::HttpError(err));
6436 }
6437 Ok(res) => {
6438 let (mut parts, body) = res.into_parts();
6439 let mut body = common::Body::new(body);
6440 if !parts.status.is_success() {
6441 let bytes = common::to_bytes(body).await.unwrap_or_default();
6442 let error = serde_json::from_str(&common::to_string(&bytes));
6443 let response = common::to_response(parts, bytes.into());
6444
6445 if let common::Retry::After(d) =
6446 dlg.http_failure(&response, error.as_ref().ok())
6447 {
6448 sleep(d).await;
6449 continue;
6450 }
6451
6452 dlg.finished(false);
6453
6454 return Err(match error {
6455 Ok(value) => common::Error::BadRequest(value),
6456 _ => common::Error::Failure(response),
6457 });
6458 }
6459 let response = {
6460 let bytes = common::to_bytes(body).await.unwrap_or_default();
6461 let encoded = common::to_string(&bytes);
6462 match serde_json::from_str(&encoded) {
6463 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6464 Err(error) => {
6465 dlg.response_json_decode_error(&encoded, &error);
6466 return Err(common::Error::JsonDecodeError(
6467 encoded.to_string(),
6468 error,
6469 ));
6470 }
6471 }
6472 };
6473
6474 dlg.finished(true);
6475 return Ok(response);
6476 }
6477 }
6478 }
6479 }
6480
6481 ///
6482 /// Sets the *request* property to the given value.
6483 ///
6484 /// Even though the property as already been set when instantiating this call,
6485 /// we provide this method for API completeness.
6486 pub fn request(
6487 mut self,
6488 new_value: BatchCreateContactsRequest,
6489 ) -> PersonBatchCreateContactCall<'a, C> {
6490 self._request = new_value;
6491 self
6492 }
6493 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6494 /// while executing the actual API request.
6495 ///
6496 /// ````text
6497 /// It should be used to handle progress information, and to implement a certain level of resilience.
6498 /// ````
6499 ///
6500 /// Sets the *delegate* property to the given value.
6501 pub fn delegate(
6502 mut self,
6503 new_value: &'a mut dyn common::Delegate,
6504 ) -> PersonBatchCreateContactCall<'a, C> {
6505 self._delegate = Some(new_value);
6506 self
6507 }
6508
6509 /// Set any additional parameter of the query string used in the request.
6510 /// It should be used to set parameters which are not yet available through their own
6511 /// setters.
6512 ///
6513 /// Please note that this method must not be used to set any of the known parameters
6514 /// which have their own setter method. If done anyway, the request will fail.
6515 ///
6516 /// # Additional Parameters
6517 ///
6518 /// * *$.xgafv* (query-string) - V1 error format.
6519 /// * *access_token* (query-string) - OAuth access token.
6520 /// * *alt* (query-string) - Data format for response.
6521 /// * *callback* (query-string) - JSONP
6522 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6523 /// * *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.
6524 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6525 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6526 /// * *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.
6527 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6528 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6529 pub fn param<T>(mut self, name: T, value: T) -> PersonBatchCreateContactCall<'a, C>
6530 where
6531 T: AsRef<str>,
6532 {
6533 self._additional_params
6534 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6535 self
6536 }
6537
6538 /// Identifies the authorization scope for the method you are building.
6539 ///
6540 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6541 /// [`Scope::Contact`].
6542 ///
6543 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6544 /// tokens for more than one scope.
6545 ///
6546 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6547 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6548 /// sufficient, a read-write scope will do as well.
6549 pub fn add_scope<St>(mut self, scope: St) -> PersonBatchCreateContactCall<'a, C>
6550 where
6551 St: AsRef<str>,
6552 {
6553 self._scopes.insert(String::from(scope.as_ref()));
6554 self
6555 }
6556 /// Identifies the authorization scope(s) for the method you are building.
6557 ///
6558 /// See [`Self::add_scope()`] for details.
6559 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonBatchCreateContactCall<'a, C>
6560 where
6561 I: IntoIterator<Item = St>,
6562 St: AsRef<str>,
6563 {
6564 self._scopes
6565 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6566 self
6567 }
6568
6569 /// Removes all scopes, and no default scope will be used either.
6570 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6571 /// for details).
6572 pub fn clear_scopes(mut self) -> PersonBatchCreateContactCall<'a, C> {
6573 self._scopes.clear();
6574 self
6575 }
6576}
6577
6578/// Delete a batch of contacts. Any non-contact data will not be deleted. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
6579///
6580/// A builder for the *batchDeleteContacts* method supported by a *person* resource.
6581/// It is not used directly, but through a [`PersonMethods`] instance.
6582///
6583/// # Example
6584///
6585/// Instantiate a resource method builder
6586///
6587/// ```test_harness,no_run
6588/// # extern crate hyper;
6589/// # extern crate hyper_rustls;
6590/// # extern crate google_people1 as people1;
6591/// use people1::api::BatchDeleteContactsRequest;
6592/// # async fn dox() {
6593/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6594///
6595/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6596/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6597/// # .with_native_roots()
6598/// # .unwrap()
6599/// # .https_only()
6600/// # .enable_http2()
6601/// # .build();
6602///
6603/// # let executor = hyper_util::rt::TokioExecutor::new();
6604/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6605/// # secret,
6606/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6607/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6608/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6609/// # ),
6610/// # ).build().await.unwrap();
6611///
6612/// # let client = hyper_util::client::legacy::Client::builder(
6613/// # hyper_util::rt::TokioExecutor::new()
6614/// # )
6615/// # .build(
6616/// # hyper_rustls::HttpsConnectorBuilder::new()
6617/// # .with_native_roots()
6618/// # .unwrap()
6619/// # .https_or_http()
6620/// # .enable_http2()
6621/// # .build()
6622/// # );
6623/// # let mut hub = PeopleService::new(client, auth);
6624/// // As the method needs a request, you would usually fill it with the desired information
6625/// // into the respective structure. Some of the parts shown here might not be applicable !
6626/// // Values shown here are possibly random and not representative !
6627/// let mut req = BatchDeleteContactsRequest::default();
6628///
6629/// // You can configure optional parameters by calling the respective setters at will, and
6630/// // execute the final call using `doit()`.
6631/// // Values shown here are possibly random and not representative !
6632/// let result = hub.people().batch_delete_contacts(req)
6633/// .doit().await;
6634/// # }
6635/// ```
6636pub struct PersonBatchDeleteContactCall<'a, C>
6637where
6638 C: 'a,
6639{
6640 hub: &'a PeopleService<C>,
6641 _request: BatchDeleteContactsRequest,
6642 _delegate: Option<&'a mut dyn common::Delegate>,
6643 _additional_params: HashMap<String, String>,
6644 _scopes: BTreeSet<String>,
6645}
6646
6647impl<'a, C> common::CallBuilder for PersonBatchDeleteContactCall<'a, C> {}
6648
6649impl<'a, C> PersonBatchDeleteContactCall<'a, C>
6650where
6651 C: common::Connector,
6652{
6653 /// Perform the operation you have build so far.
6654 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6655 use std::borrow::Cow;
6656 use std::io::{Read, Seek};
6657
6658 use common::{url::Params, ToParts};
6659 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6660
6661 let mut dd = common::DefaultDelegate;
6662 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6663 dlg.begin(common::MethodInfo {
6664 id: "people.people.batchDeleteContacts",
6665 http_method: hyper::Method::POST,
6666 });
6667
6668 for &field in ["alt"].iter() {
6669 if self._additional_params.contains_key(field) {
6670 dlg.finished(false);
6671 return Err(common::Error::FieldClash(field));
6672 }
6673 }
6674
6675 let mut params = Params::with_capacity(3 + self._additional_params.len());
6676
6677 params.extend(self._additional_params.iter());
6678
6679 params.push("alt", "json");
6680 let mut url = self.hub._base_url.clone() + "v1/people:batchDeleteContacts";
6681 if self._scopes.is_empty() {
6682 self._scopes.insert(Scope::Contact.as_ref().to_string());
6683 }
6684
6685 let url = params.parse_with_url(&url);
6686
6687 let mut json_mime_type = mime::APPLICATION_JSON;
6688 let mut request_value_reader = {
6689 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6690 common::remove_json_null_values(&mut value);
6691 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6692 serde_json::to_writer(&mut dst, &value).unwrap();
6693 dst
6694 };
6695 let request_size = request_value_reader
6696 .seek(std::io::SeekFrom::End(0))
6697 .unwrap();
6698 request_value_reader
6699 .seek(std::io::SeekFrom::Start(0))
6700 .unwrap();
6701
6702 loop {
6703 let token = match self
6704 .hub
6705 .auth
6706 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6707 .await
6708 {
6709 Ok(token) => token,
6710 Err(e) => match dlg.token(e) {
6711 Ok(token) => token,
6712 Err(e) => {
6713 dlg.finished(false);
6714 return Err(common::Error::MissingToken(e));
6715 }
6716 },
6717 };
6718 request_value_reader
6719 .seek(std::io::SeekFrom::Start(0))
6720 .unwrap();
6721 let mut req_result = {
6722 let client = &self.hub.client;
6723 dlg.pre_request();
6724 let mut req_builder = hyper::Request::builder()
6725 .method(hyper::Method::POST)
6726 .uri(url.as_str())
6727 .header(USER_AGENT, self.hub._user_agent.clone());
6728
6729 if let Some(token) = token.as_ref() {
6730 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6731 }
6732
6733 let request = req_builder
6734 .header(CONTENT_TYPE, json_mime_type.to_string())
6735 .header(CONTENT_LENGTH, request_size as u64)
6736 .body(common::to_body(
6737 request_value_reader.get_ref().clone().into(),
6738 ));
6739
6740 client.request(request.unwrap()).await
6741 };
6742
6743 match req_result {
6744 Err(err) => {
6745 if let common::Retry::After(d) = dlg.http_error(&err) {
6746 sleep(d).await;
6747 continue;
6748 }
6749 dlg.finished(false);
6750 return Err(common::Error::HttpError(err));
6751 }
6752 Ok(res) => {
6753 let (mut parts, body) = res.into_parts();
6754 let mut body = common::Body::new(body);
6755 if !parts.status.is_success() {
6756 let bytes = common::to_bytes(body).await.unwrap_or_default();
6757 let error = serde_json::from_str(&common::to_string(&bytes));
6758 let response = common::to_response(parts, bytes.into());
6759
6760 if let common::Retry::After(d) =
6761 dlg.http_failure(&response, error.as_ref().ok())
6762 {
6763 sleep(d).await;
6764 continue;
6765 }
6766
6767 dlg.finished(false);
6768
6769 return Err(match error {
6770 Ok(value) => common::Error::BadRequest(value),
6771 _ => common::Error::Failure(response),
6772 });
6773 }
6774 let response = {
6775 let bytes = common::to_bytes(body).await.unwrap_or_default();
6776 let encoded = common::to_string(&bytes);
6777 match serde_json::from_str(&encoded) {
6778 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6779 Err(error) => {
6780 dlg.response_json_decode_error(&encoded, &error);
6781 return Err(common::Error::JsonDecodeError(
6782 encoded.to_string(),
6783 error,
6784 ));
6785 }
6786 }
6787 };
6788
6789 dlg.finished(true);
6790 return Ok(response);
6791 }
6792 }
6793 }
6794 }
6795
6796 ///
6797 /// Sets the *request* property to the given value.
6798 ///
6799 /// Even though the property as already been set when instantiating this call,
6800 /// we provide this method for API completeness.
6801 pub fn request(
6802 mut self,
6803 new_value: BatchDeleteContactsRequest,
6804 ) -> PersonBatchDeleteContactCall<'a, C> {
6805 self._request = new_value;
6806 self
6807 }
6808 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6809 /// while executing the actual API request.
6810 ///
6811 /// ````text
6812 /// It should be used to handle progress information, and to implement a certain level of resilience.
6813 /// ````
6814 ///
6815 /// Sets the *delegate* property to the given value.
6816 pub fn delegate(
6817 mut self,
6818 new_value: &'a mut dyn common::Delegate,
6819 ) -> PersonBatchDeleteContactCall<'a, C> {
6820 self._delegate = Some(new_value);
6821 self
6822 }
6823
6824 /// Set any additional parameter of the query string used in the request.
6825 /// It should be used to set parameters which are not yet available through their own
6826 /// setters.
6827 ///
6828 /// Please note that this method must not be used to set any of the known parameters
6829 /// which have their own setter method. If done anyway, the request will fail.
6830 ///
6831 /// # Additional Parameters
6832 ///
6833 /// * *$.xgafv* (query-string) - V1 error format.
6834 /// * *access_token* (query-string) - OAuth access token.
6835 /// * *alt* (query-string) - Data format for response.
6836 /// * *callback* (query-string) - JSONP
6837 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6838 /// * *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.
6839 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6840 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6841 /// * *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.
6842 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6843 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6844 pub fn param<T>(mut self, name: T, value: T) -> PersonBatchDeleteContactCall<'a, C>
6845 where
6846 T: AsRef<str>,
6847 {
6848 self._additional_params
6849 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6850 self
6851 }
6852
6853 /// Identifies the authorization scope for the method you are building.
6854 ///
6855 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6856 /// [`Scope::Contact`].
6857 ///
6858 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6859 /// tokens for more than one scope.
6860 ///
6861 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6862 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6863 /// sufficient, a read-write scope will do as well.
6864 pub fn add_scope<St>(mut self, scope: St) -> PersonBatchDeleteContactCall<'a, C>
6865 where
6866 St: AsRef<str>,
6867 {
6868 self._scopes.insert(String::from(scope.as_ref()));
6869 self
6870 }
6871 /// Identifies the authorization scope(s) for the method you are building.
6872 ///
6873 /// See [`Self::add_scope()`] for details.
6874 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonBatchDeleteContactCall<'a, C>
6875 where
6876 I: IntoIterator<Item = St>,
6877 St: AsRef<str>,
6878 {
6879 self._scopes
6880 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6881 self
6882 }
6883
6884 /// Removes all scopes, and no default scope will be used either.
6885 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6886 /// for details).
6887 pub fn clear_scopes(mut self) -> PersonBatchDeleteContactCall<'a, C> {
6888 self._scopes.clear();
6889 self
6890 }
6891}
6892
6893/// Update a batch of contacts and return a map of resource names to PersonResponses for the updated contacts. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
6894///
6895/// A builder for the *batchUpdateContacts* method supported by a *person* resource.
6896/// It is not used directly, but through a [`PersonMethods`] instance.
6897///
6898/// # Example
6899///
6900/// Instantiate a resource method builder
6901///
6902/// ```test_harness,no_run
6903/// # extern crate hyper;
6904/// # extern crate hyper_rustls;
6905/// # extern crate google_people1 as people1;
6906/// use people1::api::BatchUpdateContactsRequest;
6907/// # async fn dox() {
6908/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6909///
6910/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6911/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6912/// # .with_native_roots()
6913/// # .unwrap()
6914/// # .https_only()
6915/// # .enable_http2()
6916/// # .build();
6917///
6918/// # let executor = hyper_util::rt::TokioExecutor::new();
6919/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6920/// # secret,
6921/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6922/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6923/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6924/// # ),
6925/// # ).build().await.unwrap();
6926///
6927/// # let client = hyper_util::client::legacy::Client::builder(
6928/// # hyper_util::rt::TokioExecutor::new()
6929/// # )
6930/// # .build(
6931/// # hyper_rustls::HttpsConnectorBuilder::new()
6932/// # .with_native_roots()
6933/// # .unwrap()
6934/// # .https_or_http()
6935/// # .enable_http2()
6936/// # .build()
6937/// # );
6938/// # let mut hub = PeopleService::new(client, auth);
6939/// // As the method needs a request, you would usually fill it with the desired information
6940/// // into the respective structure. Some of the parts shown here might not be applicable !
6941/// // Values shown here are possibly random and not representative !
6942/// let mut req = BatchUpdateContactsRequest::default();
6943///
6944/// // You can configure optional parameters by calling the respective setters at will, and
6945/// // execute the final call using `doit()`.
6946/// // Values shown here are possibly random and not representative !
6947/// let result = hub.people().batch_update_contacts(req)
6948/// .doit().await;
6949/// # }
6950/// ```
6951pub struct PersonBatchUpdateContactCall<'a, C>
6952where
6953 C: 'a,
6954{
6955 hub: &'a PeopleService<C>,
6956 _request: BatchUpdateContactsRequest,
6957 _delegate: Option<&'a mut dyn common::Delegate>,
6958 _additional_params: HashMap<String, String>,
6959 _scopes: BTreeSet<String>,
6960}
6961
6962impl<'a, C> common::CallBuilder for PersonBatchUpdateContactCall<'a, C> {}
6963
6964impl<'a, C> PersonBatchUpdateContactCall<'a, C>
6965where
6966 C: common::Connector,
6967{
6968 /// Perform the operation you have build so far.
6969 pub async fn doit(mut self) -> common::Result<(common::Response, BatchUpdateContactsResponse)> {
6970 use std::borrow::Cow;
6971 use std::io::{Read, Seek};
6972
6973 use common::{url::Params, ToParts};
6974 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6975
6976 let mut dd = common::DefaultDelegate;
6977 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6978 dlg.begin(common::MethodInfo {
6979 id: "people.people.batchUpdateContacts",
6980 http_method: hyper::Method::POST,
6981 });
6982
6983 for &field in ["alt"].iter() {
6984 if self._additional_params.contains_key(field) {
6985 dlg.finished(false);
6986 return Err(common::Error::FieldClash(field));
6987 }
6988 }
6989
6990 let mut params = Params::with_capacity(3 + self._additional_params.len());
6991
6992 params.extend(self._additional_params.iter());
6993
6994 params.push("alt", "json");
6995 let mut url = self.hub._base_url.clone() + "v1/people:batchUpdateContacts";
6996 if self._scopes.is_empty() {
6997 self._scopes.insert(Scope::Contact.as_ref().to_string());
6998 }
6999
7000 let url = params.parse_with_url(&url);
7001
7002 let mut json_mime_type = mime::APPLICATION_JSON;
7003 let mut request_value_reader = {
7004 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7005 common::remove_json_null_values(&mut value);
7006 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7007 serde_json::to_writer(&mut dst, &value).unwrap();
7008 dst
7009 };
7010 let request_size = request_value_reader
7011 .seek(std::io::SeekFrom::End(0))
7012 .unwrap();
7013 request_value_reader
7014 .seek(std::io::SeekFrom::Start(0))
7015 .unwrap();
7016
7017 loop {
7018 let token = match self
7019 .hub
7020 .auth
7021 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7022 .await
7023 {
7024 Ok(token) => token,
7025 Err(e) => match dlg.token(e) {
7026 Ok(token) => token,
7027 Err(e) => {
7028 dlg.finished(false);
7029 return Err(common::Error::MissingToken(e));
7030 }
7031 },
7032 };
7033 request_value_reader
7034 .seek(std::io::SeekFrom::Start(0))
7035 .unwrap();
7036 let mut req_result = {
7037 let client = &self.hub.client;
7038 dlg.pre_request();
7039 let mut req_builder = hyper::Request::builder()
7040 .method(hyper::Method::POST)
7041 .uri(url.as_str())
7042 .header(USER_AGENT, self.hub._user_agent.clone());
7043
7044 if let Some(token) = token.as_ref() {
7045 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7046 }
7047
7048 let request = req_builder
7049 .header(CONTENT_TYPE, json_mime_type.to_string())
7050 .header(CONTENT_LENGTH, request_size as u64)
7051 .body(common::to_body(
7052 request_value_reader.get_ref().clone().into(),
7053 ));
7054
7055 client.request(request.unwrap()).await
7056 };
7057
7058 match req_result {
7059 Err(err) => {
7060 if let common::Retry::After(d) = dlg.http_error(&err) {
7061 sleep(d).await;
7062 continue;
7063 }
7064 dlg.finished(false);
7065 return Err(common::Error::HttpError(err));
7066 }
7067 Ok(res) => {
7068 let (mut parts, body) = res.into_parts();
7069 let mut body = common::Body::new(body);
7070 if !parts.status.is_success() {
7071 let bytes = common::to_bytes(body).await.unwrap_or_default();
7072 let error = serde_json::from_str(&common::to_string(&bytes));
7073 let response = common::to_response(parts, bytes.into());
7074
7075 if let common::Retry::After(d) =
7076 dlg.http_failure(&response, error.as_ref().ok())
7077 {
7078 sleep(d).await;
7079 continue;
7080 }
7081
7082 dlg.finished(false);
7083
7084 return Err(match error {
7085 Ok(value) => common::Error::BadRequest(value),
7086 _ => common::Error::Failure(response),
7087 });
7088 }
7089 let response = {
7090 let bytes = common::to_bytes(body).await.unwrap_or_default();
7091 let encoded = common::to_string(&bytes);
7092 match serde_json::from_str(&encoded) {
7093 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7094 Err(error) => {
7095 dlg.response_json_decode_error(&encoded, &error);
7096 return Err(common::Error::JsonDecodeError(
7097 encoded.to_string(),
7098 error,
7099 ));
7100 }
7101 }
7102 };
7103
7104 dlg.finished(true);
7105 return Ok(response);
7106 }
7107 }
7108 }
7109 }
7110
7111 ///
7112 /// Sets the *request* property to the given value.
7113 ///
7114 /// Even though the property as already been set when instantiating this call,
7115 /// we provide this method for API completeness.
7116 pub fn request(
7117 mut self,
7118 new_value: BatchUpdateContactsRequest,
7119 ) -> PersonBatchUpdateContactCall<'a, C> {
7120 self._request = new_value;
7121 self
7122 }
7123 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7124 /// while executing the actual API request.
7125 ///
7126 /// ````text
7127 /// It should be used to handle progress information, and to implement a certain level of resilience.
7128 /// ````
7129 ///
7130 /// Sets the *delegate* property to the given value.
7131 pub fn delegate(
7132 mut self,
7133 new_value: &'a mut dyn common::Delegate,
7134 ) -> PersonBatchUpdateContactCall<'a, C> {
7135 self._delegate = Some(new_value);
7136 self
7137 }
7138
7139 /// Set any additional parameter of the query string used in the request.
7140 /// It should be used to set parameters which are not yet available through their own
7141 /// setters.
7142 ///
7143 /// Please note that this method must not be used to set any of the known parameters
7144 /// which have their own setter method. If done anyway, the request will fail.
7145 ///
7146 /// # Additional Parameters
7147 ///
7148 /// * *$.xgafv* (query-string) - V1 error format.
7149 /// * *access_token* (query-string) - OAuth access token.
7150 /// * *alt* (query-string) - Data format for response.
7151 /// * *callback* (query-string) - JSONP
7152 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7153 /// * *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.
7154 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7155 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7156 /// * *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.
7157 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7158 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7159 pub fn param<T>(mut self, name: T, value: T) -> PersonBatchUpdateContactCall<'a, C>
7160 where
7161 T: AsRef<str>,
7162 {
7163 self._additional_params
7164 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7165 self
7166 }
7167
7168 /// Identifies the authorization scope for the method you are building.
7169 ///
7170 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7171 /// [`Scope::Contact`].
7172 ///
7173 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7174 /// tokens for more than one scope.
7175 ///
7176 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7177 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7178 /// sufficient, a read-write scope will do as well.
7179 pub fn add_scope<St>(mut self, scope: St) -> PersonBatchUpdateContactCall<'a, C>
7180 where
7181 St: AsRef<str>,
7182 {
7183 self._scopes.insert(String::from(scope.as_ref()));
7184 self
7185 }
7186 /// Identifies the authorization scope(s) for the method you are building.
7187 ///
7188 /// See [`Self::add_scope()`] for details.
7189 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonBatchUpdateContactCall<'a, C>
7190 where
7191 I: IntoIterator<Item = St>,
7192 St: AsRef<str>,
7193 {
7194 self._scopes
7195 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7196 self
7197 }
7198
7199 /// Removes all scopes, and no default scope will be used either.
7200 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7201 /// for details).
7202 pub fn clear_scopes(mut self) -> PersonBatchUpdateContactCall<'a, C> {
7203 self._scopes.clear();
7204 self
7205 }
7206}
7207
7208/// Create a new contact and return the person resource for that contact. The request returns a 400 error if more than one field is specified on a field that is a singleton for contact sources: * biographies * birthdays * genders * names Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
7209///
7210/// A builder for the *createContact* method supported by a *person* resource.
7211/// It is not used directly, but through a [`PersonMethods`] instance.
7212///
7213/// # Example
7214///
7215/// Instantiate a resource method builder
7216///
7217/// ```test_harness,no_run
7218/// # extern crate hyper;
7219/// # extern crate hyper_rustls;
7220/// # extern crate google_people1 as people1;
7221/// use people1::api::Person;
7222/// # async fn dox() {
7223/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7224///
7225/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7226/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7227/// # .with_native_roots()
7228/// # .unwrap()
7229/// # .https_only()
7230/// # .enable_http2()
7231/// # .build();
7232///
7233/// # let executor = hyper_util::rt::TokioExecutor::new();
7234/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7235/// # secret,
7236/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7237/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7238/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7239/// # ),
7240/// # ).build().await.unwrap();
7241///
7242/// # let client = hyper_util::client::legacy::Client::builder(
7243/// # hyper_util::rt::TokioExecutor::new()
7244/// # )
7245/// # .build(
7246/// # hyper_rustls::HttpsConnectorBuilder::new()
7247/// # .with_native_roots()
7248/// # .unwrap()
7249/// # .https_or_http()
7250/// # .enable_http2()
7251/// # .build()
7252/// # );
7253/// # let mut hub = PeopleService::new(client, auth);
7254/// // As the method needs a request, you would usually fill it with the desired information
7255/// // into the respective structure. Some of the parts shown here might not be applicable !
7256/// // Values shown here are possibly random and not representative !
7257/// let mut req = Person::default();
7258///
7259/// // You can configure optional parameters by calling the respective setters at will, and
7260/// // execute the final call using `doit()`.
7261/// // Values shown here are possibly random and not representative !
7262/// let result = hub.people().create_contact(req)
7263/// .add_sources("Lorem")
7264/// .person_fields(FieldMask::new::<&str>(&[]))
7265/// .doit().await;
7266/// # }
7267/// ```
7268pub struct PersonCreateContactCall<'a, C>
7269where
7270 C: 'a,
7271{
7272 hub: &'a PeopleService<C>,
7273 _request: Person,
7274 _sources: Vec<String>,
7275 _person_fields: Option<common::FieldMask>,
7276 _delegate: Option<&'a mut dyn common::Delegate>,
7277 _additional_params: HashMap<String, String>,
7278 _scopes: BTreeSet<String>,
7279}
7280
7281impl<'a, C> common::CallBuilder for PersonCreateContactCall<'a, C> {}
7282
7283impl<'a, C> PersonCreateContactCall<'a, C>
7284where
7285 C: common::Connector,
7286{
7287 /// Perform the operation you have build so far.
7288 pub async fn doit(mut self) -> common::Result<(common::Response, Person)> {
7289 use std::borrow::Cow;
7290 use std::io::{Read, Seek};
7291
7292 use common::{url::Params, ToParts};
7293 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7294
7295 let mut dd = common::DefaultDelegate;
7296 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7297 dlg.begin(common::MethodInfo {
7298 id: "people.people.createContact",
7299 http_method: hyper::Method::POST,
7300 });
7301
7302 for &field in ["alt", "sources", "personFields"].iter() {
7303 if self._additional_params.contains_key(field) {
7304 dlg.finished(false);
7305 return Err(common::Error::FieldClash(field));
7306 }
7307 }
7308
7309 let mut params = Params::with_capacity(5 + self._additional_params.len());
7310 if !self._sources.is_empty() {
7311 for f in self._sources.iter() {
7312 params.push("sources", f);
7313 }
7314 }
7315 if let Some(value) = self._person_fields.as_ref() {
7316 params.push("personFields", value.to_string());
7317 }
7318
7319 params.extend(self._additional_params.iter());
7320
7321 params.push("alt", "json");
7322 let mut url = self.hub._base_url.clone() + "v1/people:createContact";
7323 if self._scopes.is_empty() {
7324 self._scopes.insert(Scope::Contact.as_ref().to_string());
7325 }
7326
7327 let url = params.parse_with_url(&url);
7328
7329 let mut json_mime_type = mime::APPLICATION_JSON;
7330 let mut request_value_reader = {
7331 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7332 common::remove_json_null_values(&mut value);
7333 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7334 serde_json::to_writer(&mut dst, &value).unwrap();
7335 dst
7336 };
7337 let request_size = request_value_reader
7338 .seek(std::io::SeekFrom::End(0))
7339 .unwrap();
7340 request_value_reader
7341 .seek(std::io::SeekFrom::Start(0))
7342 .unwrap();
7343
7344 loop {
7345 let token = match self
7346 .hub
7347 .auth
7348 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7349 .await
7350 {
7351 Ok(token) => token,
7352 Err(e) => match dlg.token(e) {
7353 Ok(token) => token,
7354 Err(e) => {
7355 dlg.finished(false);
7356 return Err(common::Error::MissingToken(e));
7357 }
7358 },
7359 };
7360 request_value_reader
7361 .seek(std::io::SeekFrom::Start(0))
7362 .unwrap();
7363 let mut req_result = {
7364 let client = &self.hub.client;
7365 dlg.pre_request();
7366 let mut req_builder = hyper::Request::builder()
7367 .method(hyper::Method::POST)
7368 .uri(url.as_str())
7369 .header(USER_AGENT, self.hub._user_agent.clone());
7370
7371 if let Some(token) = token.as_ref() {
7372 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7373 }
7374
7375 let request = req_builder
7376 .header(CONTENT_TYPE, json_mime_type.to_string())
7377 .header(CONTENT_LENGTH, request_size as u64)
7378 .body(common::to_body(
7379 request_value_reader.get_ref().clone().into(),
7380 ));
7381
7382 client.request(request.unwrap()).await
7383 };
7384
7385 match req_result {
7386 Err(err) => {
7387 if let common::Retry::After(d) = dlg.http_error(&err) {
7388 sleep(d).await;
7389 continue;
7390 }
7391 dlg.finished(false);
7392 return Err(common::Error::HttpError(err));
7393 }
7394 Ok(res) => {
7395 let (mut parts, body) = res.into_parts();
7396 let mut body = common::Body::new(body);
7397 if !parts.status.is_success() {
7398 let bytes = common::to_bytes(body).await.unwrap_or_default();
7399 let error = serde_json::from_str(&common::to_string(&bytes));
7400 let response = common::to_response(parts, bytes.into());
7401
7402 if let common::Retry::After(d) =
7403 dlg.http_failure(&response, error.as_ref().ok())
7404 {
7405 sleep(d).await;
7406 continue;
7407 }
7408
7409 dlg.finished(false);
7410
7411 return Err(match error {
7412 Ok(value) => common::Error::BadRequest(value),
7413 _ => common::Error::Failure(response),
7414 });
7415 }
7416 let response = {
7417 let bytes = common::to_bytes(body).await.unwrap_or_default();
7418 let encoded = common::to_string(&bytes);
7419 match serde_json::from_str(&encoded) {
7420 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7421 Err(error) => {
7422 dlg.response_json_decode_error(&encoded, &error);
7423 return Err(common::Error::JsonDecodeError(
7424 encoded.to_string(),
7425 error,
7426 ));
7427 }
7428 }
7429 };
7430
7431 dlg.finished(true);
7432 return Ok(response);
7433 }
7434 }
7435 }
7436 }
7437
7438 ///
7439 /// Sets the *request* property to the given value.
7440 ///
7441 /// Even though the property as already been set when instantiating this call,
7442 /// we provide this method for API completeness.
7443 pub fn request(mut self, new_value: Person) -> PersonCreateContactCall<'a, C> {
7444 self._request = new_value;
7445 self
7446 }
7447 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
7448 ///
7449 /// Append the given value to the *sources* query property.
7450 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7451 pub fn add_sources(mut self, new_value: &str) -> PersonCreateContactCall<'a, C> {
7452 self._sources.push(new_value.to_string());
7453 self
7454 }
7455 /// Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Defaults to all fields if not set. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
7456 ///
7457 /// Sets the *person fields* query property to the given value.
7458 pub fn person_fields(mut self, new_value: common::FieldMask) -> PersonCreateContactCall<'a, C> {
7459 self._person_fields = Some(new_value);
7460 self
7461 }
7462 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7463 /// while executing the actual API request.
7464 ///
7465 /// ````text
7466 /// It should be used to handle progress information, and to implement a certain level of resilience.
7467 /// ````
7468 ///
7469 /// Sets the *delegate* property to the given value.
7470 pub fn delegate(
7471 mut self,
7472 new_value: &'a mut dyn common::Delegate,
7473 ) -> PersonCreateContactCall<'a, C> {
7474 self._delegate = Some(new_value);
7475 self
7476 }
7477
7478 /// Set any additional parameter of the query string used in the request.
7479 /// It should be used to set parameters which are not yet available through their own
7480 /// setters.
7481 ///
7482 /// Please note that this method must not be used to set any of the known parameters
7483 /// which have their own setter method. If done anyway, the request will fail.
7484 ///
7485 /// # Additional Parameters
7486 ///
7487 /// * *$.xgafv* (query-string) - V1 error format.
7488 /// * *access_token* (query-string) - OAuth access token.
7489 /// * *alt* (query-string) - Data format for response.
7490 /// * *callback* (query-string) - JSONP
7491 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7492 /// * *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.
7493 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7494 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7495 /// * *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.
7496 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7497 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7498 pub fn param<T>(mut self, name: T, value: T) -> PersonCreateContactCall<'a, C>
7499 where
7500 T: AsRef<str>,
7501 {
7502 self._additional_params
7503 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7504 self
7505 }
7506
7507 /// Identifies the authorization scope for the method you are building.
7508 ///
7509 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7510 /// [`Scope::Contact`].
7511 ///
7512 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7513 /// tokens for more than one scope.
7514 ///
7515 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7516 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7517 /// sufficient, a read-write scope will do as well.
7518 pub fn add_scope<St>(mut self, scope: St) -> PersonCreateContactCall<'a, C>
7519 where
7520 St: AsRef<str>,
7521 {
7522 self._scopes.insert(String::from(scope.as_ref()));
7523 self
7524 }
7525 /// Identifies the authorization scope(s) for the method you are building.
7526 ///
7527 /// See [`Self::add_scope()`] for details.
7528 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonCreateContactCall<'a, C>
7529 where
7530 I: IntoIterator<Item = St>,
7531 St: AsRef<str>,
7532 {
7533 self._scopes
7534 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7535 self
7536 }
7537
7538 /// Removes all scopes, and no default scope will be used either.
7539 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7540 /// for details).
7541 pub fn clear_scopes(mut self) -> PersonCreateContactCall<'a, C> {
7542 self._scopes.clear();
7543 self
7544 }
7545}
7546
7547/// Delete a contact person. Any non-contact data will not be deleted. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
7548///
7549/// A builder for the *deleteContact* method supported by a *person* resource.
7550/// It is not used directly, but through a [`PersonMethods`] instance.
7551///
7552/// # Example
7553///
7554/// Instantiate a resource method builder
7555///
7556/// ```test_harness,no_run
7557/// # extern crate hyper;
7558/// # extern crate hyper_rustls;
7559/// # extern crate google_people1 as people1;
7560/// # async fn dox() {
7561/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7562///
7563/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7564/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7565/// # .with_native_roots()
7566/// # .unwrap()
7567/// # .https_only()
7568/// # .enable_http2()
7569/// # .build();
7570///
7571/// # let executor = hyper_util::rt::TokioExecutor::new();
7572/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7573/// # secret,
7574/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7575/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7576/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7577/// # ),
7578/// # ).build().await.unwrap();
7579///
7580/// # let client = hyper_util::client::legacy::Client::builder(
7581/// # hyper_util::rt::TokioExecutor::new()
7582/// # )
7583/// # .build(
7584/// # hyper_rustls::HttpsConnectorBuilder::new()
7585/// # .with_native_roots()
7586/// # .unwrap()
7587/// # .https_or_http()
7588/// # .enable_http2()
7589/// # .build()
7590/// # );
7591/// # let mut hub = PeopleService::new(client, auth);
7592/// // You can configure optional parameters by calling the respective setters at will, and
7593/// // execute the final call using `doit()`.
7594/// // Values shown here are possibly random and not representative !
7595/// let result = hub.people().delete_contact("resourceName")
7596/// .doit().await;
7597/// # }
7598/// ```
7599pub struct PersonDeleteContactCall<'a, C>
7600where
7601 C: 'a,
7602{
7603 hub: &'a PeopleService<C>,
7604 _resource_name: String,
7605 _delegate: Option<&'a mut dyn common::Delegate>,
7606 _additional_params: HashMap<String, String>,
7607 _scopes: BTreeSet<String>,
7608}
7609
7610impl<'a, C> common::CallBuilder for PersonDeleteContactCall<'a, C> {}
7611
7612impl<'a, C> PersonDeleteContactCall<'a, C>
7613where
7614 C: common::Connector,
7615{
7616 /// Perform the operation you have build so far.
7617 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7618 use std::borrow::Cow;
7619 use std::io::{Read, Seek};
7620
7621 use common::{url::Params, ToParts};
7622 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7623
7624 let mut dd = common::DefaultDelegate;
7625 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7626 dlg.begin(common::MethodInfo {
7627 id: "people.people.deleteContact",
7628 http_method: hyper::Method::DELETE,
7629 });
7630
7631 for &field in ["alt", "resourceName"].iter() {
7632 if self._additional_params.contains_key(field) {
7633 dlg.finished(false);
7634 return Err(common::Error::FieldClash(field));
7635 }
7636 }
7637
7638 let mut params = Params::with_capacity(3 + self._additional_params.len());
7639 params.push("resourceName", self._resource_name);
7640
7641 params.extend(self._additional_params.iter());
7642
7643 params.push("alt", "json");
7644 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}:deleteContact";
7645 if self._scopes.is_empty() {
7646 self._scopes.insert(Scope::Contact.as_ref().to_string());
7647 }
7648
7649 #[allow(clippy::single_element_loop)]
7650 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
7651 url = params.uri_replacement(url, param_name, find_this, true);
7652 }
7653 {
7654 let to_remove = ["resourceName"];
7655 params.remove_params(&to_remove);
7656 }
7657
7658 let url = params.parse_with_url(&url);
7659
7660 loop {
7661 let token = match self
7662 .hub
7663 .auth
7664 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7665 .await
7666 {
7667 Ok(token) => token,
7668 Err(e) => match dlg.token(e) {
7669 Ok(token) => token,
7670 Err(e) => {
7671 dlg.finished(false);
7672 return Err(common::Error::MissingToken(e));
7673 }
7674 },
7675 };
7676 let mut req_result = {
7677 let client = &self.hub.client;
7678 dlg.pre_request();
7679 let mut req_builder = hyper::Request::builder()
7680 .method(hyper::Method::DELETE)
7681 .uri(url.as_str())
7682 .header(USER_AGENT, self.hub._user_agent.clone());
7683
7684 if let Some(token) = token.as_ref() {
7685 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7686 }
7687
7688 let request = req_builder
7689 .header(CONTENT_LENGTH, 0_u64)
7690 .body(common::to_body::<String>(None));
7691
7692 client.request(request.unwrap()).await
7693 };
7694
7695 match req_result {
7696 Err(err) => {
7697 if let common::Retry::After(d) = dlg.http_error(&err) {
7698 sleep(d).await;
7699 continue;
7700 }
7701 dlg.finished(false);
7702 return Err(common::Error::HttpError(err));
7703 }
7704 Ok(res) => {
7705 let (mut parts, body) = res.into_parts();
7706 let mut body = common::Body::new(body);
7707 if !parts.status.is_success() {
7708 let bytes = common::to_bytes(body).await.unwrap_or_default();
7709 let error = serde_json::from_str(&common::to_string(&bytes));
7710 let response = common::to_response(parts, bytes.into());
7711
7712 if let common::Retry::After(d) =
7713 dlg.http_failure(&response, error.as_ref().ok())
7714 {
7715 sleep(d).await;
7716 continue;
7717 }
7718
7719 dlg.finished(false);
7720
7721 return Err(match error {
7722 Ok(value) => common::Error::BadRequest(value),
7723 _ => common::Error::Failure(response),
7724 });
7725 }
7726 let response = {
7727 let bytes = common::to_bytes(body).await.unwrap_or_default();
7728 let encoded = common::to_string(&bytes);
7729 match serde_json::from_str(&encoded) {
7730 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7731 Err(error) => {
7732 dlg.response_json_decode_error(&encoded, &error);
7733 return Err(common::Error::JsonDecodeError(
7734 encoded.to_string(),
7735 error,
7736 ));
7737 }
7738 }
7739 };
7740
7741 dlg.finished(true);
7742 return Ok(response);
7743 }
7744 }
7745 }
7746 }
7747
7748 /// Required. The resource name of the contact to delete.
7749 ///
7750 /// Sets the *resource name* path property to the given value.
7751 ///
7752 /// Even though the property as already been set when instantiating this call,
7753 /// we provide this method for API completeness.
7754 pub fn resource_name(mut self, new_value: &str) -> PersonDeleteContactCall<'a, C> {
7755 self._resource_name = new_value.to_string();
7756 self
7757 }
7758 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7759 /// while executing the actual API request.
7760 ///
7761 /// ````text
7762 /// It should be used to handle progress information, and to implement a certain level of resilience.
7763 /// ````
7764 ///
7765 /// Sets the *delegate* property to the given value.
7766 pub fn delegate(
7767 mut self,
7768 new_value: &'a mut dyn common::Delegate,
7769 ) -> PersonDeleteContactCall<'a, C> {
7770 self._delegate = Some(new_value);
7771 self
7772 }
7773
7774 /// Set any additional parameter of the query string used in the request.
7775 /// It should be used to set parameters which are not yet available through their own
7776 /// setters.
7777 ///
7778 /// Please note that this method must not be used to set any of the known parameters
7779 /// which have their own setter method. If done anyway, the request will fail.
7780 ///
7781 /// # Additional Parameters
7782 ///
7783 /// * *$.xgafv* (query-string) - V1 error format.
7784 /// * *access_token* (query-string) - OAuth access token.
7785 /// * *alt* (query-string) - Data format for response.
7786 /// * *callback* (query-string) - JSONP
7787 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7788 /// * *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.
7789 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7790 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7791 /// * *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.
7792 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7793 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7794 pub fn param<T>(mut self, name: T, value: T) -> PersonDeleteContactCall<'a, C>
7795 where
7796 T: AsRef<str>,
7797 {
7798 self._additional_params
7799 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7800 self
7801 }
7802
7803 /// Identifies the authorization scope for the method you are building.
7804 ///
7805 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7806 /// [`Scope::Contact`].
7807 ///
7808 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7809 /// tokens for more than one scope.
7810 ///
7811 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7812 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7813 /// sufficient, a read-write scope will do as well.
7814 pub fn add_scope<St>(mut self, scope: St) -> PersonDeleteContactCall<'a, C>
7815 where
7816 St: AsRef<str>,
7817 {
7818 self._scopes.insert(String::from(scope.as_ref()));
7819 self
7820 }
7821 /// Identifies the authorization scope(s) for the method you are building.
7822 ///
7823 /// See [`Self::add_scope()`] for details.
7824 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonDeleteContactCall<'a, C>
7825 where
7826 I: IntoIterator<Item = St>,
7827 St: AsRef<str>,
7828 {
7829 self._scopes
7830 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7831 self
7832 }
7833
7834 /// Removes all scopes, and no default scope will be used either.
7835 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7836 /// for details).
7837 pub fn clear_scopes(mut self) -> PersonDeleteContactCall<'a, C> {
7838 self._scopes.clear();
7839 self
7840 }
7841}
7842
7843/// Delete a contact's photo. Mutate requests for the same user should be done sequentially to avoid // lock contention.
7844///
7845/// A builder for the *deleteContactPhoto* method supported by a *person* resource.
7846/// It is not used directly, but through a [`PersonMethods`] instance.
7847///
7848/// # Example
7849///
7850/// Instantiate a resource method builder
7851///
7852/// ```test_harness,no_run
7853/// # extern crate hyper;
7854/// # extern crate hyper_rustls;
7855/// # extern crate google_people1 as people1;
7856/// # async fn dox() {
7857/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7858///
7859/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7860/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7861/// # .with_native_roots()
7862/// # .unwrap()
7863/// # .https_only()
7864/// # .enable_http2()
7865/// # .build();
7866///
7867/// # let executor = hyper_util::rt::TokioExecutor::new();
7868/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7869/// # secret,
7870/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7871/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7872/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7873/// # ),
7874/// # ).build().await.unwrap();
7875///
7876/// # let client = hyper_util::client::legacy::Client::builder(
7877/// # hyper_util::rt::TokioExecutor::new()
7878/// # )
7879/// # .build(
7880/// # hyper_rustls::HttpsConnectorBuilder::new()
7881/// # .with_native_roots()
7882/// # .unwrap()
7883/// # .https_or_http()
7884/// # .enable_http2()
7885/// # .build()
7886/// # );
7887/// # let mut hub = PeopleService::new(client, auth);
7888/// // You can configure optional parameters by calling the respective setters at will, and
7889/// // execute the final call using `doit()`.
7890/// // Values shown here are possibly random and not representative !
7891/// let result = hub.people().delete_contact_photo("resourceName")
7892/// .add_sources("sed")
7893/// .person_fields(FieldMask::new::<&str>(&[]))
7894/// .doit().await;
7895/// # }
7896/// ```
7897pub struct PersonDeleteContactPhotoCall<'a, C>
7898where
7899 C: 'a,
7900{
7901 hub: &'a PeopleService<C>,
7902 _resource_name: String,
7903 _sources: Vec<String>,
7904 _person_fields: Option<common::FieldMask>,
7905 _delegate: Option<&'a mut dyn common::Delegate>,
7906 _additional_params: HashMap<String, String>,
7907 _scopes: BTreeSet<String>,
7908}
7909
7910impl<'a, C> common::CallBuilder for PersonDeleteContactPhotoCall<'a, C> {}
7911
7912impl<'a, C> PersonDeleteContactPhotoCall<'a, C>
7913where
7914 C: common::Connector,
7915{
7916 /// Perform the operation you have build so far.
7917 pub async fn doit(mut self) -> common::Result<(common::Response, DeleteContactPhotoResponse)> {
7918 use std::borrow::Cow;
7919 use std::io::{Read, Seek};
7920
7921 use common::{url::Params, ToParts};
7922 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7923
7924 let mut dd = common::DefaultDelegate;
7925 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7926 dlg.begin(common::MethodInfo {
7927 id: "people.people.deleteContactPhoto",
7928 http_method: hyper::Method::DELETE,
7929 });
7930
7931 for &field in ["alt", "resourceName", "sources", "personFields"].iter() {
7932 if self._additional_params.contains_key(field) {
7933 dlg.finished(false);
7934 return Err(common::Error::FieldClash(field));
7935 }
7936 }
7937
7938 let mut params = Params::with_capacity(5 + self._additional_params.len());
7939 params.push("resourceName", self._resource_name);
7940 if !self._sources.is_empty() {
7941 for f in self._sources.iter() {
7942 params.push("sources", f);
7943 }
7944 }
7945 if let Some(value) = self._person_fields.as_ref() {
7946 params.push("personFields", value.to_string());
7947 }
7948
7949 params.extend(self._additional_params.iter());
7950
7951 params.push("alt", "json");
7952 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}:deleteContactPhoto";
7953 if self._scopes.is_empty() {
7954 self._scopes.insert(Scope::Contact.as_ref().to_string());
7955 }
7956
7957 #[allow(clippy::single_element_loop)]
7958 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
7959 url = params.uri_replacement(url, param_name, find_this, true);
7960 }
7961 {
7962 let to_remove = ["resourceName"];
7963 params.remove_params(&to_remove);
7964 }
7965
7966 let url = params.parse_with_url(&url);
7967
7968 loop {
7969 let token = match self
7970 .hub
7971 .auth
7972 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7973 .await
7974 {
7975 Ok(token) => token,
7976 Err(e) => match dlg.token(e) {
7977 Ok(token) => token,
7978 Err(e) => {
7979 dlg.finished(false);
7980 return Err(common::Error::MissingToken(e));
7981 }
7982 },
7983 };
7984 let mut req_result = {
7985 let client = &self.hub.client;
7986 dlg.pre_request();
7987 let mut req_builder = hyper::Request::builder()
7988 .method(hyper::Method::DELETE)
7989 .uri(url.as_str())
7990 .header(USER_AGENT, self.hub._user_agent.clone());
7991
7992 if let Some(token) = token.as_ref() {
7993 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7994 }
7995
7996 let request = req_builder
7997 .header(CONTENT_LENGTH, 0_u64)
7998 .body(common::to_body::<String>(None));
7999
8000 client.request(request.unwrap()).await
8001 };
8002
8003 match req_result {
8004 Err(err) => {
8005 if let common::Retry::After(d) = dlg.http_error(&err) {
8006 sleep(d).await;
8007 continue;
8008 }
8009 dlg.finished(false);
8010 return Err(common::Error::HttpError(err));
8011 }
8012 Ok(res) => {
8013 let (mut parts, body) = res.into_parts();
8014 let mut body = common::Body::new(body);
8015 if !parts.status.is_success() {
8016 let bytes = common::to_bytes(body).await.unwrap_or_default();
8017 let error = serde_json::from_str(&common::to_string(&bytes));
8018 let response = common::to_response(parts, bytes.into());
8019
8020 if let common::Retry::After(d) =
8021 dlg.http_failure(&response, error.as_ref().ok())
8022 {
8023 sleep(d).await;
8024 continue;
8025 }
8026
8027 dlg.finished(false);
8028
8029 return Err(match error {
8030 Ok(value) => common::Error::BadRequest(value),
8031 _ => common::Error::Failure(response),
8032 });
8033 }
8034 let response = {
8035 let bytes = common::to_bytes(body).await.unwrap_or_default();
8036 let encoded = common::to_string(&bytes);
8037 match serde_json::from_str(&encoded) {
8038 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8039 Err(error) => {
8040 dlg.response_json_decode_error(&encoded, &error);
8041 return Err(common::Error::JsonDecodeError(
8042 encoded.to_string(),
8043 error,
8044 ));
8045 }
8046 }
8047 };
8048
8049 dlg.finished(true);
8050 return Ok(response);
8051 }
8052 }
8053 }
8054 }
8055
8056 /// Required. The resource name of the contact whose photo will be deleted.
8057 ///
8058 /// Sets the *resource name* path property to the given value.
8059 ///
8060 /// Even though the property as already been set when instantiating this call,
8061 /// we provide this method for API completeness.
8062 pub fn resource_name(mut self, new_value: &str) -> PersonDeleteContactPhotoCall<'a, C> {
8063 self._resource_name = new_value.to_string();
8064 self
8065 }
8066 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
8067 ///
8068 /// Append the given value to the *sources* query property.
8069 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8070 pub fn add_sources(mut self, new_value: &str) -> PersonDeleteContactPhotoCall<'a, C> {
8071 self._sources.push(new_value.to_string());
8072 self
8073 }
8074 /// Optional. A field mask to restrict which fields on the person are returned. Multiple fields can be specified by separating them with commas. Defaults to empty if not set, which will skip the post mutate get. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
8075 ///
8076 /// Sets the *person fields* query property to the given value.
8077 pub fn person_fields(
8078 mut self,
8079 new_value: common::FieldMask,
8080 ) -> PersonDeleteContactPhotoCall<'a, C> {
8081 self._person_fields = Some(new_value);
8082 self
8083 }
8084 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8085 /// while executing the actual API request.
8086 ///
8087 /// ````text
8088 /// It should be used to handle progress information, and to implement a certain level of resilience.
8089 /// ````
8090 ///
8091 /// Sets the *delegate* property to the given value.
8092 pub fn delegate(
8093 mut self,
8094 new_value: &'a mut dyn common::Delegate,
8095 ) -> PersonDeleteContactPhotoCall<'a, C> {
8096 self._delegate = Some(new_value);
8097 self
8098 }
8099
8100 /// Set any additional parameter of the query string used in the request.
8101 /// It should be used to set parameters which are not yet available through their own
8102 /// setters.
8103 ///
8104 /// Please note that this method must not be used to set any of the known parameters
8105 /// which have their own setter method. If done anyway, the request will fail.
8106 ///
8107 /// # Additional Parameters
8108 ///
8109 /// * *$.xgafv* (query-string) - V1 error format.
8110 /// * *access_token* (query-string) - OAuth access token.
8111 /// * *alt* (query-string) - Data format for response.
8112 /// * *callback* (query-string) - JSONP
8113 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8114 /// * *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.
8115 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8116 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8117 /// * *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.
8118 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8119 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8120 pub fn param<T>(mut self, name: T, value: T) -> PersonDeleteContactPhotoCall<'a, C>
8121 where
8122 T: AsRef<str>,
8123 {
8124 self._additional_params
8125 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8126 self
8127 }
8128
8129 /// Identifies the authorization scope for the method you are building.
8130 ///
8131 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8132 /// [`Scope::Contact`].
8133 ///
8134 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8135 /// tokens for more than one scope.
8136 ///
8137 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8138 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8139 /// sufficient, a read-write scope will do as well.
8140 pub fn add_scope<St>(mut self, scope: St) -> PersonDeleteContactPhotoCall<'a, C>
8141 where
8142 St: AsRef<str>,
8143 {
8144 self._scopes.insert(String::from(scope.as_ref()));
8145 self
8146 }
8147 /// Identifies the authorization scope(s) for the method you are building.
8148 ///
8149 /// See [`Self::add_scope()`] for details.
8150 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonDeleteContactPhotoCall<'a, C>
8151 where
8152 I: IntoIterator<Item = St>,
8153 St: AsRef<str>,
8154 {
8155 self._scopes
8156 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8157 self
8158 }
8159
8160 /// Removes all scopes, and no default scope will be used either.
8161 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8162 /// for details).
8163 pub fn clear_scopes(mut self) -> PersonDeleteContactPhotoCall<'a, C> {
8164 self._scopes.clear();
8165 self
8166 }
8167}
8168
8169/// Provides information about a person by specifying a resource name. Use `people/me` to indicate the authenticated user. The request returns a 400 error if 'personFields' is not specified.
8170///
8171/// A builder for the *get* method supported by a *person* resource.
8172/// It is not used directly, but through a [`PersonMethods`] instance.
8173///
8174/// # Example
8175///
8176/// Instantiate a resource method builder
8177///
8178/// ```test_harness,no_run
8179/// # extern crate hyper;
8180/// # extern crate hyper_rustls;
8181/// # extern crate google_people1 as people1;
8182/// # async fn dox() {
8183/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8184///
8185/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8186/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8187/// # .with_native_roots()
8188/// # .unwrap()
8189/// # .https_only()
8190/// # .enable_http2()
8191/// # .build();
8192///
8193/// # let executor = hyper_util::rt::TokioExecutor::new();
8194/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8195/// # secret,
8196/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8197/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8198/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8199/// # ),
8200/// # ).build().await.unwrap();
8201///
8202/// # let client = hyper_util::client::legacy::Client::builder(
8203/// # hyper_util::rt::TokioExecutor::new()
8204/// # )
8205/// # .build(
8206/// # hyper_rustls::HttpsConnectorBuilder::new()
8207/// # .with_native_roots()
8208/// # .unwrap()
8209/// # .https_or_http()
8210/// # .enable_http2()
8211/// # .build()
8212/// # );
8213/// # let mut hub = PeopleService::new(client, auth);
8214/// // You can configure optional parameters by calling the respective setters at will, and
8215/// // execute the final call using `doit()`.
8216/// // Values shown here are possibly random and not representative !
8217/// let result = hub.people().get("resourceName")
8218/// .add_sources("sed")
8219/// .request_mask_include_field(FieldMask::new::<&str>(&[]))
8220/// .person_fields(FieldMask::new::<&str>(&[]))
8221/// .doit().await;
8222/// # }
8223/// ```
8224pub struct PersonGetCall<'a, C>
8225where
8226 C: 'a,
8227{
8228 hub: &'a PeopleService<C>,
8229 _resource_name: String,
8230 _sources: Vec<String>,
8231 _request_mask_include_field: Option<common::FieldMask>,
8232 _person_fields: Option<common::FieldMask>,
8233 _delegate: Option<&'a mut dyn common::Delegate>,
8234 _additional_params: HashMap<String, String>,
8235 _scopes: BTreeSet<String>,
8236}
8237
8238impl<'a, C> common::CallBuilder for PersonGetCall<'a, C> {}
8239
8240impl<'a, C> PersonGetCall<'a, C>
8241where
8242 C: common::Connector,
8243{
8244 /// Perform the operation you have build so far.
8245 pub async fn doit(mut self) -> common::Result<(common::Response, Person)> {
8246 use std::borrow::Cow;
8247 use std::io::{Read, Seek};
8248
8249 use common::{url::Params, ToParts};
8250 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8251
8252 let mut dd = common::DefaultDelegate;
8253 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8254 dlg.begin(common::MethodInfo {
8255 id: "people.people.get",
8256 http_method: hyper::Method::GET,
8257 });
8258
8259 for &field in [
8260 "alt",
8261 "resourceName",
8262 "sources",
8263 "requestMask.includeField",
8264 "personFields",
8265 ]
8266 .iter()
8267 {
8268 if self._additional_params.contains_key(field) {
8269 dlg.finished(false);
8270 return Err(common::Error::FieldClash(field));
8271 }
8272 }
8273
8274 let mut params = Params::with_capacity(6 + self._additional_params.len());
8275 params.push("resourceName", self._resource_name);
8276 if !self._sources.is_empty() {
8277 for f in self._sources.iter() {
8278 params.push("sources", f);
8279 }
8280 }
8281 if let Some(value) = self._request_mask_include_field.as_ref() {
8282 params.push("requestMask.includeField", value.to_string());
8283 }
8284 if let Some(value) = self._person_fields.as_ref() {
8285 params.push("personFields", value.to_string());
8286 }
8287
8288 params.extend(self._additional_params.iter());
8289
8290 params.push("alt", "json");
8291 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}";
8292 if self._scopes.is_empty() {
8293 self._scopes
8294 .insert(Scope::ContactOtherReadonly.as_ref().to_string());
8295 }
8296
8297 #[allow(clippy::single_element_loop)]
8298 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
8299 url = params.uri_replacement(url, param_name, find_this, true);
8300 }
8301 {
8302 let to_remove = ["resourceName"];
8303 params.remove_params(&to_remove);
8304 }
8305
8306 let url = params.parse_with_url(&url);
8307
8308 loop {
8309 let token = match self
8310 .hub
8311 .auth
8312 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8313 .await
8314 {
8315 Ok(token) => token,
8316 Err(e) => match dlg.token(e) {
8317 Ok(token) => token,
8318 Err(e) => {
8319 dlg.finished(false);
8320 return Err(common::Error::MissingToken(e));
8321 }
8322 },
8323 };
8324 let mut req_result = {
8325 let client = &self.hub.client;
8326 dlg.pre_request();
8327 let mut req_builder = hyper::Request::builder()
8328 .method(hyper::Method::GET)
8329 .uri(url.as_str())
8330 .header(USER_AGENT, self.hub._user_agent.clone());
8331
8332 if let Some(token) = token.as_ref() {
8333 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8334 }
8335
8336 let request = req_builder
8337 .header(CONTENT_LENGTH, 0_u64)
8338 .body(common::to_body::<String>(None));
8339
8340 client.request(request.unwrap()).await
8341 };
8342
8343 match req_result {
8344 Err(err) => {
8345 if let common::Retry::After(d) = dlg.http_error(&err) {
8346 sleep(d).await;
8347 continue;
8348 }
8349 dlg.finished(false);
8350 return Err(common::Error::HttpError(err));
8351 }
8352 Ok(res) => {
8353 let (mut parts, body) = res.into_parts();
8354 let mut body = common::Body::new(body);
8355 if !parts.status.is_success() {
8356 let bytes = common::to_bytes(body).await.unwrap_or_default();
8357 let error = serde_json::from_str(&common::to_string(&bytes));
8358 let response = common::to_response(parts, bytes.into());
8359
8360 if let common::Retry::After(d) =
8361 dlg.http_failure(&response, error.as_ref().ok())
8362 {
8363 sleep(d).await;
8364 continue;
8365 }
8366
8367 dlg.finished(false);
8368
8369 return Err(match error {
8370 Ok(value) => common::Error::BadRequest(value),
8371 _ => common::Error::Failure(response),
8372 });
8373 }
8374 let response = {
8375 let bytes = common::to_bytes(body).await.unwrap_or_default();
8376 let encoded = common::to_string(&bytes);
8377 match serde_json::from_str(&encoded) {
8378 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8379 Err(error) => {
8380 dlg.response_json_decode_error(&encoded, &error);
8381 return Err(common::Error::JsonDecodeError(
8382 encoded.to_string(),
8383 error,
8384 ));
8385 }
8386 }
8387 };
8388
8389 dlg.finished(true);
8390 return Ok(response);
8391 }
8392 }
8393 }
8394 }
8395
8396 /// Required. The resource name of the person to provide information about. - To get information about the authenticated user, specify `people/me`. - To get information about a google account, specify `people/{account_id}`. - To get information about a contact, specify the resource name that identifies the contact as returned by `people.connections.list`.
8397 ///
8398 /// Sets the *resource name* path property to the given value.
8399 ///
8400 /// Even though the property as already been set when instantiating this call,
8401 /// we provide this method for API completeness.
8402 pub fn resource_name(mut self, new_value: &str) -> PersonGetCall<'a, C> {
8403 self._resource_name = new_value.to_string();
8404 self
8405 }
8406 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_PROFILE and READ_SOURCE_TYPE_CONTACT if not set.
8407 ///
8408 /// Append the given value to the *sources* query property.
8409 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8410 pub fn add_sources(mut self, new_value: &str) -> PersonGetCall<'a, C> {
8411 self._sources.push(new_value.to_string());
8412 self
8413 }
8414 /// Required. Comma-separated list of person fields to be included in the response. Each path should start with `person.`: for example, `person.names` or `person.photos`.
8415 ///
8416 /// Sets the *request mask.include field* query property to the given value.
8417 pub fn request_mask_include_field(
8418 mut self,
8419 new_value: common::FieldMask,
8420 ) -> PersonGetCall<'a, C> {
8421 self._request_mask_include_field = Some(new_value);
8422 self
8423 }
8424 /// Required. A field mask to restrict which fields on the person are returned. Multiple fields can be specified by separating them with commas. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
8425 ///
8426 /// Sets the *person fields* query property to the given value.
8427 pub fn person_fields(mut self, new_value: common::FieldMask) -> PersonGetCall<'a, C> {
8428 self._person_fields = Some(new_value);
8429 self
8430 }
8431 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8432 /// while executing the actual API request.
8433 ///
8434 /// ````text
8435 /// It should be used to handle progress information, and to implement a certain level of resilience.
8436 /// ````
8437 ///
8438 /// Sets the *delegate* property to the given value.
8439 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PersonGetCall<'a, C> {
8440 self._delegate = Some(new_value);
8441 self
8442 }
8443
8444 /// Set any additional parameter of the query string used in the request.
8445 /// It should be used to set parameters which are not yet available through their own
8446 /// setters.
8447 ///
8448 /// Please note that this method must not be used to set any of the known parameters
8449 /// which have their own setter method. If done anyway, the request will fail.
8450 ///
8451 /// # Additional Parameters
8452 ///
8453 /// * *$.xgafv* (query-string) - V1 error format.
8454 /// * *access_token* (query-string) - OAuth access token.
8455 /// * *alt* (query-string) - Data format for response.
8456 /// * *callback* (query-string) - JSONP
8457 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8458 /// * *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.
8459 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8460 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8461 /// * *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.
8462 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8463 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8464 pub fn param<T>(mut self, name: T, value: T) -> PersonGetCall<'a, C>
8465 where
8466 T: AsRef<str>,
8467 {
8468 self._additional_params
8469 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8470 self
8471 }
8472
8473 /// Identifies the authorization scope for the method you are building.
8474 ///
8475 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8476 /// [`Scope::ContactOtherReadonly`].
8477 ///
8478 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8479 /// tokens for more than one scope.
8480 ///
8481 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8482 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8483 /// sufficient, a read-write scope will do as well.
8484 pub fn add_scope<St>(mut self, scope: St) -> PersonGetCall<'a, C>
8485 where
8486 St: AsRef<str>,
8487 {
8488 self._scopes.insert(String::from(scope.as_ref()));
8489 self
8490 }
8491 /// Identifies the authorization scope(s) for the method you are building.
8492 ///
8493 /// See [`Self::add_scope()`] for details.
8494 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonGetCall<'a, C>
8495 where
8496 I: IntoIterator<Item = St>,
8497 St: AsRef<str>,
8498 {
8499 self._scopes
8500 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8501 self
8502 }
8503
8504 /// Removes all scopes, and no default scope will be used either.
8505 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8506 /// for details).
8507 pub fn clear_scopes(mut self) -> PersonGetCall<'a, C> {
8508 self._scopes.clear();
8509 self
8510 }
8511}
8512
8513/// Provides information about a list of specific people by specifying a list of requested resource names. Use `people/me` to indicate the authenticated user. The request returns a 400 error if 'personFields' is not specified.
8514///
8515/// A builder for the *getBatchGet* method supported by a *person* resource.
8516/// It is not used directly, but through a [`PersonMethods`] instance.
8517///
8518/// # Example
8519///
8520/// Instantiate a resource method builder
8521///
8522/// ```test_harness,no_run
8523/// # extern crate hyper;
8524/// # extern crate hyper_rustls;
8525/// # extern crate google_people1 as people1;
8526/// # async fn dox() {
8527/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8528///
8529/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8530/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8531/// # .with_native_roots()
8532/// # .unwrap()
8533/// # .https_only()
8534/// # .enable_http2()
8535/// # .build();
8536///
8537/// # let executor = hyper_util::rt::TokioExecutor::new();
8538/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8539/// # secret,
8540/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8541/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8542/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8543/// # ),
8544/// # ).build().await.unwrap();
8545///
8546/// # let client = hyper_util::client::legacy::Client::builder(
8547/// # hyper_util::rt::TokioExecutor::new()
8548/// # )
8549/// # .build(
8550/// # hyper_rustls::HttpsConnectorBuilder::new()
8551/// # .with_native_roots()
8552/// # .unwrap()
8553/// # .https_or_http()
8554/// # .enable_http2()
8555/// # .build()
8556/// # );
8557/// # let mut hub = PeopleService::new(client, auth);
8558/// // You can configure optional parameters by calling the respective setters at will, and
8559/// // execute the final call using `doit()`.
8560/// // Values shown here are possibly random and not representative !
8561/// let result = hub.people().get_batch_get()
8562/// .add_sources("no")
8563/// .add_resource_names("Stet")
8564/// .request_mask_include_field(FieldMask::new::<&str>(&[]))
8565/// .person_fields(FieldMask::new::<&str>(&[]))
8566/// .doit().await;
8567/// # }
8568/// ```
8569pub struct PersonGetBatchGetCall<'a, C>
8570where
8571 C: 'a,
8572{
8573 hub: &'a PeopleService<C>,
8574 _sources: Vec<String>,
8575 _resource_names: Vec<String>,
8576 _request_mask_include_field: Option<common::FieldMask>,
8577 _person_fields: Option<common::FieldMask>,
8578 _delegate: Option<&'a mut dyn common::Delegate>,
8579 _additional_params: HashMap<String, String>,
8580 _scopes: BTreeSet<String>,
8581}
8582
8583impl<'a, C> common::CallBuilder for PersonGetBatchGetCall<'a, C> {}
8584
8585impl<'a, C> PersonGetBatchGetCall<'a, C>
8586where
8587 C: common::Connector,
8588{
8589 /// Perform the operation you have build so far.
8590 pub async fn doit(mut self) -> common::Result<(common::Response, GetPeopleResponse)> {
8591 use std::borrow::Cow;
8592 use std::io::{Read, Seek};
8593
8594 use common::{url::Params, ToParts};
8595 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8596
8597 let mut dd = common::DefaultDelegate;
8598 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8599 dlg.begin(common::MethodInfo {
8600 id: "people.people.getBatchGet",
8601 http_method: hyper::Method::GET,
8602 });
8603
8604 for &field in [
8605 "alt",
8606 "sources",
8607 "resourceNames",
8608 "requestMask.includeField",
8609 "personFields",
8610 ]
8611 .iter()
8612 {
8613 if self._additional_params.contains_key(field) {
8614 dlg.finished(false);
8615 return Err(common::Error::FieldClash(field));
8616 }
8617 }
8618
8619 let mut params = Params::with_capacity(6 + self._additional_params.len());
8620 if !self._sources.is_empty() {
8621 for f in self._sources.iter() {
8622 params.push("sources", f);
8623 }
8624 }
8625 if !self._resource_names.is_empty() {
8626 for f in self._resource_names.iter() {
8627 params.push("resourceNames", f);
8628 }
8629 }
8630 if let Some(value) = self._request_mask_include_field.as_ref() {
8631 params.push("requestMask.includeField", value.to_string());
8632 }
8633 if let Some(value) = self._person_fields.as_ref() {
8634 params.push("personFields", value.to_string());
8635 }
8636
8637 params.extend(self._additional_params.iter());
8638
8639 params.push("alt", "json");
8640 let mut url = self.hub._base_url.clone() + "v1/people:batchGet";
8641 if self._scopes.is_empty() {
8642 self._scopes
8643 .insert(Scope::ContactOtherReadonly.as_ref().to_string());
8644 }
8645
8646 let url = params.parse_with_url(&url);
8647
8648 loop {
8649 let token = match self
8650 .hub
8651 .auth
8652 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8653 .await
8654 {
8655 Ok(token) => token,
8656 Err(e) => match dlg.token(e) {
8657 Ok(token) => token,
8658 Err(e) => {
8659 dlg.finished(false);
8660 return Err(common::Error::MissingToken(e));
8661 }
8662 },
8663 };
8664 let mut req_result = {
8665 let client = &self.hub.client;
8666 dlg.pre_request();
8667 let mut req_builder = hyper::Request::builder()
8668 .method(hyper::Method::GET)
8669 .uri(url.as_str())
8670 .header(USER_AGENT, self.hub._user_agent.clone());
8671
8672 if let Some(token) = token.as_ref() {
8673 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8674 }
8675
8676 let request = req_builder
8677 .header(CONTENT_LENGTH, 0_u64)
8678 .body(common::to_body::<String>(None));
8679
8680 client.request(request.unwrap()).await
8681 };
8682
8683 match req_result {
8684 Err(err) => {
8685 if let common::Retry::After(d) = dlg.http_error(&err) {
8686 sleep(d).await;
8687 continue;
8688 }
8689 dlg.finished(false);
8690 return Err(common::Error::HttpError(err));
8691 }
8692 Ok(res) => {
8693 let (mut parts, body) = res.into_parts();
8694 let mut body = common::Body::new(body);
8695 if !parts.status.is_success() {
8696 let bytes = common::to_bytes(body).await.unwrap_or_default();
8697 let error = serde_json::from_str(&common::to_string(&bytes));
8698 let response = common::to_response(parts, bytes.into());
8699
8700 if let common::Retry::After(d) =
8701 dlg.http_failure(&response, error.as_ref().ok())
8702 {
8703 sleep(d).await;
8704 continue;
8705 }
8706
8707 dlg.finished(false);
8708
8709 return Err(match error {
8710 Ok(value) => common::Error::BadRequest(value),
8711 _ => common::Error::Failure(response),
8712 });
8713 }
8714 let response = {
8715 let bytes = common::to_bytes(body).await.unwrap_or_default();
8716 let encoded = common::to_string(&bytes);
8717 match serde_json::from_str(&encoded) {
8718 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8719 Err(error) => {
8720 dlg.response_json_decode_error(&encoded, &error);
8721 return Err(common::Error::JsonDecodeError(
8722 encoded.to_string(),
8723 error,
8724 ));
8725 }
8726 }
8727 };
8728
8729 dlg.finished(true);
8730 return Ok(response);
8731 }
8732 }
8733 }
8734 }
8735
8736 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
8737 ///
8738 /// Append the given value to the *sources* query property.
8739 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8740 pub fn add_sources(mut self, new_value: &str) -> PersonGetBatchGetCall<'a, C> {
8741 self._sources.push(new_value.to_string());
8742 self
8743 }
8744 /// Required. The resource names of the people to provide information about. It's repeatable. The URL query parameter should be resourceNames=<name1>&resourceNames=<name2>&... - To get information about the authenticated user, specify `people/me`. - To get information about a google account, specify `people/{account_id}`. - To get information about a contact, specify the resource name that identifies the contact as returned by `people.connections.list`. There is a maximum of 200 resource names.
8745 ///
8746 /// Append the given value to the *resource names* query property.
8747 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8748 pub fn add_resource_names(mut self, new_value: &str) -> PersonGetBatchGetCall<'a, C> {
8749 self._resource_names.push(new_value.to_string());
8750 self
8751 }
8752 /// Required. Comma-separated list of person fields to be included in the response. Each path should start with `person.`: for example, `person.names` or `person.photos`.
8753 ///
8754 /// Sets the *request mask.include field* query property to the given value.
8755 pub fn request_mask_include_field(
8756 mut self,
8757 new_value: common::FieldMask,
8758 ) -> PersonGetBatchGetCall<'a, C> {
8759 self._request_mask_include_field = Some(new_value);
8760 self
8761 }
8762 /// Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
8763 ///
8764 /// Sets the *person fields* query property to the given value.
8765 pub fn person_fields(mut self, new_value: common::FieldMask) -> PersonGetBatchGetCall<'a, C> {
8766 self._person_fields = Some(new_value);
8767 self
8768 }
8769 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8770 /// while executing the actual API request.
8771 ///
8772 /// ````text
8773 /// It should be used to handle progress information, and to implement a certain level of resilience.
8774 /// ````
8775 ///
8776 /// Sets the *delegate* property to the given value.
8777 pub fn delegate(
8778 mut self,
8779 new_value: &'a mut dyn common::Delegate,
8780 ) -> PersonGetBatchGetCall<'a, C> {
8781 self._delegate = Some(new_value);
8782 self
8783 }
8784
8785 /// Set any additional parameter of the query string used in the request.
8786 /// It should be used to set parameters which are not yet available through their own
8787 /// setters.
8788 ///
8789 /// Please note that this method must not be used to set any of the known parameters
8790 /// which have their own setter method. If done anyway, the request will fail.
8791 ///
8792 /// # Additional Parameters
8793 ///
8794 /// * *$.xgafv* (query-string) - V1 error format.
8795 /// * *access_token* (query-string) - OAuth access token.
8796 /// * *alt* (query-string) - Data format for response.
8797 /// * *callback* (query-string) - JSONP
8798 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8799 /// * *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.
8800 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8801 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8802 /// * *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.
8803 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8804 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8805 pub fn param<T>(mut self, name: T, value: T) -> PersonGetBatchGetCall<'a, C>
8806 where
8807 T: AsRef<str>,
8808 {
8809 self._additional_params
8810 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8811 self
8812 }
8813
8814 /// Identifies the authorization scope for the method you are building.
8815 ///
8816 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8817 /// [`Scope::ContactOtherReadonly`].
8818 ///
8819 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8820 /// tokens for more than one scope.
8821 ///
8822 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8823 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8824 /// sufficient, a read-write scope will do as well.
8825 pub fn add_scope<St>(mut self, scope: St) -> PersonGetBatchGetCall<'a, C>
8826 where
8827 St: AsRef<str>,
8828 {
8829 self._scopes.insert(String::from(scope.as_ref()));
8830 self
8831 }
8832 /// Identifies the authorization scope(s) for the method you are building.
8833 ///
8834 /// See [`Self::add_scope()`] for details.
8835 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonGetBatchGetCall<'a, C>
8836 where
8837 I: IntoIterator<Item = St>,
8838 St: AsRef<str>,
8839 {
8840 self._scopes
8841 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8842 self
8843 }
8844
8845 /// Removes all scopes, and no default scope will be used either.
8846 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8847 /// for details).
8848 pub fn clear_scopes(mut self) -> PersonGetBatchGetCall<'a, C> {
8849 self._scopes.clear();
8850 self
8851 }
8852}
8853
8854/// Provides a list of domain profiles and domain contacts in the authenticated user’s domain directory. When the `sync_token` is specified, resources deleted since the last sync will be returned as a person with `PersonMetadata.deleted` set to true. When the `page_token` or `sync_token` is specified, all other request parameters must match the first call. Writes may have a propagation delay of several minutes for sync requests. Incremental syncs are not intended for read-after-write use cases. See example usage at [List the directory people that have changed](https://developers.google.com/people/v1/directory#list_the_directory_people_that_have_changed).
8855///
8856/// A builder for the *listDirectoryPeople* method supported by a *person* resource.
8857/// It is not used directly, but through a [`PersonMethods`] instance.
8858///
8859/// # Example
8860///
8861/// Instantiate a resource method builder
8862///
8863/// ```test_harness,no_run
8864/// # extern crate hyper;
8865/// # extern crate hyper_rustls;
8866/// # extern crate google_people1 as people1;
8867/// # async fn dox() {
8868/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8869///
8870/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8871/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8872/// # .with_native_roots()
8873/// # .unwrap()
8874/// # .https_only()
8875/// # .enable_http2()
8876/// # .build();
8877///
8878/// # let executor = hyper_util::rt::TokioExecutor::new();
8879/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8880/// # secret,
8881/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8882/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8883/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8884/// # ),
8885/// # ).build().await.unwrap();
8886///
8887/// # let client = hyper_util::client::legacy::Client::builder(
8888/// # hyper_util::rt::TokioExecutor::new()
8889/// # )
8890/// # .build(
8891/// # hyper_rustls::HttpsConnectorBuilder::new()
8892/// # .with_native_roots()
8893/// # .unwrap()
8894/// # .https_or_http()
8895/// # .enable_http2()
8896/// # .build()
8897/// # );
8898/// # let mut hub = PeopleService::new(client, auth);
8899/// // You can configure optional parameters by calling the respective setters at will, and
8900/// // execute the final call using `doit()`.
8901/// // Values shown here are possibly random and not representative !
8902/// let result = hub.people().list_directory_people()
8903/// .sync_token("kasd")
8904/// .add_sources("et")
8905/// .request_sync_token(true)
8906/// .read_mask(FieldMask::new::<&str>(&[]))
8907/// .page_token("et")
8908/// .page_size(-68)
8909/// .add_merge_sources("vero")
8910/// .doit().await;
8911/// # }
8912/// ```
8913pub struct PersonListDirectoryPersonCall<'a, C>
8914where
8915 C: 'a,
8916{
8917 hub: &'a PeopleService<C>,
8918 _sync_token: Option<String>,
8919 _sources: Vec<String>,
8920 _request_sync_token: Option<bool>,
8921 _read_mask: Option<common::FieldMask>,
8922 _page_token: Option<String>,
8923 _page_size: Option<i32>,
8924 _merge_sources: Vec<String>,
8925 _delegate: Option<&'a mut dyn common::Delegate>,
8926 _additional_params: HashMap<String, String>,
8927 _scopes: BTreeSet<String>,
8928}
8929
8930impl<'a, C> common::CallBuilder for PersonListDirectoryPersonCall<'a, C> {}
8931
8932impl<'a, C> PersonListDirectoryPersonCall<'a, C>
8933where
8934 C: common::Connector,
8935{
8936 /// Perform the operation you have build so far.
8937 pub async fn doit(mut self) -> common::Result<(common::Response, ListDirectoryPeopleResponse)> {
8938 use std::borrow::Cow;
8939 use std::io::{Read, Seek};
8940
8941 use common::{url::Params, ToParts};
8942 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8943
8944 let mut dd = common::DefaultDelegate;
8945 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8946 dlg.begin(common::MethodInfo {
8947 id: "people.people.listDirectoryPeople",
8948 http_method: hyper::Method::GET,
8949 });
8950
8951 for &field in [
8952 "alt",
8953 "syncToken",
8954 "sources",
8955 "requestSyncToken",
8956 "readMask",
8957 "pageToken",
8958 "pageSize",
8959 "mergeSources",
8960 ]
8961 .iter()
8962 {
8963 if self._additional_params.contains_key(field) {
8964 dlg.finished(false);
8965 return Err(common::Error::FieldClash(field));
8966 }
8967 }
8968
8969 let mut params = Params::with_capacity(9 + self._additional_params.len());
8970 if let Some(value) = self._sync_token.as_ref() {
8971 params.push("syncToken", value);
8972 }
8973 if !self._sources.is_empty() {
8974 for f in self._sources.iter() {
8975 params.push("sources", f);
8976 }
8977 }
8978 if let Some(value) = self._request_sync_token.as_ref() {
8979 params.push("requestSyncToken", value.to_string());
8980 }
8981 if let Some(value) = self._read_mask.as_ref() {
8982 params.push("readMask", value.to_string());
8983 }
8984 if let Some(value) = self._page_token.as_ref() {
8985 params.push("pageToken", value);
8986 }
8987 if let Some(value) = self._page_size.as_ref() {
8988 params.push("pageSize", value.to_string());
8989 }
8990 if !self._merge_sources.is_empty() {
8991 for f in self._merge_sources.iter() {
8992 params.push("mergeSources", f);
8993 }
8994 }
8995
8996 params.extend(self._additional_params.iter());
8997
8998 params.push("alt", "json");
8999 let mut url = self.hub._base_url.clone() + "v1/people:listDirectoryPeople";
9000 if self._scopes.is_empty() {
9001 self._scopes
9002 .insert(Scope::DirectoryReadonly.as_ref().to_string());
9003 }
9004
9005 let url = params.parse_with_url(&url);
9006
9007 loop {
9008 let token = match self
9009 .hub
9010 .auth
9011 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9012 .await
9013 {
9014 Ok(token) => token,
9015 Err(e) => match dlg.token(e) {
9016 Ok(token) => token,
9017 Err(e) => {
9018 dlg.finished(false);
9019 return Err(common::Error::MissingToken(e));
9020 }
9021 },
9022 };
9023 let mut req_result = {
9024 let client = &self.hub.client;
9025 dlg.pre_request();
9026 let mut req_builder = hyper::Request::builder()
9027 .method(hyper::Method::GET)
9028 .uri(url.as_str())
9029 .header(USER_AGENT, self.hub._user_agent.clone());
9030
9031 if let Some(token) = token.as_ref() {
9032 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9033 }
9034
9035 let request = req_builder
9036 .header(CONTENT_LENGTH, 0_u64)
9037 .body(common::to_body::<String>(None));
9038
9039 client.request(request.unwrap()).await
9040 };
9041
9042 match req_result {
9043 Err(err) => {
9044 if let common::Retry::After(d) = dlg.http_error(&err) {
9045 sleep(d).await;
9046 continue;
9047 }
9048 dlg.finished(false);
9049 return Err(common::Error::HttpError(err));
9050 }
9051 Ok(res) => {
9052 let (mut parts, body) = res.into_parts();
9053 let mut body = common::Body::new(body);
9054 if !parts.status.is_success() {
9055 let bytes = common::to_bytes(body).await.unwrap_or_default();
9056 let error = serde_json::from_str(&common::to_string(&bytes));
9057 let response = common::to_response(parts, bytes.into());
9058
9059 if let common::Retry::After(d) =
9060 dlg.http_failure(&response, error.as_ref().ok())
9061 {
9062 sleep(d).await;
9063 continue;
9064 }
9065
9066 dlg.finished(false);
9067
9068 return Err(match error {
9069 Ok(value) => common::Error::BadRequest(value),
9070 _ => common::Error::Failure(response),
9071 });
9072 }
9073 let response = {
9074 let bytes = common::to_bytes(body).await.unwrap_or_default();
9075 let encoded = common::to_string(&bytes);
9076 match serde_json::from_str(&encoded) {
9077 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9078 Err(error) => {
9079 dlg.response_json_decode_error(&encoded, &error);
9080 return Err(common::Error::JsonDecodeError(
9081 encoded.to_string(),
9082 error,
9083 ));
9084 }
9085 }
9086 };
9087
9088 dlg.finished(true);
9089 return Ok(response);
9090 }
9091 }
9092 }
9093 }
9094
9095 /// Optional. A sync token, received from a previous response `next_sync_token` Provide this to retrieve only the resources changed since the last request. When syncing, all other parameters provided to `people.listDirectoryPeople` must match the first call that provided the sync token. More details about sync behavior at `people.listDirectoryPeople`.
9096 ///
9097 /// Sets the *sync token* query property to the given value.
9098 pub fn sync_token(mut self, new_value: &str) -> PersonListDirectoryPersonCall<'a, C> {
9099 self._sync_token = Some(new_value.to_string());
9100 self
9101 }
9102 /// Required. Directory sources to return.
9103 ///
9104 /// Append the given value to the *sources* query property.
9105 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9106 pub fn add_sources(mut self, new_value: &str) -> PersonListDirectoryPersonCall<'a, C> {
9107 self._sources.push(new_value.to_string());
9108 self
9109 }
9110 /// Optional. Whether the response should return `next_sync_token`. It can be used to get incremental changes since the last request by setting it on the request `sync_token`. More details about sync behavior at `people.listDirectoryPeople`.
9111 ///
9112 /// Sets the *request sync token* query property to the given value.
9113 pub fn request_sync_token(mut self, new_value: bool) -> PersonListDirectoryPersonCall<'a, C> {
9114 self._request_sync_token = Some(new_value);
9115 self
9116 }
9117 /// Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
9118 ///
9119 /// Sets the *read mask* query property to the given value.
9120 pub fn read_mask(
9121 mut self,
9122 new_value: common::FieldMask,
9123 ) -> PersonListDirectoryPersonCall<'a, C> {
9124 self._read_mask = Some(new_value);
9125 self
9126 }
9127 /// Optional. A page token, received from a previous response `next_page_token`. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `people.listDirectoryPeople` must match the first call that provided the page token.
9128 ///
9129 /// Sets the *page token* query property to the given value.
9130 pub fn page_token(mut self, new_value: &str) -> PersonListDirectoryPersonCall<'a, C> {
9131 self._page_token = Some(new_value.to_string());
9132 self
9133 }
9134 /// Optional. The number of people to include in the response. Valid values are between 1 and 1000, inclusive. Defaults to 100 if not set or set to 0.
9135 ///
9136 /// Sets the *page size* query property to the given value.
9137 pub fn page_size(mut self, new_value: i32) -> PersonListDirectoryPersonCall<'a, C> {
9138 self._page_size = Some(new_value);
9139 self
9140 }
9141 /// Optional. Additional data to merge into the directory sources if they are connected through verified join keys such as email addresses or phone numbers.
9142 ///
9143 /// Append the given value to the *merge sources* query property.
9144 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9145 pub fn add_merge_sources(mut self, new_value: &str) -> PersonListDirectoryPersonCall<'a, C> {
9146 self._merge_sources.push(new_value.to_string());
9147 self
9148 }
9149 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9150 /// while executing the actual API request.
9151 ///
9152 /// ````text
9153 /// It should be used to handle progress information, and to implement a certain level of resilience.
9154 /// ````
9155 ///
9156 /// Sets the *delegate* property to the given value.
9157 pub fn delegate(
9158 mut self,
9159 new_value: &'a mut dyn common::Delegate,
9160 ) -> PersonListDirectoryPersonCall<'a, C> {
9161 self._delegate = Some(new_value);
9162 self
9163 }
9164
9165 /// Set any additional parameter of the query string used in the request.
9166 /// It should be used to set parameters which are not yet available through their own
9167 /// setters.
9168 ///
9169 /// Please note that this method must not be used to set any of the known parameters
9170 /// which have their own setter method. If done anyway, the request will fail.
9171 ///
9172 /// # Additional Parameters
9173 ///
9174 /// * *$.xgafv* (query-string) - V1 error format.
9175 /// * *access_token* (query-string) - OAuth access token.
9176 /// * *alt* (query-string) - Data format for response.
9177 /// * *callback* (query-string) - JSONP
9178 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9179 /// * *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.
9180 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9181 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9182 /// * *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.
9183 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9184 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9185 pub fn param<T>(mut self, name: T, value: T) -> PersonListDirectoryPersonCall<'a, C>
9186 where
9187 T: AsRef<str>,
9188 {
9189 self._additional_params
9190 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9191 self
9192 }
9193
9194 /// Identifies the authorization scope for the method you are building.
9195 ///
9196 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9197 /// [`Scope::DirectoryReadonly`].
9198 ///
9199 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9200 /// tokens for more than one scope.
9201 ///
9202 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9203 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9204 /// sufficient, a read-write scope will do as well.
9205 pub fn add_scope<St>(mut self, scope: St) -> PersonListDirectoryPersonCall<'a, C>
9206 where
9207 St: AsRef<str>,
9208 {
9209 self._scopes.insert(String::from(scope.as_ref()));
9210 self
9211 }
9212 /// Identifies the authorization scope(s) for the method you are building.
9213 ///
9214 /// See [`Self::add_scope()`] for details.
9215 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonListDirectoryPersonCall<'a, C>
9216 where
9217 I: IntoIterator<Item = St>,
9218 St: AsRef<str>,
9219 {
9220 self._scopes
9221 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9222 self
9223 }
9224
9225 /// Removes all scopes, and no default scope will be used either.
9226 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9227 /// for details).
9228 pub fn clear_scopes(mut self) -> PersonListDirectoryPersonCall<'a, C> {
9229 self._scopes.clear();
9230 self
9231 }
9232}
9233
9234/// Provides a list of contacts in the authenticated user's grouped contacts that matches the search query. The query matches on a contact's `names`, `nickNames`, `emailAddresses`, `phoneNumbers`, and `organizations` fields that are from the CONTACT source. **IMPORTANT**: Before searching, clients should send a warmup request with an empty query to update the cache. See https://developers.google.com/people/v1/contacts#search_the_users_contacts
9235///
9236/// A builder for the *searchContacts* method supported by a *person* resource.
9237/// It is not used directly, but through a [`PersonMethods`] instance.
9238///
9239/// # Example
9240///
9241/// Instantiate a resource method builder
9242///
9243/// ```test_harness,no_run
9244/// # extern crate hyper;
9245/// # extern crate hyper_rustls;
9246/// # extern crate google_people1 as people1;
9247/// # async fn dox() {
9248/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9249///
9250/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9251/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9252/// # .with_native_roots()
9253/// # .unwrap()
9254/// # .https_only()
9255/// # .enable_http2()
9256/// # .build();
9257///
9258/// # let executor = hyper_util::rt::TokioExecutor::new();
9259/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9260/// # secret,
9261/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9262/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9263/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9264/// # ),
9265/// # ).build().await.unwrap();
9266///
9267/// # let client = hyper_util::client::legacy::Client::builder(
9268/// # hyper_util::rt::TokioExecutor::new()
9269/// # )
9270/// # .build(
9271/// # hyper_rustls::HttpsConnectorBuilder::new()
9272/// # .with_native_roots()
9273/// # .unwrap()
9274/// # .https_or_http()
9275/// # .enable_http2()
9276/// # .build()
9277/// # );
9278/// # let mut hub = PeopleService::new(client, auth);
9279/// // You can configure optional parameters by calling the respective setters at will, and
9280/// // execute the final call using `doit()`.
9281/// // Values shown here are possibly random and not representative !
9282/// let result = hub.people().search_contacts()
9283/// .add_sources("erat")
9284/// .read_mask(FieldMask::new::<&str>(&[]))
9285/// .query("sed")
9286/// .page_size(-20)
9287/// .doit().await;
9288/// # }
9289/// ```
9290pub struct PersonSearchContactCall<'a, C>
9291where
9292 C: 'a,
9293{
9294 hub: &'a PeopleService<C>,
9295 _sources: Vec<String>,
9296 _read_mask: Option<common::FieldMask>,
9297 _query: Option<String>,
9298 _page_size: Option<i32>,
9299 _delegate: Option<&'a mut dyn common::Delegate>,
9300 _additional_params: HashMap<String, String>,
9301 _scopes: BTreeSet<String>,
9302}
9303
9304impl<'a, C> common::CallBuilder for PersonSearchContactCall<'a, C> {}
9305
9306impl<'a, C> PersonSearchContactCall<'a, C>
9307where
9308 C: common::Connector,
9309{
9310 /// Perform the operation you have build so far.
9311 pub async fn doit(mut self) -> common::Result<(common::Response, SearchResponse)> {
9312 use std::borrow::Cow;
9313 use std::io::{Read, Seek};
9314
9315 use common::{url::Params, ToParts};
9316 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9317
9318 let mut dd = common::DefaultDelegate;
9319 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9320 dlg.begin(common::MethodInfo {
9321 id: "people.people.searchContacts",
9322 http_method: hyper::Method::GET,
9323 });
9324
9325 for &field in ["alt", "sources", "readMask", "query", "pageSize"].iter() {
9326 if self._additional_params.contains_key(field) {
9327 dlg.finished(false);
9328 return Err(common::Error::FieldClash(field));
9329 }
9330 }
9331
9332 let mut params = Params::with_capacity(6 + self._additional_params.len());
9333 if !self._sources.is_empty() {
9334 for f in self._sources.iter() {
9335 params.push("sources", f);
9336 }
9337 }
9338 if let Some(value) = self._read_mask.as_ref() {
9339 params.push("readMask", value.to_string());
9340 }
9341 if let Some(value) = self._query.as_ref() {
9342 params.push("query", value);
9343 }
9344 if let Some(value) = self._page_size.as_ref() {
9345 params.push("pageSize", value.to_string());
9346 }
9347
9348 params.extend(self._additional_params.iter());
9349
9350 params.push("alt", "json");
9351 let mut url = self.hub._base_url.clone() + "v1/people:searchContacts";
9352 if self._scopes.is_empty() {
9353 self._scopes
9354 .insert(Scope::ContactReadonly.as_ref().to_string());
9355 }
9356
9357 let url = params.parse_with_url(&url);
9358
9359 loop {
9360 let token = match self
9361 .hub
9362 .auth
9363 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9364 .await
9365 {
9366 Ok(token) => token,
9367 Err(e) => match dlg.token(e) {
9368 Ok(token) => token,
9369 Err(e) => {
9370 dlg.finished(false);
9371 return Err(common::Error::MissingToken(e));
9372 }
9373 },
9374 };
9375 let mut req_result = {
9376 let client = &self.hub.client;
9377 dlg.pre_request();
9378 let mut req_builder = hyper::Request::builder()
9379 .method(hyper::Method::GET)
9380 .uri(url.as_str())
9381 .header(USER_AGENT, self.hub._user_agent.clone());
9382
9383 if let Some(token) = token.as_ref() {
9384 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9385 }
9386
9387 let request = req_builder
9388 .header(CONTENT_LENGTH, 0_u64)
9389 .body(common::to_body::<String>(None));
9390
9391 client.request(request.unwrap()).await
9392 };
9393
9394 match req_result {
9395 Err(err) => {
9396 if let common::Retry::After(d) = dlg.http_error(&err) {
9397 sleep(d).await;
9398 continue;
9399 }
9400 dlg.finished(false);
9401 return Err(common::Error::HttpError(err));
9402 }
9403 Ok(res) => {
9404 let (mut parts, body) = res.into_parts();
9405 let mut body = common::Body::new(body);
9406 if !parts.status.is_success() {
9407 let bytes = common::to_bytes(body).await.unwrap_or_default();
9408 let error = serde_json::from_str(&common::to_string(&bytes));
9409 let response = common::to_response(parts, bytes.into());
9410
9411 if let common::Retry::After(d) =
9412 dlg.http_failure(&response, error.as_ref().ok())
9413 {
9414 sleep(d).await;
9415 continue;
9416 }
9417
9418 dlg.finished(false);
9419
9420 return Err(match error {
9421 Ok(value) => common::Error::BadRequest(value),
9422 _ => common::Error::Failure(response),
9423 });
9424 }
9425 let response = {
9426 let bytes = common::to_bytes(body).await.unwrap_or_default();
9427 let encoded = common::to_string(&bytes);
9428 match serde_json::from_str(&encoded) {
9429 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9430 Err(error) => {
9431 dlg.response_json_decode_error(&encoded, &error);
9432 return Err(common::Error::JsonDecodeError(
9433 encoded.to_string(),
9434 error,
9435 ));
9436 }
9437 }
9438 };
9439
9440 dlg.finished(true);
9441 return Ok(response);
9442 }
9443 }
9444 }
9445 }
9446
9447 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT if not set.
9448 ///
9449 /// Append the given value to the *sources* query property.
9450 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9451 pub fn add_sources(mut self, new_value: &str) -> PersonSearchContactCall<'a, C> {
9452 self._sources.push(new_value.to_string());
9453 self
9454 }
9455 /// Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
9456 ///
9457 /// Sets the *read mask* query property to the given value.
9458 pub fn read_mask(mut self, new_value: common::FieldMask) -> PersonSearchContactCall<'a, C> {
9459 self._read_mask = Some(new_value);
9460 self
9461 }
9462 /// Required. The plain-text query for the request. The query is used to match prefix phrases of the fields on a person. For example, a person with name "foo name" matches queries such as "f", "fo", "foo", "foo n", "nam", etc., but not "oo n".
9463 ///
9464 /// Sets the *query* query property to the given value.
9465 pub fn query(mut self, new_value: &str) -> PersonSearchContactCall<'a, C> {
9466 self._query = Some(new_value.to_string());
9467 self
9468 }
9469 /// Optional. The number of results to return. Defaults to 10 if field is not set, or set to 0. Values greater than 30 will be capped to 30.
9470 ///
9471 /// Sets the *page size* query property to the given value.
9472 pub fn page_size(mut self, new_value: i32) -> PersonSearchContactCall<'a, C> {
9473 self._page_size = Some(new_value);
9474 self
9475 }
9476 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9477 /// while executing the actual API request.
9478 ///
9479 /// ````text
9480 /// It should be used to handle progress information, and to implement a certain level of resilience.
9481 /// ````
9482 ///
9483 /// Sets the *delegate* property to the given value.
9484 pub fn delegate(
9485 mut self,
9486 new_value: &'a mut dyn common::Delegate,
9487 ) -> PersonSearchContactCall<'a, C> {
9488 self._delegate = Some(new_value);
9489 self
9490 }
9491
9492 /// Set any additional parameter of the query string used in the request.
9493 /// It should be used to set parameters which are not yet available through their own
9494 /// setters.
9495 ///
9496 /// Please note that this method must not be used to set any of the known parameters
9497 /// which have their own setter method. If done anyway, the request will fail.
9498 ///
9499 /// # Additional Parameters
9500 ///
9501 /// * *$.xgafv* (query-string) - V1 error format.
9502 /// * *access_token* (query-string) - OAuth access token.
9503 /// * *alt* (query-string) - Data format for response.
9504 /// * *callback* (query-string) - JSONP
9505 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9506 /// * *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.
9507 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9508 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9509 /// * *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.
9510 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9511 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9512 pub fn param<T>(mut self, name: T, value: T) -> PersonSearchContactCall<'a, C>
9513 where
9514 T: AsRef<str>,
9515 {
9516 self._additional_params
9517 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9518 self
9519 }
9520
9521 /// Identifies the authorization scope for the method you are building.
9522 ///
9523 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9524 /// [`Scope::ContactReadonly`].
9525 ///
9526 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9527 /// tokens for more than one scope.
9528 ///
9529 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9530 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9531 /// sufficient, a read-write scope will do as well.
9532 pub fn add_scope<St>(mut self, scope: St) -> PersonSearchContactCall<'a, C>
9533 where
9534 St: AsRef<str>,
9535 {
9536 self._scopes.insert(String::from(scope.as_ref()));
9537 self
9538 }
9539 /// Identifies the authorization scope(s) for the method you are building.
9540 ///
9541 /// See [`Self::add_scope()`] for details.
9542 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonSearchContactCall<'a, C>
9543 where
9544 I: IntoIterator<Item = St>,
9545 St: AsRef<str>,
9546 {
9547 self._scopes
9548 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9549 self
9550 }
9551
9552 /// Removes all scopes, and no default scope will be used either.
9553 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9554 /// for details).
9555 pub fn clear_scopes(mut self) -> PersonSearchContactCall<'a, C> {
9556 self._scopes.clear();
9557 self
9558 }
9559}
9560
9561/// Provides a list of domain profiles and domain contacts in the authenticated user's domain directory that match the search query.
9562///
9563/// A builder for the *searchDirectoryPeople* method supported by a *person* resource.
9564/// It is not used directly, but through a [`PersonMethods`] instance.
9565///
9566/// # Example
9567///
9568/// Instantiate a resource method builder
9569///
9570/// ```test_harness,no_run
9571/// # extern crate hyper;
9572/// # extern crate hyper_rustls;
9573/// # extern crate google_people1 as people1;
9574/// # async fn dox() {
9575/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9576///
9577/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9578/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9579/// # .with_native_roots()
9580/// # .unwrap()
9581/// # .https_only()
9582/// # .enable_http2()
9583/// # .build();
9584///
9585/// # let executor = hyper_util::rt::TokioExecutor::new();
9586/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9587/// # secret,
9588/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9589/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9590/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9591/// # ),
9592/// # ).build().await.unwrap();
9593///
9594/// # let client = hyper_util::client::legacy::Client::builder(
9595/// # hyper_util::rt::TokioExecutor::new()
9596/// # )
9597/// # .build(
9598/// # hyper_rustls::HttpsConnectorBuilder::new()
9599/// # .with_native_roots()
9600/// # .unwrap()
9601/// # .https_or_http()
9602/// # .enable_http2()
9603/// # .build()
9604/// # );
9605/// # let mut hub = PeopleService::new(client, auth);
9606/// // You can configure optional parameters by calling the respective setters at will, and
9607/// // execute the final call using `doit()`.
9608/// // Values shown here are possibly random and not representative !
9609/// let result = hub.people().search_directory_people()
9610/// .add_sources("dolore")
9611/// .read_mask(FieldMask::new::<&str>(&[]))
9612/// .query("et")
9613/// .page_token("voluptua.")
9614/// .page_size(-2)
9615/// .add_merge_sources("consetetur")
9616/// .doit().await;
9617/// # }
9618/// ```
9619pub struct PersonSearchDirectoryPersonCall<'a, C>
9620where
9621 C: 'a,
9622{
9623 hub: &'a PeopleService<C>,
9624 _sources: Vec<String>,
9625 _read_mask: Option<common::FieldMask>,
9626 _query: Option<String>,
9627 _page_token: Option<String>,
9628 _page_size: Option<i32>,
9629 _merge_sources: Vec<String>,
9630 _delegate: Option<&'a mut dyn common::Delegate>,
9631 _additional_params: HashMap<String, String>,
9632 _scopes: BTreeSet<String>,
9633}
9634
9635impl<'a, C> common::CallBuilder for PersonSearchDirectoryPersonCall<'a, C> {}
9636
9637impl<'a, C> PersonSearchDirectoryPersonCall<'a, C>
9638where
9639 C: common::Connector,
9640{
9641 /// Perform the operation you have build so far.
9642 pub async fn doit(
9643 mut self,
9644 ) -> common::Result<(common::Response, SearchDirectoryPeopleResponse)> {
9645 use std::borrow::Cow;
9646 use std::io::{Read, Seek};
9647
9648 use common::{url::Params, ToParts};
9649 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9650
9651 let mut dd = common::DefaultDelegate;
9652 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9653 dlg.begin(common::MethodInfo {
9654 id: "people.people.searchDirectoryPeople",
9655 http_method: hyper::Method::GET,
9656 });
9657
9658 for &field in [
9659 "alt",
9660 "sources",
9661 "readMask",
9662 "query",
9663 "pageToken",
9664 "pageSize",
9665 "mergeSources",
9666 ]
9667 .iter()
9668 {
9669 if self._additional_params.contains_key(field) {
9670 dlg.finished(false);
9671 return Err(common::Error::FieldClash(field));
9672 }
9673 }
9674
9675 let mut params = Params::with_capacity(8 + self._additional_params.len());
9676 if !self._sources.is_empty() {
9677 for f in self._sources.iter() {
9678 params.push("sources", f);
9679 }
9680 }
9681 if let Some(value) = self._read_mask.as_ref() {
9682 params.push("readMask", value.to_string());
9683 }
9684 if let Some(value) = self._query.as_ref() {
9685 params.push("query", value);
9686 }
9687 if let Some(value) = self._page_token.as_ref() {
9688 params.push("pageToken", value);
9689 }
9690 if let Some(value) = self._page_size.as_ref() {
9691 params.push("pageSize", value.to_string());
9692 }
9693 if !self._merge_sources.is_empty() {
9694 for f in self._merge_sources.iter() {
9695 params.push("mergeSources", f);
9696 }
9697 }
9698
9699 params.extend(self._additional_params.iter());
9700
9701 params.push("alt", "json");
9702 let mut url = self.hub._base_url.clone() + "v1/people:searchDirectoryPeople";
9703 if self._scopes.is_empty() {
9704 self._scopes
9705 .insert(Scope::DirectoryReadonly.as_ref().to_string());
9706 }
9707
9708 let url = params.parse_with_url(&url);
9709
9710 loop {
9711 let token = match self
9712 .hub
9713 .auth
9714 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9715 .await
9716 {
9717 Ok(token) => token,
9718 Err(e) => match dlg.token(e) {
9719 Ok(token) => token,
9720 Err(e) => {
9721 dlg.finished(false);
9722 return Err(common::Error::MissingToken(e));
9723 }
9724 },
9725 };
9726 let mut req_result = {
9727 let client = &self.hub.client;
9728 dlg.pre_request();
9729 let mut req_builder = hyper::Request::builder()
9730 .method(hyper::Method::GET)
9731 .uri(url.as_str())
9732 .header(USER_AGENT, self.hub._user_agent.clone());
9733
9734 if let Some(token) = token.as_ref() {
9735 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9736 }
9737
9738 let request = req_builder
9739 .header(CONTENT_LENGTH, 0_u64)
9740 .body(common::to_body::<String>(None));
9741
9742 client.request(request.unwrap()).await
9743 };
9744
9745 match req_result {
9746 Err(err) => {
9747 if let common::Retry::After(d) = dlg.http_error(&err) {
9748 sleep(d).await;
9749 continue;
9750 }
9751 dlg.finished(false);
9752 return Err(common::Error::HttpError(err));
9753 }
9754 Ok(res) => {
9755 let (mut parts, body) = res.into_parts();
9756 let mut body = common::Body::new(body);
9757 if !parts.status.is_success() {
9758 let bytes = common::to_bytes(body).await.unwrap_or_default();
9759 let error = serde_json::from_str(&common::to_string(&bytes));
9760 let response = common::to_response(parts, bytes.into());
9761
9762 if let common::Retry::After(d) =
9763 dlg.http_failure(&response, error.as_ref().ok())
9764 {
9765 sleep(d).await;
9766 continue;
9767 }
9768
9769 dlg.finished(false);
9770
9771 return Err(match error {
9772 Ok(value) => common::Error::BadRequest(value),
9773 _ => common::Error::Failure(response),
9774 });
9775 }
9776 let response = {
9777 let bytes = common::to_bytes(body).await.unwrap_or_default();
9778 let encoded = common::to_string(&bytes);
9779 match serde_json::from_str(&encoded) {
9780 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9781 Err(error) => {
9782 dlg.response_json_decode_error(&encoded, &error);
9783 return Err(common::Error::JsonDecodeError(
9784 encoded.to_string(),
9785 error,
9786 ));
9787 }
9788 }
9789 };
9790
9791 dlg.finished(true);
9792 return Ok(response);
9793 }
9794 }
9795 }
9796 }
9797
9798 /// Required. Directory sources to return.
9799 ///
9800 /// Append the given value to the *sources* query property.
9801 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9802 pub fn add_sources(mut self, new_value: &str) -> PersonSearchDirectoryPersonCall<'a, C> {
9803 self._sources.push(new_value.to_string());
9804 self
9805 }
9806 /// Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
9807 ///
9808 /// Sets the *read mask* query property to the given value.
9809 pub fn read_mask(
9810 mut self,
9811 new_value: common::FieldMask,
9812 ) -> PersonSearchDirectoryPersonCall<'a, C> {
9813 self._read_mask = Some(new_value);
9814 self
9815 }
9816 /// Required. Prefix query that matches fields in the person. Does NOT use the read_mask for determining what fields to match.
9817 ///
9818 /// Sets the *query* query property to the given value.
9819 pub fn query(mut self, new_value: &str) -> PersonSearchDirectoryPersonCall<'a, C> {
9820 self._query = Some(new_value.to_string());
9821 self
9822 }
9823 /// Optional. A page token, received from a previous response `next_page_token`. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `SearchDirectoryPeople` must match the first call that provided the page token.
9824 ///
9825 /// Sets the *page token* query property to the given value.
9826 pub fn page_token(mut self, new_value: &str) -> PersonSearchDirectoryPersonCall<'a, C> {
9827 self._page_token = Some(new_value.to_string());
9828 self
9829 }
9830 /// Optional. The number of people to include in the response. Valid values are between 1 and 500, inclusive. Defaults to 100 if not set or set to 0.
9831 ///
9832 /// Sets the *page size* query property to the given value.
9833 pub fn page_size(mut self, new_value: i32) -> PersonSearchDirectoryPersonCall<'a, C> {
9834 self._page_size = Some(new_value);
9835 self
9836 }
9837 /// Optional. Additional data to merge into the directory sources if they are connected through verified join keys such as email addresses or phone numbers.
9838 ///
9839 /// Append the given value to the *merge sources* query property.
9840 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9841 pub fn add_merge_sources(mut self, new_value: &str) -> PersonSearchDirectoryPersonCall<'a, C> {
9842 self._merge_sources.push(new_value.to_string());
9843 self
9844 }
9845 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9846 /// while executing the actual API request.
9847 ///
9848 /// ````text
9849 /// It should be used to handle progress information, and to implement a certain level of resilience.
9850 /// ````
9851 ///
9852 /// Sets the *delegate* property to the given value.
9853 pub fn delegate(
9854 mut self,
9855 new_value: &'a mut dyn common::Delegate,
9856 ) -> PersonSearchDirectoryPersonCall<'a, C> {
9857 self._delegate = Some(new_value);
9858 self
9859 }
9860
9861 /// Set any additional parameter of the query string used in the request.
9862 /// It should be used to set parameters which are not yet available through their own
9863 /// setters.
9864 ///
9865 /// Please note that this method must not be used to set any of the known parameters
9866 /// which have their own setter method. If done anyway, the request will fail.
9867 ///
9868 /// # Additional Parameters
9869 ///
9870 /// * *$.xgafv* (query-string) - V1 error format.
9871 /// * *access_token* (query-string) - OAuth access token.
9872 /// * *alt* (query-string) - Data format for response.
9873 /// * *callback* (query-string) - JSONP
9874 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9875 /// * *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.
9876 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9877 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9878 /// * *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.
9879 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9880 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9881 pub fn param<T>(mut self, name: T, value: T) -> PersonSearchDirectoryPersonCall<'a, C>
9882 where
9883 T: AsRef<str>,
9884 {
9885 self._additional_params
9886 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9887 self
9888 }
9889
9890 /// Identifies the authorization scope for the method you are building.
9891 ///
9892 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9893 /// [`Scope::DirectoryReadonly`].
9894 ///
9895 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9896 /// tokens for more than one scope.
9897 ///
9898 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9899 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9900 /// sufficient, a read-write scope will do as well.
9901 pub fn add_scope<St>(mut self, scope: St) -> PersonSearchDirectoryPersonCall<'a, C>
9902 where
9903 St: AsRef<str>,
9904 {
9905 self._scopes.insert(String::from(scope.as_ref()));
9906 self
9907 }
9908 /// Identifies the authorization scope(s) for the method you are building.
9909 ///
9910 /// See [`Self::add_scope()`] for details.
9911 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonSearchDirectoryPersonCall<'a, C>
9912 where
9913 I: IntoIterator<Item = St>,
9914 St: AsRef<str>,
9915 {
9916 self._scopes
9917 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9918 self
9919 }
9920
9921 /// Removes all scopes, and no default scope will be used either.
9922 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9923 /// for details).
9924 pub fn clear_scopes(mut self) -> PersonSearchDirectoryPersonCall<'a, C> {
9925 self._scopes.clear();
9926 self
9927 }
9928}
9929
9930/// Update contact data for an existing contact person. Any non-contact data will not be modified. Any non-contact data in the person to update will be ignored. All fields specified in the `update_mask` will be replaced. The server returns a 400 error if `person.metadata.sources` is not specified for the contact to be updated or if there is no contact source. The server returns a 400 error with reason `"failedPrecondition"` if `person.metadata.sources.etag` is different than the contact's etag, which indicates the contact has changed since its data was read. Clients should get the latest person and merge their updates into the latest person. If making sequential updates to the same person, the etag from the `updateContact` response should be used to avoid failures. The server returns a 400 error if `memberships` are being updated and there are no contact group memberships specified on the person. The server returns a 400 error if more than one field is specified on a field that is a singleton for contact sources: * biographies * birthdays * genders * names Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
9931///
9932/// A builder for the *updateContact* method supported by a *person* resource.
9933/// It is not used directly, but through a [`PersonMethods`] instance.
9934///
9935/// # Example
9936///
9937/// Instantiate a resource method builder
9938///
9939/// ```test_harness,no_run
9940/// # extern crate hyper;
9941/// # extern crate hyper_rustls;
9942/// # extern crate google_people1 as people1;
9943/// use people1::api::Person;
9944/// # async fn dox() {
9945/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9946///
9947/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9948/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9949/// # .with_native_roots()
9950/// # .unwrap()
9951/// # .https_only()
9952/// # .enable_http2()
9953/// # .build();
9954///
9955/// # let executor = hyper_util::rt::TokioExecutor::new();
9956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9957/// # secret,
9958/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9959/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9960/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9961/// # ),
9962/// # ).build().await.unwrap();
9963///
9964/// # let client = hyper_util::client::legacy::Client::builder(
9965/// # hyper_util::rt::TokioExecutor::new()
9966/// # )
9967/// # .build(
9968/// # hyper_rustls::HttpsConnectorBuilder::new()
9969/// # .with_native_roots()
9970/// # .unwrap()
9971/// # .https_or_http()
9972/// # .enable_http2()
9973/// # .build()
9974/// # );
9975/// # let mut hub = PeopleService::new(client, auth);
9976/// // As the method needs a request, you would usually fill it with the desired information
9977/// // into the respective structure. Some of the parts shown here might not be applicable !
9978/// // Values shown here are possibly random and not representative !
9979/// let mut req = Person::default();
9980///
9981/// // You can configure optional parameters by calling the respective setters at will, and
9982/// // execute the final call using `doit()`.
9983/// // Values shown here are possibly random and not representative !
9984/// let result = hub.people().update_contact(req, "resourceName")
9985/// .update_person_fields(FieldMask::new::<&str>(&[]))
9986/// .add_sources("dolor")
9987/// .person_fields(FieldMask::new::<&str>(&[]))
9988/// .doit().await;
9989/// # }
9990/// ```
9991pub struct PersonUpdateContactCall<'a, C>
9992where
9993 C: 'a,
9994{
9995 hub: &'a PeopleService<C>,
9996 _request: Person,
9997 _resource_name: String,
9998 _update_person_fields: Option<common::FieldMask>,
9999 _sources: Vec<String>,
10000 _person_fields: Option<common::FieldMask>,
10001 _delegate: Option<&'a mut dyn common::Delegate>,
10002 _additional_params: HashMap<String, String>,
10003 _scopes: BTreeSet<String>,
10004}
10005
10006impl<'a, C> common::CallBuilder for PersonUpdateContactCall<'a, C> {}
10007
10008impl<'a, C> PersonUpdateContactCall<'a, C>
10009where
10010 C: common::Connector,
10011{
10012 /// Perform the operation you have build so far.
10013 pub async fn doit(mut self) -> common::Result<(common::Response, Person)> {
10014 use std::borrow::Cow;
10015 use std::io::{Read, Seek};
10016
10017 use common::{url::Params, ToParts};
10018 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10019
10020 let mut dd = common::DefaultDelegate;
10021 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10022 dlg.begin(common::MethodInfo {
10023 id: "people.people.updateContact",
10024 http_method: hyper::Method::PATCH,
10025 });
10026
10027 for &field in [
10028 "alt",
10029 "resourceName",
10030 "updatePersonFields",
10031 "sources",
10032 "personFields",
10033 ]
10034 .iter()
10035 {
10036 if self._additional_params.contains_key(field) {
10037 dlg.finished(false);
10038 return Err(common::Error::FieldClash(field));
10039 }
10040 }
10041
10042 let mut params = Params::with_capacity(7 + self._additional_params.len());
10043 params.push("resourceName", self._resource_name);
10044 if let Some(value) = self._update_person_fields.as_ref() {
10045 params.push("updatePersonFields", value.to_string());
10046 }
10047 if !self._sources.is_empty() {
10048 for f in self._sources.iter() {
10049 params.push("sources", f);
10050 }
10051 }
10052 if let Some(value) = self._person_fields.as_ref() {
10053 params.push("personFields", value.to_string());
10054 }
10055
10056 params.extend(self._additional_params.iter());
10057
10058 params.push("alt", "json");
10059 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}:updateContact";
10060 if self._scopes.is_empty() {
10061 self._scopes.insert(Scope::Contact.as_ref().to_string());
10062 }
10063
10064 #[allow(clippy::single_element_loop)]
10065 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
10066 url = params.uri_replacement(url, param_name, find_this, true);
10067 }
10068 {
10069 let to_remove = ["resourceName"];
10070 params.remove_params(&to_remove);
10071 }
10072
10073 let url = params.parse_with_url(&url);
10074
10075 let mut json_mime_type = mime::APPLICATION_JSON;
10076 let mut request_value_reader = {
10077 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10078 common::remove_json_null_values(&mut value);
10079 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10080 serde_json::to_writer(&mut dst, &value).unwrap();
10081 dst
10082 };
10083 let request_size = request_value_reader
10084 .seek(std::io::SeekFrom::End(0))
10085 .unwrap();
10086 request_value_reader
10087 .seek(std::io::SeekFrom::Start(0))
10088 .unwrap();
10089
10090 loop {
10091 let token = match self
10092 .hub
10093 .auth
10094 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10095 .await
10096 {
10097 Ok(token) => token,
10098 Err(e) => match dlg.token(e) {
10099 Ok(token) => token,
10100 Err(e) => {
10101 dlg.finished(false);
10102 return Err(common::Error::MissingToken(e));
10103 }
10104 },
10105 };
10106 request_value_reader
10107 .seek(std::io::SeekFrom::Start(0))
10108 .unwrap();
10109 let mut req_result = {
10110 let client = &self.hub.client;
10111 dlg.pre_request();
10112 let mut req_builder = hyper::Request::builder()
10113 .method(hyper::Method::PATCH)
10114 .uri(url.as_str())
10115 .header(USER_AGENT, self.hub._user_agent.clone());
10116
10117 if let Some(token) = token.as_ref() {
10118 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10119 }
10120
10121 let request = req_builder
10122 .header(CONTENT_TYPE, json_mime_type.to_string())
10123 .header(CONTENT_LENGTH, request_size as u64)
10124 .body(common::to_body(
10125 request_value_reader.get_ref().clone().into(),
10126 ));
10127
10128 client.request(request.unwrap()).await
10129 };
10130
10131 match req_result {
10132 Err(err) => {
10133 if let common::Retry::After(d) = dlg.http_error(&err) {
10134 sleep(d).await;
10135 continue;
10136 }
10137 dlg.finished(false);
10138 return Err(common::Error::HttpError(err));
10139 }
10140 Ok(res) => {
10141 let (mut parts, body) = res.into_parts();
10142 let mut body = common::Body::new(body);
10143 if !parts.status.is_success() {
10144 let bytes = common::to_bytes(body).await.unwrap_or_default();
10145 let error = serde_json::from_str(&common::to_string(&bytes));
10146 let response = common::to_response(parts, bytes.into());
10147
10148 if let common::Retry::After(d) =
10149 dlg.http_failure(&response, error.as_ref().ok())
10150 {
10151 sleep(d).await;
10152 continue;
10153 }
10154
10155 dlg.finished(false);
10156
10157 return Err(match error {
10158 Ok(value) => common::Error::BadRequest(value),
10159 _ => common::Error::Failure(response),
10160 });
10161 }
10162 let response = {
10163 let bytes = common::to_bytes(body).await.unwrap_or_default();
10164 let encoded = common::to_string(&bytes);
10165 match serde_json::from_str(&encoded) {
10166 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10167 Err(error) => {
10168 dlg.response_json_decode_error(&encoded, &error);
10169 return Err(common::Error::JsonDecodeError(
10170 encoded.to_string(),
10171 error,
10172 ));
10173 }
10174 }
10175 };
10176
10177 dlg.finished(true);
10178 return Ok(response);
10179 }
10180 }
10181 }
10182 }
10183
10184 ///
10185 /// Sets the *request* property to the given value.
10186 ///
10187 /// Even though the property as already been set when instantiating this call,
10188 /// we provide this method for API completeness.
10189 pub fn request(mut self, new_value: Person) -> PersonUpdateContactCall<'a, C> {
10190 self._request = new_value;
10191 self
10192 }
10193 /// The resource name for the person, assigned by the server. An ASCII string in the form of `people/{person_id}`.
10194 ///
10195 /// Sets the *resource name* path property to the given value.
10196 ///
10197 /// Even though the property as already been set when instantiating this call,
10198 /// we provide this method for API completeness.
10199 pub fn resource_name(mut self, new_value: &str) -> PersonUpdateContactCall<'a, C> {
10200 self._resource_name = new_value.to_string();
10201 self
10202 }
10203 /// Required. A field mask to restrict which fields on the person are updated. Multiple fields can be specified by separating them with commas. All updated fields will be replaced. Valid values are: * addresses * biographies * birthdays * calendarUrls * clientData * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * relations * sipAddresses * urls * userDefined
10204 ///
10205 /// Sets the *update person fields* query property to the given value.
10206 pub fn update_person_fields(
10207 mut self,
10208 new_value: common::FieldMask,
10209 ) -> PersonUpdateContactCall<'a, C> {
10210 self._update_person_fields = Some(new_value);
10211 self
10212 }
10213 /// Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
10214 ///
10215 /// Append the given value to the *sources* query property.
10216 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10217 pub fn add_sources(mut self, new_value: &str) -> PersonUpdateContactCall<'a, C> {
10218 self._sources.push(new_value.to_string());
10219 self
10220 }
10221 /// Optional. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Defaults to all fields if not set. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
10222 ///
10223 /// Sets the *person fields* query property to the given value.
10224 pub fn person_fields(mut self, new_value: common::FieldMask) -> PersonUpdateContactCall<'a, C> {
10225 self._person_fields = Some(new_value);
10226 self
10227 }
10228 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10229 /// while executing the actual API request.
10230 ///
10231 /// ````text
10232 /// It should be used to handle progress information, and to implement a certain level of resilience.
10233 /// ````
10234 ///
10235 /// Sets the *delegate* property to the given value.
10236 pub fn delegate(
10237 mut self,
10238 new_value: &'a mut dyn common::Delegate,
10239 ) -> PersonUpdateContactCall<'a, C> {
10240 self._delegate = Some(new_value);
10241 self
10242 }
10243
10244 /// Set any additional parameter of the query string used in the request.
10245 /// It should be used to set parameters which are not yet available through their own
10246 /// setters.
10247 ///
10248 /// Please note that this method must not be used to set any of the known parameters
10249 /// which have their own setter method. If done anyway, the request will fail.
10250 ///
10251 /// # Additional Parameters
10252 ///
10253 /// * *$.xgafv* (query-string) - V1 error format.
10254 /// * *access_token* (query-string) - OAuth access token.
10255 /// * *alt* (query-string) - Data format for response.
10256 /// * *callback* (query-string) - JSONP
10257 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10258 /// * *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.
10259 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10260 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10261 /// * *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.
10262 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10263 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10264 pub fn param<T>(mut self, name: T, value: T) -> PersonUpdateContactCall<'a, C>
10265 where
10266 T: AsRef<str>,
10267 {
10268 self._additional_params
10269 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10270 self
10271 }
10272
10273 /// Identifies the authorization scope for the method you are building.
10274 ///
10275 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10276 /// [`Scope::Contact`].
10277 ///
10278 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10279 /// tokens for more than one scope.
10280 ///
10281 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10282 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10283 /// sufficient, a read-write scope will do as well.
10284 pub fn add_scope<St>(mut self, scope: St) -> PersonUpdateContactCall<'a, C>
10285 where
10286 St: AsRef<str>,
10287 {
10288 self._scopes.insert(String::from(scope.as_ref()));
10289 self
10290 }
10291 /// Identifies the authorization scope(s) for the method you are building.
10292 ///
10293 /// See [`Self::add_scope()`] for details.
10294 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonUpdateContactCall<'a, C>
10295 where
10296 I: IntoIterator<Item = St>,
10297 St: AsRef<str>,
10298 {
10299 self._scopes
10300 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10301 self
10302 }
10303
10304 /// Removes all scopes, and no default scope will be used either.
10305 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10306 /// for details).
10307 pub fn clear_scopes(mut self) -> PersonUpdateContactCall<'a, C> {
10308 self._scopes.clear();
10309 self
10310 }
10311}
10312
10313/// Update a contact's photo. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.
10314///
10315/// A builder for the *updateContactPhoto* method supported by a *person* resource.
10316/// It is not used directly, but through a [`PersonMethods`] instance.
10317///
10318/// # Example
10319///
10320/// Instantiate a resource method builder
10321///
10322/// ```test_harness,no_run
10323/// # extern crate hyper;
10324/// # extern crate hyper_rustls;
10325/// # extern crate google_people1 as people1;
10326/// use people1::api::UpdateContactPhotoRequest;
10327/// # async fn dox() {
10328/// # use people1::{PeopleService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10329///
10330/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10331/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10332/// # .with_native_roots()
10333/// # .unwrap()
10334/// # .https_only()
10335/// # .enable_http2()
10336/// # .build();
10337///
10338/// # let executor = hyper_util::rt::TokioExecutor::new();
10339/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10340/// # secret,
10341/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10342/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10343/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10344/// # ),
10345/// # ).build().await.unwrap();
10346///
10347/// # let client = hyper_util::client::legacy::Client::builder(
10348/// # hyper_util::rt::TokioExecutor::new()
10349/// # )
10350/// # .build(
10351/// # hyper_rustls::HttpsConnectorBuilder::new()
10352/// # .with_native_roots()
10353/// # .unwrap()
10354/// # .https_or_http()
10355/// # .enable_http2()
10356/// # .build()
10357/// # );
10358/// # let mut hub = PeopleService::new(client, auth);
10359/// // As the method needs a request, you would usually fill it with the desired information
10360/// // into the respective structure. Some of the parts shown here might not be applicable !
10361/// // Values shown here are possibly random and not representative !
10362/// let mut req = UpdateContactPhotoRequest::default();
10363///
10364/// // You can configure optional parameters by calling the respective setters at will, and
10365/// // execute the final call using `doit()`.
10366/// // Values shown here are possibly random and not representative !
10367/// let result = hub.people().update_contact_photo(req, "resourceName")
10368/// .doit().await;
10369/// # }
10370/// ```
10371pub struct PersonUpdateContactPhotoCall<'a, C>
10372where
10373 C: 'a,
10374{
10375 hub: &'a PeopleService<C>,
10376 _request: UpdateContactPhotoRequest,
10377 _resource_name: String,
10378 _delegate: Option<&'a mut dyn common::Delegate>,
10379 _additional_params: HashMap<String, String>,
10380 _scopes: BTreeSet<String>,
10381}
10382
10383impl<'a, C> common::CallBuilder for PersonUpdateContactPhotoCall<'a, C> {}
10384
10385impl<'a, C> PersonUpdateContactPhotoCall<'a, C>
10386where
10387 C: common::Connector,
10388{
10389 /// Perform the operation you have build so far.
10390 pub async fn doit(mut self) -> common::Result<(common::Response, UpdateContactPhotoResponse)> {
10391 use std::borrow::Cow;
10392 use std::io::{Read, Seek};
10393
10394 use common::{url::Params, ToParts};
10395 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10396
10397 let mut dd = common::DefaultDelegate;
10398 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10399 dlg.begin(common::MethodInfo {
10400 id: "people.people.updateContactPhoto",
10401 http_method: hyper::Method::PATCH,
10402 });
10403
10404 for &field in ["alt", "resourceName"].iter() {
10405 if self._additional_params.contains_key(field) {
10406 dlg.finished(false);
10407 return Err(common::Error::FieldClash(field));
10408 }
10409 }
10410
10411 let mut params = Params::with_capacity(4 + self._additional_params.len());
10412 params.push("resourceName", self._resource_name);
10413
10414 params.extend(self._additional_params.iter());
10415
10416 params.push("alt", "json");
10417 let mut url = self.hub._base_url.clone() + "v1/{+resourceName}:updateContactPhoto";
10418 if self._scopes.is_empty() {
10419 self._scopes.insert(Scope::Contact.as_ref().to_string());
10420 }
10421
10422 #[allow(clippy::single_element_loop)]
10423 for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() {
10424 url = params.uri_replacement(url, param_name, find_this, true);
10425 }
10426 {
10427 let to_remove = ["resourceName"];
10428 params.remove_params(&to_remove);
10429 }
10430
10431 let url = params.parse_with_url(&url);
10432
10433 let mut json_mime_type = mime::APPLICATION_JSON;
10434 let mut request_value_reader = {
10435 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10436 common::remove_json_null_values(&mut value);
10437 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10438 serde_json::to_writer(&mut dst, &value).unwrap();
10439 dst
10440 };
10441 let request_size = request_value_reader
10442 .seek(std::io::SeekFrom::End(0))
10443 .unwrap();
10444 request_value_reader
10445 .seek(std::io::SeekFrom::Start(0))
10446 .unwrap();
10447
10448 loop {
10449 let token = match self
10450 .hub
10451 .auth
10452 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10453 .await
10454 {
10455 Ok(token) => token,
10456 Err(e) => match dlg.token(e) {
10457 Ok(token) => token,
10458 Err(e) => {
10459 dlg.finished(false);
10460 return Err(common::Error::MissingToken(e));
10461 }
10462 },
10463 };
10464 request_value_reader
10465 .seek(std::io::SeekFrom::Start(0))
10466 .unwrap();
10467 let mut req_result = {
10468 let client = &self.hub.client;
10469 dlg.pre_request();
10470 let mut req_builder = hyper::Request::builder()
10471 .method(hyper::Method::PATCH)
10472 .uri(url.as_str())
10473 .header(USER_AGENT, self.hub._user_agent.clone());
10474
10475 if let Some(token) = token.as_ref() {
10476 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10477 }
10478
10479 let request = req_builder
10480 .header(CONTENT_TYPE, json_mime_type.to_string())
10481 .header(CONTENT_LENGTH, request_size as u64)
10482 .body(common::to_body(
10483 request_value_reader.get_ref().clone().into(),
10484 ));
10485
10486 client.request(request.unwrap()).await
10487 };
10488
10489 match req_result {
10490 Err(err) => {
10491 if let common::Retry::After(d) = dlg.http_error(&err) {
10492 sleep(d).await;
10493 continue;
10494 }
10495 dlg.finished(false);
10496 return Err(common::Error::HttpError(err));
10497 }
10498 Ok(res) => {
10499 let (mut parts, body) = res.into_parts();
10500 let mut body = common::Body::new(body);
10501 if !parts.status.is_success() {
10502 let bytes = common::to_bytes(body).await.unwrap_or_default();
10503 let error = serde_json::from_str(&common::to_string(&bytes));
10504 let response = common::to_response(parts, bytes.into());
10505
10506 if let common::Retry::After(d) =
10507 dlg.http_failure(&response, error.as_ref().ok())
10508 {
10509 sleep(d).await;
10510 continue;
10511 }
10512
10513 dlg.finished(false);
10514
10515 return Err(match error {
10516 Ok(value) => common::Error::BadRequest(value),
10517 _ => common::Error::Failure(response),
10518 });
10519 }
10520 let response = {
10521 let bytes = common::to_bytes(body).await.unwrap_or_default();
10522 let encoded = common::to_string(&bytes);
10523 match serde_json::from_str(&encoded) {
10524 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10525 Err(error) => {
10526 dlg.response_json_decode_error(&encoded, &error);
10527 return Err(common::Error::JsonDecodeError(
10528 encoded.to_string(),
10529 error,
10530 ));
10531 }
10532 }
10533 };
10534
10535 dlg.finished(true);
10536 return Ok(response);
10537 }
10538 }
10539 }
10540 }
10541
10542 ///
10543 /// Sets the *request* property to the given value.
10544 ///
10545 /// Even though the property as already been set when instantiating this call,
10546 /// we provide this method for API completeness.
10547 pub fn request(
10548 mut self,
10549 new_value: UpdateContactPhotoRequest,
10550 ) -> PersonUpdateContactPhotoCall<'a, C> {
10551 self._request = new_value;
10552 self
10553 }
10554 /// Required. Person resource name
10555 ///
10556 /// Sets the *resource name* path property to the given value.
10557 ///
10558 /// Even though the property as already been set when instantiating this call,
10559 /// we provide this method for API completeness.
10560 pub fn resource_name(mut self, new_value: &str) -> PersonUpdateContactPhotoCall<'a, C> {
10561 self._resource_name = new_value.to_string();
10562 self
10563 }
10564 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10565 /// while executing the actual API request.
10566 ///
10567 /// ````text
10568 /// It should be used to handle progress information, and to implement a certain level of resilience.
10569 /// ````
10570 ///
10571 /// Sets the *delegate* property to the given value.
10572 pub fn delegate(
10573 mut self,
10574 new_value: &'a mut dyn common::Delegate,
10575 ) -> PersonUpdateContactPhotoCall<'a, C> {
10576 self._delegate = Some(new_value);
10577 self
10578 }
10579
10580 /// Set any additional parameter of the query string used in the request.
10581 /// It should be used to set parameters which are not yet available through their own
10582 /// setters.
10583 ///
10584 /// Please note that this method must not be used to set any of the known parameters
10585 /// which have their own setter method. If done anyway, the request will fail.
10586 ///
10587 /// # Additional Parameters
10588 ///
10589 /// * *$.xgafv* (query-string) - V1 error format.
10590 /// * *access_token* (query-string) - OAuth access token.
10591 /// * *alt* (query-string) - Data format for response.
10592 /// * *callback* (query-string) - JSONP
10593 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10594 /// * *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.
10595 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10596 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10597 /// * *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.
10598 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10599 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10600 pub fn param<T>(mut self, name: T, value: T) -> PersonUpdateContactPhotoCall<'a, C>
10601 where
10602 T: AsRef<str>,
10603 {
10604 self._additional_params
10605 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10606 self
10607 }
10608
10609 /// Identifies the authorization scope for the method you are building.
10610 ///
10611 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10612 /// [`Scope::Contact`].
10613 ///
10614 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10615 /// tokens for more than one scope.
10616 ///
10617 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10618 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10619 /// sufficient, a read-write scope will do as well.
10620 pub fn add_scope<St>(mut self, scope: St) -> PersonUpdateContactPhotoCall<'a, C>
10621 where
10622 St: AsRef<str>,
10623 {
10624 self._scopes.insert(String::from(scope.as_ref()));
10625 self
10626 }
10627 /// Identifies the authorization scope(s) for the method you are building.
10628 ///
10629 /// See [`Self::add_scope()`] for details.
10630 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonUpdateContactPhotoCall<'a, C>
10631 where
10632 I: IntoIterator<Item = St>,
10633 St: AsRef<str>,
10634 {
10635 self._scopes
10636 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10637 self
10638 }
10639
10640 /// Removes all scopes, and no default scope will be used either.
10641 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10642 /// for details).
10643 pub fn clear_scopes(mut self) -> PersonUpdateContactPhotoCall<'a, C> {
10644 self._scopes.clear();
10645 self
10646 }
10647}