google_plus1/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 /// View your basic profile info, including your age range and language
17 Login,
18
19 /// Associate you with your personal info on Google
20 Me,
21
22 /// View your email address
23 UserinfoEmail,
24
25 /// See your personal info, including any personal info you've made publicly available
26 UserinfoProfile,
27}
28
29impl AsRef<str> for Scope {
30 fn as_ref(&self) -> &str {
31 match *self {
32 Scope::Login => "https://www.googleapis.com/auth/plus.login",
33 Scope::Me => "https://www.googleapis.com/auth/plus.me",
34 Scope::UserinfoEmail => "https://www.googleapis.com/auth/userinfo.email",
35 Scope::UserinfoProfile => "https://www.googleapis.com/auth/userinfo.profile",
36 }
37 }
38}
39
40#[allow(clippy::derivable_impls)]
41impl Default for Scope {
42 fn default() -> Scope {
43 Scope::Me
44 }
45}
46
47// ########
48// HUB ###
49// ######
50
51/// Central instance to access all Plus related resource activities
52///
53/// # Examples
54///
55/// Instantiate a new hub
56///
57/// ```test_harness,no_run
58/// extern crate hyper;
59/// extern crate hyper_rustls;
60/// extern crate google_plus1 as plus1;
61/// use plus1::{Result, Error};
62/// # async fn dox() {
63/// use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
64///
65/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
66/// // `client_secret`, among other things.
67/// let secret: yup_oauth2::ApplicationSecret = Default::default();
68/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
69/// // unless you replace `None` with the desired Flow.
70/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
71/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
72/// // retrieve them from storage.
73/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
74/// .with_native_roots()
75/// .unwrap()
76/// .https_only()
77/// .enable_http2()
78/// .build();
79///
80/// let executor = hyper_util::rt::TokioExecutor::new();
81/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
82/// secret,
83/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
84/// yup_oauth2::client::CustomHyperClientBuilder::from(
85/// hyper_util::client::legacy::Client::builder(executor).build(connector),
86/// ),
87/// ).build().await.unwrap();
88///
89/// let client = hyper_util::client::legacy::Client::builder(
90/// hyper_util::rt::TokioExecutor::new()
91/// )
92/// .build(
93/// hyper_rustls::HttpsConnectorBuilder::new()
94/// .with_native_roots()
95/// .unwrap()
96/// .https_or_http()
97/// .enable_http2()
98/// .build()
99/// );
100/// let mut hub = Plus::new(client, auth);
101/// // You can configure optional parameters by calling the respective setters at will, and
102/// // execute the final call using `doit()`.
103/// // Values shown here are possibly random and not representative !
104/// let result = hub.people().list("userId", "collection")
105/// .page_token("ipsum")
106/// .order_by("gubergren")
107/// .max_results(50)
108/// .doit().await;
109///
110/// match result {
111/// Err(e) => match e {
112/// // The Error enum provides details about what exactly happened.
113/// // You can also just use its `Debug`, `Display` or `Error` traits
114/// Error::HttpError(_)
115/// |Error::Io(_)
116/// |Error::MissingAPIKey
117/// |Error::MissingToken(_)
118/// |Error::Cancelled
119/// |Error::UploadSizeLimitExceeded(_, _)
120/// |Error::Failure(_)
121/// |Error::BadRequest(_)
122/// |Error::FieldClash(_)
123/// |Error::JsonDecodeError(_, _) => println!("{}", e),
124/// },
125/// Ok(res) => println!("Success: {:?}", res),
126/// }
127/// # }
128/// ```
129#[derive(Clone)]
130pub struct Plus<C> {
131 pub client: common::Client<C>,
132 pub auth: Box<dyn common::GetToken>,
133 _user_agent: String,
134 _base_url: String,
135 _root_url: String,
136}
137
138impl<C> common::Hub for Plus<C> {}
139
140impl<'a, C> Plus<C> {
141 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Plus<C> {
142 Plus {
143 client,
144 auth: Box::new(auth),
145 _user_agent: "google-api-rust-client/7.0.0".to_string(),
146 _base_url: "https://www.googleapis.com/plus/v1/".to_string(),
147 _root_url: "https://www.googleapis.com/".to_string(),
148 }
149 }
150
151 pub fn activities(&'a self) -> ActivityMethods<'a, C> {
152 ActivityMethods { hub: self }
153 }
154 pub fn comments(&'a self) -> CommentMethods<'a, C> {
155 CommentMethods { hub: self }
156 }
157 pub fn people(&'a self) -> PersonMethods<'a, C> {
158 PersonMethods { hub: self }
159 }
160
161 /// Set the user-agent header field to use in all requests to the server.
162 /// It defaults to `google-api-rust-client/7.0.0`.
163 ///
164 /// Returns the previously set user-agent.
165 pub fn user_agent(&mut self, agent_name: String) -> String {
166 std::mem::replace(&mut self._user_agent, agent_name)
167 }
168
169 /// Set the base url to use in all requests to the server.
170 /// It defaults to `https://www.googleapis.com/plus/v1/`.
171 ///
172 /// Returns the previously set base url.
173 pub fn base_url(&mut self, new_base_url: String) -> String {
174 std::mem::replace(&mut self._base_url, new_base_url)
175 }
176
177 /// Set the root url to use in all requests to the server.
178 /// It defaults to `https://www.googleapis.com/`.
179 ///
180 /// Returns the previously set root url.
181 pub fn root_url(&mut self, new_root_url: String) -> String {
182 std::mem::replace(&mut self._root_url, new_root_url)
183 }
184}
185
186// ############
187// SCHEMAS ###
188// ##########
189/// There is no detailed description.
190///
191/// This type is not used in any activity, and only used as *part* of another schema.
192///
193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
194#[serde_with::serde_as]
195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
196pub struct Acl {
197 /// Description of the access granted, suitable for display.
198 pub description: Option<String>,
199 /// The list of access entries.
200 pub items: Option<Vec<PlusAclentryResource>>,
201 /// Identifies this resource as a collection of access controls. Value: "plus#acl".
202 pub kind: Option<String>,
203}
204
205impl common::Part for Acl {}
206
207/// There is no detailed description.
208///
209/// # Activities
210///
211/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
212/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
213///
214/// * [get activities](ActivityGetCall) (response)
215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
216#[serde_with::serde_as]
217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
218pub struct Activity {
219 /// Identifies who has access to see this activity.
220 pub access: Option<Acl>,
221 /// The person who performed this activity.
222 pub actor: Option<ActivityActor>,
223 /// Street address where this activity occurred.
224 pub address: Option<String>,
225 /// Additional content added by the person who shared this activity, applicable only when resharing an activity.
226 pub annotation: Option<String>,
227 /// If this activity is a crosspost from another system, this property specifies the ID of the original activity.
228 #[serde(rename = "crosspostSource")]
229 pub crosspost_source: Option<String>,
230 /// ETag of this response for caching purposes.
231 pub etag: Option<String>,
232 /// Latitude and longitude where this activity occurred. Format is latitude followed by longitude, space separated.
233 pub geocode: Option<String>,
234 /// The ID of this activity.
235 pub id: Option<String>,
236 /// Identifies this resource as an activity. Value: "plus#activity".
237 pub kind: Option<String>,
238 /// The location where this activity occurred.
239 pub location: Option<Place>,
240 /// The object of this activity.
241 pub object: Option<ActivityObject>,
242 /// ID of the place where this activity occurred.
243 #[serde(rename = "placeId")]
244 pub place_id: Option<String>,
245 /// Name of the place where this activity occurred.
246 #[serde(rename = "placeName")]
247 pub place_name: Option<String>,
248 /// The service provider that initially published this activity.
249 pub provider: Option<ActivityProvider>,
250 /// The time at which this activity was initially published. Formatted as an RFC 3339 timestamp.
251 pub published: Option<chrono::DateTime<chrono::offset::Utc>>,
252 /// Radius, in meters, of the region where this activity occurred, centered at the latitude and longitude identified in geocode.
253 pub radius: Option<String>,
254 /// Title of this activity.
255 pub title: Option<String>,
256 /// The time at which this activity was last updated. Formatted as an RFC 3339 timestamp.
257 pub updated: Option<chrono::DateTime<chrono::offset::Utc>>,
258 /// The link to this activity.
259 pub url: Option<String>,
260 /// This activity's verb, which indicates the action that was performed. Possible values include, but are not limited to, the following values:
261 /// - "post" - Publish content to the stream.
262 /// - "share" - Reshare an activity.
263 pub verb: Option<String>,
264}
265
266impl common::ResponseResult for Activity {}
267
268/// There is no detailed description.
269///
270/// # Activities
271///
272/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
273/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
274///
275/// * [list activities](ActivityListCall) (response)
276/// * [search activities](ActivitySearchCall) (response)
277#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
278#[serde_with::serde_as]
279#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
280pub struct ActivityFeed {
281 /// ETag of this response for caching purposes.
282 pub etag: Option<String>,
283 /// The ID of this collection of activities. Deprecated.
284 pub id: Option<String>,
285 /// The activities in this page of results.
286 pub items: Option<Vec<Activity>>,
287 /// Identifies this resource as a collection of activities. Value: "plus#activityFeed".
288 pub kind: Option<String>,
289 /// Link to the next page of activities.
290 #[serde(rename = "nextLink")]
291 pub next_link: Option<String>,
292 /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results.
293 #[serde(rename = "nextPageToken")]
294 pub next_page_token: Option<String>,
295 /// Link to this activity resource.
296 #[serde(rename = "selfLink")]
297 pub self_link: Option<String>,
298 /// The title of this collection of activities, which is a truncated portion of the content.
299 pub title: Option<String>,
300 /// The time at which this collection of activities was last updated. Formatted as an RFC 3339 timestamp.
301 pub updated: Option<chrono::DateTime<chrono::offset::Utc>>,
302}
303
304impl common::ResponseResult for ActivityFeed {}
305
306/// There is no detailed description.
307///
308/// # Activities
309///
310/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
311/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
312///
313/// * [get comments](CommentGetCall) (response)
314/// * [list comments](CommentListCall) (none)
315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
316#[serde_with::serde_as]
317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
318pub struct Comment {
319 /// The person who posted this comment.
320 pub actor: Option<CommentActor>,
321 /// ETag of this response for caching purposes.
322 pub etag: Option<String>,
323 /// The ID of this comment.
324 pub id: Option<String>,
325 /// The activity this comment replied to.
326 #[serde(rename = "inReplyTo")]
327 pub in_reply_to: Option<Vec<CommentInReplyTo>>,
328 /// Identifies this resource as a comment. Value: "plus#comment".
329 pub kind: Option<String>,
330 /// The object of this comment.
331 pub object: Option<CommentObject>,
332 /// People who +1'd this comment.
333 pub plusoners: Option<CommentPlusoners>,
334 /// The time at which this comment was initially published. Formatted as an RFC 3339 timestamp.
335 pub published: Option<chrono::DateTime<chrono::offset::Utc>>,
336 /// Link to this comment resource.
337 #[serde(rename = "selfLink")]
338 pub self_link: Option<String>,
339 /// The time at which this comment was last updated. Formatted as an RFC 3339 timestamp.
340 pub updated: Option<chrono::DateTime<chrono::offset::Utc>>,
341 /// This comment's verb, indicating what action was performed. Possible values are:
342 /// - "post" - Publish content to the stream.
343 pub verb: Option<String>,
344}
345
346impl common::Resource for Comment {}
347impl common::ResponseResult for Comment {}
348
349/// There is no detailed description.
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/// * [list comments](CommentListCall) (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 CommentFeed {
361 /// ETag of this response for caching purposes.
362 pub etag: Option<String>,
363 /// The ID of this collection of comments.
364 pub id: Option<String>,
365 /// The comments in this page of results.
366 pub items: Option<Vec<Comment>>,
367 /// Identifies this resource as a collection of comments. Value: "plus#commentFeed".
368 pub kind: Option<String>,
369 /// Link to the next page of activities.
370 #[serde(rename = "nextLink")]
371 pub next_link: Option<String>,
372 /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results.
373 #[serde(rename = "nextPageToken")]
374 pub next_page_token: Option<String>,
375 /// The title of this collection of comments.
376 pub title: Option<String>,
377 /// The time at which this collection of comments was last updated. Formatted as an RFC 3339 timestamp.
378 pub updated: Option<chrono::DateTime<chrono::offset::Utc>>,
379}
380
381impl common::ResponseResult for CommentFeed {}
382
383/// There is no detailed description.
384///
385/// # Activities
386///
387/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
388/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
389///
390/// * [list people](PersonListCall) (response)
391/// * [list by activity people](PersonListByActivityCall) (response)
392/// * [search people](PersonSearchCall) (response)
393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
394#[serde_with::serde_as]
395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
396pub struct PeopleFeed {
397 /// ETag of this response for caching purposes.
398 pub etag: Option<String>,
399 /// The people in this page of results. Each item includes the id, displayName, image, and url for the person. To retrieve additional profile data, see the people.get method.
400 pub items: Option<Vec<Person>>,
401 /// Identifies this resource as a collection of people. Value: "plus#peopleFeed".
402 pub kind: Option<String>,
403 /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results.
404 #[serde(rename = "nextPageToken")]
405 pub next_page_token: Option<String>,
406 /// Link to this resource.
407 #[serde(rename = "selfLink")]
408 pub self_link: Option<String>,
409 /// The title of this collection of people.
410 pub title: Option<String>,
411 /// The total number of people available in this list. The number of people in a response might be smaller due to paging. This might not be set for all collections.
412 #[serde(rename = "totalItems")]
413 pub total_items: Option<i32>,
414}
415
416impl common::ResponseResult for PeopleFeed {}
417
418/// There is no detailed description.
419///
420/// # Activities
421///
422/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
423/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
424///
425/// * [get people](PersonGetCall) (response)
426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
427#[serde_with::serde_as]
428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
429pub struct Person {
430 /// A short biography for this person.
431 #[serde(rename = "aboutMe")]
432 pub about_me: Option<String>,
433 /// The age range of the person. Valid ranges are 17 or younger, 18 to 20, and 21 or older. Age is determined from the user's birthday using Western age reckoning.
434 #[serde(rename = "ageRange")]
435 pub age_range: Option<PersonAgeRange>,
436 /// The person's date of birth, represented as YYYY-MM-DD.
437 pub birthday: Option<String>,
438 /// The "bragging rights" line of this person.
439 #[serde(rename = "braggingRights")]
440 pub bragging_rights: Option<String>,
441 /// For followers who are visible, the number of people who have added this person or page to a circle.
442 #[serde(rename = "circledByCount")]
443 pub circled_by_count: Option<i32>,
444 /// The cover photo content.
445 pub cover: Option<PersonCover>,
446 /// (this field is not currently used)
447 #[serde(rename = "currentLocation")]
448 pub current_location: Option<String>,
449 /// The name of this person, which is suitable for display.
450 #[serde(rename = "displayName")]
451 pub display_name: Option<String>,
452 /// The hosted domain name for the user's Google Apps account. For instance, example.com. The plus.profile.emails.read or email scope is needed to get this domain name.
453 pub domain: Option<String>,
454 /// A list of email addresses that this person has, including their Google account email address, and the public verified email addresses on their Google+ profile. The plus.profile.emails.read scope is needed to retrieve these email addresses, or the email scope can be used to retrieve just the Google account email address.
455 pub emails: Option<Vec<PersonEmails>>,
456 /// ETag of this response for caching purposes.
457 pub etag: Option<String>,
458 /// The person's gender. Possible values include, but are not limited to, the following values:
459 /// - "male" - Male gender.
460 /// - "female" - Female gender.
461 /// - "other" - Other.
462 pub gender: Option<String>,
463 /// The ID of this person.
464 pub id: Option<String>,
465 /// The representation of the person's profile photo.
466 pub image: Option<PersonImage>,
467 /// Whether this user has signed up for Google+.
468 #[serde(rename = "isPlusUser")]
469 pub is_plus_user: Option<bool>,
470 /// Identifies this resource as a person. Value: "plus#person".
471 pub kind: Option<String>,
472 /// The user's preferred language for rendering.
473 pub language: Option<String>,
474 /// An object representation of the individual components of a person's name.
475 pub name: Option<PersonName>,
476 /// The nickname of this person.
477 pub nickname: Option<String>,
478 /// Type of person within Google+. Possible values include, but are not limited to, the following values:
479 /// - "person" - represents an actual person.
480 /// - "page" - represents a page.
481 #[serde(rename = "objectType")]
482 pub object_type: Option<String>,
483 /// The occupation of this person.
484 pub occupation: Option<String>,
485 /// A list of current or past organizations with which this person is associated.
486 pub organizations: Option<Vec<PersonOrganizations>>,
487 /// A list of places where this person has lived.
488 #[serde(rename = "placesLived")]
489 pub places_lived: Option<Vec<PersonPlacesLived>>,
490 /// If a Google+ Page, the number of people who have +1'd this page.
491 #[serde(rename = "plusOneCount")]
492 pub plus_one_count: Option<i32>,
493 /// The person's relationship status. Possible values include, but are not limited to, the following values:
494 /// - "single" - Person is single.
495 /// - "in_a_relationship" - Person is in a relationship.
496 /// - "engaged" - Person is engaged.
497 /// - "married" - Person is married.
498 /// - "its_complicated" - The relationship is complicated.
499 /// - "open_relationship" - Person is in an open relationship.
500 /// - "widowed" - Person is widowed.
501 /// - "in_domestic_partnership" - Person is in a domestic partnership.
502 /// - "in_civil_union" - Person is in a civil union.
503 #[serde(rename = "relationshipStatus")]
504 pub relationship_status: Option<String>,
505 /// The person's skills.
506 pub skills: Option<String>,
507 /// The brief description (tagline) of this person.
508 pub tagline: Option<String>,
509 /// The URL of this person's profile.
510 pub url: Option<String>,
511 /// A list of URLs for this person.
512 pub urls: Option<Vec<PersonUrls>>,
513 /// Whether the person or Google+ Page has been verified.
514 pub verified: Option<bool>,
515}
516
517impl common::ResponseResult for Person {}
518
519/// There is no detailed description.
520///
521/// This type is not used in any activity, and only used as *part* of another schema.
522///
523#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
524#[serde_with::serde_as]
525#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
526pub struct Place {
527 /// The physical address of the place.
528 pub address: Option<PlaceAddress>,
529 /// The display name of the place.
530 #[serde(rename = "displayName")]
531 pub display_name: Option<String>,
532 /// The id of the place.
533 pub id: Option<String>,
534 /// Identifies this resource as a place. Value: "plus#place".
535 pub kind: Option<String>,
536 /// The position of the place.
537 pub position: Option<PlacePosition>,
538}
539
540impl common::Part for Place {}
541
542/// There is no detailed description.
543///
544/// This type is not used in any activity, and only used as *part* of another schema.
545///
546#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
547#[serde_with::serde_as]
548#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
549pub struct PlusAclentryResource {
550 /// A descriptive name for this entry. Suitable for display.
551 #[serde(rename = "displayName")]
552 pub display_name: Option<String>,
553 /// The ID of the entry. For entries of type "person" or "circle", this is the ID of the resource. For other types, this property is not set.
554 pub id: Option<String>,
555 /// The type of entry describing to whom access is granted. Possible values are:
556 /// - "person" - Access to an individual.
557 /// - "circle" - Access to members of a circle.
558 /// - "myCircles" - Access to members of all the person's circles.
559 /// - "extendedCircles" - Access to members of all the person's circles, plus all of the people in their circles.
560 /// - "domain" - Access to members of the person's Google Apps domain.
561 /// - "public" - Access to anyone on the web.
562 #[serde(rename = "type")]
563 pub type_: Option<String>,
564}
565
566impl common::Part for PlusAclentryResource {}
567
568/// The person who performed this activity.
569///
570/// This type is not used in any activity, and only used as *part* of another schema.
571///
572#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
573#[serde_with::serde_as]
574#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
575pub struct ActivityActor {
576 /// Actor info specific to particular clients.
577 #[serde(rename = "clientSpecificActorInfo")]
578 pub client_specific_actor_info: Option<ActivityActorClientSpecificActorInfo>,
579 /// The name of the actor, suitable for display.
580 #[serde(rename = "displayName")]
581 pub display_name: Option<String>,
582 /// The ID of the actor's Person resource.
583 pub id: Option<String>,
584 /// The image representation of the actor.
585 pub image: Option<ActivityActorImage>,
586 /// An object representation of the individual components of name.
587 pub name: Option<ActivityActorName>,
588 /// The link to the actor's Google profile.
589 pub url: Option<String>,
590 /// Verification status of actor.
591 pub verification: Option<ActivityActorVerification>,
592}
593
594impl common::NestedType for ActivityActor {}
595impl common::Part for ActivityActor {}
596
597/// Actor info specific to particular clients.
598///
599/// This type is not used in any activity, and only used as *part* of another schema.
600///
601#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
602#[serde_with::serde_as]
603#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
604pub struct ActivityActorClientSpecificActorInfo {
605 /// Actor info specific to YouTube clients.
606 #[serde(rename = "youtubeActorInfo")]
607 pub youtube_actor_info: Option<ActivityActorClientSpecificActorInfoYoutubeActorInfo>,
608}
609
610impl common::NestedType for ActivityActorClientSpecificActorInfo {}
611impl common::Part for ActivityActorClientSpecificActorInfo {}
612
613/// Actor info specific to YouTube clients.
614///
615/// This type is not used in any activity, and only used as *part* of another schema.
616///
617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
618#[serde_with::serde_as]
619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
620pub struct ActivityActorClientSpecificActorInfoYoutubeActorInfo {
621 /// ID of the YouTube channel owned by the Actor.
622 #[serde(rename = "channelId")]
623 pub channel_id: Option<String>,
624}
625
626impl common::NestedType for ActivityActorClientSpecificActorInfoYoutubeActorInfo {}
627impl common::Part for ActivityActorClientSpecificActorInfoYoutubeActorInfo {}
628
629/// The image representation of the actor.
630///
631/// This type is not used in any activity, and only used as *part* of another schema.
632///
633#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
634#[serde_with::serde_as]
635#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
636pub struct ActivityActorImage {
637 /// The URL of the actor's profile photo. To resize the image and crop it to a square, append the query string ?sz=x, where x is the dimension in pixels of each side.
638 pub url: Option<String>,
639}
640
641impl common::NestedType for ActivityActorImage {}
642impl common::Part for ActivityActorImage {}
643
644/// An object representation of the individual components of name.
645///
646/// This type is not used in any activity, and only used as *part* of another schema.
647///
648#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
649#[serde_with::serde_as]
650#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
651pub struct ActivityActorName {
652 /// The family name ("last name") of the actor.
653 #[serde(rename = "familyName")]
654 pub family_name: Option<String>,
655 /// The given name ("first name") of the actor.
656 #[serde(rename = "givenName")]
657 pub given_name: Option<String>,
658}
659
660impl common::NestedType for ActivityActorName {}
661impl common::Part for ActivityActorName {}
662
663/// Verification status of actor.
664///
665/// This type is not used in any activity, and only used as *part* of another schema.
666///
667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
668#[serde_with::serde_as]
669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
670pub struct ActivityActorVerification {
671 /// Verification for one-time or manual processes.
672 #[serde(rename = "adHocVerified")]
673 pub ad_hoc_verified: Option<String>,
674}
675
676impl common::NestedType for ActivityActorVerification {}
677impl common::Part for ActivityActorVerification {}
678
679/// The object of this activity.
680///
681/// This type is not used in any activity, and only used as *part* of another schema.
682///
683#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
684#[serde_with::serde_as]
685#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
686pub struct ActivityObject {
687 /// If this activity's object is itself another activity, such as when a person reshares an activity, this property specifies the original activity's actor.
688 pub actor: Option<ActivityObjectActor>,
689 /// The media objects attached to this activity.
690 pub attachments: Option<Vec<ActivityObjectAttachments>>,
691 /// The HTML-formatted content, which is suitable for display.
692 pub content: Option<String>,
693 /// The ID of the object. When resharing an activity, this is the ID of the activity that is being reshared.
694 pub id: Option<String>,
695 /// The type of the object. Possible values include, but are not limited to, the following values:
696 /// - "note" - Textual content.
697 /// - "activity" - A Google+ activity.
698 #[serde(rename = "objectType")]
699 pub object_type: Option<String>,
700 /// The content (text) as provided by the author, which is stored without any HTML formatting. When creating or updating an activity, this value must be supplied as plain text in the request.
701 #[serde(rename = "originalContent")]
702 pub original_content: Option<String>,
703 /// People who +1'd this activity.
704 pub plusoners: Option<ActivityObjectPlusoners>,
705 /// Comments in reply to this activity.
706 pub replies: Option<ActivityObjectReplies>,
707 /// People who reshared this activity.
708 pub resharers: Option<ActivityObjectResharers>,
709 /// The URL that points to the linked resource.
710 pub url: Option<String>,
711}
712
713impl common::NestedType for ActivityObject {}
714impl common::Part for ActivityObject {}
715
716/// If this activity's object is itself another activity, such as when a person reshares an activity, this property specifies the original activity's actor.
717///
718/// This type is not used in any activity, and only used as *part* of another schema.
719///
720#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
721#[serde_with::serde_as]
722#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
723pub struct ActivityObjectActor {
724 /// Actor info specific to particular clients.
725 #[serde(rename = "clientSpecificActorInfo")]
726 pub client_specific_actor_info: Option<ActivityObjectActorClientSpecificActorInfo>,
727 /// The original actor's name, which is suitable for display.
728 #[serde(rename = "displayName")]
729 pub display_name: Option<String>,
730 /// ID of the original actor.
731 pub id: Option<String>,
732 /// The image representation of the original actor.
733 pub image: Option<ActivityObjectActorImage>,
734 /// A link to the original actor's Google profile.
735 pub url: Option<String>,
736 /// Verification status of actor.
737 pub verification: Option<ActivityObjectActorVerification>,
738}
739
740impl common::NestedType for ActivityObjectActor {}
741impl common::Part for ActivityObjectActor {}
742
743/// Actor info specific to particular clients.
744///
745/// This type is not used in any activity, and only used as *part* of another schema.
746///
747#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
748#[serde_with::serde_as]
749#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
750pub struct ActivityObjectActorClientSpecificActorInfo {
751 /// Actor info specific to YouTube clients.
752 #[serde(rename = "youtubeActorInfo")]
753 pub youtube_actor_info: Option<ActivityObjectActorClientSpecificActorInfoYoutubeActorInfo>,
754}
755
756impl common::NestedType for ActivityObjectActorClientSpecificActorInfo {}
757impl common::Part for ActivityObjectActorClientSpecificActorInfo {}
758
759/// Actor info specific to YouTube clients.
760///
761/// This type is not used in any activity, and only used as *part* of another schema.
762///
763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
764#[serde_with::serde_as]
765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
766pub struct ActivityObjectActorClientSpecificActorInfoYoutubeActorInfo {
767 /// ID of the YouTube channel owned by the Actor.
768 #[serde(rename = "channelId")]
769 pub channel_id: Option<String>,
770}
771
772impl common::NestedType for ActivityObjectActorClientSpecificActorInfoYoutubeActorInfo {}
773impl common::Part for ActivityObjectActorClientSpecificActorInfoYoutubeActorInfo {}
774
775/// The image representation of the original actor.
776///
777/// This type is not used in any activity, and only used as *part* of another schema.
778///
779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
780#[serde_with::serde_as]
781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
782pub struct ActivityObjectActorImage {
783 /// A URL that points to a thumbnail photo of the original actor.
784 pub url: Option<String>,
785}
786
787impl common::NestedType for ActivityObjectActorImage {}
788impl common::Part for ActivityObjectActorImage {}
789
790/// Verification status of actor.
791///
792/// This type is not used in any activity, and only used as *part* of another schema.
793///
794#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
795#[serde_with::serde_as]
796#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
797pub struct ActivityObjectActorVerification {
798 /// Verification for one-time or manual processes.
799 #[serde(rename = "adHocVerified")]
800 pub ad_hoc_verified: Option<String>,
801}
802
803impl common::NestedType for ActivityObjectActorVerification {}
804impl common::Part for ActivityObjectActorVerification {}
805
806/// The media objects attached to this activity.
807///
808/// This type is not used in any activity, and only used as *part* of another schema.
809///
810#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
811#[serde_with::serde_as]
812#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
813pub struct ActivityObjectAttachments {
814 /// If the attachment is an article, this property contains a snippet of text from the article. It can also include descriptions for other types.
815 pub content: Option<String>,
816 /// The title of the attachment, such as a photo caption or an article title.
817 #[serde(rename = "displayName")]
818 pub display_name: Option<String>,
819 /// If the attachment is a video, the embeddable link.
820 pub embed: Option<ActivityObjectAttachmentsEmbed>,
821 /// The full image URL for photo attachments.
822 #[serde(rename = "fullImage")]
823 pub full_image: Option<ActivityObjectAttachmentsFullImage>,
824 /// The ID of the attachment.
825 pub id: Option<String>,
826 /// The preview image for photos or videos.
827 pub image: Option<ActivityObjectAttachmentsImage>,
828 /// The type of media object. Possible values include, but are not limited to, the following values:
829 /// - "photo" - A photo.
830 /// - "album" - A photo album.
831 /// - "video" - A video.
832 /// - "article" - An article, specified by a link.
833 #[serde(rename = "objectType")]
834 pub object_type: Option<String>,
835 /// If the attachment is an album, this property is a list of potential additional thumbnails from the album.
836 pub thumbnails: Option<Vec<ActivityObjectAttachmentsThumbnails>>,
837 /// The link to the attachment, which should be of type text/html.
838 pub url: Option<String>,
839}
840
841impl common::NestedType for ActivityObjectAttachments {}
842impl common::Part for ActivityObjectAttachments {}
843
844/// If the attachment is a video, the embeddable link.
845///
846/// This type is not used in any activity, and only used as *part* of another schema.
847///
848#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
849#[serde_with::serde_as]
850#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
851pub struct ActivityObjectAttachmentsEmbed {
852 /// Media type of the link.
853 #[serde(rename = "type")]
854 pub type_: Option<String>,
855 /// URL of the link.
856 pub url: Option<String>,
857}
858
859impl common::NestedType for ActivityObjectAttachmentsEmbed {}
860impl common::Part for ActivityObjectAttachmentsEmbed {}
861
862/// The full image URL for photo attachments.
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 ActivityObjectAttachmentsFullImage {
870 /// The height, in pixels, of the linked resource.
871 pub height: Option<u32>,
872 /// Media type of the link.
873 #[serde(rename = "type")]
874 pub type_: Option<String>,
875 /// URL of the image.
876 pub url: Option<String>,
877 /// The width, in pixels, of the linked resource.
878 pub width: Option<u32>,
879}
880
881impl common::NestedType for ActivityObjectAttachmentsFullImage {}
882impl common::Part for ActivityObjectAttachmentsFullImage {}
883
884/// The preview image for photos or videos.
885///
886/// This type is not used in any activity, and only used as *part* of another schema.
887///
888#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
889#[serde_with::serde_as]
890#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
891pub struct ActivityObjectAttachmentsImage {
892 /// The height, in pixels, of the linked resource.
893 pub height: Option<u32>,
894 /// Media type of the link.
895 #[serde(rename = "type")]
896 pub type_: Option<String>,
897 /// Image URL.
898 pub url: Option<String>,
899 /// The width, in pixels, of the linked resource.
900 pub width: Option<u32>,
901}
902
903impl common::NestedType for ActivityObjectAttachmentsImage {}
904impl common::Part for ActivityObjectAttachmentsImage {}
905
906/// If the attachment is an album, this property is a list of potential additional thumbnails from the album.
907///
908/// This type is not used in any activity, and only used as *part* of another schema.
909///
910#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
911#[serde_with::serde_as]
912#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
913pub struct ActivityObjectAttachmentsThumbnails {
914 /// Potential name of the thumbnail.
915 pub description: Option<String>,
916 /// Image resource.
917 pub image: Option<ActivityObjectAttachmentsThumbnailsImage>,
918 /// URL of the webpage containing the image.
919 pub url: Option<String>,
920}
921
922impl common::NestedType for ActivityObjectAttachmentsThumbnails {}
923impl common::Part for ActivityObjectAttachmentsThumbnails {}
924
925/// Image resource.
926///
927/// This type is not used in any activity, and only used as *part* of another schema.
928///
929#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
930#[serde_with::serde_as]
931#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
932pub struct ActivityObjectAttachmentsThumbnailsImage {
933 /// The height, in pixels, of the linked resource.
934 pub height: Option<u32>,
935 /// Media type of the link.
936 #[serde(rename = "type")]
937 pub type_: Option<String>,
938 /// Image url.
939 pub url: Option<String>,
940 /// The width, in pixels, of the linked resource.
941 pub width: Option<u32>,
942}
943
944impl common::NestedType for ActivityObjectAttachmentsThumbnailsImage {}
945impl common::Part for ActivityObjectAttachmentsThumbnailsImage {}
946
947/// People who +1'd this activity.
948///
949/// This type is not used in any activity, and only used as *part* of another schema.
950///
951#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
952#[serde_with::serde_as]
953#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
954pub struct ActivityObjectPlusoners {
955 /// The URL for the collection of people who +1'd this activity.
956 #[serde(rename = "selfLink")]
957 pub self_link: Option<String>,
958 /// Total number of people who +1'd this activity.
959 #[serde(rename = "totalItems")]
960 pub total_items: Option<u32>,
961}
962
963impl common::NestedType for ActivityObjectPlusoners {}
964impl common::Part for ActivityObjectPlusoners {}
965
966/// Comments in reply to this activity.
967///
968/// This type is not used in any activity, and only used as *part* of another schema.
969///
970#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
971#[serde_with::serde_as]
972#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
973pub struct ActivityObjectReplies {
974 /// The URL for the collection of comments in reply to this activity.
975 #[serde(rename = "selfLink")]
976 pub self_link: Option<String>,
977 /// Total number of comments on this activity.
978 #[serde(rename = "totalItems")]
979 pub total_items: Option<u32>,
980}
981
982impl common::NestedType for ActivityObjectReplies {}
983impl common::Part for ActivityObjectReplies {}
984
985/// People who reshared this activity.
986///
987/// This type is not used in any activity, and only used as *part* of another schema.
988///
989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
990#[serde_with::serde_as]
991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
992pub struct ActivityObjectResharers {
993 /// The URL for the collection of resharers.
994 #[serde(rename = "selfLink")]
995 pub self_link: Option<String>,
996 /// Total number of people who reshared this activity.
997 #[serde(rename = "totalItems")]
998 pub total_items: Option<u32>,
999}
1000
1001impl common::NestedType for ActivityObjectResharers {}
1002impl common::Part for ActivityObjectResharers {}
1003
1004/// The service provider that initially published this activity.
1005///
1006/// This type is not used in any activity, and only used as *part* of another schema.
1007///
1008#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1009#[serde_with::serde_as]
1010#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1011pub struct ActivityProvider {
1012 /// Name of the service provider.
1013 pub title: Option<String>,
1014}
1015
1016impl common::NestedType for ActivityProvider {}
1017impl common::Part for ActivityProvider {}
1018
1019/// The person who posted this comment.
1020///
1021/// This type is not used in any activity, and only used as *part* of another schema.
1022///
1023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1024#[serde_with::serde_as]
1025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1026pub struct CommentActor {
1027 /// Actor info specific to particular clients.
1028 #[serde(rename = "clientSpecificActorInfo")]
1029 pub client_specific_actor_info: Option<CommentActorClientSpecificActorInfo>,
1030 /// The name of this actor, suitable for display.
1031 #[serde(rename = "displayName")]
1032 pub display_name: Option<String>,
1033 /// The ID of the actor.
1034 pub id: Option<String>,
1035 /// The image representation of this actor.
1036 pub image: Option<CommentActorImage>,
1037 /// A link to the Person resource for this actor.
1038 pub url: Option<String>,
1039 /// Verification status of actor.
1040 pub verification: Option<CommentActorVerification>,
1041}
1042
1043impl common::NestedType for CommentActor {}
1044impl common::Part for CommentActor {}
1045
1046/// Actor info specific to particular clients.
1047///
1048/// This type is not used in any activity, and only used as *part* of another schema.
1049///
1050#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1051#[serde_with::serde_as]
1052#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1053pub struct CommentActorClientSpecificActorInfo {
1054 /// Actor info specific to YouTube clients.
1055 #[serde(rename = "youtubeActorInfo")]
1056 pub youtube_actor_info: Option<CommentActorClientSpecificActorInfoYoutubeActorInfo>,
1057}
1058
1059impl common::NestedType for CommentActorClientSpecificActorInfo {}
1060impl common::Part for CommentActorClientSpecificActorInfo {}
1061
1062/// Actor info specific to YouTube clients.
1063///
1064/// This type is not used in any activity, and only used as *part* of another schema.
1065///
1066#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1067#[serde_with::serde_as]
1068#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1069pub struct CommentActorClientSpecificActorInfoYoutubeActorInfo {
1070 /// ID of the YouTube channel owned by the Actor.
1071 #[serde(rename = "channelId")]
1072 pub channel_id: Option<String>,
1073}
1074
1075impl common::NestedType for CommentActorClientSpecificActorInfoYoutubeActorInfo {}
1076impl common::Part for CommentActorClientSpecificActorInfoYoutubeActorInfo {}
1077
1078/// The image representation of this actor.
1079///
1080/// This type is not used in any activity, and only used as *part* of another schema.
1081///
1082#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1083#[serde_with::serde_as]
1084#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1085pub struct CommentActorImage {
1086 /// The URL of the actor's profile photo. To resize the image and crop it to a square, append the query string ?sz=x, where x is the dimension in pixels of each side.
1087 pub url: Option<String>,
1088}
1089
1090impl common::NestedType for CommentActorImage {}
1091impl common::Part for CommentActorImage {}
1092
1093/// Verification status of actor.
1094///
1095/// This type is not used in any activity, and only used as *part* of another schema.
1096///
1097#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1098#[serde_with::serde_as]
1099#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1100pub struct CommentActorVerification {
1101 /// Verification for one-time or manual processes.
1102 #[serde(rename = "adHocVerified")]
1103 pub ad_hoc_verified: Option<String>,
1104}
1105
1106impl common::NestedType for CommentActorVerification {}
1107impl common::Part for CommentActorVerification {}
1108
1109/// The activity this comment replied to.
1110///
1111/// This type is not used in any activity, and only used as *part* of another schema.
1112///
1113#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1114#[serde_with::serde_as]
1115#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1116pub struct CommentInReplyTo {
1117 /// The ID of the activity.
1118 pub id: Option<String>,
1119 /// The URL of the activity.
1120 pub url: Option<String>,
1121}
1122
1123impl common::NestedType for CommentInReplyTo {}
1124impl common::Part for CommentInReplyTo {}
1125
1126/// The object of this comment.
1127///
1128/// This type is not used in any activity, and only used as *part* of another schema.
1129///
1130#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1131#[serde_with::serde_as]
1132#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1133pub struct CommentObject {
1134 /// The HTML-formatted content, suitable for display.
1135 pub content: Option<String>,
1136 /// The object type of this comment. Possible values are:
1137 /// - "comment" - A comment in reply to an activity.
1138 #[serde(rename = "objectType")]
1139 pub object_type: Option<String>,
1140 /// The content (text) as provided by the author, stored without any HTML formatting. When creating or updating a comment, this value must be supplied as plain text in the request.
1141 #[serde(rename = "originalContent")]
1142 pub original_content: Option<String>,
1143}
1144
1145impl common::NestedType for CommentObject {}
1146impl common::Part for CommentObject {}
1147
1148/// People who +1'd this comment.
1149///
1150/// This type is not used in any activity, and only used as *part* of another schema.
1151///
1152#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1153#[serde_with::serde_as]
1154#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1155pub struct CommentPlusoners {
1156 /// Total number of people who +1'd this comment.
1157 #[serde(rename = "totalItems")]
1158 pub total_items: Option<u32>,
1159}
1160
1161impl common::NestedType for CommentPlusoners {}
1162impl common::Part for CommentPlusoners {}
1163
1164/// The age range of the person. Valid ranges are 17 or younger, 18 to 20, and 21 or older. Age is determined from the user's birthday using Western age reckoning.
1165///
1166/// This type is not used in any activity, and only used as *part* of another schema.
1167///
1168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1169#[serde_with::serde_as]
1170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1171pub struct PersonAgeRange {
1172 /// The age range's upper bound, if any. Possible values include, but are not limited to, the following:
1173 /// - "17" - for age 17
1174 /// - "20" - for age 20
1175 pub max: Option<i32>,
1176 /// The age range's lower bound, if any. Possible values include, but are not limited to, the following:
1177 /// - "21" - for age 21
1178 /// - "18" - for age 18
1179 pub min: Option<i32>,
1180}
1181
1182impl common::NestedType for PersonAgeRange {}
1183impl common::Part for PersonAgeRange {}
1184
1185/// The cover photo content.
1186///
1187/// This type is not used in any activity, and only used as *part* of another schema.
1188///
1189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1190#[serde_with::serde_as]
1191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1192pub struct PersonCover {
1193 /// Extra information about the cover photo.
1194 #[serde(rename = "coverInfo")]
1195 pub cover_info: Option<PersonCoverCoverInfo>,
1196 /// The person's primary cover image.
1197 #[serde(rename = "coverPhoto")]
1198 pub cover_photo: Option<PersonCoverCoverPhoto>,
1199 /// The layout of the cover art. Possible values include, but are not limited to, the following values:
1200 /// - "banner" - One large image banner.
1201 pub layout: Option<String>,
1202}
1203
1204impl common::NestedType for PersonCover {}
1205impl common::Part for PersonCover {}
1206
1207/// Extra information about the cover photo.
1208///
1209/// This type is not used in any activity, and only used as *part* of another schema.
1210///
1211#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1212#[serde_with::serde_as]
1213#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1214pub struct PersonCoverCoverInfo {
1215 /// The difference between the left position of the cover image and the actual displayed cover image. Only valid for banner layout.
1216 #[serde(rename = "leftImageOffset")]
1217 pub left_image_offset: Option<i32>,
1218 /// The difference between the top position of the cover image and the actual displayed cover image. Only valid for banner layout.
1219 #[serde(rename = "topImageOffset")]
1220 pub top_image_offset: Option<i32>,
1221}
1222
1223impl common::NestedType for PersonCoverCoverInfo {}
1224impl common::Part for PersonCoverCoverInfo {}
1225
1226/// The person's primary cover image.
1227///
1228/// This type is not used in any activity, and only used as *part* of another schema.
1229///
1230#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1231#[serde_with::serde_as]
1232#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1233pub struct PersonCoverCoverPhoto {
1234 /// The height of the image.
1235 pub height: Option<i32>,
1236 /// The URL of the image.
1237 pub url: Option<String>,
1238 /// The width of the image.
1239 pub width: Option<i32>,
1240}
1241
1242impl common::NestedType for PersonCoverCoverPhoto {}
1243impl common::Part for PersonCoverCoverPhoto {}
1244
1245/// A list of email addresses that this person has, including their Google account email address, and the public verified email addresses on their Google+ profile. The plus.profile.emails.read scope is needed to retrieve these email addresses, or the email scope can be used to retrieve just the Google account email address.
1246///
1247/// This type is not used in any activity, and only used as *part* of another schema.
1248///
1249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1250#[serde_with::serde_as]
1251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1252pub struct PersonEmails {
1253 /// The type of address. Possible values include, but are not limited to, the following values:
1254 /// - "account" - Google account email address.
1255 /// - "home" - Home email address.
1256 /// - "work" - Work email address.
1257 /// - "other" - Other.
1258 #[serde(rename = "type")]
1259 pub type_: Option<String>,
1260 /// The email address.
1261 pub value: Option<String>,
1262}
1263
1264impl common::NestedType for PersonEmails {}
1265impl common::Part for PersonEmails {}
1266
1267/// The representation of the person's profile photo.
1268///
1269/// This type is not used in any activity, and only used as *part* of another schema.
1270///
1271#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1272#[serde_with::serde_as]
1273#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1274pub struct PersonImage {
1275 /// Whether the person's profile photo is the default one
1276 #[serde(rename = "isDefault")]
1277 pub is_default: Option<bool>,
1278 /// The URL of the person's profile photo. To resize the image and crop it to a square, append the query string ?sz=x, where x is the dimension in pixels of each side.
1279 pub url: Option<String>,
1280}
1281
1282impl common::NestedType for PersonImage {}
1283impl common::Part for PersonImage {}
1284
1285/// An object representation of the individual components of a person's name.
1286///
1287/// This type is not used in any activity, and only used as *part* of another schema.
1288///
1289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1290#[serde_with::serde_as]
1291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1292pub struct PersonName {
1293 /// The family name (last name) of this person.
1294 #[serde(rename = "familyName")]
1295 pub family_name: Option<String>,
1296 /// The full name of this person, including middle names, suffixes, etc.
1297 pub formatted: Option<String>,
1298 /// The given name (first name) of this person.
1299 #[serde(rename = "givenName")]
1300 pub given_name: Option<String>,
1301 /// The honorific prefixes (such as "Dr." or "Mrs.") for this person.
1302 #[serde(rename = "honorificPrefix")]
1303 pub honorific_prefix: Option<String>,
1304 /// The honorific suffixes (such as "Jr.") for this person.
1305 #[serde(rename = "honorificSuffix")]
1306 pub honorific_suffix: Option<String>,
1307 /// The middle name of this person.
1308 #[serde(rename = "middleName")]
1309 pub middle_name: Option<String>,
1310}
1311
1312impl common::NestedType for PersonName {}
1313impl common::Part for PersonName {}
1314
1315/// A list of current or past organizations with which this person is associated.
1316///
1317/// This type is not used in any activity, and only used as *part* of another schema.
1318///
1319#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1320#[serde_with::serde_as]
1321#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1322pub struct PersonOrganizations {
1323 /// The department within the organization. Deprecated.
1324 pub department: Option<String>,
1325 /// A short description of the person's role in this organization. Deprecated.
1326 pub description: Option<String>,
1327 /// The date that the person left this organization.
1328 #[serde(rename = "endDate")]
1329 pub end_date: Option<String>,
1330 /// The location of this organization. Deprecated.
1331 pub location: Option<String>,
1332 /// The name of the organization.
1333 pub name: Option<String>,
1334 /// If "true", indicates this organization is the person's primary one, which is typically interpreted as the current one.
1335 pub primary: Option<bool>,
1336 /// The date that the person joined this organization.
1337 #[serde(rename = "startDate")]
1338 pub start_date: Option<String>,
1339 /// The person's job title or role within the organization.
1340 pub title: Option<String>,
1341 /// The type of organization. Possible values include, but are not limited to, the following values:
1342 /// - "work" - Work.
1343 /// - "school" - School.
1344 #[serde(rename = "type")]
1345 pub type_: Option<String>,
1346}
1347
1348impl common::NestedType for PersonOrganizations {}
1349impl common::Part for PersonOrganizations {}
1350
1351/// A list of places where this person has lived.
1352///
1353/// This type is not used in any activity, and only used as *part* of another schema.
1354///
1355#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1356#[serde_with::serde_as]
1357#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1358pub struct PersonPlacesLived {
1359 /// If "true", this place of residence is this person's primary residence.
1360 pub primary: Option<bool>,
1361 /// A place where this person has lived. For example: "Seattle, WA", "Near Toronto".
1362 pub value: Option<String>,
1363}
1364
1365impl common::NestedType for PersonPlacesLived {}
1366impl common::Part for PersonPlacesLived {}
1367
1368/// A list of URLs for this person.
1369///
1370/// This type is not used in any activity, and only used as *part* of another schema.
1371///
1372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1373#[serde_with::serde_as]
1374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1375pub struct PersonUrls {
1376 /// The label of the URL.
1377 pub label: Option<String>,
1378 /// The type of URL. Possible values include, but are not limited to, the following values:
1379 /// - "otherProfile" - URL for another profile.
1380 /// - "contributor" - URL to a site for which this person is a contributor.
1381 /// - "website" - URL for this Google+ Page's primary website.
1382 /// - "other" - Other URL.
1383 #[serde(rename = "type")]
1384 pub type_: Option<String>,
1385 /// The URL value.
1386 pub value: Option<String>,
1387}
1388
1389impl common::NestedType for PersonUrls {}
1390impl common::Part for PersonUrls {}
1391
1392/// The physical address of the place.
1393///
1394/// This type is not used in any activity, and only used as *part* of another schema.
1395///
1396#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1397#[serde_with::serde_as]
1398#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1399pub struct PlaceAddress {
1400 /// The formatted address for display.
1401 pub formatted: Option<String>,
1402}
1403
1404impl common::NestedType for PlaceAddress {}
1405impl common::Part for PlaceAddress {}
1406
1407/// The position of the place.
1408///
1409/// This type is not used in any activity, and only used as *part* of another schema.
1410///
1411#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1412#[serde_with::serde_as]
1413#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1414pub struct PlacePosition {
1415 /// The latitude of this position.
1416 pub latitude: Option<f64>,
1417 /// The longitude of this position.
1418 pub longitude: Option<f64>,
1419}
1420
1421impl common::NestedType for PlacePosition {}
1422impl common::Part for PlacePosition {}
1423
1424// ###################
1425// MethodBuilders ###
1426// #################
1427
1428/// A builder providing access to all methods supported on *activity* resources.
1429/// It is not used directly, but through the [`Plus`] hub.
1430///
1431/// # Example
1432///
1433/// Instantiate a resource builder
1434///
1435/// ```test_harness,no_run
1436/// extern crate hyper;
1437/// extern crate hyper_rustls;
1438/// extern crate google_plus1 as plus1;
1439///
1440/// # async fn dox() {
1441/// use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1442///
1443/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1444/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1445/// .with_native_roots()
1446/// .unwrap()
1447/// .https_only()
1448/// .enable_http2()
1449/// .build();
1450///
1451/// let executor = hyper_util::rt::TokioExecutor::new();
1452/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1453/// secret,
1454/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1455/// yup_oauth2::client::CustomHyperClientBuilder::from(
1456/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1457/// ),
1458/// ).build().await.unwrap();
1459///
1460/// let client = hyper_util::client::legacy::Client::builder(
1461/// hyper_util::rt::TokioExecutor::new()
1462/// )
1463/// .build(
1464/// hyper_rustls::HttpsConnectorBuilder::new()
1465/// .with_native_roots()
1466/// .unwrap()
1467/// .https_or_http()
1468/// .enable_http2()
1469/// .build()
1470/// );
1471/// let mut hub = Plus::new(client, auth);
1472/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1473/// // like `get(...)`, `list(...)` and `search(...)`
1474/// // to build up your call.
1475/// let rb = hub.activities();
1476/// # }
1477/// ```
1478pub struct ActivityMethods<'a, C>
1479where
1480 C: 'a,
1481{
1482 hub: &'a Plus<C>,
1483}
1484
1485impl<'a, C> common::MethodsBuilder for ActivityMethods<'a, C> {}
1486
1487impl<'a, C> ActivityMethods<'a, C> {
1488 /// Create a builder to help you perform the following task:
1489 ///
1490 /// Shut down. See https://developers.google.com/+/api-shutdown for more details.
1491 ///
1492 /// # Arguments
1493 ///
1494 /// * `activityId` - The ID of the activity to get.
1495 pub fn get(&self, activity_id: &str) -> ActivityGetCall<'a, C> {
1496 ActivityGetCall {
1497 hub: self.hub,
1498 _activity_id: activity_id.to_string(),
1499 _delegate: Default::default(),
1500 _additional_params: Default::default(),
1501 _scopes: Default::default(),
1502 }
1503 }
1504
1505 /// Create a builder to help you perform the following task:
1506 ///
1507 /// Shut down. See https://developers.google.com/+/api-shutdown for more details.
1508 ///
1509 /// # Arguments
1510 ///
1511 /// * `userId` - The ID of the user to get activities for. The special value "me" can be used to indicate the authenticated user.
1512 /// * `collection` - The collection of activities to list.
1513 pub fn list(&self, user_id: &str, collection: &str) -> ActivityListCall<'a, C> {
1514 ActivityListCall {
1515 hub: self.hub,
1516 _user_id: user_id.to_string(),
1517 _collection: collection.to_string(),
1518 _page_token: Default::default(),
1519 _max_results: Default::default(),
1520 _delegate: Default::default(),
1521 _additional_params: Default::default(),
1522 _scopes: Default::default(),
1523 }
1524 }
1525
1526 /// Create a builder to help you perform the following task:
1527 ///
1528 /// Shut down. See https://developers.google.com/+/api-shutdown for more details.
1529 ///
1530 /// # Arguments
1531 ///
1532 /// * `query` - Full-text search query string.
1533 pub fn search(&self, query: &str) -> ActivitySearchCall<'a, C> {
1534 ActivitySearchCall {
1535 hub: self.hub,
1536 _query: query.to_string(),
1537 _page_token: Default::default(),
1538 _order_by: Default::default(),
1539 _max_results: Default::default(),
1540 _language: Default::default(),
1541 _delegate: Default::default(),
1542 _additional_params: Default::default(),
1543 _scopes: Default::default(),
1544 }
1545 }
1546}
1547
1548/// A builder providing access to all methods supported on *comment* resources.
1549/// It is not used directly, but through the [`Plus`] hub.
1550///
1551/// # Example
1552///
1553/// Instantiate a resource builder
1554///
1555/// ```test_harness,no_run
1556/// extern crate hyper;
1557/// extern crate hyper_rustls;
1558/// extern crate google_plus1 as plus1;
1559///
1560/// # async fn dox() {
1561/// use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1562///
1563/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1564/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1565/// .with_native_roots()
1566/// .unwrap()
1567/// .https_only()
1568/// .enable_http2()
1569/// .build();
1570///
1571/// let executor = hyper_util::rt::TokioExecutor::new();
1572/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1573/// secret,
1574/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1575/// yup_oauth2::client::CustomHyperClientBuilder::from(
1576/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1577/// ),
1578/// ).build().await.unwrap();
1579///
1580/// let client = hyper_util::client::legacy::Client::builder(
1581/// hyper_util::rt::TokioExecutor::new()
1582/// )
1583/// .build(
1584/// hyper_rustls::HttpsConnectorBuilder::new()
1585/// .with_native_roots()
1586/// .unwrap()
1587/// .https_or_http()
1588/// .enable_http2()
1589/// .build()
1590/// );
1591/// let mut hub = Plus::new(client, auth);
1592/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1593/// // like `get(...)` and `list(...)`
1594/// // to build up your call.
1595/// let rb = hub.comments();
1596/// # }
1597/// ```
1598pub struct CommentMethods<'a, C>
1599where
1600 C: 'a,
1601{
1602 hub: &'a Plus<C>,
1603}
1604
1605impl<'a, C> common::MethodsBuilder for CommentMethods<'a, C> {}
1606
1607impl<'a, C> CommentMethods<'a, C> {
1608 /// Create a builder to help you perform the following task:
1609 ///
1610 /// Shut down. See https://developers.google.com/+/api-shutdown for more details.
1611 ///
1612 /// # Arguments
1613 ///
1614 /// * `commentId` - The ID of the comment to get.
1615 pub fn get(&self, comment_id: &str) -> CommentGetCall<'a, C> {
1616 CommentGetCall {
1617 hub: self.hub,
1618 _comment_id: comment_id.to_string(),
1619 _delegate: Default::default(),
1620 _additional_params: Default::default(),
1621 _scopes: Default::default(),
1622 }
1623 }
1624
1625 /// Create a builder to help you perform the following task:
1626 ///
1627 /// Shut down. See https://developers.google.com/+/api-shutdown for more details.
1628 ///
1629 /// # Arguments
1630 ///
1631 /// * `activityId` - The ID of the activity to get comments for.
1632 pub fn list(&self, activity_id: &str) -> CommentListCall<'a, C> {
1633 CommentListCall {
1634 hub: self.hub,
1635 _activity_id: activity_id.to_string(),
1636 _sort_order: Default::default(),
1637 _page_token: Default::default(),
1638 _max_results: Default::default(),
1639 _delegate: Default::default(),
1640 _additional_params: Default::default(),
1641 _scopes: Default::default(),
1642 }
1643 }
1644}
1645
1646/// A builder providing access to all methods supported on *person* resources.
1647/// It is not used directly, but through the [`Plus`] hub.
1648///
1649/// # Example
1650///
1651/// Instantiate a resource builder
1652///
1653/// ```test_harness,no_run
1654/// extern crate hyper;
1655/// extern crate hyper_rustls;
1656/// extern crate google_plus1 as plus1;
1657///
1658/// # async fn dox() {
1659/// use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1660///
1661/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1662/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1663/// .with_native_roots()
1664/// .unwrap()
1665/// .https_only()
1666/// .enable_http2()
1667/// .build();
1668///
1669/// let executor = hyper_util::rt::TokioExecutor::new();
1670/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1671/// secret,
1672/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1673/// yup_oauth2::client::CustomHyperClientBuilder::from(
1674/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1675/// ),
1676/// ).build().await.unwrap();
1677///
1678/// let client = hyper_util::client::legacy::Client::builder(
1679/// hyper_util::rt::TokioExecutor::new()
1680/// )
1681/// .build(
1682/// hyper_rustls::HttpsConnectorBuilder::new()
1683/// .with_native_roots()
1684/// .unwrap()
1685/// .https_or_http()
1686/// .enable_http2()
1687/// .build()
1688/// );
1689/// let mut hub = Plus::new(client, auth);
1690/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1691/// // like `get(...)`, `list(...)`, `list_by_activity(...)` and `search(...)`
1692/// // to build up your call.
1693/// let rb = hub.people();
1694/// # }
1695/// ```
1696pub struct PersonMethods<'a, C>
1697where
1698 C: 'a,
1699{
1700 hub: &'a Plus<C>,
1701}
1702
1703impl<'a, C> common::MethodsBuilder for PersonMethods<'a, C> {}
1704
1705impl<'a, C> PersonMethods<'a, C> {
1706 /// Create a builder to help you perform the following task:
1707 ///
1708 /// Get a person's profile. If your app uses scope https://www.googleapis.com/auth/plus.login, this method is guaranteed to return ageRange and language.
1709 ///
1710 /// # Arguments
1711 ///
1712 /// * `userId` - The ID of the person to get the profile for. The special value "me" can be used to indicate the authenticated user.
1713 pub fn get(&self, user_id: &str) -> PersonGetCall<'a, C> {
1714 PersonGetCall {
1715 hub: self.hub,
1716 _user_id: user_id.to_string(),
1717 _delegate: Default::default(),
1718 _additional_params: Default::default(),
1719 _scopes: Default::default(),
1720 }
1721 }
1722
1723 /// Create a builder to help you perform the following task:
1724 ///
1725 /// List all of the people in the specified collection.
1726 ///
1727 /// # Arguments
1728 ///
1729 /// * `userId` - Get the collection of people for the person identified. Use "me" to indicate the authenticated user.
1730 /// * `collection` - The collection of people to list.
1731 pub fn list(&self, user_id: &str, collection: &str) -> PersonListCall<'a, C> {
1732 PersonListCall {
1733 hub: self.hub,
1734 _user_id: user_id.to_string(),
1735 _collection: collection.to_string(),
1736 _page_token: Default::default(),
1737 _order_by: Default::default(),
1738 _max_results: Default::default(),
1739 _delegate: Default::default(),
1740 _additional_params: Default::default(),
1741 _scopes: Default::default(),
1742 }
1743 }
1744
1745 /// Create a builder to help you perform the following task:
1746 ///
1747 /// Shut down. See https://developers.google.com/+/api-shutdown for more details.
1748 ///
1749 /// # Arguments
1750 ///
1751 /// * `activityId` - The ID of the activity to get the list of people for.
1752 /// * `collection` - The collection of people to list.
1753 pub fn list_by_activity(
1754 &self,
1755 activity_id: &str,
1756 collection: &str,
1757 ) -> PersonListByActivityCall<'a, C> {
1758 PersonListByActivityCall {
1759 hub: self.hub,
1760 _activity_id: activity_id.to_string(),
1761 _collection: collection.to_string(),
1762 _page_token: Default::default(),
1763 _max_results: Default::default(),
1764 _delegate: Default::default(),
1765 _additional_params: Default::default(),
1766 _scopes: Default::default(),
1767 }
1768 }
1769
1770 /// Create a builder to help you perform the following task:
1771 ///
1772 /// Shut down. See https://developers.google.com/+/api-shutdown for more details.
1773 ///
1774 /// # Arguments
1775 ///
1776 /// * `query` - Specify a query string for full text search of public text in all profiles.
1777 pub fn search(&self, query: &str) -> PersonSearchCall<'a, C> {
1778 PersonSearchCall {
1779 hub: self.hub,
1780 _query: query.to_string(),
1781 _page_token: Default::default(),
1782 _max_results: Default::default(),
1783 _language: Default::default(),
1784 _delegate: Default::default(),
1785 _additional_params: Default::default(),
1786 _scopes: Default::default(),
1787 }
1788 }
1789}
1790
1791// ###################
1792// CallBuilders ###
1793// #################
1794
1795/// Shut down. See https://developers.google.com/+/api-shutdown for more details.
1796///
1797/// A builder for the *get* method supported by a *activity* resource.
1798/// It is not used directly, but through a [`ActivityMethods`] instance.
1799///
1800/// # Example
1801///
1802/// Instantiate a resource method builder
1803///
1804/// ```test_harness,no_run
1805/// # extern crate hyper;
1806/// # extern crate hyper_rustls;
1807/// # extern crate google_plus1 as plus1;
1808/// # async fn dox() {
1809/// # use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1810///
1811/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1812/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1813/// # .with_native_roots()
1814/// # .unwrap()
1815/// # .https_only()
1816/// # .enable_http2()
1817/// # .build();
1818///
1819/// # let executor = hyper_util::rt::TokioExecutor::new();
1820/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1821/// # secret,
1822/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1823/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1824/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1825/// # ),
1826/// # ).build().await.unwrap();
1827///
1828/// # let client = hyper_util::client::legacy::Client::builder(
1829/// # hyper_util::rt::TokioExecutor::new()
1830/// # )
1831/// # .build(
1832/// # hyper_rustls::HttpsConnectorBuilder::new()
1833/// # .with_native_roots()
1834/// # .unwrap()
1835/// # .https_or_http()
1836/// # .enable_http2()
1837/// # .build()
1838/// # );
1839/// # let mut hub = Plus::new(client, auth);
1840/// // You can configure optional parameters by calling the respective setters at will, and
1841/// // execute the final call using `doit()`.
1842/// // Values shown here are possibly random and not representative !
1843/// let result = hub.activities().get("activityId")
1844/// .doit().await;
1845/// # }
1846/// ```
1847pub struct ActivityGetCall<'a, C>
1848where
1849 C: 'a,
1850{
1851 hub: &'a Plus<C>,
1852 _activity_id: String,
1853 _delegate: Option<&'a mut dyn common::Delegate>,
1854 _additional_params: HashMap<String, String>,
1855 _scopes: BTreeSet<String>,
1856}
1857
1858impl<'a, C> common::CallBuilder for ActivityGetCall<'a, C> {}
1859
1860impl<'a, C> ActivityGetCall<'a, C>
1861where
1862 C: common::Connector,
1863{
1864 /// Perform the operation you have build so far.
1865 pub async fn doit(mut self) -> common::Result<(common::Response, Activity)> {
1866 use std::borrow::Cow;
1867 use std::io::{Read, Seek};
1868
1869 use common::{url::Params, ToParts};
1870 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1871
1872 let mut dd = common::DefaultDelegate;
1873 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1874 dlg.begin(common::MethodInfo {
1875 id: "plus.activities.get",
1876 http_method: hyper::Method::GET,
1877 });
1878
1879 for &field in ["alt", "activityId"].iter() {
1880 if self._additional_params.contains_key(field) {
1881 dlg.finished(false);
1882 return Err(common::Error::FieldClash(field));
1883 }
1884 }
1885
1886 let mut params = Params::with_capacity(3 + self._additional_params.len());
1887 params.push("activityId", self._activity_id);
1888
1889 params.extend(self._additional_params.iter());
1890
1891 params.push("alt", "json");
1892 let mut url = self.hub._base_url.clone() + "activities/{activityId}";
1893 if self._scopes.is_empty() {
1894 self._scopes.insert(Scope::Login.as_ref().to_string());
1895 }
1896
1897 #[allow(clippy::single_element_loop)]
1898 for &(find_this, param_name) in [("{activityId}", "activityId")].iter() {
1899 url = params.uri_replacement(url, param_name, find_this, false);
1900 }
1901 {
1902 let to_remove = ["activityId"];
1903 params.remove_params(&to_remove);
1904 }
1905
1906 let url = params.parse_with_url(&url);
1907
1908 loop {
1909 let token = match self
1910 .hub
1911 .auth
1912 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1913 .await
1914 {
1915 Ok(token) => token,
1916 Err(e) => match dlg.token(e) {
1917 Ok(token) => token,
1918 Err(e) => {
1919 dlg.finished(false);
1920 return Err(common::Error::MissingToken(e));
1921 }
1922 },
1923 };
1924 let mut req_result = {
1925 let client = &self.hub.client;
1926 dlg.pre_request();
1927 let mut req_builder = hyper::Request::builder()
1928 .method(hyper::Method::GET)
1929 .uri(url.as_str())
1930 .header(USER_AGENT, self.hub._user_agent.clone());
1931
1932 if let Some(token) = token.as_ref() {
1933 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1934 }
1935
1936 let request = req_builder
1937 .header(CONTENT_LENGTH, 0_u64)
1938 .body(common::to_body::<String>(None));
1939
1940 client.request(request.unwrap()).await
1941 };
1942
1943 match req_result {
1944 Err(err) => {
1945 if let common::Retry::After(d) = dlg.http_error(&err) {
1946 sleep(d).await;
1947 continue;
1948 }
1949 dlg.finished(false);
1950 return Err(common::Error::HttpError(err));
1951 }
1952 Ok(res) => {
1953 let (mut parts, body) = res.into_parts();
1954 let mut body = common::Body::new(body);
1955 if !parts.status.is_success() {
1956 let bytes = common::to_bytes(body).await.unwrap_or_default();
1957 let error = serde_json::from_str(&common::to_string(&bytes));
1958 let response = common::to_response(parts, bytes.into());
1959
1960 if let common::Retry::After(d) =
1961 dlg.http_failure(&response, error.as_ref().ok())
1962 {
1963 sleep(d).await;
1964 continue;
1965 }
1966
1967 dlg.finished(false);
1968
1969 return Err(match error {
1970 Ok(value) => common::Error::BadRequest(value),
1971 _ => common::Error::Failure(response),
1972 });
1973 }
1974 let response = {
1975 let bytes = common::to_bytes(body).await.unwrap_or_default();
1976 let encoded = common::to_string(&bytes);
1977 match serde_json::from_str(&encoded) {
1978 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1979 Err(error) => {
1980 dlg.response_json_decode_error(&encoded, &error);
1981 return Err(common::Error::JsonDecodeError(
1982 encoded.to_string(),
1983 error,
1984 ));
1985 }
1986 }
1987 };
1988
1989 dlg.finished(true);
1990 return Ok(response);
1991 }
1992 }
1993 }
1994 }
1995
1996 /// The ID of the activity to get.
1997 ///
1998 /// Sets the *activity id* path property to the given value.
1999 ///
2000 /// Even though the property as already been set when instantiating this call,
2001 /// we provide this method for API completeness.
2002 pub fn activity_id(mut self, new_value: &str) -> ActivityGetCall<'a, C> {
2003 self._activity_id = new_value.to_string();
2004 self
2005 }
2006 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2007 /// while executing the actual API request.
2008 ///
2009 /// ````text
2010 /// It should be used to handle progress information, and to implement a certain level of resilience.
2011 /// ````
2012 ///
2013 /// Sets the *delegate* property to the given value.
2014 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ActivityGetCall<'a, C> {
2015 self._delegate = Some(new_value);
2016 self
2017 }
2018
2019 /// Set any additional parameter of the query string used in the request.
2020 /// It should be used to set parameters which are not yet available through their own
2021 /// setters.
2022 ///
2023 /// Please note that this method must not be used to set any of the known parameters
2024 /// which have their own setter method. If done anyway, the request will fail.
2025 ///
2026 /// # Additional Parameters
2027 ///
2028 /// * *alt* (query-string) - Data format for the response.
2029 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2030 /// * *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.
2031 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2032 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2033 /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
2034 /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
2035 pub fn param<T>(mut self, name: T, value: T) -> ActivityGetCall<'a, C>
2036 where
2037 T: AsRef<str>,
2038 {
2039 self._additional_params
2040 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2041 self
2042 }
2043
2044 /// Identifies the authorization scope for the method you are building.
2045 ///
2046 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2047 /// [`Scope::Login`].
2048 ///
2049 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2050 /// tokens for more than one scope.
2051 ///
2052 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2053 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2054 /// sufficient, a read-write scope will do as well.
2055 pub fn add_scope<St>(mut self, scope: St) -> ActivityGetCall<'a, C>
2056 where
2057 St: AsRef<str>,
2058 {
2059 self._scopes.insert(String::from(scope.as_ref()));
2060 self
2061 }
2062 /// Identifies the authorization scope(s) for the method you are building.
2063 ///
2064 /// See [`Self::add_scope()`] for details.
2065 pub fn add_scopes<I, St>(mut self, scopes: I) -> ActivityGetCall<'a, C>
2066 where
2067 I: IntoIterator<Item = St>,
2068 St: AsRef<str>,
2069 {
2070 self._scopes
2071 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2072 self
2073 }
2074
2075 /// Removes all scopes, and no default scope will be used either.
2076 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2077 /// for details).
2078 pub fn clear_scopes(mut self) -> ActivityGetCall<'a, C> {
2079 self._scopes.clear();
2080 self
2081 }
2082}
2083
2084/// Shut down. See https://developers.google.com/+/api-shutdown for more details.
2085///
2086/// A builder for the *list* method supported by a *activity* resource.
2087/// It is not used directly, but through a [`ActivityMethods`] instance.
2088///
2089/// # Example
2090///
2091/// Instantiate a resource method builder
2092///
2093/// ```test_harness,no_run
2094/// # extern crate hyper;
2095/// # extern crate hyper_rustls;
2096/// # extern crate google_plus1 as plus1;
2097/// # async fn dox() {
2098/// # use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2099///
2100/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2101/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2102/// # .with_native_roots()
2103/// # .unwrap()
2104/// # .https_only()
2105/// # .enable_http2()
2106/// # .build();
2107///
2108/// # let executor = hyper_util::rt::TokioExecutor::new();
2109/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2110/// # secret,
2111/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2112/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2113/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2114/// # ),
2115/// # ).build().await.unwrap();
2116///
2117/// # let client = hyper_util::client::legacy::Client::builder(
2118/// # hyper_util::rt::TokioExecutor::new()
2119/// # )
2120/// # .build(
2121/// # hyper_rustls::HttpsConnectorBuilder::new()
2122/// # .with_native_roots()
2123/// # .unwrap()
2124/// # .https_or_http()
2125/// # .enable_http2()
2126/// # .build()
2127/// # );
2128/// # let mut hub = Plus::new(client, auth);
2129/// // You can configure optional parameters by calling the respective setters at will, and
2130/// // execute the final call using `doit()`.
2131/// // Values shown here are possibly random and not representative !
2132/// let result = hub.activities().list("userId", "collection")
2133/// .page_token("ea")
2134/// .max_results(46)
2135/// .doit().await;
2136/// # }
2137/// ```
2138pub struct ActivityListCall<'a, C>
2139where
2140 C: 'a,
2141{
2142 hub: &'a Plus<C>,
2143 _user_id: String,
2144 _collection: String,
2145 _page_token: Option<String>,
2146 _max_results: Option<u32>,
2147 _delegate: Option<&'a mut dyn common::Delegate>,
2148 _additional_params: HashMap<String, String>,
2149 _scopes: BTreeSet<String>,
2150}
2151
2152impl<'a, C> common::CallBuilder for ActivityListCall<'a, C> {}
2153
2154impl<'a, C> ActivityListCall<'a, C>
2155where
2156 C: common::Connector,
2157{
2158 /// Perform the operation you have build so far.
2159 pub async fn doit(mut self) -> common::Result<(common::Response, ActivityFeed)> {
2160 use std::borrow::Cow;
2161 use std::io::{Read, Seek};
2162
2163 use common::{url::Params, ToParts};
2164 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2165
2166 let mut dd = common::DefaultDelegate;
2167 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2168 dlg.begin(common::MethodInfo {
2169 id: "plus.activities.list",
2170 http_method: hyper::Method::GET,
2171 });
2172
2173 for &field in ["alt", "userId", "collection", "pageToken", "maxResults"].iter() {
2174 if self._additional_params.contains_key(field) {
2175 dlg.finished(false);
2176 return Err(common::Error::FieldClash(field));
2177 }
2178 }
2179
2180 let mut params = Params::with_capacity(6 + self._additional_params.len());
2181 params.push("userId", self._user_id);
2182 params.push("collection", self._collection);
2183 if let Some(value) = self._page_token.as_ref() {
2184 params.push("pageToken", value);
2185 }
2186 if let Some(value) = self._max_results.as_ref() {
2187 params.push("maxResults", value.to_string());
2188 }
2189
2190 params.extend(self._additional_params.iter());
2191
2192 params.push("alt", "json");
2193 let mut url = self.hub._base_url.clone() + "people/{userId}/activities/{collection}";
2194 if self._scopes.is_empty() {
2195 self._scopes.insert(Scope::Login.as_ref().to_string());
2196 }
2197
2198 #[allow(clippy::single_element_loop)]
2199 for &(find_this, param_name) in
2200 [("{userId}", "userId"), ("{collection}", "collection")].iter()
2201 {
2202 url = params.uri_replacement(url, param_name, find_this, false);
2203 }
2204 {
2205 let to_remove = ["collection", "userId"];
2206 params.remove_params(&to_remove);
2207 }
2208
2209 let url = params.parse_with_url(&url);
2210
2211 loop {
2212 let token = match self
2213 .hub
2214 .auth
2215 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2216 .await
2217 {
2218 Ok(token) => token,
2219 Err(e) => match dlg.token(e) {
2220 Ok(token) => token,
2221 Err(e) => {
2222 dlg.finished(false);
2223 return Err(common::Error::MissingToken(e));
2224 }
2225 },
2226 };
2227 let mut req_result = {
2228 let client = &self.hub.client;
2229 dlg.pre_request();
2230 let mut req_builder = hyper::Request::builder()
2231 .method(hyper::Method::GET)
2232 .uri(url.as_str())
2233 .header(USER_AGENT, self.hub._user_agent.clone());
2234
2235 if let Some(token) = token.as_ref() {
2236 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2237 }
2238
2239 let request = req_builder
2240 .header(CONTENT_LENGTH, 0_u64)
2241 .body(common::to_body::<String>(None));
2242
2243 client.request(request.unwrap()).await
2244 };
2245
2246 match req_result {
2247 Err(err) => {
2248 if let common::Retry::After(d) = dlg.http_error(&err) {
2249 sleep(d).await;
2250 continue;
2251 }
2252 dlg.finished(false);
2253 return Err(common::Error::HttpError(err));
2254 }
2255 Ok(res) => {
2256 let (mut parts, body) = res.into_parts();
2257 let mut body = common::Body::new(body);
2258 if !parts.status.is_success() {
2259 let bytes = common::to_bytes(body).await.unwrap_or_default();
2260 let error = serde_json::from_str(&common::to_string(&bytes));
2261 let response = common::to_response(parts, bytes.into());
2262
2263 if let common::Retry::After(d) =
2264 dlg.http_failure(&response, error.as_ref().ok())
2265 {
2266 sleep(d).await;
2267 continue;
2268 }
2269
2270 dlg.finished(false);
2271
2272 return Err(match error {
2273 Ok(value) => common::Error::BadRequest(value),
2274 _ => common::Error::Failure(response),
2275 });
2276 }
2277 let response = {
2278 let bytes = common::to_bytes(body).await.unwrap_or_default();
2279 let encoded = common::to_string(&bytes);
2280 match serde_json::from_str(&encoded) {
2281 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2282 Err(error) => {
2283 dlg.response_json_decode_error(&encoded, &error);
2284 return Err(common::Error::JsonDecodeError(
2285 encoded.to_string(),
2286 error,
2287 ));
2288 }
2289 }
2290 };
2291
2292 dlg.finished(true);
2293 return Ok(response);
2294 }
2295 }
2296 }
2297 }
2298
2299 /// The ID of the user to get activities for. The special value "me" can be used to indicate the authenticated user.
2300 ///
2301 /// Sets the *user id* path property to the given value.
2302 ///
2303 /// Even though the property as already been set when instantiating this call,
2304 /// we provide this method for API completeness.
2305 pub fn user_id(mut self, new_value: &str) -> ActivityListCall<'a, C> {
2306 self._user_id = new_value.to_string();
2307 self
2308 }
2309 /// The collection of activities to list.
2310 ///
2311 /// Sets the *collection* path property to the given value.
2312 ///
2313 /// Even though the property as already been set when instantiating this call,
2314 /// we provide this method for API completeness.
2315 pub fn collection(mut self, new_value: &str) -> ActivityListCall<'a, C> {
2316 self._collection = new_value.to_string();
2317 self
2318 }
2319 /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response.
2320 ///
2321 /// Sets the *page token* query property to the given value.
2322 pub fn page_token(mut self, new_value: &str) -> ActivityListCall<'a, C> {
2323 self._page_token = Some(new_value.to_string());
2324 self
2325 }
2326 /// The maximum number of activities to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.
2327 ///
2328 /// Sets the *max results* query property to the given value.
2329 pub fn max_results(mut self, new_value: u32) -> ActivityListCall<'a, C> {
2330 self._max_results = Some(new_value);
2331 self
2332 }
2333 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2334 /// while executing the actual API request.
2335 ///
2336 /// ````text
2337 /// It should be used to handle progress information, and to implement a certain level of resilience.
2338 /// ````
2339 ///
2340 /// Sets the *delegate* property to the given value.
2341 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ActivityListCall<'a, C> {
2342 self._delegate = Some(new_value);
2343 self
2344 }
2345
2346 /// Set any additional parameter of the query string used in the request.
2347 /// It should be used to set parameters which are not yet available through their own
2348 /// setters.
2349 ///
2350 /// Please note that this method must not be used to set any of the known parameters
2351 /// which have their own setter method. If done anyway, the request will fail.
2352 ///
2353 /// # Additional Parameters
2354 ///
2355 /// * *alt* (query-string) - Data format for the response.
2356 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2357 /// * *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.
2358 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2359 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2360 /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
2361 /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
2362 pub fn param<T>(mut self, name: T, value: T) -> ActivityListCall<'a, C>
2363 where
2364 T: AsRef<str>,
2365 {
2366 self._additional_params
2367 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2368 self
2369 }
2370
2371 /// Identifies the authorization scope for the method you are building.
2372 ///
2373 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2374 /// [`Scope::Login`].
2375 ///
2376 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2377 /// tokens for more than one scope.
2378 ///
2379 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2380 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2381 /// sufficient, a read-write scope will do as well.
2382 pub fn add_scope<St>(mut self, scope: St) -> ActivityListCall<'a, C>
2383 where
2384 St: AsRef<str>,
2385 {
2386 self._scopes.insert(String::from(scope.as_ref()));
2387 self
2388 }
2389 /// Identifies the authorization scope(s) for the method you are building.
2390 ///
2391 /// See [`Self::add_scope()`] for details.
2392 pub fn add_scopes<I, St>(mut self, scopes: I) -> ActivityListCall<'a, C>
2393 where
2394 I: IntoIterator<Item = St>,
2395 St: AsRef<str>,
2396 {
2397 self._scopes
2398 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2399 self
2400 }
2401
2402 /// Removes all scopes, and no default scope will be used either.
2403 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2404 /// for details).
2405 pub fn clear_scopes(mut self) -> ActivityListCall<'a, C> {
2406 self._scopes.clear();
2407 self
2408 }
2409}
2410
2411/// Shut down. See https://developers.google.com/+/api-shutdown for more details.
2412///
2413/// A builder for the *search* method supported by a *activity* resource.
2414/// It is not used directly, but through a [`ActivityMethods`] instance.
2415///
2416/// # Example
2417///
2418/// Instantiate a resource method builder
2419///
2420/// ```test_harness,no_run
2421/// # extern crate hyper;
2422/// # extern crate hyper_rustls;
2423/// # extern crate google_plus1 as plus1;
2424/// # async fn dox() {
2425/// # use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2426///
2427/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2428/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2429/// # .with_native_roots()
2430/// # .unwrap()
2431/// # .https_only()
2432/// # .enable_http2()
2433/// # .build();
2434///
2435/// # let executor = hyper_util::rt::TokioExecutor::new();
2436/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2437/// # secret,
2438/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2439/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2440/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2441/// # ),
2442/// # ).build().await.unwrap();
2443///
2444/// # let client = hyper_util::client::legacy::Client::builder(
2445/// # hyper_util::rt::TokioExecutor::new()
2446/// # )
2447/// # .build(
2448/// # hyper_rustls::HttpsConnectorBuilder::new()
2449/// # .with_native_roots()
2450/// # .unwrap()
2451/// # .https_or_http()
2452/// # .enable_http2()
2453/// # .build()
2454/// # );
2455/// # let mut hub = Plus::new(client, auth);
2456/// // You can configure optional parameters by calling the respective setters at will, and
2457/// // execute the final call using `doit()`.
2458/// // Values shown here are possibly random and not representative !
2459/// let result = hub.activities().search("query")
2460/// .page_token("amet")
2461/// .order_by("duo")
2462/// .max_results(51)
2463/// .language("sed")
2464/// .doit().await;
2465/// # }
2466/// ```
2467pub struct ActivitySearchCall<'a, C>
2468where
2469 C: 'a,
2470{
2471 hub: &'a Plus<C>,
2472 _query: String,
2473 _page_token: Option<String>,
2474 _order_by: Option<String>,
2475 _max_results: Option<u32>,
2476 _language: Option<String>,
2477 _delegate: Option<&'a mut dyn common::Delegate>,
2478 _additional_params: HashMap<String, String>,
2479 _scopes: BTreeSet<String>,
2480}
2481
2482impl<'a, C> common::CallBuilder for ActivitySearchCall<'a, C> {}
2483
2484impl<'a, C> ActivitySearchCall<'a, C>
2485where
2486 C: common::Connector,
2487{
2488 /// Perform the operation you have build so far.
2489 pub async fn doit(mut self) -> common::Result<(common::Response, ActivityFeed)> {
2490 use std::borrow::Cow;
2491 use std::io::{Read, Seek};
2492
2493 use common::{url::Params, ToParts};
2494 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2495
2496 let mut dd = common::DefaultDelegate;
2497 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2498 dlg.begin(common::MethodInfo {
2499 id: "plus.activities.search",
2500 http_method: hyper::Method::GET,
2501 });
2502
2503 for &field in [
2504 "alt",
2505 "query",
2506 "pageToken",
2507 "orderBy",
2508 "maxResults",
2509 "language",
2510 ]
2511 .iter()
2512 {
2513 if self._additional_params.contains_key(field) {
2514 dlg.finished(false);
2515 return Err(common::Error::FieldClash(field));
2516 }
2517 }
2518
2519 let mut params = Params::with_capacity(7 + self._additional_params.len());
2520 params.push("query", self._query);
2521 if let Some(value) = self._page_token.as_ref() {
2522 params.push("pageToken", value);
2523 }
2524 if let Some(value) = self._order_by.as_ref() {
2525 params.push("orderBy", value);
2526 }
2527 if let Some(value) = self._max_results.as_ref() {
2528 params.push("maxResults", value.to_string());
2529 }
2530 if let Some(value) = self._language.as_ref() {
2531 params.push("language", value);
2532 }
2533
2534 params.extend(self._additional_params.iter());
2535
2536 params.push("alt", "json");
2537 let mut url = self.hub._base_url.clone() + "activities";
2538 if self._scopes.is_empty() {
2539 self._scopes.insert(Scope::Login.as_ref().to_string());
2540 }
2541
2542 let url = params.parse_with_url(&url);
2543
2544 loop {
2545 let token = match self
2546 .hub
2547 .auth
2548 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2549 .await
2550 {
2551 Ok(token) => token,
2552 Err(e) => match dlg.token(e) {
2553 Ok(token) => token,
2554 Err(e) => {
2555 dlg.finished(false);
2556 return Err(common::Error::MissingToken(e));
2557 }
2558 },
2559 };
2560 let mut req_result = {
2561 let client = &self.hub.client;
2562 dlg.pre_request();
2563 let mut req_builder = hyper::Request::builder()
2564 .method(hyper::Method::GET)
2565 .uri(url.as_str())
2566 .header(USER_AGENT, self.hub._user_agent.clone());
2567
2568 if let Some(token) = token.as_ref() {
2569 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2570 }
2571
2572 let request = req_builder
2573 .header(CONTENT_LENGTH, 0_u64)
2574 .body(common::to_body::<String>(None));
2575
2576 client.request(request.unwrap()).await
2577 };
2578
2579 match req_result {
2580 Err(err) => {
2581 if let common::Retry::After(d) = dlg.http_error(&err) {
2582 sleep(d).await;
2583 continue;
2584 }
2585 dlg.finished(false);
2586 return Err(common::Error::HttpError(err));
2587 }
2588 Ok(res) => {
2589 let (mut parts, body) = res.into_parts();
2590 let mut body = common::Body::new(body);
2591 if !parts.status.is_success() {
2592 let bytes = common::to_bytes(body).await.unwrap_or_default();
2593 let error = serde_json::from_str(&common::to_string(&bytes));
2594 let response = common::to_response(parts, bytes.into());
2595
2596 if let common::Retry::After(d) =
2597 dlg.http_failure(&response, error.as_ref().ok())
2598 {
2599 sleep(d).await;
2600 continue;
2601 }
2602
2603 dlg.finished(false);
2604
2605 return Err(match error {
2606 Ok(value) => common::Error::BadRequest(value),
2607 _ => common::Error::Failure(response),
2608 });
2609 }
2610 let response = {
2611 let bytes = common::to_bytes(body).await.unwrap_or_default();
2612 let encoded = common::to_string(&bytes);
2613 match serde_json::from_str(&encoded) {
2614 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2615 Err(error) => {
2616 dlg.response_json_decode_error(&encoded, &error);
2617 return Err(common::Error::JsonDecodeError(
2618 encoded.to_string(),
2619 error,
2620 ));
2621 }
2622 }
2623 };
2624
2625 dlg.finished(true);
2626 return Ok(response);
2627 }
2628 }
2629 }
2630 }
2631
2632 /// Full-text search query string.
2633 ///
2634 /// Sets the *query* query property to the given value.
2635 ///
2636 /// Even though the property as already been set when instantiating this call,
2637 /// we provide this method for API completeness.
2638 pub fn query(mut self, new_value: &str) -> ActivitySearchCall<'a, C> {
2639 self._query = new_value.to_string();
2640 self
2641 }
2642 /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. This token can be of any length.
2643 ///
2644 /// Sets the *page token* query property to the given value.
2645 pub fn page_token(mut self, new_value: &str) -> ActivitySearchCall<'a, C> {
2646 self._page_token = Some(new_value.to_string());
2647 self
2648 }
2649 /// Specifies how to order search results.
2650 ///
2651 /// Sets the *order by* query property to the given value.
2652 pub fn order_by(mut self, new_value: &str) -> ActivitySearchCall<'a, C> {
2653 self._order_by = Some(new_value.to_string());
2654 self
2655 }
2656 /// The maximum number of activities to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.
2657 ///
2658 /// Sets the *max results* query property to the given value.
2659 pub fn max_results(mut self, new_value: u32) -> ActivitySearchCall<'a, C> {
2660 self._max_results = Some(new_value);
2661 self
2662 }
2663 /// Specify the preferred language to search with. See search language codes for available values.
2664 ///
2665 /// Sets the *language* query property to the given value.
2666 pub fn language(mut self, new_value: &str) -> ActivitySearchCall<'a, C> {
2667 self._language = Some(new_value.to_string());
2668 self
2669 }
2670 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2671 /// while executing the actual API request.
2672 ///
2673 /// ````text
2674 /// It should be used to handle progress information, and to implement a certain level of resilience.
2675 /// ````
2676 ///
2677 /// Sets the *delegate* property to the given value.
2678 pub fn delegate(
2679 mut self,
2680 new_value: &'a mut dyn common::Delegate,
2681 ) -> ActivitySearchCall<'a, C> {
2682 self._delegate = Some(new_value);
2683 self
2684 }
2685
2686 /// Set any additional parameter of the query string used in the request.
2687 /// It should be used to set parameters which are not yet available through their own
2688 /// setters.
2689 ///
2690 /// Please note that this method must not be used to set any of the known parameters
2691 /// which have their own setter method. If done anyway, the request will fail.
2692 ///
2693 /// # Additional Parameters
2694 ///
2695 /// * *alt* (query-string) - Data format for the response.
2696 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2697 /// * *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.
2698 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2699 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2700 /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
2701 /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
2702 pub fn param<T>(mut self, name: T, value: T) -> ActivitySearchCall<'a, C>
2703 where
2704 T: AsRef<str>,
2705 {
2706 self._additional_params
2707 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2708 self
2709 }
2710
2711 /// Identifies the authorization scope for the method you are building.
2712 ///
2713 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2714 /// [`Scope::Login`].
2715 ///
2716 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2717 /// tokens for more than one scope.
2718 ///
2719 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2720 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2721 /// sufficient, a read-write scope will do as well.
2722 pub fn add_scope<St>(mut self, scope: St) -> ActivitySearchCall<'a, C>
2723 where
2724 St: AsRef<str>,
2725 {
2726 self._scopes.insert(String::from(scope.as_ref()));
2727 self
2728 }
2729 /// Identifies the authorization scope(s) for the method you are building.
2730 ///
2731 /// See [`Self::add_scope()`] for details.
2732 pub fn add_scopes<I, St>(mut self, scopes: I) -> ActivitySearchCall<'a, C>
2733 where
2734 I: IntoIterator<Item = St>,
2735 St: AsRef<str>,
2736 {
2737 self._scopes
2738 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2739 self
2740 }
2741
2742 /// Removes all scopes, and no default scope will be used either.
2743 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2744 /// for details).
2745 pub fn clear_scopes(mut self) -> ActivitySearchCall<'a, C> {
2746 self._scopes.clear();
2747 self
2748 }
2749}
2750
2751/// Shut down. See https://developers.google.com/+/api-shutdown for more details.
2752///
2753/// A builder for the *get* method supported by a *comment* resource.
2754/// It is not used directly, but through a [`CommentMethods`] instance.
2755///
2756/// # Example
2757///
2758/// Instantiate a resource method builder
2759///
2760/// ```test_harness,no_run
2761/// # extern crate hyper;
2762/// # extern crate hyper_rustls;
2763/// # extern crate google_plus1 as plus1;
2764/// # async fn dox() {
2765/// # use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2766///
2767/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2768/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2769/// # .with_native_roots()
2770/// # .unwrap()
2771/// # .https_only()
2772/// # .enable_http2()
2773/// # .build();
2774///
2775/// # let executor = hyper_util::rt::TokioExecutor::new();
2776/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2777/// # secret,
2778/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2779/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2780/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2781/// # ),
2782/// # ).build().await.unwrap();
2783///
2784/// # let client = hyper_util::client::legacy::Client::builder(
2785/// # hyper_util::rt::TokioExecutor::new()
2786/// # )
2787/// # .build(
2788/// # hyper_rustls::HttpsConnectorBuilder::new()
2789/// # .with_native_roots()
2790/// # .unwrap()
2791/// # .https_or_http()
2792/// # .enable_http2()
2793/// # .build()
2794/// # );
2795/// # let mut hub = Plus::new(client, auth);
2796/// // You can configure optional parameters by calling the respective setters at will, and
2797/// // execute the final call using `doit()`.
2798/// // Values shown here are possibly random and not representative !
2799/// let result = hub.comments().get("commentId")
2800/// .doit().await;
2801/// # }
2802/// ```
2803pub struct CommentGetCall<'a, C>
2804where
2805 C: 'a,
2806{
2807 hub: &'a Plus<C>,
2808 _comment_id: String,
2809 _delegate: Option<&'a mut dyn common::Delegate>,
2810 _additional_params: HashMap<String, String>,
2811 _scopes: BTreeSet<String>,
2812}
2813
2814impl<'a, C> common::CallBuilder for CommentGetCall<'a, C> {}
2815
2816impl<'a, C> CommentGetCall<'a, C>
2817where
2818 C: common::Connector,
2819{
2820 /// Perform the operation you have build so far.
2821 pub async fn doit(mut self) -> common::Result<(common::Response, Comment)> {
2822 use std::borrow::Cow;
2823 use std::io::{Read, Seek};
2824
2825 use common::{url::Params, ToParts};
2826 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2827
2828 let mut dd = common::DefaultDelegate;
2829 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2830 dlg.begin(common::MethodInfo {
2831 id: "plus.comments.get",
2832 http_method: hyper::Method::GET,
2833 });
2834
2835 for &field in ["alt", "commentId"].iter() {
2836 if self._additional_params.contains_key(field) {
2837 dlg.finished(false);
2838 return Err(common::Error::FieldClash(field));
2839 }
2840 }
2841
2842 let mut params = Params::with_capacity(3 + self._additional_params.len());
2843 params.push("commentId", self._comment_id);
2844
2845 params.extend(self._additional_params.iter());
2846
2847 params.push("alt", "json");
2848 let mut url = self.hub._base_url.clone() + "comments/{commentId}";
2849 if self._scopes.is_empty() {
2850 self._scopes.insert(Scope::Login.as_ref().to_string());
2851 }
2852
2853 #[allow(clippy::single_element_loop)]
2854 for &(find_this, param_name) in [("{commentId}", "commentId")].iter() {
2855 url = params.uri_replacement(url, param_name, find_this, false);
2856 }
2857 {
2858 let to_remove = ["commentId"];
2859 params.remove_params(&to_remove);
2860 }
2861
2862 let url = params.parse_with_url(&url);
2863
2864 loop {
2865 let token = match self
2866 .hub
2867 .auth
2868 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2869 .await
2870 {
2871 Ok(token) => token,
2872 Err(e) => match dlg.token(e) {
2873 Ok(token) => token,
2874 Err(e) => {
2875 dlg.finished(false);
2876 return Err(common::Error::MissingToken(e));
2877 }
2878 },
2879 };
2880 let mut req_result = {
2881 let client = &self.hub.client;
2882 dlg.pre_request();
2883 let mut req_builder = hyper::Request::builder()
2884 .method(hyper::Method::GET)
2885 .uri(url.as_str())
2886 .header(USER_AGENT, self.hub._user_agent.clone());
2887
2888 if let Some(token) = token.as_ref() {
2889 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2890 }
2891
2892 let request = req_builder
2893 .header(CONTENT_LENGTH, 0_u64)
2894 .body(common::to_body::<String>(None));
2895
2896 client.request(request.unwrap()).await
2897 };
2898
2899 match req_result {
2900 Err(err) => {
2901 if let common::Retry::After(d) = dlg.http_error(&err) {
2902 sleep(d).await;
2903 continue;
2904 }
2905 dlg.finished(false);
2906 return Err(common::Error::HttpError(err));
2907 }
2908 Ok(res) => {
2909 let (mut parts, body) = res.into_parts();
2910 let mut body = common::Body::new(body);
2911 if !parts.status.is_success() {
2912 let bytes = common::to_bytes(body).await.unwrap_or_default();
2913 let error = serde_json::from_str(&common::to_string(&bytes));
2914 let response = common::to_response(parts, bytes.into());
2915
2916 if let common::Retry::After(d) =
2917 dlg.http_failure(&response, error.as_ref().ok())
2918 {
2919 sleep(d).await;
2920 continue;
2921 }
2922
2923 dlg.finished(false);
2924
2925 return Err(match error {
2926 Ok(value) => common::Error::BadRequest(value),
2927 _ => common::Error::Failure(response),
2928 });
2929 }
2930 let response = {
2931 let bytes = common::to_bytes(body).await.unwrap_or_default();
2932 let encoded = common::to_string(&bytes);
2933 match serde_json::from_str(&encoded) {
2934 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2935 Err(error) => {
2936 dlg.response_json_decode_error(&encoded, &error);
2937 return Err(common::Error::JsonDecodeError(
2938 encoded.to_string(),
2939 error,
2940 ));
2941 }
2942 }
2943 };
2944
2945 dlg.finished(true);
2946 return Ok(response);
2947 }
2948 }
2949 }
2950 }
2951
2952 /// The ID of the comment to get.
2953 ///
2954 /// Sets the *comment id* path property to the given value.
2955 ///
2956 /// Even though the property as already been set when instantiating this call,
2957 /// we provide this method for API completeness.
2958 pub fn comment_id(mut self, new_value: &str) -> CommentGetCall<'a, C> {
2959 self._comment_id = new_value.to_string();
2960 self
2961 }
2962 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2963 /// while executing the actual API request.
2964 ///
2965 /// ````text
2966 /// It should be used to handle progress information, and to implement a certain level of resilience.
2967 /// ````
2968 ///
2969 /// Sets the *delegate* property to the given value.
2970 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CommentGetCall<'a, C> {
2971 self._delegate = Some(new_value);
2972 self
2973 }
2974
2975 /// Set any additional parameter of the query string used in the request.
2976 /// It should be used to set parameters which are not yet available through their own
2977 /// setters.
2978 ///
2979 /// Please note that this method must not be used to set any of the known parameters
2980 /// which have their own setter method. If done anyway, the request will fail.
2981 ///
2982 /// # Additional Parameters
2983 ///
2984 /// * *alt* (query-string) - Data format for the response.
2985 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2986 /// * *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.
2987 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2988 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2989 /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
2990 /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
2991 pub fn param<T>(mut self, name: T, value: T) -> CommentGetCall<'a, C>
2992 where
2993 T: AsRef<str>,
2994 {
2995 self._additional_params
2996 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2997 self
2998 }
2999
3000 /// Identifies the authorization scope for the method you are building.
3001 ///
3002 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3003 /// [`Scope::Login`].
3004 ///
3005 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3006 /// tokens for more than one scope.
3007 ///
3008 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3009 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3010 /// sufficient, a read-write scope will do as well.
3011 pub fn add_scope<St>(mut self, scope: St) -> CommentGetCall<'a, C>
3012 where
3013 St: AsRef<str>,
3014 {
3015 self._scopes.insert(String::from(scope.as_ref()));
3016 self
3017 }
3018 /// Identifies the authorization scope(s) for the method you are building.
3019 ///
3020 /// See [`Self::add_scope()`] for details.
3021 pub fn add_scopes<I, St>(mut self, scopes: I) -> CommentGetCall<'a, C>
3022 where
3023 I: IntoIterator<Item = St>,
3024 St: AsRef<str>,
3025 {
3026 self._scopes
3027 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3028 self
3029 }
3030
3031 /// Removes all scopes, and no default scope will be used either.
3032 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3033 /// for details).
3034 pub fn clear_scopes(mut self) -> CommentGetCall<'a, C> {
3035 self._scopes.clear();
3036 self
3037 }
3038}
3039
3040/// Shut down. See https://developers.google.com/+/api-shutdown for more details.
3041///
3042/// A builder for the *list* method supported by a *comment* resource.
3043/// It is not used directly, but through a [`CommentMethods`] instance.
3044///
3045/// # Example
3046///
3047/// Instantiate a resource method builder
3048///
3049/// ```test_harness,no_run
3050/// # extern crate hyper;
3051/// # extern crate hyper_rustls;
3052/// # extern crate google_plus1 as plus1;
3053/// # async fn dox() {
3054/// # use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3055///
3056/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3057/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3058/// # .with_native_roots()
3059/// # .unwrap()
3060/// # .https_only()
3061/// # .enable_http2()
3062/// # .build();
3063///
3064/// # let executor = hyper_util::rt::TokioExecutor::new();
3065/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3066/// # secret,
3067/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3068/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3069/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3070/// # ),
3071/// # ).build().await.unwrap();
3072///
3073/// # let client = hyper_util::client::legacy::Client::builder(
3074/// # hyper_util::rt::TokioExecutor::new()
3075/// # )
3076/// # .build(
3077/// # hyper_rustls::HttpsConnectorBuilder::new()
3078/// # .with_native_roots()
3079/// # .unwrap()
3080/// # .https_or_http()
3081/// # .enable_http2()
3082/// # .build()
3083/// # );
3084/// # let mut hub = Plus::new(client, auth);
3085/// // You can configure optional parameters by calling the respective setters at will, and
3086/// // execute the final call using `doit()`.
3087/// // Values shown here are possibly random and not representative !
3088/// let result = hub.comments().list("activityId")
3089/// .sort_order("rebum.")
3090/// .page_token("est")
3091/// .max_results(51)
3092/// .doit().await;
3093/// # }
3094/// ```
3095pub struct CommentListCall<'a, C>
3096where
3097 C: 'a,
3098{
3099 hub: &'a Plus<C>,
3100 _activity_id: String,
3101 _sort_order: Option<String>,
3102 _page_token: Option<String>,
3103 _max_results: Option<u32>,
3104 _delegate: Option<&'a mut dyn common::Delegate>,
3105 _additional_params: HashMap<String, String>,
3106 _scopes: BTreeSet<String>,
3107}
3108
3109impl<'a, C> common::CallBuilder for CommentListCall<'a, C> {}
3110
3111impl<'a, C> CommentListCall<'a, C>
3112where
3113 C: common::Connector,
3114{
3115 /// Perform the operation you have build so far.
3116 pub async fn doit(mut self) -> common::Result<(common::Response, CommentFeed)> {
3117 use std::borrow::Cow;
3118 use std::io::{Read, Seek};
3119
3120 use common::{url::Params, ToParts};
3121 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3122
3123 let mut dd = common::DefaultDelegate;
3124 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3125 dlg.begin(common::MethodInfo {
3126 id: "plus.comments.list",
3127 http_method: hyper::Method::GET,
3128 });
3129
3130 for &field in ["alt", "activityId", "sortOrder", "pageToken", "maxResults"].iter() {
3131 if self._additional_params.contains_key(field) {
3132 dlg.finished(false);
3133 return Err(common::Error::FieldClash(field));
3134 }
3135 }
3136
3137 let mut params = Params::with_capacity(6 + self._additional_params.len());
3138 params.push("activityId", self._activity_id);
3139 if let Some(value) = self._sort_order.as_ref() {
3140 params.push("sortOrder", value);
3141 }
3142 if let Some(value) = self._page_token.as_ref() {
3143 params.push("pageToken", value);
3144 }
3145 if let Some(value) = self._max_results.as_ref() {
3146 params.push("maxResults", value.to_string());
3147 }
3148
3149 params.extend(self._additional_params.iter());
3150
3151 params.push("alt", "json");
3152 let mut url = self.hub._base_url.clone() + "activities/{activityId}/comments";
3153 if self._scopes.is_empty() {
3154 self._scopes.insert(Scope::Login.as_ref().to_string());
3155 }
3156
3157 #[allow(clippy::single_element_loop)]
3158 for &(find_this, param_name) in [("{activityId}", "activityId")].iter() {
3159 url = params.uri_replacement(url, param_name, find_this, false);
3160 }
3161 {
3162 let to_remove = ["activityId"];
3163 params.remove_params(&to_remove);
3164 }
3165
3166 let url = params.parse_with_url(&url);
3167
3168 loop {
3169 let token = match self
3170 .hub
3171 .auth
3172 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3173 .await
3174 {
3175 Ok(token) => token,
3176 Err(e) => match dlg.token(e) {
3177 Ok(token) => token,
3178 Err(e) => {
3179 dlg.finished(false);
3180 return Err(common::Error::MissingToken(e));
3181 }
3182 },
3183 };
3184 let mut req_result = {
3185 let client = &self.hub.client;
3186 dlg.pre_request();
3187 let mut req_builder = hyper::Request::builder()
3188 .method(hyper::Method::GET)
3189 .uri(url.as_str())
3190 .header(USER_AGENT, self.hub._user_agent.clone());
3191
3192 if let Some(token) = token.as_ref() {
3193 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3194 }
3195
3196 let request = req_builder
3197 .header(CONTENT_LENGTH, 0_u64)
3198 .body(common::to_body::<String>(None));
3199
3200 client.request(request.unwrap()).await
3201 };
3202
3203 match req_result {
3204 Err(err) => {
3205 if let common::Retry::After(d) = dlg.http_error(&err) {
3206 sleep(d).await;
3207 continue;
3208 }
3209 dlg.finished(false);
3210 return Err(common::Error::HttpError(err));
3211 }
3212 Ok(res) => {
3213 let (mut parts, body) = res.into_parts();
3214 let mut body = common::Body::new(body);
3215 if !parts.status.is_success() {
3216 let bytes = common::to_bytes(body).await.unwrap_or_default();
3217 let error = serde_json::from_str(&common::to_string(&bytes));
3218 let response = common::to_response(parts, bytes.into());
3219
3220 if let common::Retry::After(d) =
3221 dlg.http_failure(&response, error.as_ref().ok())
3222 {
3223 sleep(d).await;
3224 continue;
3225 }
3226
3227 dlg.finished(false);
3228
3229 return Err(match error {
3230 Ok(value) => common::Error::BadRequest(value),
3231 _ => common::Error::Failure(response),
3232 });
3233 }
3234 let response = {
3235 let bytes = common::to_bytes(body).await.unwrap_or_default();
3236 let encoded = common::to_string(&bytes);
3237 match serde_json::from_str(&encoded) {
3238 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3239 Err(error) => {
3240 dlg.response_json_decode_error(&encoded, &error);
3241 return Err(common::Error::JsonDecodeError(
3242 encoded.to_string(),
3243 error,
3244 ));
3245 }
3246 }
3247 };
3248
3249 dlg.finished(true);
3250 return Ok(response);
3251 }
3252 }
3253 }
3254 }
3255
3256 /// The ID of the activity to get comments for.
3257 ///
3258 /// Sets the *activity id* path property to the given value.
3259 ///
3260 /// Even though the property as already been set when instantiating this call,
3261 /// we provide this method for API completeness.
3262 pub fn activity_id(mut self, new_value: &str) -> CommentListCall<'a, C> {
3263 self._activity_id = new_value.to_string();
3264 self
3265 }
3266 /// The order in which to sort the list of comments.
3267 ///
3268 /// Sets the *sort order* query property to the given value.
3269 pub fn sort_order(mut self, new_value: &str) -> CommentListCall<'a, C> {
3270 self._sort_order = Some(new_value.to_string());
3271 self
3272 }
3273 /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response.
3274 ///
3275 /// Sets the *page token* query property to the given value.
3276 pub fn page_token(mut self, new_value: &str) -> CommentListCall<'a, C> {
3277 self._page_token = Some(new_value.to_string());
3278 self
3279 }
3280 /// The maximum number of comments to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.
3281 ///
3282 /// Sets the *max results* query property to the given value.
3283 pub fn max_results(mut self, new_value: u32) -> CommentListCall<'a, C> {
3284 self._max_results = Some(new_value);
3285 self
3286 }
3287 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3288 /// while executing the actual API request.
3289 ///
3290 /// ````text
3291 /// It should be used to handle progress information, and to implement a certain level of resilience.
3292 /// ````
3293 ///
3294 /// Sets the *delegate* property to the given value.
3295 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CommentListCall<'a, C> {
3296 self._delegate = Some(new_value);
3297 self
3298 }
3299
3300 /// Set any additional parameter of the query string used in the request.
3301 /// It should be used to set parameters which are not yet available through their own
3302 /// setters.
3303 ///
3304 /// Please note that this method must not be used to set any of the known parameters
3305 /// which have their own setter method. If done anyway, the request will fail.
3306 ///
3307 /// # Additional Parameters
3308 ///
3309 /// * *alt* (query-string) - Data format for the response.
3310 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3311 /// * *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.
3312 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3313 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3314 /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
3315 /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
3316 pub fn param<T>(mut self, name: T, value: T) -> CommentListCall<'a, C>
3317 where
3318 T: AsRef<str>,
3319 {
3320 self._additional_params
3321 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3322 self
3323 }
3324
3325 /// Identifies the authorization scope for the method you are building.
3326 ///
3327 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3328 /// [`Scope::Login`].
3329 ///
3330 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3331 /// tokens for more than one scope.
3332 ///
3333 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3334 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3335 /// sufficient, a read-write scope will do as well.
3336 pub fn add_scope<St>(mut self, scope: St) -> CommentListCall<'a, C>
3337 where
3338 St: AsRef<str>,
3339 {
3340 self._scopes.insert(String::from(scope.as_ref()));
3341 self
3342 }
3343 /// Identifies the authorization scope(s) for the method you are building.
3344 ///
3345 /// See [`Self::add_scope()`] for details.
3346 pub fn add_scopes<I, St>(mut self, scopes: I) -> CommentListCall<'a, C>
3347 where
3348 I: IntoIterator<Item = St>,
3349 St: AsRef<str>,
3350 {
3351 self._scopes
3352 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3353 self
3354 }
3355
3356 /// Removes all scopes, and no default scope will be used either.
3357 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3358 /// for details).
3359 pub fn clear_scopes(mut self) -> CommentListCall<'a, C> {
3360 self._scopes.clear();
3361 self
3362 }
3363}
3364
3365/// Get a person's profile. If your app uses scope https://www.googleapis.com/auth/plus.login, this method is guaranteed to return ageRange and language.
3366///
3367/// A builder for the *get* method supported by a *person* resource.
3368/// It is not used directly, but through a [`PersonMethods`] instance.
3369///
3370/// # Example
3371///
3372/// Instantiate a resource method builder
3373///
3374/// ```test_harness,no_run
3375/// # extern crate hyper;
3376/// # extern crate hyper_rustls;
3377/// # extern crate google_plus1 as plus1;
3378/// # async fn dox() {
3379/// # use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3380///
3381/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3382/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3383/// # .with_native_roots()
3384/// # .unwrap()
3385/// # .https_only()
3386/// # .enable_http2()
3387/// # .build();
3388///
3389/// # let executor = hyper_util::rt::TokioExecutor::new();
3390/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3391/// # secret,
3392/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3393/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3394/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3395/// # ),
3396/// # ).build().await.unwrap();
3397///
3398/// # let client = hyper_util::client::legacy::Client::builder(
3399/// # hyper_util::rt::TokioExecutor::new()
3400/// # )
3401/// # .build(
3402/// # hyper_rustls::HttpsConnectorBuilder::new()
3403/// # .with_native_roots()
3404/// # .unwrap()
3405/// # .https_or_http()
3406/// # .enable_http2()
3407/// # .build()
3408/// # );
3409/// # let mut hub = Plus::new(client, auth);
3410/// // You can configure optional parameters by calling the respective setters at will, and
3411/// // execute the final call using `doit()`.
3412/// // Values shown here are possibly random and not representative !
3413/// let result = hub.people().get("userId")
3414/// .doit().await;
3415/// # }
3416/// ```
3417pub struct PersonGetCall<'a, C>
3418where
3419 C: 'a,
3420{
3421 hub: &'a Plus<C>,
3422 _user_id: String,
3423 _delegate: Option<&'a mut dyn common::Delegate>,
3424 _additional_params: HashMap<String, String>,
3425 _scopes: BTreeSet<String>,
3426}
3427
3428impl<'a, C> common::CallBuilder for PersonGetCall<'a, C> {}
3429
3430impl<'a, C> PersonGetCall<'a, C>
3431where
3432 C: common::Connector,
3433{
3434 /// Perform the operation you have build so far.
3435 pub async fn doit(mut self) -> common::Result<(common::Response, Person)> {
3436 use std::borrow::Cow;
3437 use std::io::{Read, Seek};
3438
3439 use common::{url::Params, ToParts};
3440 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3441
3442 let mut dd = common::DefaultDelegate;
3443 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3444 dlg.begin(common::MethodInfo {
3445 id: "plus.people.get",
3446 http_method: hyper::Method::GET,
3447 });
3448
3449 for &field in ["alt", "userId"].iter() {
3450 if self._additional_params.contains_key(field) {
3451 dlg.finished(false);
3452 return Err(common::Error::FieldClash(field));
3453 }
3454 }
3455
3456 let mut params = Params::with_capacity(3 + self._additional_params.len());
3457 params.push("userId", self._user_id);
3458
3459 params.extend(self._additional_params.iter());
3460
3461 params.push("alt", "json");
3462 let mut url = self.hub._base_url.clone() + "people/{userId}";
3463 if self._scopes.is_empty() {
3464 self._scopes.insert(Scope::Login.as_ref().to_string());
3465 }
3466
3467 #[allow(clippy::single_element_loop)]
3468 for &(find_this, param_name) in [("{userId}", "userId")].iter() {
3469 url = params.uri_replacement(url, param_name, find_this, false);
3470 }
3471 {
3472 let to_remove = ["userId"];
3473 params.remove_params(&to_remove);
3474 }
3475
3476 let url = params.parse_with_url(&url);
3477
3478 loop {
3479 let token = match self
3480 .hub
3481 .auth
3482 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3483 .await
3484 {
3485 Ok(token) => token,
3486 Err(e) => match dlg.token(e) {
3487 Ok(token) => token,
3488 Err(e) => {
3489 dlg.finished(false);
3490 return Err(common::Error::MissingToken(e));
3491 }
3492 },
3493 };
3494 let mut req_result = {
3495 let client = &self.hub.client;
3496 dlg.pre_request();
3497 let mut req_builder = hyper::Request::builder()
3498 .method(hyper::Method::GET)
3499 .uri(url.as_str())
3500 .header(USER_AGENT, self.hub._user_agent.clone());
3501
3502 if let Some(token) = token.as_ref() {
3503 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3504 }
3505
3506 let request = req_builder
3507 .header(CONTENT_LENGTH, 0_u64)
3508 .body(common::to_body::<String>(None));
3509
3510 client.request(request.unwrap()).await
3511 };
3512
3513 match req_result {
3514 Err(err) => {
3515 if let common::Retry::After(d) = dlg.http_error(&err) {
3516 sleep(d).await;
3517 continue;
3518 }
3519 dlg.finished(false);
3520 return Err(common::Error::HttpError(err));
3521 }
3522 Ok(res) => {
3523 let (mut parts, body) = res.into_parts();
3524 let mut body = common::Body::new(body);
3525 if !parts.status.is_success() {
3526 let bytes = common::to_bytes(body).await.unwrap_or_default();
3527 let error = serde_json::from_str(&common::to_string(&bytes));
3528 let response = common::to_response(parts, bytes.into());
3529
3530 if let common::Retry::After(d) =
3531 dlg.http_failure(&response, error.as_ref().ok())
3532 {
3533 sleep(d).await;
3534 continue;
3535 }
3536
3537 dlg.finished(false);
3538
3539 return Err(match error {
3540 Ok(value) => common::Error::BadRequest(value),
3541 _ => common::Error::Failure(response),
3542 });
3543 }
3544 let response = {
3545 let bytes = common::to_bytes(body).await.unwrap_or_default();
3546 let encoded = common::to_string(&bytes);
3547 match serde_json::from_str(&encoded) {
3548 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3549 Err(error) => {
3550 dlg.response_json_decode_error(&encoded, &error);
3551 return Err(common::Error::JsonDecodeError(
3552 encoded.to_string(),
3553 error,
3554 ));
3555 }
3556 }
3557 };
3558
3559 dlg.finished(true);
3560 return Ok(response);
3561 }
3562 }
3563 }
3564 }
3565
3566 /// The ID of the person to get the profile for. The special value "me" can be used to indicate the authenticated user.
3567 ///
3568 /// Sets the *user id* path property to the given value.
3569 ///
3570 /// Even though the property as already been set when instantiating this call,
3571 /// we provide this method for API completeness.
3572 pub fn user_id(mut self, new_value: &str) -> PersonGetCall<'a, C> {
3573 self._user_id = new_value.to_string();
3574 self
3575 }
3576 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3577 /// while executing the actual API request.
3578 ///
3579 /// ````text
3580 /// It should be used to handle progress information, and to implement a certain level of resilience.
3581 /// ````
3582 ///
3583 /// Sets the *delegate* property to the given value.
3584 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PersonGetCall<'a, C> {
3585 self._delegate = Some(new_value);
3586 self
3587 }
3588
3589 /// Set any additional parameter of the query string used in the request.
3590 /// It should be used to set parameters which are not yet available through their own
3591 /// setters.
3592 ///
3593 /// Please note that this method must not be used to set any of the known parameters
3594 /// which have their own setter method. If done anyway, the request will fail.
3595 ///
3596 /// # Additional Parameters
3597 ///
3598 /// * *alt* (query-string) - Data format for the response.
3599 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3600 /// * *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.
3601 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3602 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3603 /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
3604 /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
3605 pub fn param<T>(mut self, name: T, value: T) -> PersonGetCall<'a, C>
3606 where
3607 T: AsRef<str>,
3608 {
3609 self._additional_params
3610 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3611 self
3612 }
3613
3614 /// Identifies the authorization scope for the method you are building.
3615 ///
3616 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3617 /// [`Scope::Login`].
3618 ///
3619 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3620 /// tokens for more than one scope.
3621 ///
3622 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3623 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3624 /// sufficient, a read-write scope will do as well.
3625 pub fn add_scope<St>(mut self, scope: St) -> PersonGetCall<'a, C>
3626 where
3627 St: AsRef<str>,
3628 {
3629 self._scopes.insert(String::from(scope.as_ref()));
3630 self
3631 }
3632 /// Identifies the authorization scope(s) for the method you are building.
3633 ///
3634 /// See [`Self::add_scope()`] for details.
3635 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonGetCall<'a, C>
3636 where
3637 I: IntoIterator<Item = St>,
3638 St: AsRef<str>,
3639 {
3640 self._scopes
3641 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3642 self
3643 }
3644
3645 /// Removes all scopes, and no default scope will be used either.
3646 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3647 /// for details).
3648 pub fn clear_scopes(mut self) -> PersonGetCall<'a, C> {
3649 self._scopes.clear();
3650 self
3651 }
3652}
3653
3654/// List all of the people in the specified collection.
3655///
3656/// A builder for the *list* method supported by a *person* resource.
3657/// It is not used directly, but through a [`PersonMethods`] instance.
3658///
3659/// # Example
3660///
3661/// Instantiate a resource method builder
3662///
3663/// ```test_harness,no_run
3664/// # extern crate hyper;
3665/// # extern crate hyper_rustls;
3666/// # extern crate google_plus1 as plus1;
3667/// # async fn dox() {
3668/// # use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3669///
3670/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3671/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3672/// # .with_native_roots()
3673/// # .unwrap()
3674/// # .https_only()
3675/// # .enable_http2()
3676/// # .build();
3677///
3678/// # let executor = hyper_util::rt::TokioExecutor::new();
3679/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3680/// # secret,
3681/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3682/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3683/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3684/// # ),
3685/// # ).build().await.unwrap();
3686///
3687/// # let client = hyper_util::client::legacy::Client::builder(
3688/// # hyper_util::rt::TokioExecutor::new()
3689/// # )
3690/// # .build(
3691/// # hyper_rustls::HttpsConnectorBuilder::new()
3692/// # .with_native_roots()
3693/// # .unwrap()
3694/// # .https_or_http()
3695/// # .enable_http2()
3696/// # .build()
3697/// # );
3698/// # let mut hub = Plus::new(client, auth);
3699/// // You can configure optional parameters by calling the respective setters at will, and
3700/// // execute the final call using `doit()`.
3701/// // Values shown here are possibly random and not representative !
3702/// let result = hub.people().list("userId", "collection")
3703/// .page_token("ea")
3704/// .order_by("dolor")
3705/// .max_results(45)
3706/// .doit().await;
3707/// # }
3708/// ```
3709pub struct PersonListCall<'a, C>
3710where
3711 C: 'a,
3712{
3713 hub: &'a Plus<C>,
3714 _user_id: String,
3715 _collection: String,
3716 _page_token: Option<String>,
3717 _order_by: Option<String>,
3718 _max_results: Option<u32>,
3719 _delegate: Option<&'a mut dyn common::Delegate>,
3720 _additional_params: HashMap<String, String>,
3721 _scopes: BTreeSet<String>,
3722}
3723
3724impl<'a, C> common::CallBuilder for PersonListCall<'a, C> {}
3725
3726impl<'a, C> PersonListCall<'a, C>
3727where
3728 C: common::Connector,
3729{
3730 /// Perform the operation you have build so far.
3731 pub async fn doit(mut self) -> common::Result<(common::Response, PeopleFeed)> {
3732 use std::borrow::Cow;
3733 use std::io::{Read, Seek};
3734
3735 use common::{url::Params, ToParts};
3736 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3737
3738 let mut dd = common::DefaultDelegate;
3739 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3740 dlg.begin(common::MethodInfo {
3741 id: "plus.people.list",
3742 http_method: hyper::Method::GET,
3743 });
3744
3745 for &field in [
3746 "alt",
3747 "userId",
3748 "collection",
3749 "pageToken",
3750 "orderBy",
3751 "maxResults",
3752 ]
3753 .iter()
3754 {
3755 if self._additional_params.contains_key(field) {
3756 dlg.finished(false);
3757 return Err(common::Error::FieldClash(field));
3758 }
3759 }
3760
3761 let mut params = Params::with_capacity(7 + self._additional_params.len());
3762 params.push("userId", self._user_id);
3763 params.push("collection", self._collection);
3764 if let Some(value) = self._page_token.as_ref() {
3765 params.push("pageToken", value);
3766 }
3767 if let Some(value) = self._order_by.as_ref() {
3768 params.push("orderBy", value);
3769 }
3770 if let Some(value) = self._max_results.as_ref() {
3771 params.push("maxResults", value.to_string());
3772 }
3773
3774 params.extend(self._additional_params.iter());
3775
3776 params.push("alt", "json");
3777 let mut url = self.hub._base_url.clone() + "people/{userId}/people/{collection}";
3778 if self._scopes.is_empty() {
3779 self._scopes.insert(Scope::Login.as_ref().to_string());
3780 }
3781
3782 #[allow(clippy::single_element_loop)]
3783 for &(find_this, param_name) in
3784 [("{userId}", "userId"), ("{collection}", "collection")].iter()
3785 {
3786 url = params.uri_replacement(url, param_name, find_this, false);
3787 }
3788 {
3789 let to_remove = ["collection", "userId"];
3790 params.remove_params(&to_remove);
3791 }
3792
3793 let url = params.parse_with_url(&url);
3794
3795 loop {
3796 let token = match self
3797 .hub
3798 .auth
3799 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3800 .await
3801 {
3802 Ok(token) => token,
3803 Err(e) => match dlg.token(e) {
3804 Ok(token) => token,
3805 Err(e) => {
3806 dlg.finished(false);
3807 return Err(common::Error::MissingToken(e));
3808 }
3809 },
3810 };
3811 let mut req_result = {
3812 let client = &self.hub.client;
3813 dlg.pre_request();
3814 let mut req_builder = hyper::Request::builder()
3815 .method(hyper::Method::GET)
3816 .uri(url.as_str())
3817 .header(USER_AGENT, self.hub._user_agent.clone());
3818
3819 if let Some(token) = token.as_ref() {
3820 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3821 }
3822
3823 let request = req_builder
3824 .header(CONTENT_LENGTH, 0_u64)
3825 .body(common::to_body::<String>(None));
3826
3827 client.request(request.unwrap()).await
3828 };
3829
3830 match req_result {
3831 Err(err) => {
3832 if let common::Retry::After(d) = dlg.http_error(&err) {
3833 sleep(d).await;
3834 continue;
3835 }
3836 dlg.finished(false);
3837 return Err(common::Error::HttpError(err));
3838 }
3839 Ok(res) => {
3840 let (mut parts, body) = res.into_parts();
3841 let mut body = common::Body::new(body);
3842 if !parts.status.is_success() {
3843 let bytes = common::to_bytes(body).await.unwrap_or_default();
3844 let error = serde_json::from_str(&common::to_string(&bytes));
3845 let response = common::to_response(parts, bytes.into());
3846
3847 if let common::Retry::After(d) =
3848 dlg.http_failure(&response, error.as_ref().ok())
3849 {
3850 sleep(d).await;
3851 continue;
3852 }
3853
3854 dlg.finished(false);
3855
3856 return Err(match error {
3857 Ok(value) => common::Error::BadRequest(value),
3858 _ => common::Error::Failure(response),
3859 });
3860 }
3861 let response = {
3862 let bytes = common::to_bytes(body).await.unwrap_or_default();
3863 let encoded = common::to_string(&bytes);
3864 match serde_json::from_str(&encoded) {
3865 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3866 Err(error) => {
3867 dlg.response_json_decode_error(&encoded, &error);
3868 return Err(common::Error::JsonDecodeError(
3869 encoded.to_string(),
3870 error,
3871 ));
3872 }
3873 }
3874 };
3875
3876 dlg.finished(true);
3877 return Ok(response);
3878 }
3879 }
3880 }
3881 }
3882
3883 /// Get the collection of people for the person identified. Use "me" to indicate the authenticated user.
3884 ///
3885 /// Sets the *user id* path property to the given value.
3886 ///
3887 /// Even though the property as already been set when instantiating this call,
3888 /// we provide this method for API completeness.
3889 pub fn user_id(mut self, new_value: &str) -> PersonListCall<'a, C> {
3890 self._user_id = new_value.to_string();
3891 self
3892 }
3893 /// The collection of people to list.
3894 ///
3895 /// Sets the *collection* path property to the given value.
3896 ///
3897 /// Even though the property as already been set when instantiating this call,
3898 /// we provide this method for API completeness.
3899 pub fn collection(mut self, new_value: &str) -> PersonListCall<'a, C> {
3900 self._collection = new_value.to_string();
3901 self
3902 }
3903 /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response.
3904 ///
3905 /// Sets the *page token* query property to the given value.
3906 pub fn page_token(mut self, new_value: &str) -> PersonListCall<'a, C> {
3907 self._page_token = Some(new_value.to_string());
3908 self
3909 }
3910 /// The order to return people in.
3911 ///
3912 /// Sets the *order by* query property to the given value.
3913 pub fn order_by(mut self, new_value: &str) -> PersonListCall<'a, C> {
3914 self._order_by = Some(new_value.to_string());
3915 self
3916 }
3917 /// The maximum number of people to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.
3918 ///
3919 /// Sets the *max results* query property to the given value.
3920 pub fn max_results(mut self, new_value: u32) -> PersonListCall<'a, C> {
3921 self._max_results = Some(new_value);
3922 self
3923 }
3924 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3925 /// while executing the actual API request.
3926 ///
3927 /// ````text
3928 /// It should be used to handle progress information, and to implement a certain level of resilience.
3929 /// ````
3930 ///
3931 /// Sets the *delegate* property to the given value.
3932 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PersonListCall<'a, C> {
3933 self._delegate = Some(new_value);
3934 self
3935 }
3936
3937 /// Set any additional parameter of the query string used in the request.
3938 /// It should be used to set parameters which are not yet available through their own
3939 /// setters.
3940 ///
3941 /// Please note that this method must not be used to set any of the known parameters
3942 /// which have their own setter method. If done anyway, the request will fail.
3943 ///
3944 /// # Additional Parameters
3945 ///
3946 /// * *alt* (query-string) - Data format for the response.
3947 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3948 /// * *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.
3949 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3950 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3951 /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
3952 /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
3953 pub fn param<T>(mut self, name: T, value: T) -> PersonListCall<'a, C>
3954 where
3955 T: AsRef<str>,
3956 {
3957 self._additional_params
3958 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3959 self
3960 }
3961
3962 /// Identifies the authorization scope for the method you are building.
3963 ///
3964 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3965 /// [`Scope::Login`].
3966 ///
3967 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3968 /// tokens for more than one scope.
3969 ///
3970 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3971 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3972 /// sufficient, a read-write scope will do as well.
3973 pub fn add_scope<St>(mut self, scope: St) -> PersonListCall<'a, C>
3974 where
3975 St: AsRef<str>,
3976 {
3977 self._scopes.insert(String::from(scope.as_ref()));
3978 self
3979 }
3980 /// Identifies the authorization scope(s) for the method you are building.
3981 ///
3982 /// See [`Self::add_scope()`] for details.
3983 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonListCall<'a, C>
3984 where
3985 I: IntoIterator<Item = St>,
3986 St: AsRef<str>,
3987 {
3988 self._scopes
3989 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3990 self
3991 }
3992
3993 /// Removes all scopes, and no default scope will be used either.
3994 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3995 /// for details).
3996 pub fn clear_scopes(mut self) -> PersonListCall<'a, C> {
3997 self._scopes.clear();
3998 self
3999 }
4000}
4001
4002/// Shut down. See https://developers.google.com/+/api-shutdown for more details.
4003///
4004/// A builder for the *listByActivity* method supported by a *person* resource.
4005/// It is not used directly, but through a [`PersonMethods`] instance.
4006///
4007/// # Example
4008///
4009/// Instantiate a resource method builder
4010///
4011/// ```test_harness,no_run
4012/// # extern crate hyper;
4013/// # extern crate hyper_rustls;
4014/// # extern crate google_plus1 as plus1;
4015/// # async fn dox() {
4016/// # use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4017///
4018/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4019/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4020/// # .with_native_roots()
4021/// # .unwrap()
4022/// # .https_only()
4023/// # .enable_http2()
4024/// # .build();
4025///
4026/// # let executor = hyper_util::rt::TokioExecutor::new();
4027/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4028/// # secret,
4029/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4030/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4031/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4032/// # ),
4033/// # ).build().await.unwrap();
4034///
4035/// # let client = hyper_util::client::legacy::Client::builder(
4036/// # hyper_util::rt::TokioExecutor::new()
4037/// # )
4038/// # .build(
4039/// # hyper_rustls::HttpsConnectorBuilder::new()
4040/// # .with_native_roots()
4041/// # .unwrap()
4042/// # .https_or_http()
4043/// # .enable_http2()
4044/// # .build()
4045/// # );
4046/// # let mut hub = Plus::new(client, auth);
4047/// // You can configure optional parameters by calling the respective setters at will, and
4048/// // execute the final call using `doit()`.
4049/// // Values shown here are possibly random and not representative !
4050/// let result = hub.people().list_by_activity("activityId", "collection")
4051/// .page_token("sed")
4052/// .max_results(31)
4053/// .doit().await;
4054/// # }
4055/// ```
4056pub struct PersonListByActivityCall<'a, C>
4057where
4058 C: 'a,
4059{
4060 hub: &'a Plus<C>,
4061 _activity_id: String,
4062 _collection: String,
4063 _page_token: Option<String>,
4064 _max_results: Option<u32>,
4065 _delegate: Option<&'a mut dyn common::Delegate>,
4066 _additional_params: HashMap<String, String>,
4067 _scopes: BTreeSet<String>,
4068}
4069
4070impl<'a, C> common::CallBuilder for PersonListByActivityCall<'a, C> {}
4071
4072impl<'a, C> PersonListByActivityCall<'a, C>
4073where
4074 C: common::Connector,
4075{
4076 /// Perform the operation you have build so far.
4077 pub async fn doit(mut self) -> common::Result<(common::Response, PeopleFeed)> {
4078 use std::borrow::Cow;
4079 use std::io::{Read, Seek};
4080
4081 use common::{url::Params, ToParts};
4082 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4083
4084 let mut dd = common::DefaultDelegate;
4085 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4086 dlg.begin(common::MethodInfo {
4087 id: "plus.people.listByActivity",
4088 http_method: hyper::Method::GET,
4089 });
4090
4091 for &field in ["alt", "activityId", "collection", "pageToken", "maxResults"].iter() {
4092 if self._additional_params.contains_key(field) {
4093 dlg.finished(false);
4094 return Err(common::Error::FieldClash(field));
4095 }
4096 }
4097
4098 let mut params = Params::with_capacity(6 + self._additional_params.len());
4099 params.push("activityId", self._activity_id);
4100 params.push("collection", self._collection);
4101 if let Some(value) = self._page_token.as_ref() {
4102 params.push("pageToken", value);
4103 }
4104 if let Some(value) = self._max_results.as_ref() {
4105 params.push("maxResults", value.to_string());
4106 }
4107
4108 params.extend(self._additional_params.iter());
4109
4110 params.push("alt", "json");
4111 let mut url = self.hub._base_url.clone() + "activities/{activityId}/people/{collection}";
4112 if self._scopes.is_empty() {
4113 self._scopes.insert(Scope::Login.as_ref().to_string());
4114 }
4115
4116 #[allow(clippy::single_element_loop)]
4117 for &(find_this, param_name) in [
4118 ("{activityId}", "activityId"),
4119 ("{collection}", "collection"),
4120 ]
4121 .iter()
4122 {
4123 url = params.uri_replacement(url, param_name, find_this, false);
4124 }
4125 {
4126 let to_remove = ["collection", "activityId"];
4127 params.remove_params(&to_remove);
4128 }
4129
4130 let url = params.parse_with_url(&url);
4131
4132 loop {
4133 let token = match self
4134 .hub
4135 .auth
4136 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4137 .await
4138 {
4139 Ok(token) => token,
4140 Err(e) => match dlg.token(e) {
4141 Ok(token) => token,
4142 Err(e) => {
4143 dlg.finished(false);
4144 return Err(common::Error::MissingToken(e));
4145 }
4146 },
4147 };
4148 let mut req_result = {
4149 let client = &self.hub.client;
4150 dlg.pre_request();
4151 let mut req_builder = hyper::Request::builder()
4152 .method(hyper::Method::GET)
4153 .uri(url.as_str())
4154 .header(USER_AGENT, self.hub._user_agent.clone());
4155
4156 if let Some(token) = token.as_ref() {
4157 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4158 }
4159
4160 let request = req_builder
4161 .header(CONTENT_LENGTH, 0_u64)
4162 .body(common::to_body::<String>(None));
4163
4164 client.request(request.unwrap()).await
4165 };
4166
4167 match req_result {
4168 Err(err) => {
4169 if let common::Retry::After(d) = dlg.http_error(&err) {
4170 sleep(d).await;
4171 continue;
4172 }
4173 dlg.finished(false);
4174 return Err(common::Error::HttpError(err));
4175 }
4176 Ok(res) => {
4177 let (mut parts, body) = res.into_parts();
4178 let mut body = common::Body::new(body);
4179 if !parts.status.is_success() {
4180 let bytes = common::to_bytes(body).await.unwrap_or_default();
4181 let error = serde_json::from_str(&common::to_string(&bytes));
4182 let response = common::to_response(parts, bytes.into());
4183
4184 if let common::Retry::After(d) =
4185 dlg.http_failure(&response, error.as_ref().ok())
4186 {
4187 sleep(d).await;
4188 continue;
4189 }
4190
4191 dlg.finished(false);
4192
4193 return Err(match error {
4194 Ok(value) => common::Error::BadRequest(value),
4195 _ => common::Error::Failure(response),
4196 });
4197 }
4198 let response = {
4199 let bytes = common::to_bytes(body).await.unwrap_or_default();
4200 let encoded = common::to_string(&bytes);
4201 match serde_json::from_str(&encoded) {
4202 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4203 Err(error) => {
4204 dlg.response_json_decode_error(&encoded, &error);
4205 return Err(common::Error::JsonDecodeError(
4206 encoded.to_string(),
4207 error,
4208 ));
4209 }
4210 }
4211 };
4212
4213 dlg.finished(true);
4214 return Ok(response);
4215 }
4216 }
4217 }
4218 }
4219
4220 /// The ID of the activity to get the list of people for.
4221 ///
4222 /// Sets the *activity id* path property to the given value.
4223 ///
4224 /// Even though the property as already been set when instantiating this call,
4225 /// we provide this method for API completeness.
4226 pub fn activity_id(mut self, new_value: &str) -> PersonListByActivityCall<'a, C> {
4227 self._activity_id = new_value.to_string();
4228 self
4229 }
4230 /// The collection of people to list.
4231 ///
4232 /// Sets the *collection* path property to the given value.
4233 ///
4234 /// Even though the property as already been set when instantiating this call,
4235 /// we provide this method for API completeness.
4236 pub fn collection(mut self, new_value: &str) -> PersonListByActivityCall<'a, C> {
4237 self._collection = new_value.to_string();
4238 self
4239 }
4240 /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response.
4241 ///
4242 /// Sets the *page token* query property to the given value.
4243 pub fn page_token(mut self, new_value: &str) -> PersonListByActivityCall<'a, C> {
4244 self._page_token = Some(new_value.to_string());
4245 self
4246 }
4247 /// The maximum number of people to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.
4248 ///
4249 /// Sets the *max results* query property to the given value.
4250 pub fn max_results(mut self, new_value: u32) -> PersonListByActivityCall<'a, C> {
4251 self._max_results = Some(new_value);
4252 self
4253 }
4254 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4255 /// while executing the actual API request.
4256 ///
4257 /// ````text
4258 /// It should be used to handle progress information, and to implement a certain level of resilience.
4259 /// ````
4260 ///
4261 /// Sets the *delegate* property to the given value.
4262 pub fn delegate(
4263 mut self,
4264 new_value: &'a mut dyn common::Delegate,
4265 ) -> PersonListByActivityCall<'a, C> {
4266 self._delegate = Some(new_value);
4267 self
4268 }
4269
4270 /// Set any additional parameter of the query string used in the request.
4271 /// It should be used to set parameters which are not yet available through their own
4272 /// setters.
4273 ///
4274 /// Please note that this method must not be used to set any of the known parameters
4275 /// which have their own setter method. If done anyway, the request will fail.
4276 ///
4277 /// # Additional Parameters
4278 ///
4279 /// * *alt* (query-string) - Data format for the response.
4280 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4281 /// * *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.
4282 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4283 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4284 /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
4285 /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
4286 pub fn param<T>(mut self, name: T, value: T) -> PersonListByActivityCall<'a, C>
4287 where
4288 T: AsRef<str>,
4289 {
4290 self._additional_params
4291 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4292 self
4293 }
4294
4295 /// Identifies the authorization scope for the method you are building.
4296 ///
4297 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4298 /// [`Scope::Login`].
4299 ///
4300 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4301 /// tokens for more than one scope.
4302 ///
4303 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4304 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4305 /// sufficient, a read-write scope will do as well.
4306 pub fn add_scope<St>(mut self, scope: St) -> PersonListByActivityCall<'a, C>
4307 where
4308 St: AsRef<str>,
4309 {
4310 self._scopes.insert(String::from(scope.as_ref()));
4311 self
4312 }
4313 /// Identifies the authorization scope(s) for the method you are building.
4314 ///
4315 /// See [`Self::add_scope()`] for details.
4316 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonListByActivityCall<'a, C>
4317 where
4318 I: IntoIterator<Item = St>,
4319 St: AsRef<str>,
4320 {
4321 self._scopes
4322 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4323 self
4324 }
4325
4326 /// Removes all scopes, and no default scope will be used either.
4327 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4328 /// for details).
4329 pub fn clear_scopes(mut self) -> PersonListByActivityCall<'a, C> {
4330 self._scopes.clear();
4331 self
4332 }
4333}
4334
4335/// Shut down. See https://developers.google.com/+/api-shutdown for more details.
4336///
4337/// A builder for the *search* method supported by a *person* resource.
4338/// It is not used directly, but through a [`PersonMethods`] instance.
4339///
4340/// # Example
4341///
4342/// Instantiate a resource method builder
4343///
4344/// ```test_harness,no_run
4345/// # extern crate hyper;
4346/// # extern crate hyper_rustls;
4347/// # extern crate google_plus1 as plus1;
4348/// # async fn dox() {
4349/// # use plus1::{Plus, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4350///
4351/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4352/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4353/// # .with_native_roots()
4354/// # .unwrap()
4355/// # .https_only()
4356/// # .enable_http2()
4357/// # .build();
4358///
4359/// # let executor = hyper_util::rt::TokioExecutor::new();
4360/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4361/// # secret,
4362/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4363/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4364/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4365/// # ),
4366/// # ).build().await.unwrap();
4367///
4368/// # let client = hyper_util::client::legacy::Client::builder(
4369/// # hyper_util::rt::TokioExecutor::new()
4370/// # )
4371/// # .build(
4372/// # hyper_rustls::HttpsConnectorBuilder::new()
4373/// # .with_native_roots()
4374/// # .unwrap()
4375/// # .https_or_http()
4376/// # .enable_http2()
4377/// # .build()
4378/// # );
4379/// # let mut hub = Plus::new(client, auth);
4380/// // You can configure optional parameters by calling the respective setters at will, and
4381/// // execute the final call using `doit()`.
4382/// // Values shown here are possibly random and not representative !
4383/// let result = hub.people().search("query")
4384/// .page_token("no")
4385/// .max_results(86)
4386/// .language("kasd")
4387/// .doit().await;
4388/// # }
4389/// ```
4390pub struct PersonSearchCall<'a, C>
4391where
4392 C: 'a,
4393{
4394 hub: &'a Plus<C>,
4395 _query: String,
4396 _page_token: Option<String>,
4397 _max_results: Option<u32>,
4398 _language: Option<String>,
4399 _delegate: Option<&'a mut dyn common::Delegate>,
4400 _additional_params: HashMap<String, String>,
4401 _scopes: BTreeSet<String>,
4402}
4403
4404impl<'a, C> common::CallBuilder for PersonSearchCall<'a, C> {}
4405
4406impl<'a, C> PersonSearchCall<'a, C>
4407where
4408 C: common::Connector,
4409{
4410 /// Perform the operation you have build so far.
4411 pub async fn doit(mut self) -> common::Result<(common::Response, PeopleFeed)> {
4412 use std::borrow::Cow;
4413 use std::io::{Read, Seek};
4414
4415 use common::{url::Params, ToParts};
4416 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4417
4418 let mut dd = common::DefaultDelegate;
4419 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4420 dlg.begin(common::MethodInfo {
4421 id: "plus.people.search",
4422 http_method: hyper::Method::GET,
4423 });
4424
4425 for &field in ["alt", "query", "pageToken", "maxResults", "language"].iter() {
4426 if self._additional_params.contains_key(field) {
4427 dlg.finished(false);
4428 return Err(common::Error::FieldClash(field));
4429 }
4430 }
4431
4432 let mut params = Params::with_capacity(6 + self._additional_params.len());
4433 params.push("query", self._query);
4434 if let Some(value) = self._page_token.as_ref() {
4435 params.push("pageToken", value);
4436 }
4437 if let Some(value) = self._max_results.as_ref() {
4438 params.push("maxResults", value.to_string());
4439 }
4440 if let Some(value) = self._language.as_ref() {
4441 params.push("language", value);
4442 }
4443
4444 params.extend(self._additional_params.iter());
4445
4446 params.push("alt", "json");
4447 let mut url = self.hub._base_url.clone() + "people";
4448 if self._scopes.is_empty() {
4449 self._scopes.insert(Scope::Login.as_ref().to_string());
4450 }
4451
4452 let url = params.parse_with_url(&url);
4453
4454 loop {
4455 let token = match self
4456 .hub
4457 .auth
4458 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4459 .await
4460 {
4461 Ok(token) => token,
4462 Err(e) => match dlg.token(e) {
4463 Ok(token) => token,
4464 Err(e) => {
4465 dlg.finished(false);
4466 return Err(common::Error::MissingToken(e));
4467 }
4468 },
4469 };
4470 let mut req_result = {
4471 let client = &self.hub.client;
4472 dlg.pre_request();
4473 let mut req_builder = hyper::Request::builder()
4474 .method(hyper::Method::GET)
4475 .uri(url.as_str())
4476 .header(USER_AGENT, self.hub._user_agent.clone());
4477
4478 if let Some(token) = token.as_ref() {
4479 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4480 }
4481
4482 let request = req_builder
4483 .header(CONTENT_LENGTH, 0_u64)
4484 .body(common::to_body::<String>(None));
4485
4486 client.request(request.unwrap()).await
4487 };
4488
4489 match req_result {
4490 Err(err) => {
4491 if let common::Retry::After(d) = dlg.http_error(&err) {
4492 sleep(d).await;
4493 continue;
4494 }
4495 dlg.finished(false);
4496 return Err(common::Error::HttpError(err));
4497 }
4498 Ok(res) => {
4499 let (mut parts, body) = res.into_parts();
4500 let mut body = common::Body::new(body);
4501 if !parts.status.is_success() {
4502 let bytes = common::to_bytes(body).await.unwrap_or_default();
4503 let error = serde_json::from_str(&common::to_string(&bytes));
4504 let response = common::to_response(parts, bytes.into());
4505
4506 if let common::Retry::After(d) =
4507 dlg.http_failure(&response, error.as_ref().ok())
4508 {
4509 sleep(d).await;
4510 continue;
4511 }
4512
4513 dlg.finished(false);
4514
4515 return Err(match error {
4516 Ok(value) => common::Error::BadRequest(value),
4517 _ => common::Error::Failure(response),
4518 });
4519 }
4520 let response = {
4521 let bytes = common::to_bytes(body).await.unwrap_or_default();
4522 let encoded = common::to_string(&bytes);
4523 match serde_json::from_str(&encoded) {
4524 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4525 Err(error) => {
4526 dlg.response_json_decode_error(&encoded, &error);
4527 return Err(common::Error::JsonDecodeError(
4528 encoded.to_string(),
4529 error,
4530 ));
4531 }
4532 }
4533 };
4534
4535 dlg.finished(true);
4536 return Ok(response);
4537 }
4538 }
4539 }
4540 }
4541
4542 /// Specify a query string for full text search of public text in all profiles.
4543 ///
4544 /// Sets the *query* query property to the given value.
4545 ///
4546 /// Even though the property as already been set when instantiating this call,
4547 /// we provide this method for API completeness.
4548 pub fn query(mut self, new_value: &str) -> PersonSearchCall<'a, C> {
4549 self._query = new_value.to_string();
4550 self
4551 }
4552 /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. This token can be of any length.
4553 ///
4554 /// Sets the *page token* query property to the given value.
4555 pub fn page_token(mut self, new_value: &str) -> PersonSearchCall<'a, C> {
4556 self._page_token = Some(new_value.to_string());
4557 self
4558 }
4559 /// The maximum number of people to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.
4560 ///
4561 /// Sets the *max results* query property to the given value.
4562 pub fn max_results(mut self, new_value: u32) -> PersonSearchCall<'a, C> {
4563 self._max_results = Some(new_value);
4564 self
4565 }
4566 /// Specify the preferred language to search with. See search language codes for available values.
4567 ///
4568 /// Sets the *language* query property to the given value.
4569 pub fn language(mut self, new_value: &str) -> PersonSearchCall<'a, C> {
4570 self._language = Some(new_value.to_string());
4571 self
4572 }
4573 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4574 /// while executing the actual API request.
4575 ///
4576 /// ````text
4577 /// It should be used to handle progress information, and to implement a certain level of resilience.
4578 /// ````
4579 ///
4580 /// Sets the *delegate* property to the given value.
4581 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PersonSearchCall<'a, C> {
4582 self._delegate = Some(new_value);
4583 self
4584 }
4585
4586 /// Set any additional parameter of the query string used in the request.
4587 /// It should be used to set parameters which are not yet available through their own
4588 /// setters.
4589 ///
4590 /// Please note that this method must not be used to set any of the known parameters
4591 /// which have their own setter method. If done anyway, the request will fail.
4592 ///
4593 /// # Additional Parameters
4594 ///
4595 /// * *alt* (query-string) - Data format for the response.
4596 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4597 /// * *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.
4598 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4599 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4600 /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
4601 /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
4602 pub fn param<T>(mut self, name: T, value: T) -> PersonSearchCall<'a, C>
4603 where
4604 T: AsRef<str>,
4605 {
4606 self._additional_params
4607 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4608 self
4609 }
4610
4611 /// Identifies the authorization scope for the method you are building.
4612 ///
4613 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4614 /// [`Scope::Login`].
4615 ///
4616 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4617 /// tokens for more than one scope.
4618 ///
4619 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4620 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4621 /// sufficient, a read-write scope will do as well.
4622 pub fn add_scope<St>(mut self, scope: St) -> PersonSearchCall<'a, C>
4623 where
4624 St: AsRef<str>,
4625 {
4626 self._scopes.insert(String::from(scope.as_ref()));
4627 self
4628 }
4629 /// Identifies the authorization scope(s) for the method you are building.
4630 ///
4631 /// See [`Self::add_scope()`] for details.
4632 pub fn add_scopes<I, St>(mut self, scopes: I) -> PersonSearchCall<'a, C>
4633 where
4634 I: IntoIterator<Item = St>,
4635 St: AsRef<str>,
4636 {
4637 self._scopes
4638 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4639 self
4640 }
4641
4642 /// Removes all scopes, and no default scope will be used either.
4643 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4644 /// for details).
4645 pub fn clear_scopes(mut self) -> PersonSearchCall<'a, C> {
4646 self._scopes.clear();
4647 self
4648 }
4649}