google_genomics1/
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, edit, configure, and delete your Google Cloud Platform data
17    CloudPlatform,
18
19    /// View and manage Genomics data
20    Full,
21}
22
23impl AsRef<str> for Scope {
24    fn as_ref(&self) -> &str {
25        match *self {
26            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
27            Scope::Full => "https://www.googleapis.com/auth/genomics",
28        }
29    }
30}
31
32#[allow(clippy::derivable_impls)]
33impl Default for Scope {
34    fn default() -> Scope {
35        Scope::Full
36    }
37}
38
39// ########
40// HUB ###
41// ######
42
43/// Central instance to access all Genomics related resource activities
44///
45/// # Examples
46///
47/// Instantiate a new hub
48///
49/// ```test_harness,no_run
50/// extern crate hyper;
51/// extern crate hyper_rustls;
52/// extern crate google_genomics1 as genomics1;
53/// use genomics1::{Result, Error};
54/// # async fn dox() {
55/// use genomics1::{Genomics, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56///
57/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
58/// // `client_secret`, among other things.
59/// let secret: yup_oauth2::ApplicationSecret = Default::default();
60/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
61/// // unless you replace  `None` with the desired Flow.
62/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
63/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
64/// // retrieve them from storage.
65/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
66///     .with_native_roots()
67///     .unwrap()
68///     .https_only()
69///     .enable_http2()
70///     .build();
71///
72/// let executor = hyper_util::rt::TokioExecutor::new();
73/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
74///     secret,
75///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
76///     yup_oauth2::client::CustomHyperClientBuilder::from(
77///         hyper_util::client::legacy::Client::builder(executor).build(connector),
78///     ),
79/// ).build().await.unwrap();
80///
81/// let client = hyper_util::client::legacy::Client::builder(
82///     hyper_util::rt::TokioExecutor::new()
83/// )
84/// .build(
85///     hyper_rustls::HttpsConnectorBuilder::new()
86///         .with_native_roots()
87///         .unwrap()
88///         .https_or_http()
89///         .enable_http2()
90///         .build()
91/// );
92/// let mut hub = Genomics::new(client, auth);
93/// // You can configure optional parameters by calling the respective setters at will, and
94/// // execute the final call using `doit()`.
95/// // Values shown here are possibly random and not representative !
96/// let result = hub.operations().list("name")
97///              .page_token("takimata")
98///              .page_size(-52)
99///              .filter("duo")
100///              .doit().await;
101///
102/// match result {
103///     Err(e) => match e {
104///         // The Error enum provides details about what exactly happened.
105///         // You can also just use its `Debug`, `Display` or `Error` traits
106///          Error::HttpError(_)
107///         |Error::Io(_)
108///         |Error::MissingAPIKey
109///         |Error::MissingToken(_)
110///         |Error::Cancelled
111///         |Error::UploadSizeLimitExceeded(_, _)
112///         |Error::Failure(_)
113///         |Error::BadRequest(_)
114///         |Error::FieldClash(_)
115///         |Error::JsonDecodeError(_, _) => println!("{}", e),
116///     },
117///     Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct Genomics<C> {
123    pub client: common::Client<C>,
124    pub auth: Box<dyn common::GetToken>,
125    _user_agent: String,
126    _base_url: String,
127    _root_url: String,
128}
129
130impl<C> common::Hub for Genomics<C> {}
131
132impl<'a, C> Genomics<C> {
133    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Genomics<C> {
134        Genomics {
135            client,
136            auth: Box::new(auth),
137            _user_agent: "google-api-rust-client/7.0.0".to_string(),
138            _base_url: "https://genomics.googleapis.com/".to_string(),
139            _root_url: "https://genomics.googleapis.com/".to_string(),
140        }
141    }
142
143    pub fn operations(&'a self) -> OperationMethods<'a, C> {
144        OperationMethods { hub: self }
145    }
146
147    /// Set the user-agent header field to use in all requests to the server.
148    /// It defaults to `google-api-rust-client/7.0.0`.
149    ///
150    /// Returns the previously set user-agent.
151    pub fn user_agent(&mut self, agent_name: String) -> String {
152        std::mem::replace(&mut self._user_agent, agent_name)
153    }
154
155    /// Set the base url to use in all requests to the server.
156    /// It defaults to `https://genomics.googleapis.com/`.
157    ///
158    /// Returns the previously set base url.
159    pub fn base_url(&mut self, new_base_url: String) -> String {
160        std::mem::replace(&mut self._base_url, new_base_url)
161    }
162
163    /// Set the root url to use in all requests to the server.
164    /// It defaults to `https://genomics.googleapis.com/`.
165    ///
166    /// Returns the previously set root url.
167    pub fn root_url(&mut self, new_root_url: String) -> String {
168        std::mem::replace(&mut self._root_url, new_root_url)
169    }
170}
171
172// ############
173// SCHEMAS ###
174// ##########
175/// The request message for Operations.CancelOperation.
176///
177/// # Activities
178///
179/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
180/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
181///
182/// * [cancel operations](OperationCancelCall) (request)
183#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
184#[serde_with::serde_as]
185#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
186pub struct CancelOperationRequest {
187    _never_set: Option<bool>,
188}
189
190impl common::RequestValue for CancelOperationRequest {}
191
192/// 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); } The JSON representation for `Empty` is empty JSON object `{}`.
193///
194/// # Activities
195///
196/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
197/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
198///
199/// * [cancel operations](OperationCancelCall) (response)
200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
201#[serde_with::serde_as]
202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
203pub struct Empty {
204    _never_set: Option<bool>,
205}
206
207impl common::ResponseResult for Empty {}
208
209/// The response message for Operations.ListOperations.
210///
211/// # Activities
212///
213/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
214/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
215///
216/// * [list operations](OperationListCall) (response)
217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
218#[serde_with::serde_as]
219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
220pub struct ListOperationsResponse {
221    /// The standard List next-page token.
222    #[serde(rename = "nextPageToken")]
223    pub next_page_token: Option<String>,
224    /// A list of operations that matches the specified filter in the request.
225    pub operations: Option<Vec<Operation>>,
226}
227
228impl common::ResponseResult for ListOperationsResponse {}
229
230/// This resource represents a long-running operation that is the result of a network API call.
231///
232/// # Activities
233///
234/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
235/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
236///
237/// * [cancel operations](OperationCancelCall) (none)
238/// * [get operations](OperationGetCall) (response)
239/// * [list operations](OperationListCall) (none)
240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
241#[serde_with::serde_as]
242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
243pub struct Operation {
244    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
245    pub done: Option<bool>,
246    /// The error result of the operation in case of failure or cancellation.
247    pub error: Option<Status>,
248    /// An OperationMetadata or Metadata object. This will always be returned with the Operation.
249    pub metadata: Option<HashMap<String, serde_json::Value>>,
250    /// The server-assigned name, which is only unique within the same service that originally returns it. For example: `operations/CJHU7Oi_ChDrveSpBRjfuL-qzoWAgEw`
251    pub name: Option<String>,
252    /// An Empty object.
253    pub response: Option<HashMap<String, serde_json::Value>>,
254}
255
256impl common::Resource for Operation {}
257impl common::ResponseResult for Operation {}
258
259/// 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).
260///
261/// This type is not used in any activity, and only used as *part* of another schema.
262///
263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
264#[serde_with::serde_as]
265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
266pub struct Status {
267    /// The status code, which should be an enum value of google.rpc.Code.
268    pub code: Option<i32>,
269    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
270    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
271    /// 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.
272    pub message: Option<String>,
273}
274
275impl common::Part for Status {}
276
277// ###################
278// MethodBuilders ###
279// #################
280
281/// A builder providing access to all methods supported on *operation* resources.
282/// It is not used directly, but through the [`Genomics`] hub.
283///
284/// # Example
285///
286/// Instantiate a resource builder
287///
288/// ```test_harness,no_run
289/// extern crate hyper;
290/// extern crate hyper_rustls;
291/// extern crate google_genomics1 as genomics1;
292///
293/// # async fn dox() {
294/// use genomics1::{Genomics, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
295///
296/// let secret: yup_oauth2::ApplicationSecret = Default::default();
297/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
298///     .with_native_roots()
299///     .unwrap()
300///     .https_only()
301///     .enable_http2()
302///     .build();
303///
304/// let executor = hyper_util::rt::TokioExecutor::new();
305/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
306///     secret,
307///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
308///     yup_oauth2::client::CustomHyperClientBuilder::from(
309///         hyper_util::client::legacy::Client::builder(executor).build(connector),
310///     ),
311/// ).build().await.unwrap();
312///
313/// let client = hyper_util::client::legacy::Client::builder(
314///     hyper_util::rt::TokioExecutor::new()
315/// )
316/// .build(
317///     hyper_rustls::HttpsConnectorBuilder::new()
318///         .with_native_roots()
319///         .unwrap()
320///         .https_or_http()
321///         .enable_http2()
322///         .build()
323/// );
324/// let mut hub = Genomics::new(client, auth);
325/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
326/// // like `cancel(...)`, `get(...)` and `list(...)`
327/// // to build up your call.
328/// let rb = hub.operations();
329/// # }
330/// ```
331pub struct OperationMethods<'a, C>
332where
333    C: 'a,
334{
335    hub: &'a Genomics<C>,
336}
337
338impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
339
340impl<'a, C> OperationMethods<'a, C> {
341    /// Create a builder to help you perform the following task:
342    ///
343    /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients may use Operations.GetOperation or Operations.ListOperations to check whether the cancellation succeeded or the operation completed despite cancellation. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: * `genomics.operations.cancel`
344    ///
345    /// # Arguments
346    ///
347    /// * `request` - No description provided.
348    /// * `name` - The name of the operation resource to be cancelled.
349    pub fn cancel(
350        &self,
351        request: CancelOperationRequest,
352        name: &str,
353    ) -> OperationCancelCall<'a, C> {
354        OperationCancelCall {
355            hub: self.hub,
356            _request: request,
357            _name: name.to_string(),
358            _delegate: Default::default(),
359            _additional_params: Default::default(),
360            _scopes: Default::default(),
361        }
362    }
363
364    /// Create a builder to help you perform the following task:
365    ///
366    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: * `genomics.operations.get`
367    ///
368    /// # Arguments
369    ///
370    /// * `name` - The name of the operation resource.
371    pub fn get(&self, name: &str) -> OperationGetCall<'a, C> {
372        OperationGetCall {
373            hub: self.hub,
374            _name: name.to_string(),
375            _delegate: Default::default(),
376            _additional_params: Default::default(),
377            _scopes: Default::default(),
378        }
379    }
380
381    /// Create a builder to help you perform the following task:
382    ///
383    /// Lists operations that match the specified filter in the request. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: * `genomics.operations.list`
384    ///
385    /// # Arguments
386    ///
387    /// * `name` - The name of the operation's parent resource.
388    pub fn list(&self, name: &str) -> OperationListCall<'a, C> {
389        OperationListCall {
390            hub: self.hub,
391            _name: name.to_string(),
392            _page_token: Default::default(),
393            _page_size: Default::default(),
394            _filter: Default::default(),
395            _delegate: Default::default(),
396            _additional_params: Default::default(),
397            _scopes: Default::default(),
398        }
399    }
400}
401
402// ###################
403// CallBuilders   ###
404// #################
405
406/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients may use Operations.GetOperation or Operations.ListOperations to check whether the cancellation succeeded or the operation completed despite cancellation. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: * `genomics.operations.cancel`
407///
408/// A builder for the *cancel* method supported by a *operation* resource.
409/// It is not used directly, but through a [`OperationMethods`] instance.
410///
411/// # Example
412///
413/// Instantiate a resource method builder
414///
415/// ```test_harness,no_run
416/// # extern crate hyper;
417/// # extern crate hyper_rustls;
418/// # extern crate google_genomics1 as genomics1;
419/// use genomics1::api::CancelOperationRequest;
420/// # async fn dox() {
421/// # use genomics1::{Genomics, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
422///
423/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
424/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
425/// #     .with_native_roots()
426/// #     .unwrap()
427/// #     .https_only()
428/// #     .enable_http2()
429/// #     .build();
430///
431/// # let executor = hyper_util::rt::TokioExecutor::new();
432/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
433/// #     secret,
434/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
435/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
436/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
437/// #     ),
438/// # ).build().await.unwrap();
439///
440/// # let client = hyper_util::client::legacy::Client::builder(
441/// #     hyper_util::rt::TokioExecutor::new()
442/// # )
443/// # .build(
444/// #     hyper_rustls::HttpsConnectorBuilder::new()
445/// #         .with_native_roots()
446/// #         .unwrap()
447/// #         .https_or_http()
448/// #         .enable_http2()
449/// #         .build()
450/// # );
451/// # let mut hub = Genomics::new(client, auth);
452/// // As the method needs a request, you would usually fill it with the desired information
453/// // into the respective structure. Some of the parts shown here might not be applicable !
454/// // Values shown here are possibly random and not representative !
455/// let mut req = CancelOperationRequest::default();
456///
457/// // You can configure optional parameters by calling the respective setters at will, and
458/// // execute the final call using `doit()`.
459/// // Values shown here are possibly random and not representative !
460/// let result = hub.operations().cancel(req, "name")
461///              .doit().await;
462/// # }
463/// ```
464pub struct OperationCancelCall<'a, C>
465where
466    C: 'a,
467{
468    hub: &'a Genomics<C>,
469    _request: CancelOperationRequest,
470    _name: String,
471    _delegate: Option<&'a mut dyn common::Delegate>,
472    _additional_params: HashMap<String, String>,
473    _scopes: BTreeSet<String>,
474}
475
476impl<'a, C> common::CallBuilder for OperationCancelCall<'a, C> {}
477
478impl<'a, C> OperationCancelCall<'a, C>
479where
480    C: common::Connector,
481{
482    /// Perform the operation you have build so far.
483    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
484        use std::borrow::Cow;
485        use std::io::{Read, Seek};
486
487        use common::{url::Params, ToParts};
488        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
489
490        let mut dd = common::DefaultDelegate;
491        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
492        dlg.begin(common::MethodInfo {
493            id: "genomics.operations.cancel",
494            http_method: hyper::Method::POST,
495        });
496
497        for &field in ["alt", "name"].iter() {
498            if self._additional_params.contains_key(field) {
499                dlg.finished(false);
500                return Err(common::Error::FieldClash(field));
501            }
502        }
503
504        let mut params = Params::with_capacity(4 + self._additional_params.len());
505        params.push("name", self._name);
506
507        params.extend(self._additional_params.iter());
508
509        params.push("alt", "json");
510        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
511        if self._scopes.is_empty() {
512            self._scopes
513                .insert(Scope::CloudPlatform.as_ref().to_string());
514        }
515
516        #[allow(clippy::single_element_loop)]
517        for &(find_this, param_name) in [("{+name}", "name")].iter() {
518            url = params.uri_replacement(url, param_name, find_this, true);
519        }
520        {
521            let to_remove = ["name"];
522            params.remove_params(&to_remove);
523        }
524
525        let url = params.parse_with_url(&url);
526
527        let mut json_mime_type = mime::APPLICATION_JSON;
528        let mut request_value_reader = {
529            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
530            common::remove_json_null_values(&mut value);
531            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
532            serde_json::to_writer(&mut dst, &value).unwrap();
533            dst
534        };
535        let request_size = request_value_reader
536            .seek(std::io::SeekFrom::End(0))
537            .unwrap();
538        request_value_reader
539            .seek(std::io::SeekFrom::Start(0))
540            .unwrap();
541
542        loop {
543            let token = match self
544                .hub
545                .auth
546                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
547                .await
548            {
549                Ok(token) => token,
550                Err(e) => match dlg.token(e) {
551                    Ok(token) => token,
552                    Err(e) => {
553                        dlg.finished(false);
554                        return Err(common::Error::MissingToken(e));
555                    }
556                },
557            };
558            request_value_reader
559                .seek(std::io::SeekFrom::Start(0))
560                .unwrap();
561            let mut req_result = {
562                let client = &self.hub.client;
563                dlg.pre_request();
564                let mut req_builder = hyper::Request::builder()
565                    .method(hyper::Method::POST)
566                    .uri(url.as_str())
567                    .header(USER_AGENT, self.hub._user_agent.clone());
568
569                if let Some(token) = token.as_ref() {
570                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
571                }
572
573                let request = req_builder
574                    .header(CONTENT_TYPE, json_mime_type.to_string())
575                    .header(CONTENT_LENGTH, request_size as u64)
576                    .body(common::to_body(
577                        request_value_reader.get_ref().clone().into(),
578                    ));
579
580                client.request(request.unwrap()).await
581            };
582
583            match req_result {
584                Err(err) => {
585                    if let common::Retry::After(d) = dlg.http_error(&err) {
586                        sleep(d).await;
587                        continue;
588                    }
589                    dlg.finished(false);
590                    return Err(common::Error::HttpError(err));
591                }
592                Ok(res) => {
593                    let (mut parts, body) = res.into_parts();
594                    let mut body = common::Body::new(body);
595                    if !parts.status.is_success() {
596                        let bytes = common::to_bytes(body).await.unwrap_or_default();
597                        let error = serde_json::from_str(&common::to_string(&bytes));
598                        let response = common::to_response(parts, bytes.into());
599
600                        if let common::Retry::After(d) =
601                            dlg.http_failure(&response, error.as_ref().ok())
602                        {
603                            sleep(d).await;
604                            continue;
605                        }
606
607                        dlg.finished(false);
608
609                        return Err(match error {
610                            Ok(value) => common::Error::BadRequest(value),
611                            _ => common::Error::Failure(response),
612                        });
613                    }
614                    let response = {
615                        let bytes = common::to_bytes(body).await.unwrap_or_default();
616                        let encoded = common::to_string(&bytes);
617                        match serde_json::from_str(&encoded) {
618                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
619                            Err(error) => {
620                                dlg.response_json_decode_error(&encoded, &error);
621                                return Err(common::Error::JsonDecodeError(
622                                    encoded.to_string(),
623                                    error,
624                                ));
625                            }
626                        }
627                    };
628
629                    dlg.finished(true);
630                    return Ok(response);
631                }
632            }
633        }
634    }
635
636    ///
637    /// Sets the *request* property to the given value.
638    ///
639    /// Even though the property as already been set when instantiating this call,
640    /// we provide this method for API completeness.
641    pub fn request(mut self, new_value: CancelOperationRequest) -> OperationCancelCall<'a, C> {
642        self._request = new_value;
643        self
644    }
645    /// The name of the operation resource to be cancelled.
646    ///
647    /// Sets the *name* path property to the given value.
648    ///
649    /// Even though the property as already been set when instantiating this call,
650    /// we provide this method for API completeness.
651    pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, C> {
652        self._name = new_value.to_string();
653        self
654    }
655    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
656    /// while executing the actual API request.
657    ///
658    /// ````text
659    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
660    /// ````
661    ///
662    /// Sets the *delegate* property to the given value.
663    pub fn delegate(
664        mut self,
665        new_value: &'a mut dyn common::Delegate,
666    ) -> OperationCancelCall<'a, C> {
667        self._delegate = Some(new_value);
668        self
669    }
670
671    /// Set any additional parameter of the query string used in the request.
672    /// It should be used to set parameters which are not yet available through their own
673    /// setters.
674    ///
675    /// Please note that this method must not be used to set any of the known parameters
676    /// which have their own setter method. If done anyway, the request will fail.
677    ///
678    /// # Additional Parameters
679    ///
680    /// * *$.xgafv* (query-string) - V1 error format.
681    /// * *access_token* (query-string) - OAuth access token.
682    /// * *alt* (query-string) - Data format for response.
683    /// * *callback* (query-string) - JSONP
684    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
685    /// * *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.
686    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
687    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
688    /// * *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.
689    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
690    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
691    pub fn param<T>(mut self, name: T, value: T) -> OperationCancelCall<'a, C>
692    where
693        T: AsRef<str>,
694    {
695        self._additional_params
696            .insert(name.as_ref().to_string(), value.as_ref().to_string());
697        self
698    }
699
700    /// Identifies the authorization scope for the method you are building.
701    ///
702    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
703    /// [`Scope::CloudPlatform`].
704    ///
705    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
706    /// tokens for more than one scope.
707    ///
708    /// Usually there is more than one suitable scope to authorize an operation, some of which may
709    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
710    /// sufficient, a read-write scope will do as well.
711    pub fn add_scope<St>(mut self, scope: St) -> OperationCancelCall<'a, C>
712    where
713        St: AsRef<str>,
714    {
715        self._scopes.insert(String::from(scope.as_ref()));
716        self
717    }
718    /// Identifies the authorization scope(s) for the method you are building.
719    ///
720    /// See [`Self::add_scope()`] for details.
721    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationCancelCall<'a, C>
722    where
723        I: IntoIterator<Item = St>,
724        St: AsRef<str>,
725    {
726        self._scopes
727            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
728        self
729    }
730
731    /// Removes all scopes, and no default scope will be used either.
732    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
733    /// for details).
734    pub fn clear_scopes(mut self) -> OperationCancelCall<'a, C> {
735        self._scopes.clear();
736        self
737    }
738}
739
740/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: * `genomics.operations.get`
741///
742/// A builder for the *get* method supported by a *operation* resource.
743/// It is not used directly, but through a [`OperationMethods`] instance.
744///
745/// # Example
746///
747/// Instantiate a resource method builder
748///
749/// ```test_harness,no_run
750/// # extern crate hyper;
751/// # extern crate hyper_rustls;
752/// # extern crate google_genomics1 as genomics1;
753/// # async fn dox() {
754/// # use genomics1::{Genomics, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
755///
756/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
757/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
758/// #     .with_native_roots()
759/// #     .unwrap()
760/// #     .https_only()
761/// #     .enable_http2()
762/// #     .build();
763///
764/// # let executor = hyper_util::rt::TokioExecutor::new();
765/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
766/// #     secret,
767/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
768/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
769/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
770/// #     ),
771/// # ).build().await.unwrap();
772///
773/// # let client = hyper_util::client::legacy::Client::builder(
774/// #     hyper_util::rt::TokioExecutor::new()
775/// # )
776/// # .build(
777/// #     hyper_rustls::HttpsConnectorBuilder::new()
778/// #         .with_native_roots()
779/// #         .unwrap()
780/// #         .https_or_http()
781/// #         .enable_http2()
782/// #         .build()
783/// # );
784/// # let mut hub = Genomics::new(client, auth);
785/// // You can configure optional parameters by calling the respective setters at will, and
786/// // execute the final call using `doit()`.
787/// // Values shown here are possibly random and not representative !
788/// let result = hub.operations().get("name")
789///              .doit().await;
790/// # }
791/// ```
792pub struct OperationGetCall<'a, C>
793where
794    C: 'a,
795{
796    hub: &'a Genomics<C>,
797    _name: String,
798    _delegate: Option<&'a mut dyn common::Delegate>,
799    _additional_params: HashMap<String, String>,
800    _scopes: BTreeSet<String>,
801}
802
803impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
804
805impl<'a, C> OperationGetCall<'a, C>
806where
807    C: common::Connector,
808{
809    /// Perform the operation you have build so far.
810    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
811        use std::borrow::Cow;
812        use std::io::{Read, Seek};
813
814        use common::{url::Params, ToParts};
815        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
816
817        let mut dd = common::DefaultDelegate;
818        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
819        dlg.begin(common::MethodInfo {
820            id: "genomics.operations.get",
821            http_method: hyper::Method::GET,
822        });
823
824        for &field in ["alt", "name"].iter() {
825            if self._additional_params.contains_key(field) {
826                dlg.finished(false);
827                return Err(common::Error::FieldClash(field));
828            }
829        }
830
831        let mut params = Params::with_capacity(3 + self._additional_params.len());
832        params.push("name", self._name);
833
834        params.extend(self._additional_params.iter());
835
836        params.push("alt", "json");
837        let mut url = self.hub._base_url.clone() + "v1/{+name}";
838        if self._scopes.is_empty() {
839            self._scopes
840                .insert(Scope::CloudPlatform.as_ref().to_string());
841        }
842
843        #[allow(clippy::single_element_loop)]
844        for &(find_this, param_name) in [("{+name}", "name")].iter() {
845            url = params.uri_replacement(url, param_name, find_this, true);
846        }
847        {
848            let to_remove = ["name"];
849            params.remove_params(&to_remove);
850        }
851
852        let url = params.parse_with_url(&url);
853
854        loop {
855            let token = match self
856                .hub
857                .auth
858                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
859                .await
860            {
861                Ok(token) => token,
862                Err(e) => match dlg.token(e) {
863                    Ok(token) => token,
864                    Err(e) => {
865                        dlg.finished(false);
866                        return Err(common::Error::MissingToken(e));
867                    }
868                },
869            };
870            let mut req_result = {
871                let client = &self.hub.client;
872                dlg.pre_request();
873                let mut req_builder = hyper::Request::builder()
874                    .method(hyper::Method::GET)
875                    .uri(url.as_str())
876                    .header(USER_AGENT, self.hub._user_agent.clone());
877
878                if let Some(token) = token.as_ref() {
879                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
880                }
881
882                let request = req_builder
883                    .header(CONTENT_LENGTH, 0_u64)
884                    .body(common::to_body::<String>(None));
885
886                client.request(request.unwrap()).await
887            };
888
889            match req_result {
890                Err(err) => {
891                    if let common::Retry::After(d) = dlg.http_error(&err) {
892                        sleep(d).await;
893                        continue;
894                    }
895                    dlg.finished(false);
896                    return Err(common::Error::HttpError(err));
897                }
898                Ok(res) => {
899                    let (mut parts, body) = res.into_parts();
900                    let mut body = common::Body::new(body);
901                    if !parts.status.is_success() {
902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
903                        let error = serde_json::from_str(&common::to_string(&bytes));
904                        let response = common::to_response(parts, bytes.into());
905
906                        if let common::Retry::After(d) =
907                            dlg.http_failure(&response, error.as_ref().ok())
908                        {
909                            sleep(d).await;
910                            continue;
911                        }
912
913                        dlg.finished(false);
914
915                        return Err(match error {
916                            Ok(value) => common::Error::BadRequest(value),
917                            _ => common::Error::Failure(response),
918                        });
919                    }
920                    let response = {
921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
922                        let encoded = common::to_string(&bytes);
923                        match serde_json::from_str(&encoded) {
924                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
925                            Err(error) => {
926                                dlg.response_json_decode_error(&encoded, &error);
927                                return Err(common::Error::JsonDecodeError(
928                                    encoded.to_string(),
929                                    error,
930                                ));
931                            }
932                        }
933                    };
934
935                    dlg.finished(true);
936                    return Ok(response);
937                }
938            }
939        }
940    }
941
942    /// The name of the operation resource.
943    ///
944    /// Sets the *name* path property to the given value.
945    ///
946    /// Even though the property as already been set when instantiating this call,
947    /// we provide this method for API completeness.
948    pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C> {
949        self._name = new_value.to_string();
950        self
951    }
952    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
953    /// while executing the actual API request.
954    ///
955    /// ````text
956    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
957    /// ````
958    ///
959    /// Sets the *delegate* property to the given value.
960    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
961        self._delegate = Some(new_value);
962        self
963    }
964
965    /// Set any additional parameter of the query string used in the request.
966    /// It should be used to set parameters which are not yet available through their own
967    /// setters.
968    ///
969    /// Please note that this method must not be used to set any of the known parameters
970    /// which have their own setter method. If done anyway, the request will fail.
971    ///
972    /// # Additional Parameters
973    ///
974    /// * *$.xgafv* (query-string) - V1 error format.
975    /// * *access_token* (query-string) - OAuth access token.
976    /// * *alt* (query-string) - Data format for response.
977    /// * *callback* (query-string) - JSONP
978    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
979    /// * *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.
980    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
981    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
982    /// * *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.
983    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
984    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
985    pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
986    where
987        T: AsRef<str>,
988    {
989        self._additional_params
990            .insert(name.as_ref().to_string(), value.as_ref().to_string());
991        self
992    }
993
994    /// Identifies the authorization scope for the method you are building.
995    ///
996    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
997    /// [`Scope::CloudPlatform`].
998    ///
999    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1000    /// tokens for more than one scope.
1001    ///
1002    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1003    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1004    /// sufficient, a read-write scope will do as well.
1005    pub fn add_scope<St>(mut self, scope: St) -> OperationGetCall<'a, C>
1006    where
1007        St: AsRef<str>,
1008    {
1009        self._scopes.insert(String::from(scope.as_ref()));
1010        self
1011    }
1012    /// Identifies the authorization scope(s) for the method you are building.
1013    ///
1014    /// See [`Self::add_scope()`] for details.
1015    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationGetCall<'a, C>
1016    where
1017        I: IntoIterator<Item = St>,
1018        St: AsRef<str>,
1019    {
1020        self._scopes
1021            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1022        self
1023    }
1024
1025    /// Removes all scopes, and no default scope will be used either.
1026    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1027    /// for details).
1028    pub fn clear_scopes(mut self) -> OperationGetCall<'a, C> {
1029        self._scopes.clear();
1030        self
1031    }
1032}
1033
1034/// Lists operations that match the specified filter in the request. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: * `genomics.operations.list`
1035///
1036/// A builder for the *list* method supported by a *operation* resource.
1037/// It is not used directly, but through a [`OperationMethods`] instance.
1038///
1039/// # Example
1040///
1041/// Instantiate a resource method builder
1042///
1043/// ```test_harness,no_run
1044/// # extern crate hyper;
1045/// # extern crate hyper_rustls;
1046/// # extern crate google_genomics1 as genomics1;
1047/// # async fn dox() {
1048/// # use genomics1::{Genomics, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1049///
1050/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1051/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1052/// #     .with_native_roots()
1053/// #     .unwrap()
1054/// #     .https_only()
1055/// #     .enable_http2()
1056/// #     .build();
1057///
1058/// # let executor = hyper_util::rt::TokioExecutor::new();
1059/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1060/// #     secret,
1061/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1062/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1063/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1064/// #     ),
1065/// # ).build().await.unwrap();
1066///
1067/// # let client = hyper_util::client::legacy::Client::builder(
1068/// #     hyper_util::rt::TokioExecutor::new()
1069/// # )
1070/// # .build(
1071/// #     hyper_rustls::HttpsConnectorBuilder::new()
1072/// #         .with_native_roots()
1073/// #         .unwrap()
1074/// #         .https_or_http()
1075/// #         .enable_http2()
1076/// #         .build()
1077/// # );
1078/// # let mut hub = Genomics::new(client, auth);
1079/// // You can configure optional parameters by calling the respective setters at will, and
1080/// // execute the final call using `doit()`.
1081/// // Values shown here are possibly random and not representative !
1082/// let result = hub.operations().list("name")
1083///              .page_token("gubergren")
1084///              .page_size(-75)
1085///              .filter("dolor")
1086///              .doit().await;
1087/// # }
1088/// ```
1089pub struct OperationListCall<'a, C>
1090where
1091    C: 'a,
1092{
1093    hub: &'a Genomics<C>,
1094    _name: String,
1095    _page_token: Option<String>,
1096    _page_size: Option<i32>,
1097    _filter: Option<String>,
1098    _delegate: Option<&'a mut dyn common::Delegate>,
1099    _additional_params: HashMap<String, String>,
1100    _scopes: BTreeSet<String>,
1101}
1102
1103impl<'a, C> common::CallBuilder for OperationListCall<'a, C> {}
1104
1105impl<'a, C> OperationListCall<'a, C>
1106where
1107    C: common::Connector,
1108{
1109    /// Perform the operation you have build so far.
1110    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
1111        use std::borrow::Cow;
1112        use std::io::{Read, Seek};
1113
1114        use common::{url::Params, ToParts};
1115        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1116
1117        let mut dd = common::DefaultDelegate;
1118        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1119        dlg.begin(common::MethodInfo {
1120            id: "genomics.operations.list",
1121            http_method: hyper::Method::GET,
1122        });
1123
1124        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
1125            if self._additional_params.contains_key(field) {
1126                dlg.finished(false);
1127                return Err(common::Error::FieldClash(field));
1128            }
1129        }
1130
1131        let mut params = Params::with_capacity(6 + self._additional_params.len());
1132        params.push("name", self._name);
1133        if let Some(value) = self._page_token.as_ref() {
1134            params.push("pageToken", value);
1135        }
1136        if let Some(value) = self._page_size.as_ref() {
1137            params.push("pageSize", value.to_string());
1138        }
1139        if let Some(value) = self._filter.as_ref() {
1140            params.push("filter", value);
1141        }
1142
1143        params.extend(self._additional_params.iter());
1144
1145        params.push("alt", "json");
1146        let mut url = self.hub._base_url.clone() + "v1/{+name}";
1147        if self._scopes.is_empty() {
1148            self._scopes
1149                .insert(Scope::CloudPlatform.as_ref().to_string());
1150        }
1151
1152        #[allow(clippy::single_element_loop)]
1153        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1154            url = params.uri_replacement(url, param_name, find_this, true);
1155        }
1156        {
1157            let to_remove = ["name"];
1158            params.remove_params(&to_remove);
1159        }
1160
1161        let url = params.parse_with_url(&url);
1162
1163        loop {
1164            let token = match self
1165                .hub
1166                .auth
1167                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1168                .await
1169            {
1170                Ok(token) => token,
1171                Err(e) => match dlg.token(e) {
1172                    Ok(token) => token,
1173                    Err(e) => {
1174                        dlg.finished(false);
1175                        return Err(common::Error::MissingToken(e));
1176                    }
1177                },
1178            };
1179            let mut req_result = {
1180                let client = &self.hub.client;
1181                dlg.pre_request();
1182                let mut req_builder = hyper::Request::builder()
1183                    .method(hyper::Method::GET)
1184                    .uri(url.as_str())
1185                    .header(USER_AGENT, self.hub._user_agent.clone());
1186
1187                if let Some(token) = token.as_ref() {
1188                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1189                }
1190
1191                let request = req_builder
1192                    .header(CONTENT_LENGTH, 0_u64)
1193                    .body(common::to_body::<String>(None));
1194
1195                client.request(request.unwrap()).await
1196            };
1197
1198            match req_result {
1199                Err(err) => {
1200                    if let common::Retry::After(d) = dlg.http_error(&err) {
1201                        sleep(d).await;
1202                        continue;
1203                    }
1204                    dlg.finished(false);
1205                    return Err(common::Error::HttpError(err));
1206                }
1207                Ok(res) => {
1208                    let (mut parts, body) = res.into_parts();
1209                    let mut body = common::Body::new(body);
1210                    if !parts.status.is_success() {
1211                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1212                        let error = serde_json::from_str(&common::to_string(&bytes));
1213                        let response = common::to_response(parts, bytes.into());
1214
1215                        if let common::Retry::After(d) =
1216                            dlg.http_failure(&response, error.as_ref().ok())
1217                        {
1218                            sleep(d).await;
1219                            continue;
1220                        }
1221
1222                        dlg.finished(false);
1223
1224                        return Err(match error {
1225                            Ok(value) => common::Error::BadRequest(value),
1226                            _ => common::Error::Failure(response),
1227                        });
1228                    }
1229                    let response = {
1230                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1231                        let encoded = common::to_string(&bytes);
1232                        match serde_json::from_str(&encoded) {
1233                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1234                            Err(error) => {
1235                                dlg.response_json_decode_error(&encoded, &error);
1236                                return Err(common::Error::JsonDecodeError(
1237                                    encoded.to_string(),
1238                                    error,
1239                                ));
1240                            }
1241                        }
1242                    };
1243
1244                    dlg.finished(true);
1245                    return Ok(response);
1246                }
1247            }
1248        }
1249    }
1250
1251    /// The name of the operation's parent resource.
1252    ///
1253    /// Sets the *name* path property to the given value.
1254    ///
1255    /// Even though the property as already been set when instantiating this call,
1256    /// we provide this method for API completeness.
1257    pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C> {
1258        self._name = new_value.to_string();
1259        self
1260    }
1261    /// The standard list page token.
1262    ///
1263    /// Sets the *page token* query property to the given value.
1264    pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C> {
1265        self._page_token = Some(new_value.to_string());
1266        self
1267    }
1268    /// The maximum number of results to return. The maximum value is 256.
1269    ///
1270    /// Sets the *page size* query property to the given value.
1271    pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C> {
1272        self._page_size = Some(new_value);
1273        self
1274    }
1275    /// A string for filtering Operations. In v2alpha1, the following filter fields are supported: * createTime: The time this job was created * events: The set of event (names) that have occurred while running the pipeline. The : operator can be used to determine if a particular event has occurred. * error: If the pipeline is running, this value is NULL. Once the pipeline finishes, the value is the standard Google error code. * labels.key or labels."key with space" where key is a label key. * done: If the pipeline is running, this value is false. Once the pipeline finishes, the value is true. In v1 and v1alpha2, the following filter fields are supported: * projectId: Required. Corresponds to OperationMetadata.projectId. * createTime: The time this job was created, in seconds from the [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `>=` and/or `<=` operators. * status: Can be `RUNNING`, `SUCCESS`, `FAILURE`, or `CANCELED`. Only one status may be specified. * labels.key where key is a label key. Examples: * `projectId = my-project AND createTime >= 1432140000` * `projectId = my-project AND createTime >= 1432140000 AND createTime <= 1432150000 AND status = RUNNING` * `projectId = my-project AND labels.color = *` * `projectId = my-project AND labels.color = red`
1276    ///
1277    /// Sets the *filter* query property to the given value.
1278    pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
1279        self._filter = Some(new_value.to_string());
1280        self
1281    }
1282    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1283    /// while executing the actual API request.
1284    ///
1285    /// ````text
1286    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1287    /// ````
1288    ///
1289    /// Sets the *delegate* property to the given value.
1290    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationListCall<'a, C> {
1291        self._delegate = Some(new_value);
1292        self
1293    }
1294
1295    /// Set any additional parameter of the query string used in the request.
1296    /// It should be used to set parameters which are not yet available through their own
1297    /// setters.
1298    ///
1299    /// Please note that this method must not be used to set any of the known parameters
1300    /// which have their own setter method. If done anyway, the request will fail.
1301    ///
1302    /// # Additional Parameters
1303    ///
1304    /// * *$.xgafv* (query-string) - V1 error format.
1305    /// * *access_token* (query-string) - OAuth access token.
1306    /// * *alt* (query-string) - Data format for response.
1307    /// * *callback* (query-string) - JSONP
1308    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1309    /// * *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.
1310    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1311    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1312    /// * *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.
1313    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1314    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1315    pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, C>
1316    where
1317        T: AsRef<str>,
1318    {
1319        self._additional_params
1320            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1321        self
1322    }
1323
1324    /// Identifies the authorization scope for the method you are building.
1325    ///
1326    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1327    /// [`Scope::CloudPlatform`].
1328    ///
1329    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1330    /// tokens for more than one scope.
1331    ///
1332    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1333    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1334    /// sufficient, a read-write scope will do as well.
1335    pub fn add_scope<St>(mut self, scope: St) -> OperationListCall<'a, C>
1336    where
1337        St: AsRef<str>,
1338    {
1339        self._scopes.insert(String::from(scope.as_ref()));
1340        self
1341    }
1342    /// Identifies the authorization scope(s) for the method you are building.
1343    ///
1344    /// See [`Self::add_scope()`] for details.
1345    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationListCall<'a, C>
1346    where
1347        I: IntoIterator<Item = St>,
1348        St: AsRef<str>,
1349    {
1350        self._scopes
1351            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1352        self
1353    }
1354
1355    /// Removes all scopes, and no default scope will be used either.
1356    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1357    /// for details).
1358    pub fn clear_scopes(mut self) -> OperationListCall<'a, C> {
1359        self._scopes.clear();
1360        self
1361    }
1362}