Skip to main content

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