google_driveactivity2/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 and add to the activity record of files in your Google Drive
17 DriveActivity,
18
19 /// View the activity record of files in your Google Drive
20 DriveActivityReadonly,
21}
22
23impl AsRef<str> for Scope {
24 fn as_ref(&self) -> &str {
25 match *self {
26 Scope::DriveActivity => "https://www.googleapis.com/auth/drive.activity",
27 Scope::DriveActivityReadonly => {
28 "https://www.googleapis.com/auth/drive.activity.readonly"
29 }
30 }
31 }
32}
33
34#[allow(clippy::derivable_impls)]
35impl Default for Scope {
36 fn default() -> Scope {
37 Scope::DriveActivityReadonly
38 }
39}
40
41// ########
42// HUB ###
43// ######
44
45/// Central instance to access all DriveActivityHub related resource activities
46///
47/// # Examples
48///
49/// Instantiate a new hub
50///
51/// ```test_harness,no_run
52/// extern crate hyper;
53/// extern crate hyper_rustls;
54/// extern crate google_driveactivity2 as driveactivity2;
55/// use driveactivity2::api::QueryDriveActivityRequest;
56/// use driveactivity2::{Result, Error};
57/// # async fn dox() {
58/// use driveactivity2::{DriveActivityHub, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59///
60/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
61/// // `client_secret`, among other things.
62/// let secret: yup_oauth2::ApplicationSecret = Default::default();
63/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
64/// // unless you replace `None` with the desired Flow.
65/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
66/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
67/// // retrieve them from storage.
68/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
69/// .with_native_roots()
70/// .unwrap()
71/// .https_only()
72/// .enable_http2()
73/// .build();
74///
75/// let executor = hyper_util::rt::TokioExecutor::new();
76/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
77/// secret,
78/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79/// yup_oauth2::client::CustomHyperClientBuilder::from(
80/// hyper_util::client::legacy::Client::builder(executor).build(connector),
81/// ),
82/// ).build().await.unwrap();
83///
84/// let client = hyper_util::client::legacy::Client::builder(
85/// hyper_util::rt::TokioExecutor::new()
86/// )
87/// .build(
88/// hyper_rustls::HttpsConnectorBuilder::new()
89/// .with_native_roots()
90/// .unwrap()
91/// .https_or_http()
92/// .enable_http2()
93/// .build()
94/// );
95/// let mut hub = DriveActivityHub::new(client, auth);
96/// // As the method needs a request, you would usually fill it with the desired information
97/// // into the respective structure. Some of the parts shown here might not be applicable !
98/// // Values shown here are possibly random and not representative !
99/// let mut req = QueryDriveActivityRequest::default();
100///
101/// // You can configure optional parameters by calling the respective setters at will, and
102/// // execute the final call using `doit()`.
103/// // Values shown here are possibly random and not representative !
104/// let result = hub.activity().query(req)
105/// .doit().await;
106///
107/// match result {
108/// Err(e) => match e {
109/// // The Error enum provides details about what exactly happened.
110/// // You can also just use its `Debug`, `Display` or `Error` traits
111/// Error::HttpError(_)
112/// |Error::Io(_)
113/// |Error::MissingAPIKey
114/// |Error::MissingToken(_)
115/// |Error::Cancelled
116/// |Error::UploadSizeLimitExceeded(_, _)
117/// |Error::Failure(_)
118/// |Error::BadRequest(_)
119/// |Error::FieldClash(_)
120/// |Error::JsonDecodeError(_, _) => println!("{}", e),
121/// },
122/// Ok(res) => println!("Success: {:?}", res),
123/// }
124/// # }
125/// ```
126#[derive(Clone)]
127pub struct DriveActivityHub<C> {
128 pub client: common::Client<C>,
129 pub auth: Box<dyn common::GetToken>,
130 _user_agent: String,
131 _base_url: String,
132 _root_url: String,
133}
134
135impl<C> common::Hub for DriveActivityHub<C> {}
136
137impl<'a, C> DriveActivityHub<C> {
138 pub fn new<A: 'static + common::GetToken>(
139 client: common::Client<C>,
140 auth: A,
141 ) -> DriveActivityHub<C> {
142 DriveActivityHub {
143 client,
144 auth: Box::new(auth),
145 _user_agent: "google-api-rust-client/7.0.0".to_string(),
146 _base_url: "https://driveactivity.googleapis.com/".to_string(),
147 _root_url: "https://driveactivity.googleapis.com/".to_string(),
148 }
149 }
150
151 pub fn activity(&'a self) -> ActivityMethods<'a, C> {
152 ActivityMethods { hub: self }
153 }
154
155 /// Set the user-agent header field to use in all requests to the server.
156 /// It defaults to `google-api-rust-client/7.0.0`.
157 ///
158 /// Returns the previously set user-agent.
159 pub fn user_agent(&mut self, agent_name: String) -> String {
160 std::mem::replace(&mut self._user_agent, agent_name)
161 }
162
163 /// Set the base url to use in all requests to the server.
164 /// It defaults to `https://driveactivity.googleapis.com/`.
165 ///
166 /// Returns the previously set base url.
167 pub fn base_url(&mut self, new_base_url: String) -> String {
168 std::mem::replace(&mut self._base_url, new_base_url)
169 }
170
171 /// Set the root url to use in all requests to the server.
172 /// It defaults to `https://driveactivity.googleapis.com/`.
173 ///
174 /// Returns the previously set root url.
175 pub fn root_url(&mut self, new_root_url: String) -> String {
176 std::mem::replace(&mut self._root_url, new_root_url)
177 }
178}
179
180// ############
181// SCHEMAS ###
182// ##########
183/// Information about the action.
184///
185/// This type is not used in any activity, and only used as *part* of another schema.
186///
187#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
188#[serde_with::serde_as]
189#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
190pub struct Action {
191 /// The actor responsible for this action (or empty if all actors are responsible).
192 pub actor: Option<Actor>,
193 /// The type and detailed information about the action.
194 pub detail: Option<ActionDetail>,
195 /// The target this action affects (or empty if affecting all targets). This represents the state of the target immediately after this action occurred.
196 pub target: Option<Target>,
197 /// The action occurred over this time range.
198 #[serde(rename = "timeRange")]
199 pub time_range: Option<TimeRange>,
200 /// The action occurred at this specific time.
201 pub timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
202}
203
204impl common::Part for Action {}
205
206/// Data describing the type and additional information of an action.
207///
208/// This type is not used in any activity, and only used as *part* of another schema.
209///
210#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
211#[serde_with::serde_as]
212#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
213pub struct ActionDetail {
214 /// Label was changed.
215 #[serde(rename = "appliedLabelChange")]
216 pub applied_label_change: Option<AppliedLabelChange>,
217 /// A change about comments was made.
218 pub comment: Option<Comment>,
219 /// An object was created.
220 pub create: Option<Create>,
221 /// An object was deleted.
222 pub delete: Option<Delete>,
223 /// A change happened in data leak prevention status.
224 #[serde(rename = "dlpChange")]
225 pub dlp_change: Option<DataLeakPreventionChange>,
226 /// An object was edited.
227 pub edit: Option<Edit>,
228 /// An object was moved.
229 #[serde(rename = "move")]
230 pub move_: Option<Move>,
231 /// The permission on an object was changed.
232 #[serde(rename = "permissionChange")]
233 pub permission_change: Option<PermissionChange>,
234 /// An object was referenced in an application outside of Drive/Docs.
235 pub reference: Option<ApplicationReference>,
236 /// An object was renamed.
237 pub rename: Option<Rename>,
238 /// A deleted object was restored.
239 pub restore: Option<Restore>,
240 /// Settings were changed.
241 #[serde(rename = "settingsChange")]
242 pub settings_change: Option<SettingsChange>,
243}
244
245impl common::Part for ActionDetail {}
246
247/// The actor of a Drive activity.
248///
249/// This type is not used in any activity, and only used as *part* of another schema.
250///
251#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
252#[serde_with::serde_as]
253#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
254pub struct Actor {
255 /// An administrator.
256 pub administrator: Option<Administrator>,
257 /// An anonymous user.
258 pub anonymous: Option<AnonymousUser>,
259 /// An account acting on behalf of another.
260 pub impersonation: Option<Impersonation>,
261 /// A non-user actor (i.e. system triggered).
262 pub system: Option<SystemEvent>,
263 /// An end user.
264 pub user: Option<User>,
265}
266
267impl common::Part for Actor {}
268
269/// Empty message representing an administrator.
270///
271/// This type is not used in any activity, and only used as *part* of another schema.
272///
273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
274#[serde_with::serde_as]
275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
276pub struct Administrator {
277 _never_set: Option<bool>,
278}
279
280impl common::Part for Administrator {}
281
282/// Empty message representing an anonymous user or indicating the authenticated user should be anonymized.
283///
284/// This type is not used in any activity, and only used as *part* of another schema.
285///
286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
287#[serde_with::serde_as]
288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
289pub struct AnonymousUser {
290 _never_set: Option<bool>,
291}
292
293impl common::Part for AnonymousUser {}
294
295/// Represents any user (including a logged out user).
296///
297/// This type is not used in any activity, and only used as *part* of another schema.
298///
299#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
300#[serde_with::serde_as]
301#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
302pub struct Anyone {
303 _never_set: Option<bool>,
304}
305
306impl common::Part for Anyone {}
307
308/// Activity in applications other than Drive.
309///
310/// This type is not used in any activity, and only used as *part* of another schema.
311///
312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
313#[serde_with::serde_as]
314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
315pub struct ApplicationReference {
316 /// The reference type corresponding to this event.
317 #[serde(rename = "type")]
318 pub type_: Option<String>,
319}
320
321impl common::Part for ApplicationReference {}
322
323/// Label changes that were made on the Target.
324///
325/// This type is not used in any activity, and only used as *part* of another schema.
326///
327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
328#[serde_with::serde_as]
329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
330pub struct AppliedLabelChange {
331 /// Changes that were made to the Label on the Target.
332 pub changes: Option<Vec<AppliedLabelChangeDetail>>,
333}
334
335impl common::Part for AppliedLabelChange {}
336
337/// A change made to a Label on the Target.
338///
339/// This type is not used in any activity, and only used as *part* of another schema.
340///
341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
342#[serde_with::serde_as]
343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
344pub struct AppliedLabelChangeDetail {
345 /// Field Changes. Only present if `types` contains `LABEL_FIELD_VALUE_CHANGED`.
346 #[serde(rename = "fieldChanges")]
347 pub field_changes: Option<Vec<FieldValueChange>>,
348 /// The Label name representing the Label that changed. This name always contains the revision of the Label that was used when this Action occurred. The format is `labels/id@revision`.
349 pub label: Option<String>,
350 /// The human-readable title of the label that changed.
351 pub title: Option<String>,
352 /// The types of changes made to the Label on the Target.
353 pub types: Option<Vec<String>>,
354}
355
356impl common::Part for AppliedLabelChangeDetail {}
357
358/// A comment with an assignment.
359///
360/// This type is not used in any activity, and only used as *part* of another schema.
361///
362#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
363#[serde_with::serde_as]
364#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
365pub struct Assignment {
366 /// The user to whom the comment was assigned.
367 #[serde(rename = "assignedUser")]
368 pub assigned_user: Option<User>,
369 /// The sub-type of this event.
370 pub subtype: Option<String>,
371}
372
373impl common::Part for Assignment {}
374
375/// A change about comments on an object.
376///
377/// This type is not used in any activity, and only used as *part* of another schema.
378///
379#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
380#[serde_with::serde_as]
381#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
382pub struct Comment {
383 /// A change on an assignment.
384 pub assignment: Option<Assignment>,
385 /// Users who are mentioned in this comment.
386 #[serde(rename = "mentionedUsers")]
387 pub mentioned_users: Option<Vec<User>>,
388 /// A change on a regular posted comment.
389 pub post: Option<Post>,
390 /// A change on a suggestion.
391 pub suggestion: Option<Suggestion>,
392}
393
394impl common::Part for Comment {}
395
396/// How the individual activities are consolidated. If a set of activities is related they can be consolidated into one combined activity, such as one actor performing the same action on multiple targets, or multiple actors performing the same action on a single target. The strategy defines the rules for which activities are related.
397///
398/// This type is not used in any activity, and only used as *part* of another schema.
399///
400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
401#[serde_with::serde_as]
402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
403pub struct ConsolidationStrategy {
404 /// The individual activities are consolidated using the legacy strategy.
405 pub legacy: Option<Legacy>,
406 /// The individual activities are not consolidated.
407 pub none: Option<NoConsolidation>,
408}
409
410impl common::Part for ConsolidationStrategy {}
411
412/// An object was created by copying an existing object.
413///
414/// This type is not used in any activity, and only used as *part* of another schema.
415///
416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
417#[serde_with::serde_as]
418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
419pub struct Copy {
420 /// The original object.
421 #[serde(rename = "originalObject")]
422 pub original_object: Option<TargetReference>,
423}
424
425impl common::Part for Copy {}
426
427/// An object was created.
428///
429/// This type is not used in any activity, and only used as *part* of another schema.
430///
431#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
432#[serde_with::serde_as]
433#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
434pub struct Create {
435 /// If present, indicates the object was created by copying an existing Drive object.
436 pub copy: Option<Copy>,
437 /// If present, indicates the object was newly created (e.g. as a blank document), not derived from a Drive object or external object.
438 pub new: Option<New>,
439 /// If present, indicates the object originated externally and was uploaded to Drive.
440 pub upload: Option<Upload>,
441}
442
443impl common::Part for Create {}
444
445/// A change in the object's data leak prevention status.
446///
447/// This type is not used in any activity, and only used as *part* of another schema.
448///
449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
450#[serde_with::serde_as]
451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
452pub struct DataLeakPreventionChange {
453 /// The type of Data Leak Prevention (DLP) change.
454 #[serde(rename = "type")]
455 pub type_: Option<String>,
456}
457
458impl common::Part for DataLeakPreventionChange {}
459
460/// Wrapper for Date Field value.
461///
462/// This type is not used in any activity, and only used as *part* of another schema.
463///
464#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
465#[serde_with::serde_as]
466#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
467pub struct Date {
468 /// Date value.
469 pub value: Option<chrono::DateTime<chrono::offset::Utc>>,
470}
471
472impl common::Part for Date {}
473
474/// An object was deleted.
475///
476/// This type is not used in any activity, and only used as *part* of another schema.
477///
478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
479#[serde_with::serde_as]
480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
481pub struct Delete {
482 /// The type of delete action taken.
483 #[serde(rename = "type")]
484 pub type_: Option<String>,
485}
486
487impl common::Part for Delete {}
488
489/// A user whose account has since been deleted.
490///
491/// This type is not used in any activity, and only used as *part* of another schema.
492///
493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
494#[serde_with::serde_as]
495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
496pub struct DeletedUser {
497 _never_set: Option<bool>,
498}
499
500impl common::Part for DeletedUser {}
501
502/// Information about a domain.
503///
504/// This type is not used in any activity, and only used as *part* of another schema.
505///
506#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
507#[serde_with::serde_as]
508#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
509pub struct Domain {
510 /// An opaque string used to identify this domain.
511 #[serde(rename = "legacyId")]
512 pub legacy_id: Option<String>,
513 /// The name of the domain, e.g. `google.com`.
514 pub name: Option<String>,
515}
516
517impl common::Part for Domain {}
518
519/// Information about a shared drive.
520///
521/// This type is not used in any activity, and only used as *part* of another schema.
522///
523#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
524#[serde_with::serde_as]
525#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
526pub struct Drive {
527 /// The resource name of the shared drive. The format is `COLLECTION_ID/DRIVE_ID`. Clients should not assume a specific collection ID for this resource name.
528 pub name: Option<String>,
529 /// The root of this shared drive.
530 pub root: Option<DriveItem>,
531 /// The title of the shared drive.
532 pub title: Option<String>,
533}
534
535impl common::Part for Drive {}
536
537/// A single Drive activity comprising one or more Actions by one or more Actors on one or more Targets. Some Action groupings occur spontaneously, such as moving an item into a shared folder triggering a permission change. Other groupings of related Actions, such as multiple Actors editing one item or moving multiple files into a new folder, are controlled by the selection of a ConsolidationStrategy in the QueryDriveActivityRequest.
538///
539/// This type is not used in any activity, and only used as *part* of another schema.
540///
541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
542#[serde_with::serde_as]
543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
544pub struct DriveActivity {
545 /// Details on all actions in this activity.
546 pub actions: Option<Vec<Action>>,
547 /// All actor(s) responsible for the activity.
548 pub actors: Option<Vec<Actor>>,
549 /// Key information about the primary action for this activity. This is either representative, or the most important, of all actions in the activity, according to the ConsolidationStrategy in the request.
550 #[serde(rename = "primaryActionDetail")]
551 pub primary_action_detail: Option<ActionDetail>,
552 /// All Google Drive objects this activity is about (e.g. file, folder, drive). This represents the state of the target immediately after the actions occurred.
553 pub targets: Option<Vec<Target>>,
554 /// The activity occurred over this time range.
555 #[serde(rename = "timeRange")]
556 pub time_range: Option<TimeRange>,
557 /// The activity occurred at this specific time.
558 pub timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
559}
560
561impl common::Part for DriveActivity {}
562
563/// A Drive item which is a file.
564///
565/// This type is not used in any activity, and only used as *part* of another schema.
566///
567#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
568#[serde_with::serde_as]
569#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
570pub struct DriveFile {
571 _never_set: Option<bool>,
572}
573
574impl common::Part for DriveFile {}
575
576/// A Drive item which is a folder.
577///
578/// This type is not used in any activity, and only used as *part* of another schema.
579///
580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
581#[serde_with::serde_as]
582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
583pub struct DriveFolder {
584 /// The type of Drive folder.
585 #[serde(rename = "type")]
586 pub type_: Option<String>,
587}
588
589impl common::Part for DriveFolder {}
590
591/// A Drive item, such as a file or folder.
592///
593/// This type is not used in any activity, and only used as *part* of another schema.
594///
595#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
596#[serde_with::serde_as]
597#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
598pub struct DriveItem {
599 /// The Drive item is a file.
600 #[serde(rename = "driveFile")]
601 pub drive_file: Option<DriveFile>,
602 /// The Drive item is a folder. Includes information about the type of folder.
603 #[serde(rename = "driveFolder")]
604 pub drive_folder: Option<DriveFolder>,
605 /// This field is deprecated; please use the `driveFile` field instead.
606 pub file: Option<File>,
607 /// This field is deprecated; please use the `driveFolder` field instead.
608 pub folder: Option<Folder>,
609 /// The MIME type of the Drive item. See https://developers.google.com/workspace/drive/v3/web/mime-types.
610 #[serde(rename = "mimeType")]
611 pub mime_type: Option<String>,
612 /// The target Drive item. The format is `items/ITEM_ID`.
613 pub name: Option<String>,
614 /// Information about the owner of this Drive item.
615 pub owner: Option<Owner>,
616 /// The title of the Drive item.
617 pub title: Option<String>,
618}
619
620impl common::Part for DriveItem {}
621
622/// A lightweight reference to a Drive item, such as a file or folder.
623///
624/// This type is not used in any activity, and only used as *part* of another schema.
625///
626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
627#[serde_with::serde_as]
628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
629pub struct DriveItemReference {
630 /// The Drive item is a file.
631 #[serde(rename = "driveFile")]
632 pub drive_file: Option<DriveFile>,
633 /// The Drive item is a folder. Includes information about the type of folder.
634 #[serde(rename = "driveFolder")]
635 pub drive_folder: Option<DriveFolder>,
636 /// This field is deprecated; please use the `driveFile` field instead.
637 pub file: Option<File>,
638 /// This field is deprecated; please use the `driveFolder` field instead.
639 pub folder: Option<Folder>,
640 /// The target Drive item. The format is `items/ITEM_ID`.
641 pub name: Option<String>,
642 /// The title of the Drive item.
643 pub title: Option<String>,
644}
645
646impl common::Part for DriveItemReference {}
647
648/// A lightweight reference to a shared drive.
649///
650/// This type is not used in any activity, and only used as *part* of another schema.
651///
652#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
653#[serde_with::serde_as]
654#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
655pub struct DriveReference {
656 /// The resource name of the shared drive. The format is `COLLECTION_ID/DRIVE_ID`. Clients should not assume a specific collection ID for this resource name.
657 pub name: Option<String>,
658 /// The title of the shared drive.
659 pub title: Option<String>,
660}
661
662impl common::Part for DriveReference {}
663
664/// An empty message indicating an object was edited.
665///
666/// This type is not used in any activity, and only used as *part* of another schema.
667///
668#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
669#[serde_with::serde_as]
670#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
671pub struct Edit {
672 _never_set: Option<bool>,
673}
674
675impl common::Part for Edit {}
676
677/// Contains a value of a Field.
678///
679/// This type is not used in any activity, and only used as *part* of another schema.
680///
681#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
682#[serde_with::serde_as]
683#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
684pub struct FieldValue {
685 /// Date Field value.
686 pub date: Option<Date>,
687 /// Integer Field value.
688 pub integer: Option<Integer>,
689 /// Selection Field value.
690 pub selection: Option<Selection>,
691 /// Selection List Field value.
692 #[serde(rename = "selectionList")]
693 pub selection_list: Option<SelectionList>,
694 /// Text Field value.
695 pub text: Option<Text>,
696 /// Text List Field value.
697 #[serde(rename = "textList")]
698 pub text_list: Option<TextList>,
699 /// User Field value.
700 pub user: Option<SingleUser>,
701 /// User List Field value.
702 #[serde(rename = "userList")]
703 pub user_list: Option<UserList>,
704}
705
706impl common::Part for FieldValue {}
707
708/// Change to a Field value.
709///
710/// This type is not used in any activity, and only used as *part* of another schema.
711///
712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
713#[serde_with::serde_as]
714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
715pub struct FieldValueChange {
716 /// The human-readable display name for this field.
717 #[serde(rename = "displayName")]
718 pub display_name: Option<String>,
719 /// The ID of this field. Field IDs are unique within a Label.
720 #[serde(rename = "fieldId")]
721 pub field_id: Option<String>,
722 /// The value that is now set on the field. If not present, the field was cleared. At least one of {old_value|new_value} is always set.
723 #[serde(rename = "newValue")]
724 pub new_value: Option<FieldValue>,
725 /// The value that was previously set on the field. If not present, the field was newly set. At least one of {old_value|new_value} is always set.
726 #[serde(rename = "oldValue")]
727 pub old_value: Option<FieldValue>,
728}
729
730impl common::Part for FieldValueChange {}
731
732/// This item is deprecated; please see `DriveFile` instead.
733///
734/// This type is not used in any activity, and only used as *part* of another schema.
735///
736#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
737#[serde_with::serde_as]
738#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
739pub struct File {
740 _never_set: Option<bool>,
741}
742
743impl common::Part for File {}
744
745/// A comment on a file.
746///
747/// This type is not used in any activity, and only used as *part* of another schema.
748///
749#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
750#[serde_with::serde_as]
751#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
752pub struct FileComment {
753 /// The comment in the discussion thread. This identifier is an opaque string compatible with the Drive API; see https://developers.google.com/workspace/drive/v3/reference/comments/get
754 #[serde(rename = "legacyCommentId")]
755 pub legacy_comment_id: Option<String>,
756 /// The discussion thread to which the comment was added. This identifier is an opaque string compatible with the Drive API and references the first comment in a discussion; see https://developers.google.com/workspace/drive/v3/reference/comments/get
757 #[serde(rename = "legacyDiscussionId")]
758 pub legacy_discussion_id: Option<String>,
759 /// The link to the discussion thread containing this comment, for example, `https://docs.google.com/DOCUMENT_ID/edit?disco=THREAD_ID`.
760 #[serde(rename = "linkToDiscussion")]
761 pub link_to_discussion: Option<String>,
762 /// The Drive item containing this comment.
763 pub parent: Option<DriveItem>,
764}
765
766impl common::Part for FileComment {}
767
768/// This item is deprecated; please see `DriveFolder` instead.
769///
770/// This type is not used in any activity, and only used as *part* of another schema.
771///
772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
773#[serde_with::serde_as]
774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
775pub struct Folder {
776 /// This field is deprecated; please see `DriveFolder.type` instead.
777 #[serde(rename = "type")]
778 pub type_: Option<String>,
779}
780
781impl common::Part for Folder {}
782
783/// Information about a group.
784///
785/// This type is not used in any activity, and only used as *part* of another schema.
786///
787#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
788#[serde_with::serde_as]
789#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
790pub struct Group {
791 /// The email address of the group.
792 pub email: Option<String>,
793 /// The title of the group.
794 pub title: Option<String>,
795}
796
797impl common::Part for Group {}
798
799/// Information about an impersonation, where an admin acts on behalf of an end user. Information about the acting admin is not currently available.
800///
801/// This type is not used in any activity, and only used as *part* of another schema.
802///
803#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
804#[serde_with::serde_as]
805#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
806pub struct Impersonation {
807 /// The impersonated user.
808 #[serde(rename = "impersonatedUser")]
809 pub impersonated_user: Option<User>,
810}
811
812impl common::Part for Impersonation {}
813
814/// Wrapper for Integer Field value.
815///
816/// This type is not used in any activity, and only used as *part* of another schema.
817///
818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
819#[serde_with::serde_as]
820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
821pub struct Integer {
822 /// Integer value.
823 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
824 pub value: Option<i64>,
825}
826
827impl common::Part for Integer {}
828
829/// A known user.
830///
831/// This type is not used in any activity, and only used as *part* of another schema.
832///
833#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
834#[serde_with::serde_as]
835#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
836pub struct KnownUser {
837 /// True if this is the user making the request.
838 #[serde(rename = "isCurrentUser")]
839 pub is_current_user: Option<bool>,
840 /// The identifier for this user that can be used with the People API to get more information. The format is `people/ACCOUNT_ID`. See https://developers.google.com/people/.
841 #[serde(rename = "personName")]
842 pub person_name: Option<String>,
843}
844
845impl common::Part for KnownUser {}
846
847/// A strategy that consolidates activities using the grouping rules from the legacy V1 Activity API. Similar actions occurring within a window of time can be grouped across multiple targets (such as moving a set of files at once) or multiple actors (such as several users editing the same item). Grouping rules for this strategy are specific to each type of action.
848///
849/// This type is not used in any activity, and only used as *part* of another schema.
850///
851#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
852#[serde_with::serde_as]
853#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
854pub struct Legacy {
855 _never_set: Option<bool>,
856}
857
858impl common::Part for Legacy {}
859
860/// An object was moved.
861///
862/// This type is not used in any activity, and only used as *part* of another schema.
863///
864#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
865#[serde_with::serde_as]
866#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
867pub struct Move {
868 /// The added parent object(s).
869 #[serde(rename = "addedParents")]
870 pub added_parents: Option<Vec<TargetReference>>,
871 /// The removed parent object(s).
872 #[serde(rename = "removedParents")]
873 pub removed_parents: Option<Vec<TargetReference>>,
874}
875
876impl common::Part for Move {}
877
878/// An object was created from scratch.
879///
880/// This type is not used in any activity, and only used as *part* of another schema.
881///
882#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
883#[serde_with::serde_as]
884#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
885pub struct New {
886 _never_set: Option<bool>,
887}
888
889impl common::Part for New {}
890
891/// A strategy that does no consolidation of individual activities.
892///
893/// This type is not used in any activity, and only used as *part* of another schema.
894///
895#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
896#[serde_with::serde_as]
897#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
898pub struct NoConsolidation {
899 _never_set: Option<bool>,
900}
901
902impl common::Part for NoConsolidation {}
903
904/// Information about the owner of a Drive item.
905///
906/// This type is not used in any activity, and only used as *part* of another schema.
907///
908#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
909#[serde_with::serde_as]
910#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
911pub struct Owner {
912 /// The domain of the Drive item owner.
913 pub domain: Option<Domain>,
914 /// The drive that owns the item.
915 pub drive: Option<DriveReference>,
916 /// This field is deprecated; please use the `drive` field instead.
917 #[serde(rename = "teamDrive")]
918 pub team_drive: Option<TeamDriveReference>,
919 /// The user that owns the Drive item.
920 pub user: Option<User>,
921}
922
923impl common::Part for Owner {}
924
925/// The permission setting of an object.
926///
927/// This type is not used in any activity, and only used as *part* of another schema.
928///
929#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
930#[serde_with::serde_as]
931#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
932pub struct Permission {
933 /// If true, the item can be discovered (e.g. in the user's "Shared with me" collection) without needing a link to the item.
934 #[serde(rename = "allowDiscovery")]
935 pub allow_discovery: Option<bool>,
936 /// If set, this permission applies to anyone, even logged out users.
937 pub anyone: Option<Anyone>,
938 /// The domain to whom this permission applies.
939 pub domain: Option<Domain>,
940 /// The group to whom this permission applies.
941 pub group: Option<Group>,
942 /// Indicates the [Google Drive permissions role](https://developers.google.com/workspace/drive/web/manage-sharing#roles). The role determines a user's ability to read, write, and comment on items.
943 pub role: Option<String>,
944 /// The user to whom this permission applies.
945 pub user: Option<User>,
946}
947
948impl common::Part for Permission {}
949
950/// A change of the permission setting on an item.
951///
952/// This type is not used in any activity, and only used as *part* of another schema.
953///
954#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
955#[serde_with::serde_as]
956#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
957pub struct PermissionChange {
958 /// The set of permissions added by this change.
959 #[serde(rename = "addedPermissions")]
960 pub added_permissions: Option<Vec<Permission>>,
961 /// The set of permissions removed by this change.
962 #[serde(rename = "removedPermissions")]
963 pub removed_permissions: Option<Vec<Permission>>,
964}
965
966impl common::Part for PermissionChange {}
967
968/// A regular posted comment.
969///
970/// This type is not used in any activity, and only used as *part* of another schema.
971///
972#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
973#[serde_with::serde_as]
974#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
975pub struct Post {
976 /// The sub-type of this event.
977 pub subtype: Option<String>,
978}
979
980impl common::Part for Post {}
981
982/// The request message for querying Drive activity.
983///
984/// # Activities
985///
986/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
987/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
988///
989/// * [query activity](ActivityQueryCall) (request)
990#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
991#[serde_with::serde_as]
992#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
993pub struct QueryDriveActivityRequest {
994 /// Return activities for this Drive folder, plus all children and descendants. The format is `items/ITEM_ID`.
995 #[serde(rename = "ancestorName")]
996 pub ancestor_name: Option<String>,
997 /// Details on how to consolidate related actions that make up the activity. If not set, then related actions aren't consolidated.
998 #[serde(rename = "consolidationStrategy")]
999 pub consolidation_strategy: Option<ConsolidationStrategy>,
1000 /// The filtering for items returned from this query request. The format of the filter string is a sequence of expressions, joined by an optional "AND", where each expression is of the form "field operator value". Supported fields: - `time`: Uses numerical operators on date values either in terms of milliseconds since Jan 1, 1970 or in RFC 3339 format. Examples: - `time > 1452409200000 AND time <= 1492812924310` - `time >= "2016-01-10T01:02:03-05:00"` - `detail.action_detail_case`: Uses the "has" operator (:) and either a singular value or a list of allowed action types enclosed in parentheses, separated by a space. To exclude a result from the response, prepend a hyphen (`-`) to the beginning of the filter string. Examples: - `detail.action_detail_case:RENAME` - `detail.action_detail_case:(CREATE RESTORE)` - `-detail.action_detail_case:MOVE`
1001 pub filter: Option<String>,
1002 /// Return activities for this Drive item. The format is `items/ITEM_ID`.
1003 #[serde(rename = "itemName")]
1004 pub item_name: Option<String>,
1005 /// The minimum number of activities desired in the response; the server attempts to return at least this quantity. The server may also return fewer activities if it has a partial response ready before the request times out. If not set, a default value is used.
1006 #[serde(rename = "pageSize")]
1007 pub page_size: Option<i32>,
1008 /// The token identifies which page of results to return. Set this to the next_page_token value returned from a previous query to obtain the following page of results. If not set, the first page of results is returned.
1009 #[serde(rename = "pageToken")]
1010 pub page_token: Option<String>,
1011}
1012
1013impl common::RequestValue for QueryDriveActivityRequest {}
1014
1015/// Response message for querying Drive activity.
1016///
1017/// # Activities
1018///
1019/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1020/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1021///
1022/// * [query activity](ActivityQueryCall) (response)
1023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1024#[serde_with::serde_as]
1025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1026pub struct QueryDriveActivityResponse {
1027 /// List of activity requested.
1028 pub activities: Option<Vec<DriveActivity>>,
1029 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
1030 #[serde(rename = "nextPageToken")]
1031 pub next_page_token: Option<String>,
1032}
1033
1034impl common::ResponseResult for QueryDriveActivityResponse {}
1035
1036/// An object was renamed.
1037///
1038/// This type is not used in any activity, and only used as *part* of another schema.
1039///
1040#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1041#[serde_with::serde_as]
1042#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1043pub struct Rename {
1044 /// The new title of the drive object.
1045 #[serde(rename = "newTitle")]
1046 pub new_title: Option<String>,
1047 /// The previous title of the drive object.
1048 #[serde(rename = "oldTitle")]
1049 pub old_title: Option<String>,
1050}
1051
1052impl common::Part for Rename {}
1053
1054/// A deleted object was restored.
1055///
1056/// This type is not used in any activity, and only used as *part* of another schema.
1057///
1058#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1059#[serde_with::serde_as]
1060#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1061pub struct Restore {
1062 /// The type of restore action taken.
1063 #[serde(rename = "type")]
1064 pub type_: Option<String>,
1065}
1066
1067impl common::Part for Restore {}
1068
1069/// Information about restriction policy changes to a feature.
1070///
1071/// This type is not used in any activity, and only used as *part* of another schema.
1072///
1073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1074#[serde_with::serde_as]
1075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1076pub struct RestrictionChange {
1077 /// The feature which had a change in restriction policy.
1078 pub feature: Option<String>,
1079 /// The restriction in place after the change.
1080 #[serde(rename = "newRestriction")]
1081 pub new_restriction: Option<String>,
1082}
1083
1084impl common::Part for RestrictionChange {}
1085
1086/// Wrapper for Selection Field value as combined value/display_name pair for selected choice.
1087///
1088/// This type is not used in any activity, and only used as *part* of another schema.
1089///
1090#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1091#[serde_with::serde_as]
1092#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1093pub struct Selection {
1094 /// Selection value as human-readable display string.
1095 #[serde(rename = "displayName")]
1096 pub display_name: Option<String>,
1097 /// Selection value as Field Choice ID.
1098 pub value: Option<String>,
1099}
1100
1101impl common::Part for Selection {}
1102
1103/// Wrapper for SelectionList Field value.
1104///
1105/// This type is not used in any activity, and only used as *part* of another schema.
1106///
1107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1108#[serde_with::serde_as]
1109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1110pub struct SelectionList {
1111 /// Selection values.
1112 pub values: Option<Vec<Selection>>,
1113}
1114
1115impl common::Part for SelectionList {}
1116
1117/// Information about settings changes.
1118///
1119/// This type is not used in any activity, and only used as *part* of another schema.
1120///
1121#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1122#[serde_with::serde_as]
1123#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1124pub struct SettingsChange {
1125 /// The set of changes made to restrictions.
1126 #[serde(rename = "restrictionChanges")]
1127 pub restriction_changes: Option<Vec<RestrictionChange>>,
1128}
1129
1130impl common::Part for SettingsChange {}
1131
1132/// Wrapper for User Field value.
1133///
1134/// This type is not used in any activity, and only used as *part* of another schema.
1135///
1136#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1137#[serde_with::serde_as]
1138#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1139pub struct SingleUser {
1140 /// User value as email.
1141 pub value: Option<String>,
1142}
1143
1144impl common::Part for SingleUser {}
1145
1146/// A suggestion.
1147///
1148/// This type is not used in any activity, and only used as *part* of another schema.
1149///
1150#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1151#[serde_with::serde_as]
1152#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1153pub struct Suggestion {
1154 /// The sub-type of this event.
1155 pub subtype: Option<String>,
1156}
1157
1158impl common::Part for Suggestion {}
1159
1160/// Event triggered by system operations instead of end users.
1161///
1162/// This type is not used in any activity, and only used as *part* of another schema.
1163///
1164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1165#[serde_with::serde_as]
1166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1167pub struct SystemEvent {
1168 /// The type of the system event that may triggered activity.
1169 #[serde(rename = "type")]
1170 pub type_: Option<String>,
1171}
1172
1173impl common::Part for SystemEvent {}
1174
1175/// Information about the target of activity. For more information on how activity history is shared with users, see [Activity history visibility](https://developers.google.com/workspace/drive/activity/v2#activityhistory).
1176///
1177/// This type is not used in any activity, and only used as *part* of another schema.
1178///
1179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1180#[serde_with::serde_as]
1181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1182pub struct Target {
1183 /// The target is a shared drive.
1184 pub drive: Option<Drive>,
1185 /// The target is a Drive item.
1186 #[serde(rename = "driveItem")]
1187 pub drive_item: Option<DriveItem>,
1188 /// The target is a comment on a Drive file.
1189 #[serde(rename = "fileComment")]
1190 pub file_comment: Option<FileComment>,
1191 /// This field is deprecated; please use the `drive` field instead.
1192 #[serde(rename = "teamDrive")]
1193 pub team_drive: Option<TeamDrive>,
1194}
1195
1196impl common::Part for Target {}
1197
1198/// A lightweight reference to the target of activity.
1199///
1200/// This type is not used in any activity, and only used as *part* of another schema.
1201///
1202#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1203#[serde_with::serde_as]
1204#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1205pub struct TargetReference {
1206 /// The target is a shared drive.
1207 pub drive: Option<DriveReference>,
1208 /// The target is a Drive item.
1209 #[serde(rename = "driveItem")]
1210 pub drive_item: Option<DriveItemReference>,
1211 /// This field is deprecated; please use the `drive` field instead.
1212 #[serde(rename = "teamDrive")]
1213 pub team_drive: Option<TeamDriveReference>,
1214}
1215
1216impl common::Part for TargetReference {}
1217
1218/// This item is deprecated; please see `Drive` instead.
1219///
1220/// This type is not used in any activity, and only used as *part* of another schema.
1221///
1222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1223#[serde_with::serde_as]
1224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1225pub struct TeamDrive {
1226 /// This field is deprecated; please see `Drive.name` instead.
1227 pub name: Option<String>,
1228 /// This field is deprecated; please see `Drive.root` instead.
1229 pub root: Option<DriveItem>,
1230 /// This field is deprecated; please see `Drive.title` instead.
1231 pub title: Option<String>,
1232}
1233
1234impl common::Part for TeamDrive {}
1235
1236/// This item is deprecated; please see `DriveReference` instead.
1237///
1238/// This type is not used in any activity, and only used as *part* of another schema.
1239///
1240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1241#[serde_with::serde_as]
1242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1243pub struct TeamDriveReference {
1244 /// This field is deprecated; please see `DriveReference.name` instead.
1245 pub name: Option<String>,
1246 /// This field is deprecated; please see `DriveReference.title` instead.
1247 pub title: Option<String>,
1248}
1249
1250impl common::Part for TeamDriveReference {}
1251
1252/// Wrapper for Text Field value.
1253///
1254/// This type is not used in any activity, and only used as *part* of another schema.
1255///
1256#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1257#[serde_with::serde_as]
1258#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1259pub struct Text {
1260 /// Value of Text Field.
1261 pub value: Option<String>,
1262}
1263
1264impl common::Part for Text {}
1265
1266/// Wrapper for Text List Field value.
1267///
1268/// This type is not used in any activity, and only used as *part* of another schema.
1269///
1270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1271#[serde_with::serde_as]
1272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1273pub struct TextList {
1274 /// Text values.
1275 pub values: Option<Vec<Text>>,
1276}
1277
1278impl common::Part for TextList {}
1279
1280/// Information about time ranges.
1281///
1282/// This type is not used in any activity, and only used as *part* of another schema.
1283///
1284#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1285#[serde_with::serde_as]
1286#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1287pub struct TimeRange {
1288 /// The end of the time range.
1289 #[serde(rename = "endTime")]
1290 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1291 /// The start of the time range.
1292 #[serde(rename = "startTime")]
1293 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1294}
1295
1296impl common::Part for TimeRange {}
1297
1298/// A user about whom nothing is currently known.
1299///
1300/// This type is not used in any activity, and only used as *part* of another schema.
1301///
1302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1303#[serde_with::serde_as]
1304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1305pub struct UnknownUser {
1306 _never_set: Option<bool>,
1307}
1308
1309impl common::Part for UnknownUser {}
1310
1311/// An object was uploaded into Drive.
1312///
1313/// This type is not used in any activity, and only used as *part* of another schema.
1314///
1315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1316#[serde_with::serde_as]
1317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1318pub struct Upload {
1319 _never_set: Option<bool>,
1320}
1321
1322impl common::Part for Upload {}
1323
1324/// Information about an end user.
1325///
1326/// This type is not used in any activity, and only used as *part* of another schema.
1327///
1328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1329#[serde_with::serde_as]
1330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1331pub struct User {
1332 /// A user whose account has since been deleted.
1333 #[serde(rename = "deletedUser")]
1334 pub deleted_user: Option<DeletedUser>,
1335 /// A known user.
1336 #[serde(rename = "knownUser")]
1337 pub known_user: Option<KnownUser>,
1338 /// A user about whom nothing is currently known.
1339 #[serde(rename = "unknownUser")]
1340 pub unknown_user: Option<UnknownUser>,
1341}
1342
1343impl common::Part for User {}
1344
1345/// Wrapper for UserList Field value.
1346///
1347/// This type is not used in any activity, and only used as *part* of another schema.
1348///
1349#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1350#[serde_with::serde_as]
1351#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1352pub struct UserList {
1353 /// User values.
1354 pub values: Option<Vec<SingleUser>>,
1355}
1356
1357impl common::Part for UserList {}
1358
1359// ###################
1360// MethodBuilders ###
1361// #################
1362
1363/// A builder providing access to all methods supported on *activity* resources.
1364/// It is not used directly, but through the [`DriveActivityHub`] hub.
1365///
1366/// # Example
1367///
1368/// Instantiate a resource builder
1369///
1370/// ```test_harness,no_run
1371/// extern crate hyper;
1372/// extern crate hyper_rustls;
1373/// extern crate google_driveactivity2 as driveactivity2;
1374///
1375/// # async fn dox() {
1376/// use driveactivity2::{DriveActivityHub, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1377///
1378/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1379/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1380/// .with_native_roots()
1381/// .unwrap()
1382/// .https_only()
1383/// .enable_http2()
1384/// .build();
1385///
1386/// let executor = hyper_util::rt::TokioExecutor::new();
1387/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1388/// secret,
1389/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1390/// yup_oauth2::client::CustomHyperClientBuilder::from(
1391/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1392/// ),
1393/// ).build().await.unwrap();
1394///
1395/// let client = hyper_util::client::legacy::Client::builder(
1396/// hyper_util::rt::TokioExecutor::new()
1397/// )
1398/// .build(
1399/// hyper_rustls::HttpsConnectorBuilder::new()
1400/// .with_native_roots()
1401/// .unwrap()
1402/// .https_or_http()
1403/// .enable_http2()
1404/// .build()
1405/// );
1406/// let mut hub = DriveActivityHub::new(client, auth);
1407/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1408/// // like `query(...)`
1409/// // to build up your call.
1410/// let rb = hub.activity();
1411/// # }
1412/// ```
1413pub struct ActivityMethods<'a, C>
1414where
1415 C: 'a,
1416{
1417 hub: &'a DriveActivityHub<C>,
1418}
1419
1420impl<'a, C> common::MethodsBuilder for ActivityMethods<'a, C> {}
1421
1422impl<'a, C> ActivityMethods<'a, C> {
1423 /// Create a builder to help you perform the following task:
1424 ///
1425 /// Query past activity in Google Drive.
1426 ///
1427 /// # Arguments
1428 ///
1429 /// * `request` - No description provided.
1430 pub fn query(&self, request: QueryDriveActivityRequest) -> ActivityQueryCall<'a, C> {
1431 ActivityQueryCall {
1432 hub: self.hub,
1433 _request: request,
1434 _delegate: Default::default(),
1435 _additional_params: Default::default(),
1436 _scopes: Default::default(),
1437 }
1438 }
1439}
1440
1441// ###################
1442// CallBuilders ###
1443// #################
1444
1445/// Query past activity in Google Drive.
1446///
1447/// A builder for the *query* method supported by a *activity* resource.
1448/// It is not used directly, but through a [`ActivityMethods`] instance.
1449///
1450/// # Example
1451///
1452/// Instantiate a resource method builder
1453///
1454/// ```test_harness,no_run
1455/// # extern crate hyper;
1456/// # extern crate hyper_rustls;
1457/// # extern crate google_driveactivity2 as driveactivity2;
1458/// use driveactivity2::api::QueryDriveActivityRequest;
1459/// # async fn dox() {
1460/// # use driveactivity2::{DriveActivityHub, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1461///
1462/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1463/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1464/// # .with_native_roots()
1465/// # .unwrap()
1466/// # .https_only()
1467/// # .enable_http2()
1468/// # .build();
1469///
1470/// # let executor = hyper_util::rt::TokioExecutor::new();
1471/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1472/// # secret,
1473/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1474/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1475/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1476/// # ),
1477/// # ).build().await.unwrap();
1478///
1479/// # let client = hyper_util::client::legacy::Client::builder(
1480/// # hyper_util::rt::TokioExecutor::new()
1481/// # )
1482/// # .build(
1483/// # hyper_rustls::HttpsConnectorBuilder::new()
1484/// # .with_native_roots()
1485/// # .unwrap()
1486/// # .https_or_http()
1487/// # .enable_http2()
1488/// # .build()
1489/// # );
1490/// # let mut hub = DriveActivityHub::new(client, auth);
1491/// // As the method needs a request, you would usually fill it with the desired information
1492/// // into the respective structure. Some of the parts shown here might not be applicable !
1493/// // Values shown here are possibly random and not representative !
1494/// let mut req = QueryDriveActivityRequest::default();
1495///
1496/// // You can configure optional parameters by calling the respective setters at will, and
1497/// // execute the final call using `doit()`.
1498/// // Values shown here are possibly random and not representative !
1499/// let result = hub.activity().query(req)
1500/// .doit().await;
1501/// # }
1502/// ```
1503pub struct ActivityQueryCall<'a, C>
1504where
1505 C: 'a,
1506{
1507 hub: &'a DriveActivityHub<C>,
1508 _request: QueryDriveActivityRequest,
1509 _delegate: Option<&'a mut dyn common::Delegate>,
1510 _additional_params: HashMap<String, String>,
1511 _scopes: BTreeSet<String>,
1512}
1513
1514impl<'a, C> common::CallBuilder for ActivityQueryCall<'a, C> {}
1515
1516impl<'a, C> ActivityQueryCall<'a, C>
1517where
1518 C: common::Connector,
1519{
1520 /// Perform the operation you have build so far.
1521 pub async fn doit(mut self) -> common::Result<(common::Response, QueryDriveActivityResponse)> {
1522 use std::borrow::Cow;
1523 use std::io::{Read, Seek};
1524
1525 use common::{url::Params, ToParts};
1526 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1527
1528 let mut dd = common::DefaultDelegate;
1529 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1530 dlg.begin(common::MethodInfo {
1531 id: "driveactivity.activity.query",
1532 http_method: hyper::Method::POST,
1533 });
1534
1535 for &field in ["alt"].iter() {
1536 if self._additional_params.contains_key(field) {
1537 dlg.finished(false);
1538 return Err(common::Error::FieldClash(field));
1539 }
1540 }
1541
1542 let mut params = Params::with_capacity(3 + self._additional_params.len());
1543
1544 params.extend(self._additional_params.iter());
1545
1546 params.push("alt", "json");
1547 let mut url = self.hub._base_url.clone() + "v2/activity:query";
1548 if self._scopes.is_empty() {
1549 self._scopes
1550 .insert(Scope::DriveActivityReadonly.as_ref().to_string());
1551 }
1552
1553 let url = params.parse_with_url(&url);
1554
1555 let mut json_mime_type = mime::APPLICATION_JSON;
1556 let mut request_value_reader = {
1557 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1558 common::remove_json_null_values(&mut value);
1559 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1560 serde_json::to_writer(&mut dst, &value).unwrap();
1561 dst
1562 };
1563 let request_size = request_value_reader
1564 .seek(std::io::SeekFrom::End(0))
1565 .unwrap();
1566 request_value_reader
1567 .seek(std::io::SeekFrom::Start(0))
1568 .unwrap();
1569
1570 loop {
1571 let token = match self
1572 .hub
1573 .auth
1574 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1575 .await
1576 {
1577 Ok(token) => token,
1578 Err(e) => match dlg.token(e) {
1579 Ok(token) => token,
1580 Err(e) => {
1581 dlg.finished(false);
1582 return Err(common::Error::MissingToken(e));
1583 }
1584 },
1585 };
1586 request_value_reader
1587 .seek(std::io::SeekFrom::Start(0))
1588 .unwrap();
1589 let mut req_result = {
1590 let client = &self.hub.client;
1591 dlg.pre_request();
1592 let mut req_builder = hyper::Request::builder()
1593 .method(hyper::Method::POST)
1594 .uri(url.as_str())
1595 .header(USER_AGENT, self.hub._user_agent.clone());
1596
1597 if let Some(token) = token.as_ref() {
1598 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1599 }
1600
1601 let request = req_builder
1602 .header(CONTENT_TYPE, json_mime_type.to_string())
1603 .header(CONTENT_LENGTH, request_size as u64)
1604 .body(common::to_body(
1605 request_value_reader.get_ref().clone().into(),
1606 ));
1607
1608 client.request(request.unwrap()).await
1609 };
1610
1611 match req_result {
1612 Err(err) => {
1613 if let common::Retry::After(d) = dlg.http_error(&err) {
1614 sleep(d).await;
1615 continue;
1616 }
1617 dlg.finished(false);
1618 return Err(common::Error::HttpError(err));
1619 }
1620 Ok(res) => {
1621 let (mut parts, body) = res.into_parts();
1622 let mut body = common::Body::new(body);
1623 if !parts.status.is_success() {
1624 let bytes = common::to_bytes(body).await.unwrap_or_default();
1625 let error = serde_json::from_str(&common::to_string(&bytes));
1626 let response = common::to_response(parts, bytes.into());
1627
1628 if let common::Retry::After(d) =
1629 dlg.http_failure(&response, error.as_ref().ok())
1630 {
1631 sleep(d).await;
1632 continue;
1633 }
1634
1635 dlg.finished(false);
1636
1637 return Err(match error {
1638 Ok(value) => common::Error::BadRequest(value),
1639 _ => common::Error::Failure(response),
1640 });
1641 }
1642 let response = {
1643 let bytes = common::to_bytes(body).await.unwrap_or_default();
1644 let encoded = common::to_string(&bytes);
1645 match serde_json::from_str(&encoded) {
1646 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1647 Err(error) => {
1648 dlg.response_json_decode_error(&encoded, &error);
1649 return Err(common::Error::JsonDecodeError(
1650 encoded.to_string(),
1651 error,
1652 ));
1653 }
1654 }
1655 };
1656
1657 dlg.finished(true);
1658 return Ok(response);
1659 }
1660 }
1661 }
1662 }
1663
1664 ///
1665 /// Sets the *request* property to the given value.
1666 ///
1667 /// Even though the property as already been set when instantiating this call,
1668 /// we provide this method for API completeness.
1669 pub fn request(mut self, new_value: QueryDriveActivityRequest) -> ActivityQueryCall<'a, C> {
1670 self._request = new_value;
1671 self
1672 }
1673 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1674 /// while executing the actual API request.
1675 ///
1676 /// ````text
1677 /// It should be used to handle progress information, and to implement a certain level of resilience.
1678 /// ````
1679 ///
1680 /// Sets the *delegate* property to the given value.
1681 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ActivityQueryCall<'a, C> {
1682 self._delegate = Some(new_value);
1683 self
1684 }
1685
1686 /// Set any additional parameter of the query string used in the request.
1687 /// It should be used to set parameters which are not yet available through their own
1688 /// setters.
1689 ///
1690 /// Please note that this method must not be used to set any of the known parameters
1691 /// which have their own setter method. If done anyway, the request will fail.
1692 ///
1693 /// # Additional Parameters
1694 ///
1695 /// * *$.xgafv* (query-string) - V1 error format.
1696 /// * *access_token* (query-string) - OAuth access token.
1697 /// * *alt* (query-string) - Data format for response.
1698 /// * *callback* (query-string) - JSONP
1699 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1700 /// * *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.
1701 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1702 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1703 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1704 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1705 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1706 pub fn param<T>(mut self, name: T, value: T) -> ActivityQueryCall<'a, C>
1707 where
1708 T: AsRef<str>,
1709 {
1710 self._additional_params
1711 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1712 self
1713 }
1714
1715 /// Identifies the authorization scope for the method you are building.
1716 ///
1717 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1718 /// [`Scope::DriveActivityReadonly`].
1719 ///
1720 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1721 /// tokens for more than one scope.
1722 ///
1723 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1724 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1725 /// sufficient, a read-write scope will do as well.
1726 pub fn add_scope<St>(mut self, scope: St) -> ActivityQueryCall<'a, C>
1727 where
1728 St: AsRef<str>,
1729 {
1730 self._scopes.insert(String::from(scope.as_ref()));
1731 self
1732 }
1733 /// Identifies the authorization scope(s) for the method you are building.
1734 ///
1735 /// See [`Self::add_scope()`] for details.
1736 pub fn add_scopes<I, St>(mut self, scopes: I) -> ActivityQueryCall<'a, C>
1737 where
1738 I: IntoIterator<Item = St>,
1739 St: AsRef<str>,
1740 {
1741 self._scopes
1742 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1743 self
1744 }
1745
1746 /// Removes all scopes, and no default scope will be used either.
1747 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1748 /// for details).
1749 pub fn clear_scopes(mut self) -> ActivityQueryCall<'a, C> {
1750 self._scopes.clear();
1751 self
1752 }
1753}