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