google_vault1/
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    /// Manage your eDiscovery data
17    Ediscovery,
18
19    /// View your eDiscovery data
20    EdiscoveryReadonly,
21}
22
23impl AsRef<str> for Scope {
24    fn as_ref(&self) -> &str {
25        match *self {
26            Scope::Ediscovery => "https://www.googleapis.com/auth/ediscovery",
27            Scope::EdiscoveryReadonly => "https://www.googleapis.com/auth/ediscovery.readonly",
28        }
29    }
30}
31
32#[allow(clippy::derivable_impls)]
33impl Default for Scope {
34    fn default() -> Scope {
35        Scope::EdiscoveryReadonly
36    }
37}
38
39// ########
40// HUB ###
41// ######
42
43/// Central instance to access all Vault related resource activities
44///
45/// # Examples
46///
47/// Instantiate a new hub
48///
49/// ```test_harness,no_run
50/// extern crate hyper;
51/// extern crate hyper_rustls;
52/// extern crate google_vault1 as vault1;
53/// use vault1::{Result, Error};
54/// # async fn dox() {
55/// use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56///
57/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
58/// // `client_secret`, among other things.
59/// let secret: yup_oauth2::ApplicationSecret = Default::default();
60/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
61/// // unless you replace  `None` with the desired Flow.
62/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
63/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
64/// // retrieve them from storage.
65/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
66///     .with_native_roots()
67///     .unwrap()
68///     .https_only()
69///     .enable_http2()
70///     .build();
71///
72/// let executor = hyper_util::rt::TokioExecutor::new();
73/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
74///     secret,
75///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
76///     yup_oauth2::client::CustomHyperClientBuilder::from(
77///         hyper_util::client::legacy::Client::builder(executor).build(connector),
78///     ),
79/// ).build().await.unwrap();
80///
81/// let client = hyper_util::client::legacy::Client::builder(
82///     hyper_util::rt::TokioExecutor::new()
83/// )
84/// .build(
85///     hyper_rustls::HttpsConnectorBuilder::new()
86///         .with_native_roots()
87///         .unwrap()
88///         .https_or_http()
89///         .enable_http2()
90///         .build()
91/// );
92/// let mut hub = Vault::new(client, auth);
93/// // You can configure optional parameters by calling the respective setters at will, and
94/// // execute the final call using `doit()`.
95/// // Values shown here are possibly random and not representative !
96/// let result = hub.matters().holds_list("matterId")
97///              .view("takimata")
98///              .page_token("amet.")
99///              .page_size(-20)
100///              .doit().await;
101///
102/// match result {
103///     Err(e) => match e {
104///         // The Error enum provides details about what exactly happened.
105///         // You can also just use its `Debug`, `Display` or `Error` traits
106///          Error::HttpError(_)
107///         |Error::Io(_)
108///         |Error::MissingAPIKey
109///         |Error::MissingToken(_)
110///         |Error::Cancelled
111///         |Error::UploadSizeLimitExceeded(_, _)
112///         |Error::Failure(_)
113///         |Error::BadRequest(_)
114///         |Error::FieldClash(_)
115///         |Error::JsonDecodeError(_, _) => println!("{}", e),
116///     },
117///     Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct Vault<C> {
123    pub client: common::Client<C>,
124    pub auth: Box<dyn common::GetToken>,
125    _user_agent: String,
126    _base_url: String,
127    _root_url: String,
128}
129
130impl<C> common::Hub for Vault<C> {}
131
132impl<'a, C> Vault<C> {
133    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Vault<C> {
134        Vault {
135            client,
136            auth: Box::new(auth),
137            _user_agent: "google-api-rust-client/7.0.0".to_string(),
138            _base_url: "https://vault.googleapis.com/".to_string(),
139            _root_url: "https://vault.googleapis.com/".to_string(),
140        }
141    }
142
143    pub fn matters(&'a self) -> MatterMethods<'a, C> {
144        MatterMethods { hub: self }
145    }
146    pub fn operations(&'a self) -> OperationMethods<'a, C> {
147        OperationMethods { hub: self }
148    }
149
150    /// Set the user-agent header field to use in all requests to the server.
151    /// It defaults to `google-api-rust-client/7.0.0`.
152    ///
153    /// Returns the previously set user-agent.
154    pub fn user_agent(&mut self, agent_name: String) -> String {
155        std::mem::replace(&mut self._user_agent, agent_name)
156    }
157
158    /// Set the base url to use in all requests to the server.
159    /// It defaults to `https://vault.googleapis.com/`.
160    ///
161    /// Returns the previously set base url.
162    pub fn base_url(&mut self, new_base_url: String) -> String {
163        std::mem::replace(&mut self._base_url, new_base_url)
164    }
165
166    /// Set the root url to use in all requests to the server.
167    /// It defaults to `https://vault.googleapis.com/`.
168    ///
169    /// Returns the previously set root url.
170    pub fn root_url(&mut self, new_root_url: String) -> String {
171        std::mem::replace(&mut self._root_url, new_root_url)
172    }
173}
174
175// ############
176// SCHEMAS ###
177// ##########
178/// The accounts to search
179///
180/// This type is not used in any activity, and only used as *part* of another schema.
181///
182#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
183#[serde_with::serde_as]
184#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
185pub struct AccountInfo {
186    /// A set of accounts to search.
187    pub emails: Option<Vec<String>>,
188}
189
190impl common::Part for AccountInfo {}
191
192/// The status of each account creation, and the **HeldAccount**, if successful.
193///
194/// This type is not used in any activity, and only used as *part* of another schema.
195///
196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
197#[serde_with::serde_as]
198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
199pub struct AddHeldAccountResult {
200    /// Returned when the account was successfully created.
201    pub account: Option<HeldAccount>,
202    /// Reports the request status. If it failed, returns an error message.
203    pub status: Option<Status>,
204}
205
206impl common::Part for AddHeldAccountResult {}
207
208/// Add a list of accounts to a hold.
209///
210/// # Activities
211///
212/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
213/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
214///
215/// * [holds add held accounts matters](MatterHoldAddHeldAccountCall) (request)
216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
217#[serde_with::serde_as]
218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
219pub struct AddHeldAccountsRequest {
220    /// A comma-separated list of the account IDs of the accounts to add to the hold. Specify either **emails** or **account_ids**, but not both.
221    #[serde(rename = "accountIds")]
222    pub account_ids: Option<Vec<String>>,
223    /// A comma-separated list of the emails of the accounts to add to the hold. Specify either **emails** or **account_ids**, but not both.
224    pub emails: Option<Vec<String>>,
225}
226
227impl common::RequestValue for AddHeldAccountsRequest {}
228
229/// Response for batch create held accounts.
230///
231/// # Activities
232///
233/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
234/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
235///
236/// * [holds add held accounts matters](MatterHoldAddHeldAccountCall) (response)
237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
238#[serde_with::serde_as]
239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
240pub struct AddHeldAccountsResponse {
241    /// The list of responses, in the same order as the batch request.
242    pub responses: Option<Vec<AddHeldAccountResult>>,
243}
244
245impl common::ResponseResult for AddHeldAccountsResponse {}
246
247/// Add an account with the permission specified. The role cannot be owner. If an account already has a role in the matter, the existing role is overwritten.
248///
249/// # Activities
250///
251/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
252/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
253///
254/// * [add permissions matters](MatterAddPermissionCall) (request)
255#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
256#[serde_with::serde_as]
257#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
258pub struct AddMatterPermissionsRequest {
259    /// Only relevant if **sendEmails** is **true**. To CC the requestor in the email message, set to **true**. To not CC requestor, set to **false**.
260    #[serde(rename = "ccMe")]
261    pub cc_me: Option<bool>,
262    /// The account and its role to add.
263    #[serde(rename = "matterPermission")]
264    pub matter_permission: Option<MatterPermission>,
265    /// To send a notification email to the added account, set to **true**. To not send a notification email, set to **false**.
266    #[serde(rename = "sendEmails")]
267    pub send_emails: Option<bool>,
268}
269
270impl common::RequestValue for AddMatterPermissionsRequest {}
271
272/// The options for Calendar exports.
273///
274/// This type is not used in any activity, and only used as *part* of another schema.
275///
276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
277#[serde_with::serde_as]
278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
279pub struct CalendarExportOptions {
280    /// The file format for exported text messages.
281    #[serde(rename = "exportFormat")]
282    pub export_format: Option<String>,
283}
284
285impl common::Part for CalendarExportOptions {}
286
287/// Additional options for Calendar search
288///
289/// This type is not used in any activity, and only used as *part* of another schema.
290///
291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
292#[serde_with::serde_as]
293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
294pub struct CalendarOptions {
295    /// Matches only those events whose location contains all of the words in the given set. If the string contains quoted phrases, this method only matches those events whose location contain the exact phrase. Entries in the set are considered in "and". Word splitting example: ["New Zealand"] vs ["New","Zealand"] "New Zealand": matched by both "New and better Zealand": only matched by the later
296    #[serde(rename = "locationQuery")]
297    pub location_query: Option<Vec<String>>,
298    /// Matches only those events that do not contain any of the words in the given set in title, description, location, or attendees. Entries in the set are considered in "or".
299    #[serde(rename = "minusWords")]
300    pub minus_words: Option<Vec<String>>,
301    /// Matches only those events whose attendees contain all of the words in the given set. Entries in the set are considered in "and".
302    #[serde(rename = "peopleQuery")]
303    pub people_query: Option<Vec<String>>,
304    /// Matches only events for which the custodian gave one of these responses. If the set is empty or contains ATTENDEE_RESPONSE_UNSPECIFIED there will be no filtering on responses.
305    #[serde(rename = "responseStatuses")]
306    pub response_statuses: Option<Vec<String>>,
307    /// Search the current version of the Calendar event, but export the contents of the last version saved before 12:00 AM UTC on the specified date. Enter the date in UTC.
308    #[serde(rename = "versionDate")]
309    pub version_date: Option<chrono::DateTime<chrono::offset::Utc>>,
310}
311
312impl common::Part for CalendarOptions {}
313
314/// The request message for Operations.CancelOperation.
315///
316/// # Activities
317///
318/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
319/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
320///
321/// * [cancel operations](OperationCancelCall) (request)
322#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
323#[serde_with::serde_as]
324#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
325pub struct CancelOperationRequest {
326    _never_set: Option<bool>,
327}
328
329impl common::RequestValue for CancelOperationRequest {}
330
331/// Close a matter by ID.
332///
333/// # Activities
334///
335/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
336/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
337///
338/// * [close matters](MatterCloseCall) (request)
339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
340#[serde_with::serde_as]
341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
342pub struct CloseMatterRequest {
343    _never_set: Option<bool>,
344}
345
346impl common::RequestValue for CloseMatterRequest {}
347
348/// Response to a CloseMatterRequest.
349///
350/// # Activities
351///
352/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
353/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
354///
355/// * [close matters](MatterCloseCall) (response)
356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
357#[serde_with::serde_as]
358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
359pub struct CloseMatterResponse {
360    /// The updated matter, with state **CLOSED**.
361    pub matter: Option<Matter>,
362}
363
364impl common::ResponseResult for CloseMatterResponse {}
365
366/// The export file in Cloud Storage
367///
368/// This type is not used in any activity, and only used as *part* of another schema.
369///
370#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
371#[serde_with::serde_as]
372#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
373pub struct CloudStorageFile {
374    /// The name of the Cloud Storage bucket for the export file. You can use this value in the Cloud Storage [JSON API](https://cloud.google.com/storage/docs/json_api) or [XML API](https://cloud.google.com/storage/docs/xml-api), but not to list the bucket contents. Instead, you can [get individual export files](https://cloud.google.com/storage/docs/json_api/v1/objects/get) by object name.
375    #[serde(rename = "bucketName")]
376    pub bucket_name: Option<String>,
377    /// The md5 hash of the file.
378    #[serde(rename = "md5Hash")]
379    pub md5_hash: Option<String>,
380    /// The name of the Cloud Storage object for the export file. You can use this value in the Cloud Storage [JSON API](https://cloud.google.com/storage/docs/json_api) or [XML API](https://cloud.google.com/storage/docs/xml-api).
381    #[serde(rename = "objectName")]
382    pub object_name: Option<String>,
383    /// The export file size.
384    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
385    pub size: Option<i64>,
386}
387
388impl common::Part for CloudStorageFile {}
389
390/// Export sink for Cloud Storage files.
391///
392/// This type is not used in any activity, and only used as *part* of another schema.
393///
394#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
395#[serde_with::serde_as]
396#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
397pub struct CloudStorageSink {
398    /// Output only. The exported files in Cloud Storage.
399    pub files: Option<Vec<CloudStorageFile>>,
400}
401
402impl common::Part for CloudStorageSink {}
403
404/// Service-specific options for holds.
405///
406/// This type is not used in any activity, and only used as *part* of another schema.
407///
408#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
409#[serde_with::serde_as]
410#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
411pub struct CorpusQuery {
412    /// Service-specific options for Calendar holds. If set, **CorpusType** must be **CALENDAR**.
413    #[serde(rename = "calendarQuery")]
414    pub calendar_query: Option<HeldCalendarQuery>,
415    /// Service-specific options for Drive holds. If set, **CorpusType** must be **DRIVE**.
416    #[serde(rename = "driveQuery")]
417    pub drive_query: Option<HeldDriveQuery>,
418    /// Service-specific options for Groups holds. If set, **CorpusType** must be **GROUPS**.
419    #[serde(rename = "groupsQuery")]
420    pub groups_query: Option<HeldGroupsQuery>,
421    /// Service-specific options for Chat holds. If set, **CorpusType** must be **HANGOUTS_CHAT**.
422    #[serde(rename = "hangoutsChatQuery")]
423    pub hangouts_chat_query: Option<HeldHangoutsChatQuery>,
424    /// Service-specific options for Gmail holds. If set, **CorpusType** must be **MAIL**.
425    #[serde(rename = "mailQuery")]
426    pub mail_query: Option<HeldMailQuery>,
427    /// Service-specific options for Voice holds. If set, **CorpusType** must be **VOICE**.
428    #[serde(rename = "voiceQuery")]
429    pub voice_query: Option<HeldVoiceQuery>,
430}
431
432impl common::Part for CorpusQuery {}
433
434/// Count artifacts request.
435///
436/// # Activities
437///
438/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
439/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
440///
441/// * [count matters](MatterCountCall) (request)
442#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
443#[serde_with::serde_as]
444#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
445pub struct CountArtifactsRequest {
446    /// The search query.
447    pub query: Option<Query>,
448    /// Sets the granularity of the count results.
449    pub view: Option<String>,
450}
451
452impl common::RequestValue for CountArtifactsRequest {}
453
454/// Specify Drive documents by document ID.
455///
456/// This type is not used in any activity, and only used as *part* of another schema.
457///
458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
459#[serde_with::serde_as]
460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
461pub struct DriveDocumentIds {
462    /// Required. A list of Drive document IDs.
463    pub ids: Option<Vec<String>>,
464}
465
466impl common::Part for DriveDocumentIds {}
467
468/// The Drive documents to search.
469///
470/// This type is not used in any activity, and only used as *part* of another schema.
471///
472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
473#[serde_with::serde_as]
474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
475pub struct DriveDocumentInfo {
476    /// Specify Drive documents by document ID.
477    #[serde(rename = "documentIds")]
478    pub document_ids: Option<DriveDocumentIds>,
479}
480
481impl common::Part for DriveDocumentInfo {}
482
483/// Options for Drive exports.
484///
485/// This type is not used in any activity, and only used as *part* of another schema.
486///
487#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
488#[serde_with::serde_as]
489#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
490pub struct DriveExportOptions {
491    /// To include access level information for users with [indirect access](https://support.google.com/vault/answer/6099459#metadata) to files, set to **true**.
492    #[serde(rename = "includeAccessInfo")]
493    pub include_access_info: Option<bool>,
494}
495
496impl common::Part for DriveExportOptions {}
497
498/// Additional options for Drive search.
499///
500/// This type is not used in any activity, and only used as *part* of another schema.
501///
502#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
503#[serde_with::serde_as]
504#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
505pub struct DriveOptions {
506    /// Set whether the results include only content encrypted with [Google Workspace Client-side encryption](https://support.google.com/a?p=cse_ov) content, only unencrypted content, or both. Defaults to both. Currently supported for Drive.
507    #[serde(rename = "clientSideEncryptedOption")]
508    pub client_side_encrypted_option: Option<String>,
509    /// Set to **true** to include shared drives.
510    #[serde(rename = "includeSharedDrives")]
511    pub include_shared_drives: Option<bool>,
512    /// Set to true to include Team Drive.
513    #[serde(rename = "includeTeamDrives")]
514    pub include_team_drives: Option<bool>,
515    /// Optional. Options to include or exclude documents in shared drives. We recommend using this field over include_shared_drives. This field overrides include_shared_drives and include_team_drives when set.
516    #[serde(rename = "sharedDrivesOption")]
517    pub shared_drives_option: Option<String>,
518    /// Search the current version of the Drive file, but export the contents of the last version saved before 12:00 AM UTC on the specified date. Enter the date in UTC.
519    #[serde(rename = "versionDate")]
520    pub version_date: Option<chrono::DateTime<chrono::offset::Utc>>,
521}
522
523impl common::Part for DriveOptions {}
524
525/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
526///
527/// # Activities
528///
529/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
530/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
531///
532/// * [exports delete matters](MatterExportDeleteCall) (response)
533/// * [holds accounts delete matters](MatterHoldAccountDeleteCall) (response)
534/// * [holds delete matters](MatterHoldDeleteCall) (response)
535/// * [saved queries delete matters](MatterSavedQueryDeleteCall) (response)
536/// * [remove permissions matters](MatterRemovePermissionCall) (response)
537/// * [cancel operations](OperationCancelCall) (response)
538/// * [delete operations](OperationDeleteCall) (response)
539#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
540#[serde_with::serde_as]
541#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
542pub struct Empty {
543    _never_set: Option<bool>,
544}
545
546impl common::ResponseResult for Empty {}
547
548/// An export. To work with Vault resources, the account must have the [required Vault privileges](https://support.google.com/vault/answer/2799699) and access to the matter. To access a matter, the account must have created the matter, have the matter shared with them, or have the **View All Matters** privilege.
549///
550/// # Activities
551///
552/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
553/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
554///
555/// * [exports create matters](MatterExportCreateCall) (request|response)
556/// * [exports get matters](MatterExportGetCall) (response)
557#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
558#[serde_with::serde_as]
559#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
560pub struct Export {
561    /// Output only. The sink for export files in Cloud Storage.
562    #[serde(rename = "cloudStorageSink")]
563    pub cloud_storage_sink: Option<CloudStorageSink>,
564    /// Output only. The time when the export was created.
565    #[serde(rename = "createTime")]
566    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
567    /// Additional export options.
568    #[serde(rename = "exportOptions")]
569    pub export_options: Option<ExportOptions>,
570    /// Output only. The generated export ID.
571    pub id: Option<String>,
572    /// Output only. The matter ID.
573    #[serde(rename = "matterId")]
574    pub matter_id: Option<String>,
575    /// The export name. Don't use special characters (~!$'(),;@:/?) in the name, they can prevent you from downloading exports.
576    pub name: Option<String>,
577    /// Output only. Identifies the parent export that spawned this child export. This is only set on child exports.
578    #[serde(rename = "parentExportId")]
579    pub parent_export_id: Option<String>,
580    /// The query parameters used to create the export.
581    pub query: Option<Query>,
582    /// Output only. The requester of the export.
583    pub requester: Option<UserInfo>,
584    /// Output only. Details about the export progress and size.
585    pub stats: Option<ExportStats>,
586    /// Output only. The status of the export.
587    pub status: Option<String>,
588}
589
590impl common::RequestValue for Export {}
591impl common::ResponseResult for Export {}
592
593/// Additional options for exports
594///
595/// This type is not used in any activity, and only used as *part* of another schema.
596///
597#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
598#[serde_with::serde_as]
599#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
600pub struct ExportOptions {
601    /// Option available for Calendar export.
602    #[serde(rename = "calendarOptions")]
603    pub calendar_options: Option<CalendarExportOptions>,
604    /// Options for Drive exports.
605    #[serde(rename = "driveOptions")]
606    pub drive_options: Option<DriveExportOptions>,
607    /// Option available for Gemini export.
608    #[serde(rename = "geminiOptions")]
609    pub gemini_options: Option<GeminiExportOptions>,
610    /// Options for Groups exports.
611    #[serde(rename = "groupsOptions")]
612    pub groups_options: Option<GroupsExportOptions>,
613    /// Options for Chat exports.
614    #[serde(rename = "hangoutsChatOptions")]
615    pub hangouts_chat_options: Option<HangoutsChatExportOptions>,
616    /// Options for Gmail exports.
617    #[serde(rename = "mailOptions")]
618    pub mail_options: Option<MailExportOptions>,
619    /// The requested data region for the export.
620    pub region: Option<String>,
621    /// Options for Voice exports.
622    #[serde(rename = "voiceOptions")]
623    pub voice_options: Option<VoiceExportOptions>,
624}
625
626impl common::Part for ExportOptions {}
627
628/// Progress information for an export.
629///
630/// This type is not used in any activity, and only used as *part* of another schema.
631///
632#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
633#[serde_with::serde_as]
634#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
635pub struct ExportStats {
636    /// The number of messages or files already processed for export.
637    #[serde(rename = "exportedArtifactCount")]
638    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
639    pub exported_artifact_count: Option<i64>,
640    /// The size of export in bytes.
641    #[serde(rename = "sizeInBytes")]
642    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
643    pub size_in_bytes: Option<i64>,
644    /// The number of messages or files to be exported.
645    #[serde(rename = "totalArtifactCount")]
646    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
647    pub total_artifact_count: Option<i64>,
648}
649
650impl common::Part for ExportStats {}
651
652/// The options for Gemini exports.
653///
654/// This type is not used in any activity, and only used as *part* of another schema.
655///
656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
657#[serde_with::serde_as]
658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
659pub struct GeminiExportOptions {
660    /// The file format for exported messages.
661    #[serde(rename = "exportFormat")]
662    pub export_format: Option<String>,
663}
664
665impl common::Part for GeminiExportOptions {}
666
667/// Additional options for Gemini search
668///
669/// This type is not used in any activity, and only used as *part* of another schema.
670///
671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
672#[serde_with::serde_as]
673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
674pub struct GeminiOptions {
675    _never_set: Option<bool>,
676}
677
678impl common::Part for GeminiOptions {}
679
680/// Options for Groups exports.
681///
682/// This type is not used in any activity, and only used as *part* of another schema.
683///
684#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
685#[serde_with::serde_as]
686#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
687pub struct GroupsExportOptions {
688    /// The file format for exported messages.
689    #[serde(rename = "exportFormat")]
690    pub export_format: Option<String>,
691}
692
693impl common::Part for GroupsExportOptions {}
694
695/// Options for Chat exports.
696///
697/// This type is not used in any activity, and only used as *part* of another schema.
698///
699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
700#[serde_with::serde_as]
701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
702pub struct HangoutsChatExportOptions {
703    /// The file format for exported messages.
704    #[serde(rename = "exportFormat")]
705    pub export_format: Option<String>,
706}
707
708impl common::Part for HangoutsChatExportOptions {}
709
710/// The Chat spaces to search
711///
712/// This type is not used in any activity, and only used as *part* of another schema.
713///
714#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
715#[serde_with::serde_as]
716#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
717pub struct HangoutsChatInfo {
718    /// A list of Chat spaces IDs, as provided by the [Chat API](https://developers.google.com/workspace/chat). There is a limit of exporting from 500 Chat spaces per request.
719    #[serde(rename = "roomId")]
720    pub room_id: Option<Vec<String>>,
721}
722
723impl common::Part for HangoutsChatInfo {}
724
725/// Additional options for Google Chat search
726///
727/// This type is not used in any activity, and only used as *part* of another schema.
728///
729#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
730#[serde_with::serde_as]
731#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
732pub struct HangoutsChatOptions {
733    /// For searches by account or organizational unit, set to **true** to include rooms.
734    #[serde(rename = "includeRooms")]
735    pub include_rooms: Option<bool>,
736}
737
738impl common::Part for HangoutsChatOptions {}
739
740/// An account covered by a hold. This structure is immutable. It can be an individual account or a Google Group, depending on the service. To work with Vault resources, the account must have the \[required Vault privileges\] (https://support.google.com/vault/answer/2799699) and access to the matter. To access a matter, the account must have created the matter, have the matter shared with them, or have the **View All Matters** privilege.
741///
742/// # Activities
743///
744/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
745/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
746///
747/// * [holds accounts create matters](MatterHoldAccountCreateCall) (request|response)
748#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
749#[serde_with::serde_as]
750#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
751pub struct HeldAccount {
752    /// The account ID, as provided by the [Admin SDK](https://developers.google.com/admin-sdk/).
753    #[serde(rename = "accountId")]
754    pub account_id: Option<String>,
755    /// The primary email address of the account. If used as an input, this takes precedence over **accountId**.
756    pub email: Option<String>,
757    /// Output only. The first name of the account holder.
758    #[serde(rename = "firstName")]
759    pub first_name: Option<String>,
760    /// Output only. When the account was put on hold.
761    #[serde(rename = "holdTime")]
762    pub hold_time: Option<chrono::DateTime<chrono::offset::Utc>>,
763    /// Output only. The last name of the account holder.
764    #[serde(rename = "lastName")]
765    pub last_name: Option<String>,
766}
767
768impl common::RequestValue for HeldAccount {}
769impl common::ResponseResult for HeldAccount {}
770
771/// Options for Calendar holds.
772///
773/// This type is not used in any activity, and only used as *part* of another schema.
774///
775#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
776#[serde_with::serde_as]
777#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
778pub struct HeldCalendarQuery {
779    _never_set: Option<bool>,
780}
781
782impl common::Part for HeldCalendarQuery {}
783
784/// Options for Drive holds.
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 HeldDriveQuery {
792    /// To include files in shared drives in the hold, set to **true**.
793    #[serde(rename = "includeSharedDriveFiles")]
794    pub include_shared_drive_files: Option<bool>,
795    /// To include files in Team Drives in the hold, set to **true**.
796    #[serde(rename = "includeTeamDriveFiles")]
797    pub include_team_drive_files: Option<bool>,
798}
799
800impl common::Part for HeldDriveQuery {}
801
802/// Query options for group holds.
803///
804/// This type is not used in any activity, and only used as *part* of another schema.
805///
806#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
807#[serde_with::serde_as]
808#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
809pub struct HeldGroupsQuery {
810    /// The end time for the query. Specify in GMT. The value is rounded to 12 AM on the specified date.
811    #[serde(rename = "endTime")]
812    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
813    /// The start time for the query. Specify in GMT. The value is rounded to 12 AM on the specified date.
814    #[serde(rename = "startTime")]
815    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
816    /// The [search operators](https://support.google.com/vault/answer/2474474) used to refine the messages covered by the hold.
817    pub terms: Option<String>,
818}
819
820impl common::Part for HeldGroupsQuery {}
821
822/// Options for Chat holds.
823///
824/// This type is not used in any activity, and only used as *part* of another schema.
825///
826#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
827#[serde_with::serde_as]
828#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
829pub struct HeldHangoutsChatQuery {
830    /// To include messages in Chat spaces the user was a member of, set to **true**.
831    #[serde(rename = "includeRooms")]
832    pub include_rooms: Option<bool>,
833}
834
835impl common::Part for HeldHangoutsChatQuery {}
836
837/// Query options for Gmail holds.
838///
839/// This type is not used in any activity, and only used as *part* of another schema.
840///
841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
842#[serde_with::serde_as]
843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
844pub struct HeldMailQuery {
845    /// The end time for the query. Specify in GMT. The value is rounded to 12 AM on the specified date.
846    #[serde(rename = "endTime")]
847    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
848    /// The start time for the query. Specify in GMT. The value is rounded to 12 AM on the specified date.
849    #[serde(rename = "startTime")]
850    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
851    /// The [search operators](https://support.google.com/vault/answer/2474474) used to refine the messages covered by the hold.
852    pub terms: Option<String>,
853}
854
855impl common::Part for HeldMailQuery {}
856
857/// The organizational unit covered by a hold. This structure is immutable.
858///
859/// This type is not used in any activity, and only used as *part* of another schema.
860///
861#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
862#[serde_with::serde_as]
863#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
864pub struct HeldOrgUnit {
865    /// When the organizational unit was put on hold. This property is immutable.
866    #[serde(rename = "holdTime")]
867    pub hold_time: Option<chrono::DateTime<chrono::offset::Utc>>,
868    /// The organizational unit's immutable ID as provided by the [Admin SDK](https://developers.google.com/admin-sdk/).
869    #[serde(rename = "orgUnitId")]
870    pub org_unit_id: Option<String>,
871}
872
873impl common::Part for HeldOrgUnit {}
874
875/// Options for Voice holds.
876///
877/// This type is not used in any activity, and only used as *part* of another schema.
878///
879#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
880#[serde_with::serde_as]
881#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
882pub struct HeldVoiceQuery {
883    /// A list of data types covered by the hold. Should be non-empty. Order does not matter and duplicates are ignored.
884    #[serde(rename = "coveredData")]
885    pub covered_data: Option<Vec<String>>,
886}
887
888impl common::Part for HeldVoiceQuery {}
889
890/// A hold. A hold prevents the specified Google Workspace service from purging data for specific accounts or all members of an organizational unit. To work with Vault resources, the account must have the \[required Vault privileges\] (https://support.google.com/vault/answer/2799699) and access to the matter. To access a matter, the account must have created the matter, have the matter shared with them, or have the **View All Matters** privilege.
891///
892/// # Activities
893///
894/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
895/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
896///
897/// * [holds create matters](MatterHoldCreateCall) (request|response)
898/// * [holds get matters](MatterHoldGetCall) (response)
899/// * [holds update matters](MatterHoldUpdateCall) (request|response)
900#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
901#[serde_with::serde_as]
902#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
903pub struct Hold {
904    /// If set, the hold applies to the specified accounts and **orgUnit** must be empty.
905    pub accounts: Option<Vec<HeldAccount>>,
906    /// The service to be searched.
907    pub corpus: Option<String>,
908    /// The unique immutable ID of the hold. Assigned during creation.
909    #[serde(rename = "holdId")]
910    pub hold_id: Option<String>,
911    /// The name of the hold.
912    pub name: Option<String>,
913    /// If set, the hold applies to all members of the organizational unit and **accounts** must be empty. This property is mutable. For Groups holds, set **accounts**.
914    #[serde(rename = "orgUnit")]
915    pub org_unit: Option<HeldOrgUnit>,
916    /// Service-specific options. If set, **CorpusQuery** must match **CorpusType**.
917    pub query: Option<CorpusQuery>,
918    /// The last time this hold was modified.
919    #[serde(rename = "updateTime")]
920    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
921}
922
923impl common::RequestValue for Hold {}
924impl common::ResponseResult for Hold {}
925
926/// The exports for a matter.
927///
928/// # Activities
929///
930/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
931/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
932///
933/// * [exports list matters](MatterExportListCall) (response)
934#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
935#[serde_with::serde_as]
936#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
937pub struct ListExportsResponse {
938    /// The list of exports.
939    pub exports: Option<Vec<Export>>,
940    /// Page token to retrieve the next page of results in the list.
941    #[serde(rename = "nextPageToken")]
942    pub next_page_token: Option<String>,
943}
944
945impl common::ResponseResult for ListExportsResponse {}
946
947/// Returns a list of the accounts covered by a hold.
948///
949/// # Activities
950///
951/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
952/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
953///
954/// * [holds accounts list matters](MatterHoldAccountListCall) (response)
955#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
956#[serde_with::serde_as]
957#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
958pub struct ListHeldAccountsResponse {
959    /// The held accounts on a hold.
960    pub accounts: Option<Vec<HeldAccount>>,
961}
962
963impl common::ResponseResult for ListHeldAccountsResponse {}
964
965/// The holds for a matter.
966///
967/// # Activities
968///
969/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
970/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
971///
972/// * [holds list matters](MatterHoldListCall) (response)
973#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
974#[serde_with::serde_as]
975#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
976pub struct ListHoldsResponse {
977    /// The list of holds.
978    pub holds: Option<Vec<Hold>>,
979    /// Page token to retrieve the next page of results in the list. If this is empty, then there are no more holds to list.
980    #[serde(rename = "nextPageToken")]
981    pub next_page_token: Option<String>,
982}
983
984impl common::ResponseResult for ListHoldsResponse {}
985
986/// Provides the list of matters.
987///
988/// # Activities
989///
990/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
991/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
992///
993/// * [list matters](MatterListCall) (response)
994#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
995#[serde_with::serde_as]
996#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
997pub struct ListMattersResponse {
998    /// List of matters.
999    pub matters: Option<Vec<Matter>>,
1000    /// Page token to retrieve the next page of results in the list.
1001    #[serde(rename = "nextPageToken")]
1002    pub next_page_token: Option<String>,
1003}
1004
1005impl common::ResponseResult for ListMattersResponse {}
1006
1007/// The response message for Operations.ListOperations.
1008///
1009/// # Activities
1010///
1011/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1012/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1013///
1014/// * [list operations](OperationListCall) (response)
1015#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1016#[serde_with::serde_as]
1017#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1018pub struct ListOperationsResponse {
1019    /// The standard List next-page token.
1020    #[serde(rename = "nextPageToken")]
1021    pub next_page_token: Option<String>,
1022    /// A list of operations that matches the specified filter in the request.
1023    pub operations: Option<Vec<Operation>>,
1024    /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
1025    pub unreachable: Option<Vec<String>>,
1026}
1027
1028impl common::ResponseResult for ListOperationsResponse {}
1029
1030/// Definition of the response for method ListSaveQuery.
1031///
1032/// # Activities
1033///
1034/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1035/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1036///
1037/// * [saved queries list matters](MatterSavedQueryListCall) (response)
1038#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1039#[serde_with::serde_as]
1040#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1041pub struct ListSavedQueriesResponse {
1042    /// Page token to retrieve the next page of results in the list. If this is empty, then there are no more saved queries to list.
1043    #[serde(rename = "nextPageToken")]
1044    pub next_page_token: Option<String>,
1045    /// List of saved queries.
1046    #[serde(rename = "savedQueries")]
1047    pub saved_queries: Option<Vec<SavedQuery>>,
1048}
1049
1050impl common::ResponseResult for ListSavedQueriesResponse {}
1051
1052/// Options for Gmail exports.
1053///
1054/// This type is not used in any activity, and only used as *part* of another schema.
1055///
1056#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1057#[serde_with::serde_as]
1058#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1059pub struct MailExportOptions {
1060    /// The file format for exported messages.
1061    #[serde(rename = "exportFormat")]
1062    pub export_format: Option<String>,
1063    /// Optional. To enable exporting linked Drive files, set to **true**.
1064    #[serde(rename = "exportLinkedDriveFiles")]
1065    pub export_linked_drive_files: Option<bool>,
1066    /// To export confidential mode content, set to **true**.
1067    #[serde(rename = "showConfidentialModeContent")]
1068    pub show_confidential_mode_content: Option<bool>,
1069    /// To use the new export system, set to **true**.
1070    #[serde(rename = "useNewExport")]
1071    pub use_new_export: Option<bool>,
1072}
1073
1074impl common::Part for MailExportOptions {}
1075
1076/// Additional options for Gmail search
1077///
1078/// This type is not used in any activity, and only used as *part* of another schema.
1079///
1080#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1081#[serde_with::serde_as]
1082#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1083pub struct MailOptions {
1084    /// Specifies whether the results should include encrypted content, unencrypted content, or both. Defaults to including both.
1085    #[serde(rename = "clientSideEncryptedOption")]
1086    pub client_side_encrypted_option: Option<String>,
1087    /// Set to **true** to exclude drafts.
1088    #[serde(rename = "excludeDrafts")]
1089    pub exclude_drafts: Option<bool>,
1090}
1091
1092impl common::Part for MailOptions {}
1093
1094/// Represents a matter. To work with Vault resources, the account must have the \[required Vault privileges\] (https://support.google.com/vault/answer/2799699) and access to the matter. To access a matter, the account must have created the matter, have the matter shared with them, or have the **View All Matters** privilege.
1095///
1096/// # Activities
1097///
1098/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1099/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1100///
1101/// * [exports create matters](MatterExportCreateCall) (none)
1102/// * [exports delete matters](MatterExportDeleteCall) (none)
1103/// * [exports get matters](MatterExportGetCall) (none)
1104/// * [exports list matters](MatterExportListCall) (none)
1105/// * [holds accounts create matters](MatterHoldAccountCreateCall) (none)
1106/// * [holds accounts delete matters](MatterHoldAccountDeleteCall) (none)
1107/// * [holds accounts list matters](MatterHoldAccountListCall) (none)
1108/// * [holds add held accounts matters](MatterHoldAddHeldAccountCall) (none)
1109/// * [holds create matters](MatterHoldCreateCall) (none)
1110/// * [holds delete matters](MatterHoldDeleteCall) (none)
1111/// * [holds get matters](MatterHoldGetCall) (none)
1112/// * [holds list matters](MatterHoldListCall) (none)
1113/// * [holds remove held accounts matters](MatterHoldRemoveHeldAccountCall) (none)
1114/// * [holds update matters](MatterHoldUpdateCall) (none)
1115/// * [saved queries create matters](MatterSavedQueryCreateCall) (none)
1116/// * [saved queries delete matters](MatterSavedQueryDeleteCall) (none)
1117/// * [saved queries get matters](MatterSavedQueryGetCall) (none)
1118/// * [saved queries list matters](MatterSavedQueryListCall) (none)
1119/// * [add permissions matters](MatterAddPermissionCall) (none)
1120/// * [close matters](MatterCloseCall) (none)
1121/// * [count matters](MatterCountCall) (none)
1122/// * [create matters](MatterCreateCall) (request|response)
1123/// * [delete matters](MatterDeleteCall) (response)
1124/// * [get matters](MatterGetCall) (response)
1125/// * [list matters](MatterListCall) (none)
1126/// * [remove permissions matters](MatterRemovePermissionCall) (none)
1127/// * [reopen matters](MatterReopenCall) (none)
1128/// * [undelete matters](MatterUndeleteCall) (response)
1129/// * [update matters](MatterUpdateCall) (request|response)
1130#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1131#[serde_with::serde_as]
1132#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1133pub struct Matter {
1134    /// An optional description for the matter.
1135    pub description: Option<String>,
1136    /// The matter ID, which is generated by the server. Leave blank when creating a matter.
1137    #[serde(rename = "matterId")]
1138    pub matter_id: Option<String>,
1139    /// Lists the users and their permission for the matter. Currently there is no programmer defined limit on the number of permissions a matter can have.
1140    #[serde(rename = "matterPermissions")]
1141    pub matter_permissions: Option<Vec<MatterPermission>>,
1142    /// Optional. The requested data region for the matter.
1143    #[serde(rename = "matterRegion")]
1144    pub matter_region: Option<String>,
1145    /// The name of the matter.
1146    pub name: Option<String>,
1147    /// The state of the matter.
1148    pub state: Option<String>,
1149}
1150
1151impl common::RequestValue for Matter {}
1152impl common::Resource for Matter {}
1153impl common::ResponseResult for Matter {}
1154
1155/// Users can be matter owners or collaborators. Each matter has only one owner. All others users who can access the matter are collaborators. When an account is purged, its corresponding MatterPermission resources cease to exist.
1156///
1157/// # Activities
1158///
1159/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1160/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1161///
1162/// * [add permissions matters](MatterAddPermissionCall) (response)
1163#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1164#[serde_with::serde_as]
1165#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1166pub struct MatterPermission {
1167    /// The account ID, as provided by the [Admin SDK](https://developers.google.com/admin-sdk/).
1168    #[serde(rename = "accountId")]
1169    pub account_id: Option<String>,
1170    /// The user's role for the matter.
1171    pub role: Option<String>,
1172}
1173
1174impl common::ResponseResult for MatterPermission {}
1175
1176/// This resource represents a long-running operation that is the result of a network API call.
1177///
1178/// # Activities
1179///
1180/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1181/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1182///
1183/// * [count matters](MatterCountCall) (response)
1184/// * [cancel operations](OperationCancelCall) (none)
1185/// * [delete operations](OperationDeleteCall) (none)
1186/// * [get operations](OperationGetCall) (response)
1187/// * [list operations](OperationListCall) (none)
1188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1189#[serde_with::serde_as]
1190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1191pub struct Operation {
1192    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
1193    pub done: Option<bool>,
1194    /// The error result of the operation in case of failure or cancellation.
1195    pub error: Option<Status>,
1196    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
1197    pub metadata: Option<HashMap<String, serde_json::Value>>,
1198    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
1199    pub name: Option<String>,
1200    /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
1201    pub response: Option<HashMap<String, serde_json::Value>>,
1202}
1203
1204impl common::Resource for Operation {}
1205impl common::ResponseResult for Operation {}
1206
1207/// The organizational unit to search
1208///
1209/// This type is not used in any activity, and only used as *part* of another schema.
1210///
1211#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1212#[serde_with::serde_as]
1213#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1214pub struct OrgUnitInfo {
1215    /// The name of the organizational unit to search, as provided by the [Admin SDK Directory API](https://developers.google.com/admin-sdk/directory/).
1216    #[serde(rename = "orgUnitId")]
1217    pub org_unit_id: Option<String>,
1218}
1219
1220impl common::Part for OrgUnitInfo {}
1221
1222/// The query definition used for search and export.
1223///
1224/// This type is not used in any activity, and only used as *part* of another schema.
1225///
1226#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1227#[serde_with::serde_as]
1228#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1229pub struct Query {
1230    /// Required when **SearchMethod** is **ACCOUNT**.
1231    #[serde(rename = "accountInfo")]
1232    pub account_info: Option<AccountInfo>,
1233    /// Set Calendar search-specific options.
1234    #[serde(rename = "calendarOptions")]
1235    pub calendar_options: Option<CalendarOptions>,
1236    /// The Google Workspace service to search.
1237    pub corpus: Option<String>,
1238    /// The data source to search.
1239    #[serde(rename = "dataScope")]
1240    pub data_scope: Option<String>,
1241    /// Required when **SearchMethod** is **DRIVE_DOCUMENT**.
1242    #[serde(rename = "driveDocumentInfo")]
1243    pub drive_document_info: Option<DriveDocumentInfo>,
1244    /// Set Drive search-specific options.
1245    #[serde(rename = "driveOptions")]
1246    pub drive_options: Option<DriveOptions>,
1247    /// The end time for the search query. Specify in GMT. The value is rounded to 12 AM on the specified date.
1248    #[serde(rename = "endTime")]
1249    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1250    /// Set Gemini search-specific options.
1251    #[serde(rename = "geminiOptions")]
1252    pub gemini_options: Option<GeminiOptions>,
1253    /// Required when **SearchMethod** is **ROOM**. (read-only)
1254    #[serde(rename = "hangoutsChatInfo")]
1255    pub hangouts_chat_info: Option<HangoutsChatInfo>,
1256    /// Set Chat search-specific options. (read-only)
1257    #[serde(rename = "hangoutsChatOptions")]
1258    pub hangouts_chat_options: Option<HangoutsChatOptions>,
1259    /// Set Gmail search-specific options.
1260    #[serde(rename = "mailOptions")]
1261    pub mail_options: Option<MailOptions>,
1262    /// The entity to search. This field replaces **searchMethod** to support shared drives. When **searchMethod** is **TEAM_DRIVE**, the response of this field is **SHARED_DRIVE**.
1263    pub method: Option<String>,
1264    /// Required when **SearchMethod** is **ORG_UNIT**.
1265    #[serde(rename = "orgUnitInfo")]
1266    pub org_unit_info: Option<OrgUnitInfo>,
1267    /// The search method to use.
1268    #[serde(rename = "searchMethod")]
1269    pub search_method: Option<String>,
1270    /// Required when **SearchMethod** is **SHARED_DRIVE**.
1271    #[serde(rename = "sharedDriveInfo")]
1272    pub shared_drive_info: Option<SharedDriveInfo>,
1273    /// Required when **SearchMethod** is **SITES_URL**.
1274    #[serde(rename = "sitesUrlInfo")]
1275    pub sites_url_info: Option<SitesUrlInfo>,
1276    /// The start time for the search query. Specify in GMT. The value is rounded to 12 AM on the specified date.
1277    #[serde(rename = "startTime")]
1278    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1279    /// Required when **SearchMethod** is **TEAM_DRIVE**.
1280    #[serde(rename = "teamDriveInfo")]
1281    pub team_drive_info: Option<TeamDriveInfo>,
1282    /// Service-specific [search operators](https://support.google.com/vault/answer/2474474) to filter search results.
1283    pub terms: Option<String>,
1284    /// The time zone name. It should be an IANA TZ name, such as "America/Los_Angeles". For a list of time zone names, see [Time Zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For more information about how Vault uses time zones, see [the Vault help center](https://support.google.com/vault/answer/6092995#time).
1285    #[serde(rename = "timeZone")]
1286    pub time_zone: Option<String>,
1287    /// Set Voice search-specific options.
1288    #[serde(rename = "voiceOptions")]
1289    pub voice_options: Option<VoiceOptions>,
1290}
1291
1292impl common::Part for Query {}
1293
1294/// Remove a list of accounts from a hold.
1295///
1296/// # Activities
1297///
1298/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1299/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1300///
1301/// * [holds remove held accounts matters](MatterHoldRemoveHeldAccountCall) (request)
1302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1303#[serde_with::serde_as]
1304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1305pub struct RemoveHeldAccountsRequest {
1306    /// The account IDs of the accounts to remove from the hold.
1307    #[serde(rename = "accountIds")]
1308    pub account_ids: Option<Vec<String>>,
1309}
1310
1311impl common::RequestValue for RemoveHeldAccountsRequest {}
1312
1313/// Response for batch delete held accounts.
1314///
1315/// # Activities
1316///
1317/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1318/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1319///
1320/// * [holds remove held accounts matters](MatterHoldRemoveHeldAccountCall) (response)
1321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1322#[serde_with::serde_as]
1323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1324pub struct RemoveHeldAccountsResponse {
1325    /// A list of statuses for the deleted accounts. Results have the same order as the request.
1326    pub statuses: Option<Vec<Status>>,
1327}
1328
1329impl common::ResponseResult for RemoveHeldAccountsResponse {}
1330
1331/// Remove an account as a matter collaborator.
1332///
1333/// # Activities
1334///
1335/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1336/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1337///
1338/// * [remove permissions matters](MatterRemovePermissionCall) (request)
1339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1340#[serde_with::serde_as]
1341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1342pub struct RemoveMatterPermissionsRequest {
1343    /// The account ID.
1344    #[serde(rename = "accountId")]
1345    pub account_id: Option<String>,
1346}
1347
1348impl common::RequestValue for RemoveMatterPermissionsRequest {}
1349
1350/// Reopen a matter by ID.
1351///
1352/// # Activities
1353///
1354/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1355/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1356///
1357/// * [reopen matters](MatterReopenCall) (request)
1358#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1359#[serde_with::serde_as]
1360#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1361pub struct ReopenMatterRequest {
1362    _never_set: Option<bool>,
1363}
1364
1365impl common::RequestValue for ReopenMatterRequest {}
1366
1367/// Response to a ReopenMatterRequest.
1368///
1369/// # Activities
1370///
1371/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1372/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1373///
1374/// * [reopen matters](MatterReopenCall) (response)
1375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1376#[serde_with::serde_as]
1377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1378pub struct ReopenMatterResponse {
1379    /// The updated matter, with state **OPEN**.
1380    pub matter: Option<Matter>,
1381}
1382
1383impl common::ResponseResult for ReopenMatterResponse {}
1384
1385/// The definition of a saved query. To work with Vault resources, the account must have the [required Vault privileges](https://support.google.com/vault/answer/2799699) and access to the matter. To access a matter, the account must have created the matter, have the matter shared with them, or have the **View All Matters** privilege.
1386///
1387/// # Activities
1388///
1389/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1390/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1391///
1392/// * [saved queries create matters](MatterSavedQueryCreateCall) (request|response)
1393/// * [saved queries get matters](MatterSavedQueryGetCall) (response)
1394#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1395#[serde_with::serde_as]
1396#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1397pub struct SavedQuery {
1398    /// Output only. The server-generated timestamp when the saved query was created.
1399    #[serde(rename = "createTime")]
1400    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1401    /// The name of the saved query.
1402    #[serde(rename = "displayName")]
1403    pub display_name: Option<String>,
1404    /// Output only. The matter ID of the matter the saved query is saved in. The server does not use this field during create and always uses matter ID in the URL.
1405    #[serde(rename = "matterId")]
1406    pub matter_id: Option<String>,
1407    /// The search parameters of the saved query.
1408    pub query: Option<Query>,
1409    /// A unique identifier for the saved query.
1410    #[serde(rename = "savedQueryId")]
1411    pub saved_query_id: Option<String>,
1412}
1413
1414impl common::RequestValue for SavedQuery {}
1415impl common::ResponseResult for SavedQuery {}
1416
1417/// The shared drives to search
1418///
1419/// This type is not used in any activity, and only used as *part* of another schema.
1420///
1421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1422#[serde_with::serde_as]
1423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1424pub struct SharedDriveInfo {
1425    /// A list of shared drive IDs, as provided by the [Drive API](https://developers.google.com/drive).
1426    #[serde(rename = "sharedDriveIds")]
1427    pub shared_drive_ids: Option<Vec<String>>,
1428}
1429
1430impl common::Part for SharedDriveInfo {}
1431
1432/// The published site URLs of new Google Sites to search
1433///
1434/// This type is not used in any activity, and only used as *part* of another schema.
1435///
1436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1437#[serde_with::serde_as]
1438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1439pub struct SitesUrlInfo {
1440    /// A list of published site URLs.
1441    pub urls: Option<Vec<String>>,
1442}
1443
1444impl common::Part for SitesUrlInfo {}
1445
1446/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
1447///
1448/// This type is not used in any activity, and only used as *part* of another schema.
1449///
1450#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1451#[serde_with::serde_as]
1452#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1453pub struct Status {
1454    /// The status code, which should be an enum value of google.rpc.Code.
1455    pub code: Option<i32>,
1456    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1457    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1458    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1459    pub message: Option<String>,
1460}
1461
1462impl common::Part for Status {}
1463
1464/// Team Drives to search
1465///
1466/// This type is not used in any activity, and only used as *part* of another schema.
1467///
1468#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1469#[serde_with::serde_as]
1470#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1471pub struct TeamDriveInfo {
1472    /// List of Team Drive IDs, as provided by the [Drive API](https://developers.google.com/drive).
1473    #[serde(rename = "teamDriveIds")]
1474    pub team_drive_ids: Option<Vec<String>>,
1475}
1476
1477impl common::Part for TeamDriveInfo {}
1478
1479/// Undelete a matter by ID.
1480///
1481/// # Activities
1482///
1483/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1484/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1485///
1486/// * [undelete matters](MatterUndeleteCall) (request)
1487#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1488#[serde_with::serde_as]
1489#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1490pub struct UndeleteMatterRequest {
1491    _never_set: Option<bool>,
1492}
1493
1494impl common::RequestValue for UndeleteMatterRequest {}
1495
1496/// User's information.
1497///
1498/// This type is not used in any activity, and only used as *part* of another schema.
1499///
1500#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1501#[serde_with::serde_as]
1502#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1503pub struct UserInfo {
1504    /// The displayed name of the user.
1505    #[serde(rename = "displayName")]
1506    pub display_name: Option<String>,
1507    /// The email address of the user.
1508    pub email: Option<String>,
1509}
1510
1511impl common::Part for UserInfo {}
1512
1513/// The options for Voice exports.
1514///
1515/// This type is not used in any activity, and only used as *part* of another schema.
1516///
1517#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1518#[serde_with::serde_as]
1519#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1520pub struct VoiceExportOptions {
1521    /// The file format for exported text messages.
1522    #[serde(rename = "exportFormat")]
1523    pub export_format: Option<String>,
1524}
1525
1526impl common::Part for VoiceExportOptions {}
1527
1528/// Additional options for Voice search
1529///
1530/// This type is not used in any activity, and only used as *part* of another schema.
1531///
1532#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1533#[serde_with::serde_as]
1534#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1535pub struct VoiceOptions {
1536    /// Datatypes to search
1537    #[serde(rename = "coveredData")]
1538    pub covered_data: Option<Vec<String>>,
1539}
1540
1541impl common::Part for VoiceOptions {}
1542
1543// ###################
1544// MethodBuilders ###
1545// #################
1546
1547/// A builder providing access to all methods supported on *matter* resources.
1548/// It is not used directly, but through the [`Vault`] hub.
1549///
1550/// # Example
1551///
1552/// Instantiate a resource builder
1553///
1554/// ```test_harness,no_run
1555/// extern crate hyper;
1556/// extern crate hyper_rustls;
1557/// extern crate google_vault1 as vault1;
1558///
1559/// # async fn dox() {
1560/// use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1561///
1562/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1563/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1564///     .with_native_roots()
1565///     .unwrap()
1566///     .https_only()
1567///     .enable_http2()
1568///     .build();
1569///
1570/// let executor = hyper_util::rt::TokioExecutor::new();
1571/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1572///     secret,
1573///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1574///     yup_oauth2::client::CustomHyperClientBuilder::from(
1575///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1576///     ),
1577/// ).build().await.unwrap();
1578///
1579/// let client = hyper_util::client::legacy::Client::builder(
1580///     hyper_util::rt::TokioExecutor::new()
1581/// )
1582/// .build(
1583///     hyper_rustls::HttpsConnectorBuilder::new()
1584///         .with_native_roots()
1585///         .unwrap()
1586///         .https_or_http()
1587///         .enable_http2()
1588///         .build()
1589/// );
1590/// let mut hub = Vault::new(client, auth);
1591/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1592/// // like `add_permissions(...)`, `close(...)`, `count(...)`, `create(...)`, `delete(...)`, `exports_create(...)`, `exports_delete(...)`, `exports_get(...)`, `exports_list(...)`, `get(...)`, `holds_accounts_create(...)`, `holds_accounts_delete(...)`, `holds_accounts_list(...)`, `holds_add_held_accounts(...)`, `holds_create(...)`, `holds_delete(...)`, `holds_get(...)`, `holds_list(...)`, `holds_remove_held_accounts(...)`, `holds_update(...)`, `list(...)`, `remove_permissions(...)`, `reopen(...)`, `saved_queries_create(...)`, `saved_queries_delete(...)`, `saved_queries_get(...)`, `saved_queries_list(...)`, `undelete(...)` and `update(...)`
1593/// // to build up your call.
1594/// let rb = hub.matters();
1595/// # }
1596/// ```
1597pub struct MatterMethods<'a, C>
1598where
1599    C: 'a,
1600{
1601    hub: &'a Vault<C>,
1602}
1603
1604impl<'a, C> common::MethodsBuilder for MatterMethods<'a, C> {}
1605
1606impl<'a, C> MatterMethods<'a, C> {
1607    /// Create a builder to help you perform the following task:
1608    ///
1609    /// Creates an export.
1610    ///
1611    /// # Arguments
1612    ///
1613    /// * `request` - No description provided.
1614    /// * `matterId` - The matter ID.
1615    pub fn exports_create(
1616        &self,
1617        request: Export,
1618        matter_id: &str,
1619    ) -> MatterExportCreateCall<'a, C> {
1620        MatterExportCreateCall {
1621            hub: self.hub,
1622            _request: request,
1623            _matter_id: matter_id.to_string(),
1624            _delegate: Default::default(),
1625            _additional_params: Default::default(),
1626            _scopes: Default::default(),
1627        }
1628    }
1629
1630    /// Create a builder to help you perform the following task:
1631    ///
1632    /// Deletes an export.
1633    ///
1634    /// # Arguments
1635    ///
1636    /// * `matterId` - The matter ID.
1637    /// * `exportId` - The export ID.
1638    pub fn exports_delete(
1639        &self,
1640        matter_id: &str,
1641        export_id: &str,
1642    ) -> MatterExportDeleteCall<'a, C> {
1643        MatterExportDeleteCall {
1644            hub: self.hub,
1645            _matter_id: matter_id.to_string(),
1646            _export_id: export_id.to_string(),
1647            _delegate: Default::default(),
1648            _additional_params: Default::default(),
1649            _scopes: Default::default(),
1650        }
1651    }
1652
1653    /// Create a builder to help you perform the following task:
1654    ///
1655    /// Gets an export.
1656    ///
1657    /// # Arguments
1658    ///
1659    /// * `matterId` - The matter ID.
1660    /// * `exportId` - The export ID.
1661    pub fn exports_get(&self, matter_id: &str, export_id: &str) -> MatterExportGetCall<'a, C> {
1662        MatterExportGetCall {
1663            hub: self.hub,
1664            _matter_id: matter_id.to_string(),
1665            _export_id: export_id.to_string(),
1666            _delegate: Default::default(),
1667            _additional_params: Default::default(),
1668            _scopes: Default::default(),
1669        }
1670    }
1671
1672    /// Create a builder to help you perform the following task:
1673    ///
1674    /// Lists details about the exports in the specified matter.
1675    ///
1676    /// # Arguments
1677    ///
1678    /// * `matterId` - The matter ID.
1679    pub fn exports_list(&self, matter_id: &str) -> MatterExportListCall<'a, C> {
1680        MatterExportListCall {
1681            hub: self.hub,
1682            _matter_id: matter_id.to_string(),
1683            _page_token: Default::default(),
1684            _page_size: Default::default(),
1685            _delegate: Default::default(),
1686            _additional_params: Default::default(),
1687            _scopes: Default::default(),
1688        }
1689    }
1690
1691    /// Create a builder to help you perform the following task:
1692    ///
1693    /// Adds an account to a hold. Accounts can be added only to a hold that does not have an organizational unit set. If you try to add an account to an organizational unit-based hold, an error is returned.
1694    ///
1695    /// # Arguments
1696    ///
1697    /// * `request` - No description provided.
1698    /// * `matterId` - The matter ID.
1699    /// * `holdId` - The hold ID.
1700    pub fn holds_accounts_create(
1701        &self,
1702        request: HeldAccount,
1703        matter_id: &str,
1704        hold_id: &str,
1705    ) -> MatterHoldAccountCreateCall<'a, C> {
1706        MatterHoldAccountCreateCall {
1707            hub: self.hub,
1708            _request: request,
1709            _matter_id: matter_id.to_string(),
1710            _hold_id: hold_id.to_string(),
1711            _delegate: Default::default(),
1712            _additional_params: Default::default(),
1713            _scopes: Default::default(),
1714        }
1715    }
1716
1717    /// Create a builder to help you perform the following task:
1718    ///
1719    /// Removes an account from a hold.
1720    ///
1721    /// # Arguments
1722    ///
1723    /// * `matterId` - The matter ID.
1724    /// * `holdId` - The hold ID.
1725    /// * `accountId` - The ID of the account to remove from the hold.
1726    pub fn holds_accounts_delete(
1727        &self,
1728        matter_id: &str,
1729        hold_id: &str,
1730        account_id: &str,
1731    ) -> MatterHoldAccountDeleteCall<'a, C> {
1732        MatterHoldAccountDeleteCall {
1733            hub: self.hub,
1734            _matter_id: matter_id.to_string(),
1735            _hold_id: hold_id.to_string(),
1736            _account_id: account_id.to_string(),
1737            _delegate: Default::default(),
1738            _additional_params: Default::default(),
1739            _scopes: Default::default(),
1740        }
1741    }
1742
1743    /// Create a builder to help you perform the following task:
1744    ///
1745    /// Lists the accounts covered by a hold. This can list only individually-specified accounts covered by the hold. If the hold covers an organizational unit, use the [Admin SDK](https://developers.google.com/admin-sdk/). to list the members of the organizational unit on hold.
1746    ///
1747    /// # Arguments
1748    ///
1749    /// * `matterId` - The matter ID.
1750    /// * `holdId` - The hold ID.
1751    pub fn holds_accounts_list(
1752        &self,
1753        matter_id: &str,
1754        hold_id: &str,
1755    ) -> MatterHoldAccountListCall<'a, C> {
1756        MatterHoldAccountListCall {
1757            hub: self.hub,
1758            _matter_id: matter_id.to_string(),
1759            _hold_id: hold_id.to_string(),
1760            _delegate: Default::default(),
1761            _additional_params: Default::default(),
1762            _scopes: Default::default(),
1763        }
1764    }
1765
1766    /// Create a builder to help you perform the following task:
1767    ///
1768    /// Adds accounts to a hold. Returns a list of accounts that have been successfully added. Accounts can be added only to an existing account-based hold.
1769    ///
1770    /// # Arguments
1771    ///
1772    /// * `request` - No description provided.
1773    /// * `matterId` - The matter ID.
1774    /// * `holdId` - The hold ID.
1775    pub fn holds_add_held_accounts(
1776        &self,
1777        request: AddHeldAccountsRequest,
1778        matter_id: &str,
1779        hold_id: &str,
1780    ) -> MatterHoldAddHeldAccountCall<'a, C> {
1781        MatterHoldAddHeldAccountCall {
1782            hub: self.hub,
1783            _request: request,
1784            _matter_id: matter_id.to_string(),
1785            _hold_id: hold_id.to_string(),
1786            _delegate: Default::default(),
1787            _additional_params: Default::default(),
1788            _scopes: Default::default(),
1789        }
1790    }
1791
1792    /// Create a builder to help you perform the following task:
1793    ///
1794    /// Creates a hold in the specified matter.
1795    ///
1796    /// # Arguments
1797    ///
1798    /// * `request` - No description provided.
1799    /// * `matterId` - The matter ID.
1800    pub fn holds_create(&self, request: Hold, matter_id: &str) -> MatterHoldCreateCall<'a, C> {
1801        MatterHoldCreateCall {
1802            hub: self.hub,
1803            _request: request,
1804            _matter_id: matter_id.to_string(),
1805            _delegate: Default::default(),
1806            _additional_params: Default::default(),
1807            _scopes: Default::default(),
1808        }
1809    }
1810
1811    /// Create a builder to help you perform the following task:
1812    ///
1813    /// Removes the specified hold and releases the accounts or organizational unit covered by the hold. If the data is not preserved by another hold or retention rule, it might be purged.
1814    ///
1815    /// # Arguments
1816    ///
1817    /// * `matterId` - The matter ID.
1818    /// * `holdId` - The hold ID.
1819    pub fn holds_delete(&self, matter_id: &str, hold_id: &str) -> MatterHoldDeleteCall<'a, C> {
1820        MatterHoldDeleteCall {
1821            hub: self.hub,
1822            _matter_id: matter_id.to_string(),
1823            _hold_id: hold_id.to_string(),
1824            _delegate: Default::default(),
1825            _additional_params: Default::default(),
1826            _scopes: Default::default(),
1827        }
1828    }
1829
1830    /// Create a builder to help you perform the following task:
1831    ///
1832    /// Gets the specified hold.
1833    ///
1834    /// # Arguments
1835    ///
1836    /// * `matterId` - The matter ID.
1837    /// * `holdId` - The hold ID.
1838    pub fn holds_get(&self, matter_id: &str, hold_id: &str) -> MatterHoldGetCall<'a, C> {
1839        MatterHoldGetCall {
1840            hub: self.hub,
1841            _matter_id: matter_id.to_string(),
1842            _hold_id: hold_id.to_string(),
1843            _view: Default::default(),
1844            _delegate: Default::default(),
1845            _additional_params: Default::default(),
1846            _scopes: Default::default(),
1847        }
1848    }
1849
1850    /// Create a builder to help you perform the following task:
1851    ///
1852    /// Lists the holds in a matter.
1853    ///
1854    /// # Arguments
1855    ///
1856    /// * `matterId` - The matter ID.
1857    pub fn holds_list(&self, matter_id: &str) -> MatterHoldListCall<'a, C> {
1858        MatterHoldListCall {
1859            hub: self.hub,
1860            _matter_id: matter_id.to_string(),
1861            _view: Default::default(),
1862            _page_token: Default::default(),
1863            _page_size: Default::default(),
1864            _delegate: Default::default(),
1865            _additional_params: Default::default(),
1866            _scopes: Default::default(),
1867        }
1868    }
1869
1870    /// Create a builder to help you perform the following task:
1871    ///
1872    /// Removes the specified accounts from a hold. Returns a list of statuses in the same order as the request.
1873    ///
1874    /// # Arguments
1875    ///
1876    /// * `request` - No description provided.
1877    /// * `matterId` - The matter ID.
1878    /// * `holdId` - The hold ID.
1879    pub fn holds_remove_held_accounts(
1880        &self,
1881        request: RemoveHeldAccountsRequest,
1882        matter_id: &str,
1883        hold_id: &str,
1884    ) -> MatterHoldRemoveHeldAccountCall<'a, C> {
1885        MatterHoldRemoveHeldAccountCall {
1886            hub: self.hub,
1887            _request: request,
1888            _matter_id: matter_id.to_string(),
1889            _hold_id: hold_id.to_string(),
1890            _delegate: Default::default(),
1891            _additional_params: Default::default(),
1892            _scopes: Default::default(),
1893        }
1894    }
1895
1896    /// Create a builder to help you perform the following task:
1897    ///
1898    /// Updates the scope (organizational unit or accounts) and query parameters of a hold. You cannot add accounts to a hold that covers an organizational unit, nor can you add organizational units to a hold that covers individual accounts. If you try, the unsupported values are ignored.
1899    ///
1900    /// # Arguments
1901    ///
1902    /// * `request` - No description provided.
1903    /// * `matterId` - The matter ID.
1904    /// * `holdId` - The ID of the hold.
1905    pub fn holds_update(
1906        &self,
1907        request: Hold,
1908        matter_id: &str,
1909        hold_id: &str,
1910    ) -> MatterHoldUpdateCall<'a, C> {
1911        MatterHoldUpdateCall {
1912            hub: self.hub,
1913            _request: request,
1914            _matter_id: matter_id.to_string(),
1915            _hold_id: hold_id.to_string(),
1916            _delegate: Default::default(),
1917            _additional_params: Default::default(),
1918            _scopes: Default::default(),
1919        }
1920    }
1921
1922    /// Create a builder to help you perform the following task:
1923    ///
1924    /// Creates a saved query.
1925    ///
1926    /// # Arguments
1927    ///
1928    /// * `request` - No description provided.
1929    /// * `matterId` - The ID of the matter to create the saved query in.
1930    pub fn saved_queries_create(
1931        &self,
1932        request: SavedQuery,
1933        matter_id: &str,
1934    ) -> MatterSavedQueryCreateCall<'a, C> {
1935        MatterSavedQueryCreateCall {
1936            hub: self.hub,
1937            _request: request,
1938            _matter_id: matter_id.to_string(),
1939            _delegate: Default::default(),
1940            _additional_params: Default::default(),
1941            _scopes: Default::default(),
1942        }
1943    }
1944
1945    /// Create a builder to help you perform the following task:
1946    ///
1947    /// Deletes the specified saved query.
1948    ///
1949    /// # Arguments
1950    ///
1951    /// * `matterId` - The ID of the matter to delete the saved query from.
1952    /// * `savedQueryId` - ID of the saved query to delete.
1953    pub fn saved_queries_delete(
1954        &self,
1955        matter_id: &str,
1956        saved_query_id: &str,
1957    ) -> MatterSavedQueryDeleteCall<'a, C> {
1958        MatterSavedQueryDeleteCall {
1959            hub: self.hub,
1960            _matter_id: matter_id.to_string(),
1961            _saved_query_id: saved_query_id.to_string(),
1962            _delegate: Default::default(),
1963            _additional_params: Default::default(),
1964            _scopes: Default::default(),
1965        }
1966    }
1967
1968    /// Create a builder to help you perform the following task:
1969    ///
1970    /// Retrieves the specified saved query.
1971    ///
1972    /// # Arguments
1973    ///
1974    /// * `matterId` - The ID of the matter to get the saved query from.
1975    /// * `savedQueryId` - ID of the saved query to retrieve.
1976    pub fn saved_queries_get(
1977        &self,
1978        matter_id: &str,
1979        saved_query_id: &str,
1980    ) -> MatterSavedQueryGetCall<'a, C> {
1981        MatterSavedQueryGetCall {
1982            hub: self.hub,
1983            _matter_id: matter_id.to_string(),
1984            _saved_query_id: saved_query_id.to_string(),
1985            _delegate: Default::default(),
1986            _additional_params: Default::default(),
1987            _scopes: Default::default(),
1988        }
1989    }
1990
1991    /// Create a builder to help you perform the following task:
1992    ///
1993    /// Lists the saved queries in a matter.
1994    ///
1995    /// # Arguments
1996    ///
1997    /// * `matterId` - The ID of the matter to get the saved queries for.
1998    pub fn saved_queries_list(&self, matter_id: &str) -> MatterSavedQueryListCall<'a, C> {
1999        MatterSavedQueryListCall {
2000            hub: self.hub,
2001            _matter_id: matter_id.to_string(),
2002            _page_token: Default::default(),
2003            _page_size: Default::default(),
2004            _delegate: Default::default(),
2005            _additional_params: Default::default(),
2006            _scopes: Default::default(),
2007        }
2008    }
2009
2010    /// Create a builder to help you perform the following task:
2011    ///
2012    /// Adds an account as a matter collaborator.
2013    ///
2014    /// # Arguments
2015    ///
2016    /// * `request` - No description provided.
2017    /// * `matterId` - The matter ID.
2018    pub fn add_permissions(
2019        &self,
2020        request: AddMatterPermissionsRequest,
2021        matter_id: &str,
2022    ) -> MatterAddPermissionCall<'a, C> {
2023        MatterAddPermissionCall {
2024            hub: self.hub,
2025            _request: request,
2026            _matter_id: matter_id.to_string(),
2027            _delegate: Default::default(),
2028            _additional_params: Default::default(),
2029            _scopes: Default::default(),
2030        }
2031    }
2032
2033    /// Create a builder to help you perform the following task:
2034    ///
2035    /// Closes the specified matter. Returns the matter with updated state.
2036    ///
2037    /// # Arguments
2038    ///
2039    /// * `request` - No description provided.
2040    /// * `matterId` - The matter ID.
2041    pub fn close(&self, request: CloseMatterRequest, matter_id: &str) -> MatterCloseCall<'a, C> {
2042        MatterCloseCall {
2043            hub: self.hub,
2044            _request: request,
2045            _matter_id: matter_id.to_string(),
2046            _delegate: Default::default(),
2047            _additional_params: Default::default(),
2048            _scopes: Default::default(),
2049        }
2050    }
2051
2052    /// Create a builder to help you perform the following task:
2053    ///
2054    /// Counts the accounts processed by the specified query.
2055    ///
2056    /// # Arguments
2057    ///
2058    /// * `request` - No description provided.
2059    /// * `matterId` - The matter ID.
2060    pub fn count(&self, request: CountArtifactsRequest, matter_id: &str) -> MatterCountCall<'a, C> {
2061        MatterCountCall {
2062            hub: self.hub,
2063            _request: request,
2064            _matter_id: matter_id.to_string(),
2065            _delegate: Default::default(),
2066            _additional_params: Default::default(),
2067            _scopes: Default::default(),
2068        }
2069    }
2070
2071    /// Create a builder to help you perform the following task:
2072    ///
2073    /// Creates a matter with the given name and description. The initial state is open, and the owner is the method caller. Returns the created matter with default view.
2074    ///
2075    /// # Arguments
2076    ///
2077    /// * `request` - No description provided.
2078    pub fn create(&self, request: Matter) -> MatterCreateCall<'a, C> {
2079        MatterCreateCall {
2080            hub: self.hub,
2081            _request: request,
2082            _delegate: Default::default(),
2083            _additional_params: Default::default(),
2084            _scopes: Default::default(),
2085        }
2086    }
2087
2088    /// Create a builder to help you perform the following task:
2089    ///
2090    /// Deletes the specified matter. Returns the matter with updated state.
2091    ///
2092    /// # Arguments
2093    ///
2094    /// * `matterId` - The matter ID
2095    pub fn delete(&self, matter_id: &str) -> MatterDeleteCall<'a, C> {
2096        MatterDeleteCall {
2097            hub: self.hub,
2098            _matter_id: matter_id.to_string(),
2099            _delegate: Default::default(),
2100            _additional_params: Default::default(),
2101            _scopes: Default::default(),
2102        }
2103    }
2104
2105    /// Create a builder to help you perform the following task:
2106    ///
2107    /// Gets the specified matter.
2108    ///
2109    /// # Arguments
2110    ///
2111    /// * `matterId` - The matter ID.
2112    pub fn get(&self, matter_id: &str) -> MatterGetCall<'a, C> {
2113        MatterGetCall {
2114            hub: self.hub,
2115            _matter_id: matter_id.to_string(),
2116            _view: Default::default(),
2117            _delegate: Default::default(),
2118            _additional_params: Default::default(),
2119            _scopes: Default::default(),
2120        }
2121    }
2122
2123    /// Create a builder to help you perform the following task:
2124    ///
2125    /// Lists matters the requestor has access to.
2126    pub fn list(&self) -> MatterListCall<'a, C> {
2127        MatterListCall {
2128            hub: self.hub,
2129            _view: Default::default(),
2130            _state: Default::default(),
2131            _page_token: Default::default(),
2132            _page_size: Default::default(),
2133            _delegate: Default::default(),
2134            _additional_params: Default::default(),
2135            _scopes: Default::default(),
2136        }
2137    }
2138
2139    /// Create a builder to help you perform the following task:
2140    ///
2141    /// Removes an account as a matter collaborator.
2142    ///
2143    /// # Arguments
2144    ///
2145    /// * `request` - No description provided.
2146    /// * `matterId` - The matter ID.
2147    pub fn remove_permissions(
2148        &self,
2149        request: RemoveMatterPermissionsRequest,
2150        matter_id: &str,
2151    ) -> MatterRemovePermissionCall<'a, C> {
2152        MatterRemovePermissionCall {
2153            hub: self.hub,
2154            _request: request,
2155            _matter_id: matter_id.to_string(),
2156            _delegate: Default::default(),
2157            _additional_params: Default::default(),
2158            _scopes: Default::default(),
2159        }
2160    }
2161
2162    /// Create a builder to help you perform the following task:
2163    ///
2164    /// Reopens the specified matter. Returns the matter with updated state.
2165    ///
2166    /// # Arguments
2167    ///
2168    /// * `request` - No description provided.
2169    /// * `matterId` - The matter ID.
2170    pub fn reopen(&self, request: ReopenMatterRequest, matter_id: &str) -> MatterReopenCall<'a, C> {
2171        MatterReopenCall {
2172            hub: self.hub,
2173            _request: request,
2174            _matter_id: matter_id.to_string(),
2175            _delegate: Default::default(),
2176            _additional_params: Default::default(),
2177            _scopes: Default::default(),
2178        }
2179    }
2180
2181    /// Create a builder to help you perform the following task:
2182    ///
2183    /// Undeletes the specified matter. Returns the matter with updated state.
2184    ///
2185    /// # Arguments
2186    ///
2187    /// * `request` - No description provided.
2188    /// * `matterId` - The matter ID.
2189    pub fn undelete(
2190        &self,
2191        request: UndeleteMatterRequest,
2192        matter_id: &str,
2193    ) -> MatterUndeleteCall<'a, C> {
2194        MatterUndeleteCall {
2195            hub: self.hub,
2196            _request: request,
2197            _matter_id: matter_id.to_string(),
2198            _delegate: Default::default(),
2199            _additional_params: Default::default(),
2200            _scopes: Default::default(),
2201        }
2202    }
2203
2204    /// Create a builder to help you perform the following task:
2205    ///
2206    /// Updates the specified matter. This updates only the name and description of the matter, identified by matter ID. Changes to any other fields are ignored. Returns the default view of the matter.
2207    ///
2208    /// # Arguments
2209    ///
2210    /// * `request` - No description provided.
2211    /// * `matterId` - The matter ID.
2212    pub fn update(&self, request: Matter, matter_id: &str) -> MatterUpdateCall<'a, C> {
2213        MatterUpdateCall {
2214            hub: self.hub,
2215            _request: request,
2216            _matter_id: matter_id.to_string(),
2217            _delegate: Default::default(),
2218            _additional_params: Default::default(),
2219            _scopes: Default::default(),
2220        }
2221    }
2222}
2223
2224/// A builder providing access to all methods supported on *operation* resources.
2225/// It is not used directly, but through the [`Vault`] hub.
2226///
2227/// # Example
2228///
2229/// Instantiate a resource builder
2230///
2231/// ```test_harness,no_run
2232/// extern crate hyper;
2233/// extern crate hyper_rustls;
2234/// extern crate google_vault1 as vault1;
2235///
2236/// # async fn dox() {
2237/// use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2238///
2239/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2240/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2241///     .with_native_roots()
2242///     .unwrap()
2243///     .https_only()
2244///     .enable_http2()
2245///     .build();
2246///
2247/// let executor = hyper_util::rt::TokioExecutor::new();
2248/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2249///     secret,
2250///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2251///     yup_oauth2::client::CustomHyperClientBuilder::from(
2252///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2253///     ),
2254/// ).build().await.unwrap();
2255///
2256/// let client = hyper_util::client::legacy::Client::builder(
2257///     hyper_util::rt::TokioExecutor::new()
2258/// )
2259/// .build(
2260///     hyper_rustls::HttpsConnectorBuilder::new()
2261///         .with_native_roots()
2262///         .unwrap()
2263///         .https_or_http()
2264///         .enable_http2()
2265///         .build()
2266/// );
2267/// let mut hub = Vault::new(client, auth);
2268/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2269/// // like `cancel(...)`, `delete(...)`, `get(...)` and `list(...)`
2270/// // to build up your call.
2271/// let rb = hub.operations();
2272/// # }
2273/// ```
2274pub struct OperationMethods<'a, C>
2275where
2276    C: 'a,
2277{
2278    hub: &'a Vault<C>,
2279}
2280
2281impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
2282
2283impl<'a, C> OperationMethods<'a, C> {
2284    /// Create a builder to help you perform the following task:
2285    ///
2286    /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
2287    ///
2288    /// # Arguments
2289    ///
2290    /// * `request` - No description provided.
2291    /// * `name` - The name of the operation resource to be cancelled.
2292    pub fn cancel(
2293        &self,
2294        request: CancelOperationRequest,
2295        name: &str,
2296    ) -> OperationCancelCall<'a, C> {
2297        OperationCancelCall {
2298            hub: self.hub,
2299            _request: request,
2300            _name: name.to_string(),
2301            _delegate: Default::default(),
2302            _additional_params: Default::default(),
2303            _scopes: Default::default(),
2304        }
2305    }
2306
2307    /// Create a builder to help you perform the following task:
2308    ///
2309    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
2310    ///
2311    /// # Arguments
2312    ///
2313    /// * `name` - The name of the operation resource to be deleted.
2314    pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, C> {
2315        OperationDeleteCall {
2316            hub: self.hub,
2317            _name: name.to_string(),
2318            _delegate: Default::default(),
2319            _additional_params: Default::default(),
2320            _scopes: Default::default(),
2321        }
2322    }
2323
2324    /// Create a builder to help you perform the following task:
2325    ///
2326    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2327    ///
2328    /// # Arguments
2329    ///
2330    /// * `name` - The name of the operation resource.
2331    pub fn get(&self, name: &str) -> OperationGetCall<'a, C> {
2332        OperationGetCall {
2333            hub: self.hub,
2334            _name: name.to_string(),
2335            _delegate: Default::default(),
2336            _additional_params: Default::default(),
2337            _scopes: Default::default(),
2338        }
2339    }
2340
2341    /// Create a builder to help you perform the following task:
2342    ///
2343    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2344    ///
2345    /// # Arguments
2346    ///
2347    /// * `name` - The name of the operation's parent resource.
2348    pub fn list(&self, name: &str) -> OperationListCall<'a, C> {
2349        OperationListCall {
2350            hub: self.hub,
2351            _name: name.to_string(),
2352            _return_partial_success: Default::default(),
2353            _page_token: Default::default(),
2354            _page_size: Default::default(),
2355            _filter: Default::default(),
2356            _delegate: Default::default(),
2357            _additional_params: Default::default(),
2358            _scopes: Default::default(),
2359        }
2360    }
2361}
2362
2363// ###################
2364// CallBuilders   ###
2365// #################
2366
2367/// Creates an export.
2368///
2369/// A builder for the *exports.create* method supported by a *matter* resource.
2370/// It is not used directly, but through a [`MatterMethods`] instance.
2371///
2372/// # Example
2373///
2374/// Instantiate a resource method builder
2375///
2376/// ```test_harness,no_run
2377/// # extern crate hyper;
2378/// # extern crate hyper_rustls;
2379/// # extern crate google_vault1 as vault1;
2380/// use vault1::api::Export;
2381/// # async fn dox() {
2382/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2383///
2384/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2385/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2386/// #     .with_native_roots()
2387/// #     .unwrap()
2388/// #     .https_only()
2389/// #     .enable_http2()
2390/// #     .build();
2391///
2392/// # let executor = hyper_util::rt::TokioExecutor::new();
2393/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2394/// #     secret,
2395/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2396/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2397/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2398/// #     ),
2399/// # ).build().await.unwrap();
2400///
2401/// # let client = hyper_util::client::legacy::Client::builder(
2402/// #     hyper_util::rt::TokioExecutor::new()
2403/// # )
2404/// # .build(
2405/// #     hyper_rustls::HttpsConnectorBuilder::new()
2406/// #         .with_native_roots()
2407/// #         .unwrap()
2408/// #         .https_or_http()
2409/// #         .enable_http2()
2410/// #         .build()
2411/// # );
2412/// # let mut hub = Vault::new(client, auth);
2413/// // As the method needs a request, you would usually fill it with the desired information
2414/// // into the respective structure. Some of the parts shown here might not be applicable !
2415/// // Values shown here are possibly random and not representative !
2416/// let mut req = Export::default();
2417///
2418/// // You can configure optional parameters by calling the respective setters at will, and
2419/// // execute the final call using `doit()`.
2420/// // Values shown here are possibly random and not representative !
2421/// let result = hub.matters().exports_create(req, "matterId")
2422///              .doit().await;
2423/// # }
2424/// ```
2425pub struct MatterExportCreateCall<'a, C>
2426where
2427    C: 'a,
2428{
2429    hub: &'a Vault<C>,
2430    _request: Export,
2431    _matter_id: String,
2432    _delegate: Option<&'a mut dyn common::Delegate>,
2433    _additional_params: HashMap<String, String>,
2434    _scopes: BTreeSet<String>,
2435}
2436
2437impl<'a, C> common::CallBuilder for MatterExportCreateCall<'a, C> {}
2438
2439impl<'a, C> MatterExportCreateCall<'a, C>
2440where
2441    C: common::Connector,
2442{
2443    /// Perform the operation you have build so far.
2444    pub async fn doit(mut self) -> common::Result<(common::Response, Export)> {
2445        use std::borrow::Cow;
2446        use std::io::{Read, Seek};
2447
2448        use common::{url::Params, ToParts};
2449        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2450
2451        let mut dd = common::DefaultDelegate;
2452        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2453        dlg.begin(common::MethodInfo {
2454            id: "vault.matters.exports.create",
2455            http_method: hyper::Method::POST,
2456        });
2457
2458        for &field in ["alt", "matterId"].iter() {
2459            if self._additional_params.contains_key(field) {
2460                dlg.finished(false);
2461                return Err(common::Error::FieldClash(field));
2462            }
2463        }
2464
2465        let mut params = Params::with_capacity(4 + self._additional_params.len());
2466        params.push("matterId", self._matter_id);
2467
2468        params.extend(self._additional_params.iter());
2469
2470        params.push("alt", "json");
2471        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/exports";
2472        if self._scopes.is_empty() {
2473            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
2474        }
2475
2476        #[allow(clippy::single_element_loop)]
2477        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
2478            url = params.uri_replacement(url, param_name, find_this, false);
2479        }
2480        {
2481            let to_remove = ["matterId"];
2482            params.remove_params(&to_remove);
2483        }
2484
2485        let url = params.parse_with_url(&url);
2486
2487        let mut json_mime_type = mime::APPLICATION_JSON;
2488        let mut request_value_reader = {
2489            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2490            common::remove_json_null_values(&mut value);
2491            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2492            serde_json::to_writer(&mut dst, &value).unwrap();
2493            dst
2494        };
2495        let request_size = request_value_reader
2496            .seek(std::io::SeekFrom::End(0))
2497            .unwrap();
2498        request_value_reader
2499            .seek(std::io::SeekFrom::Start(0))
2500            .unwrap();
2501
2502        loop {
2503            let token = match self
2504                .hub
2505                .auth
2506                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2507                .await
2508            {
2509                Ok(token) => token,
2510                Err(e) => match dlg.token(e) {
2511                    Ok(token) => token,
2512                    Err(e) => {
2513                        dlg.finished(false);
2514                        return Err(common::Error::MissingToken(e));
2515                    }
2516                },
2517            };
2518            request_value_reader
2519                .seek(std::io::SeekFrom::Start(0))
2520                .unwrap();
2521            let mut req_result = {
2522                let client = &self.hub.client;
2523                dlg.pre_request();
2524                let mut req_builder = hyper::Request::builder()
2525                    .method(hyper::Method::POST)
2526                    .uri(url.as_str())
2527                    .header(USER_AGENT, self.hub._user_agent.clone());
2528
2529                if let Some(token) = token.as_ref() {
2530                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2531                }
2532
2533                let request = req_builder
2534                    .header(CONTENT_TYPE, json_mime_type.to_string())
2535                    .header(CONTENT_LENGTH, request_size as u64)
2536                    .body(common::to_body(
2537                        request_value_reader.get_ref().clone().into(),
2538                    ));
2539
2540                client.request(request.unwrap()).await
2541            };
2542
2543            match req_result {
2544                Err(err) => {
2545                    if let common::Retry::After(d) = dlg.http_error(&err) {
2546                        sleep(d).await;
2547                        continue;
2548                    }
2549                    dlg.finished(false);
2550                    return Err(common::Error::HttpError(err));
2551                }
2552                Ok(res) => {
2553                    let (mut parts, body) = res.into_parts();
2554                    let mut body = common::Body::new(body);
2555                    if !parts.status.is_success() {
2556                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2557                        let error = serde_json::from_str(&common::to_string(&bytes));
2558                        let response = common::to_response(parts, bytes.into());
2559
2560                        if let common::Retry::After(d) =
2561                            dlg.http_failure(&response, error.as_ref().ok())
2562                        {
2563                            sleep(d).await;
2564                            continue;
2565                        }
2566
2567                        dlg.finished(false);
2568
2569                        return Err(match error {
2570                            Ok(value) => common::Error::BadRequest(value),
2571                            _ => common::Error::Failure(response),
2572                        });
2573                    }
2574                    let response = {
2575                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2576                        let encoded = common::to_string(&bytes);
2577                        match serde_json::from_str(&encoded) {
2578                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2579                            Err(error) => {
2580                                dlg.response_json_decode_error(&encoded, &error);
2581                                return Err(common::Error::JsonDecodeError(
2582                                    encoded.to_string(),
2583                                    error,
2584                                ));
2585                            }
2586                        }
2587                    };
2588
2589                    dlg.finished(true);
2590                    return Ok(response);
2591                }
2592            }
2593        }
2594    }
2595
2596    ///
2597    /// Sets the *request* property to the given value.
2598    ///
2599    /// Even though the property as already been set when instantiating this call,
2600    /// we provide this method for API completeness.
2601    pub fn request(mut self, new_value: Export) -> MatterExportCreateCall<'a, C> {
2602        self._request = new_value;
2603        self
2604    }
2605    /// The matter ID.
2606    ///
2607    /// Sets the *matter id* path property to the given value.
2608    ///
2609    /// Even though the property as already been set when instantiating this call,
2610    /// we provide this method for API completeness.
2611    pub fn matter_id(mut self, new_value: &str) -> MatterExportCreateCall<'a, C> {
2612        self._matter_id = new_value.to_string();
2613        self
2614    }
2615    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2616    /// while executing the actual API request.
2617    ///
2618    /// ````text
2619    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2620    /// ````
2621    ///
2622    /// Sets the *delegate* property to the given value.
2623    pub fn delegate(
2624        mut self,
2625        new_value: &'a mut dyn common::Delegate,
2626    ) -> MatterExportCreateCall<'a, C> {
2627        self._delegate = Some(new_value);
2628        self
2629    }
2630
2631    /// Set any additional parameter of the query string used in the request.
2632    /// It should be used to set parameters which are not yet available through their own
2633    /// setters.
2634    ///
2635    /// Please note that this method must not be used to set any of the known parameters
2636    /// which have their own setter method. If done anyway, the request will fail.
2637    ///
2638    /// # Additional Parameters
2639    ///
2640    /// * *$.xgafv* (query-string) - V1 error format.
2641    /// * *access_token* (query-string) - OAuth access token.
2642    /// * *alt* (query-string) - Data format for response.
2643    /// * *callback* (query-string) - JSONP
2644    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2645    /// * *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.
2646    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2647    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2648    /// * *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.
2649    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2650    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2651    pub fn param<T>(mut self, name: T, value: T) -> MatterExportCreateCall<'a, C>
2652    where
2653        T: AsRef<str>,
2654    {
2655        self._additional_params
2656            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2657        self
2658    }
2659
2660    /// Identifies the authorization scope for the method you are building.
2661    ///
2662    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2663    /// [`Scope::Ediscovery`].
2664    ///
2665    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2666    /// tokens for more than one scope.
2667    ///
2668    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2669    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2670    /// sufficient, a read-write scope will do as well.
2671    pub fn add_scope<St>(mut self, scope: St) -> MatterExportCreateCall<'a, C>
2672    where
2673        St: AsRef<str>,
2674    {
2675        self._scopes.insert(String::from(scope.as_ref()));
2676        self
2677    }
2678    /// Identifies the authorization scope(s) for the method you are building.
2679    ///
2680    /// See [`Self::add_scope()`] for details.
2681    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterExportCreateCall<'a, C>
2682    where
2683        I: IntoIterator<Item = St>,
2684        St: AsRef<str>,
2685    {
2686        self._scopes
2687            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2688        self
2689    }
2690
2691    /// Removes all scopes, and no default scope will be used either.
2692    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2693    /// for details).
2694    pub fn clear_scopes(mut self) -> MatterExportCreateCall<'a, C> {
2695        self._scopes.clear();
2696        self
2697    }
2698}
2699
2700/// Deletes an export.
2701///
2702/// A builder for the *exports.delete* method supported by a *matter* resource.
2703/// It is not used directly, but through a [`MatterMethods`] instance.
2704///
2705/// # Example
2706///
2707/// Instantiate a resource method builder
2708///
2709/// ```test_harness,no_run
2710/// # extern crate hyper;
2711/// # extern crate hyper_rustls;
2712/// # extern crate google_vault1 as vault1;
2713/// # async fn dox() {
2714/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2715///
2716/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2717/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2718/// #     .with_native_roots()
2719/// #     .unwrap()
2720/// #     .https_only()
2721/// #     .enable_http2()
2722/// #     .build();
2723///
2724/// # let executor = hyper_util::rt::TokioExecutor::new();
2725/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2726/// #     secret,
2727/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2728/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2729/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2730/// #     ),
2731/// # ).build().await.unwrap();
2732///
2733/// # let client = hyper_util::client::legacy::Client::builder(
2734/// #     hyper_util::rt::TokioExecutor::new()
2735/// # )
2736/// # .build(
2737/// #     hyper_rustls::HttpsConnectorBuilder::new()
2738/// #         .with_native_roots()
2739/// #         .unwrap()
2740/// #         .https_or_http()
2741/// #         .enable_http2()
2742/// #         .build()
2743/// # );
2744/// # let mut hub = Vault::new(client, auth);
2745/// // You can configure optional parameters by calling the respective setters at will, and
2746/// // execute the final call using `doit()`.
2747/// // Values shown here are possibly random and not representative !
2748/// let result = hub.matters().exports_delete("matterId", "exportId")
2749///              .doit().await;
2750/// # }
2751/// ```
2752pub struct MatterExportDeleteCall<'a, C>
2753where
2754    C: 'a,
2755{
2756    hub: &'a Vault<C>,
2757    _matter_id: String,
2758    _export_id: String,
2759    _delegate: Option<&'a mut dyn common::Delegate>,
2760    _additional_params: HashMap<String, String>,
2761    _scopes: BTreeSet<String>,
2762}
2763
2764impl<'a, C> common::CallBuilder for MatterExportDeleteCall<'a, C> {}
2765
2766impl<'a, C> MatterExportDeleteCall<'a, C>
2767where
2768    C: common::Connector,
2769{
2770    /// Perform the operation you have build so far.
2771    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2772        use std::borrow::Cow;
2773        use std::io::{Read, Seek};
2774
2775        use common::{url::Params, ToParts};
2776        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2777
2778        let mut dd = common::DefaultDelegate;
2779        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2780        dlg.begin(common::MethodInfo {
2781            id: "vault.matters.exports.delete",
2782            http_method: hyper::Method::DELETE,
2783        });
2784
2785        for &field in ["alt", "matterId", "exportId"].iter() {
2786            if self._additional_params.contains_key(field) {
2787                dlg.finished(false);
2788                return Err(common::Error::FieldClash(field));
2789            }
2790        }
2791
2792        let mut params = Params::with_capacity(4 + self._additional_params.len());
2793        params.push("matterId", self._matter_id);
2794        params.push("exportId", self._export_id);
2795
2796        params.extend(self._additional_params.iter());
2797
2798        params.push("alt", "json");
2799        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/exports/{exportId}";
2800        if self._scopes.is_empty() {
2801            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
2802        }
2803
2804        #[allow(clippy::single_element_loop)]
2805        for &(find_this, param_name) in
2806            [("{matterId}", "matterId"), ("{exportId}", "exportId")].iter()
2807        {
2808            url = params.uri_replacement(url, param_name, find_this, false);
2809        }
2810        {
2811            let to_remove = ["exportId", "matterId"];
2812            params.remove_params(&to_remove);
2813        }
2814
2815        let url = params.parse_with_url(&url);
2816
2817        loop {
2818            let token = match self
2819                .hub
2820                .auth
2821                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2822                .await
2823            {
2824                Ok(token) => token,
2825                Err(e) => match dlg.token(e) {
2826                    Ok(token) => token,
2827                    Err(e) => {
2828                        dlg.finished(false);
2829                        return Err(common::Error::MissingToken(e));
2830                    }
2831                },
2832            };
2833            let mut req_result = {
2834                let client = &self.hub.client;
2835                dlg.pre_request();
2836                let mut req_builder = hyper::Request::builder()
2837                    .method(hyper::Method::DELETE)
2838                    .uri(url.as_str())
2839                    .header(USER_AGENT, self.hub._user_agent.clone());
2840
2841                if let Some(token) = token.as_ref() {
2842                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2843                }
2844
2845                let request = req_builder
2846                    .header(CONTENT_LENGTH, 0_u64)
2847                    .body(common::to_body::<String>(None));
2848
2849                client.request(request.unwrap()).await
2850            };
2851
2852            match req_result {
2853                Err(err) => {
2854                    if let common::Retry::After(d) = dlg.http_error(&err) {
2855                        sleep(d).await;
2856                        continue;
2857                    }
2858                    dlg.finished(false);
2859                    return Err(common::Error::HttpError(err));
2860                }
2861                Ok(res) => {
2862                    let (mut parts, body) = res.into_parts();
2863                    let mut body = common::Body::new(body);
2864                    if !parts.status.is_success() {
2865                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2866                        let error = serde_json::from_str(&common::to_string(&bytes));
2867                        let response = common::to_response(parts, bytes.into());
2868
2869                        if let common::Retry::After(d) =
2870                            dlg.http_failure(&response, error.as_ref().ok())
2871                        {
2872                            sleep(d).await;
2873                            continue;
2874                        }
2875
2876                        dlg.finished(false);
2877
2878                        return Err(match error {
2879                            Ok(value) => common::Error::BadRequest(value),
2880                            _ => common::Error::Failure(response),
2881                        });
2882                    }
2883                    let response = {
2884                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2885                        let encoded = common::to_string(&bytes);
2886                        match serde_json::from_str(&encoded) {
2887                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2888                            Err(error) => {
2889                                dlg.response_json_decode_error(&encoded, &error);
2890                                return Err(common::Error::JsonDecodeError(
2891                                    encoded.to_string(),
2892                                    error,
2893                                ));
2894                            }
2895                        }
2896                    };
2897
2898                    dlg.finished(true);
2899                    return Ok(response);
2900                }
2901            }
2902        }
2903    }
2904
2905    /// The matter ID.
2906    ///
2907    /// Sets the *matter id* path property to the given value.
2908    ///
2909    /// Even though the property as already been set when instantiating this call,
2910    /// we provide this method for API completeness.
2911    pub fn matter_id(mut self, new_value: &str) -> MatterExportDeleteCall<'a, C> {
2912        self._matter_id = new_value.to_string();
2913        self
2914    }
2915    /// The export ID.
2916    ///
2917    /// Sets the *export id* path property to the given value.
2918    ///
2919    /// Even though the property as already been set when instantiating this call,
2920    /// we provide this method for API completeness.
2921    pub fn export_id(mut self, new_value: &str) -> MatterExportDeleteCall<'a, C> {
2922        self._export_id = new_value.to_string();
2923        self
2924    }
2925    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2926    /// while executing the actual API request.
2927    ///
2928    /// ````text
2929    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2930    /// ````
2931    ///
2932    /// Sets the *delegate* property to the given value.
2933    pub fn delegate(
2934        mut self,
2935        new_value: &'a mut dyn common::Delegate,
2936    ) -> MatterExportDeleteCall<'a, C> {
2937        self._delegate = Some(new_value);
2938        self
2939    }
2940
2941    /// Set any additional parameter of the query string used in the request.
2942    /// It should be used to set parameters which are not yet available through their own
2943    /// setters.
2944    ///
2945    /// Please note that this method must not be used to set any of the known parameters
2946    /// which have their own setter method. If done anyway, the request will fail.
2947    ///
2948    /// # Additional Parameters
2949    ///
2950    /// * *$.xgafv* (query-string) - V1 error format.
2951    /// * *access_token* (query-string) - OAuth access token.
2952    /// * *alt* (query-string) - Data format for response.
2953    /// * *callback* (query-string) - JSONP
2954    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2955    /// * *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.
2956    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2957    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2958    /// * *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.
2959    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2960    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2961    pub fn param<T>(mut self, name: T, value: T) -> MatterExportDeleteCall<'a, C>
2962    where
2963        T: AsRef<str>,
2964    {
2965        self._additional_params
2966            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2967        self
2968    }
2969
2970    /// Identifies the authorization scope for the method you are building.
2971    ///
2972    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2973    /// [`Scope::Ediscovery`].
2974    ///
2975    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2976    /// tokens for more than one scope.
2977    ///
2978    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2979    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2980    /// sufficient, a read-write scope will do as well.
2981    pub fn add_scope<St>(mut self, scope: St) -> MatterExportDeleteCall<'a, C>
2982    where
2983        St: AsRef<str>,
2984    {
2985        self._scopes.insert(String::from(scope.as_ref()));
2986        self
2987    }
2988    /// Identifies the authorization scope(s) for the method you are building.
2989    ///
2990    /// See [`Self::add_scope()`] for details.
2991    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterExportDeleteCall<'a, C>
2992    where
2993        I: IntoIterator<Item = St>,
2994        St: AsRef<str>,
2995    {
2996        self._scopes
2997            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2998        self
2999    }
3000
3001    /// Removes all scopes, and no default scope will be used either.
3002    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3003    /// for details).
3004    pub fn clear_scopes(mut self) -> MatterExportDeleteCall<'a, C> {
3005        self._scopes.clear();
3006        self
3007    }
3008}
3009
3010/// Gets an export.
3011///
3012/// A builder for the *exports.get* method supported by a *matter* resource.
3013/// It is not used directly, but through a [`MatterMethods`] instance.
3014///
3015/// # Example
3016///
3017/// Instantiate a resource method builder
3018///
3019/// ```test_harness,no_run
3020/// # extern crate hyper;
3021/// # extern crate hyper_rustls;
3022/// # extern crate google_vault1 as vault1;
3023/// # async fn dox() {
3024/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3025///
3026/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3027/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3028/// #     .with_native_roots()
3029/// #     .unwrap()
3030/// #     .https_only()
3031/// #     .enable_http2()
3032/// #     .build();
3033///
3034/// # let executor = hyper_util::rt::TokioExecutor::new();
3035/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3036/// #     secret,
3037/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3038/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3039/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3040/// #     ),
3041/// # ).build().await.unwrap();
3042///
3043/// # let client = hyper_util::client::legacy::Client::builder(
3044/// #     hyper_util::rt::TokioExecutor::new()
3045/// # )
3046/// # .build(
3047/// #     hyper_rustls::HttpsConnectorBuilder::new()
3048/// #         .with_native_roots()
3049/// #         .unwrap()
3050/// #         .https_or_http()
3051/// #         .enable_http2()
3052/// #         .build()
3053/// # );
3054/// # let mut hub = Vault::new(client, auth);
3055/// // You can configure optional parameters by calling the respective setters at will, and
3056/// // execute the final call using `doit()`.
3057/// // Values shown here are possibly random and not representative !
3058/// let result = hub.matters().exports_get("matterId", "exportId")
3059///              .doit().await;
3060/// # }
3061/// ```
3062pub struct MatterExportGetCall<'a, C>
3063where
3064    C: 'a,
3065{
3066    hub: &'a Vault<C>,
3067    _matter_id: String,
3068    _export_id: String,
3069    _delegate: Option<&'a mut dyn common::Delegate>,
3070    _additional_params: HashMap<String, String>,
3071    _scopes: BTreeSet<String>,
3072}
3073
3074impl<'a, C> common::CallBuilder for MatterExportGetCall<'a, C> {}
3075
3076impl<'a, C> MatterExportGetCall<'a, C>
3077where
3078    C: common::Connector,
3079{
3080    /// Perform the operation you have build so far.
3081    pub async fn doit(mut self) -> common::Result<(common::Response, Export)> {
3082        use std::borrow::Cow;
3083        use std::io::{Read, Seek};
3084
3085        use common::{url::Params, ToParts};
3086        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3087
3088        let mut dd = common::DefaultDelegate;
3089        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3090        dlg.begin(common::MethodInfo {
3091            id: "vault.matters.exports.get",
3092            http_method: hyper::Method::GET,
3093        });
3094
3095        for &field in ["alt", "matterId", "exportId"].iter() {
3096            if self._additional_params.contains_key(field) {
3097                dlg.finished(false);
3098                return Err(common::Error::FieldClash(field));
3099            }
3100        }
3101
3102        let mut params = Params::with_capacity(4 + self._additional_params.len());
3103        params.push("matterId", self._matter_id);
3104        params.push("exportId", self._export_id);
3105
3106        params.extend(self._additional_params.iter());
3107
3108        params.push("alt", "json");
3109        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/exports/{exportId}";
3110        if self._scopes.is_empty() {
3111            self._scopes
3112                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
3113        }
3114
3115        #[allow(clippy::single_element_loop)]
3116        for &(find_this, param_name) in
3117            [("{matterId}", "matterId"), ("{exportId}", "exportId")].iter()
3118        {
3119            url = params.uri_replacement(url, param_name, find_this, false);
3120        }
3121        {
3122            let to_remove = ["exportId", "matterId"];
3123            params.remove_params(&to_remove);
3124        }
3125
3126        let url = params.parse_with_url(&url);
3127
3128        loop {
3129            let token = match self
3130                .hub
3131                .auth
3132                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3133                .await
3134            {
3135                Ok(token) => token,
3136                Err(e) => match dlg.token(e) {
3137                    Ok(token) => token,
3138                    Err(e) => {
3139                        dlg.finished(false);
3140                        return Err(common::Error::MissingToken(e));
3141                    }
3142                },
3143            };
3144            let mut req_result = {
3145                let client = &self.hub.client;
3146                dlg.pre_request();
3147                let mut req_builder = hyper::Request::builder()
3148                    .method(hyper::Method::GET)
3149                    .uri(url.as_str())
3150                    .header(USER_AGENT, self.hub._user_agent.clone());
3151
3152                if let Some(token) = token.as_ref() {
3153                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3154                }
3155
3156                let request = req_builder
3157                    .header(CONTENT_LENGTH, 0_u64)
3158                    .body(common::to_body::<String>(None));
3159
3160                client.request(request.unwrap()).await
3161            };
3162
3163            match req_result {
3164                Err(err) => {
3165                    if let common::Retry::After(d) = dlg.http_error(&err) {
3166                        sleep(d).await;
3167                        continue;
3168                    }
3169                    dlg.finished(false);
3170                    return Err(common::Error::HttpError(err));
3171                }
3172                Ok(res) => {
3173                    let (mut parts, body) = res.into_parts();
3174                    let mut body = common::Body::new(body);
3175                    if !parts.status.is_success() {
3176                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3177                        let error = serde_json::from_str(&common::to_string(&bytes));
3178                        let response = common::to_response(parts, bytes.into());
3179
3180                        if let common::Retry::After(d) =
3181                            dlg.http_failure(&response, error.as_ref().ok())
3182                        {
3183                            sleep(d).await;
3184                            continue;
3185                        }
3186
3187                        dlg.finished(false);
3188
3189                        return Err(match error {
3190                            Ok(value) => common::Error::BadRequest(value),
3191                            _ => common::Error::Failure(response),
3192                        });
3193                    }
3194                    let response = {
3195                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3196                        let encoded = common::to_string(&bytes);
3197                        match serde_json::from_str(&encoded) {
3198                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3199                            Err(error) => {
3200                                dlg.response_json_decode_error(&encoded, &error);
3201                                return Err(common::Error::JsonDecodeError(
3202                                    encoded.to_string(),
3203                                    error,
3204                                ));
3205                            }
3206                        }
3207                    };
3208
3209                    dlg.finished(true);
3210                    return Ok(response);
3211                }
3212            }
3213        }
3214    }
3215
3216    /// The matter ID.
3217    ///
3218    /// Sets the *matter id* path property to the given value.
3219    ///
3220    /// Even though the property as already been set when instantiating this call,
3221    /// we provide this method for API completeness.
3222    pub fn matter_id(mut self, new_value: &str) -> MatterExportGetCall<'a, C> {
3223        self._matter_id = new_value.to_string();
3224        self
3225    }
3226    /// The export ID.
3227    ///
3228    /// Sets the *export id* path property to the given value.
3229    ///
3230    /// Even though the property as already been set when instantiating this call,
3231    /// we provide this method for API completeness.
3232    pub fn export_id(mut self, new_value: &str) -> MatterExportGetCall<'a, C> {
3233        self._export_id = new_value.to_string();
3234        self
3235    }
3236    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3237    /// while executing the actual API request.
3238    ///
3239    /// ````text
3240    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3241    /// ````
3242    ///
3243    /// Sets the *delegate* property to the given value.
3244    pub fn delegate(
3245        mut self,
3246        new_value: &'a mut dyn common::Delegate,
3247    ) -> MatterExportGetCall<'a, C> {
3248        self._delegate = Some(new_value);
3249        self
3250    }
3251
3252    /// Set any additional parameter of the query string used in the request.
3253    /// It should be used to set parameters which are not yet available through their own
3254    /// setters.
3255    ///
3256    /// Please note that this method must not be used to set any of the known parameters
3257    /// which have their own setter method. If done anyway, the request will fail.
3258    ///
3259    /// # Additional Parameters
3260    ///
3261    /// * *$.xgafv* (query-string) - V1 error format.
3262    /// * *access_token* (query-string) - OAuth access token.
3263    /// * *alt* (query-string) - Data format for response.
3264    /// * *callback* (query-string) - JSONP
3265    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3266    /// * *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.
3267    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3268    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3269    /// * *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.
3270    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3271    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3272    pub fn param<T>(mut self, name: T, value: T) -> MatterExportGetCall<'a, C>
3273    where
3274        T: AsRef<str>,
3275    {
3276        self._additional_params
3277            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3278        self
3279    }
3280
3281    /// Identifies the authorization scope for the method you are building.
3282    ///
3283    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3284    /// [`Scope::EdiscoveryReadonly`].
3285    ///
3286    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3287    /// tokens for more than one scope.
3288    ///
3289    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3290    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3291    /// sufficient, a read-write scope will do as well.
3292    pub fn add_scope<St>(mut self, scope: St) -> MatterExportGetCall<'a, C>
3293    where
3294        St: AsRef<str>,
3295    {
3296        self._scopes.insert(String::from(scope.as_ref()));
3297        self
3298    }
3299    /// Identifies the authorization scope(s) for the method you are building.
3300    ///
3301    /// See [`Self::add_scope()`] for details.
3302    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterExportGetCall<'a, C>
3303    where
3304        I: IntoIterator<Item = St>,
3305        St: AsRef<str>,
3306    {
3307        self._scopes
3308            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3309        self
3310    }
3311
3312    /// Removes all scopes, and no default scope will be used either.
3313    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3314    /// for details).
3315    pub fn clear_scopes(mut self) -> MatterExportGetCall<'a, C> {
3316        self._scopes.clear();
3317        self
3318    }
3319}
3320
3321/// Lists details about the exports in the specified matter.
3322///
3323/// A builder for the *exports.list* method supported by a *matter* resource.
3324/// It is not used directly, but through a [`MatterMethods`] instance.
3325///
3326/// # Example
3327///
3328/// Instantiate a resource method builder
3329///
3330/// ```test_harness,no_run
3331/// # extern crate hyper;
3332/// # extern crate hyper_rustls;
3333/// # extern crate google_vault1 as vault1;
3334/// # async fn dox() {
3335/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3336///
3337/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3338/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3339/// #     .with_native_roots()
3340/// #     .unwrap()
3341/// #     .https_only()
3342/// #     .enable_http2()
3343/// #     .build();
3344///
3345/// # let executor = hyper_util::rt::TokioExecutor::new();
3346/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3347/// #     secret,
3348/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3349/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3350/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3351/// #     ),
3352/// # ).build().await.unwrap();
3353///
3354/// # let client = hyper_util::client::legacy::Client::builder(
3355/// #     hyper_util::rt::TokioExecutor::new()
3356/// # )
3357/// # .build(
3358/// #     hyper_rustls::HttpsConnectorBuilder::new()
3359/// #         .with_native_roots()
3360/// #         .unwrap()
3361/// #         .https_or_http()
3362/// #         .enable_http2()
3363/// #         .build()
3364/// # );
3365/// # let mut hub = Vault::new(client, auth);
3366/// // You can configure optional parameters by calling the respective setters at will, and
3367/// // execute the final call using `doit()`.
3368/// // Values shown here are possibly random and not representative !
3369/// let result = hub.matters().exports_list("matterId")
3370///              .page_token("ea")
3371///              .page_size(-55)
3372///              .doit().await;
3373/// # }
3374/// ```
3375pub struct MatterExportListCall<'a, C>
3376where
3377    C: 'a,
3378{
3379    hub: &'a Vault<C>,
3380    _matter_id: String,
3381    _page_token: Option<String>,
3382    _page_size: Option<i32>,
3383    _delegate: Option<&'a mut dyn common::Delegate>,
3384    _additional_params: HashMap<String, String>,
3385    _scopes: BTreeSet<String>,
3386}
3387
3388impl<'a, C> common::CallBuilder for MatterExportListCall<'a, C> {}
3389
3390impl<'a, C> MatterExportListCall<'a, C>
3391where
3392    C: common::Connector,
3393{
3394    /// Perform the operation you have build so far.
3395    pub async fn doit(mut self) -> common::Result<(common::Response, ListExportsResponse)> {
3396        use std::borrow::Cow;
3397        use std::io::{Read, Seek};
3398
3399        use common::{url::Params, ToParts};
3400        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3401
3402        let mut dd = common::DefaultDelegate;
3403        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3404        dlg.begin(common::MethodInfo {
3405            id: "vault.matters.exports.list",
3406            http_method: hyper::Method::GET,
3407        });
3408
3409        for &field in ["alt", "matterId", "pageToken", "pageSize"].iter() {
3410            if self._additional_params.contains_key(field) {
3411                dlg.finished(false);
3412                return Err(common::Error::FieldClash(field));
3413            }
3414        }
3415
3416        let mut params = Params::with_capacity(5 + self._additional_params.len());
3417        params.push("matterId", self._matter_id);
3418        if let Some(value) = self._page_token.as_ref() {
3419            params.push("pageToken", value);
3420        }
3421        if let Some(value) = self._page_size.as_ref() {
3422            params.push("pageSize", value.to_string());
3423        }
3424
3425        params.extend(self._additional_params.iter());
3426
3427        params.push("alt", "json");
3428        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/exports";
3429        if self._scopes.is_empty() {
3430            self._scopes
3431                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
3432        }
3433
3434        #[allow(clippy::single_element_loop)]
3435        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
3436            url = params.uri_replacement(url, param_name, find_this, false);
3437        }
3438        {
3439            let to_remove = ["matterId"];
3440            params.remove_params(&to_remove);
3441        }
3442
3443        let url = params.parse_with_url(&url);
3444
3445        loop {
3446            let token = match self
3447                .hub
3448                .auth
3449                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3450                .await
3451            {
3452                Ok(token) => token,
3453                Err(e) => match dlg.token(e) {
3454                    Ok(token) => token,
3455                    Err(e) => {
3456                        dlg.finished(false);
3457                        return Err(common::Error::MissingToken(e));
3458                    }
3459                },
3460            };
3461            let mut req_result = {
3462                let client = &self.hub.client;
3463                dlg.pre_request();
3464                let mut req_builder = hyper::Request::builder()
3465                    .method(hyper::Method::GET)
3466                    .uri(url.as_str())
3467                    .header(USER_AGENT, self.hub._user_agent.clone());
3468
3469                if let Some(token) = token.as_ref() {
3470                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3471                }
3472
3473                let request = req_builder
3474                    .header(CONTENT_LENGTH, 0_u64)
3475                    .body(common::to_body::<String>(None));
3476
3477                client.request(request.unwrap()).await
3478            };
3479
3480            match req_result {
3481                Err(err) => {
3482                    if let common::Retry::After(d) = dlg.http_error(&err) {
3483                        sleep(d).await;
3484                        continue;
3485                    }
3486                    dlg.finished(false);
3487                    return Err(common::Error::HttpError(err));
3488                }
3489                Ok(res) => {
3490                    let (mut parts, body) = res.into_parts();
3491                    let mut body = common::Body::new(body);
3492                    if !parts.status.is_success() {
3493                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3494                        let error = serde_json::from_str(&common::to_string(&bytes));
3495                        let response = common::to_response(parts, bytes.into());
3496
3497                        if let common::Retry::After(d) =
3498                            dlg.http_failure(&response, error.as_ref().ok())
3499                        {
3500                            sleep(d).await;
3501                            continue;
3502                        }
3503
3504                        dlg.finished(false);
3505
3506                        return Err(match error {
3507                            Ok(value) => common::Error::BadRequest(value),
3508                            _ => common::Error::Failure(response),
3509                        });
3510                    }
3511                    let response = {
3512                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3513                        let encoded = common::to_string(&bytes);
3514                        match serde_json::from_str(&encoded) {
3515                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3516                            Err(error) => {
3517                                dlg.response_json_decode_error(&encoded, &error);
3518                                return Err(common::Error::JsonDecodeError(
3519                                    encoded.to_string(),
3520                                    error,
3521                                ));
3522                            }
3523                        }
3524                    };
3525
3526                    dlg.finished(true);
3527                    return Ok(response);
3528                }
3529            }
3530        }
3531    }
3532
3533    /// The matter ID.
3534    ///
3535    /// Sets the *matter id* path property to the given value.
3536    ///
3537    /// Even though the property as already been set when instantiating this call,
3538    /// we provide this method for API completeness.
3539    pub fn matter_id(mut self, new_value: &str) -> MatterExportListCall<'a, C> {
3540        self._matter_id = new_value.to_string();
3541        self
3542    }
3543    /// The pagination token as returned in the response.
3544    ///
3545    /// Sets the *page token* query property to the given value.
3546    pub fn page_token(mut self, new_value: &str) -> MatterExportListCall<'a, C> {
3547        self._page_token = Some(new_value.to_string());
3548        self
3549    }
3550    /// The number of exports to return in the response.
3551    ///
3552    /// Sets the *page size* query property to the given value.
3553    pub fn page_size(mut self, new_value: i32) -> MatterExportListCall<'a, C> {
3554        self._page_size = Some(new_value);
3555        self
3556    }
3557    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3558    /// while executing the actual API request.
3559    ///
3560    /// ````text
3561    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3562    /// ````
3563    ///
3564    /// Sets the *delegate* property to the given value.
3565    pub fn delegate(
3566        mut self,
3567        new_value: &'a mut dyn common::Delegate,
3568    ) -> MatterExportListCall<'a, C> {
3569        self._delegate = Some(new_value);
3570        self
3571    }
3572
3573    /// Set any additional parameter of the query string used in the request.
3574    /// It should be used to set parameters which are not yet available through their own
3575    /// setters.
3576    ///
3577    /// Please note that this method must not be used to set any of the known parameters
3578    /// which have their own setter method. If done anyway, the request will fail.
3579    ///
3580    /// # Additional Parameters
3581    ///
3582    /// * *$.xgafv* (query-string) - V1 error format.
3583    /// * *access_token* (query-string) - OAuth access token.
3584    /// * *alt* (query-string) - Data format for response.
3585    /// * *callback* (query-string) - JSONP
3586    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3587    /// * *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.
3588    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3589    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3590    /// * *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.
3591    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3592    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3593    pub fn param<T>(mut self, name: T, value: T) -> MatterExportListCall<'a, C>
3594    where
3595        T: AsRef<str>,
3596    {
3597        self._additional_params
3598            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3599        self
3600    }
3601
3602    /// Identifies the authorization scope for the method you are building.
3603    ///
3604    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3605    /// [`Scope::EdiscoveryReadonly`].
3606    ///
3607    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3608    /// tokens for more than one scope.
3609    ///
3610    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3611    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3612    /// sufficient, a read-write scope will do as well.
3613    pub fn add_scope<St>(mut self, scope: St) -> MatterExportListCall<'a, C>
3614    where
3615        St: AsRef<str>,
3616    {
3617        self._scopes.insert(String::from(scope.as_ref()));
3618        self
3619    }
3620    /// Identifies the authorization scope(s) for the method you are building.
3621    ///
3622    /// See [`Self::add_scope()`] for details.
3623    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterExportListCall<'a, C>
3624    where
3625        I: IntoIterator<Item = St>,
3626        St: AsRef<str>,
3627    {
3628        self._scopes
3629            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3630        self
3631    }
3632
3633    /// Removes all scopes, and no default scope will be used either.
3634    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3635    /// for details).
3636    pub fn clear_scopes(mut self) -> MatterExportListCall<'a, C> {
3637        self._scopes.clear();
3638        self
3639    }
3640}
3641
3642/// Adds an account to a hold. Accounts can be added only to a hold that does not have an organizational unit set. If you try to add an account to an organizational unit-based hold, an error is returned.
3643///
3644/// A builder for the *holds.accounts.create* method supported by a *matter* resource.
3645/// It is not used directly, but through a [`MatterMethods`] instance.
3646///
3647/// # Example
3648///
3649/// Instantiate a resource method builder
3650///
3651/// ```test_harness,no_run
3652/// # extern crate hyper;
3653/// # extern crate hyper_rustls;
3654/// # extern crate google_vault1 as vault1;
3655/// use vault1::api::HeldAccount;
3656/// # async fn dox() {
3657/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3658///
3659/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3660/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3661/// #     .with_native_roots()
3662/// #     .unwrap()
3663/// #     .https_only()
3664/// #     .enable_http2()
3665/// #     .build();
3666///
3667/// # let executor = hyper_util::rt::TokioExecutor::new();
3668/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3669/// #     secret,
3670/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3671/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3672/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3673/// #     ),
3674/// # ).build().await.unwrap();
3675///
3676/// # let client = hyper_util::client::legacy::Client::builder(
3677/// #     hyper_util::rt::TokioExecutor::new()
3678/// # )
3679/// # .build(
3680/// #     hyper_rustls::HttpsConnectorBuilder::new()
3681/// #         .with_native_roots()
3682/// #         .unwrap()
3683/// #         .https_or_http()
3684/// #         .enable_http2()
3685/// #         .build()
3686/// # );
3687/// # let mut hub = Vault::new(client, auth);
3688/// // As the method needs a request, you would usually fill it with the desired information
3689/// // into the respective structure. Some of the parts shown here might not be applicable !
3690/// // Values shown here are possibly random and not representative !
3691/// let mut req = HeldAccount::default();
3692///
3693/// // You can configure optional parameters by calling the respective setters at will, and
3694/// // execute the final call using `doit()`.
3695/// // Values shown here are possibly random and not representative !
3696/// let result = hub.matters().holds_accounts_create(req, "matterId", "holdId")
3697///              .doit().await;
3698/// # }
3699/// ```
3700pub struct MatterHoldAccountCreateCall<'a, C>
3701where
3702    C: 'a,
3703{
3704    hub: &'a Vault<C>,
3705    _request: HeldAccount,
3706    _matter_id: String,
3707    _hold_id: String,
3708    _delegate: Option<&'a mut dyn common::Delegate>,
3709    _additional_params: HashMap<String, String>,
3710    _scopes: BTreeSet<String>,
3711}
3712
3713impl<'a, C> common::CallBuilder for MatterHoldAccountCreateCall<'a, C> {}
3714
3715impl<'a, C> MatterHoldAccountCreateCall<'a, C>
3716where
3717    C: common::Connector,
3718{
3719    /// Perform the operation you have build so far.
3720    pub async fn doit(mut self) -> common::Result<(common::Response, HeldAccount)> {
3721        use std::borrow::Cow;
3722        use std::io::{Read, Seek};
3723
3724        use common::{url::Params, ToParts};
3725        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3726
3727        let mut dd = common::DefaultDelegate;
3728        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3729        dlg.begin(common::MethodInfo {
3730            id: "vault.matters.holds.accounts.create",
3731            http_method: hyper::Method::POST,
3732        });
3733
3734        for &field in ["alt", "matterId", "holdId"].iter() {
3735            if self._additional_params.contains_key(field) {
3736                dlg.finished(false);
3737                return Err(common::Error::FieldClash(field));
3738            }
3739        }
3740
3741        let mut params = Params::with_capacity(5 + self._additional_params.len());
3742        params.push("matterId", self._matter_id);
3743        params.push("holdId", self._hold_id);
3744
3745        params.extend(self._additional_params.iter());
3746
3747        params.push("alt", "json");
3748        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/holds/{holdId}/accounts";
3749        if self._scopes.is_empty() {
3750            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
3751        }
3752
3753        #[allow(clippy::single_element_loop)]
3754        for &(find_this, param_name) in [("{matterId}", "matterId"), ("{holdId}", "holdId")].iter()
3755        {
3756            url = params.uri_replacement(url, param_name, find_this, false);
3757        }
3758        {
3759            let to_remove = ["holdId", "matterId"];
3760            params.remove_params(&to_remove);
3761        }
3762
3763        let url = params.parse_with_url(&url);
3764
3765        let mut json_mime_type = mime::APPLICATION_JSON;
3766        let mut request_value_reader = {
3767            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3768            common::remove_json_null_values(&mut value);
3769            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3770            serde_json::to_writer(&mut dst, &value).unwrap();
3771            dst
3772        };
3773        let request_size = request_value_reader
3774            .seek(std::io::SeekFrom::End(0))
3775            .unwrap();
3776        request_value_reader
3777            .seek(std::io::SeekFrom::Start(0))
3778            .unwrap();
3779
3780        loop {
3781            let token = match self
3782                .hub
3783                .auth
3784                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3785                .await
3786            {
3787                Ok(token) => token,
3788                Err(e) => match dlg.token(e) {
3789                    Ok(token) => token,
3790                    Err(e) => {
3791                        dlg.finished(false);
3792                        return Err(common::Error::MissingToken(e));
3793                    }
3794                },
3795            };
3796            request_value_reader
3797                .seek(std::io::SeekFrom::Start(0))
3798                .unwrap();
3799            let mut req_result = {
3800                let client = &self.hub.client;
3801                dlg.pre_request();
3802                let mut req_builder = hyper::Request::builder()
3803                    .method(hyper::Method::POST)
3804                    .uri(url.as_str())
3805                    .header(USER_AGENT, self.hub._user_agent.clone());
3806
3807                if let Some(token) = token.as_ref() {
3808                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3809                }
3810
3811                let request = req_builder
3812                    .header(CONTENT_TYPE, json_mime_type.to_string())
3813                    .header(CONTENT_LENGTH, request_size as u64)
3814                    .body(common::to_body(
3815                        request_value_reader.get_ref().clone().into(),
3816                    ));
3817
3818                client.request(request.unwrap()).await
3819            };
3820
3821            match req_result {
3822                Err(err) => {
3823                    if let common::Retry::After(d) = dlg.http_error(&err) {
3824                        sleep(d).await;
3825                        continue;
3826                    }
3827                    dlg.finished(false);
3828                    return Err(common::Error::HttpError(err));
3829                }
3830                Ok(res) => {
3831                    let (mut parts, body) = res.into_parts();
3832                    let mut body = common::Body::new(body);
3833                    if !parts.status.is_success() {
3834                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3835                        let error = serde_json::from_str(&common::to_string(&bytes));
3836                        let response = common::to_response(parts, bytes.into());
3837
3838                        if let common::Retry::After(d) =
3839                            dlg.http_failure(&response, error.as_ref().ok())
3840                        {
3841                            sleep(d).await;
3842                            continue;
3843                        }
3844
3845                        dlg.finished(false);
3846
3847                        return Err(match error {
3848                            Ok(value) => common::Error::BadRequest(value),
3849                            _ => common::Error::Failure(response),
3850                        });
3851                    }
3852                    let response = {
3853                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3854                        let encoded = common::to_string(&bytes);
3855                        match serde_json::from_str(&encoded) {
3856                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3857                            Err(error) => {
3858                                dlg.response_json_decode_error(&encoded, &error);
3859                                return Err(common::Error::JsonDecodeError(
3860                                    encoded.to_string(),
3861                                    error,
3862                                ));
3863                            }
3864                        }
3865                    };
3866
3867                    dlg.finished(true);
3868                    return Ok(response);
3869                }
3870            }
3871        }
3872    }
3873
3874    ///
3875    /// Sets the *request* property to the given value.
3876    ///
3877    /// Even though the property as already been set when instantiating this call,
3878    /// we provide this method for API completeness.
3879    pub fn request(mut self, new_value: HeldAccount) -> MatterHoldAccountCreateCall<'a, C> {
3880        self._request = new_value;
3881        self
3882    }
3883    /// The matter ID.
3884    ///
3885    /// Sets the *matter id* path property to the given value.
3886    ///
3887    /// Even though the property as already been set when instantiating this call,
3888    /// we provide this method for API completeness.
3889    pub fn matter_id(mut self, new_value: &str) -> MatterHoldAccountCreateCall<'a, C> {
3890        self._matter_id = new_value.to_string();
3891        self
3892    }
3893    /// The hold ID.
3894    ///
3895    /// Sets the *hold id* path property to the given value.
3896    ///
3897    /// Even though the property as already been set when instantiating this call,
3898    /// we provide this method for API completeness.
3899    pub fn hold_id(mut self, new_value: &str) -> MatterHoldAccountCreateCall<'a, C> {
3900        self._hold_id = new_value.to_string();
3901        self
3902    }
3903    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3904    /// while executing the actual API request.
3905    ///
3906    /// ````text
3907    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3908    /// ````
3909    ///
3910    /// Sets the *delegate* property to the given value.
3911    pub fn delegate(
3912        mut self,
3913        new_value: &'a mut dyn common::Delegate,
3914    ) -> MatterHoldAccountCreateCall<'a, C> {
3915        self._delegate = Some(new_value);
3916        self
3917    }
3918
3919    /// Set any additional parameter of the query string used in the request.
3920    /// It should be used to set parameters which are not yet available through their own
3921    /// setters.
3922    ///
3923    /// Please note that this method must not be used to set any of the known parameters
3924    /// which have their own setter method. If done anyway, the request will fail.
3925    ///
3926    /// # Additional Parameters
3927    ///
3928    /// * *$.xgafv* (query-string) - V1 error format.
3929    /// * *access_token* (query-string) - OAuth access token.
3930    /// * *alt* (query-string) - Data format for response.
3931    /// * *callback* (query-string) - JSONP
3932    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3933    /// * *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.
3934    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3935    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3936    /// * *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.
3937    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3938    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3939    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldAccountCreateCall<'a, C>
3940    where
3941        T: AsRef<str>,
3942    {
3943        self._additional_params
3944            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3945        self
3946    }
3947
3948    /// Identifies the authorization scope for the method you are building.
3949    ///
3950    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3951    /// [`Scope::Ediscovery`].
3952    ///
3953    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3954    /// tokens for more than one scope.
3955    ///
3956    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3957    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3958    /// sufficient, a read-write scope will do as well.
3959    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldAccountCreateCall<'a, C>
3960    where
3961        St: AsRef<str>,
3962    {
3963        self._scopes.insert(String::from(scope.as_ref()));
3964        self
3965    }
3966    /// Identifies the authorization scope(s) for the method you are building.
3967    ///
3968    /// See [`Self::add_scope()`] for details.
3969    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldAccountCreateCall<'a, C>
3970    where
3971        I: IntoIterator<Item = St>,
3972        St: AsRef<str>,
3973    {
3974        self._scopes
3975            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3976        self
3977    }
3978
3979    /// Removes all scopes, and no default scope will be used either.
3980    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3981    /// for details).
3982    pub fn clear_scopes(mut self) -> MatterHoldAccountCreateCall<'a, C> {
3983        self._scopes.clear();
3984        self
3985    }
3986}
3987
3988/// Removes an account from a hold.
3989///
3990/// A builder for the *holds.accounts.delete* method supported by a *matter* resource.
3991/// It is not used directly, but through a [`MatterMethods`] instance.
3992///
3993/// # Example
3994///
3995/// Instantiate a resource method builder
3996///
3997/// ```test_harness,no_run
3998/// # extern crate hyper;
3999/// # extern crate hyper_rustls;
4000/// # extern crate google_vault1 as vault1;
4001/// # async fn dox() {
4002/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4003///
4004/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4005/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4006/// #     .with_native_roots()
4007/// #     .unwrap()
4008/// #     .https_only()
4009/// #     .enable_http2()
4010/// #     .build();
4011///
4012/// # let executor = hyper_util::rt::TokioExecutor::new();
4013/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4014/// #     secret,
4015/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4016/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4017/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4018/// #     ),
4019/// # ).build().await.unwrap();
4020///
4021/// # let client = hyper_util::client::legacy::Client::builder(
4022/// #     hyper_util::rt::TokioExecutor::new()
4023/// # )
4024/// # .build(
4025/// #     hyper_rustls::HttpsConnectorBuilder::new()
4026/// #         .with_native_roots()
4027/// #         .unwrap()
4028/// #         .https_or_http()
4029/// #         .enable_http2()
4030/// #         .build()
4031/// # );
4032/// # let mut hub = Vault::new(client, auth);
4033/// // You can configure optional parameters by calling the respective setters at will, and
4034/// // execute the final call using `doit()`.
4035/// // Values shown here are possibly random and not representative !
4036/// let result = hub.matters().holds_accounts_delete("matterId", "holdId", "accountId")
4037///              .doit().await;
4038/// # }
4039/// ```
4040pub struct MatterHoldAccountDeleteCall<'a, C>
4041where
4042    C: 'a,
4043{
4044    hub: &'a Vault<C>,
4045    _matter_id: String,
4046    _hold_id: String,
4047    _account_id: String,
4048    _delegate: Option<&'a mut dyn common::Delegate>,
4049    _additional_params: HashMap<String, String>,
4050    _scopes: BTreeSet<String>,
4051}
4052
4053impl<'a, C> common::CallBuilder for MatterHoldAccountDeleteCall<'a, C> {}
4054
4055impl<'a, C> MatterHoldAccountDeleteCall<'a, C>
4056where
4057    C: common::Connector,
4058{
4059    /// Perform the operation you have build so far.
4060    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4061        use std::borrow::Cow;
4062        use std::io::{Read, Seek};
4063
4064        use common::{url::Params, ToParts};
4065        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4066
4067        let mut dd = common::DefaultDelegate;
4068        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4069        dlg.begin(common::MethodInfo {
4070            id: "vault.matters.holds.accounts.delete",
4071            http_method: hyper::Method::DELETE,
4072        });
4073
4074        for &field in ["alt", "matterId", "holdId", "accountId"].iter() {
4075            if self._additional_params.contains_key(field) {
4076                dlg.finished(false);
4077                return Err(common::Error::FieldClash(field));
4078            }
4079        }
4080
4081        let mut params = Params::with_capacity(5 + self._additional_params.len());
4082        params.push("matterId", self._matter_id);
4083        params.push("holdId", self._hold_id);
4084        params.push("accountId", self._account_id);
4085
4086        params.extend(self._additional_params.iter());
4087
4088        params.push("alt", "json");
4089        let mut url = self.hub._base_url.clone()
4090            + "v1/matters/{matterId}/holds/{holdId}/accounts/{accountId}";
4091        if self._scopes.is_empty() {
4092            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
4093        }
4094
4095        #[allow(clippy::single_element_loop)]
4096        for &(find_this, param_name) in [
4097            ("{matterId}", "matterId"),
4098            ("{holdId}", "holdId"),
4099            ("{accountId}", "accountId"),
4100        ]
4101        .iter()
4102        {
4103            url = params.uri_replacement(url, param_name, find_this, false);
4104        }
4105        {
4106            let to_remove = ["accountId", "holdId", "matterId"];
4107            params.remove_params(&to_remove);
4108        }
4109
4110        let url = params.parse_with_url(&url);
4111
4112        loop {
4113            let token = match self
4114                .hub
4115                .auth
4116                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4117                .await
4118            {
4119                Ok(token) => token,
4120                Err(e) => match dlg.token(e) {
4121                    Ok(token) => token,
4122                    Err(e) => {
4123                        dlg.finished(false);
4124                        return Err(common::Error::MissingToken(e));
4125                    }
4126                },
4127            };
4128            let mut req_result = {
4129                let client = &self.hub.client;
4130                dlg.pre_request();
4131                let mut req_builder = hyper::Request::builder()
4132                    .method(hyper::Method::DELETE)
4133                    .uri(url.as_str())
4134                    .header(USER_AGENT, self.hub._user_agent.clone());
4135
4136                if let Some(token) = token.as_ref() {
4137                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4138                }
4139
4140                let request = req_builder
4141                    .header(CONTENT_LENGTH, 0_u64)
4142                    .body(common::to_body::<String>(None));
4143
4144                client.request(request.unwrap()).await
4145            };
4146
4147            match req_result {
4148                Err(err) => {
4149                    if let common::Retry::After(d) = dlg.http_error(&err) {
4150                        sleep(d).await;
4151                        continue;
4152                    }
4153                    dlg.finished(false);
4154                    return Err(common::Error::HttpError(err));
4155                }
4156                Ok(res) => {
4157                    let (mut parts, body) = res.into_parts();
4158                    let mut body = common::Body::new(body);
4159                    if !parts.status.is_success() {
4160                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4161                        let error = serde_json::from_str(&common::to_string(&bytes));
4162                        let response = common::to_response(parts, bytes.into());
4163
4164                        if let common::Retry::After(d) =
4165                            dlg.http_failure(&response, error.as_ref().ok())
4166                        {
4167                            sleep(d).await;
4168                            continue;
4169                        }
4170
4171                        dlg.finished(false);
4172
4173                        return Err(match error {
4174                            Ok(value) => common::Error::BadRequest(value),
4175                            _ => common::Error::Failure(response),
4176                        });
4177                    }
4178                    let response = {
4179                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4180                        let encoded = common::to_string(&bytes);
4181                        match serde_json::from_str(&encoded) {
4182                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4183                            Err(error) => {
4184                                dlg.response_json_decode_error(&encoded, &error);
4185                                return Err(common::Error::JsonDecodeError(
4186                                    encoded.to_string(),
4187                                    error,
4188                                ));
4189                            }
4190                        }
4191                    };
4192
4193                    dlg.finished(true);
4194                    return Ok(response);
4195                }
4196            }
4197        }
4198    }
4199
4200    /// The matter ID.
4201    ///
4202    /// Sets the *matter id* path property to the given value.
4203    ///
4204    /// Even though the property as already been set when instantiating this call,
4205    /// we provide this method for API completeness.
4206    pub fn matter_id(mut self, new_value: &str) -> MatterHoldAccountDeleteCall<'a, C> {
4207        self._matter_id = new_value.to_string();
4208        self
4209    }
4210    /// The hold ID.
4211    ///
4212    /// Sets the *hold id* path property to the given value.
4213    ///
4214    /// Even though the property as already been set when instantiating this call,
4215    /// we provide this method for API completeness.
4216    pub fn hold_id(mut self, new_value: &str) -> MatterHoldAccountDeleteCall<'a, C> {
4217        self._hold_id = new_value.to_string();
4218        self
4219    }
4220    /// The ID of the account to remove from the hold.
4221    ///
4222    /// Sets the *account id* path property to the given value.
4223    ///
4224    /// Even though the property as already been set when instantiating this call,
4225    /// we provide this method for API completeness.
4226    pub fn account_id(mut self, new_value: &str) -> MatterHoldAccountDeleteCall<'a, C> {
4227        self._account_id = new_value.to_string();
4228        self
4229    }
4230    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4231    /// while executing the actual API request.
4232    ///
4233    /// ````text
4234    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4235    /// ````
4236    ///
4237    /// Sets the *delegate* property to the given value.
4238    pub fn delegate(
4239        mut self,
4240        new_value: &'a mut dyn common::Delegate,
4241    ) -> MatterHoldAccountDeleteCall<'a, C> {
4242        self._delegate = Some(new_value);
4243        self
4244    }
4245
4246    /// Set any additional parameter of the query string used in the request.
4247    /// It should be used to set parameters which are not yet available through their own
4248    /// setters.
4249    ///
4250    /// Please note that this method must not be used to set any of the known parameters
4251    /// which have their own setter method. If done anyway, the request will fail.
4252    ///
4253    /// # Additional Parameters
4254    ///
4255    /// * *$.xgafv* (query-string) - V1 error format.
4256    /// * *access_token* (query-string) - OAuth access token.
4257    /// * *alt* (query-string) - Data format for response.
4258    /// * *callback* (query-string) - JSONP
4259    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4260    /// * *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.
4261    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4262    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4263    /// * *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.
4264    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4265    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4266    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldAccountDeleteCall<'a, C>
4267    where
4268        T: AsRef<str>,
4269    {
4270        self._additional_params
4271            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4272        self
4273    }
4274
4275    /// Identifies the authorization scope for the method you are building.
4276    ///
4277    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4278    /// [`Scope::Ediscovery`].
4279    ///
4280    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4281    /// tokens for more than one scope.
4282    ///
4283    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4284    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4285    /// sufficient, a read-write scope will do as well.
4286    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldAccountDeleteCall<'a, C>
4287    where
4288        St: AsRef<str>,
4289    {
4290        self._scopes.insert(String::from(scope.as_ref()));
4291        self
4292    }
4293    /// Identifies the authorization scope(s) for the method you are building.
4294    ///
4295    /// See [`Self::add_scope()`] for details.
4296    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldAccountDeleteCall<'a, C>
4297    where
4298        I: IntoIterator<Item = St>,
4299        St: AsRef<str>,
4300    {
4301        self._scopes
4302            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4303        self
4304    }
4305
4306    /// Removes all scopes, and no default scope will be used either.
4307    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4308    /// for details).
4309    pub fn clear_scopes(mut self) -> MatterHoldAccountDeleteCall<'a, C> {
4310        self._scopes.clear();
4311        self
4312    }
4313}
4314
4315/// Lists the accounts covered by a hold. This can list only individually-specified accounts covered by the hold. If the hold covers an organizational unit, use the [Admin SDK](https://developers.google.com/admin-sdk/). to list the members of the organizational unit on hold.
4316///
4317/// A builder for the *holds.accounts.list* method supported by a *matter* resource.
4318/// It is not used directly, but through a [`MatterMethods`] instance.
4319///
4320/// # Example
4321///
4322/// Instantiate a resource method builder
4323///
4324/// ```test_harness,no_run
4325/// # extern crate hyper;
4326/// # extern crate hyper_rustls;
4327/// # extern crate google_vault1 as vault1;
4328/// # async fn dox() {
4329/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4330///
4331/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4332/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4333/// #     .with_native_roots()
4334/// #     .unwrap()
4335/// #     .https_only()
4336/// #     .enable_http2()
4337/// #     .build();
4338///
4339/// # let executor = hyper_util::rt::TokioExecutor::new();
4340/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4341/// #     secret,
4342/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4343/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4344/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4345/// #     ),
4346/// # ).build().await.unwrap();
4347///
4348/// # let client = hyper_util::client::legacy::Client::builder(
4349/// #     hyper_util::rt::TokioExecutor::new()
4350/// # )
4351/// # .build(
4352/// #     hyper_rustls::HttpsConnectorBuilder::new()
4353/// #         .with_native_roots()
4354/// #         .unwrap()
4355/// #         .https_or_http()
4356/// #         .enable_http2()
4357/// #         .build()
4358/// # );
4359/// # let mut hub = Vault::new(client, auth);
4360/// // You can configure optional parameters by calling the respective setters at will, and
4361/// // execute the final call using `doit()`.
4362/// // Values shown here are possibly random and not representative !
4363/// let result = hub.matters().holds_accounts_list("matterId", "holdId")
4364///              .doit().await;
4365/// # }
4366/// ```
4367pub struct MatterHoldAccountListCall<'a, C>
4368where
4369    C: 'a,
4370{
4371    hub: &'a Vault<C>,
4372    _matter_id: String,
4373    _hold_id: String,
4374    _delegate: Option<&'a mut dyn common::Delegate>,
4375    _additional_params: HashMap<String, String>,
4376    _scopes: BTreeSet<String>,
4377}
4378
4379impl<'a, C> common::CallBuilder for MatterHoldAccountListCall<'a, C> {}
4380
4381impl<'a, C> MatterHoldAccountListCall<'a, C>
4382where
4383    C: common::Connector,
4384{
4385    /// Perform the operation you have build so far.
4386    pub async fn doit(mut self) -> common::Result<(common::Response, ListHeldAccountsResponse)> {
4387        use std::borrow::Cow;
4388        use std::io::{Read, Seek};
4389
4390        use common::{url::Params, ToParts};
4391        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4392
4393        let mut dd = common::DefaultDelegate;
4394        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4395        dlg.begin(common::MethodInfo {
4396            id: "vault.matters.holds.accounts.list",
4397            http_method: hyper::Method::GET,
4398        });
4399
4400        for &field in ["alt", "matterId", "holdId"].iter() {
4401            if self._additional_params.contains_key(field) {
4402                dlg.finished(false);
4403                return Err(common::Error::FieldClash(field));
4404            }
4405        }
4406
4407        let mut params = Params::with_capacity(4 + self._additional_params.len());
4408        params.push("matterId", self._matter_id);
4409        params.push("holdId", self._hold_id);
4410
4411        params.extend(self._additional_params.iter());
4412
4413        params.push("alt", "json");
4414        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/holds/{holdId}/accounts";
4415        if self._scopes.is_empty() {
4416            self._scopes
4417                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
4418        }
4419
4420        #[allow(clippy::single_element_loop)]
4421        for &(find_this, param_name) in [("{matterId}", "matterId"), ("{holdId}", "holdId")].iter()
4422        {
4423            url = params.uri_replacement(url, param_name, find_this, false);
4424        }
4425        {
4426            let to_remove = ["holdId", "matterId"];
4427            params.remove_params(&to_remove);
4428        }
4429
4430        let url = params.parse_with_url(&url);
4431
4432        loop {
4433            let token = match self
4434                .hub
4435                .auth
4436                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4437                .await
4438            {
4439                Ok(token) => token,
4440                Err(e) => match dlg.token(e) {
4441                    Ok(token) => token,
4442                    Err(e) => {
4443                        dlg.finished(false);
4444                        return Err(common::Error::MissingToken(e));
4445                    }
4446                },
4447            };
4448            let mut req_result = {
4449                let client = &self.hub.client;
4450                dlg.pre_request();
4451                let mut req_builder = hyper::Request::builder()
4452                    .method(hyper::Method::GET)
4453                    .uri(url.as_str())
4454                    .header(USER_AGENT, self.hub._user_agent.clone());
4455
4456                if let Some(token) = token.as_ref() {
4457                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4458                }
4459
4460                let request = req_builder
4461                    .header(CONTENT_LENGTH, 0_u64)
4462                    .body(common::to_body::<String>(None));
4463
4464                client.request(request.unwrap()).await
4465            };
4466
4467            match req_result {
4468                Err(err) => {
4469                    if let common::Retry::After(d) = dlg.http_error(&err) {
4470                        sleep(d).await;
4471                        continue;
4472                    }
4473                    dlg.finished(false);
4474                    return Err(common::Error::HttpError(err));
4475                }
4476                Ok(res) => {
4477                    let (mut parts, body) = res.into_parts();
4478                    let mut body = common::Body::new(body);
4479                    if !parts.status.is_success() {
4480                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4481                        let error = serde_json::from_str(&common::to_string(&bytes));
4482                        let response = common::to_response(parts, bytes.into());
4483
4484                        if let common::Retry::After(d) =
4485                            dlg.http_failure(&response, error.as_ref().ok())
4486                        {
4487                            sleep(d).await;
4488                            continue;
4489                        }
4490
4491                        dlg.finished(false);
4492
4493                        return Err(match error {
4494                            Ok(value) => common::Error::BadRequest(value),
4495                            _ => common::Error::Failure(response),
4496                        });
4497                    }
4498                    let response = {
4499                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4500                        let encoded = common::to_string(&bytes);
4501                        match serde_json::from_str(&encoded) {
4502                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4503                            Err(error) => {
4504                                dlg.response_json_decode_error(&encoded, &error);
4505                                return Err(common::Error::JsonDecodeError(
4506                                    encoded.to_string(),
4507                                    error,
4508                                ));
4509                            }
4510                        }
4511                    };
4512
4513                    dlg.finished(true);
4514                    return Ok(response);
4515                }
4516            }
4517        }
4518    }
4519
4520    /// The matter ID.
4521    ///
4522    /// Sets the *matter id* path property to the given value.
4523    ///
4524    /// Even though the property as already been set when instantiating this call,
4525    /// we provide this method for API completeness.
4526    pub fn matter_id(mut self, new_value: &str) -> MatterHoldAccountListCall<'a, C> {
4527        self._matter_id = new_value.to_string();
4528        self
4529    }
4530    /// The hold ID.
4531    ///
4532    /// Sets the *hold id* path property to the given value.
4533    ///
4534    /// Even though the property as already been set when instantiating this call,
4535    /// we provide this method for API completeness.
4536    pub fn hold_id(mut self, new_value: &str) -> MatterHoldAccountListCall<'a, C> {
4537        self._hold_id = new_value.to_string();
4538        self
4539    }
4540    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4541    /// while executing the actual API request.
4542    ///
4543    /// ````text
4544    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4545    /// ````
4546    ///
4547    /// Sets the *delegate* property to the given value.
4548    pub fn delegate(
4549        mut self,
4550        new_value: &'a mut dyn common::Delegate,
4551    ) -> MatterHoldAccountListCall<'a, C> {
4552        self._delegate = Some(new_value);
4553        self
4554    }
4555
4556    /// Set any additional parameter of the query string used in the request.
4557    /// It should be used to set parameters which are not yet available through their own
4558    /// setters.
4559    ///
4560    /// Please note that this method must not be used to set any of the known parameters
4561    /// which have their own setter method. If done anyway, the request will fail.
4562    ///
4563    /// # Additional Parameters
4564    ///
4565    /// * *$.xgafv* (query-string) - V1 error format.
4566    /// * *access_token* (query-string) - OAuth access token.
4567    /// * *alt* (query-string) - Data format for response.
4568    /// * *callback* (query-string) - JSONP
4569    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4570    /// * *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.
4571    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4572    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4573    /// * *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.
4574    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4575    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4576    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldAccountListCall<'a, C>
4577    where
4578        T: AsRef<str>,
4579    {
4580        self._additional_params
4581            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4582        self
4583    }
4584
4585    /// Identifies the authorization scope for the method you are building.
4586    ///
4587    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4588    /// [`Scope::EdiscoveryReadonly`].
4589    ///
4590    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4591    /// tokens for more than one scope.
4592    ///
4593    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4594    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4595    /// sufficient, a read-write scope will do as well.
4596    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldAccountListCall<'a, C>
4597    where
4598        St: AsRef<str>,
4599    {
4600        self._scopes.insert(String::from(scope.as_ref()));
4601        self
4602    }
4603    /// Identifies the authorization scope(s) for the method you are building.
4604    ///
4605    /// See [`Self::add_scope()`] for details.
4606    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldAccountListCall<'a, C>
4607    where
4608        I: IntoIterator<Item = St>,
4609        St: AsRef<str>,
4610    {
4611        self._scopes
4612            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4613        self
4614    }
4615
4616    /// Removes all scopes, and no default scope will be used either.
4617    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4618    /// for details).
4619    pub fn clear_scopes(mut self) -> MatterHoldAccountListCall<'a, C> {
4620        self._scopes.clear();
4621        self
4622    }
4623}
4624
4625/// Adds accounts to a hold. Returns a list of accounts that have been successfully added. Accounts can be added only to an existing account-based hold.
4626///
4627/// A builder for the *holds.addHeldAccounts* method supported by a *matter* resource.
4628/// It is not used directly, but through a [`MatterMethods`] instance.
4629///
4630/// # Example
4631///
4632/// Instantiate a resource method builder
4633///
4634/// ```test_harness,no_run
4635/// # extern crate hyper;
4636/// # extern crate hyper_rustls;
4637/// # extern crate google_vault1 as vault1;
4638/// use vault1::api::AddHeldAccountsRequest;
4639/// # async fn dox() {
4640/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4641///
4642/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4643/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4644/// #     .with_native_roots()
4645/// #     .unwrap()
4646/// #     .https_only()
4647/// #     .enable_http2()
4648/// #     .build();
4649///
4650/// # let executor = hyper_util::rt::TokioExecutor::new();
4651/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4652/// #     secret,
4653/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4654/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4655/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4656/// #     ),
4657/// # ).build().await.unwrap();
4658///
4659/// # let client = hyper_util::client::legacy::Client::builder(
4660/// #     hyper_util::rt::TokioExecutor::new()
4661/// # )
4662/// # .build(
4663/// #     hyper_rustls::HttpsConnectorBuilder::new()
4664/// #         .with_native_roots()
4665/// #         .unwrap()
4666/// #         .https_or_http()
4667/// #         .enable_http2()
4668/// #         .build()
4669/// # );
4670/// # let mut hub = Vault::new(client, auth);
4671/// // As the method needs a request, you would usually fill it with the desired information
4672/// // into the respective structure. Some of the parts shown here might not be applicable !
4673/// // Values shown here are possibly random and not representative !
4674/// let mut req = AddHeldAccountsRequest::default();
4675///
4676/// // You can configure optional parameters by calling the respective setters at will, and
4677/// // execute the final call using `doit()`.
4678/// // Values shown here are possibly random and not representative !
4679/// let result = hub.matters().holds_add_held_accounts(req, "matterId", "holdId")
4680///              .doit().await;
4681/// # }
4682/// ```
4683pub struct MatterHoldAddHeldAccountCall<'a, C>
4684where
4685    C: 'a,
4686{
4687    hub: &'a Vault<C>,
4688    _request: AddHeldAccountsRequest,
4689    _matter_id: String,
4690    _hold_id: String,
4691    _delegate: Option<&'a mut dyn common::Delegate>,
4692    _additional_params: HashMap<String, String>,
4693    _scopes: BTreeSet<String>,
4694}
4695
4696impl<'a, C> common::CallBuilder for MatterHoldAddHeldAccountCall<'a, C> {}
4697
4698impl<'a, C> MatterHoldAddHeldAccountCall<'a, C>
4699where
4700    C: common::Connector,
4701{
4702    /// Perform the operation you have build so far.
4703    pub async fn doit(mut self) -> common::Result<(common::Response, AddHeldAccountsResponse)> {
4704        use std::borrow::Cow;
4705        use std::io::{Read, Seek};
4706
4707        use common::{url::Params, ToParts};
4708        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4709
4710        let mut dd = common::DefaultDelegate;
4711        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4712        dlg.begin(common::MethodInfo {
4713            id: "vault.matters.holds.addHeldAccounts",
4714            http_method: hyper::Method::POST,
4715        });
4716
4717        for &field in ["alt", "matterId", "holdId"].iter() {
4718            if self._additional_params.contains_key(field) {
4719                dlg.finished(false);
4720                return Err(common::Error::FieldClash(field));
4721            }
4722        }
4723
4724        let mut params = Params::with_capacity(5 + self._additional_params.len());
4725        params.push("matterId", self._matter_id);
4726        params.push("holdId", self._hold_id);
4727
4728        params.extend(self._additional_params.iter());
4729
4730        params.push("alt", "json");
4731        let mut url =
4732            self.hub._base_url.clone() + "v1/matters/{matterId}/holds/{holdId}:addHeldAccounts";
4733        if self._scopes.is_empty() {
4734            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
4735        }
4736
4737        #[allow(clippy::single_element_loop)]
4738        for &(find_this, param_name) in [("{matterId}", "matterId"), ("{holdId}", "holdId")].iter()
4739        {
4740            url = params.uri_replacement(url, param_name, find_this, false);
4741        }
4742        {
4743            let to_remove = ["holdId", "matterId"];
4744            params.remove_params(&to_remove);
4745        }
4746
4747        let url = params.parse_with_url(&url);
4748
4749        let mut json_mime_type = mime::APPLICATION_JSON;
4750        let mut request_value_reader = {
4751            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4752            common::remove_json_null_values(&mut value);
4753            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4754            serde_json::to_writer(&mut dst, &value).unwrap();
4755            dst
4756        };
4757        let request_size = request_value_reader
4758            .seek(std::io::SeekFrom::End(0))
4759            .unwrap();
4760        request_value_reader
4761            .seek(std::io::SeekFrom::Start(0))
4762            .unwrap();
4763
4764        loop {
4765            let token = match self
4766                .hub
4767                .auth
4768                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4769                .await
4770            {
4771                Ok(token) => token,
4772                Err(e) => match dlg.token(e) {
4773                    Ok(token) => token,
4774                    Err(e) => {
4775                        dlg.finished(false);
4776                        return Err(common::Error::MissingToken(e));
4777                    }
4778                },
4779            };
4780            request_value_reader
4781                .seek(std::io::SeekFrom::Start(0))
4782                .unwrap();
4783            let mut req_result = {
4784                let client = &self.hub.client;
4785                dlg.pre_request();
4786                let mut req_builder = hyper::Request::builder()
4787                    .method(hyper::Method::POST)
4788                    .uri(url.as_str())
4789                    .header(USER_AGENT, self.hub._user_agent.clone());
4790
4791                if let Some(token) = token.as_ref() {
4792                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4793                }
4794
4795                let request = req_builder
4796                    .header(CONTENT_TYPE, json_mime_type.to_string())
4797                    .header(CONTENT_LENGTH, request_size as u64)
4798                    .body(common::to_body(
4799                        request_value_reader.get_ref().clone().into(),
4800                    ));
4801
4802                client.request(request.unwrap()).await
4803            };
4804
4805            match req_result {
4806                Err(err) => {
4807                    if let common::Retry::After(d) = dlg.http_error(&err) {
4808                        sleep(d).await;
4809                        continue;
4810                    }
4811                    dlg.finished(false);
4812                    return Err(common::Error::HttpError(err));
4813                }
4814                Ok(res) => {
4815                    let (mut parts, body) = res.into_parts();
4816                    let mut body = common::Body::new(body);
4817                    if !parts.status.is_success() {
4818                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4819                        let error = serde_json::from_str(&common::to_string(&bytes));
4820                        let response = common::to_response(parts, bytes.into());
4821
4822                        if let common::Retry::After(d) =
4823                            dlg.http_failure(&response, error.as_ref().ok())
4824                        {
4825                            sleep(d).await;
4826                            continue;
4827                        }
4828
4829                        dlg.finished(false);
4830
4831                        return Err(match error {
4832                            Ok(value) => common::Error::BadRequest(value),
4833                            _ => common::Error::Failure(response),
4834                        });
4835                    }
4836                    let response = {
4837                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4838                        let encoded = common::to_string(&bytes);
4839                        match serde_json::from_str(&encoded) {
4840                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4841                            Err(error) => {
4842                                dlg.response_json_decode_error(&encoded, &error);
4843                                return Err(common::Error::JsonDecodeError(
4844                                    encoded.to_string(),
4845                                    error,
4846                                ));
4847                            }
4848                        }
4849                    };
4850
4851                    dlg.finished(true);
4852                    return Ok(response);
4853                }
4854            }
4855        }
4856    }
4857
4858    ///
4859    /// Sets the *request* property to the given value.
4860    ///
4861    /// Even though the property as already been set when instantiating this call,
4862    /// we provide this method for API completeness.
4863    pub fn request(
4864        mut self,
4865        new_value: AddHeldAccountsRequest,
4866    ) -> MatterHoldAddHeldAccountCall<'a, C> {
4867        self._request = new_value;
4868        self
4869    }
4870    /// The matter ID.
4871    ///
4872    /// Sets the *matter id* path property to the given value.
4873    ///
4874    /// Even though the property as already been set when instantiating this call,
4875    /// we provide this method for API completeness.
4876    pub fn matter_id(mut self, new_value: &str) -> MatterHoldAddHeldAccountCall<'a, C> {
4877        self._matter_id = new_value.to_string();
4878        self
4879    }
4880    /// The hold ID.
4881    ///
4882    /// Sets the *hold id* path property to the given value.
4883    ///
4884    /// Even though the property as already been set when instantiating this call,
4885    /// we provide this method for API completeness.
4886    pub fn hold_id(mut self, new_value: &str) -> MatterHoldAddHeldAccountCall<'a, C> {
4887        self._hold_id = new_value.to_string();
4888        self
4889    }
4890    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4891    /// while executing the actual API request.
4892    ///
4893    /// ````text
4894    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4895    /// ````
4896    ///
4897    /// Sets the *delegate* property to the given value.
4898    pub fn delegate(
4899        mut self,
4900        new_value: &'a mut dyn common::Delegate,
4901    ) -> MatterHoldAddHeldAccountCall<'a, C> {
4902        self._delegate = Some(new_value);
4903        self
4904    }
4905
4906    /// Set any additional parameter of the query string used in the request.
4907    /// It should be used to set parameters which are not yet available through their own
4908    /// setters.
4909    ///
4910    /// Please note that this method must not be used to set any of the known parameters
4911    /// which have their own setter method. If done anyway, the request will fail.
4912    ///
4913    /// # Additional Parameters
4914    ///
4915    /// * *$.xgafv* (query-string) - V1 error format.
4916    /// * *access_token* (query-string) - OAuth access token.
4917    /// * *alt* (query-string) - Data format for response.
4918    /// * *callback* (query-string) - JSONP
4919    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4920    /// * *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.
4921    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4922    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4923    /// * *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.
4924    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4925    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4926    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldAddHeldAccountCall<'a, C>
4927    where
4928        T: AsRef<str>,
4929    {
4930        self._additional_params
4931            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4932        self
4933    }
4934
4935    /// Identifies the authorization scope for the method you are building.
4936    ///
4937    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4938    /// [`Scope::Ediscovery`].
4939    ///
4940    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4941    /// tokens for more than one scope.
4942    ///
4943    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4944    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4945    /// sufficient, a read-write scope will do as well.
4946    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldAddHeldAccountCall<'a, C>
4947    where
4948        St: AsRef<str>,
4949    {
4950        self._scopes.insert(String::from(scope.as_ref()));
4951        self
4952    }
4953    /// Identifies the authorization scope(s) for the method you are building.
4954    ///
4955    /// See [`Self::add_scope()`] for details.
4956    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldAddHeldAccountCall<'a, C>
4957    where
4958        I: IntoIterator<Item = St>,
4959        St: AsRef<str>,
4960    {
4961        self._scopes
4962            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4963        self
4964    }
4965
4966    /// Removes all scopes, and no default scope will be used either.
4967    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4968    /// for details).
4969    pub fn clear_scopes(mut self) -> MatterHoldAddHeldAccountCall<'a, C> {
4970        self._scopes.clear();
4971        self
4972    }
4973}
4974
4975/// Creates a hold in the specified matter.
4976///
4977/// A builder for the *holds.create* method supported by a *matter* resource.
4978/// It is not used directly, but through a [`MatterMethods`] instance.
4979///
4980/// # Example
4981///
4982/// Instantiate a resource method builder
4983///
4984/// ```test_harness,no_run
4985/// # extern crate hyper;
4986/// # extern crate hyper_rustls;
4987/// # extern crate google_vault1 as vault1;
4988/// use vault1::api::Hold;
4989/// # async fn dox() {
4990/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4991///
4992/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4993/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4994/// #     .with_native_roots()
4995/// #     .unwrap()
4996/// #     .https_only()
4997/// #     .enable_http2()
4998/// #     .build();
4999///
5000/// # let executor = hyper_util::rt::TokioExecutor::new();
5001/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5002/// #     secret,
5003/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5004/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5005/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5006/// #     ),
5007/// # ).build().await.unwrap();
5008///
5009/// # let client = hyper_util::client::legacy::Client::builder(
5010/// #     hyper_util::rt::TokioExecutor::new()
5011/// # )
5012/// # .build(
5013/// #     hyper_rustls::HttpsConnectorBuilder::new()
5014/// #         .with_native_roots()
5015/// #         .unwrap()
5016/// #         .https_or_http()
5017/// #         .enable_http2()
5018/// #         .build()
5019/// # );
5020/// # let mut hub = Vault::new(client, auth);
5021/// // As the method needs a request, you would usually fill it with the desired information
5022/// // into the respective structure. Some of the parts shown here might not be applicable !
5023/// // Values shown here are possibly random and not representative !
5024/// let mut req = Hold::default();
5025///
5026/// // You can configure optional parameters by calling the respective setters at will, and
5027/// // execute the final call using `doit()`.
5028/// // Values shown here are possibly random and not representative !
5029/// let result = hub.matters().holds_create(req, "matterId")
5030///              .doit().await;
5031/// # }
5032/// ```
5033pub struct MatterHoldCreateCall<'a, C>
5034where
5035    C: 'a,
5036{
5037    hub: &'a Vault<C>,
5038    _request: Hold,
5039    _matter_id: String,
5040    _delegate: Option<&'a mut dyn common::Delegate>,
5041    _additional_params: HashMap<String, String>,
5042    _scopes: BTreeSet<String>,
5043}
5044
5045impl<'a, C> common::CallBuilder for MatterHoldCreateCall<'a, C> {}
5046
5047impl<'a, C> MatterHoldCreateCall<'a, C>
5048where
5049    C: common::Connector,
5050{
5051    /// Perform the operation you have build so far.
5052    pub async fn doit(mut self) -> common::Result<(common::Response, Hold)> {
5053        use std::borrow::Cow;
5054        use std::io::{Read, Seek};
5055
5056        use common::{url::Params, ToParts};
5057        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5058
5059        let mut dd = common::DefaultDelegate;
5060        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5061        dlg.begin(common::MethodInfo {
5062            id: "vault.matters.holds.create",
5063            http_method: hyper::Method::POST,
5064        });
5065
5066        for &field in ["alt", "matterId"].iter() {
5067            if self._additional_params.contains_key(field) {
5068                dlg.finished(false);
5069                return Err(common::Error::FieldClash(field));
5070            }
5071        }
5072
5073        let mut params = Params::with_capacity(4 + self._additional_params.len());
5074        params.push("matterId", self._matter_id);
5075
5076        params.extend(self._additional_params.iter());
5077
5078        params.push("alt", "json");
5079        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/holds";
5080        if self._scopes.is_empty() {
5081            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
5082        }
5083
5084        #[allow(clippy::single_element_loop)]
5085        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
5086            url = params.uri_replacement(url, param_name, find_this, false);
5087        }
5088        {
5089            let to_remove = ["matterId"];
5090            params.remove_params(&to_remove);
5091        }
5092
5093        let url = params.parse_with_url(&url);
5094
5095        let mut json_mime_type = mime::APPLICATION_JSON;
5096        let mut request_value_reader = {
5097            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5098            common::remove_json_null_values(&mut value);
5099            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5100            serde_json::to_writer(&mut dst, &value).unwrap();
5101            dst
5102        };
5103        let request_size = request_value_reader
5104            .seek(std::io::SeekFrom::End(0))
5105            .unwrap();
5106        request_value_reader
5107            .seek(std::io::SeekFrom::Start(0))
5108            .unwrap();
5109
5110        loop {
5111            let token = match self
5112                .hub
5113                .auth
5114                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5115                .await
5116            {
5117                Ok(token) => token,
5118                Err(e) => match dlg.token(e) {
5119                    Ok(token) => token,
5120                    Err(e) => {
5121                        dlg.finished(false);
5122                        return Err(common::Error::MissingToken(e));
5123                    }
5124                },
5125            };
5126            request_value_reader
5127                .seek(std::io::SeekFrom::Start(0))
5128                .unwrap();
5129            let mut req_result = {
5130                let client = &self.hub.client;
5131                dlg.pre_request();
5132                let mut req_builder = hyper::Request::builder()
5133                    .method(hyper::Method::POST)
5134                    .uri(url.as_str())
5135                    .header(USER_AGENT, self.hub._user_agent.clone());
5136
5137                if let Some(token) = token.as_ref() {
5138                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5139                }
5140
5141                let request = req_builder
5142                    .header(CONTENT_TYPE, json_mime_type.to_string())
5143                    .header(CONTENT_LENGTH, request_size as u64)
5144                    .body(common::to_body(
5145                        request_value_reader.get_ref().clone().into(),
5146                    ));
5147
5148                client.request(request.unwrap()).await
5149            };
5150
5151            match req_result {
5152                Err(err) => {
5153                    if let common::Retry::After(d) = dlg.http_error(&err) {
5154                        sleep(d).await;
5155                        continue;
5156                    }
5157                    dlg.finished(false);
5158                    return Err(common::Error::HttpError(err));
5159                }
5160                Ok(res) => {
5161                    let (mut parts, body) = res.into_parts();
5162                    let mut body = common::Body::new(body);
5163                    if !parts.status.is_success() {
5164                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5165                        let error = serde_json::from_str(&common::to_string(&bytes));
5166                        let response = common::to_response(parts, bytes.into());
5167
5168                        if let common::Retry::After(d) =
5169                            dlg.http_failure(&response, error.as_ref().ok())
5170                        {
5171                            sleep(d).await;
5172                            continue;
5173                        }
5174
5175                        dlg.finished(false);
5176
5177                        return Err(match error {
5178                            Ok(value) => common::Error::BadRequest(value),
5179                            _ => common::Error::Failure(response),
5180                        });
5181                    }
5182                    let response = {
5183                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5184                        let encoded = common::to_string(&bytes);
5185                        match serde_json::from_str(&encoded) {
5186                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5187                            Err(error) => {
5188                                dlg.response_json_decode_error(&encoded, &error);
5189                                return Err(common::Error::JsonDecodeError(
5190                                    encoded.to_string(),
5191                                    error,
5192                                ));
5193                            }
5194                        }
5195                    };
5196
5197                    dlg.finished(true);
5198                    return Ok(response);
5199                }
5200            }
5201        }
5202    }
5203
5204    ///
5205    /// Sets the *request* property to the given value.
5206    ///
5207    /// Even though the property as already been set when instantiating this call,
5208    /// we provide this method for API completeness.
5209    pub fn request(mut self, new_value: Hold) -> MatterHoldCreateCall<'a, C> {
5210        self._request = new_value;
5211        self
5212    }
5213    /// The matter ID.
5214    ///
5215    /// Sets the *matter 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 matter_id(mut self, new_value: &str) -> MatterHoldCreateCall<'a, C> {
5220        self._matter_id = new_value.to_string();
5221        self
5222    }
5223    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5224    /// while executing the actual API request.
5225    ///
5226    /// ````text
5227    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5228    /// ````
5229    ///
5230    /// Sets the *delegate* property to the given value.
5231    pub fn delegate(
5232        mut self,
5233        new_value: &'a mut dyn common::Delegate,
5234    ) -> MatterHoldCreateCall<'a, C> {
5235        self._delegate = Some(new_value);
5236        self
5237    }
5238
5239    /// Set any additional parameter of the query string used in the request.
5240    /// It should be used to set parameters which are not yet available through their own
5241    /// setters.
5242    ///
5243    /// Please note that this method must not be used to set any of the known parameters
5244    /// which have their own setter method. If done anyway, the request will fail.
5245    ///
5246    /// # Additional Parameters
5247    ///
5248    /// * *$.xgafv* (query-string) - V1 error format.
5249    /// * *access_token* (query-string) - OAuth access token.
5250    /// * *alt* (query-string) - Data format for response.
5251    /// * *callback* (query-string) - JSONP
5252    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5253    /// * *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.
5254    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5255    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5256    /// * *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.
5257    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5258    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5259    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldCreateCall<'a, C>
5260    where
5261        T: AsRef<str>,
5262    {
5263        self._additional_params
5264            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5265        self
5266    }
5267
5268    /// Identifies the authorization scope for the method you are building.
5269    ///
5270    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5271    /// [`Scope::Ediscovery`].
5272    ///
5273    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5274    /// tokens for more than one scope.
5275    ///
5276    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5277    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5278    /// sufficient, a read-write scope will do as well.
5279    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldCreateCall<'a, C>
5280    where
5281        St: AsRef<str>,
5282    {
5283        self._scopes.insert(String::from(scope.as_ref()));
5284        self
5285    }
5286    /// Identifies the authorization scope(s) for the method you are building.
5287    ///
5288    /// See [`Self::add_scope()`] for details.
5289    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldCreateCall<'a, C>
5290    where
5291        I: IntoIterator<Item = St>,
5292        St: AsRef<str>,
5293    {
5294        self._scopes
5295            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5296        self
5297    }
5298
5299    /// Removes all scopes, and no default scope will be used either.
5300    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5301    /// for details).
5302    pub fn clear_scopes(mut self) -> MatterHoldCreateCall<'a, C> {
5303        self._scopes.clear();
5304        self
5305    }
5306}
5307
5308/// Removes the specified hold and releases the accounts or organizational unit covered by the hold. If the data is not preserved by another hold or retention rule, it might be purged.
5309///
5310/// A builder for the *holds.delete* method supported by a *matter* resource.
5311/// It is not used directly, but through a [`MatterMethods`] instance.
5312///
5313/// # Example
5314///
5315/// Instantiate a resource method builder
5316///
5317/// ```test_harness,no_run
5318/// # extern crate hyper;
5319/// # extern crate hyper_rustls;
5320/// # extern crate google_vault1 as vault1;
5321/// # async fn dox() {
5322/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5323///
5324/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5325/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5326/// #     .with_native_roots()
5327/// #     .unwrap()
5328/// #     .https_only()
5329/// #     .enable_http2()
5330/// #     .build();
5331///
5332/// # let executor = hyper_util::rt::TokioExecutor::new();
5333/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5334/// #     secret,
5335/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5336/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5337/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5338/// #     ),
5339/// # ).build().await.unwrap();
5340///
5341/// # let client = hyper_util::client::legacy::Client::builder(
5342/// #     hyper_util::rt::TokioExecutor::new()
5343/// # )
5344/// # .build(
5345/// #     hyper_rustls::HttpsConnectorBuilder::new()
5346/// #         .with_native_roots()
5347/// #         .unwrap()
5348/// #         .https_or_http()
5349/// #         .enable_http2()
5350/// #         .build()
5351/// # );
5352/// # let mut hub = Vault::new(client, auth);
5353/// // You can configure optional parameters by calling the respective setters at will, and
5354/// // execute the final call using `doit()`.
5355/// // Values shown here are possibly random and not representative !
5356/// let result = hub.matters().holds_delete("matterId", "holdId")
5357///              .doit().await;
5358/// # }
5359/// ```
5360pub struct MatterHoldDeleteCall<'a, C>
5361where
5362    C: 'a,
5363{
5364    hub: &'a Vault<C>,
5365    _matter_id: String,
5366    _hold_id: String,
5367    _delegate: Option<&'a mut dyn common::Delegate>,
5368    _additional_params: HashMap<String, String>,
5369    _scopes: BTreeSet<String>,
5370}
5371
5372impl<'a, C> common::CallBuilder for MatterHoldDeleteCall<'a, C> {}
5373
5374impl<'a, C> MatterHoldDeleteCall<'a, C>
5375where
5376    C: common::Connector,
5377{
5378    /// Perform the operation you have build so far.
5379    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5380        use std::borrow::Cow;
5381        use std::io::{Read, Seek};
5382
5383        use common::{url::Params, ToParts};
5384        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5385
5386        let mut dd = common::DefaultDelegate;
5387        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5388        dlg.begin(common::MethodInfo {
5389            id: "vault.matters.holds.delete",
5390            http_method: hyper::Method::DELETE,
5391        });
5392
5393        for &field in ["alt", "matterId", "holdId"].iter() {
5394            if self._additional_params.contains_key(field) {
5395                dlg.finished(false);
5396                return Err(common::Error::FieldClash(field));
5397            }
5398        }
5399
5400        let mut params = Params::with_capacity(4 + self._additional_params.len());
5401        params.push("matterId", self._matter_id);
5402        params.push("holdId", self._hold_id);
5403
5404        params.extend(self._additional_params.iter());
5405
5406        params.push("alt", "json");
5407        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/holds/{holdId}";
5408        if self._scopes.is_empty() {
5409            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
5410        }
5411
5412        #[allow(clippy::single_element_loop)]
5413        for &(find_this, param_name) in [("{matterId}", "matterId"), ("{holdId}", "holdId")].iter()
5414        {
5415            url = params.uri_replacement(url, param_name, find_this, false);
5416        }
5417        {
5418            let to_remove = ["holdId", "matterId"];
5419            params.remove_params(&to_remove);
5420        }
5421
5422        let url = params.parse_with_url(&url);
5423
5424        loop {
5425            let token = match self
5426                .hub
5427                .auth
5428                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5429                .await
5430            {
5431                Ok(token) => token,
5432                Err(e) => match dlg.token(e) {
5433                    Ok(token) => token,
5434                    Err(e) => {
5435                        dlg.finished(false);
5436                        return Err(common::Error::MissingToken(e));
5437                    }
5438                },
5439            };
5440            let mut req_result = {
5441                let client = &self.hub.client;
5442                dlg.pre_request();
5443                let mut req_builder = hyper::Request::builder()
5444                    .method(hyper::Method::DELETE)
5445                    .uri(url.as_str())
5446                    .header(USER_AGENT, self.hub._user_agent.clone());
5447
5448                if let Some(token) = token.as_ref() {
5449                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5450                }
5451
5452                let request = req_builder
5453                    .header(CONTENT_LENGTH, 0_u64)
5454                    .body(common::to_body::<String>(None));
5455
5456                client.request(request.unwrap()).await
5457            };
5458
5459            match req_result {
5460                Err(err) => {
5461                    if let common::Retry::After(d) = dlg.http_error(&err) {
5462                        sleep(d).await;
5463                        continue;
5464                    }
5465                    dlg.finished(false);
5466                    return Err(common::Error::HttpError(err));
5467                }
5468                Ok(res) => {
5469                    let (mut parts, body) = res.into_parts();
5470                    let mut body = common::Body::new(body);
5471                    if !parts.status.is_success() {
5472                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5473                        let error = serde_json::from_str(&common::to_string(&bytes));
5474                        let response = common::to_response(parts, bytes.into());
5475
5476                        if let common::Retry::After(d) =
5477                            dlg.http_failure(&response, error.as_ref().ok())
5478                        {
5479                            sleep(d).await;
5480                            continue;
5481                        }
5482
5483                        dlg.finished(false);
5484
5485                        return Err(match error {
5486                            Ok(value) => common::Error::BadRequest(value),
5487                            _ => common::Error::Failure(response),
5488                        });
5489                    }
5490                    let response = {
5491                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5492                        let encoded = common::to_string(&bytes);
5493                        match serde_json::from_str(&encoded) {
5494                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5495                            Err(error) => {
5496                                dlg.response_json_decode_error(&encoded, &error);
5497                                return Err(common::Error::JsonDecodeError(
5498                                    encoded.to_string(),
5499                                    error,
5500                                ));
5501                            }
5502                        }
5503                    };
5504
5505                    dlg.finished(true);
5506                    return Ok(response);
5507                }
5508            }
5509        }
5510    }
5511
5512    /// The matter ID.
5513    ///
5514    /// Sets the *matter id* path property to the given value.
5515    ///
5516    /// Even though the property as already been set when instantiating this call,
5517    /// we provide this method for API completeness.
5518    pub fn matter_id(mut self, new_value: &str) -> MatterHoldDeleteCall<'a, C> {
5519        self._matter_id = new_value.to_string();
5520        self
5521    }
5522    /// The hold ID.
5523    ///
5524    /// Sets the *hold id* path property to the given value.
5525    ///
5526    /// Even though the property as already been set when instantiating this call,
5527    /// we provide this method for API completeness.
5528    pub fn hold_id(mut self, new_value: &str) -> MatterHoldDeleteCall<'a, C> {
5529        self._hold_id = new_value.to_string();
5530        self
5531    }
5532    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5533    /// while executing the actual API request.
5534    ///
5535    /// ````text
5536    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5537    /// ````
5538    ///
5539    /// Sets the *delegate* property to the given value.
5540    pub fn delegate(
5541        mut self,
5542        new_value: &'a mut dyn common::Delegate,
5543    ) -> MatterHoldDeleteCall<'a, C> {
5544        self._delegate = Some(new_value);
5545        self
5546    }
5547
5548    /// Set any additional parameter of the query string used in the request.
5549    /// It should be used to set parameters which are not yet available through their own
5550    /// setters.
5551    ///
5552    /// Please note that this method must not be used to set any of the known parameters
5553    /// which have their own setter method. If done anyway, the request will fail.
5554    ///
5555    /// # Additional Parameters
5556    ///
5557    /// * *$.xgafv* (query-string) - V1 error format.
5558    /// * *access_token* (query-string) - OAuth access token.
5559    /// * *alt* (query-string) - Data format for response.
5560    /// * *callback* (query-string) - JSONP
5561    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5562    /// * *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.
5563    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5564    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5565    /// * *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.
5566    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5567    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5568    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldDeleteCall<'a, C>
5569    where
5570        T: AsRef<str>,
5571    {
5572        self._additional_params
5573            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5574        self
5575    }
5576
5577    /// Identifies the authorization scope for the method you are building.
5578    ///
5579    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5580    /// [`Scope::Ediscovery`].
5581    ///
5582    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5583    /// tokens for more than one scope.
5584    ///
5585    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5586    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5587    /// sufficient, a read-write scope will do as well.
5588    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldDeleteCall<'a, C>
5589    where
5590        St: AsRef<str>,
5591    {
5592        self._scopes.insert(String::from(scope.as_ref()));
5593        self
5594    }
5595    /// Identifies the authorization scope(s) for the method you are building.
5596    ///
5597    /// See [`Self::add_scope()`] for details.
5598    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldDeleteCall<'a, C>
5599    where
5600        I: IntoIterator<Item = St>,
5601        St: AsRef<str>,
5602    {
5603        self._scopes
5604            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5605        self
5606    }
5607
5608    /// Removes all scopes, and no default scope will be used either.
5609    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5610    /// for details).
5611    pub fn clear_scopes(mut self) -> MatterHoldDeleteCall<'a, C> {
5612        self._scopes.clear();
5613        self
5614    }
5615}
5616
5617/// Gets the specified hold.
5618///
5619/// A builder for the *holds.get* method supported by a *matter* resource.
5620/// It is not used directly, but through a [`MatterMethods`] instance.
5621///
5622/// # Example
5623///
5624/// Instantiate a resource method builder
5625///
5626/// ```test_harness,no_run
5627/// # extern crate hyper;
5628/// # extern crate hyper_rustls;
5629/// # extern crate google_vault1 as vault1;
5630/// # async fn dox() {
5631/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5632///
5633/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5634/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5635/// #     .with_native_roots()
5636/// #     .unwrap()
5637/// #     .https_only()
5638/// #     .enable_http2()
5639/// #     .build();
5640///
5641/// # let executor = hyper_util::rt::TokioExecutor::new();
5642/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5643/// #     secret,
5644/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5645/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5646/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5647/// #     ),
5648/// # ).build().await.unwrap();
5649///
5650/// # let client = hyper_util::client::legacy::Client::builder(
5651/// #     hyper_util::rt::TokioExecutor::new()
5652/// # )
5653/// # .build(
5654/// #     hyper_rustls::HttpsConnectorBuilder::new()
5655/// #         .with_native_roots()
5656/// #         .unwrap()
5657/// #         .https_or_http()
5658/// #         .enable_http2()
5659/// #         .build()
5660/// # );
5661/// # let mut hub = Vault::new(client, auth);
5662/// // You can configure optional parameters by calling the respective setters at will, and
5663/// // execute the final call using `doit()`.
5664/// // Values shown here are possibly random and not representative !
5665/// let result = hub.matters().holds_get("matterId", "holdId")
5666///              .view("dolor")
5667///              .doit().await;
5668/// # }
5669/// ```
5670pub struct MatterHoldGetCall<'a, C>
5671where
5672    C: 'a,
5673{
5674    hub: &'a Vault<C>,
5675    _matter_id: String,
5676    _hold_id: String,
5677    _view: Option<String>,
5678    _delegate: Option<&'a mut dyn common::Delegate>,
5679    _additional_params: HashMap<String, String>,
5680    _scopes: BTreeSet<String>,
5681}
5682
5683impl<'a, C> common::CallBuilder for MatterHoldGetCall<'a, C> {}
5684
5685impl<'a, C> MatterHoldGetCall<'a, C>
5686where
5687    C: common::Connector,
5688{
5689    /// Perform the operation you have build so far.
5690    pub async fn doit(mut self) -> common::Result<(common::Response, Hold)> {
5691        use std::borrow::Cow;
5692        use std::io::{Read, Seek};
5693
5694        use common::{url::Params, ToParts};
5695        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5696
5697        let mut dd = common::DefaultDelegate;
5698        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5699        dlg.begin(common::MethodInfo {
5700            id: "vault.matters.holds.get",
5701            http_method: hyper::Method::GET,
5702        });
5703
5704        for &field in ["alt", "matterId", "holdId", "view"].iter() {
5705            if self._additional_params.contains_key(field) {
5706                dlg.finished(false);
5707                return Err(common::Error::FieldClash(field));
5708            }
5709        }
5710
5711        let mut params = Params::with_capacity(5 + self._additional_params.len());
5712        params.push("matterId", self._matter_id);
5713        params.push("holdId", self._hold_id);
5714        if let Some(value) = self._view.as_ref() {
5715            params.push("view", value);
5716        }
5717
5718        params.extend(self._additional_params.iter());
5719
5720        params.push("alt", "json");
5721        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/holds/{holdId}";
5722        if self._scopes.is_empty() {
5723            self._scopes
5724                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
5725        }
5726
5727        #[allow(clippy::single_element_loop)]
5728        for &(find_this, param_name) in [("{matterId}", "matterId"), ("{holdId}", "holdId")].iter()
5729        {
5730            url = params.uri_replacement(url, param_name, find_this, false);
5731        }
5732        {
5733            let to_remove = ["holdId", "matterId"];
5734            params.remove_params(&to_remove);
5735        }
5736
5737        let url = params.parse_with_url(&url);
5738
5739        loop {
5740            let token = match self
5741                .hub
5742                .auth
5743                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5744                .await
5745            {
5746                Ok(token) => token,
5747                Err(e) => match dlg.token(e) {
5748                    Ok(token) => token,
5749                    Err(e) => {
5750                        dlg.finished(false);
5751                        return Err(common::Error::MissingToken(e));
5752                    }
5753                },
5754            };
5755            let mut req_result = {
5756                let client = &self.hub.client;
5757                dlg.pre_request();
5758                let mut req_builder = hyper::Request::builder()
5759                    .method(hyper::Method::GET)
5760                    .uri(url.as_str())
5761                    .header(USER_AGENT, self.hub._user_agent.clone());
5762
5763                if let Some(token) = token.as_ref() {
5764                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5765                }
5766
5767                let request = req_builder
5768                    .header(CONTENT_LENGTH, 0_u64)
5769                    .body(common::to_body::<String>(None));
5770
5771                client.request(request.unwrap()).await
5772            };
5773
5774            match req_result {
5775                Err(err) => {
5776                    if let common::Retry::After(d) = dlg.http_error(&err) {
5777                        sleep(d).await;
5778                        continue;
5779                    }
5780                    dlg.finished(false);
5781                    return Err(common::Error::HttpError(err));
5782                }
5783                Ok(res) => {
5784                    let (mut parts, body) = res.into_parts();
5785                    let mut body = common::Body::new(body);
5786                    if !parts.status.is_success() {
5787                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5788                        let error = serde_json::from_str(&common::to_string(&bytes));
5789                        let response = common::to_response(parts, bytes.into());
5790
5791                        if let common::Retry::After(d) =
5792                            dlg.http_failure(&response, error.as_ref().ok())
5793                        {
5794                            sleep(d).await;
5795                            continue;
5796                        }
5797
5798                        dlg.finished(false);
5799
5800                        return Err(match error {
5801                            Ok(value) => common::Error::BadRequest(value),
5802                            _ => common::Error::Failure(response),
5803                        });
5804                    }
5805                    let response = {
5806                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5807                        let encoded = common::to_string(&bytes);
5808                        match serde_json::from_str(&encoded) {
5809                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5810                            Err(error) => {
5811                                dlg.response_json_decode_error(&encoded, &error);
5812                                return Err(common::Error::JsonDecodeError(
5813                                    encoded.to_string(),
5814                                    error,
5815                                ));
5816                            }
5817                        }
5818                    };
5819
5820                    dlg.finished(true);
5821                    return Ok(response);
5822                }
5823            }
5824        }
5825    }
5826
5827    /// The matter ID.
5828    ///
5829    /// Sets the *matter id* path property to the given value.
5830    ///
5831    /// Even though the property as already been set when instantiating this call,
5832    /// we provide this method for API completeness.
5833    pub fn matter_id(mut self, new_value: &str) -> MatterHoldGetCall<'a, C> {
5834        self._matter_id = new_value.to_string();
5835        self
5836    }
5837    /// The hold ID.
5838    ///
5839    /// Sets the *hold id* path property to the given value.
5840    ///
5841    /// Even though the property as already been set when instantiating this call,
5842    /// we provide this method for API completeness.
5843    pub fn hold_id(mut self, new_value: &str) -> MatterHoldGetCall<'a, C> {
5844        self._hold_id = new_value.to_string();
5845        self
5846    }
5847    /// The amount of detail to return for a hold.
5848    ///
5849    /// Sets the *view* query property to the given value.
5850    pub fn view(mut self, new_value: &str) -> MatterHoldGetCall<'a, C> {
5851        self._view = Some(new_value.to_string());
5852        self
5853    }
5854    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5855    /// while executing the actual API request.
5856    ///
5857    /// ````text
5858    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5859    /// ````
5860    ///
5861    /// Sets the *delegate* property to the given value.
5862    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MatterHoldGetCall<'a, C> {
5863        self._delegate = Some(new_value);
5864        self
5865    }
5866
5867    /// Set any additional parameter of the query string used in the request.
5868    /// It should be used to set parameters which are not yet available through their own
5869    /// setters.
5870    ///
5871    /// Please note that this method must not be used to set any of the known parameters
5872    /// which have their own setter method. If done anyway, the request will fail.
5873    ///
5874    /// # Additional Parameters
5875    ///
5876    /// * *$.xgafv* (query-string) - V1 error format.
5877    /// * *access_token* (query-string) - OAuth access token.
5878    /// * *alt* (query-string) - Data format for response.
5879    /// * *callback* (query-string) - JSONP
5880    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5881    /// * *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.
5882    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5883    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5884    /// * *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.
5885    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5886    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5887    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldGetCall<'a, C>
5888    where
5889        T: AsRef<str>,
5890    {
5891        self._additional_params
5892            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5893        self
5894    }
5895
5896    /// Identifies the authorization scope for the method you are building.
5897    ///
5898    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5899    /// [`Scope::EdiscoveryReadonly`].
5900    ///
5901    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5902    /// tokens for more than one scope.
5903    ///
5904    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5905    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5906    /// sufficient, a read-write scope will do as well.
5907    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldGetCall<'a, C>
5908    where
5909        St: AsRef<str>,
5910    {
5911        self._scopes.insert(String::from(scope.as_ref()));
5912        self
5913    }
5914    /// Identifies the authorization scope(s) for the method you are building.
5915    ///
5916    /// See [`Self::add_scope()`] for details.
5917    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldGetCall<'a, C>
5918    where
5919        I: IntoIterator<Item = St>,
5920        St: AsRef<str>,
5921    {
5922        self._scopes
5923            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5924        self
5925    }
5926
5927    /// Removes all scopes, and no default scope will be used either.
5928    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5929    /// for details).
5930    pub fn clear_scopes(mut self) -> MatterHoldGetCall<'a, C> {
5931        self._scopes.clear();
5932        self
5933    }
5934}
5935
5936/// Lists the holds in a matter.
5937///
5938/// A builder for the *holds.list* method supported by a *matter* resource.
5939/// It is not used directly, but through a [`MatterMethods`] instance.
5940///
5941/// # Example
5942///
5943/// Instantiate a resource method builder
5944///
5945/// ```test_harness,no_run
5946/// # extern crate hyper;
5947/// # extern crate hyper_rustls;
5948/// # extern crate google_vault1 as vault1;
5949/// # async fn dox() {
5950/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5951///
5952/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5953/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5954/// #     .with_native_roots()
5955/// #     .unwrap()
5956/// #     .https_only()
5957/// #     .enable_http2()
5958/// #     .build();
5959///
5960/// # let executor = hyper_util::rt::TokioExecutor::new();
5961/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5962/// #     secret,
5963/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5964/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5965/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5966/// #     ),
5967/// # ).build().await.unwrap();
5968///
5969/// # let client = hyper_util::client::legacy::Client::builder(
5970/// #     hyper_util::rt::TokioExecutor::new()
5971/// # )
5972/// # .build(
5973/// #     hyper_rustls::HttpsConnectorBuilder::new()
5974/// #         .with_native_roots()
5975/// #         .unwrap()
5976/// #         .https_or_http()
5977/// #         .enable_http2()
5978/// #         .build()
5979/// # );
5980/// # let mut hub = Vault::new(client, auth);
5981/// // You can configure optional parameters by calling the respective setters at will, and
5982/// // execute the final call using `doit()`.
5983/// // Values shown here are possibly random and not representative !
5984/// let result = hub.matters().holds_list("matterId")
5985///              .view("eos")
5986///              .page_token("labore")
5987///              .page_size(-43)
5988///              .doit().await;
5989/// # }
5990/// ```
5991pub struct MatterHoldListCall<'a, C>
5992where
5993    C: 'a,
5994{
5995    hub: &'a Vault<C>,
5996    _matter_id: String,
5997    _view: Option<String>,
5998    _page_token: Option<String>,
5999    _page_size: Option<i32>,
6000    _delegate: Option<&'a mut dyn common::Delegate>,
6001    _additional_params: HashMap<String, String>,
6002    _scopes: BTreeSet<String>,
6003}
6004
6005impl<'a, C> common::CallBuilder for MatterHoldListCall<'a, C> {}
6006
6007impl<'a, C> MatterHoldListCall<'a, C>
6008where
6009    C: common::Connector,
6010{
6011    /// Perform the operation you have build so far.
6012    pub async fn doit(mut self) -> common::Result<(common::Response, ListHoldsResponse)> {
6013        use std::borrow::Cow;
6014        use std::io::{Read, Seek};
6015
6016        use common::{url::Params, ToParts};
6017        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6018
6019        let mut dd = common::DefaultDelegate;
6020        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6021        dlg.begin(common::MethodInfo {
6022            id: "vault.matters.holds.list",
6023            http_method: hyper::Method::GET,
6024        });
6025
6026        for &field in ["alt", "matterId", "view", "pageToken", "pageSize"].iter() {
6027            if self._additional_params.contains_key(field) {
6028                dlg.finished(false);
6029                return Err(common::Error::FieldClash(field));
6030            }
6031        }
6032
6033        let mut params = Params::with_capacity(6 + self._additional_params.len());
6034        params.push("matterId", self._matter_id);
6035        if let Some(value) = self._view.as_ref() {
6036            params.push("view", value);
6037        }
6038        if let Some(value) = self._page_token.as_ref() {
6039            params.push("pageToken", value);
6040        }
6041        if let Some(value) = self._page_size.as_ref() {
6042            params.push("pageSize", value.to_string());
6043        }
6044
6045        params.extend(self._additional_params.iter());
6046
6047        params.push("alt", "json");
6048        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/holds";
6049        if self._scopes.is_empty() {
6050            self._scopes
6051                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
6052        }
6053
6054        #[allow(clippy::single_element_loop)]
6055        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
6056            url = params.uri_replacement(url, param_name, find_this, false);
6057        }
6058        {
6059            let to_remove = ["matterId"];
6060            params.remove_params(&to_remove);
6061        }
6062
6063        let url = params.parse_with_url(&url);
6064
6065        loop {
6066            let token = match self
6067                .hub
6068                .auth
6069                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6070                .await
6071            {
6072                Ok(token) => token,
6073                Err(e) => match dlg.token(e) {
6074                    Ok(token) => token,
6075                    Err(e) => {
6076                        dlg.finished(false);
6077                        return Err(common::Error::MissingToken(e));
6078                    }
6079                },
6080            };
6081            let mut req_result = {
6082                let client = &self.hub.client;
6083                dlg.pre_request();
6084                let mut req_builder = hyper::Request::builder()
6085                    .method(hyper::Method::GET)
6086                    .uri(url.as_str())
6087                    .header(USER_AGENT, self.hub._user_agent.clone());
6088
6089                if let Some(token) = token.as_ref() {
6090                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6091                }
6092
6093                let request = req_builder
6094                    .header(CONTENT_LENGTH, 0_u64)
6095                    .body(common::to_body::<String>(None));
6096
6097                client.request(request.unwrap()).await
6098            };
6099
6100            match req_result {
6101                Err(err) => {
6102                    if let common::Retry::After(d) = dlg.http_error(&err) {
6103                        sleep(d).await;
6104                        continue;
6105                    }
6106                    dlg.finished(false);
6107                    return Err(common::Error::HttpError(err));
6108                }
6109                Ok(res) => {
6110                    let (mut parts, body) = res.into_parts();
6111                    let mut body = common::Body::new(body);
6112                    if !parts.status.is_success() {
6113                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6114                        let error = serde_json::from_str(&common::to_string(&bytes));
6115                        let response = common::to_response(parts, bytes.into());
6116
6117                        if let common::Retry::After(d) =
6118                            dlg.http_failure(&response, error.as_ref().ok())
6119                        {
6120                            sleep(d).await;
6121                            continue;
6122                        }
6123
6124                        dlg.finished(false);
6125
6126                        return Err(match error {
6127                            Ok(value) => common::Error::BadRequest(value),
6128                            _ => common::Error::Failure(response),
6129                        });
6130                    }
6131                    let response = {
6132                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6133                        let encoded = common::to_string(&bytes);
6134                        match serde_json::from_str(&encoded) {
6135                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6136                            Err(error) => {
6137                                dlg.response_json_decode_error(&encoded, &error);
6138                                return Err(common::Error::JsonDecodeError(
6139                                    encoded.to_string(),
6140                                    error,
6141                                ));
6142                            }
6143                        }
6144                    };
6145
6146                    dlg.finished(true);
6147                    return Ok(response);
6148                }
6149            }
6150        }
6151    }
6152
6153    /// The matter ID.
6154    ///
6155    /// Sets the *matter id* path property to the given value.
6156    ///
6157    /// Even though the property as already been set when instantiating this call,
6158    /// we provide this method for API completeness.
6159    pub fn matter_id(mut self, new_value: &str) -> MatterHoldListCall<'a, C> {
6160        self._matter_id = new_value.to_string();
6161        self
6162    }
6163    /// The amount of detail to return for a hold.
6164    ///
6165    /// Sets the *view* query property to the given value.
6166    pub fn view(mut self, new_value: &str) -> MatterHoldListCall<'a, C> {
6167        self._view = Some(new_value.to_string());
6168        self
6169    }
6170    /// The pagination token as returned in the response. An empty token means start from the beginning.
6171    ///
6172    /// Sets the *page token* query property to the given value.
6173    pub fn page_token(mut self, new_value: &str) -> MatterHoldListCall<'a, C> {
6174        self._page_token = Some(new_value.to_string());
6175        self
6176    }
6177    /// The number of holds to return in the response, between 0 and 100 inclusive. Leaving this empty, or as 0, is the same as **page_size** = 100.
6178    ///
6179    /// Sets the *page size* query property to the given value.
6180    pub fn page_size(mut self, new_value: i32) -> MatterHoldListCall<'a, C> {
6181        self._page_size = Some(new_value);
6182        self
6183    }
6184    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6185    /// while executing the actual API request.
6186    ///
6187    /// ````text
6188    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6189    /// ````
6190    ///
6191    /// Sets the *delegate* property to the given value.
6192    pub fn delegate(
6193        mut self,
6194        new_value: &'a mut dyn common::Delegate,
6195    ) -> MatterHoldListCall<'a, C> {
6196        self._delegate = Some(new_value);
6197        self
6198    }
6199
6200    /// Set any additional parameter of the query string used in the request.
6201    /// It should be used to set parameters which are not yet available through their own
6202    /// setters.
6203    ///
6204    /// Please note that this method must not be used to set any of the known parameters
6205    /// which have their own setter method. If done anyway, the request will fail.
6206    ///
6207    /// # Additional Parameters
6208    ///
6209    /// * *$.xgafv* (query-string) - V1 error format.
6210    /// * *access_token* (query-string) - OAuth access token.
6211    /// * *alt* (query-string) - Data format for response.
6212    /// * *callback* (query-string) - JSONP
6213    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6214    /// * *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.
6215    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6216    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6217    /// * *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.
6218    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6219    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6220    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldListCall<'a, C>
6221    where
6222        T: AsRef<str>,
6223    {
6224        self._additional_params
6225            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6226        self
6227    }
6228
6229    /// Identifies the authorization scope for the method you are building.
6230    ///
6231    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6232    /// [`Scope::EdiscoveryReadonly`].
6233    ///
6234    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6235    /// tokens for more than one scope.
6236    ///
6237    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6238    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6239    /// sufficient, a read-write scope will do as well.
6240    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldListCall<'a, C>
6241    where
6242        St: AsRef<str>,
6243    {
6244        self._scopes.insert(String::from(scope.as_ref()));
6245        self
6246    }
6247    /// Identifies the authorization scope(s) for the method you are building.
6248    ///
6249    /// See [`Self::add_scope()`] for details.
6250    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldListCall<'a, C>
6251    where
6252        I: IntoIterator<Item = St>,
6253        St: AsRef<str>,
6254    {
6255        self._scopes
6256            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6257        self
6258    }
6259
6260    /// Removes all scopes, and no default scope will be used either.
6261    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6262    /// for details).
6263    pub fn clear_scopes(mut self) -> MatterHoldListCall<'a, C> {
6264        self._scopes.clear();
6265        self
6266    }
6267}
6268
6269/// Removes the specified accounts from a hold. Returns a list of statuses in the same order as the request.
6270///
6271/// A builder for the *holds.removeHeldAccounts* method supported by a *matter* resource.
6272/// It is not used directly, but through a [`MatterMethods`] instance.
6273///
6274/// # Example
6275///
6276/// Instantiate a resource method builder
6277///
6278/// ```test_harness,no_run
6279/// # extern crate hyper;
6280/// # extern crate hyper_rustls;
6281/// # extern crate google_vault1 as vault1;
6282/// use vault1::api::RemoveHeldAccountsRequest;
6283/// # async fn dox() {
6284/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6285///
6286/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6287/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6288/// #     .with_native_roots()
6289/// #     .unwrap()
6290/// #     .https_only()
6291/// #     .enable_http2()
6292/// #     .build();
6293///
6294/// # let executor = hyper_util::rt::TokioExecutor::new();
6295/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6296/// #     secret,
6297/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6298/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6299/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6300/// #     ),
6301/// # ).build().await.unwrap();
6302///
6303/// # let client = hyper_util::client::legacy::Client::builder(
6304/// #     hyper_util::rt::TokioExecutor::new()
6305/// # )
6306/// # .build(
6307/// #     hyper_rustls::HttpsConnectorBuilder::new()
6308/// #         .with_native_roots()
6309/// #         .unwrap()
6310/// #         .https_or_http()
6311/// #         .enable_http2()
6312/// #         .build()
6313/// # );
6314/// # let mut hub = Vault::new(client, auth);
6315/// // As the method needs a request, you would usually fill it with the desired information
6316/// // into the respective structure. Some of the parts shown here might not be applicable !
6317/// // Values shown here are possibly random and not representative !
6318/// let mut req = RemoveHeldAccountsRequest::default();
6319///
6320/// // You can configure optional parameters by calling the respective setters at will, and
6321/// // execute the final call using `doit()`.
6322/// // Values shown here are possibly random and not representative !
6323/// let result = hub.matters().holds_remove_held_accounts(req, "matterId", "holdId")
6324///              .doit().await;
6325/// # }
6326/// ```
6327pub struct MatterHoldRemoveHeldAccountCall<'a, C>
6328where
6329    C: 'a,
6330{
6331    hub: &'a Vault<C>,
6332    _request: RemoveHeldAccountsRequest,
6333    _matter_id: String,
6334    _hold_id: String,
6335    _delegate: Option<&'a mut dyn common::Delegate>,
6336    _additional_params: HashMap<String, String>,
6337    _scopes: BTreeSet<String>,
6338}
6339
6340impl<'a, C> common::CallBuilder for MatterHoldRemoveHeldAccountCall<'a, C> {}
6341
6342impl<'a, C> MatterHoldRemoveHeldAccountCall<'a, C>
6343where
6344    C: common::Connector,
6345{
6346    /// Perform the operation you have build so far.
6347    pub async fn doit(mut self) -> common::Result<(common::Response, RemoveHeldAccountsResponse)> {
6348        use std::borrow::Cow;
6349        use std::io::{Read, Seek};
6350
6351        use common::{url::Params, ToParts};
6352        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6353
6354        let mut dd = common::DefaultDelegate;
6355        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6356        dlg.begin(common::MethodInfo {
6357            id: "vault.matters.holds.removeHeldAccounts",
6358            http_method: hyper::Method::POST,
6359        });
6360
6361        for &field in ["alt", "matterId", "holdId"].iter() {
6362            if self._additional_params.contains_key(field) {
6363                dlg.finished(false);
6364                return Err(common::Error::FieldClash(field));
6365            }
6366        }
6367
6368        let mut params = Params::with_capacity(5 + self._additional_params.len());
6369        params.push("matterId", self._matter_id);
6370        params.push("holdId", self._hold_id);
6371
6372        params.extend(self._additional_params.iter());
6373
6374        params.push("alt", "json");
6375        let mut url =
6376            self.hub._base_url.clone() + "v1/matters/{matterId}/holds/{holdId}:removeHeldAccounts";
6377        if self._scopes.is_empty() {
6378            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
6379        }
6380
6381        #[allow(clippy::single_element_loop)]
6382        for &(find_this, param_name) in [("{matterId}", "matterId"), ("{holdId}", "holdId")].iter()
6383        {
6384            url = params.uri_replacement(url, param_name, find_this, false);
6385        }
6386        {
6387            let to_remove = ["holdId", "matterId"];
6388            params.remove_params(&to_remove);
6389        }
6390
6391        let url = params.parse_with_url(&url);
6392
6393        let mut json_mime_type = mime::APPLICATION_JSON;
6394        let mut request_value_reader = {
6395            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6396            common::remove_json_null_values(&mut value);
6397            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6398            serde_json::to_writer(&mut dst, &value).unwrap();
6399            dst
6400        };
6401        let request_size = request_value_reader
6402            .seek(std::io::SeekFrom::End(0))
6403            .unwrap();
6404        request_value_reader
6405            .seek(std::io::SeekFrom::Start(0))
6406            .unwrap();
6407
6408        loop {
6409            let token = match self
6410                .hub
6411                .auth
6412                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6413                .await
6414            {
6415                Ok(token) => token,
6416                Err(e) => match dlg.token(e) {
6417                    Ok(token) => token,
6418                    Err(e) => {
6419                        dlg.finished(false);
6420                        return Err(common::Error::MissingToken(e));
6421                    }
6422                },
6423            };
6424            request_value_reader
6425                .seek(std::io::SeekFrom::Start(0))
6426                .unwrap();
6427            let mut req_result = {
6428                let client = &self.hub.client;
6429                dlg.pre_request();
6430                let mut req_builder = hyper::Request::builder()
6431                    .method(hyper::Method::POST)
6432                    .uri(url.as_str())
6433                    .header(USER_AGENT, self.hub._user_agent.clone());
6434
6435                if let Some(token) = token.as_ref() {
6436                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6437                }
6438
6439                let request = req_builder
6440                    .header(CONTENT_TYPE, json_mime_type.to_string())
6441                    .header(CONTENT_LENGTH, request_size as u64)
6442                    .body(common::to_body(
6443                        request_value_reader.get_ref().clone().into(),
6444                    ));
6445
6446                client.request(request.unwrap()).await
6447            };
6448
6449            match req_result {
6450                Err(err) => {
6451                    if let common::Retry::After(d) = dlg.http_error(&err) {
6452                        sleep(d).await;
6453                        continue;
6454                    }
6455                    dlg.finished(false);
6456                    return Err(common::Error::HttpError(err));
6457                }
6458                Ok(res) => {
6459                    let (mut parts, body) = res.into_parts();
6460                    let mut body = common::Body::new(body);
6461                    if !parts.status.is_success() {
6462                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6463                        let error = serde_json::from_str(&common::to_string(&bytes));
6464                        let response = common::to_response(parts, bytes.into());
6465
6466                        if let common::Retry::After(d) =
6467                            dlg.http_failure(&response, error.as_ref().ok())
6468                        {
6469                            sleep(d).await;
6470                            continue;
6471                        }
6472
6473                        dlg.finished(false);
6474
6475                        return Err(match error {
6476                            Ok(value) => common::Error::BadRequest(value),
6477                            _ => common::Error::Failure(response),
6478                        });
6479                    }
6480                    let response = {
6481                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6482                        let encoded = common::to_string(&bytes);
6483                        match serde_json::from_str(&encoded) {
6484                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6485                            Err(error) => {
6486                                dlg.response_json_decode_error(&encoded, &error);
6487                                return Err(common::Error::JsonDecodeError(
6488                                    encoded.to_string(),
6489                                    error,
6490                                ));
6491                            }
6492                        }
6493                    };
6494
6495                    dlg.finished(true);
6496                    return Ok(response);
6497                }
6498            }
6499        }
6500    }
6501
6502    ///
6503    /// Sets the *request* property to the given value.
6504    ///
6505    /// Even though the property as already been set when instantiating this call,
6506    /// we provide this method for API completeness.
6507    pub fn request(
6508        mut self,
6509        new_value: RemoveHeldAccountsRequest,
6510    ) -> MatterHoldRemoveHeldAccountCall<'a, C> {
6511        self._request = new_value;
6512        self
6513    }
6514    /// The matter ID.
6515    ///
6516    /// Sets the *matter id* path property to the given value.
6517    ///
6518    /// Even though the property as already been set when instantiating this call,
6519    /// we provide this method for API completeness.
6520    pub fn matter_id(mut self, new_value: &str) -> MatterHoldRemoveHeldAccountCall<'a, C> {
6521        self._matter_id = new_value.to_string();
6522        self
6523    }
6524    /// The hold ID.
6525    ///
6526    /// Sets the *hold id* path property to the given value.
6527    ///
6528    /// Even though the property as already been set when instantiating this call,
6529    /// we provide this method for API completeness.
6530    pub fn hold_id(mut self, new_value: &str) -> MatterHoldRemoveHeldAccountCall<'a, C> {
6531        self._hold_id = new_value.to_string();
6532        self
6533    }
6534    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6535    /// while executing the actual API request.
6536    ///
6537    /// ````text
6538    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6539    /// ````
6540    ///
6541    /// Sets the *delegate* property to the given value.
6542    pub fn delegate(
6543        mut self,
6544        new_value: &'a mut dyn common::Delegate,
6545    ) -> MatterHoldRemoveHeldAccountCall<'a, C> {
6546        self._delegate = Some(new_value);
6547        self
6548    }
6549
6550    /// Set any additional parameter of the query string used in the request.
6551    /// It should be used to set parameters which are not yet available through their own
6552    /// setters.
6553    ///
6554    /// Please note that this method must not be used to set any of the known parameters
6555    /// which have their own setter method. If done anyway, the request will fail.
6556    ///
6557    /// # Additional Parameters
6558    ///
6559    /// * *$.xgafv* (query-string) - V1 error format.
6560    /// * *access_token* (query-string) - OAuth access token.
6561    /// * *alt* (query-string) - Data format for response.
6562    /// * *callback* (query-string) - JSONP
6563    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6564    /// * *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.
6565    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6566    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6567    /// * *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.
6568    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6569    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6570    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldRemoveHeldAccountCall<'a, C>
6571    where
6572        T: AsRef<str>,
6573    {
6574        self._additional_params
6575            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6576        self
6577    }
6578
6579    /// Identifies the authorization scope for the method you are building.
6580    ///
6581    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6582    /// [`Scope::Ediscovery`].
6583    ///
6584    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6585    /// tokens for more than one scope.
6586    ///
6587    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6588    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6589    /// sufficient, a read-write scope will do as well.
6590    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldRemoveHeldAccountCall<'a, C>
6591    where
6592        St: AsRef<str>,
6593    {
6594        self._scopes.insert(String::from(scope.as_ref()));
6595        self
6596    }
6597    /// Identifies the authorization scope(s) for the method you are building.
6598    ///
6599    /// See [`Self::add_scope()`] for details.
6600    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldRemoveHeldAccountCall<'a, C>
6601    where
6602        I: IntoIterator<Item = St>,
6603        St: AsRef<str>,
6604    {
6605        self._scopes
6606            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6607        self
6608    }
6609
6610    /// Removes all scopes, and no default scope will be used either.
6611    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6612    /// for details).
6613    pub fn clear_scopes(mut self) -> MatterHoldRemoveHeldAccountCall<'a, C> {
6614        self._scopes.clear();
6615        self
6616    }
6617}
6618
6619/// Updates the scope (organizational unit or accounts) and query parameters of a hold. You cannot add accounts to a hold that covers an organizational unit, nor can you add organizational units to a hold that covers individual accounts. If you try, the unsupported values are ignored.
6620///
6621/// A builder for the *holds.update* method supported by a *matter* resource.
6622/// It is not used directly, but through a [`MatterMethods`] instance.
6623///
6624/// # Example
6625///
6626/// Instantiate a resource method builder
6627///
6628/// ```test_harness,no_run
6629/// # extern crate hyper;
6630/// # extern crate hyper_rustls;
6631/// # extern crate google_vault1 as vault1;
6632/// use vault1::api::Hold;
6633/// # async fn dox() {
6634/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6635///
6636/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6637/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6638/// #     .with_native_roots()
6639/// #     .unwrap()
6640/// #     .https_only()
6641/// #     .enable_http2()
6642/// #     .build();
6643///
6644/// # let executor = hyper_util::rt::TokioExecutor::new();
6645/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6646/// #     secret,
6647/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6648/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6649/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6650/// #     ),
6651/// # ).build().await.unwrap();
6652///
6653/// # let client = hyper_util::client::legacy::Client::builder(
6654/// #     hyper_util::rt::TokioExecutor::new()
6655/// # )
6656/// # .build(
6657/// #     hyper_rustls::HttpsConnectorBuilder::new()
6658/// #         .with_native_roots()
6659/// #         .unwrap()
6660/// #         .https_or_http()
6661/// #         .enable_http2()
6662/// #         .build()
6663/// # );
6664/// # let mut hub = Vault::new(client, auth);
6665/// // As the method needs a request, you would usually fill it with the desired information
6666/// // into the respective structure. Some of the parts shown here might not be applicable !
6667/// // Values shown here are possibly random and not representative !
6668/// let mut req = Hold::default();
6669///
6670/// // You can configure optional parameters by calling the respective setters at will, and
6671/// // execute the final call using `doit()`.
6672/// // Values shown here are possibly random and not representative !
6673/// let result = hub.matters().holds_update(req, "matterId", "holdId")
6674///              .doit().await;
6675/// # }
6676/// ```
6677pub struct MatterHoldUpdateCall<'a, C>
6678where
6679    C: 'a,
6680{
6681    hub: &'a Vault<C>,
6682    _request: Hold,
6683    _matter_id: String,
6684    _hold_id: String,
6685    _delegate: Option<&'a mut dyn common::Delegate>,
6686    _additional_params: HashMap<String, String>,
6687    _scopes: BTreeSet<String>,
6688}
6689
6690impl<'a, C> common::CallBuilder for MatterHoldUpdateCall<'a, C> {}
6691
6692impl<'a, C> MatterHoldUpdateCall<'a, C>
6693where
6694    C: common::Connector,
6695{
6696    /// Perform the operation you have build so far.
6697    pub async fn doit(mut self) -> common::Result<(common::Response, Hold)> {
6698        use std::borrow::Cow;
6699        use std::io::{Read, Seek};
6700
6701        use common::{url::Params, ToParts};
6702        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6703
6704        let mut dd = common::DefaultDelegate;
6705        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6706        dlg.begin(common::MethodInfo {
6707            id: "vault.matters.holds.update",
6708            http_method: hyper::Method::PUT,
6709        });
6710
6711        for &field in ["alt", "matterId", "holdId"].iter() {
6712            if self._additional_params.contains_key(field) {
6713                dlg.finished(false);
6714                return Err(common::Error::FieldClash(field));
6715            }
6716        }
6717
6718        let mut params = Params::with_capacity(5 + self._additional_params.len());
6719        params.push("matterId", self._matter_id);
6720        params.push("holdId", self._hold_id);
6721
6722        params.extend(self._additional_params.iter());
6723
6724        params.push("alt", "json");
6725        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/holds/{holdId}";
6726        if self._scopes.is_empty() {
6727            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
6728        }
6729
6730        #[allow(clippy::single_element_loop)]
6731        for &(find_this, param_name) in [("{matterId}", "matterId"), ("{holdId}", "holdId")].iter()
6732        {
6733            url = params.uri_replacement(url, param_name, find_this, false);
6734        }
6735        {
6736            let to_remove = ["holdId", "matterId"];
6737            params.remove_params(&to_remove);
6738        }
6739
6740        let url = params.parse_with_url(&url);
6741
6742        let mut json_mime_type = mime::APPLICATION_JSON;
6743        let mut request_value_reader = {
6744            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6745            common::remove_json_null_values(&mut value);
6746            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6747            serde_json::to_writer(&mut dst, &value).unwrap();
6748            dst
6749        };
6750        let request_size = request_value_reader
6751            .seek(std::io::SeekFrom::End(0))
6752            .unwrap();
6753        request_value_reader
6754            .seek(std::io::SeekFrom::Start(0))
6755            .unwrap();
6756
6757        loop {
6758            let token = match self
6759                .hub
6760                .auth
6761                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6762                .await
6763            {
6764                Ok(token) => token,
6765                Err(e) => match dlg.token(e) {
6766                    Ok(token) => token,
6767                    Err(e) => {
6768                        dlg.finished(false);
6769                        return Err(common::Error::MissingToken(e));
6770                    }
6771                },
6772            };
6773            request_value_reader
6774                .seek(std::io::SeekFrom::Start(0))
6775                .unwrap();
6776            let mut req_result = {
6777                let client = &self.hub.client;
6778                dlg.pre_request();
6779                let mut req_builder = hyper::Request::builder()
6780                    .method(hyper::Method::PUT)
6781                    .uri(url.as_str())
6782                    .header(USER_AGENT, self.hub._user_agent.clone());
6783
6784                if let Some(token) = token.as_ref() {
6785                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6786                }
6787
6788                let request = req_builder
6789                    .header(CONTENT_TYPE, json_mime_type.to_string())
6790                    .header(CONTENT_LENGTH, request_size as u64)
6791                    .body(common::to_body(
6792                        request_value_reader.get_ref().clone().into(),
6793                    ));
6794
6795                client.request(request.unwrap()).await
6796            };
6797
6798            match req_result {
6799                Err(err) => {
6800                    if let common::Retry::After(d) = dlg.http_error(&err) {
6801                        sleep(d).await;
6802                        continue;
6803                    }
6804                    dlg.finished(false);
6805                    return Err(common::Error::HttpError(err));
6806                }
6807                Ok(res) => {
6808                    let (mut parts, body) = res.into_parts();
6809                    let mut body = common::Body::new(body);
6810                    if !parts.status.is_success() {
6811                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6812                        let error = serde_json::from_str(&common::to_string(&bytes));
6813                        let response = common::to_response(parts, bytes.into());
6814
6815                        if let common::Retry::After(d) =
6816                            dlg.http_failure(&response, error.as_ref().ok())
6817                        {
6818                            sleep(d).await;
6819                            continue;
6820                        }
6821
6822                        dlg.finished(false);
6823
6824                        return Err(match error {
6825                            Ok(value) => common::Error::BadRequest(value),
6826                            _ => common::Error::Failure(response),
6827                        });
6828                    }
6829                    let response = {
6830                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6831                        let encoded = common::to_string(&bytes);
6832                        match serde_json::from_str(&encoded) {
6833                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6834                            Err(error) => {
6835                                dlg.response_json_decode_error(&encoded, &error);
6836                                return Err(common::Error::JsonDecodeError(
6837                                    encoded.to_string(),
6838                                    error,
6839                                ));
6840                            }
6841                        }
6842                    };
6843
6844                    dlg.finished(true);
6845                    return Ok(response);
6846                }
6847            }
6848        }
6849    }
6850
6851    ///
6852    /// Sets the *request* property to the given value.
6853    ///
6854    /// Even though the property as already been set when instantiating this call,
6855    /// we provide this method for API completeness.
6856    pub fn request(mut self, new_value: Hold) -> MatterHoldUpdateCall<'a, C> {
6857        self._request = new_value;
6858        self
6859    }
6860    /// The matter ID.
6861    ///
6862    /// Sets the *matter id* path property to the given value.
6863    ///
6864    /// Even though the property as already been set when instantiating this call,
6865    /// we provide this method for API completeness.
6866    pub fn matter_id(mut self, new_value: &str) -> MatterHoldUpdateCall<'a, C> {
6867        self._matter_id = new_value.to_string();
6868        self
6869    }
6870    /// The ID of the hold.
6871    ///
6872    /// Sets the *hold id* path property to the given value.
6873    ///
6874    /// Even though the property as already been set when instantiating this call,
6875    /// we provide this method for API completeness.
6876    pub fn hold_id(mut self, new_value: &str) -> MatterHoldUpdateCall<'a, C> {
6877        self._hold_id = new_value.to_string();
6878        self
6879    }
6880    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6881    /// while executing the actual API request.
6882    ///
6883    /// ````text
6884    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6885    /// ````
6886    ///
6887    /// Sets the *delegate* property to the given value.
6888    pub fn delegate(
6889        mut self,
6890        new_value: &'a mut dyn common::Delegate,
6891    ) -> MatterHoldUpdateCall<'a, C> {
6892        self._delegate = Some(new_value);
6893        self
6894    }
6895
6896    /// Set any additional parameter of the query string used in the request.
6897    /// It should be used to set parameters which are not yet available through their own
6898    /// setters.
6899    ///
6900    /// Please note that this method must not be used to set any of the known parameters
6901    /// which have their own setter method. If done anyway, the request will fail.
6902    ///
6903    /// # Additional Parameters
6904    ///
6905    /// * *$.xgafv* (query-string) - V1 error format.
6906    /// * *access_token* (query-string) - OAuth access token.
6907    /// * *alt* (query-string) - Data format for response.
6908    /// * *callback* (query-string) - JSONP
6909    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6910    /// * *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.
6911    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6912    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6913    /// * *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.
6914    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6915    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6916    pub fn param<T>(mut self, name: T, value: T) -> MatterHoldUpdateCall<'a, C>
6917    where
6918        T: AsRef<str>,
6919    {
6920        self._additional_params
6921            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6922        self
6923    }
6924
6925    /// Identifies the authorization scope for the method you are building.
6926    ///
6927    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6928    /// [`Scope::Ediscovery`].
6929    ///
6930    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6931    /// tokens for more than one scope.
6932    ///
6933    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6934    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6935    /// sufficient, a read-write scope will do as well.
6936    pub fn add_scope<St>(mut self, scope: St) -> MatterHoldUpdateCall<'a, C>
6937    where
6938        St: AsRef<str>,
6939    {
6940        self._scopes.insert(String::from(scope.as_ref()));
6941        self
6942    }
6943    /// Identifies the authorization scope(s) for the method you are building.
6944    ///
6945    /// See [`Self::add_scope()`] for details.
6946    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterHoldUpdateCall<'a, C>
6947    where
6948        I: IntoIterator<Item = St>,
6949        St: AsRef<str>,
6950    {
6951        self._scopes
6952            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6953        self
6954    }
6955
6956    /// Removes all scopes, and no default scope will be used either.
6957    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6958    /// for details).
6959    pub fn clear_scopes(mut self) -> MatterHoldUpdateCall<'a, C> {
6960        self._scopes.clear();
6961        self
6962    }
6963}
6964
6965/// Creates a saved query.
6966///
6967/// A builder for the *savedQueries.create* method supported by a *matter* resource.
6968/// It is not used directly, but through a [`MatterMethods`] instance.
6969///
6970/// # Example
6971///
6972/// Instantiate a resource method builder
6973///
6974/// ```test_harness,no_run
6975/// # extern crate hyper;
6976/// # extern crate hyper_rustls;
6977/// # extern crate google_vault1 as vault1;
6978/// use vault1::api::SavedQuery;
6979/// # async fn dox() {
6980/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6981///
6982/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6983/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6984/// #     .with_native_roots()
6985/// #     .unwrap()
6986/// #     .https_only()
6987/// #     .enable_http2()
6988/// #     .build();
6989///
6990/// # let executor = hyper_util::rt::TokioExecutor::new();
6991/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6992/// #     secret,
6993/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6994/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6995/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6996/// #     ),
6997/// # ).build().await.unwrap();
6998///
6999/// # let client = hyper_util::client::legacy::Client::builder(
7000/// #     hyper_util::rt::TokioExecutor::new()
7001/// # )
7002/// # .build(
7003/// #     hyper_rustls::HttpsConnectorBuilder::new()
7004/// #         .with_native_roots()
7005/// #         .unwrap()
7006/// #         .https_or_http()
7007/// #         .enable_http2()
7008/// #         .build()
7009/// # );
7010/// # let mut hub = Vault::new(client, auth);
7011/// // As the method needs a request, you would usually fill it with the desired information
7012/// // into the respective structure. Some of the parts shown here might not be applicable !
7013/// // Values shown here are possibly random and not representative !
7014/// let mut req = SavedQuery::default();
7015///
7016/// // You can configure optional parameters by calling the respective setters at will, and
7017/// // execute the final call using `doit()`.
7018/// // Values shown here are possibly random and not representative !
7019/// let result = hub.matters().saved_queries_create(req, "matterId")
7020///              .doit().await;
7021/// # }
7022/// ```
7023pub struct MatterSavedQueryCreateCall<'a, C>
7024where
7025    C: 'a,
7026{
7027    hub: &'a Vault<C>,
7028    _request: SavedQuery,
7029    _matter_id: String,
7030    _delegate: Option<&'a mut dyn common::Delegate>,
7031    _additional_params: HashMap<String, String>,
7032    _scopes: BTreeSet<String>,
7033}
7034
7035impl<'a, C> common::CallBuilder for MatterSavedQueryCreateCall<'a, C> {}
7036
7037impl<'a, C> MatterSavedQueryCreateCall<'a, C>
7038where
7039    C: common::Connector,
7040{
7041    /// Perform the operation you have build so far.
7042    pub async fn doit(mut self) -> common::Result<(common::Response, SavedQuery)> {
7043        use std::borrow::Cow;
7044        use std::io::{Read, Seek};
7045
7046        use common::{url::Params, ToParts};
7047        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7048
7049        let mut dd = common::DefaultDelegate;
7050        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7051        dlg.begin(common::MethodInfo {
7052            id: "vault.matters.savedQueries.create",
7053            http_method: hyper::Method::POST,
7054        });
7055
7056        for &field in ["alt", "matterId"].iter() {
7057            if self._additional_params.contains_key(field) {
7058                dlg.finished(false);
7059                return Err(common::Error::FieldClash(field));
7060            }
7061        }
7062
7063        let mut params = Params::with_capacity(4 + self._additional_params.len());
7064        params.push("matterId", self._matter_id);
7065
7066        params.extend(self._additional_params.iter());
7067
7068        params.push("alt", "json");
7069        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/savedQueries";
7070        if self._scopes.is_empty() {
7071            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
7072        }
7073
7074        #[allow(clippy::single_element_loop)]
7075        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
7076            url = params.uri_replacement(url, param_name, find_this, false);
7077        }
7078        {
7079            let to_remove = ["matterId"];
7080            params.remove_params(&to_remove);
7081        }
7082
7083        let url = params.parse_with_url(&url);
7084
7085        let mut json_mime_type = mime::APPLICATION_JSON;
7086        let mut request_value_reader = {
7087            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7088            common::remove_json_null_values(&mut value);
7089            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7090            serde_json::to_writer(&mut dst, &value).unwrap();
7091            dst
7092        };
7093        let request_size = request_value_reader
7094            .seek(std::io::SeekFrom::End(0))
7095            .unwrap();
7096        request_value_reader
7097            .seek(std::io::SeekFrom::Start(0))
7098            .unwrap();
7099
7100        loop {
7101            let token = match self
7102                .hub
7103                .auth
7104                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7105                .await
7106            {
7107                Ok(token) => token,
7108                Err(e) => match dlg.token(e) {
7109                    Ok(token) => token,
7110                    Err(e) => {
7111                        dlg.finished(false);
7112                        return Err(common::Error::MissingToken(e));
7113                    }
7114                },
7115            };
7116            request_value_reader
7117                .seek(std::io::SeekFrom::Start(0))
7118                .unwrap();
7119            let mut req_result = {
7120                let client = &self.hub.client;
7121                dlg.pre_request();
7122                let mut req_builder = hyper::Request::builder()
7123                    .method(hyper::Method::POST)
7124                    .uri(url.as_str())
7125                    .header(USER_AGENT, self.hub._user_agent.clone());
7126
7127                if let Some(token) = token.as_ref() {
7128                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7129                }
7130
7131                let request = req_builder
7132                    .header(CONTENT_TYPE, json_mime_type.to_string())
7133                    .header(CONTENT_LENGTH, request_size as u64)
7134                    .body(common::to_body(
7135                        request_value_reader.get_ref().clone().into(),
7136                    ));
7137
7138                client.request(request.unwrap()).await
7139            };
7140
7141            match req_result {
7142                Err(err) => {
7143                    if let common::Retry::After(d) = dlg.http_error(&err) {
7144                        sleep(d).await;
7145                        continue;
7146                    }
7147                    dlg.finished(false);
7148                    return Err(common::Error::HttpError(err));
7149                }
7150                Ok(res) => {
7151                    let (mut parts, body) = res.into_parts();
7152                    let mut body = common::Body::new(body);
7153                    if !parts.status.is_success() {
7154                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7155                        let error = serde_json::from_str(&common::to_string(&bytes));
7156                        let response = common::to_response(parts, bytes.into());
7157
7158                        if let common::Retry::After(d) =
7159                            dlg.http_failure(&response, error.as_ref().ok())
7160                        {
7161                            sleep(d).await;
7162                            continue;
7163                        }
7164
7165                        dlg.finished(false);
7166
7167                        return Err(match error {
7168                            Ok(value) => common::Error::BadRequest(value),
7169                            _ => common::Error::Failure(response),
7170                        });
7171                    }
7172                    let response = {
7173                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7174                        let encoded = common::to_string(&bytes);
7175                        match serde_json::from_str(&encoded) {
7176                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7177                            Err(error) => {
7178                                dlg.response_json_decode_error(&encoded, &error);
7179                                return Err(common::Error::JsonDecodeError(
7180                                    encoded.to_string(),
7181                                    error,
7182                                ));
7183                            }
7184                        }
7185                    };
7186
7187                    dlg.finished(true);
7188                    return Ok(response);
7189                }
7190            }
7191        }
7192    }
7193
7194    ///
7195    /// Sets the *request* property to the given value.
7196    ///
7197    /// Even though the property as already been set when instantiating this call,
7198    /// we provide this method for API completeness.
7199    pub fn request(mut self, new_value: SavedQuery) -> MatterSavedQueryCreateCall<'a, C> {
7200        self._request = new_value;
7201        self
7202    }
7203    /// The ID of the matter to create the saved query in.
7204    ///
7205    /// Sets the *matter id* path property to the given value.
7206    ///
7207    /// Even though the property as already been set when instantiating this call,
7208    /// we provide this method for API completeness.
7209    pub fn matter_id(mut self, new_value: &str) -> MatterSavedQueryCreateCall<'a, C> {
7210        self._matter_id = new_value.to_string();
7211        self
7212    }
7213    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7214    /// while executing the actual API request.
7215    ///
7216    /// ````text
7217    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7218    /// ````
7219    ///
7220    /// Sets the *delegate* property to the given value.
7221    pub fn delegate(
7222        mut self,
7223        new_value: &'a mut dyn common::Delegate,
7224    ) -> MatterSavedQueryCreateCall<'a, C> {
7225        self._delegate = Some(new_value);
7226        self
7227    }
7228
7229    /// Set any additional parameter of the query string used in the request.
7230    /// It should be used to set parameters which are not yet available through their own
7231    /// setters.
7232    ///
7233    /// Please note that this method must not be used to set any of the known parameters
7234    /// which have their own setter method. If done anyway, the request will fail.
7235    ///
7236    /// # Additional Parameters
7237    ///
7238    /// * *$.xgafv* (query-string) - V1 error format.
7239    /// * *access_token* (query-string) - OAuth access token.
7240    /// * *alt* (query-string) - Data format for response.
7241    /// * *callback* (query-string) - JSONP
7242    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7243    /// * *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.
7244    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7245    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7246    /// * *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.
7247    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7248    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7249    pub fn param<T>(mut self, name: T, value: T) -> MatterSavedQueryCreateCall<'a, C>
7250    where
7251        T: AsRef<str>,
7252    {
7253        self._additional_params
7254            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7255        self
7256    }
7257
7258    /// Identifies the authorization scope for the method you are building.
7259    ///
7260    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7261    /// [`Scope::Ediscovery`].
7262    ///
7263    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7264    /// tokens for more than one scope.
7265    ///
7266    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7267    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7268    /// sufficient, a read-write scope will do as well.
7269    pub fn add_scope<St>(mut self, scope: St) -> MatterSavedQueryCreateCall<'a, C>
7270    where
7271        St: AsRef<str>,
7272    {
7273        self._scopes.insert(String::from(scope.as_ref()));
7274        self
7275    }
7276    /// Identifies the authorization scope(s) for the method you are building.
7277    ///
7278    /// See [`Self::add_scope()`] for details.
7279    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterSavedQueryCreateCall<'a, C>
7280    where
7281        I: IntoIterator<Item = St>,
7282        St: AsRef<str>,
7283    {
7284        self._scopes
7285            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7286        self
7287    }
7288
7289    /// Removes all scopes, and no default scope will be used either.
7290    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7291    /// for details).
7292    pub fn clear_scopes(mut self) -> MatterSavedQueryCreateCall<'a, C> {
7293        self._scopes.clear();
7294        self
7295    }
7296}
7297
7298/// Deletes the specified saved query.
7299///
7300/// A builder for the *savedQueries.delete* method supported by a *matter* resource.
7301/// It is not used directly, but through a [`MatterMethods`] instance.
7302///
7303/// # Example
7304///
7305/// Instantiate a resource method builder
7306///
7307/// ```test_harness,no_run
7308/// # extern crate hyper;
7309/// # extern crate hyper_rustls;
7310/// # extern crate google_vault1 as vault1;
7311/// # async fn dox() {
7312/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7313///
7314/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7315/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7316/// #     .with_native_roots()
7317/// #     .unwrap()
7318/// #     .https_only()
7319/// #     .enable_http2()
7320/// #     .build();
7321///
7322/// # let executor = hyper_util::rt::TokioExecutor::new();
7323/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7324/// #     secret,
7325/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7326/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7327/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7328/// #     ),
7329/// # ).build().await.unwrap();
7330///
7331/// # let client = hyper_util::client::legacy::Client::builder(
7332/// #     hyper_util::rt::TokioExecutor::new()
7333/// # )
7334/// # .build(
7335/// #     hyper_rustls::HttpsConnectorBuilder::new()
7336/// #         .with_native_roots()
7337/// #         .unwrap()
7338/// #         .https_or_http()
7339/// #         .enable_http2()
7340/// #         .build()
7341/// # );
7342/// # let mut hub = Vault::new(client, auth);
7343/// // You can configure optional parameters by calling the respective setters at will, and
7344/// // execute the final call using `doit()`.
7345/// // Values shown here are possibly random and not representative !
7346/// let result = hub.matters().saved_queries_delete("matterId", "savedQueryId")
7347///              .doit().await;
7348/// # }
7349/// ```
7350pub struct MatterSavedQueryDeleteCall<'a, C>
7351where
7352    C: 'a,
7353{
7354    hub: &'a Vault<C>,
7355    _matter_id: String,
7356    _saved_query_id: String,
7357    _delegate: Option<&'a mut dyn common::Delegate>,
7358    _additional_params: HashMap<String, String>,
7359    _scopes: BTreeSet<String>,
7360}
7361
7362impl<'a, C> common::CallBuilder for MatterSavedQueryDeleteCall<'a, C> {}
7363
7364impl<'a, C> MatterSavedQueryDeleteCall<'a, C>
7365where
7366    C: common::Connector,
7367{
7368    /// Perform the operation you have build so far.
7369    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7370        use std::borrow::Cow;
7371        use std::io::{Read, Seek};
7372
7373        use common::{url::Params, ToParts};
7374        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7375
7376        let mut dd = common::DefaultDelegate;
7377        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7378        dlg.begin(common::MethodInfo {
7379            id: "vault.matters.savedQueries.delete",
7380            http_method: hyper::Method::DELETE,
7381        });
7382
7383        for &field in ["alt", "matterId", "savedQueryId"].iter() {
7384            if self._additional_params.contains_key(field) {
7385                dlg.finished(false);
7386                return Err(common::Error::FieldClash(field));
7387            }
7388        }
7389
7390        let mut params = Params::with_capacity(4 + self._additional_params.len());
7391        params.push("matterId", self._matter_id);
7392        params.push("savedQueryId", self._saved_query_id);
7393
7394        params.extend(self._additional_params.iter());
7395
7396        params.push("alt", "json");
7397        let mut url =
7398            self.hub._base_url.clone() + "v1/matters/{matterId}/savedQueries/{savedQueryId}";
7399        if self._scopes.is_empty() {
7400            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
7401        }
7402
7403        #[allow(clippy::single_element_loop)]
7404        for &(find_this, param_name) in [
7405            ("{matterId}", "matterId"),
7406            ("{savedQueryId}", "savedQueryId"),
7407        ]
7408        .iter()
7409        {
7410            url = params.uri_replacement(url, param_name, find_this, false);
7411        }
7412        {
7413            let to_remove = ["savedQueryId", "matterId"];
7414            params.remove_params(&to_remove);
7415        }
7416
7417        let url = params.parse_with_url(&url);
7418
7419        loop {
7420            let token = match self
7421                .hub
7422                .auth
7423                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7424                .await
7425            {
7426                Ok(token) => token,
7427                Err(e) => match dlg.token(e) {
7428                    Ok(token) => token,
7429                    Err(e) => {
7430                        dlg.finished(false);
7431                        return Err(common::Error::MissingToken(e));
7432                    }
7433                },
7434            };
7435            let mut req_result = {
7436                let client = &self.hub.client;
7437                dlg.pre_request();
7438                let mut req_builder = hyper::Request::builder()
7439                    .method(hyper::Method::DELETE)
7440                    .uri(url.as_str())
7441                    .header(USER_AGENT, self.hub._user_agent.clone());
7442
7443                if let Some(token) = token.as_ref() {
7444                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7445                }
7446
7447                let request = req_builder
7448                    .header(CONTENT_LENGTH, 0_u64)
7449                    .body(common::to_body::<String>(None));
7450
7451                client.request(request.unwrap()).await
7452            };
7453
7454            match req_result {
7455                Err(err) => {
7456                    if let common::Retry::After(d) = dlg.http_error(&err) {
7457                        sleep(d).await;
7458                        continue;
7459                    }
7460                    dlg.finished(false);
7461                    return Err(common::Error::HttpError(err));
7462                }
7463                Ok(res) => {
7464                    let (mut parts, body) = res.into_parts();
7465                    let mut body = common::Body::new(body);
7466                    if !parts.status.is_success() {
7467                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7468                        let error = serde_json::from_str(&common::to_string(&bytes));
7469                        let response = common::to_response(parts, bytes.into());
7470
7471                        if let common::Retry::After(d) =
7472                            dlg.http_failure(&response, error.as_ref().ok())
7473                        {
7474                            sleep(d).await;
7475                            continue;
7476                        }
7477
7478                        dlg.finished(false);
7479
7480                        return Err(match error {
7481                            Ok(value) => common::Error::BadRequest(value),
7482                            _ => common::Error::Failure(response),
7483                        });
7484                    }
7485                    let response = {
7486                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7487                        let encoded = common::to_string(&bytes);
7488                        match serde_json::from_str(&encoded) {
7489                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7490                            Err(error) => {
7491                                dlg.response_json_decode_error(&encoded, &error);
7492                                return Err(common::Error::JsonDecodeError(
7493                                    encoded.to_string(),
7494                                    error,
7495                                ));
7496                            }
7497                        }
7498                    };
7499
7500                    dlg.finished(true);
7501                    return Ok(response);
7502                }
7503            }
7504        }
7505    }
7506
7507    /// The ID of the matter to delete the saved query from.
7508    ///
7509    /// Sets the *matter id* path property to the given value.
7510    ///
7511    /// Even though the property as already been set when instantiating this call,
7512    /// we provide this method for API completeness.
7513    pub fn matter_id(mut self, new_value: &str) -> MatterSavedQueryDeleteCall<'a, C> {
7514        self._matter_id = new_value.to_string();
7515        self
7516    }
7517    /// ID of the saved query to delete.
7518    ///
7519    /// Sets the *saved query id* path property to the given value.
7520    ///
7521    /// Even though the property as already been set when instantiating this call,
7522    /// we provide this method for API completeness.
7523    pub fn saved_query_id(mut self, new_value: &str) -> MatterSavedQueryDeleteCall<'a, C> {
7524        self._saved_query_id = new_value.to_string();
7525        self
7526    }
7527    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7528    /// while executing the actual API request.
7529    ///
7530    /// ````text
7531    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7532    /// ````
7533    ///
7534    /// Sets the *delegate* property to the given value.
7535    pub fn delegate(
7536        mut self,
7537        new_value: &'a mut dyn common::Delegate,
7538    ) -> MatterSavedQueryDeleteCall<'a, C> {
7539        self._delegate = Some(new_value);
7540        self
7541    }
7542
7543    /// Set any additional parameter of the query string used in the request.
7544    /// It should be used to set parameters which are not yet available through their own
7545    /// setters.
7546    ///
7547    /// Please note that this method must not be used to set any of the known parameters
7548    /// which have their own setter method. If done anyway, the request will fail.
7549    ///
7550    /// # Additional Parameters
7551    ///
7552    /// * *$.xgafv* (query-string) - V1 error format.
7553    /// * *access_token* (query-string) - OAuth access token.
7554    /// * *alt* (query-string) - Data format for response.
7555    /// * *callback* (query-string) - JSONP
7556    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7557    /// * *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.
7558    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7559    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7560    /// * *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.
7561    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7562    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7563    pub fn param<T>(mut self, name: T, value: T) -> MatterSavedQueryDeleteCall<'a, C>
7564    where
7565        T: AsRef<str>,
7566    {
7567        self._additional_params
7568            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7569        self
7570    }
7571
7572    /// Identifies the authorization scope for the method you are building.
7573    ///
7574    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7575    /// [`Scope::Ediscovery`].
7576    ///
7577    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7578    /// tokens for more than one scope.
7579    ///
7580    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7581    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7582    /// sufficient, a read-write scope will do as well.
7583    pub fn add_scope<St>(mut self, scope: St) -> MatterSavedQueryDeleteCall<'a, C>
7584    where
7585        St: AsRef<str>,
7586    {
7587        self._scopes.insert(String::from(scope.as_ref()));
7588        self
7589    }
7590    /// Identifies the authorization scope(s) for the method you are building.
7591    ///
7592    /// See [`Self::add_scope()`] for details.
7593    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterSavedQueryDeleteCall<'a, C>
7594    where
7595        I: IntoIterator<Item = St>,
7596        St: AsRef<str>,
7597    {
7598        self._scopes
7599            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7600        self
7601    }
7602
7603    /// Removes all scopes, and no default scope will be used either.
7604    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7605    /// for details).
7606    pub fn clear_scopes(mut self) -> MatterSavedQueryDeleteCall<'a, C> {
7607        self._scopes.clear();
7608        self
7609    }
7610}
7611
7612/// Retrieves the specified saved query.
7613///
7614/// A builder for the *savedQueries.get* method supported by a *matter* resource.
7615/// It is not used directly, but through a [`MatterMethods`] instance.
7616///
7617/// # Example
7618///
7619/// Instantiate a resource method builder
7620///
7621/// ```test_harness,no_run
7622/// # extern crate hyper;
7623/// # extern crate hyper_rustls;
7624/// # extern crate google_vault1 as vault1;
7625/// # async fn dox() {
7626/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7627///
7628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7629/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7630/// #     .with_native_roots()
7631/// #     .unwrap()
7632/// #     .https_only()
7633/// #     .enable_http2()
7634/// #     .build();
7635///
7636/// # let executor = hyper_util::rt::TokioExecutor::new();
7637/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7638/// #     secret,
7639/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7640/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7641/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7642/// #     ),
7643/// # ).build().await.unwrap();
7644///
7645/// # let client = hyper_util::client::legacy::Client::builder(
7646/// #     hyper_util::rt::TokioExecutor::new()
7647/// # )
7648/// # .build(
7649/// #     hyper_rustls::HttpsConnectorBuilder::new()
7650/// #         .with_native_roots()
7651/// #         .unwrap()
7652/// #         .https_or_http()
7653/// #         .enable_http2()
7654/// #         .build()
7655/// # );
7656/// # let mut hub = Vault::new(client, auth);
7657/// // You can configure optional parameters by calling the respective setters at will, and
7658/// // execute the final call using `doit()`.
7659/// // Values shown here are possibly random and not representative !
7660/// let result = hub.matters().saved_queries_get("matterId", "savedQueryId")
7661///              .doit().await;
7662/// # }
7663/// ```
7664pub struct MatterSavedQueryGetCall<'a, C>
7665where
7666    C: 'a,
7667{
7668    hub: &'a Vault<C>,
7669    _matter_id: String,
7670    _saved_query_id: String,
7671    _delegate: Option<&'a mut dyn common::Delegate>,
7672    _additional_params: HashMap<String, String>,
7673    _scopes: BTreeSet<String>,
7674}
7675
7676impl<'a, C> common::CallBuilder for MatterSavedQueryGetCall<'a, C> {}
7677
7678impl<'a, C> MatterSavedQueryGetCall<'a, C>
7679where
7680    C: common::Connector,
7681{
7682    /// Perform the operation you have build so far.
7683    pub async fn doit(mut self) -> common::Result<(common::Response, SavedQuery)> {
7684        use std::borrow::Cow;
7685        use std::io::{Read, Seek};
7686
7687        use common::{url::Params, ToParts};
7688        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7689
7690        let mut dd = common::DefaultDelegate;
7691        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7692        dlg.begin(common::MethodInfo {
7693            id: "vault.matters.savedQueries.get",
7694            http_method: hyper::Method::GET,
7695        });
7696
7697        for &field in ["alt", "matterId", "savedQueryId"].iter() {
7698            if self._additional_params.contains_key(field) {
7699                dlg.finished(false);
7700                return Err(common::Error::FieldClash(field));
7701            }
7702        }
7703
7704        let mut params = Params::with_capacity(4 + self._additional_params.len());
7705        params.push("matterId", self._matter_id);
7706        params.push("savedQueryId", self._saved_query_id);
7707
7708        params.extend(self._additional_params.iter());
7709
7710        params.push("alt", "json");
7711        let mut url =
7712            self.hub._base_url.clone() + "v1/matters/{matterId}/savedQueries/{savedQueryId}";
7713        if self._scopes.is_empty() {
7714            self._scopes
7715                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
7716        }
7717
7718        #[allow(clippy::single_element_loop)]
7719        for &(find_this, param_name) in [
7720            ("{matterId}", "matterId"),
7721            ("{savedQueryId}", "savedQueryId"),
7722        ]
7723        .iter()
7724        {
7725            url = params.uri_replacement(url, param_name, find_this, false);
7726        }
7727        {
7728            let to_remove = ["savedQueryId", "matterId"];
7729            params.remove_params(&to_remove);
7730        }
7731
7732        let url = params.parse_with_url(&url);
7733
7734        loop {
7735            let token = match self
7736                .hub
7737                .auth
7738                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7739                .await
7740            {
7741                Ok(token) => token,
7742                Err(e) => match dlg.token(e) {
7743                    Ok(token) => token,
7744                    Err(e) => {
7745                        dlg.finished(false);
7746                        return Err(common::Error::MissingToken(e));
7747                    }
7748                },
7749            };
7750            let mut req_result = {
7751                let client = &self.hub.client;
7752                dlg.pre_request();
7753                let mut req_builder = hyper::Request::builder()
7754                    .method(hyper::Method::GET)
7755                    .uri(url.as_str())
7756                    .header(USER_AGENT, self.hub._user_agent.clone());
7757
7758                if let Some(token) = token.as_ref() {
7759                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7760                }
7761
7762                let request = req_builder
7763                    .header(CONTENT_LENGTH, 0_u64)
7764                    .body(common::to_body::<String>(None));
7765
7766                client.request(request.unwrap()).await
7767            };
7768
7769            match req_result {
7770                Err(err) => {
7771                    if let common::Retry::After(d) = dlg.http_error(&err) {
7772                        sleep(d).await;
7773                        continue;
7774                    }
7775                    dlg.finished(false);
7776                    return Err(common::Error::HttpError(err));
7777                }
7778                Ok(res) => {
7779                    let (mut parts, body) = res.into_parts();
7780                    let mut body = common::Body::new(body);
7781                    if !parts.status.is_success() {
7782                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7783                        let error = serde_json::from_str(&common::to_string(&bytes));
7784                        let response = common::to_response(parts, bytes.into());
7785
7786                        if let common::Retry::After(d) =
7787                            dlg.http_failure(&response, error.as_ref().ok())
7788                        {
7789                            sleep(d).await;
7790                            continue;
7791                        }
7792
7793                        dlg.finished(false);
7794
7795                        return Err(match error {
7796                            Ok(value) => common::Error::BadRequest(value),
7797                            _ => common::Error::Failure(response),
7798                        });
7799                    }
7800                    let response = {
7801                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7802                        let encoded = common::to_string(&bytes);
7803                        match serde_json::from_str(&encoded) {
7804                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7805                            Err(error) => {
7806                                dlg.response_json_decode_error(&encoded, &error);
7807                                return Err(common::Error::JsonDecodeError(
7808                                    encoded.to_string(),
7809                                    error,
7810                                ));
7811                            }
7812                        }
7813                    };
7814
7815                    dlg.finished(true);
7816                    return Ok(response);
7817                }
7818            }
7819        }
7820    }
7821
7822    /// The ID of the matter to get the saved query from.
7823    ///
7824    /// Sets the *matter id* path property to the given value.
7825    ///
7826    /// Even though the property as already been set when instantiating this call,
7827    /// we provide this method for API completeness.
7828    pub fn matter_id(mut self, new_value: &str) -> MatterSavedQueryGetCall<'a, C> {
7829        self._matter_id = new_value.to_string();
7830        self
7831    }
7832    /// ID of the saved query to retrieve.
7833    ///
7834    /// Sets the *saved query id* path property to the given value.
7835    ///
7836    /// Even though the property as already been set when instantiating this call,
7837    /// we provide this method for API completeness.
7838    pub fn saved_query_id(mut self, new_value: &str) -> MatterSavedQueryGetCall<'a, C> {
7839        self._saved_query_id = new_value.to_string();
7840        self
7841    }
7842    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7843    /// while executing the actual API request.
7844    ///
7845    /// ````text
7846    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7847    /// ````
7848    ///
7849    /// Sets the *delegate* property to the given value.
7850    pub fn delegate(
7851        mut self,
7852        new_value: &'a mut dyn common::Delegate,
7853    ) -> MatterSavedQueryGetCall<'a, C> {
7854        self._delegate = Some(new_value);
7855        self
7856    }
7857
7858    /// Set any additional parameter of the query string used in the request.
7859    /// It should be used to set parameters which are not yet available through their own
7860    /// setters.
7861    ///
7862    /// Please note that this method must not be used to set any of the known parameters
7863    /// which have their own setter method. If done anyway, the request will fail.
7864    ///
7865    /// # Additional Parameters
7866    ///
7867    /// * *$.xgafv* (query-string) - V1 error format.
7868    /// * *access_token* (query-string) - OAuth access token.
7869    /// * *alt* (query-string) - Data format for response.
7870    /// * *callback* (query-string) - JSONP
7871    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7872    /// * *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.
7873    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7874    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7875    /// * *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.
7876    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7877    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7878    pub fn param<T>(mut self, name: T, value: T) -> MatterSavedQueryGetCall<'a, C>
7879    where
7880        T: AsRef<str>,
7881    {
7882        self._additional_params
7883            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7884        self
7885    }
7886
7887    /// Identifies the authorization scope for the method you are building.
7888    ///
7889    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7890    /// [`Scope::EdiscoveryReadonly`].
7891    ///
7892    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7893    /// tokens for more than one scope.
7894    ///
7895    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7896    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7897    /// sufficient, a read-write scope will do as well.
7898    pub fn add_scope<St>(mut self, scope: St) -> MatterSavedQueryGetCall<'a, C>
7899    where
7900        St: AsRef<str>,
7901    {
7902        self._scopes.insert(String::from(scope.as_ref()));
7903        self
7904    }
7905    /// Identifies the authorization scope(s) for the method you are building.
7906    ///
7907    /// See [`Self::add_scope()`] for details.
7908    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterSavedQueryGetCall<'a, C>
7909    where
7910        I: IntoIterator<Item = St>,
7911        St: AsRef<str>,
7912    {
7913        self._scopes
7914            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7915        self
7916    }
7917
7918    /// Removes all scopes, and no default scope will be used either.
7919    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7920    /// for details).
7921    pub fn clear_scopes(mut self) -> MatterSavedQueryGetCall<'a, C> {
7922        self._scopes.clear();
7923        self
7924    }
7925}
7926
7927/// Lists the saved queries in a matter.
7928///
7929/// A builder for the *savedQueries.list* method supported by a *matter* resource.
7930/// It is not used directly, but through a [`MatterMethods`] instance.
7931///
7932/// # Example
7933///
7934/// Instantiate a resource method builder
7935///
7936/// ```test_harness,no_run
7937/// # extern crate hyper;
7938/// # extern crate hyper_rustls;
7939/// # extern crate google_vault1 as vault1;
7940/// # async fn dox() {
7941/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7942///
7943/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7944/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7945/// #     .with_native_roots()
7946/// #     .unwrap()
7947/// #     .https_only()
7948/// #     .enable_http2()
7949/// #     .build();
7950///
7951/// # let executor = hyper_util::rt::TokioExecutor::new();
7952/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7953/// #     secret,
7954/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7955/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7956/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7957/// #     ),
7958/// # ).build().await.unwrap();
7959///
7960/// # let client = hyper_util::client::legacy::Client::builder(
7961/// #     hyper_util::rt::TokioExecutor::new()
7962/// # )
7963/// # .build(
7964/// #     hyper_rustls::HttpsConnectorBuilder::new()
7965/// #         .with_native_roots()
7966/// #         .unwrap()
7967/// #         .https_or_http()
7968/// #         .enable_http2()
7969/// #         .build()
7970/// # );
7971/// # let mut hub = Vault::new(client, auth);
7972/// // You can configure optional parameters by calling the respective setters at will, and
7973/// // execute the final call using `doit()`.
7974/// // Values shown here are possibly random and not representative !
7975/// let result = hub.matters().saved_queries_list("matterId")
7976///              .page_token("erat")
7977///              .page_size(-93)
7978///              .doit().await;
7979/// # }
7980/// ```
7981pub struct MatterSavedQueryListCall<'a, C>
7982where
7983    C: 'a,
7984{
7985    hub: &'a Vault<C>,
7986    _matter_id: String,
7987    _page_token: Option<String>,
7988    _page_size: Option<i32>,
7989    _delegate: Option<&'a mut dyn common::Delegate>,
7990    _additional_params: HashMap<String, String>,
7991    _scopes: BTreeSet<String>,
7992}
7993
7994impl<'a, C> common::CallBuilder for MatterSavedQueryListCall<'a, C> {}
7995
7996impl<'a, C> MatterSavedQueryListCall<'a, C>
7997where
7998    C: common::Connector,
7999{
8000    /// Perform the operation you have build so far.
8001    pub async fn doit(mut self) -> common::Result<(common::Response, ListSavedQueriesResponse)> {
8002        use std::borrow::Cow;
8003        use std::io::{Read, Seek};
8004
8005        use common::{url::Params, ToParts};
8006        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8007
8008        let mut dd = common::DefaultDelegate;
8009        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8010        dlg.begin(common::MethodInfo {
8011            id: "vault.matters.savedQueries.list",
8012            http_method: hyper::Method::GET,
8013        });
8014
8015        for &field in ["alt", "matterId", "pageToken", "pageSize"].iter() {
8016            if self._additional_params.contains_key(field) {
8017                dlg.finished(false);
8018                return Err(common::Error::FieldClash(field));
8019            }
8020        }
8021
8022        let mut params = Params::with_capacity(5 + self._additional_params.len());
8023        params.push("matterId", self._matter_id);
8024        if let Some(value) = self._page_token.as_ref() {
8025            params.push("pageToken", value);
8026        }
8027        if let Some(value) = self._page_size.as_ref() {
8028            params.push("pageSize", value.to_string());
8029        }
8030
8031        params.extend(self._additional_params.iter());
8032
8033        params.push("alt", "json");
8034        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/savedQueries";
8035        if self._scopes.is_empty() {
8036            self._scopes
8037                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
8038        }
8039
8040        #[allow(clippy::single_element_loop)]
8041        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
8042            url = params.uri_replacement(url, param_name, find_this, false);
8043        }
8044        {
8045            let to_remove = ["matterId"];
8046            params.remove_params(&to_remove);
8047        }
8048
8049        let url = params.parse_with_url(&url);
8050
8051        loop {
8052            let token = match self
8053                .hub
8054                .auth
8055                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8056                .await
8057            {
8058                Ok(token) => token,
8059                Err(e) => match dlg.token(e) {
8060                    Ok(token) => token,
8061                    Err(e) => {
8062                        dlg.finished(false);
8063                        return Err(common::Error::MissingToken(e));
8064                    }
8065                },
8066            };
8067            let mut req_result = {
8068                let client = &self.hub.client;
8069                dlg.pre_request();
8070                let mut req_builder = hyper::Request::builder()
8071                    .method(hyper::Method::GET)
8072                    .uri(url.as_str())
8073                    .header(USER_AGENT, self.hub._user_agent.clone());
8074
8075                if let Some(token) = token.as_ref() {
8076                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8077                }
8078
8079                let request = req_builder
8080                    .header(CONTENT_LENGTH, 0_u64)
8081                    .body(common::to_body::<String>(None));
8082
8083                client.request(request.unwrap()).await
8084            };
8085
8086            match req_result {
8087                Err(err) => {
8088                    if let common::Retry::After(d) = dlg.http_error(&err) {
8089                        sleep(d).await;
8090                        continue;
8091                    }
8092                    dlg.finished(false);
8093                    return Err(common::Error::HttpError(err));
8094                }
8095                Ok(res) => {
8096                    let (mut parts, body) = res.into_parts();
8097                    let mut body = common::Body::new(body);
8098                    if !parts.status.is_success() {
8099                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8100                        let error = serde_json::from_str(&common::to_string(&bytes));
8101                        let response = common::to_response(parts, bytes.into());
8102
8103                        if let common::Retry::After(d) =
8104                            dlg.http_failure(&response, error.as_ref().ok())
8105                        {
8106                            sleep(d).await;
8107                            continue;
8108                        }
8109
8110                        dlg.finished(false);
8111
8112                        return Err(match error {
8113                            Ok(value) => common::Error::BadRequest(value),
8114                            _ => common::Error::Failure(response),
8115                        });
8116                    }
8117                    let response = {
8118                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8119                        let encoded = common::to_string(&bytes);
8120                        match serde_json::from_str(&encoded) {
8121                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8122                            Err(error) => {
8123                                dlg.response_json_decode_error(&encoded, &error);
8124                                return Err(common::Error::JsonDecodeError(
8125                                    encoded.to_string(),
8126                                    error,
8127                                ));
8128                            }
8129                        }
8130                    };
8131
8132                    dlg.finished(true);
8133                    return Ok(response);
8134                }
8135            }
8136        }
8137    }
8138
8139    /// The ID of the matter to get the saved queries for.
8140    ///
8141    /// Sets the *matter id* path property to the given value.
8142    ///
8143    /// Even though the property as already been set when instantiating this call,
8144    /// we provide this method for API completeness.
8145    pub fn matter_id(mut self, new_value: &str) -> MatterSavedQueryListCall<'a, C> {
8146        self._matter_id = new_value.to_string();
8147        self
8148    }
8149    /// The pagination token as returned in the previous response. An empty token means start from the beginning.
8150    ///
8151    /// Sets the *page token* query property to the given value.
8152    pub fn page_token(mut self, new_value: &str) -> MatterSavedQueryListCall<'a, C> {
8153        self._page_token = Some(new_value.to_string());
8154        self
8155    }
8156    /// The maximum number of saved queries to return.
8157    ///
8158    /// Sets the *page size* query property to the given value.
8159    pub fn page_size(mut self, new_value: i32) -> MatterSavedQueryListCall<'a, C> {
8160        self._page_size = Some(new_value);
8161        self
8162    }
8163    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8164    /// while executing the actual API request.
8165    ///
8166    /// ````text
8167    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8168    /// ````
8169    ///
8170    /// Sets the *delegate* property to the given value.
8171    pub fn delegate(
8172        mut self,
8173        new_value: &'a mut dyn common::Delegate,
8174    ) -> MatterSavedQueryListCall<'a, C> {
8175        self._delegate = Some(new_value);
8176        self
8177    }
8178
8179    /// Set any additional parameter of the query string used in the request.
8180    /// It should be used to set parameters which are not yet available through their own
8181    /// setters.
8182    ///
8183    /// Please note that this method must not be used to set any of the known parameters
8184    /// which have their own setter method. If done anyway, the request will fail.
8185    ///
8186    /// # Additional Parameters
8187    ///
8188    /// * *$.xgafv* (query-string) - V1 error format.
8189    /// * *access_token* (query-string) - OAuth access token.
8190    /// * *alt* (query-string) - Data format for response.
8191    /// * *callback* (query-string) - JSONP
8192    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8193    /// * *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.
8194    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8195    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8196    /// * *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.
8197    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8198    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8199    pub fn param<T>(mut self, name: T, value: T) -> MatterSavedQueryListCall<'a, C>
8200    where
8201        T: AsRef<str>,
8202    {
8203        self._additional_params
8204            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8205        self
8206    }
8207
8208    /// Identifies the authorization scope for the method you are building.
8209    ///
8210    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8211    /// [`Scope::EdiscoveryReadonly`].
8212    ///
8213    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8214    /// tokens for more than one scope.
8215    ///
8216    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8217    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8218    /// sufficient, a read-write scope will do as well.
8219    pub fn add_scope<St>(mut self, scope: St) -> MatterSavedQueryListCall<'a, C>
8220    where
8221        St: AsRef<str>,
8222    {
8223        self._scopes.insert(String::from(scope.as_ref()));
8224        self
8225    }
8226    /// Identifies the authorization scope(s) for the method you are building.
8227    ///
8228    /// See [`Self::add_scope()`] for details.
8229    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterSavedQueryListCall<'a, C>
8230    where
8231        I: IntoIterator<Item = St>,
8232        St: AsRef<str>,
8233    {
8234        self._scopes
8235            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8236        self
8237    }
8238
8239    /// Removes all scopes, and no default scope will be used either.
8240    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8241    /// for details).
8242    pub fn clear_scopes(mut self) -> MatterSavedQueryListCall<'a, C> {
8243        self._scopes.clear();
8244        self
8245    }
8246}
8247
8248/// Adds an account as a matter collaborator.
8249///
8250/// A builder for the *addPermissions* method supported by a *matter* resource.
8251/// It is not used directly, but through a [`MatterMethods`] instance.
8252///
8253/// # Example
8254///
8255/// Instantiate a resource method builder
8256///
8257/// ```test_harness,no_run
8258/// # extern crate hyper;
8259/// # extern crate hyper_rustls;
8260/// # extern crate google_vault1 as vault1;
8261/// use vault1::api::AddMatterPermissionsRequest;
8262/// # async fn dox() {
8263/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8264///
8265/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8266/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8267/// #     .with_native_roots()
8268/// #     .unwrap()
8269/// #     .https_only()
8270/// #     .enable_http2()
8271/// #     .build();
8272///
8273/// # let executor = hyper_util::rt::TokioExecutor::new();
8274/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8275/// #     secret,
8276/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8277/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8278/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8279/// #     ),
8280/// # ).build().await.unwrap();
8281///
8282/// # let client = hyper_util::client::legacy::Client::builder(
8283/// #     hyper_util::rt::TokioExecutor::new()
8284/// # )
8285/// # .build(
8286/// #     hyper_rustls::HttpsConnectorBuilder::new()
8287/// #         .with_native_roots()
8288/// #         .unwrap()
8289/// #         .https_or_http()
8290/// #         .enable_http2()
8291/// #         .build()
8292/// # );
8293/// # let mut hub = Vault::new(client, auth);
8294/// // As the method needs a request, you would usually fill it with the desired information
8295/// // into the respective structure. Some of the parts shown here might not be applicable !
8296/// // Values shown here are possibly random and not representative !
8297/// let mut req = AddMatterPermissionsRequest::default();
8298///
8299/// // You can configure optional parameters by calling the respective setters at will, and
8300/// // execute the final call using `doit()`.
8301/// // Values shown here are possibly random and not representative !
8302/// let result = hub.matters().add_permissions(req, "matterId")
8303///              .doit().await;
8304/// # }
8305/// ```
8306pub struct MatterAddPermissionCall<'a, C>
8307where
8308    C: 'a,
8309{
8310    hub: &'a Vault<C>,
8311    _request: AddMatterPermissionsRequest,
8312    _matter_id: String,
8313    _delegate: Option<&'a mut dyn common::Delegate>,
8314    _additional_params: HashMap<String, String>,
8315    _scopes: BTreeSet<String>,
8316}
8317
8318impl<'a, C> common::CallBuilder for MatterAddPermissionCall<'a, C> {}
8319
8320impl<'a, C> MatterAddPermissionCall<'a, C>
8321where
8322    C: common::Connector,
8323{
8324    /// Perform the operation you have build so far.
8325    pub async fn doit(mut self) -> common::Result<(common::Response, MatterPermission)> {
8326        use std::borrow::Cow;
8327        use std::io::{Read, Seek};
8328
8329        use common::{url::Params, ToParts};
8330        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8331
8332        let mut dd = common::DefaultDelegate;
8333        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8334        dlg.begin(common::MethodInfo {
8335            id: "vault.matters.addPermissions",
8336            http_method: hyper::Method::POST,
8337        });
8338
8339        for &field in ["alt", "matterId"].iter() {
8340            if self._additional_params.contains_key(field) {
8341                dlg.finished(false);
8342                return Err(common::Error::FieldClash(field));
8343            }
8344        }
8345
8346        let mut params = Params::with_capacity(4 + self._additional_params.len());
8347        params.push("matterId", self._matter_id);
8348
8349        params.extend(self._additional_params.iter());
8350
8351        params.push("alt", "json");
8352        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}:addPermissions";
8353        if self._scopes.is_empty() {
8354            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
8355        }
8356
8357        #[allow(clippy::single_element_loop)]
8358        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
8359            url = params.uri_replacement(url, param_name, find_this, false);
8360        }
8361        {
8362            let to_remove = ["matterId"];
8363            params.remove_params(&to_remove);
8364        }
8365
8366        let url = params.parse_with_url(&url);
8367
8368        let mut json_mime_type = mime::APPLICATION_JSON;
8369        let mut request_value_reader = {
8370            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8371            common::remove_json_null_values(&mut value);
8372            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8373            serde_json::to_writer(&mut dst, &value).unwrap();
8374            dst
8375        };
8376        let request_size = request_value_reader
8377            .seek(std::io::SeekFrom::End(0))
8378            .unwrap();
8379        request_value_reader
8380            .seek(std::io::SeekFrom::Start(0))
8381            .unwrap();
8382
8383        loop {
8384            let token = match self
8385                .hub
8386                .auth
8387                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8388                .await
8389            {
8390                Ok(token) => token,
8391                Err(e) => match dlg.token(e) {
8392                    Ok(token) => token,
8393                    Err(e) => {
8394                        dlg.finished(false);
8395                        return Err(common::Error::MissingToken(e));
8396                    }
8397                },
8398            };
8399            request_value_reader
8400                .seek(std::io::SeekFrom::Start(0))
8401                .unwrap();
8402            let mut req_result = {
8403                let client = &self.hub.client;
8404                dlg.pre_request();
8405                let mut req_builder = hyper::Request::builder()
8406                    .method(hyper::Method::POST)
8407                    .uri(url.as_str())
8408                    .header(USER_AGENT, self.hub._user_agent.clone());
8409
8410                if let Some(token) = token.as_ref() {
8411                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8412                }
8413
8414                let request = req_builder
8415                    .header(CONTENT_TYPE, json_mime_type.to_string())
8416                    .header(CONTENT_LENGTH, request_size as u64)
8417                    .body(common::to_body(
8418                        request_value_reader.get_ref().clone().into(),
8419                    ));
8420
8421                client.request(request.unwrap()).await
8422            };
8423
8424            match req_result {
8425                Err(err) => {
8426                    if let common::Retry::After(d) = dlg.http_error(&err) {
8427                        sleep(d).await;
8428                        continue;
8429                    }
8430                    dlg.finished(false);
8431                    return Err(common::Error::HttpError(err));
8432                }
8433                Ok(res) => {
8434                    let (mut parts, body) = res.into_parts();
8435                    let mut body = common::Body::new(body);
8436                    if !parts.status.is_success() {
8437                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8438                        let error = serde_json::from_str(&common::to_string(&bytes));
8439                        let response = common::to_response(parts, bytes.into());
8440
8441                        if let common::Retry::After(d) =
8442                            dlg.http_failure(&response, error.as_ref().ok())
8443                        {
8444                            sleep(d).await;
8445                            continue;
8446                        }
8447
8448                        dlg.finished(false);
8449
8450                        return Err(match error {
8451                            Ok(value) => common::Error::BadRequest(value),
8452                            _ => common::Error::Failure(response),
8453                        });
8454                    }
8455                    let response = {
8456                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8457                        let encoded = common::to_string(&bytes);
8458                        match serde_json::from_str(&encoded) {
8459                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8460                            Err(error) => {
8461                                dlg.response_json_decode_error(&encoded, &error);
8462                                return Err(common::Error::JsonDecodeError(
8463                                    encoded.to_string(),
8464                                    error,
8465                                ));
8466                            }
8467                        }
8468                    };
8469
8470                    dlg.finished(true);
8471                    return Ok(response);
8472                }
8473            }
8474        }
8475    }
8476
8477    ///
8478    /// Sets the *request* property to the given value.
8479    ///
8480    /// Even though the property as already been set when instantiating this call,
8481    /// we provide this method for API completeness.
8482    pub fn request(
8483        mut self,
8484        new_value: AddMatterPermissionsRequest,
8485    ) -> MatterAddPermissionCall<'a, C> {
8486        self._request = new_value;
8487        self
8488    }
8489    /// The matter ID.
8490    ///
8491    /// Sets the *matter id* path property to the given value.
8492    ///
8493    /// Even though the property as already been set when instantiating this call,
8494    /// we provide this method for API completeness.
8495    pub fn matter_id(mut self, new_value: &str) -> MatterAddPermissionCall<'a, C> {
8496        self._matter_id = new_value.to_string();
8497        self
8498    }
8499    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8500    /// while executing the actual API request.
8501    ///
8502    /// ````text
8503    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8504    /// ````
8505    ///
8506    /// Sets the *delegate* property to the given value.
8507    pub fn delegate(
8508        mut self,
8509        new_value: &'a mut dyn common::Delegate,
8510    ) -> MatterAddPermissionCall<'a, C> {
8511        self._delegate = Some(new_value);
8512        self
8513    }
8514
8515    /// Set any additional parameter of the query string used in the request.
8516    /// It should be used to set parameters which are not yet available through their own
8517    /// setters.
8518    ///
8519    /// Please note that this method must not be used to set any of the known parameters
8520    /// which have their own setter method. If done anyway, the request will fail.
8521    ///
8522    /// # Additional Parameters
8523    ///
8524    /// * *$.xgafv* (query-string) - V1 error format.
8525    /// * *access_token* (query-string) - OAuth access token.
8526    /// * *alt* (query-string) - Data format for response.
8527    /// * *callback* (query-string) - JSONP
8528    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8529    /// * *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.
8530    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8531    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8532    /// * *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.
8533    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8534    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8535    pub fn param<T>(mut self, name: T, value: T) -> MatterAddPermissionCall<'a, C>
8536    where
8537        T: AsRef<str>,
8538    {
8539        self._additional_params
8540            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8541        self
8542    }
8543
8544    /// Identifies the authorization scope for the method you are building.
8545    ///
8546    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8547    /// [`Scope::Ediscovery`].
8548    ///
8549    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8550    /// tokens for more than one scope.
8551    ///
8552    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8553    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8554    /// sufficient, a read-write scope will do as well.
8555    pub fn add_scope<St>(mut self, scope: St) -> MatterAddPermissionCall<'a, C>
8556    where
8557        St: AsRef<str>,
8558    {
8559        self._scopes.insert(String::from(scope.as_ref()));
8560        self
8561    }
8562    /// Identifies the authorization scope(s) for the method you are building.
8563    ///
8564    /// See [`Self::add_scope()`] for details.
8565    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterAddPermissionCall<'a, C>
8566    where
8567        I: IntoIterator<Item = St>,
8568        St: AsRef<str>,
8569    {
8570        self._scopes
8571            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8572        self
8573    }
8574
8575    /// Removes all scopes, and no default scope will be used either.
8576    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8577    /// for details).
8578    pub fn clear_scopes(mut self) -> MatterAddPermissionCall<'a, C> {
8579        self._scopes.clear();
8580        self
8581    }
8582}
8583
8584/// Closes the specified matter. Returns the matter with updated state.
8585///
8586/// A builder for the *close* method supported by a *matter* resource.
8587/// It is not used directly, but through a [`MatterMethods`] instance.
8588///
8589/// # Example
8590///
8591/// Instantiate a resource method builder
8592///
8593/// ```test_harness,no_run
8594/// # extern crate hyper;
8595/// # extern crate hyper_rustls;
8596/// # extern crate google_vault1 as vault1;
8597/// use vault1::api::CloseMatterRequest;
8598/// # async fn dox() {
8599/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8600///
8601/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8602/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8603/// #     .with_native_roots()
8604/// #     .unwrap()
8605/// #     .https_only()
8606/// #     .enable_http2()
8607/// #     .build();
8608///
8609/// # let executor = hyper_util::rt::TokioExecutor::new();
8610/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8611/// #     secret,
8612/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8613/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8614/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8615/// #     ),
8616/// # ).build().await.unwrap();
8617///
8618/// # let client = hyper_util::client::legacy::Client::builder(
8619/// #     hyper_util::rt::TokioExecutor::new()
8620/// # )
8621/// # .build(
8622/// #     hyper_rustls::HttpsConnectorBuilder::new()
8623/// #         .with_native_roots()
8624/// #         .unwrap()
8625/// #         .https_or_http()
8626/// #         .enable_http2()
8627/// #         .build()
8628/// # );
8629/// # let mut hub = Vault::new(client, auth);
8630/// // As the method needs a request, you would usually fill it with the desired information
8631/// // into the respective structure. Some of the parts shown here might not be applicable !
8632/// // Values shown here are possibly random and not representative !
8633/// let mut req = CloseMatterRequest::default();
8634///
8635/// // You can configure optional parameters by calling the respective setters at will, and
8636/// // execute the final call using `doit()`.
8637/// // Values shown here are possibly random and not representative !
8638/// let result = hub.matters().close(req, "matterId")
8639///              .doit().await;
8640/// # }
8641/// ```
8642pub struct MatterCloseCall<'a, C>
8643where
8644    C: 'a,
8645{
8646    hub: &'a Vault<C>,
8647    _request: CloseMatterRequest,
8648    _matter_id: String,
8649    _delegate: Option<&'a mut dyn common::Delegate>,
8650    _additional_params: HashMap<String, String>,
8651    _scopes: BTreeSet<String>,
8652}
8653
8654impl<'a, C> common::CallBuilder for MatterCloseCall<'a, C> {}
8655
8656impl<'a, C> MatterCloseCall<'a, C>
8657where
8658    C: common::Connector,
8659{
8660    /// Perform the operation you have build so far.
8661    pub async fn doit(mut self) -> common::Result<(common::Response, CloseMatterResponse)> {
8662        use std::borrow::Cow;
8663        use std::io::{Read, Seek};
8664
8665        use common::{url::Params, ToParts};
8666        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8667
8668        let mut dd = common::DefaultDelegate;
8669        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8670        dlg.begin(common::MethodInfo {
8671            id: "vault.matters.close",
8672            http_method: hyper::Method::POST,
8673        });
8674
8675        for &field in ["alt", "matterId"].iter() {
8676            if self._additional_params.contains_key(field) {
8677                dlg.finished(false);
8678                return Err(common::Error::FieldClash(field));
8679            }
8680        }
8681
8682        let mut params = Params::with_capacity(4 + self._additional_params.len());
8683        params.push("matterId", self._matter_id);
8684
8685        params.extend(self._additional_params.iter());
8686
8687        params.push("alt", "json");
8688        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}:close";
8689        if self._scopes.is_empty() {
8690            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
8691        }
8692
8693        #[allow(clippy::single_element_loop)]
8694        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
8695            url = params.uri_replacement(url, param_name, find_this, false);
8696        }
8697        {
8698            let to_remove = ["matterId"];
8699            params.remove_params(&to_remove);
8700        }
8701
8702        let url = params.parse_with_url(&url);
8703
8704        let mut json_mime_type = mime::APPLICATION_JSON;
8705        let mut request_value_reader = {
8706            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8707            common::remove_json_null_values(&mut value);
8708            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8709            serde_json::to_writer(&mut dst, &value).unwrap();
8710            dst
8711        };
8712        let request_size = request_value_reader
8713            .seek(std::io::SeekFrom::End(0))
8714            .unwrap();
8715        request_value_reader
8716            .seek(std::io::SeekFrom::Start(0))
8717            .unwrap();
8718
8719        loop {
8720            let token = match self
8721                .hub
8722                .auth
8723                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8724                .await
8725            {
8726                Ok(token) => token,
8727                Err(e) => match dlg.token(e) {
8728                    Ok(token) => token,
8729                    Err(e) => {
8730                        dlg.finished(false);
8731                        return Err(common::Error::MissingToken(e));
8732                    }
8733                },
8734            };
8735            request_value_reader
8736                .seek(std::io::SeekFrom::Start(0))
8737                .unwrap();
8738            let mut req_result = {
8739                let client = &self.hub.client;
8740                dlg.pre_request();
8741                let mut req_builder = hyper::Request::builder()
8742                    .method(hyper::Method::POST)
8743                    .uri(url.as_str())
8744                    .header(USER_AGENT, self.hub._user_agent.clone());
8745
8746                if let Some(token) = token.as_ref() {
8747                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8748                }
8749
8750                let request = req_builder
8751                    .header(CONTENT_TYPE, json_mime_type.to_string())
8752                    .header(CONTENT_LENGTH, request_size as u64)
8753                    .body(common::to_body(
8754                        request_value_reader.get_ref().clone().into(),
8755                    ));
8756
8757                client.request(request.unwrap()).await
8758            };
8759
8760            match req_result {
8761                Err(err) => {
8762                    if let common::Retry::After(d) = dlg.http_error(&err) {
8763                        sleep(d).await;
8764                        continue;
8765                    }
8766                    dlg.finished(false);
8767                    return Err(common::Error::HttpError(err));
8768                }
8769                Ok(res) => {
8770                    let (mut parts, body) = res.into_parts();
8771                    let mut body = common::Body::new(body);
8772                    if !parts.status.is_success() {
8773                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8774                        let error = serde_json::from_str(&common::to_string(&bytes));
8775                        let response = common::to_response(parts, bytes.into());
8776
8777                        if let common::Retry::After(d) =
8778                            dlg.http_failure(&response, error.as_ref().ok())
8779                        {
8780                            sleep(d).await;
8781                            continue;
8782                        }
8783
8784                        dlg.finished(false);
8785
8786                        return Err(match error {
8787                            Ok(value) => common::Error::BadRequest(value),
8788                            _ => common::Error::Failure(response),
8789                        });
8790                    }
8791                    let response = {
8792                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8793                        let encoded = common::to_string(&bytes);
8794                        match serde_json::from_str(&encoded) {
8795                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8796                            Err(error) => {
8797                                dlg.response_json_decode_error(&encoded, &error);
8798                                return Err(common::Error::JsonDecodeError(
8799                                    encoded.to_string(),
8800                                    error,
8801                                ));
8802                            }
8803                        }
8804                    };
8805
8806                    dlg.finished(true);
8807                    return Ok(response);
8808                }
8809            }
8810        }
8811    }
8812
8813    ///
8814    /// Sets the *request* property to the given value.
8815    ///
8816    /// Even though the property as already been set when instantiating this call,
8817    /// we provide this method for API completeness.
8818    pub fn request(mut self, new_value: CloseMatterRequest) -> MatterCloseCall<'a, C> {
8819        self._request = new_value;
8820        self
8821    }
8822    /// The matter ID.
8823    ///
8824    /// Sets the *matter id* path property to the given value.
8825    ///
8826    /// Even though the property as already been set when instantiating this call,
8827    /// we provide this method for API completeness.
8828    pub fn matter_id(mut self, new_value: &str) -> MatterCloseCall<'a, C> {
8829        self._matter_id = new_value.to_string();
8830        self
8831    }
8832    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8833    /// while executing the actual API request.
8834    ///
8835    /// ````text
8836    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8837    /// ````
8838    ///
8839    /// Sets the *delegate* property to the given value.
8840    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MatterCloseCall<'a, C> {
8841        self._delegate = Some(new_value);
8842        self
8843    }
8844
8845    /// Set any additional parameter of the query string used in the request.
8846    /// It should be used to set parameters which are not yet available through their own
8847    /// setters.
8848    ///
8849    /// Please note that this method must not be used to set any of the known parameters
8850    /// which have their own setter method. If done anyway, the request will fail.
8851    ///
8852    /// # Additional Parameters
8853    ///
8854    /// * *$.xgafv* (query-string) - V1 error format.
8855    /// * *access_token* (query-string) - OAuth access token.
8856    /// * *alt* (query-string) - Data format for response.
8857    /// * *callback* (query-string) - JSONP
8858    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8859    /// * *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.
8860    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8861    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8862    /// * *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.
8863    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8864    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8865    pub fn param<T>(mut self, name: T, value: T) -> MatterCloseCall<'a, C>
8866    where
8867        T: AsRef<str>,
8868    {
8869        self._additional_params
8870            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8871        self
8872    }
8873
8874    /// Identifies the authorization scope for the method you are building.
8875    ///
8876    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8877    /// [`Scope::Ediscovery`].
8878    ///
8879    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8880    /// tokens for more than one scope.
8881    ///
8882    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8883    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8884    /// sufficient, a read-write scope will do as well.
8885    pub fn add_scope<St>(mut self, scope: St) -> MatterCloseCall<'a, C>
8886    where
8887        St: AsRef<str>,
8888    {
8889        self._scopes.insert(String::from(scope.as_ref()));
8890        self
8891    }
8892    /// Identifies the authorization scope(s) for the method you are building.
8893    ///
8894    /// See [`Self::add_scope()`] for details.
8895    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterCloseCall<'a, C>
8896    where
8897        I: IntoIterator<Item = St>,
8898        St: AsRef<str>,
8899    {
8900        self._scopes
8901            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8902        self
8903    }
8904
8905    /// Removes all scopes, and no default scope will be used either.
8906    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8907    /// for details).
8908    pub fn clear_scopes(mut self) -> MatterCloseCall<'a, C> {
8909        self._scopes.clear();
8910        self
8911    }
8912}
8913
8914/// Counts the accounts processed by the specified query.
8915///
8916/// A builder for the *count* method supported by a *matter* resource.
8917/// It is not used directly, but through a [`MatterMethods`] instance.
8918///
8919/// # Example
8920///
8921/// Instantiate a resource method builder
8922///
8923/// ```test_harness,no_run
8924/// # extern crate hyper;
8925/// # extern crate hyper_rustls;
8926/// # extern crate google_vault1 as vault1;
8927/// use vault1::api::CountArtifactsRequest;
8928/// # async fn dox() {
8929/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8930///
8931/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8932/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8933/// #     .with_native_roots()
8934/// #     .unwrap()
8935/// #     .https_only()
8936/// #     .enable_http2()
8937/// #     .build();
8938///
8939/// # let executor = hyper_util::rt::TokioExecutor::new();
8940/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8941/// #     secret,
8942/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8943/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8944/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8945/// #     ),
8946/// # ).build().await.unwrap();
8947///
8948/// # let client = hyper_util::client::legacy::Client::builder(
8949/// #     hyper_util::rt::TokioExecutor::new()
8950/// # )
8951/// # .build(
8952/// #     hyper_rustls::HttpsConnectorBuilder::new()
8953/// #         .with_native_roots()
8954/// #         .unwrap()
8955/// #         .https_or_http()
8956/// #         .enable_http2()
8957/// #         .build()
8958/// # );
8959/// # let mut hub = Vault::new(client, auth);
8960/// // As the method needs a request, you would usually fill it with the desired information
8961/// // into the respective structure. Some of the parts shown here might not be applicable !
8962/// // Values shown here are possibly random and not representative !
8963/// let mut req = CountArtifactsRequest::default();
8964///
8965/// // You can configure optional parameters by calling the respective setters at will, and
8966/// // execute the final call using `doit()`.
8967/// // Values shown here are possibly random and not representative !
8968/// let result = hub.matters().count(req, "matterId")
8969///              .doit().await;
8970/// # }
8971/// ```
8972pub struct MatterCountCall<'a, C>
8973where
8974    C: 'a,
8975{
8976    hub: &'a Vault<C>,
8977    _request: CountArtifactsRequest,
8978    _matter_id: String,
8979    _delegate: Option<&'a mut dyn common::Delegate>,
8980    _additional_params: HashMap<String, String>,
8981    _scopes: BTreeSet<String>,
8982}
8983
8984impl<'a, C> common::CallBuilder for MatterCountCall<'a, C> {}
8985
8986impl<'a, C> MatterCountCall<'a, C>
8987where
8988    C: common::Connector,
8989{
8990    /// Perform the operation you have build so far.
8991    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8992        use std::borrow::Cow;
8993        use std::io::{Read, Seek};
8994
8995        use common::{url::Params, ToParts};
8996        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8997
8998        let mut dd = common::DefaultDelegate;
8999        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9000        dlg.begin(common::MethodInfo {
9001            id: "vault.matters.count",
9002            http_method: hyper::Method::POST,
9003        });
9004
9005        for &field in ["alt", "matterId"].iter() {
9006            if self._additional_params.contains_key(field) {
9007                dlg.finished(false);
9008                return Err(common::Error::FieldClash(field));
9009            }
9010        }
9011
9012        let mut params = Params::with_capacity(4 + self._additional_params.len());
9013        params.push("matterId", self._matter_id);
9014
9015        params.extend(self._additional_params.iter());
9016
9017        params.push("alt", "json");
9018        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}:count";
9019        if self._scopes.is_empty() {
9020            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
9021        }
9022
9023        #[allow(clippy::single_element_loop)]
9024        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
9025            url = params.uri_replacement(url, param_name, find_this, false);
9026        }
9027        {
9028            let to_remove = ["matterId"];
9029            params.remove_params(&to_remove);
9030        }
9031
9032        let url = params.parse_with_url(&url);
9033
9034        let mut json_mime_type = mime::APPLICATION_JSON;
9035        let mut request_value_reader = {
9036            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9037            common::remove_json_null_values(&mut value);
9038            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9039            serde_json::to_writer(&mut dst, &value).unwrap();
9040            dst
9041        };
9042        let request_size = request_value_reader
9043            .seek(std::io::SeekFrom::End(0))
9044            .unwrap();
9045        request_value_reader
9046            .seek(std::io::SeekFrom::Start(0))
9047            .unwrap();
9048
9049        loop {
9050            let token = match self
9051                .hub
9052                .auth
9053                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9054                .await
9055            {
9056                Ok(token) => token,
9057                Err(e) => match dlg.token(e) {
9058                    Ok(token) => token,
9059                    Err(e) => {
9060                        dlg.finished(false);
9061                        return Err(common::Error::MissingToken(e));
9062                    }
9063                },
9064            };
9065            request_value_reader
9066                .seek(std::io::SeekFrom::Start(0))
9067                .unwrap();
9068            let mut req_result = {
9069                let client = &self.hub.client;
9070                dlg.pre_request();
9071                let mut req_builder = hyper::Request::builder()
9072                    .method(hyper::Method::POST)
9073                    .uri(url.as_str())
9074                    .header(USER_AGENT, self.hub._user_agent.clone());
9075
9076                if let Some(token) = token.as_ref() {
9077                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9078                }
9079
9080                let request = req_builder
9081                    .header(CONTENT_TYPE, json_mime_type.to_string())
9082                    .header(CONTENT_LENGTH, request_size as u64)
9083                    .body(common::to_body(
9084                        request_value_reader.get_ref().clone().into(),
9085                    ));
9086
9087                client.request(request.unwrap()).await
9088            };
9089
9090            match req_result {
9091                Err(err) => {
9092                    if let common::Retry::After(d) = dlg.http_error(&err) {
9093                        sleep(d).await;
9094                        continue;
9095                    }
9096                    dlg.finished(false);
9097                    return Err(common::Error::HttpError(err));
9098                }
9099                Ok(res) => {
9100                    let (mut parts, body) = res.into_parts();
9101                    let mut body = common::Body::new(body);
9102                    if !parts.status.is_success() {
9103                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9104                        let error = serde_json::from_str(&common::to_string(&bytes));
9105                        let response = common::to_response(parts, bytes.into());
9106
9107                        if let common::Retry::After(d) =
9108                            dlg.http_failure(&response, error.as_ref().ok())
9109                        {
9110                            sleep(d).await;
9111                            continue;
9112                        }
9113
9114                        dlg.finished(false);
9115
9116                        return Err(match error {
9117                            Ok(value) => common::Error::BadRequest(value),
9118                            _ => common::Error::Failure(response),
9119                        });
9120                    }
9121                    let response = {
9122                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9123                        let encoded = common::to_string(&bytes);
9124                        match serde_json::from_str(&encoded) {
9125                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9126                            Err(error) => {
9127                                dlg.response_json_decode_error(&encoded, &error);
9128                                return Err(common::Error::JsonDecodeError(
9129                                    encoded.to_string(),
9130                                    error,
9131                                ));
9132                            }
9133                        }
9134                    };
9135
9136                    dlg.finished(true);
9137                    return Ok(response);
9138                }
9139            }
9140        }
9141    }
9142
9143    ///
9144    /// Sets the *request* property to the given value.
9145    ///
9146    /// Even though the property as already been set when instantiating this call,
9147    /// we provide this method for API completeness.
9148    pub fn request(mut self, new_value: CountArtifactsRequest) -> MatterCountCall<'a, C> {
9149        self._request = new_value;
9150        self
9151    }
9152    /// The matter ID.
9153    ///
9154    /// Sets the *matter id* path property to the given value.
9155    ///
9156    /// Even though the property as already been set when instantiating this call,
9157    /// we provide this method for API completeness.
9158    pub fn matter_id(mut self, new_value: &str) -> MatterCountCall<'a, C> {
9159        self._matter_id = new_value.to_string();
9160        self
9161    }
9162    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9163    /// while executing the actual API request.
9164    ///
9165    /// ````text
9166    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9167    /// ````
9168    ///
9169    /// Sets the *delegate* property to the given value.
9170    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MatterCountCall<'a, C> {
9171        self._delegate = Some(new_value);
9172        self
9173    }
9174
9175    /// Set any additional parameter of the query string used in the request.
9176    /// It should be used to set parameters which are not yet available through their own
9177    /// setters.
9178    ///
9179    /// Please note that this method must not be used to set any of the known parameters
9180    /// which have their own setter method. If done anyway, the request will fail.
9181    ///
9182    /// # Additional Parameters
9183    ///
9184    /// * *$.xgafv* (query-string) - V1 error format.
9185    /// * *access_token* (query-string) - OAuth access token.
9186    /// * *alt* (query-string) - Data format for response.
9187    /// * *callback* (query-string) - JSONP
9188    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9189    /// * *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.
9190    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9191    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9192    /// * *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.
9193    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9194    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9195    pub fn param<T>(mut self, name: T, value: T) -> MatterCountCall<'a, C>
9196    where
9197        T: AsRef<str>,
9198    {
9199        self._additional_params
9200            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9201        self
9202    }
9203
9204    /// Identifies the authorization scope for the method you are building.
9205    ///
9206    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9207    /// [`Scope::Ediscovery`].
9208    ///
9209    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9210    /// tokens for more than one scope.
9211    ///
9212    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9213    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9214    /// sufficient, a read-write scope will do as well.
9215    pub fn add_scope<St>(mut self, scope: St) -> MatterCountCall<'a, C>
9216    where
9217        St: AsRef<str>,
9218    {
9219        self._scopes.insert(String::from(scope.as_ref()));
9220        self
9221    }
9222    /// Identifies the authorization scope(s) for the method you are building.
9223    ///
9224    /// See [`Self::add_scope()`] for details.
9225    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterCountCall<'a, C>
9226    where
9227        I: IntoIterator<Item = St>,
9228        St: AsRef<str>,
9229    {
9230        self._scopes
9231            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9232        self
9233    }
9234
9235    /// Removes all scopes, and no default scope will be used either.
9236    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9237    /// for details).
9238    pub fn clear_scopes(mut self) -> MatterCountCall<'a, C> {
9239        self._scopes.clear();
9240        self
9241    }
9242}
9243
9244/// Creates a matter with the given name and description. The initial state is open, and the owner is the method caller. Returns the created matter with default view.
9245///
9246/// A builder for the *create* method supported by a *matter* resource.
9247/// It is not used directly, but through a [`MatterMethods`] instance.
9248///
9249/// # Example
9250///
9251/// Instantiate a resource method builder
9252///
9253/// ```test_harness,no_run
9254/// # extern crate hyper;
9255/// # extern crate hyper_rustls;
9256/// # extern crate google_vault1 as vault1;
9257/// use vault1::api::Matter;
9258/// # async fn dox() {
9259/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9260///
9261/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9262/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9263/// #     .with_native_roots()
9264/// #     .unwrap()
9265/// #     .https_only()
9266/// #     .enable_http2()
9267/// #     .build();
9268///
9269/// # let executor = hyper_util::rt::TokioExecutor::new();
9270/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9271/// #     secret,
9272/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9273/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9274/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9275/// #     ),
9276/// # ).build().await.unwrap();
9277///
9278/// # let client = hyper_util::client::legacy::Client::builder(
9279/// #     hyper_util::rt::TokioExecutor::new()
9280/// # )
9281/// # .build(
9282/// #     hyper_rustls::HttpsConnectorBuilder::new()
9283/// #         .with_native_roots()
9284/// #         .unwrap()
9285/// #         .https_or_http()
9286/// #         .enable_http2()
9287/// #         .build()
9288/// # );
9289/// # let mut hub = Vault::new(client, auth);
9290/// // As the method needs a request, you would usually fill it with the desired information
9291/// // into the respective structure. Some of the parts shown here might not be applicable !
9292/// // Values shown here are possibly random and not representative !
9293/// let mut req = Matter::default();
9294///
9295/// // You can configure optional parameters by calling the respective setters at will, and
9296/// // execute the final call using `doit()`.
9297/// // Values shown here are possibly random and not representative !
9298/// let result = hub.matters().create(req)
9299///              .doit().await;
9300/// # }
9301/// ```
9302pub struct MatterCreateCall<'a, C>
9303where
9304    C: 'a,
9305{
9306    hub: &'a Vault<C>,
9307    _request: Matter,
9308    _delegate: Option<&'a mut dyn common::Delegate>,
9309    _additional_params: HashMap<String, String>,
9310    _scopes: BTreeSet<String>,
9311}
9312
9313impl<'a, C> common::CallBuilder for MatterCreateCall<'a, C> {}
9314
9315impl<'a, C> MatterCreateCall<'a, C>
9316where
9317    C: common::Connector,
9318{
9319    /// Perform the operation you have build so far.
9320    pub async fn doit(mut self) -> common::Result<(common::Response, Matter)> {
9321        use std::borrow::Cow;
9322        use std::io::{Read, Seek};
9323
9324        use common::{url::Params, ToParts};
9325        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9326
9327        let mut dd = common::DefaultDelegate;
9328        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9329        dlg.begin(common::MethodInfo {
9330            id: "vault.matters.create",
9331            http_method: hyper::Method::POST,
9332        });
9333
9334        for &field in ["alt"].iter() {
9335            if self._additional_params.contains_key(field) {
9336                dlg.finished(false);
9337                return Err(common::Error::FieldClash(field));
9338            }
9339        }
9340
9341        let mut params = Params::with_capacity(3 + self._additional_params.len());
9342
9343        params.extend(self._additional_params.iter());
9344
9345        params.push("alt", "json");
9346        let mut url = self.hub._base_url.clone() + "v1/matters";
9347        if self._scopes.is_empty() {
9348            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
9349        }
9350
9351        let url = params.parse_with_url(&url);
9352
9353        let mut json_mime_type = mime::APPLICATION_JSON;
9354        let mut request_value_reader = {
9355            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9356            common::remove_json_null_values(&mut value);
9357            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9358            serde_json::to_writer(&mut dst, &value).unwrap();
9359            dst
9360        };
9361        let request_size = request_value_reader
9362            .seek(std::io::SeekFrom::End(0))
9363            .unwrap();
9364        request_value_reader
9365            .seek(std::io::SeekFrom::Start(0))
9366            .unwrap();
9367
9368        loop {
9369            let token = match self
9370                .hub
9371                .auth
9372                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9373                .await
9374            {
9375                Ok(token) => token,
9376                Err(e) => match dlg.token(e) {
9377                    Ok(token) => token,
9378                    Err(e) => {
9379                        dlg.finished(false);
9380                        return Err(common::Error::MissingToken(e));
9381                    }
9382                },
9383            };
9384            request_value_reader
9385                .seek(std::io::SeekFrom::Start(0))
9386                .unwrap();
9387            let mut req_result = {
9388                let client = &self.hub.client;
9389                dlg.pre_request();
9390                let mut req_builder = hyper::Request::builder()
9391                    .method(hyper::Method::POST)
9392                    .uri(url.as_str())
9393                    .header(USER_AGENT, self.hub._user_agent.clone());
9394
9395                if let Some(token) = token.as_ref() {
9396                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9397                }
9398
9399                let request = req_builder
9400                    .header(CONTENT_TYPE, json_mime_type.to_string())
9401                    .header(CONTENT_LENGTH, request_size as u64)
9402                    .body(common::to_body(
9403                        request_value_reader.get_ref().clone().into(),
9404                    ));
9405
9406                client.request(request.unwrap()).await
9407            };
9408
9409            match req_result {
9410                Err(err) => {
9411                    if let common::Retry::After(d) = dlg.http_error(&err) {
9412                        sleep(d).await;
9413                        continue;
9414                    }
9415                    dlg.finished(false);
9416                    return Err(common::Error::HttpError(err));
9417                }
9418                Ok(res) => {
9419                    let (mut parts, body) = res.into_parts();
9420                    let mut body = common::Body::new(body);
9421                    if !parts.status.is_success() {
9422                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9423                        let error = serde_json::from_str(&common::to_string(&bytes));
9424                        let response = common::to_response(parts, bytes.into());
9425
9426                        if let common::Retry::After(d) =
9427                            dlg.http_failure(&response, error.as_ref().ok())
9428                        {
9429                            sleep(d).await;
9430                            continue;
9431                        }
9432
9433                        dlg.finished(false);
9434
9435                        return Err(match error {
9436                            Ok(value) => common::Error::BadRequest(value),
9437                            _ => common::Error::Failure(response),
9438                        });
9439                    }
9440                    let response = {
9441                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9442                        let encoded = common::to_string(&bytes);
9443                        match serde_json::from_str(&encoded) {
9444                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9445                            Err(error) => {
9446                                dlg.response_json_decode_error(&encoded, &error);
9447                                return Err(common::Error::JsonDecodeError(
9448                                    encoded.to_string(),
9449                                    error,
9450                                ));
9451                            }
9452                        }
9453                    };
9454
9455                    dlg.finished(true);
9456                    return Ok(response);
9457                }
9458            }
9459        }
9460    }
9461
9462    ///
9463    /// Sets the *request* property to the given value.
9464    ///
9465    /// Even though the property as already been set when instantiating this call,
9466    /// we provide this method for API completeness.
9467    pub fn request(mut self, new_value: Matter) -> MatterCreateCall<'a, C> {
9468        self._request = new_value;
9469        self
9470    }
9471    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9472    /// while executing the actual API request.
9473    ///
9474    /// ````text
9475    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9476    /// ````
9477    ///
9478    /// Sets the *delegate* property to the given value.
9479    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MatterCreateCall<'a, C> {
9480        self._delegate = Some(new_value);
9481        self
9482    }
9483
9484    /// Set any additional parameter of the query string used in the request.
9485    /// It should be used to set parameters which are not yet available through their own
9486    /// setters.
9487    ///
9488    /// Please note that this method must not be used to set any of the known parameters
9489    /// which have their own setter method. If done anyway, the request will fail.
9490    ///
9491    /// # Additional Parameters
9492    ///
9493    /// * *$.xgafv* (query-string) - V1 error format.
9494    /// * *access_token* (query-string) - OAuth access token.
9495    /// * *alt* (query-string) - Data format for response.
9496    /// * *callback* (query-string) - JSONP
9497    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9498    /// * *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.
9499    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9500    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9501    /// * *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.
9502    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9503    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9504    pub fn param<T>(mut self, name: T, value: T) -> MatterCreateCall<'a, C>
9505    where
9506        T: AsRef<str>,
9507    {
9508        self._additional_params
9509            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9510        self
9511    }
9512
9513    /// Identifies the authorization scope for the method you are building.
9514    ///
9515    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9516    /// [`Scope::Ediscovery`].
9517    ///
9518    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9519    /// tokens for more than one scope.
9520    ///
9521    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9522    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9523    /// sufficient, a read-write scope will do as well.
9524    pub fn add_scope<St>(mut self, scope: St) -> MatterCreateCall<'a, C>
9525    where
9526        St: AsRef<str>,
9527    {
9528        self._scopes.insert(String::from(scope.as_ref()));
9529        self
9530    }
9531    /// Identifies the authorization scope(s) for the method you are building.
9532    ///
9533    /// See [`Self::add_scope()`] for details.
9534    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterCreateCall<'a, C>
9535    where
9536        I: IntoIterator<Item = St>,
9537        St: AsRef<str>,
9538    {
9539        self._scopes
9540            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9541        self
9542    }
9543
9544    /// Removes all scopes, and no default scope will be used either.
9545    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9546    /// for details).
9547    pub fn clear_scopes(mut self) -> MatterCreateCall<'a, C> {
9548        self._scopes.clear();
9549        self
9550    }
9551}
9552
9553/// Deletes the specified matter. Returns the matter with updated state.
9554///
9555/// A builder for the *delete* method supported by a *matter* resource.
9556/// It is not used directly, but through a [`MatterMethods`] instance.
9557///
9558/// # Example
9559///
9560/// Instantiate a resource method builder
9561///
9562/// ```test_harness,no_run
9563/// # extern crate hyper;
9564/// # extern crate hyper_rustls;
9565/// # extern crate google_vault1 as vault1;
9566/// # async fn dox() {
9567/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9568///
9569/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9570/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9571/// #     .with_native_roots()
9572/// #     .unwrap()
9573/// #     .https_only()
9574/// #     .enable_http2()
9575/// #     .build();
9576///
9577/// # let executor = hyper_util::rt::TokioExecutor::new();
9578/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9579/// #     secret,
9580/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9581/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9582/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9583/// #     ),
9584/// # ).build().await.unwrap();
9585///
9586/// # let client = hyper_util::client::legacy::Client::builder(
9587/// #     hyper_util::rt::TokioExecutor::new()
9588/// # )
9589/// # .build(
9590/// #     hyper_rustls::HttpsConnectorBuilder::new()
9591/// #         .with_native_roots()
9592/// #         .unwrap()
9593/// #         .https_or_http()
9594/// #         .enable_http2()
9595/// #         .build()
9596/// # );
9597/// # let mut hub = Vault::new(client, auth);
9598/// // You can configure optional parameters by calling the respective setters at will, and
9599/// // execute the final call using `doit()`.
9600/// // Values shown here are possibly random and not representative !
9601/// let result = hub.matters().delete("matterId")
9602///              .doit().await;
9603/// # }
9604/// ```
9605pub struct MatterDeleteCall<'a, C>
9606where
9607    C: 'a,
9608{
9609    hub: &'a Vault<C>,
9610    _matter_id: String,
9611    _delegate: Option<&'a mut dyn common::Delegate>,
9612    _additional_params: HashMap<String, String>,
9613    _scopes: BTreeSet<String>,
9614}
9615
9616impl<'a, C> common::CallBuilder for MatterDeleteCall<'a, C> {}
9617
9618impl<'a, C> MatterDeleteCall<'a, C>
9619where
9620    C: common::Connector,
9621{
9622    /// Perform the operation you have build so far.
9623    pub async fn doit(mut self) -> common::Result<(common::Response, Matter)> {
9624        use std::borrow::Cow;
9625        use std::io::{Read, Seek};
9626
9627        use common::{url::Params, ToParts};
9628        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9629
9630        let mut dd = common::DefaultDelegate;
9631        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9632        dlg.begin(common::MethodInfo {
9633            id: "vault.matters.delete",
9634            http_method: hyper::Method::DELETE,
9635        });
9636
9637        for &field in ["alt", "matterId"].iter() {
9638            if self._additional_params.contains_key(field) {
9639                dlg.finished(false);
9640                return Err(common::Error::FieldClash(field));
9641            }
9642        }
9643
9644        let mut params = Params::with_capacity(3 + self._additional_params.len());
9645        params.push("matterId", self._matter_id);
9646
9647        params.extend(self._additional_params.iter());
9648
9649        params.push("alt", "json");
9650        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}";
9651        if self._scopes.is_empty() {
9652            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
9653        }
9654
9655        #[allow(clippy::single_element_loop)]
9656        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
9657            url = params.uri_replacement(url, param_name, find_this, false);
9658        }
9659        {
9660            let to_remove = ["matterId"];
9661            params.remove_params(&to_remove);
9662        }
9663
9664        let url = params.parse_with_url(&url);
9665
9666        loop {
9667            let token = match self
9668                .hub
9669                .auth
9670                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9671                .await
9672            {
9673                Ok(token) => token,
9674                Err(e) => match dlg.token(e) {
9675                    Ok(token) => token,
9676                    Err(e) => {
9677                        dlg.finished(false);
9678                        return Err(common::Error::MissingToken(e));
9679                    }
9680                },
9681            };
9682            let mut req_result = {
9683                let client = &self.hub.client;
9684                dlg.pre_request();
9685                let mut req_builder = hyper::Request::builder()
9686                    .method(hyper::Method::DELETE)
9687                    .uri(url.as_str())
9688                    .header(USER_AGENT, self.hub._user_agent.clone());
9689
9690                if let Some(token) = token.as_ref() {
9691                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9692                }
9693
9694                let request = req_builder
9695                    .header(CONTENT_LENGTH, 0_u64)
9696                    .body(common::to_body::<String>(None));
9697
9698                client.request(request.unwrap()).await
9699            };
9700
9701            match req_result {
9702                Err(err) => {
9703                    if let common::Retry::After(d) = dlg.http_error(&err) {
9704                        sleep(d).await;
9705                        continue;
9706                    }
9707                    dlg.finished(false);
9708                    return Err(common::Error::HttpError(err));
9709                }
9710                Ok(res) => {
9711                    let (mut parts, body) = res.into_parts();
9712                    let mut body = common::Body::new(body);
9713                    if !parts.status.is_success() {
9714                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9715                        let error = serde_json::from_str(&common::to_string(&bytes));
9716                        let response = common::to_response(parts, bytes.into());
9717
9718                        if let common::Retry::After(d) =
9719                            dlg.http_failure(&response, error.as_ref().ok())
9720                        {
9721                            sleep(d).await;
9722                            continue;
9723                        }
9724
9725                        dlg.finished(false);
9726
9727                        return Err(match error {
9728                            Ok(value) => common::Error::BadRequest(value),
9729                            _ => common::Error::Failure(response),
9730                        });
9731                    }
9732                    let response = {
9733                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9734                        let encoded = common::to_string(&bytes);
9735                        match serde_json::from_str(&encoded) {
9736                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9737                            Err(error) => {
9738                                dlg.response_json_decode_error(&encoded, &error);
9739                                return Err(common::Error::JsonDecodeError(
9740                                    encoded.to_string(),
9741                                    error,
9742                                ));
9743                            }
9744                        }
9745                    };
9746
9747                    dlg.finished(true);
9748                    return Ok(response);
9749                }
9750            }
9751        }
9752    }
9753
9754    /// The matter ID
9755    ///
9756    /// Sets the *matter id* path property to the given value.
9757    ///
9758    /// Even though the property as already been set when instantiating this call,
9759    /// we provide this method for API completeness.
9760    pub fn matter_id(mut self, new_value: &str) -> MatterDeleteCall<'a, C> {
9761        self._matter_id = new_value.to_string();
9762        self
9763    }
9764    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9765    /// while executing the actual API request.
9766    ///
9767    /// ````text
9768    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9769    /// ````
9770    ///
9771    /// Sets the *delegate* property to the given value.
9772    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MatterDeleteCall<'a, C> {
9773        self._delegate = Some(new_value);
9774        self
9775    }
9776
9777    /// Set any additional parameter of the query string used in the request.
9778    /// It should be used to set parameters which are not yet available through their own
9779    /// setters.
9780    ///
9781    /// Please note that this method must not be used to set any of the known parameters
9782    /// which have their own setter method. If done anyway, the request will fail.
9783    ///
9784    /// # Additional Parameters
9785    ///
9786    /// * *$.xgafv* (query-string) - V1 error format.
9787    /// * *access_token* (query-string) - OAuth access token.
9788    /// * *alt* (query-string) - Data format for response.
9789    /// * *callback* (query-string) - JSONP
9790    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9791    /// * *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.
9792    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9793    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9794    /// * *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.
9795    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9796    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9797    pub fn param<T>(mut self, name: T, value: T) -> MatterDeleteCall<'a, C>
9798    where
9799        T: AsRef<str>,
9800    {
9801        self._additional_params
9802            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9803        self
9804    }
9805
9806    /// Identifies the authorization scope for the method you are building.
9807    ///
9808    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9809    /// [`Scope::Ediscovery`].
9810    ///
9811    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9812    /// tokens for more than one scope.
9813    ///
9814    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9815    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9816    /// sufficient, a read-write scope will do as well.
9817    pub fn add_scope<St>(mut self, scope: St) -> MatterDeleteCall<'a, C>
9818    where
9819        St: AsRef<str>,
9820    {
9821        self._scopes.insert(String::from(scope.as_ref()));
9822        self
9823    }
9824    /// Identifies the authorization scope(s) for the method you are building.
9825    ///
9826    /// See [`Self::add_scope()`] for details.
9827    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterDeleteCall<'a, C>
9828    where
9829        I: IntoIterator<Item = St>,
9830        St: AsRef<str>,
9831    {
9832        self._scopes
9833            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9834        self
9835    }
9836
9837    /// Removes all scopes, and no default scope will be used either.
9838    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9839    /// for details).
9840    pub fn clear_scopes(mut self) -> MatterDeleteCall<'a, C> {
9841        self._scopes.clear();
9842        self
9843    }
9844}
9845
9846/// Gets the specified matter.
9847///
9848/// A builder for the *get* method supported by a *matter* resource.
9849/// It is not used directly, but through a [`MatterMethods`] instance.
9850///
9851/// # Example
9852///
9853/// Instantiate a resource method builder
9854///
9855/// ```test_harness,no_run
9856/// # extern crate hyper;
9857/// # extern crate hyper_rustls;
9858/// # extern crate google_vault1 as vault1;
9859/// # async fn dox() {
9860/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9861///
9862/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9863/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9864/// #     .with_native_roots()
9865/// #     .unwrap()
9866/// #     .https_only()
9867/// #     .enable_http2()
9868/// #     .build();
9869///
9870/// # let executor = hyper_util::rt::TokioExecutor::new();
9871/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9872/// #     secret,
9873/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9874/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9875/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9876/// #     ),
9877/// # ).build().await.unwrap();
9878///
9879/// # let client = hyper_util::client::legacy::Client::builder(
9880/// #     hyper_util::rt::TokioExecutor::new()
9881/// # )
9882/// # .build(
9883/// #     hyper_rustls::HttpsConnectorBuilder::new()
9884/// #         .with_native_roots()
9885/// #         .unwrap()
9886/// #         .https_or_http()
9887/// #         .enable_http2()
9888/// #         .build()
9889/// # );
9890/// # let mut hub = Vault::new(client, auth);
9891/// // You can configure optional parameters by calling the respective setters at will, and
9892/// // execute the final call using `doit()`.
9893/// // Values shown here are possibly random and not representative !
9894/// let result = hub.matters().get("matterId")
9895///              .view("consetetur")
9896///              .doit().await;
9897/// # }
9898/// ```
9899pub struct MatterGetCall<'a, C>
9900where
9901    C: 'a,
9902{
9903    hub: &'a Vault<C>,
9904    _matter_id: String,
9905    _view: Option<String>,
9906    _delegate: Option<&'a mut dyn common::Delegate>,
9907    _additional_params: HashMap<String, String>,
9908    _scopes: BTreeSet<String>,
9909}
9910
9911impl<'a, C> common::CallBuilder for MatterGetCall<'a, C> {}
9912
9913impl<'a, C> MatterGetCall<'a, C>
9914where
9915    C: common::Connector,
9916{
9917    /// Perform the operation you have build so far.
9918    pub async fn doit(mut self) -> common::Result<(common::Response, Matter)> {
9919        use std::borrow::Cow;
9920        use std::io::{Read, Seek};
9921
9922        use common::{url::Params, ToParts};
9923        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9924
9925        let mut dd = common::DefaultDelegate;
9926        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9927        dlg.begin(common::MethodInfo {
9928            id: "vault.matters.get",
9929            http_method: hyper::Method::GET,
9930        });
9931
9932        for &field in ["alt", "matterId", "view"].iter() {
9933            if self._additional_params.contains_key(field) {
9934                dlg.finished(false);
9935                return Err(common::Error::FieldClash(field));
9936            }
9937        }
9938
9939        let mut params = Params::with_capacity(4 + self._additional_params.len());
9940        params.push("matterId", self._matter_id);
9941        if let Some(value) = self._view.as_ref() {
9942            params.push("view", value);
9943        }
9944
9945        params.extend(self._additional_params.iter());
9946
9947        params.push("alt", "json");
9948        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}";
9949        if self._scopes.is_empty() {
9950            self._scopes
9951                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
9952        }
9953
9954        #[allow(clippy::single_element_loop)]
9955        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
9956            url = params.uri_replacement(url, param_name, find_this, false);
9957        }
9958        {
9959            let to_remove = ["matterId"];
9960            params.remove_params(&to_remove);
9961        }
9962
9963        let url = params.parse_with_url(&url);
9964
9965        loop {
9966            let token = match self
9967                .hub
9968                .auth
9969                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9970                .await
9971            {
9972                Ok(token) => token,
9973                Err(e) => match dlg.token(e) {
9974                    Ok(token) => token,
9975                    Err(e) => {
9976                        dlg.finished(false);
9977                        return Err(common::Error::MissingToken(e));
9978                    }
9979                },
9980            };
9981            let mut req_result = {
9982                let client = &self.hub.client;
9983                dlg.pre_request();
9984                let mut req_builder = hyper::Request::builder()
9985                    .method(hyper::Method::GET)
9986                    .uri(url.as_str())
9987                    .header(USER_AGENT, self.hub._user_agent.clone());
9988
9989                if let Some(token) = token.as_ref() {
9990                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9991                }
9992
9993                let request = req_builder
9994                    .header(CONTENT_LENGTH, 0_u64)
9995                    .body(common::to_body::<String>(None));
9996
9997                client.request(request.unwrap()).await
9998            };
9999
10000            match req_result {
10001                Err(err) => {
10002                    if let common::Retry::After(d) = dlg.http_error(&err) {
10003                        sleep(d).await;
10004                        continue;
10005                    }
10006                    dlg.finished(false);
10007                    return Err(common::Error::HttpError(err));
10008                }
10009                Ok(res) => {
10010                    let (mut parts, body) = res.into_parts();
10011                    let mut body = common::Body::new(body);
10012                    if !parts.status.is_success() {
10013                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10014                        let error = serde_json::from_str(&common::to_string(&bytes));
10015                        let response = common::to_response(parts, bytes.into());
10016
10017                        if let common::Retry::After(d) =
10018                            dlg.http_failure(&response, error.as_ref().ok())
10019                        {
10020                            sleep(d).await;
10021                            continue;
10022                        }
10023
10024                        dlg.finished(false);
10025
10026                        return Err(match error {
10027                            Ok(value) => common::Error::BadRequest(value),
10028                            _ => common::Error::Failure(response),
10029                        });
10030                    }
10031                    let response = {
10032                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10033                        let encoded = common::to_string(&bytes);
10034                        match serde_json::from_str(&encoded) {
10035                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10036                            Err(error) => {
10037                                dlg.response_json_decode_error(&encoded, &error);
10038                                return Err(common::Error::JsonDecodeError(
10039                                    encoded.to_string(),
10040                                    error,
10041                                ));
10042                            }
10043                        }
10044                    };
10045
10046                    dlg.finished(true);
10047                    return Ok(response);
10048                }
10049            }
10050        }
10051    }
10052
10053    /// The matter ID.
10054    ///
10055    /// Sets the *matter id* path property to the given value.
10056    ///
10057    /// Even though the property as already been set when instantiating this call,
10058    /// we provide this method for API completeness.
10059    pub fn matter_id(mut self, new_value: &str) -> MatterGetCall<'a, C> {
10060        self._matter_id = new_value.to_string();
10061        self
10062    }
10063    /// Specifies how much information about the matter to return in the response.
10064    ///
10065    /// Sets the *view* query property to the given value.
10066    pub fn view(mut self, new_value: &str) -> MatterGetCall<'a, C> {
10067        self._view = Some(new_value.to_string());
10068        self
10069    }
10070    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10071    /// while executing the actual API request.
10072    ///
10073    /// ````text
10074    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10075    /// ````
10076    ///
10077    /// Sets the *delegate* property to the given value.
10078    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MatterGetCall<'a, C> {
10079        self._delegate = Some(new_value);
10080        self
10081    }
10082
10083    /// Set any additional parameter of the query string used in the request.
10084    /// It should be used to set parameters which are not yet available through their own
10085    /// setters.
10086    ///
10087    /// Please note that this method must not be used to set any of the known parameters
10088    /// which have their own setter method. If done anyway, the request will fail.
10089    ///
10090    /// # Additional Parameters
10091    ///
10092    /// * *$.xgafv* (query-string) - V1 error format.
10093    /// * *access_token* (query-string) - OAuth access token.
10094    /// * *alt* (query-string) - Data format for response.
10095    /// * *callback* (query-string) - JSONP
10096    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10097    /// * *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.
10098    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10099    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10100    /// * *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.
10101    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10102    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10103    pub fn param<T>(mut self, name: T, value: T) -> MatterGetCall<'a, C>
10104    where
10105        T: AsRef<str>,
10106    {
10107        self._additional_params
10108            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10109        self
10110    }
10111
10112    /// Identifies the authorization scope for the method you are building.
10113    ///
10114    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10115    /// [`Scope::EdiscoveryReadonly`].
10116    ///
10117    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10118    /// tokens for more than one scope.
10119    ///
10120    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10121    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10122    /// sufficient, a read-write scope will do as well.
10123    pub fn add_scope<St>(mut self, scope: St) -> MatterGetCall<'a, C>
10124    where
10125        St: AsRef<str>,
10126    {
10127        self._scopes.insert(String::from(scope.as_ref()));
10128        self
10129    }
10130    /// Identifies the authorization scope(s) for the method you are building.
10131    ///
10132    /// See [`Self::add_scope()`] for details.
10133    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterGetCall<'a, C>
10134    where
10135        I: IntoIterator<Item = St>,
10136        St: AsRef<str>,
10137    {
10138        self._scopes
10139            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10140        self
10141    }
10142
10143    /// Removes all scopes, and no default scope will be used either.
10144    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10145    /// for details).
10146    pub fn clear_scopes(mut self) -> MatterGetCall<'a, C> {
10147        self._scopes.clear();
10148        self
10149    }
10150}
10151
10152/// Lists matters the requestor has access to.
10153///
10154/// A builder for the *list* method supported by a *matter* resource.
10155/// It is not used directly, but through a [`MatterMethods`] instance.
10156///
10157/// # Example
10158///
10159/// Instantiate a resource method builder
10160///
10161/// ```test_harness,no_run
10162/// # extern crate hyper;
10163/// # extern crate hyper_rustls;
10164/// # extern crate google_vault1 as vault1;
10165/// # async fn dox() {
10166/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10167///
10168/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10169/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10170/// #     .with_native_roots()
10171/// #     .unwrap()
10172/// #     .https_only()
10173/// #     .enable_http2()
10174/// #     .build();
10175///
10176/// # let executor = hyper_util::rt::TokioExecutor::new();
10177/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10178/// #     secret,
10179/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10180/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10181/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10182/// #     ),
10183/// # ).build().await.unwrap();
10184///
10185/// # let client = hyper_util::client::legacy::Client::builder(
10186/// #     hyper_util::rt::TokioExecutor::new()
10187/// # )
10188/// # .build(
10189/// #     hyper_rustls::HttpsConnectorBuilder::new()
10190/// #         .with_native_roots()
10191/// #         .unwrap()
10192/// #         .https_or_http()
10193/// #         .enable_http2()
10194/// #         .build()
10195/// # );
10196/// # let mut hub = Vault::new(client, auth);
10197/// // You can configure optional parameters by calling the respective setters at will, and
10198/// // execute the final call using `doit()`.
10199/// // Values shown here are possibly random and not representative !
10200/// let result = hub.matters().list()
10201///              .view("diam")
10202///              .state("dolor")
10203///              .page_token("et")
10204///              .page_size(-22)
10205///              .doit().await;
10206/// # }
10207/// ```
10208pub struct MatterListCall<'a, C>
10209where
10210    C: 'a,
10211{
10212    hub: &'a Vault<C>,
10213    _view: Option<String>,
10214    _state: Option<String>,
10215    _page_token: Option<String>,
10216    _page_size: Option<i32>,
10217    _delegate: Option<&'a mut dyn common::Delegate>,
10218    _additional_params: HashMap<String, String>,
10219    _scopes: BTreeSet<String>,
10220}
10221
10222impl<'a, C> common::CallBuilder for MatterListCall<'a, C> {}
10223
10224impl<'a, C> MatterListCall<'a, C>
10225where
10226    C: common::Connector,
10227{
10228    /// Perform the operation you have build so far.
10229    pub async fn doit(mut self) -> common::Result<(common::Response, ListMattersResponse)> {
10230        use std::borrow::Cow;
10231        use std::io::{Read, Seek};
10232
10233        use common::{url::Params, ToParts};
10234        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10235
10236        let mut dd = common::DefaultDelegate;
10237        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10238        dlg.begin(common::MethodInfo {
10239            id: "vault.matters.list",
10240            http_method: hyper::Method::GET,
10241        });
10242
10243        for &field in ["alt", "view", "state", "pageToken", "pageSize"].iter() {
10244            if self._additional_params.contains_key(field) {
10245                dlg.finished(false);
10246                return Err(common::Error::FieldClash(field));
10247            }
10248        }
10249
10250        let mut params = Params::with_capacity(6 + self._additional_params.len());
10251        if let Some(value) = self._view.as_ref() {
10252            params.push("view", value);
10253        }
10254        if let Some(value) = self._state.as_ref() {
10255            params.push("state", value);
10256        }
10257        if let Some(value) = self._page_token.as_ref() {
10258            params.push("pageToken", value);
10259        }
10260        if let Some(value) = self._page_size.as_ref() {
10261            params.push("pageSize", value.to_string());
10262        }
10263
10264        params.extend(self._additional_params.iter());
10265
10266        params.push("alt", "json");
10267        let mut url = self.hub._base_url.clone() + "v1/matters";
10268        if self._scopes.is_empty() {
10269            self._scopes
10270                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
10271        }
10272
10273        let url = params.parse_with_url(&url);
10274
10275        loop {
10276            let token = match self
10277                .hub
10278                .auth
10279                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10280                .await
10281            {
10282                Ok(token) => token,
10283                Err(e) => match dlg.token(e) {
10284                    Ok(token) => token,
10285                    Err(e) => {
10286                        dlg.finished(false);
10287                        return Err(common::Error::MissingToken(e));
10288                    }
10289                },
10290            };
10291            let mut req_result = {
10292                let client = &self.hub.client;
10293                dlg.pre_request();
10294                let mut req_builder = hyper::Request::builder()
10295                    .method(hyper::Method::GET)
10296                    .uri(url.as_str())
10297                    .header(USER_AGENT, self.hub._user_agent.clone());
10298
10299                if let Some(token) = token.as_ref() {
10300                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10301                }
10302
10303                let request = req_builder
10304                    .header(CONTENT_LENGTH, 0_u64)
10305                    .body(common::to_body::<String>(None));
10306
10307                client.request(request.unwrap()).await
10308            };
10309
10310            match req_result {
10311                Err(err) => {
10312                    if let common::Retry::After(d) = dlg.http_error(&err) {
10313                        sleep(d).await;
10314                        continue;
10315                    }
10316                    dlg.finished(false);
10317                    return Err(common::Error::HttpError(err));
10318                }
10319                Ok(res) => {
10320                    let (mut parts, body) = res.into_parts();
10321                    let mut body = common::Body::new(body);
10322                    if !parts.status.is_success() {
10323                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10324                        let error = serde_json::from_str(&common::to_string(&bytes));
10325                        let response = common::to_response(parts, bytes.into());
10326
10327                        if let common::Retry::After(d) =
10328                            dlg.http_failure(&response, error.as_ref().ok())
10329                        {
10330                            sleep(d).await;
10331                            continue;
10332                        }
10333
10334                        dlg.finished(false);
10335
10336                        return Err(match error {
10337                            Ok(value) => common::Error::BadRequest(value),
10338                            _ => common::Error::Failure(response),
10339                        });
10340                    }
10341                    let response = {
10342                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10343                        let encoded = common::to_string(&bytes);
10344                        match serde_json::from_str(&encoded) {
10345                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10346                            Err(error) => {
10347                                dlg.response_json_decode_error(&encoded, &error);
10348                                return Err(common::Error::JsonDecodeError(
10349                                    encoded.to_string(),
10350                                    error,
10351                                ));
10352                            }
10353                        }
10354                    };
10355
10356                    dlg.finished(true);
10357                    return Ok(response);
10358                }
10359            }
10360        }
10361    }
10362
10363    /// Specifies how much information about the matter to return in response.
10364    ///
10365    /// Sets the *view* query property to the given value.
10366    pub fn view(mut self, new_value: &str) -> MatterListCall<'a, C> {
10367        self._view = Some(new_value.to_string());
10368        self
10369    }
10370    /// If set, lists only matters with the specified state. The default lists matters of all states.
10371    ///
10372    /// Sets the *state* query property to the given value.
10373    pub fn state(mut self, new_value: &str) -> MatterListCall<'a, C> {
10374        self._state = Some(new_value.to_string());
10375        self
10376    }
10377    /// The pagination token as returned in the response.
10378    ///
10379    /// Sets the *page token* query property to the given value.
10380    pub fn page_token(mut self, new_value: &str) -> MatterListCall<'a, C> {
10381        self._page_token = Some(new_value.to_string());
10382        self
10383    }
10384    /// The number of matters to return in the response. Default and maximum are 100.
10385    ///
10386    /// Sets the *page size* query property to the given value.
10387    pub fn page_size(mut self, new_value: i32) -> MatterListCall<'a, C> {
10388        self._page_size = Some(new_value);
10389        self
10390    }
10391    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10392    /// while executing the actual API request.
10393    ///
10394    /// ````text
10395    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10396    /// ````
10397    ///
10398    /// Sets the *delegate* property to the given value.
10399    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MatterListCall<'a, C> {
10400        self._delegate = Some(new_value);
10401        self
10402    }
10403
10404    /// Set any additional parameter of the query string used in the request.
10405    /// It should be used to set parameters which are not yet available through their own
10406    /// setters.
10407    ///
10408    /// Please note that this method must not be used to set any of the known parameters
10409    /// which have their own setter method. If done anyway, the request will fail.
10410    ///
10411    /// # Additional Parameters
10412    ///
10413    /// * *$.xgafv* (query-string) - V1 error format.
10414    /// * *access_token* (query-string) - OAuth access token.
10415    /// * *alt* (query-string) - Data format for response.
10416    /// * *callback* (query-string) - JSONP
10417    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10418    /// * *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.
10419    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10420    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10421    /// * *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.
10422    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10423    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10424    pub fn param<T>(mut self, name: T, value: T) -> MatterListCall<'a, C>
10425    where
10426        T: AsRef<str>,
10427    {
10428        self._additional_params
10429            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10430        self
10431    }
10432
10433    /// Identifies the authorization scope for the method you are building.
10434    ///
10435    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10436    /// [`Scope::EdiscoveryReadonly`].
10437    ///
10438    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10439    /// tokens for more than one scope.
10440    ///
10441    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10442    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10443    /// sufficient, a read-write scope will do as well.
10444    pub fn add_scope<St>(mut self, scope: St) -> MatterListCall<'a, C>
10445    where
10446        St: AsRef<str>,
10447    {
10448        self._scopes.insert(String::from(scope.as_ref()));
10449        self
10450    }
10451    /// Identifies the authorization scope(s) for the method you are building.
10452    ///
10453    /// See [`Self::add_scope()`] for details.
10454    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterListCall<'a, C>
10455    where
10456        I: IntoIterator<Item = St>,
10457        St: AsRef<str>,
10458    {
10459        self._scopes
10460            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10461        self
10462    }
10463
10464    /// Removes all scopes, and no default scope will be used either.
10465    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10466    /// for details).
10467    pub fn clear_scopes(mut self) -> MatterListCall<'a, C> {
10468        self._scopes.clear();
10469        self
10470    }
10471}
10472
10473/// Removes an account as a matter collaborator.
10474///
10475/// A builder for the *removePermissions* method supported by a *matter* resource.
10476/// It is not used directly, but through a [`MatterMethods`] instance.
10477///
10478/// # Example
10479///
10480/// Instantiate a resource method builder
10481///
10482/// ```test_harness,no_run
10483/// # extern crate hyper;
10484/// # extern crate hyper_rustls;
10485/// # extern crate google_vault1 as vault1;
10486/// use vault1::api::RemoveMatterPermissionsRequest;
10487/// # async fn dox() {
10488/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10489///
10490/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10491/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10492/// #     .with_native_roots()
10493/// #     .unwrap()
10494/// #     .https_only()
10495/// #     .enable_http2()
10496/// #     .build();
10497///
10498/// # let executor = hyper_util::rt::TokioExecutor::new();
10499/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10500/// #     secret,
10501/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10502/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10503/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10504/// #     ),
10505/// # ).build().await.unwrap();
10506///
10507/// # let client = hyper_util::client::legacy::Client::builder(
10508/// #     hyper_util::rt::TokioExecutor::new()
10509/// # )
10510/// # .build(
10511/// #     hyper_rustls::HttpsConnectorBuilder::new()
10512/// #         .with_native_roots()
10513/// #         .unwrap()
10514/// #         .https_or_http()
10515/// #         .enable_http2()
10516/// #         .build()
10517/// # );
10518/// # let mut hub = Vault::new(client, auth);
10519/// // As the method needs a request, you would usually fill it with the desired information
10520/// // into the respective structure. Some of the parts shown here might not be applicable !
10521/// // Values shown here are possibly random and not representative !
10522/// let mut req = RemoveMatterPermissionsRequest::default();
10523///
10524/// // You can configure optional parameters by calling the respective setters at will, and
10525/// // execute the final call using `doit()`.
10526/// // Values shown here are possibly random and not representative !
10527/// let result = hub.matters().remove_permissions(req, "matterId")
10528///              .doit().await;
10529/// # }
10530/// ```
10531pub struct MatterRemovePermissionCall<'a, C>
10532where
10533    C: 'a,
10534{
10535    hub: &'a Vault<C>,
10536    _request: RemoveMatterPermissionsRequest,
10537    _matter_id: String,
10538    _delegate: Option<&'a mut dyn common::Delegate>,
10539    _additional_params: HashMap<String, String>,
10540    _scopes: BTreeSet<String>,
10541}
10542
10543impl<'a, C> common::CallBuilder for MatterRemovePermissionCall<'a, C> {}
10544
10545impl<'a, C> MatterRemovePermissionCall<'a, C>
10546where
10547    C: common::Connector,
10548{
10549    /// Perform the operation you have build so far.
10550    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10551        use std::borrow::Cow;
10552        use std::io::{Read, Seek};
10553
10554        use common::{url::Params, ToParts};
10555        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10556
10557        let mut dd = common::DefaultDelegate;
10558        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10559        dlg.begin(common::MethodInfo {
10560            id: "vault.matters.removePermissions",
10561            http_method: hyper::Method::POST,
10562        });
10563
10564        for &field in ["alt", "matterId"].iter() {
10565            if self._additional_params.contains_key(field) {
10566                dlg.finished(false);
10567                return Err(common::Error::FieldClash(field));
10568            }
10569        }
10570
10571        let mut params = Params::with_capacity(4 + self._additional_params.len());
10572        params.push("matterId", self._matter_id);
10573
10574        params.extend(self._additional_params.iter());
10575
10576        params.push("alt", "json");
10577        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}:removePermissions";
10578        if self._scopes.is_empty() {
10579            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
10580        }
10581
10582        #[allow(clippy::single_element_loop)]
10583        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
10584            url = params.uri_replacement(url, param_name, find_this, false);
10585        }
10586        {
10587            let to_remove = ["matterId"];
10588            params.remove_params(&to_remove);
10589        }
10590
10591        let url = params.parse_with_url(&url);
10592
10593        let mut json_mime_type = mime::APPLICATION_JSON;
10594        let mut request_value_reader = {
10595            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10596            common::remove_json_null_values(&mut value);
10597            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10598            serde_json::to_writer(&mut dst, &value).unwrap();
10599            dst
10600        };
10601        let request_size = request_value_reader
10602            .seek(std::io::SeekFrom::End(0))
10603            .unwrap();
10604        request_value_reader
10605            .seek(std::io::SeekFrom::Start(0))
10606            .unwrap();
10607
10608        loop {
10609            let token = match self
10610                .hub
10611                .auth
10612                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10613                .await
10614            {
10615                Ok(token) => token,
10616                Err(e) => match dlg.token(e) {
10617                    Ok(token) => token,
10618                    Err(e) => {
10619                        dlg.finished(false);
10620                        return Err(common::Error::MissingToken(e));
10621                    }
10622                },
10623            };
10624            request_value_reader
10625                .seek(std::io::SeekFrom::Start(0))
10626                .unwrap();
10627            let mut req_result = {
10628                let client = &self.hub.client;
10629                dlg.pre_request();
10630                let mut req_builder = hyper::Request::builder()
10631                    .method(hyper::Method::POST)
10632                    .uri(url.as_str())
10633                    .header(USER_AGENT, self.hub._user_agent.clone());
10634
10635                if let Some(token) = token.as_ref() {
10636                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10637                }
10638
10639                let request = req_builder
10640                    .header(CONTENT_TYPE, json_mime_type.to_string())
10641                    .header(CONTENT_LENGTH, request_size as u64)
10642                    .body(common::to_body(
10643                        request_value_reader.get_ref().clone().into(),
10644                    ));
10645
10646                client.request(request.unwrap()).await
10647            };
10648
10649            match req_result {
10650                Err(err) => {
10651                    if let common::Retry::After(d) = dlg.http_error(&err) {
10652                        sleep(d).await;
10653                        continue;
10654                    }
10655                    dlg.finished(false);
10656                    return Err(common::Error::HttpError(err));
10657                }
10658                Ok(res) => {
10659                    let (mut parts, body) = res.into_parts();
10660                    let mut body = common::Body::new(body);
10661                    if !parts.status.is_success() {
10662                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10663                        let error = serde_json::from_str(&common::to_string(&bytes));
10664                        let response = common::to_response(parts, bytes.into());
10665
10666                        if let common::Retry::After(d) =
10667                            dlg.http_failure(&response, error.as_ref().ok())
10668                        {
10669                            sleep(d).await;
10670                            continue;
10671                        }
10672
10673                        dlg.finished(false);
10674
10675                        return Err(match error {
10676                            Ok(value) => common::Error::BadRequest(value),
10677                            _ => common::Error::Failure(response),
10678                        });
10679                    }
10680                    let response = {
10681                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10682                        let encoded = common::to_string(&bytes);
10683                        match serde_json::from_str(&encoded) {
10684                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10685                            Err(error) => {
10686                                dlg.response_json_decode_error(&encoded, &error);
10687                                return Err(common::Error::JsonDecodeError(
10688                                    encoded.to_string(),
10689                                    error,
10690                                ));
10691                            }
10692                        }
10693                    };
10694
10695                    dlg.finished(true);
10696                    return Ok(response);
10697                }
10698            }
10699        }
10700    }
10701
10702    ///
10703    /// Sets the *request* property to the given value.
10704    ///
10705    /// Even though the property as already been set when instantiating this call,
10706    /// we provide this method for API completeness.
10707    pub fn request(
10708        mut self,
10709        new_value: RemoveMatterPermissionsRequest,
10710    ) -> MatterRemovePermissionCall<'a, C> {
10711        self._request = new_value;
10712        self
10713    }
10714    /// The matter ID.
10715    ///
10716    /// Sets the *matter id* path property to the given value.
10717    ///
10718    /// Even though the property as already been set when instantiating this call,
10719    /// we provide this method for API completeness.
10720    pub fn matter_id(mut self, new_value: &str) -> MatterRemovePermissionCall<'a, C> {
10721        self._matter_id = new_value.to_string();
10722        self
10723    }
10724    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10725    /// while executing the actual API request.
10726    ///
10727    /// ````text
10728    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10729    /// ````
10730    ///
10731    /// Sets the *delegate* property to the given value.
10732    pub fn delegate(
10733        mut self,
10734        new_value: &'a mut dyn common::Delegate,
10735    ) -> MatterRemovePermissionCall<'a, C> {
10736        self._delegate = Some(new_value);
10737        self
10738    }
10739
10740    /// Set any additional parameter of the query string used in the request.
10741    /// It should be used to set parameters which are not yet available through their own
10742    /// setters.
10743    ///
10744    /// Please note that this method must not be used to set any of the known parameters
10745    /// which have their own setter method. If done anyway, the request will fail.
10746    ///
10747    /// # Additional Parameters
10748    ///
10749    /// * *$.xgafv* (query-string) - V1 error format.
10750    /// * *access_token* (query-string) - OAuth access token.
10751    /// * *alt* (query-string) - Data format for response.
10752    /// * *callback* (query-string) - JSONP
10753    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10754    /// * *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.
10755    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10756    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10757    /// * *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.
10758    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10759    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10760    pub fn param<T>(mut self, name: T, value: T) -> MatterRemovePermissionCall<'a, C>
10761    where
10762        T: AsRef<str>,
10763    {
10764        self._additional_params
10765            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10766        self
10767    }
10768
10769    /// Identifies the authorization scope for the method you are building.
10770    ///
10771    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10772    /// [`Scope::Ediscovery`].
10773    ///
10774    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10775    /// tokens for more than one scope.
10776    ///
10777    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10778    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10779    /// sufficient, a read-write scope will do as well.
10780    pub fn add_scope<St>(mut self, scope: St) -> MatterRemovePermissionCall<'a, C>
10781    where
10782        St: AsRef<str>,
10783    {
10784        self._scopes.insert(String::from(scope.as_ref()));
10785        self
10786    }
10787    /// Identifies the authorization scope(s) for the method you are building.
10788    ///
10789    /// See [`Self::add_scope()`] for details.
10790    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterRemovePermissionCall<'a, C>
10791    where
10792        I: IntoIterator<Item = St>,
10793        St: AsRef<str>,
10794    {
10795        self._scopes
10796            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10797        self
10798    }
10799
10800    /// Removes all scopes, and no default scope will be used either.
10801    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10802    /// for details).
10803    pub fn clear_scopes(mut self) -> MatterRemovePermissionCall<'a, C> {
10804        self._scopes.clear();
10805        self
10806    }
10807}
10808
10809/// Reopens the specified matter. Returns the matter with updated state.
10810///
10811/// A builder for the *reopen* method supported by a *matter* resource.
10812/// It is not used directly, but through a [`MatterMethods`] instance.
10813///
10814/// # Example
10815///
10816/// Instantiate a resource method builder
10817///
10818/// ```test_harness,no_run
10819/// # extern crate hyper;
10820/// # extern crate hyper_rustls;
10821/// # extern crate google_vault1 as vault1;
10822/// use vault1::api::ReopenMatterRequest;
10823/// # async fn dox() {
10824/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10825///
10826/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10827/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10828/// #     .with_native_roots()
10829/// #     .unwrap()
10830/// #     .https_only()
10831/// #     .enable_http2()
10832/// #     .build();
10833///
10834/// # let executor = hyper_util::rt::TokioExecutor::new();
10835/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10836/// #     secret,
10837/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10838/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10839/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10840/// #     ),
10841/// # ).build().await.unwrap();
10842///
10843/// # let client = hyper_util::client::legacy::Client::builder(
10844/// #     hyper_util::rt::TokioExecutor::new()
10845/// # )
10846/// # .build(
10847/// #     hyper_rustls::HttpsConnectorBuilder::new()
10848/// #         .with_native_roots()
10849/// #         .unwrap()
10850/// #         .https_or_http()
10851/// #         .enable_http2()
10852/// #         .build()
10853/// # );
10854/// # let mut hub = Vault::new(client, auth);
10855/// // As the method needs a request, you would usually fill it with the desired information
10856/// // into the respective structure. Some of the parts shown here might not be applicable !
10857/// // Values shown here are possibly random and not representative !
10858/// let mut req = ReopenMatterRequest::default();
10859///
10860/// // You can configure optional parameters by calling the respective setters at will, and
10861/// // execute the final call using `doit()`.
10862/// // Values shown here are possibly random and not representative !
10863/// let result = hub.matters().reopen(req, "matterId")
10864///              .doit().await;
10865/// # }
10866/// ```
10867pub struct MatterReopenCall<'a, C>
10868where
10869    C: 'a,
10870{
10871    hub: &'a Vault<C>,
10872    _request: ReopenMatterRequest,
10873    _matter_id: String,
10874    _delegate: Option<&'a mut dyn common::Delegate>,
10875    _additional_params: HashMap<String, String>,
10876    _scopes: BTreeSet<String>,
10877}
10878
10879impl<'a, C> common::CallBuilder for MatterReopenCall<'a, C> {}
10880
10881impl<'a, C> MatterReopenCall<'a, C>
10882where
10883    C: common::Connector,
10884{
10885    /// Perform the operation you have build so far.
10886    pub async fn doit(mut self) -> common::Result<(common::Response, ReopenMatterResponse)> {
10887        use std::borrow::Cow;
10888        use std::io::{Read, Seek};
10889
10890        use common::{url::Params, ToParts};
10891        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10892
10893        let mut dd = common::DefaultDelegate;
10894        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10895        dlg.begin(common::MethodInfo {
10896            id: "vault.matters.reopen",
10897            http_method: hyper::Method::POST,
10898        });
10899
10900        for &field in ["alt", "matterId"].iter() {
10901            if self._additional_params.contains_key(field) {
10902                dlg.finished(false);
10903                return Err(common::Error::FieldClash(field));
10904            }
10905        }
10906
10907        let mut params = Params::with_capacity(4 + self._additional_params.len());
10908        params.push("matterId", self._matter_id);
10909
10910        params.extend(self._additional_params.iter());
10911
10912        params.push("alt", "json");
10913        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}:reopen";
10914        if self._scopes.is_empty() {
10915            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
10916        }
10917
10918        #[allow(clippy::single_element_loop)]
10919        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
10920            url = params.uri_replacement(url, param_name, find_this, false);
10921        }
10922        {
10923            let to_remove = ["matterId"];
10924            params.remove_params(&to_remove);
10925        }
10926
10927        let url = params.parse_with_url(&url);
10928
10929        let mut json_mime_type = mime::APPLICATION_JSON;
10930        let mut request_value_reader = {
10931            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10932            common::remove_json_null_values(&mut value);
10933            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10934            serde_json::to_writer(&mut dst, &value).unwrap();
10935            dst
10936        };
10937        let request_size = request_value_reader
10938            .seek(std::io::SeekFrom::End(0))
10939            .unwrap();
10940        request_value_reader
10941            .seek(std::io::SeekFrom::Start(0))
10942            .unwrap();
10943
10944        loop {
10945            let token = match self
10946                .hub
10947                .auth
10948                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10949                .await
10950            {
10951                Ok(token) => token,
10952                Err(e) => match dlg.token(e) {
10953                    Ok(token) => token,
10954                    Err(e) => {
10955                        dlg.finished(false);
10956                        return Err(common::Error::MissingToken(e));
10957                    }
10958                },
10959            };
10960            request_value_reader
10961                .seek(std::io::SeekFrom::Start(0))
10962                .unwrap();
10963            let mut req_result = {
10964                let client = &self.hub.client;
10965                dlg.pre_request();
10966                let mut req_builder = hyper::Request::builder()
10967                    .method(hyper::Method::POST)
10968                    .uri(url.as_str())
10969                    .header(USER_AGENT, self.hub._user_agent.clone());
10970
10971                if let Some(token) = token.as_ref() {
10972                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10973                }
10974
10975                let request = req_builder
10976                    .header(CONTENT_TYPE, json_mime_type.to_string())
10977                    .header(CONTENT_LENGTH, request_size as u64)
10978                    .body(common::to_body(
10979                        request_value_reader.get_ref().clone().into(),
10980                    ));
10981
10982                client.request(request.unwrap()).await
10983            };
10984
10985            match req_result {
10986                Err(err) => {
10987                    if let common::Retry::After(d) = dlg.http_error(&err) {
10988                        sleep(d).await;
10989                        continue;
10990                    }
10991                    dlg.finished(false);
10992                    return Err(common::Error::HttpError(err));
10993                }
10994                Ok(res) => {
10995                    let (mut parts, body) = res.into_parts();
10996                    let mut body = common::Body::new(body);
10997                    if !parts.status.is_success() {
10998                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10999                        let error = serde_json::from_str(&common::to_string(&bytes));
11000                        let response = common::to_response(parts, bytes.into());
11001
11002                        if let common::Retry::After(d) =
11003                            dlg.http_failure(&response, error.as_ref().ok())
11004                        {
11005                            sleep(d).await;
11006                            continue;
11007                        }
11008
11009                        dlg.finished(false);
11010
11011                        return Err(match error {
11012                            Ok(value) => common::Error::BadRequest(value),
11013                            _ => common::Error::Failure(response),
11014                        });
11015                    }
11016                    let response = {
11017                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11018                        let encoded = common::to_string(&bytes);
11019                        match serde_json::from_str(&encoded) {
11020                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11021                            Err(error) => {
11022                                dlg.response_json_decode_error(&encoded, &error);
11023                                return Err(common::Error::JsonDecodeError(
11024                                    encoded.to_string(),
11025                                    error,
11026                                ));
11027                            }
11028                        }
11029                    };
11030
11031                    dlg.finished(true);
11032                    return Ok(response);
11033                }
11034            }
11035        }
11036    }
11037
11038    ///
11039    /// Sets the *request* property to the given value.
11040    ///
11041    /// Even though the property as already been set when instantiating this call,
11042    /// we provide this method for API completeness.
11043    pub fn request(mut self, new_value: ReopenMatterRequest) -> MatterReopenCall<'a, C> {
11044        self._request = new_value;
11045        self
11046    }
11047    /// The matter ID.
11048    ///
11049    /// Sets the *matter id* path property to the given value.
11050    ///
11051    /// Even though the property as already been set when instantiating this call,
11052    /// we provide this method for API completeness.
11053    pub fn matter_id(mut self, new_value: &str) -> MatterReopenCall<'a, C> {
11054        self._matter_id = new_value.to_string();
11055        self
11056    }
11057    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11058    /// while executing the actual API request.
11059    ///
11060    /// ````text
11061    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11062    /// ````
11063    ///
11064    /// Sets the *delegate* property to the given value.
11065    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MatterReopenCall<'a, C> {
11066        self._delegate = Some(new_value);
11067        self
11068    }
11069
11070    /// Set any additional parameter of the query string used in the request.
11071    /// It should be used to set parameters which are not yet available through their own
11072    /// setters.
11073    ///
11074    /// Please note that this method must not be used to set any of the known parameters
11075    /// which have their own setter method. If done anyway, the request will fail.
11076    ///
11077    /// # Additional Parameters
11078    ///
11079    /// * *$.xgafv* (query-string) - V1 error format.
11080    /// * *access_token* (query-string) - OAuth access token.
11081    /// * *alt* (query-string) - Data format for response.
11082    /// * *callback* (query-string) - JSONP
11083    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11084    /// * *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.
11085    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11086    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11087    /// * *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.
11088    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11089    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11090    pub fn param<T>(mut self, name: T, value: T) -> MatterReopenCall<'a, C>
11091    where
11092        T: AsRef<str>,
11093    {
11094        self._additional_params
11095            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11096        self
11097    }
11098
11099    /// Identifies the authorization scope for the method you are building.
11100    ///
11101    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11102    /// [`Scope::Ediscovery`].
11103    ///
11104    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11105    /// tokens for more than one scope.
11106    ///
11107    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11108    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11109    /// sufficient, a read-write scope will do as well.
11110    pub fn add_scope<St>(mut self, scope: St) -> MatterReopenCall<'a, C>
11111    where
11112        St: AsRef<str>,
11113    {
11114        self._scopes.insert(String::from(scope.as_ref()));
11115        self
11116    }
11117    /// Identifies the authorization scope(s) for the method you are building.
11118    ///
11119    /// See [`Self::add_scope()`] for details.
11120    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterReopenCall<'a, C>
11121    where
11122        I: IntoIterator<Item = St>,
11123        St: AsRef<str>,
11124    {
11125        self._scopes
11126            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11127        self
11128    }
11129
11130    /// Removes all scopes, and no default scope will be used either.
11131    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11132    /// for details).
11133    pub fn clear_scopes(mut self) -> MatterReopenCall<'a, C> {
11134        self._scopes.clear();
11135        self
11136    }
11137}
11138
11139/// Undeletes the specified matter. Returns the matter with updated state.
11140///
11141/// A builder for the *undelete* method supported by a *matter* resource.
11142/// It is not used directly, but through a [`MatterMethods`] instance.
11143///
11144/// # Example
11145///
11146/// Instantiate a resource method builder
11147///
11148/// ```test_harness,no_run
11149/// # extern crate hyper;
11150/// # extern crate hyper_rustls;
11151/// # extern crate google_vault1 as vault1;
11152/// use vault1::api::UndeleteMatterRequest;
11153/// # async fn dox() {
11154/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11155///
11156/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11157/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11158/// #     .with_native_roots()
11159/// #     .unwrap()
11160/// #     .https_only()
11161/// #     .enable_http2()
11162/// #     .build();
11163///
11164/// # let executor = hyper_util::rt::TokioExecutor::new();
11165/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11166/// #     secret,
11167/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11168/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11169/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11170/// #     ),
11171/// # ).build().await.unwrap();
11172///
11173/// # let client = hyper_util::client::legacy::Client::builder(
11174/// #     hyper_util::rt::TokioExecutor::new()
11175/// # )
11176/// # .build(
11177/// #     hyper_rustls::HttpsConnectorBuilder::new()
11178/// #         .with_native_roots()
11179/// #         .unwrap()
11180/// #         .https_or_http()
11181/// #         .enable_http2()
11182/// #         .build()
11183/// # );
11184/// # let mut hub = Vault::new(client, auth);
11185/// // As the method needs a request, you would usually fill it with the desired information
11186/// // into the respective structure. Some of the parts shown here might not be applicable !
11187/// // Values shown here are possibly random and not representative !
11188/// let mut req = UndeleteMatterRequest::default();
11189///
11190/// // You can configure optional parameters by calling the respective setters at will, and
11191/// // execute the final call using `doit()`.
11192/// // Values shown here are possibly random and not representative !
11193/// let result = hub.matters().undelete(req, "matterId")
11194///              .doit().await;
11195/// # }
11196/// ```
11197pub struct MatterUndeleteCall<'a, C>
11198where
11199    C: 'a,
11200{
11201    hub: &'a Vault<C>,
11202    _request: UndeleteMatterRequest,
11203    _matter_id: String,
11204    _delegate: Option<&'a mut dyn common::Delegate>,
11205    _additional_params: HashMap<String, String>,
11206    _scopes: BTreeSet<String>,
11207}
11208
11209impl<'a, C> common::CallBuilder for MatterUndeleteCall<'a, C> {}
11210
11211impl<'a, C> MatterUndeleteCall<'a, C>
11212where
11213    C: common::Connector,
11214{
11215    /// Perform the operation you have build so far.
11216    pub async fn doit(mut self) -> common::Result<(common::Response, Matter)> {
11217        use std::borrow::Cow;
11218        use std::io::{Read, Seek};
11219
11220        use common::{url::Params, ToParts};
11221        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11222
11223        let mut dd = common::DefaultDelegate;
11224        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11225        dlg.begin(common::MethodInfo {
11226            id: "vault.matters.undelete",
11227            http_method: hyper::Method::POST,
11228        });
11229
11230        for &field in ["alt", "matterId"].iter() {
11231            if self._additional_params.contains_key(field) {
11232                dlg.finished(false);
11233                return Err(common::Error::FieldClash(field));
11234            }
11235        }
11236
11237        let mut params = Params::with_capacity(4 + self._additional_params.len());
11238        params.push("matterId", self._matter_id);
11239
11240        params.extend(self._additional_params.iter());
11241
11242        params.push("alt", "json");
11243        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}:undelete";
11244        if self._scopes.is_empty() {
11245            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
11246        }
11247
11248        #[allow(clippy::single_element_loop)]
11249        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
11250            url = params.uri_replacement(url, param_name, find_this, false);
11251        }
11252        {
11253            let to_remove = ["matterId"];
11254            params.remove_params(&to_remove);
11255        }
11256
11257        let url = params.parse_with_url(&url);
11258
11259        let mut json_mime_type = mime::APPLICATION_JSON;
11260        let mut request_value_reader = {
11261            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11262            common::remove_json_null_values(&mut value);
11263            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11264            serde_json::to_writer(&mut dst, &value).unwrap();
11265            dst
11266        };
11267        let request_size = request_value_reader
11268            .seek(std::io::SeekFrom::End(0))
11269            .unwrap();
11270        request_value_reader
11271            .seek(std::io::SeekFrom::Start(0))
11272            .unwrap();
11273
11274        loop {
11275            let token = match self
11276                .hub
11277                .auth
11278                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11279                .await
11280            {
11281                Ok(token) => token,
11282                Err(e) => match dlg.token(e) {
11283                    Ok(token) => token,
11284                    Err(e) => {
11285                        dlg.finished(false);
11286                        return Err(common::Error::MissingToken(e));
11287                    }
11288                },
11289            };
11290            request_value_reader
11291                .seek(std::io::SeekFrom::Start(0))
11292                .unwrap();
11293            let mut req_result = {
11294                let client = &self.hub.client;
11295                dlg.pre_request();
11296                let mut req_builder = hyper::Request::builder()
11297                    .method(hyper::Method::POST)
11298                    .uri(url.as_str())
11299                    .header(USER_AGENT, self.hub._user_agent.clone());
11300
11301                if let Some(token) = token.as_ref() {
11302                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11303                }
11304
11305                let request = req_builder
11306                    .header(CONTENT_TYPE, json_mime_type.to_string())
11307                    .header(CONTENT_LENGTH, request_size as u64)
11308                    .body(common::to_body(
11309                        request_value_reader.get_ref().clone().into(),
11310                    ));
11311
11312                client.request(request.unwrap()).await
11313            };
11314
11315            match req_result {
11316                Err(err) => {
11317                    if let common::Retry::After(d) = dlg.http_error(&err) {
11318                        sleep(d).await;
11319                        continue;
11320                    }
11321                    dlg.finished(false);
11322                    return Err(common::Error::HttpError(err));
11323                }
11324                Ok(res) => {
11325                    let (mut parts, body) = res.into_parts();
11326                    let mut body = common::Body::new(body);
11327                    if !parts.status.is_success() {
11328                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11329                        let error = serde_json::from_str(&common::to_string(&bytes));
11330                        let response = common::to_response(parts, bytes.into());
11331
11332                        if let common::Retry::After(d) =
11333                            dlg.http_failure(&response, error.as_ref().ok())
11334                        {
11335                            sleep(d).await;
11336                            continue;
11337                        }
11338
11339                        dlg.finished(false);
11340
11341                        return Err(match error {
11342                            Ok(value) => common::Error::BadRequest(value),
11343                            _ => common::Error::Failure(response),
11344                        });
11345                    }
11346                    let response = {
11347                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11348                        let encoded = common::to_string(&bytes);
11349                        match serde_json::from_str(&encoded) {
11350                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11351                            Err(error) => {
11352                                dlg.response_json_decode_error(&encoded, &error);
11353                                return Err(common::Error::JsonDecodeError(
11354                                    encoded.to_string(),
11355                                    error,
11356                                ));
11357                            }
11358                        }
11359                    };
11360
11361                    dlg.finished(true);
11362                    return Ok(response);
11363                }
11364            }
11365        }
11366    }
11367
11368    ///
11369    /// Sets the *request* property to the given value.
11370    ///
11371    /// Even though the property as already been set when instantiating this call,
11372    /// we provide this method for API completeness.
11373    pub fn request(mut self, new_value: UndeleteMatterRequest) -> MatterUndeleteCall<'a, C> {
11374        self._request = new_value;
11375        self
11376    }
11377    /// The matter ID.
11378    ///
11379    /// Sets the *matter id* path property to the given value.
11380    ///
11381    /// Even though the property as already been set when instantiating this call,
11382    /// we provide this method for API completeness.
11383    pub fn matter_id(mut self, new_value: &str) -> MatterUndeleteCall<'a, C> {
11384        self._matter_id = new_value.to_string();
11385        self
11386    }
11387    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11388    /// while executing the actual API request.
11389    ///
11390    /// ````text
11391    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11392    /// ````
11393    ///
11394    /// Sets the *delegate* property to the given value.
11395    pub fn delegate(
11396        mut self,
11397        new_value: &'a mut dyn common::Delegate,
11398    ) -> MatterUndeleteCall<'a, C> {
11399        self._delegate = Some(new_value);
11400        self
11401    }
11402
11403    /// Set any additional parameter of the query string used in the request.
11404    /// It should be used to set parameters which are not yet available through their own
11405    /// setters.
11406    ///
11407    /// Please note that this method must not be used to set any of the known parameters
11408    /// which have their own setter method. If done anyway, the request will fail.
11409    ///
11410    /// # Additional Parameters
11411    ///
11412    /// * *$.xgafv* (query-string) - V1 error format.
11413    /// * *access_token* (query-string) - OAuth access token.
11414    /// * *alt* (query-string) - Data format for response.
11415    /// * *callback* (query-string) - JSONP
11416    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11417    /// * *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.
11418    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11419    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11420    /// * *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.
11421    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11422    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11423    pub fn param<T>(mut self, name: T, value: T) -> MatterUndeleteCall<'a, C>
11424    where
11425        T: AsRef<str>,
11426    {
11427        self._additional_params
11428            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11429        self
11430    }
11431
11432    /// Identifies the authorization scope for the method you are building.
11433    ///
11434    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11435    /// [`Scope::Ediscovery`].
11436    ///
11437    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11438    /// tokens for more than one scope.
11439    ///
11440    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11441    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11442    /// sufficient, a read-write scope will do as well.
11443    pub fn add_scope<St>(mut self, scope: St) -> MatterUndeleteCall<'a, C>
11444    where
11445        St: AsRef<str>,
11446    {
11447        self._scopes.insert(String::from(scope.as_ref()));
11448        self
11449    }
11450    /// Identifies the authorization scope(s) for the method you are building.
11451    ///
11452    /// See [`Self::add_scope()`] for details.
11453    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterUndeleteCall<'a, C>
11454    where
11455        I: IntoIterator<Item = St>,
11456        St: AsRef<str>,
11457    {
11458        self._scopes
11459            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11460        self
11461    }
11462
11463    /// Removes all scopes, and no default scope will be used either.
11464    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11465    /// for details).
11466    pub fn clear_scopes(mut self) -> MatterUndeleteCall<'a, C> {
11467        self._scopes.clear();
11468        self
11469    }
11470}
11471
11472/// Updates the specified matter. This updates only the name and description of the matter, identified by matter ID. Changes to any other fields are ignored. Returns the default view of the matter.
11473///
11474/// A builder for the *update* method supported by a *matter* resource.
11475/// It is not used directly, but through a [`MatterMethods`] instance.
11476///
11477/// # Example
11478///
11479/// Instantiate a resource method builder
11480///
11481/// ```test_harness,no_run
11482/// # extern crate hyper;
11483/// # extern crate hyper_rustls;
11484/// # extern crate google_vault1 as vault1;
11485/// use vault1::api::Matter;
11486/// # async fn dox() {
11487/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11488///
11489/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11490/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11491/// #     .with_native_roots()
11492/// #     .unwrap()
11493/// #     .https_only()
11494/// #     .enable_http2()
11495/// #     .build();
11496///
11497/// # let executor = hyper_util::rt::TokioExecutor::new();
11498/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11499/// #     secret,
11500/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11501/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11502/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11503/// #     ),
11504/// # ).build().await.unwrap();
11505///
11506/// # let client = hyper_util::client::legacy::Client::builder(
11507/// #     hyper_util::rt::TokioExecutor::new()
11508/// # )
11509/// # .build(
11510/// #     hyper_rustls::HttpsConnectorBuilder::new()
11511/// #         .with_native_roots()
11512/// #         .unwrap()
11513/// #         .https_or_http()
11514/// #         .enable_http2()
11515/// #         .build()
11516/// # );
11517/// # let mut hub = Vault::new(client, auth);
11518/// // As the method needs a request, you would usually fill it with the desired information
11519/// // into the respective structure. Some of the parts shown here might not be applicable !
11520/// // Values shown here are possibly random and not representative !
11521/// let mut req = Matter::default();
11522///
11523/// // You can configure optional parameters by calling the respective setters at will, and
11524/// // execute the final call using `doit()`.
11525/// // Values shown here are possibly random and not representative !
11526/// let result = hub.matters().update(req, "matterId")
11527///              .doit().await;
11528/// # }
11529/// ```
11530pub struct MatterUpdateCall<'a, C>
11531where
11532    C: 'a,
11533{
11534    hub: &'a Vault<C>,
11535    _request: Matter,
11536    _matter_id: String,
11537    _delegate: Option<&'a mut dyn common::Delegate>,
11538    _additional_params: HashMap<String, String>,
11539    _scopes: BTreeSet<String>,
11540}
11541
11542impl<'a, C> common::CallBuilder for MatterUpdateCall<'a, C> {}
11543
11544impl<'a, C> MatterUpdateCall<'a, C>
11545where
11546    C: common::Connector,
11547{
11548    /// Perform the operation you have build so far.
11549    pub async fn doit(mut self) -> common::Result<(common::Response, Matter)> {
11550        use std::borrow::Cow;
11551        use std::io::{Read, Seek};
11552
11553        use common::{url::Params, ToParts};
11554        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11555
11556        let mut dd = common::DefaultDelegate;
11557        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11558        dlg.begin(common::MethodInfo {
11559            id: "vault.matters.update",
11560            http_method: hyper::Method::PUT,
11561        });
11562
11563        for &field in ["alt", "matterId"].iter() {
11564            if self._additional_params.contains_key(field) {
11565                dlg.finished(false);
11566                return Err(common::Error::FieldClash(field));
11567            }
11568        }
11569
11570        let mut params = Params::with_capacity(4 + self._additional_params.len());
11571        params.push("matterId", self._matter_id);
11572
11573        params.extend(self._additional_params.iter());
11574
11575        params.push("alt", "json");
11576        let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}";
11577        if self._scopes.is_empty() {
11578            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
11579        }
11580
11581        #[allow(clippy::single_element_loop)]
11582        for &(find_this, param_name) in [("{matterId}", "matterId")].iter() {
11583            url = params.uri_replacement(url, param_name, find_this, false);
11584        }
11585        {
11586            let to_remove = ["matterId"];
11587            params.remove_params(&to_remove);
11588        }
11589
11590        let url = params.parse_with_url(&url);
11591
11592        let mut json_mime_type = mime::APPLICATION_JSON;
11593        let mut request_value_reader = {
11594            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11595            common::remove_json_null_values(&mut value);
11596            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11597            serde_json::to_writer(&mut dst, &value).unwrap();
11598            dst
11599        };
11600        let request_size = request_value_reader
11601            .seek(std::io::SeekFrom::End(0))
11602            .unwrap();
11603        request_value_reader
11604            .seek(std::io::SeekFrom::Start(0))
11605            .unwrap();
11606
11607        loop {
11608            let token = match self
11609                .hub
11610                .auth
11611                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11612                .await
11613            {
11614                Ok(token) => token,
11615                Err(e) => match dlg.token(e) {
11616                    Ok(token) => token,
11617                    Err(e) => {
11618                        dlg.finished(false);
11619                        return Err(common::Error::MissingToken(e));
11620                    }
11621                },
11622            };
11623            request_value_reader
11624                .seek(std::io::SeekFrom::Start(0))
11625                .unwrap();
11626            let mut req_result = {
11627                let client = &self.hub.client;
11628                dlg.pre_request();
11629                let mut req_builder = hyper::Request::builder()
11630                    .method(hyper::Method::PUT)
11631                    .uri(url.as_str())
11632                    .header(USER_AGENT, self.hub._user_agent.clone());
11633
11634                if let Some(token) = token.as_ref() {
11635                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11636                }
11637
11638                let request = req_builder
11639                    .header(CONTENT_TYPE, json_mime_type.to_string())
11640                    .header(CONTENT_LENGTH, request_size as u64)
11641                    .body(common::to_body(
11642                        request_value_reader.get_ref().clone().into(),
11643                    ));
11644
11645                client.request(request.unwrap()).await
11646            };
11647
11648            match req_result {
11649                Err(err) => {
11650                    if let common::Retry::After(d) = dlg.http_error(&err) {
11651                        sleep(d).await;
11652                        continue;
11653                    }
11654                    dlg.finished(false);
11655                    return Err(common::Error::HttpError(err));
11656                }
11657                Ok(res) => {
11658                    let (mut parts, body) = res.into_parts();
11659                    let mut body = common::Body::new(body);
11660                    if !parts.status.is_success() {
11661                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11662                        let error = serde_json::from_str(&common::to_string(&bytes));
11663                        let response = common::to_response(parts, bytes.into());
11664
11665                        if let common::Retry::After(d) =
11666                            dlg.http_failure(&response, error.as_ref().ok())
11667                        {
11668                            sleep(d).await;
11669                            continue;
11670                        }
11671
11672                        dlg.finished(false);
11673
11674                        return Err(match error {
11675                            Ok(value) => common::Error::BadRequest(value),
11676                            _ => common::Error::Failure(response),
11677                        });
11678                    }
11679                    let response = {
11680                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11681                        let encoded = common::to_string(&bytes);
11682                        match serde_json::from_str(&encoded) {
11683                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11684                            Err(error) => {
11685                                dlg.response_json_decode_error(&encoded, &error);
11686                                return Err(common::Error::JsonDecodeError(
11687                                    encoded.to_string(),
11688                                    error,
11689                                ));
11690                            }
11691                        }
11692                    };
11693
11694                    dlg.finished(true);
11695                    return Ok(response);
11696                }
11697            }
11698        }
11699    }
11700
11701    ///
11702    /// Sets the *request* property to the given value.
11703    ///
11704    /// Even though the property as already been set when instantiating this call,
11705    /// we provide this method for API completeness.
11706    pub fn request(mut self, new_value: Matter) -> MatterUpdateCall<'a, C> {
11707        self._request = new_value;
11708        self
11709    }
11710    /// The matter ID.
11711    ///
11712    /// Sets the *matter id* path property to the given value.
11713    ///
11714    /// Even though the property as already been set when instantiating this call,
11715    /// we provide this method for API completeness.
11716    pub fn matter_id(mut self, new_value: &str) -> MatterUpdateCall<'a, C> {
11717        self._matter_id = new_value.to_string();
11718        self
11719    }
11720    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11721    /// while executing the actual API request.
11722    ///
11723    /// ````text
11724    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11725    /// ````
11726    ///
11727    /// Sets the *delegate* property to the given value.
11728    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MatterUpdateCall<'a, C> {
11729        self._delegate = Some(new_value);
11730        self
11731    }
11732
11733    /// Set any additional parameter of the query string used in the request.
11734    /// It should be used to set parameters which are not yet available through their own
11735    /// setters.
11736    ///
11737    /// Please note that this method must not be used to set any of the known parameters
11738    /// which have their own setter method. If done anyway, the request will fail.
11739    ///
11740    /// # Additional Parameters
11741    ///
11742    /// * *$.xgafv* (query-string) - V1 error format.
11743    /// * *access_token* (query-string) - OAuth access token.
11744    /// * *alt* (query-string) - Data format for response.
11745    /// * *callback* (query-string) - JSONP
11746    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11747    /// * *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.
11748    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11749    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11750    /// * *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.
11751    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11752    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11753    pub fn param<T>(mut self, name: T, value: T) -> MatterUpdateCall<'a, C>
11754    where
11755        T: AsRef<str>,
11756    {
11757        self._additional_params
11758            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11759        self
11760    }
11761
11762    /// Identifies the authorization scope for the method you are building.
11763    ///
11764    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11765    /// [`Scope::Ediscovery`].
11766    ///
11767    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11768    /// tokens for more than one scope.
11769    ///
11770    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11771    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11772    /// sufficient, a read-write scope will do as well.
11773    pub fn add_scope<St>(mut self, scope: St) -> MatterUpdateCall<'a, C>
11774    where
11775        St: AsRef<str>,
11776    {
11777        self._scopes.insert(String::from(scope.as_ref()));
11778        self
11779    }
11780    /// Identifies the authorization scope(s) for the method you are building.
11781    ///
11782    /// See [`Self::add_scope()`] for details.
11783    pub fn add_scopes<I, St>(mut self, scopes: I) -> MatterUpdateCall<'a, C>
11784    where
11785        I: IntoIterator<Item = St>,
11786        St: AsRef<str>,
11787    {
11788        self._scopes
11789            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11790        self
11791    }
11792
11793    /// Removes all scopes, and no default scope will be used either.
11794    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11795    /// for details).
11796    pub fn clear_scopes(mut self) -> MatterUpdateCall<'a, C> {
11797        self._scopes.clear();
11798        self
11799    }
11800}
11801
11802/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
11803///
11804/// A builder for the *cancel* method supported by a *operation* resource.
11805/// It is not used directly, but through a [`OperationMethods`] instance.
11806///
11807/// # Example
11808///
11809/// Instantiate a resource method builder
11810///
11811/// ```test_harness,no_run
11812/// # extern crate hyper;
11813/// # extern crate hyper_rustls;
11814/// # extern crate google_vault1 as vault1;
11815/// use vault1::api::CancelOperationRequest;
11816/// # async fn dox() {
11817/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11818///
11819/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11820/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11821/// #     .with_native_roots()
11822/// #     .unwrap()
11823/// #     .https_only()
11824/// #     .enable_http2()
11825/// #     .build();
11826///
11827/// # let executor = hyper_util::rt::TokioExecutor::new();
11828/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11829/// #     secret,
11830/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11831/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11832/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11833/// #     ),
11834/// # ).build().await.unwrap();
11835///
11836/// # let client = hyper_util::client::legacy::Client::builder(
11837/// #     hyper_util::rt::TokioExecutor::new()
11838/// # )
11839/// # .build(
11840/// #     hyper_rustls::HttpsConnectorBuilder::new()
11841/// #         .with_native_roots()
11842/// #         .unwrap()
11843/// #         .https_or_http()
11844/// #         .enable_http2()
11845/// #         .build()
11846/// # );
11847/// # let mut hub = Vault::new(client, auth);
11848/// // As the method needs a request, you would usually fill it with the desired information
11849/// // into the respective structure. Some of the parts shown here might not be applicable !
11850/// // Values shown here are possibly random and not representative !
11851/// let mut req = CancelOperationRequest::default();
11852///
11853/// // You can configure optional parameters by calling the respective setters at will, and
11854/// // execute the final call using `doit()`.
11855/// // Values shown here are possibly random and not representative !
11856/// let result = hub.operations().cancel(req, "name")
11857///              .doit().await;
11858/// # }
11859/// ```
11860pub struct OperationCancelCall<'a, C>
11861where
11862    C: 'a,
11863{
11864    hub: &'a Vault<C>,
11865    _request: CancelOperationRequest,
11866    _name: String,
11867    _delegate: Option<&'a mut dyn common::Delegate>,
11868    _additional_params: HashMap<String, String>,
11869    _scopes: BTreeSet<String>,
11870}
11871
11872impl<'a, C> common::CallBuilder for OperationCancelCall<'a, C> {}
11873
11874impl<'a, C> OperationCancelCall<'a, C>
11875where
11876    C: common::Connector,
11877{
11878    /// Perform the operation you have build so far.
11879    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
11880        use std::borrow::Cow;
11881        use std::io::{Read, Seek};
11882
11883        use common::{url::Params, ToParts};
11884        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11885
11886        let mut dd = common::DefaultDelegate;
11887        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11888        dlg.begin(common::MethodInfo {
11889            id: "vault.operations.cancel",
11890            http_method: hyper::Method::POST,
11891        });
11892
11893        for &field in ["alt", "name"].iter() {
11894            if self._additional_params.contains_key(field) {
11895                dlg.finished(false);
11896                return Err(common::Error::FieldClash(field));
11897            }
11898        }
11899
11900        let mut params = Params::with_capacity(4 + self._additional_params.len());
11901        params.push("name", self._name);
11902
11903        params.extend(self._additional_params.iter());
11904
11905        params.push("alt", "json");
11906        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
11907        if self._scopes.is_empty() {
11908            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
11909        }
11910
11911        #[allow(clippy::single_element_loop)]
11912        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11913            url = params.uri_replacement(url, param_name, find_this, true);
11914        }
11915        {
11916            let to_remove = ["name"];
11917            params.remove_params(&to_remove);
11918        }
11919
11920        let url = params.parse_with_url(&url);
11921
11922        let mut json_mime_type = mime::APPLICATION_JSON;
11923        let mut request_value_reader = {
11924            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11925            common::remove_json_null_values(&mut value);
11926            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11927            serde_json::to_writer(&mut dst, &value).unwrap();
11928            dst
11929        };
11930        let request_size = request_value_reader
11931            .seek(std::io::SeekFrom::End(0))
11932            .unwrap();
11933        request_value_reader
11934            .seek(std::io::SeekFrom::Start(0))
11935            .unwrap();
11936
11937        loop {
11938            let token = match self
11939                .hub
11940                .auth
11941                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11942                .await
11943            {
11944                Ok(token) => token,
11945                Err(e) => match dlg.token(e) {
11946                    Ok(token) => token,
11947                    Err(e) => {
11948                        dlg.finished(false);
11949                        return Err(common::Error::MissingToken(e));
11950                    }
11951                },
11952            };
11953            request_value_reader
11954                .seek(std::io::SeekFrom::Start(0))
11955                .unwrap();
11956            let mut req_result = {
11957                let client = &self.hub.client;
11958                dlg.pre_request();
11959                let mut req_builder = hyper::Request::builder()
11960                    .method(hyper::Method::POST)
11961                    .uri(url.as_str())
11962                    .header(USER_AGENT, self.hub._user_agent.clone());
11963
11964                if let Some(token) = token.as_ref() {
11965                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11966                }
11967
11968                let request = req_builder
11969                    .header(CONTENT_TYPE, json_mime_type.to_string())
11970                    .header(CONTENT_LENGTH, request_size as u64)
11971                    .body(common::to_body(
11972                        request_value_reader.get_ref().clone().into(),
11973                    ));
11974
11975                client.request(request.unwrap()).await
11976            };
11977
11978            match req_result {
11979                Err(err) => {
11980                    if let common::Retry::After(d) = dlg.http_error(&err) {
11981                        sleep(d).await;
11982                        continue;
11983                    }
11984                    dlg.finished(false);
11985                    return Err(common::Error::HttpError(err));
11986                }
11987                Ok(res) => {
11988                    let (mut parts, body) = res.into_parts();
11989                    let mut body = common::Body::new(body);
11990                    if !parts.status.is_success() {
11991                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11992                        let error = serde_json::from_str(&common::to_string(&bytes));
11993                        let response = common::to_response(parts, bytes.into());
11994
11995                        if let common::Retry::After(d) =
11996                            dlg.http_failure(&response, error.as_ref().ok())
11997                        {
11998                            sleep(d).await;
11999                            continue;
12000                        }
12001
12002                        dlg.finished(false);
12003
12004                        return Err(match error {
12005                            Ok(value) => common::Error::BadRequest(value),
12006                            _ => common::Error::Failure(response),
12007                        });
12008                    }
12009                    let response = {
12010                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12011                        let encoded = common::to_string(&bytes);
12012                        match serde_json::from_str(&encoded) {
12013                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12014                            Err(error) => {
12015                                dlg.response_json_decode_error(&encoded, &error);
12016                                return Err(common::Error::JsonDecodeError(
12017                                    encoded.to_string(),
12018                                    error,
12019                                ));
12020                            }
12021                        }
12022                    };
12023
12024                    dlg.finished(true);
12025                    return Ok(response);
12026                }
12027            }
12028        }
12029    }
12030
12031    ///
12032    /// Sets the *request* property to the given value.
12033    ///
12034    /// Even though the property as already been set when instantiating this call,
12035    /// we provide this method for API completeness.
12036    pub fn request(mut self, new_value: CancelOperationRequest) -> OperationCancelCall<'a, C> {
12037        self._request = new_value;
12038        self
12039    }
12040    /// The name of the operation resource to be cancelled.
12041    ///
12042    /// Sets the *name* path property to the given value.
12043    ///
12044    /// Even though the property as already been set when instantiating this call,
12045    /// we provide this method for API completeness.
12046    pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, C> {
12047        self._name = new_value.to_string();
12048        self
12049    }
12050    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12051    /// while executing the actual API request.
12052    ///
12053    /// ````text
12054    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12055    /// ````
12056    ///
12057    /// Sets the *delegate* property to the given value.
12058    pub fn delegate(
12059        mut self,
12060        new_value: &'a mut dyn common::Delegate,
12061    ) -> OperationCancelCall<'a, C> {
12062        self._delegate = Some(new_value);
12063        self
12064    }
12065
12066    /// Set any additional parameter of the query string used in the request.
12067    /// It should be used to set parameters which are not yet available through their own
12068    /// setters.
12069    ///
12070    /// Please note that this method must not be used to set any of the known parameters
12071    /// which have their own setter method. If done anyway, the request will fail.
12072    ///
12073    /// # Additional Parameters
12074    ///
12075    /// * *$.xgafv* (query-string) - V1 error format.
12076    /// * *access_token* (query-string) - OAuth access token.
12077    /// * *alt* (query-string) - Data format for response.
12078    /// * *callback* (query-string) - JSONP
12079    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12080    /// * *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.
12081    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12082    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12083    /// * *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.
12084    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12085    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12086    pub fn param<T>(mut self, name: T, value: T) -> OperationCancelCall<'a, C>
12087    where
12088        T: AsRef<str>,
12089    {
12090        self._additional_params
12091            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12092        self
12093    }
12094
12095    /// Identifies the authorization scope for the method you are building.
12096    ///
12097    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12098    /// [`Scope::Ediscovery`].
12099    ///
12100    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12101    /// tokens for more than one scope.
12102    ///
12103    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12104    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12105    /// sufficient, a read-write scope will do as well.
12106    pub fn add_scope<St>(mut self, scope: St) -> OperationCancelCall<'a, C>
12107    where
12108        St: AsRef<str>,
12109    {
12110        self._scopes.insert(String::from(scope.as_ref()));
12111        self
12112    }
12113    /// Identifies the authorization scope(s) for the method you are building.
12114    ///
12115    /// See [`Self::add_scope()`] for details.
12116    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationCancelCall<'a, C>
12117    where
12118        I: IntoIterator<Item = St>,
12119        St: AsRef<str>,
12120    {
12121        self._scopes
12122            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12123        self
12124    }
12125
12126    /// Removes all scopes, and no default scope will be used either.
12127    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12128    /// for details).
12129    pub fn clear_scopes(mut self) -> OperationCancelCall<'a, C> {
12130        self._scopes.clear();
12131        self
12132    }
12133}
12134
12135/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
12136///
12137/// A builder for the *delete* method supported by a *operation* resource.
12138/// It is not used directly, but through a [`OperationMethods`] instance.
12139///
12140/// # Example
12141///
12142/// Instantiate a resource method builder
12143///
12144/// ```test_harness,no_run
12145/// # extern crate hyper;
12146/// # extern crate hyper_rustls;
12147/// # extern crate google_vault1 as vault1;
12148/// # async fn dox() {
12149/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12150///
12151/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12152/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12153/// #     .with_native_roots()
12154/// #     .unwrap()
12155/// #     .https_only()
12156/// #     .enable_http2()
12157/// #     .build();
12158///
12159/// # let executor = hyper_util::rt::TokioExecutor::new();
12160/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12161/// #     secret,
12162/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12163/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12164/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12165/// #     ),
12166/// # ).build().await.unwrap();
12167///
12168/// # let client = hyper_util::client::legacy::Client::builder(
12169/// #     hyper_util::rt::TokioExecutor::new()
12170/// # )
12171/// # .build(
12172/// #     hyper_rustls::HttpsConnectorBuilder::new()
12173/// #         .with_native_roots()
12174/// #         .unwrap()
12175/// #         .https_or_http()
12176/// #         .enable_http2()
12177/// #         .build()
12178/// # );
12179/// # let mut hub = Vault::new(client, auth);
12180/// // You can configure optional parameters by calling the respective setters at will, and
12181/// // execute the final call using `doit()`.
12182/// // Values shown here are possibly random and not representative !
12183/// let result = hub.operations().delete("name")
12184///              .doit().await;
12185/// # }
12186/// ```
12187pub struct OperationDeleteCall<'a, C>
12188where
12189    C: 'a,
12190{
12191    hub: &'a Vault<C>,
12192    _name: String,
12193    _delegate: Option<&'a mut dyn common::Delegate>,
12194    _additional_params: HashMap<String, String>,
12195    _scopes: BTreeSet<String>,
12196}
12197
12198impl<'a, C> common::CallBuilder for OperationDeleteCall<'a, C> {}
12199
12200impl<'a, C> OperationDeleteCall<'a, C>
12201where
12202    C: common::Connector,
12203{
12204    /// Perform the operation you have build so far.
12205    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
12206        use std::borrow::Cow;
12207        use std::io::{Read, Seek};
12208
12209        use common::{url::Params, ToParts};
12210        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12211
12212        let mut dd = common::DefaultDelegate;
12213        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12214        dlg.begin(common::MethodInfo {
12215            id: "vault.operations.delete",
12216            http_method: hyper::Method::DELETE,
12217        });
12218
12219        for &field in ["alt", "name"].iter() {
12220            if self._additional_params.contains_key(field) {
12221                dlg.finished(false);
12222                return Err(common::Error::FieldClash(field));
12223            }
12224        }
12225
12226        let mut params = Params::with_capacity(3 + self._additional_params.len());
12227        params.push("name", self._name);
12228
12229        params.extend(self._additional_params.iter());
12230
12231        params.push("alt", "json");
12232        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12233        if self._scopes.is_empty() {
12234            self._scopes.insert(Scope::Ediscovery.as_ref().to_string());
12235        }
12236
12237        #[allow(clippy::single_element_loop)]
12238        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12239            url = params.uri_replacement(url, param_name, find_this, true);
12240        }
12241        {
12242            let to_remove = ["name"];
12243            params.remove_params(&to_remove);
12244        }
12245
12246        let url = params.parse_with_url(&url);
12247
12248        loop {
12249            let token = match self
12250                .hub
12251                .auth
12252                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12253                .await
12254            {
12255                Ok(token) => token,
12256                Err(e) => match dlg.token(e) {
12257                    Ok(token) => token,
12258                    Err(e) => {
12259                        dlg.finished(false);
12260                        return Err(common::Error::MissingToken(e));
12261                    }
12262                },
12263            };
12264            let mut req_result = {
12265                let client = &self.hub.client;
12266                dlg.pre_request();
12267                let mut req_builder = hyper::Request::builder()
12268                    .method(hyper::Method::DELETE)
12269                    .uri(url.as_str())
12270                    .header(USER_AGENT, self.hub._user_agent.clone());
12271
12272                if let Some(token) = token.as_ref() {
12273                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12274                }
12275
12276                let request = req_builder
12277                    .header(CONTENT_LENGTH, 0_u64)
12278                    .body(common::to_body::<String>(None));
12279
12280                client.request(request.unwrap()).await
12281            };
12282
12283            match req_result {
12284                Err(err) => {
12285                    if let common::Retry::After(d) = dlg.http_error(&err) {
12286                        sleep(d).await;
12287                        continue;
12288                    }
12289                    dlg.finished(false);
12290                    return Err(common::Error::HttpError(err));
12291                }
12292                Ok(res) => {
12293                    let (mut parts, body) = res.into_parts();
12294                    let mut body = common::Body::new(body);
12295                    if !parts.status.is_success() {
12296                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12297                        let error = serde_json::from_str(&common::to_string(&bytes));
12298                        let response = common::to_response(parts, bytes.into());
12299
12300                        if let common::Retry::After(d) =
12301                            dlg.http_failure(&response, error.as_ref().ok())
12302                        {
12303                            sleep(d).await;
12304                            continue;
12305                        }
12306
12307                        dlg.finished(false);
12308
12309                        return Err(match error {
12310                            Ok(value) => common::Error::BadRequest(value),
12311                            _ => common::Error::Failure(response),
12312                        });
12313                    }
12314                    let response = {
12315                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12316                        let encoded = common::to_string(&bytes);
12317                        match serde_json::from_str(&encoded) {
12318                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12319                            Err(error) => {
12320                                dlg.response_json_decode_error(&encoded, &error);
12321                                return Err(common::Error::JsonDecodeError(
12322                                    encoded.to_string(),
12323                                    error,
12324                                ));
12325                            }
12326                        }
12327                    };
12328
12329                    dlg.finished(true);
12330                    return Ok(response);
12331                }
12332            }
12333        }
12334    }
12335
12336    /// The name of the operation resource to be deleted.
12337    ///
12338    /// Sets the *name* path property to the given value.
12339    ///
12340    /// Even though the property as already been set when instantiating this call,
12341    /// we provide this method for API completeness.
12342    pub fn name(mut self, new_value: &str) -> OperationDeleteCall<'a, C> {
12343        self._name = new_value.to_string();
12344        self
12345    }
12346    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12347    /// while executing the actual API request.
12348    ///
12349    /// ````text
12350    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12351    /// ````
12352    ///
12353    /// Sets the *delegate* property to the given value.
12354    pub fn delegate(
12355        mut self,
12356        new_value: &'a mut dyn common::Delegate,
12357    ) -> OperationDeleteCall<'a, C> {
12358        self._delegate = Some(new_value);
12359        self
12360    }
12361
12362    /// Set any additional parameter of the query string used in the request.
12363    /// It should be used to set parameters which are not yet available through their own
12364    /// setters.
12365    ///
12366    /// Please note that this method must not be used to set any of the known parameters
12367    /// which have their own setter method. If done anyway, the request will fail.
12368    ///
12369    /// # Additional Parameters
12370    ///
12371    /// * *$.xgafv* (query-string) - V1 error format.
12372    /// * *access_token* (query-string) - OAuth access token.
12373    /// * *alt* (query-string) - Data format for response.
12374    /// * *callback* (query-string) - JSONP
12375    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12376    /// * *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.
12377    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12378    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12379    /// * *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.
12380    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12381    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12382    pub fn param<T>(mut self, name: T, value: T) -> OperationDeleteCall<'a, C>
12383    where
12384        T: AsRef<str>,
12385    {
12386        self._additional_params
12387            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12388        self
12389    }
12390
12391    /// Identifies the authorization scope for the method you are building.
12392    ///
12393    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12394    /// [`Scope::Ediscovery`].
12395    ///
12396    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12397    /// tokens for more than one scope.
12398    ///
12399    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12400    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12401    /// sufficient, a read-write scope will do as well.
12402    pub fn add_scope<St>(mut self, scope: St) -> OperationDeleteCall<'a, C>
12403    where
12404        St: AsRef<str>,
12405    {
12406        self._scopes.insert(String::from(scope.as_ref()));
12407        self
12408    }
12409    /// Identifies the authorization scope(s) for the method you are building.
12410    ///
12411    /// See [`Self::add_scope()`] for details.
12412    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationDeleteCall<'a, C>
12413    where
12414        I: IntoIterator<Item = St>,
12415        St: AsRef<str>,
12416    {
12417        self._scopes
12418            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12419        self
12420    }
12421
12422    /// Removes all scopes, and no default scope will be used either.
12423    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12424    /// for details).
12425    pub fn clear_scopes(mut self) -> OperationDeleteCall<'a, C> {
12426        self._scopes.clear();
12427        self
12428    }
12429}
12430
12431/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
12432///
12433/// A builder for the *get* method supported by a *operation* resource.
12434/// It is not used directly, but through a [`OperationMethods`] instance.
12435///
12436/// # Example
12437///
12438/// Instantiate a resource method builder
12439///
12440/// ```test_harness,no_run
12441/// # extern crate hyper;
12442/// # extern crate hyper_rustls;
12443/// # extern crate google_vault1 as vault1;
12444/// # async fn dox() {
12445/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12446///
12447/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12448/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12449/// #     .with_native_roots()
12450/// #     .unwrap()
12451/// #     .https_only()
12452/// #     .enable_http2()
12453/// #     .build();
12454///
12455/// # let executor = hyper_util::rt::TokioExecutor::new();
12456/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12457/// #     secret,
12458/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12459/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12460/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12461/// #     ),
12462/// # ).build().await.unwrap();
12463///
12464/// # let client = hyper_util::client::legacy::Client::builder(
12465/// #     hyper_util::rt::TokioExecutor::new()
12466/// # )
12467/// # .build(
12468/// #     hyper_rustls::HttpsConnectorBuilder::new()
12469/// #         .with_native_roots()
12470/// #         .unwrap()
12471/// #         .https_or_http()
12472/// #         .enable_http2()
12473/// #         .build()
12474/// # );
12475/// # let mut hub = Vault::new(client, auth);
12476/// // You can configure optional parameters by calling the respective setters at will, and
12477/// // execute the final call using `doit()`.
12478/// // Values shown here are possibly random and not representative !
12479/// let result = hub.operations().get("name")
12480///              .doit().await;
12481/// # }
12482/// ```
12483pub struct OperationGetCall<'a, C>
12484where
12485    C: 'a,
12486{
12487    hub: &'a Vault<C>,
12488    _name: String,
12489    _delegate: Option<&'a mut dyn common::Delegate>,
12490    _additional_params: HashMap<String, String>,
12491    _scopes: BTreeSet<String>,
12492}
12493
12494impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
12495
12496impl<'a, C> OperationGetCall<'a, C>
12497where
12498    C: common::Connector,
12499{
12500    /// Perform the operation you have build so far.
12501    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12502        use std::borrow::Cow;
12503        use std::io::{Read, Seek};
12504
12505        use common::{url::Params, ToParts};
12506        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12507
12508        let mut dd = common::DefaultDelegate;
12509        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12510        dlg.begin(common::MethodInfo {
12511            id: "vault.operations.get",
12512            http_method: hyper::Method::GET,
12513        });
12514
12515        for &field in ["alt", "name"].iter() {
12516            if self._additional_params.contains_key(field) {
12517                dlg.finished(false);
12518                return Err(common::Error::FieldClash(field));
12519            }
12520        }
12521
12522        let mut params = Params::with_capacity(3 + self._additional_params.len());
12523        params.push("name", self._name);
12524
12525        params.extend(self._additional_params.iter());
12526
12527        params.push("alt", "json");
12528        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12529        if self._scopes.is_empty() {
12530            self._scopes
12531                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
12532        }
12533
12534        #[allow(clippy::single_element_loop)]
12535        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12536            url = params.uri_replacement(url, param_name, find_this, true);
12537        }
12538        {
12539            let to_remove = ["name"];
12540            params.remove_params(&to_remove);
12541        }
12542
12543        let url = params.parse_with_url(&url);
12544
12545        loop {
12546            let token = match self
12547                .hub
12548                .auth
12549                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12550                .await
12551            {
12552                Ok(token) => token,
12553                Err(e) => match dlg.token(e) {
12554                    Ok(token) => token,
12555                    Err(e) => {
12556                        dlg.finished(false);
12557                        return Err(common::Error::MissingToken(e));
12558                    }
12559                },
12560            };
12561            let mut req_result = {
12562                let client = &self.hub.client;
12563                dlg.pre_request();
12564                let mut req_builder = hyper::Request::builder()
12565                    .method(hyper::Method::GET)
12566                    .uri(url.as_str())
12567                    .header(USER_AGENT, self.hub._user_agent.clone());
12568
12569                if let Some(token) = token.as_ref() {
12570                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12571                }
12572
12573                let request = req_builder
12574                    .header(CONTENT_LENGTH, 0_u64)
12575                    .body(common::to_body::<String>(None));
12576
12577                client.request(request.unwrap()).await
12578            };
12579
12580            match req_result {
12581                Err(err) => {
12582                    if let common::Retry::After(d) = dlg.http_error(&err) {
12583                        sleep(d).await;
12584                        continue;
12585                    }
12586                    dlg.finished(false);
12587                    return Err(common::Error::HttpError(err));
12588                }
12589                Ok(res) => {
12590                    let (mut parts, body) = res.into_parts();
12591                    let mut body = common::Body::new(body);
12592                    if !parts.status.is_success() {
12593                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12594                        let error = serde_json::from_str(&common::to_string(&bytes));
12595                        let response = common::to_response(parts, bytes.into());
12596
12597                        if let common::Retry::After(d) =
12598                            dlg.http_failure(&response, error.as_ref().ok())
12599                        {
12600                            sleep(d).await;
12601                            continue;
12602                        }
12603
12604                        dlg.finished(false);
12605
12606                        return Err(match error {
12607                            Ok(value) => common::Error::BadRequest(value),
12608                            _ => common::Error::Failure(response),
12609                        });
12610                    }
12611                    let response = {
12612                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12613                        let encoded = common::to_string(&bytes);
12614                        match serde_json::from_str(&encoded) {
12615                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12616                            Err(error) => {
12617                                dlg.response_json_decode_error(&encoded, &error);
12618                                return Err(common::Error::JsonDecodeError(
12619                                    encoded.to_string(),
12620                                    error,
12621                                ));
12622                            }
12623                        }
12624                    };
12625
12626                    dlg.finished(true);
12627                    return Ok(response);
12628                }
12629            }
12630        }
12631    }
12632
12633    /// The name of the operation resource.
12634    ///
12635    /// Sets the *name* path property to the given value.
12636    ///
12637    /// Even though the property as already been set when instantiating this call,
12638    /// we provide this method for API completeness.
12639    pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C> {
12640        self._name = new_value.to_string();
12641        self
12642    }
12643    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12644    /// while executing the actual API request.
12645    ///
12646    /// ````text
12647    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12648    /// ````
12649    ///
12650    /// Sets the *delegate* property to the given value.
12651    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
12652        self._delegate = Some(new_value);
12653        self
12654    }
12655
12656    /// Set any additional parameter of the query string used in the request.
12657    /// It should be used to set parameters which are not yet available through their own
12658    /// setters.
12659    ///
12660    /// Please note that this method must not be used to set any of the known parameters
12661    /// which have their own setter method. If done anyway, the request will fail.
12662    ///
12663    /// # Additional Parameters
12664    ///
12665    /// * *$.xgafv* (query-string) - V1 error format.
12666    /// * *access_token* (query-string) - OAuth access token.
12667    /// * *alt* (query-string) - Data format for response.
12668    /// * *callback* (query-string) - JSONP
12669    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12670    /// * *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.
12671    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12672    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12673    /// * *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.
12674    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12675    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12676    pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
12677    where
12678        T: AsRef<str>,
12679    {
12680        self._additional_params
12681            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12682        self
12683    }
12684
12685    /// Identifies the authorization scope for the method you are building.
12686    ///
12687    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12688    /// [`Scope::EdiscoveryReadonly`].
12689    ///
12690    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12691    /// tokens for more than one scope.
12692    ///
12693    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12694    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12695    /// sufficient, a read-write scope will do as well.
12696    pub fn add_scope<St>(mut self, scope: St) -> OperationGetCall<'a, C>
12697    where
12698        St: AsRef<str>,
12699    {
12700        self._scopes.insert(String::from(scope.as_ref()));
12701        self
12702    }
12703    /// Identifies the authorization scope(s) for the method you are building.
12704    ///
12705    /// See [`Self::add_scope()`] for details.
12706    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationGetCall<'a, C>
12707    where
12708        I: IntoIterator<Item = St>,
12709        St: AsRef<str>,
12710    {
12711        self._scopes
12712            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12713        self
12714    }
12715
12716    /// Removes all scopes, and no default scope will be used either.
12717    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12718    /// for details).
12719    pub fn clear_scopes(mut self) -> OperationGetCall<'a, C> {
12720        self._scopes.clear();
12721        self
12722    }
12723}
12724
12725/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
12726///
12727/// A builder for the *list* method supported by a *operation* resource.
12728/// It is not used directly, but through a [`OperationMethods`] instance.
12729///
12730/// # Example
12731///
12732/// Instantiate a resource method builder
12733///
12734/// ```test_harness,no_run
12735/// # extern crate hyper;
12736/// # extern crate hyper_rustls;
12737/// # extern crate google_vault1 as vault1;
12738/// # async fn dox() {
12739/// # use vault1::{Vault, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12740///
12741/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12742/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12743/// #     .with_native_roots()
12744/// #     .unwrap()
12745/// #     .https_only()
12746/// #     .enable_http2()
12747/// #     .build();
12748///
12749/// # let executor = hyper_util::rt::TokioExecutor::new();
12750/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12751/// #     secret,
12752/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12753/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12754/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12755/// #     ),
12756/// # ).build().await.unwrap();
12757///
12758/// # let client = hyper_util::client::legacy::Client::builder(
12759/// #     hyper_util::rt::TokioExecutor::new()
12760/// # )
12761/// # .build(
12762/// #     hyper_rustls::HttpsConnectorBuilder::new()
12763/// #         .with_native_roots()
12764/// #         .unwrap()
12765/// #         .https_or_http()
12766/// #         .enable_http2()
12767/// #         .build()
12768/// # );
12769/// # let mut hub = Vault::new(client, auth);
12770/// // You can configure optional parameters by calling the respective setters at will, and
12771/// // execute the final call using `doit()`.
12772/// // Values shown here are possibly random and not representative !
12773/// let result = hub.operations().list("name")
12774///              .return_partial_success(false)
12775///              .page_token("elitr")
12776///              .page_size(-6)
12777///              .filter("diam")
12778///              .doit().await;
12779/// # }
12780/// ```
12781pub struct OperationListCall<'a, C>
12782where
12783    C: 'a,
12784{
12785    hub: &'a Vault<C>,
12786    _name: String,
12787    _return_partial_success: Option<bool>,
12788    _page_token: Option<String>,
12789    _page_size: Option<i32>,
12790    _filter: Option<String>,
12791    _delegate: Option<&'a mut dyn common::Delegate>,
12792    _additional_params: HashMap<String, String>,
12793    _scopes: BTreeSet<String>,
12794}
12795
12796impl<'a, C> common::CallBuilder for OperationListCall<'a, C> {}
12797
12798impl<'a, C> OperationListCall<'a, C>
12799where
12800    C: common::Connector,
12801{
12802    /// Perform the operation you have build so far.
12803    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
12804        use std::borrow::Cow;
12805        use std::io::{Read, Seek};
12806
12807        use common::{url::Params, ToParts};
12808        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12809
12810        let mut dd = common::DefaultDelegate;
12811        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12812        dlg.begin(common::MethodInfo {
12813            id: "vault.operations.list",
12814            http_method: hyper::Method::GET,
12815        });
12816
12817        for &field in [
12818            "alt",
12819            "name",
12820            "returnPartialSuccess",
12821            "pageToken",
12822            "pageSize",
12823            "filter",
12824        ]
12825        .iter()
12826        {
12827            if self._additional_params.contains_key(field) {
12828                dlg.finished(false);
12829                return Err(common::Error::FieldClash(field));
12830            }
12831        }
12832
12833        let mut params = Params::with_capacity(7 + self._additional_params.len());
12834        params.push("name", self._name);
12835        if let Some(value) = self._return_partial_success.as_ref() {
12836            params.push("returnPartialSuccess", value.to_string());
12837        }
12838        if let Some(value) = self._page_token.as_ref() {
12839            params.push("pageToken", value);
12840        }
12841        if let Some(value) = self._page_size.as_ref() {
12842            params.push("pageSize", value.to_string());
12843        }
12844        if let Some(value) = self._filter.as_ref() {
12845            params.push("filter", value);
12846        }
12847
12848        params.extend(self._additional_params.iter());
12849
12850        params.push("alt", "json");
12851        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12852        if self._scopes.is_empty() {
12853            self._scopes
12854                .insert(Scope::EdiscoveryReadonly.as_ref().to_string());
12855        }
12856
12857        #[allow(clippy::single_element_loop)]
12858        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12859            url = params.uri_replacement(url, param_name, find_this, true);
12860        }
12861        {
12862            let to_remove = ["name"];
12863            params.remove_params(&to_remove);
12864        }
12865
12866        let url = params.parse_with_url(&url);
12867
12868        loop {
12869            let token = match self
12870                .hub
12871                .auth
12872                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12873                .await
12874            {
12875                Ok(token) => token,
12876                Err(e) => match dlg.token(e) {
12877                    Ok(token) => token,
12878                    Err(e) => {
12879                        dlg.finished(false);
12880                        return Err(common::Error::MissingToken(e));
12881                    }
12882                },
12883            };
12884            let mut req_result = {
12885                let client = &self.hub.client;
12886                dlg.pre_request();
12887                let mut req_builder = hyper::Request::builder()
12888                    .method(hyper::Method::GET)
12889                    .uri(url.as_str())
12890                    .header(USER_AGENT, self.hub._user_agent.clone());
12891
12892                if let Some(token) = token.as_ref() {
12893                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12894                }
12895
12896                let request = req_builder
12897                    .header(CONTENT_LENGTH, 0_u64)
12898                    .body(common::to_body::<String>(None));
12899
12900                client.request(request.unwrap()).await
12901            };
12902
12903            match req_result {
12904                Err(err) => {
12905                    if let common::Retry::After(d) = dlg.http_error(&err) {
12906                        sleep(d).await;
12907                        continue;
12908                    }
12909                    dlg.finished(false);
12910                    return Err(common::Error::HttpError(err));
12911                }
12912                Ok(res) => {
12913                    let (mut parts, body) = res.into_parts();
12914                    let mut body = common::Body::new(body);
12915                    if !parts.status.is_success() {
12916                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12917                        let error = serde_json::from_str(&common::to_string(&bytes));
12918                        let response = common::to_response(parts, bytes.into());
12919
12920                        if let common::Retry::After(d) =
12921                            dlg.http_failure(&response, error.as_ref().ok())
12922                        {
12923                            sleep(d).await;
12924                            continue;
12925                        }
12926
12927                        dlg.finished(false);
12928
12929                        return Err(match error {
12930                            Ok(value) => common::Error::BadRequest(value),
12931                            _ => common::Error::Failure(response),
12932                        });
12933                    }
12934                    let response = {
12935                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12936                        let encoded = common::to_string(&bytes);
12937                        match serde_json::from_str(&encoded) {
12938                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12939                            Err(error) => {
12940                                dlg.response_json_decode_error(&encoded, &error);
12941                                return Err(common::Error::JsonDecodeError(
12942                                    encoded.to_string(),
12943                                    error,
12944                                ));
12945                            }
12946                        }
12947                    };
12948
12949                    dlg.finished(true);
12950                    return Ok(response);
12951                }
12952            }
12953        }
12954    }
12955
12956    /// The name of the operation's parent resource.
12957    ///
12958    /// Sets the *name* path property to the given value.
12959    ///
12960    /// Even though the property as already been set when instantiating this call,
12961    /// we provide this method for API completeness.
12962    pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C> {
12963        self._name = new_value.to_string();
12964        self
12965    }
12966    /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
12967    ///
12968    /// Sets the *return partial success* query property to the given value.
12969    pub fn return_partial_success(mut self, new_value: bool) -> OperationListCall<'a, C> {
12970        self._return_partial_success = Some(new_value);
12971        self
12972    }
12973    /// The standard list page token.
12974    ///
12975    /// Sets the *page token* query property to the given value.
12976    pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C> {
12977        self._page_token = Some(new_value.to_string());
12978        self
12979    }
12980    /// The standard list page size.
12981    ///
12982    /// Sets the *page size* query property to the given value.
12983    pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C> {
12984        self._page_size = Some(new_value);
12985        self
12986    }
12987    /// The standard list filter.
12988    ///
12989    /// Sets the *filter* query property to the given value.
12990    pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
12991        self._filter = Some(new_value.to_string());
12992        self
12993    }
12994    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12995    /// while executing the actual API request.
12996    ///
12997    /// ````text
12998    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12999    /// ````
13000    ///
13001    /// Sets the *delegate* property to the given value.
13002    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationListCall<'a, C> {
13003        self._delegate = Some(new_value);
13004        self
13005    }
13006
13007    /// Set any additional parameter of the query string used in the request.
13008    /// It should be used to set parameters which are not yet available through their own
13009    /// setters.
13010    ///
13011    /// Please note that this method must not be used to set any of the known parameters
13012    /// which have their own setter method. If done anyway, the request will fail.
13013    ///
13014    /// # Additional Parameters
13015    ///
13016    /// * *$.xgafv* (query-string) - V1 error format.
13017    /// * *access_token* (query-string) - OAuth access token.
13018    /// * *alt* (query-string) - Data format for response.
13019    /// * *callback* (query-string) - JSONP
13020    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13021    /// * *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.
13022    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13023    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13024    /// * *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.
13025    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13026    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13027    pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, C>
13028    where
13029        T: AsRef<str>,
13030    {
13031        self._additional_params
13032            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13033        self
13034    }
13035
13036    /// Identifies the authorization scope for the method you are building.
13037    ///
13038    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13039    /// [`Scope::EdiscoveryReadonly`].
13040    ///
13041    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13042    /// tokens for more than one scope.
13043    ///
13044    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13045    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13046    /// sufficient, a read-write scope will do as well.
13047    pub fn add_scope<St>(mut self, scope: St) -> OperationListCall<'a, C>
13048    where
13049        St: AsRef<str>,
13050    {
13051        self._scopes.insert(String::from(scope.as_ref()));
13052        self
13053    }
13054    /// Identifies the authorization scope(s) for the method you are building.
13055    ///
13056    /// See [`Self::add_scope()`] for details.
13057    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationListCall<'a, C>
13058    where
13059        I: IntoIterator<Item = St>,
13060        St: AsRef<str>,
13061    {
13062        self._scopes
13063            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13064        self
13065    }
13066
13067    /// Removes all scopes, and no default scope will be used either.
13068    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13069    /// for details).
13070    pub fn clear_scopes(mut self) -> OperationListCall<'a, C> {
13071        self._scopes.clear();
13072        self
13073    }
13074}