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